From b423ccc70198d2a73f991fc5a55f089d9e195082 Mon Sep 17 00:00:00 2001 From: jrags <> Date: Mon, 6 Mar 2006 02:38:22 +0000 Subject: Updated Hangman to use view controls --- .../pages/Fundamentals/Samples/Hangman/Home.php | 27 +++++++++------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php') diff --git a/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php b/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php index cbbd1c56..1d78186d 100644 --- a/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php +++ b/demos/quickstart/protected/pages/Fundamentals/Samples/Hangman/Home.php @@ -1,7 +1,12 @@ IsPostBack) + $this->GameMultiView->ActiveView=$this->IntroView; + } + public function selectLevel($sender,$param) { if(($selection=$this->LevelSelection->SelectedValue)==='') @@ -10,11 +15,11 @@ class Home extends TPage return; } else - $this->Level=TPropertyValue::ensureInteger($selection); + $this->Level=TPropertyValue::ensureInteger($selection); $this->Word=$this->generateWord(); $this->GuessWord=str_repeat('_',strlen($this->Word)); $this->Misses=0; - $this->showPanel('GuessPanel'); + $this->GameMultiView->ActiveView=$this->GuessView; } public function guessWord($sender,$param) @@ -35,7 +40,7 @@ class Home extends TPage { $this->GuessWord=$guessWord; if($guessWord===$word) - $this->showPanel('WinPanel'); + $this->GameMultiView->ActiveView=$this->WinView; } else { @@ -47,12 +52,12 @@ class Home extends TPage public function giveUp($sender,$param) { - $this->showPanel('LosePanel'); + $this->GameMultiView->ActiveView=$this->LoseView; } public function startAgain($sender,$param) { - $this->showPanel('IntroPanel'); + $this->GameMultiView->ActiveView=$this->IntroView; $this->LevelError->Visible=false; for($letter=65;$letter<=90;++$letter) { @@ -73,15 +78,6 @@ class Home extends TPage return strtoupper($word); } - protected function showPanel($panelID) - { - $this->IntroPanel->Visible=false; - $this->GuessPanel->Visible=false; - $this->WinPanel->Visible=false; - $this->LosePanel->Visible=false; - $this->$panelID->Visible=true; - } - public function setLevel($value) { $this->setViewState('Level',$value,0); @@ -122,5 +118,4 @@ class Home extends TPage return $this->getViewState('Misses',0); } } - ?> \ No newline at end of file -- cgit v1.2.3