Example #1
0
	void InitStateMachine() {
		if ( null != slideState )
			return;
		slideState = new mbsStateMachine<eSlideState>();
		slideState.AddState(eSlideState.Closed);
		slideState.AddState(eSlideState.Opening, StateOpening);
		slideState.AddState(eSlideState.Opened);
		slideState.AddState(eSlideState.Closing, StateClosing);
		slideState.SetState(eSlideState.Closed);
		Deactivate(true);
	}
Example #2
0
	void Start()
	{
		//first I define the states for the Update function's variable
		//make sure to define every state that exists in the enum
		//if you don't want the state to do anything, just leave the function field empty
		state = new mbsStateMachine<smTest>();
		state.AddState(smTest.Opening, Opening);
		state.AddState(smTest.Idle);
		state.AddState(smTest.Closing, Closing);
		state.AddState(smTest.Closed);
		
		//now define the states for the OnGUI function's variable
		guistate = new mbsStateMachine<smTest>();
		guistate.AddState(smTest.Opening, DrawBasic);
		guistate.AddState(smTest.Idle	, DrawCloseButton);
		guistate.AddState(smTest.Closing, DrawBasic);
		guistate.AddState(smTest.Closed	, DrawRestartButton);
		
		//mbsStateMachine will always default to the first non-null state when you first
		//define the states so in this case state.Currentstate will be set to Opening
	}
Example #3
0
	static public void InitServerState()
	{
		if (null != serverState) return;
		
		serverState =  new mbsStateMachine<WULServerState>();
		serverState.AddState(WULServerState.None);
		serverState.AddState(WULServerState.Contacting, ShowPleaseWait);
		serverState.SetState (WULServerState.None);
	}
		public void AssignServerStateVariable(mbsStateMachine<WULServerState> state)
		{
			serverState = state;
		}
Example #5
0
		virtual protected void InitWULoginGUI()
		{
			InitLoginSystem();

			WUCookie.LoadStoredCookie();
			if (PlayerPrefs.HasKey("Remember Me"))
			{
				attempt_auto_login = PlayerPrefs.GetInt("Remember Me",0) > 0;
				login_challenge.Entries[0].value = PlayerPrefs.GetString("username");
			}

			if (fix_resolution)
				GUIX.SetScreenSize(fixed_screen_width, fixed_screen_height);

			//the server's state can always be only one of two: Idling or awaiting a response
			//set this up and start in the idle state.
			WPServer.ServerState = new mbsStateMachine<WULServerState>();
			WPServer.ServerState.AddState(WULServerState.None);
			WPServer.ServerState.AddState(WULServerState.Contacting, ShowPleaseWait);
			WPServer.ServerState.SetState (WULServerState.None);

			//setup the various states our login kit could be in...
			loginState = new mbsStateMachine<WULStates>();
			loginState.AddState(WULStates.Dummy);
			loginState.AddState(WULStates.ValidateLoginStatus  );
			loginState.AddState(WULStates.Logout			   );
			loginState.AddState(WULStates.FetchAccountDetails  );
			loginState.AddState(WULStates.UpdateAccountDetails );
			loginState.AddState(WULStates.LoginMenu				, ShowLoginMenu);
			loginState.AddState(WULStates.AccountMenu			, ShowAccountMenu);
			loginState.AddState(WULStates.AccountInfo			, account_info.Draw);
			loginState.AddState(WULStates.LoginChallenge		, ShowLoginChallenge);
			loginState.AddState(WULStates.PasswordReset			, pass_reset_challenge.Draw);
			loginState.AddState(WULStates.RegisterAccount		, registration_challenge.Draw);
			loginState.AddState(WULStates.PasswordChange		, password_change_challenge.Draw);

			//if this script is loaded while already logged in, go to the account 
			//management menu or else show the login menu
			if (WULogin.logged_in)
				loginState.SetState(WULStates.AccountMenu);
			else
				loginState.SetState(WULStates.LoginMenu);

			//setup all the actions that will take place when buttons are clicked
			//in the OnGUI prefab...
			SetupResponders();

			//and finally, setup the window we will be displaying the stuff in and activate it
			displayArea.Init();
			displayArea.ForceState(eSlideState.Closed);
			displayArea.Activate();

			//if "Remember me" was selected during the last login, try to log in automatically...
			if (attempt_auto_login && loginState.CompareState(WULStates.LoginMenu) )
				AttemptAutoLogin();
		}