Skip to content
Jeppe Zapp edited this page Feb 6, 2014 · 17 revisions

The object to hold all widgets on the current screen.

Variables

Variable Type
pageName string Name of the page

Methods

Method Return type
StartPage void The page is initialized
UpdatePage void The OGRoot is updated
ExitPage void The page is switched away from
ResetStyles void Gets default styles for every widget on the current screen

Example

The best way to use pages is to create a new subclass of OGPage

#pragma strict

public class MyPage extends OGPage {
   public var welcome : OGLabel;   
   public var button : OGButton;

   private var visitCounter : int = 0;

   public function SwitchPage () {
      OGRoot.GoToPage ( "MyOtherPage" );
   }

   override function StartPage () {
      welcome.text = "Welcome! You have been here " + visitCounter + "times before";
      
      button.target = this.gameObject;
      button.message = "SwitchPage";
      
      visitCounter++;
   }

   override function ExitPage () {
      welcome.text = "";
   }
}
Clone this wiki locally