/// <summary> /// Handle application state changes /// </summary> /// <remarks> /// Override to receive notice of application state changes /// check the applicationStateVO.state to filter for required state /// </remarks> /// <param name="applicationStateVO">The new application state object</param> protected virtual void OnApplicationStateChanged(ApplicationStateVO applicationStateVO) { switch (applicationStateVO.state) { case ApplicationState.LOADING: DebugLogger.Log(NAME + "::OnApplicationStateChanged -> ApplicationState.LOADING"); break; case ApplicationState.MAIN_VIEW: DebugLogger.Log(NAME + "::OnApplicationStateChanged -> ApplicationState.MAIN_VIEW"); break; } }
/// <summary> /// /// </summary> /// <param name="applicationStateVO"></param> protected override void OnApplicationStateChanged(ApplicationStateVO applicationStateVO) { // Fade the appilcation view in from black if coming from loading state if (applicationStateVO.previousState != null && applicationStateVO.previousState.state == ApplicationState.LOADING && applicationStateVO.state == ApplicationState.MAIN_VIEW) { // Black out fades in when loading a new scene ( environment ) // So Request blackout fade out // Fades from black to transparent SendNotification(CoreNote.REQUEST_BLACKOUT, new RequestBlackoutVO { fadeDirection = FadeDirection.OUT, delay = 1.0f }); } }
public override void Execute(INotification notification) { DebugLogger.Log("RequestApplicationStateChangeCommand::Execute"); ApplicationStateProxy applicationStateProxy = Facade.RetrieveProxy(ApplicationStateProxy.NAME) as ApplicationStateProxy; ApplicationStateVO applicationStateVO = notification.Body as ApplicationStateVO; // First check new state is not same as old state if (applicationStateProxy.CurrentState != null && applicationStateProxy.CurrentState.state == applicationStateVO.state) { DebugLogger.LogWarning("Application State is already set to {0}", applicationStateProxy.CurrentState.state.ToString()); return; } if (applicationStateVO.previousState == null) { applicationStateVO.previousState = applicationStateProxy.CurrentState; } applicationStateProxy.CurrentState = applicationStateVO; }