// Ends the currently-running state, and resumes whatever is next // down the line. public void PopState() { StateExitValue result = CurrentState().Cleanup(); stateStack.Pop(); CurrentState().Resume(result); }
// Ends the currently-running state, and resumes whatever is next // down the line. public void PopState() { Debug.Log("Count3=" + stateStack.Count); StateExitValue result = CurrentState().Cleanup(); stateStack.Pop(); CurrentState().Resume(result); Debug.Log("Count4=" + stateStack.Count); }
public override void Resume(StateExitValue results) { Debug.Log("Resume FetchUserData"); if (results != null) { if (results.sourceState == typeof(WaitingForDBLoad <ShipmentsData>)) { var resultData = results.data as WaitingForDBLoad <ShipmentsData> .Results; if (resultData.wasSuccessful) { if (resultData.results != null) { // Got some results back! Use this data. // CommonData.currentCategory = new DBStruct<ShipmentsData>( // CommonData.DBCategoryTablePath + categoryID, CommonData.app); // CommonData.currentCategory.Initialize(resultData.results); // Debug.Log("Fetched user " + CommonData.currentUser.data.name); } else { // Make a new user, using default credentials. Debug.Log("Could not find category " + categoryName + " - Creating new profile."); ShipmentsData temp = new ShipmentsData() { categoryID = this.categoryID, categoryName = this.categoryName }; // CommonData.currentCategory = new DBStruct<ShipmentsData>( // CommonData.DBCategoryTablePath + categoryID, CommonData.app); // CommonData.currentCategory.Initialize(temp); // CommonData.currentCategory.PushData(); } } else { // Can't fetch data. Assume internet problems, stay offline. CommonData.currentUser = null; } } } // Whether we successfully fetched, or had to make a new user, // return control to the calling state. manager.PopState(); }
public override void Resume(StateExitValue results) { Debug.Log("Resume FetchUserData"); if (results != null) { if (results.sourceState == typeof(WaitingForDBLoad <UserMarker>)) { var resultData = results.data as WaitingForDBLoad <UserMarker> .Results; if (resultData.wasSuccessful) { if (resultData.results != null) { // Got some results back! Use this data. // CommonData.currentUserMarker = new DBStruct<UserMarker>( // CommonData.DBUserTablePath + userID, CommonData.app); // CommonData.currentUserMarker.Initialize(resultData.results); // Debug.Log("Fetched user " + CommonData.currentUserMarker.data.name); } else { // Make a new user, using default credentials. Debug.Log("Could not find user " + userID + " - Creating new profile."); UserMarker temp = new UserMarker(); temp.name = StringConstants.DefaultUserName; temp.id = userID; // CommonData.currentUserMarker = new DBStruct<UserMarker>( // CommonData.DBUserTablePath + userID, CommonData.app); // CommonData.currentUserMarker.Initialize(temp); // CommonData.currentUserMarker.PushData(); } } else { // Can't fetch data. Assume internet problems, stay offline. CommonData.currentUser = null; } } } // Whether we successfully fetched, or had to make a new user, // return control to the calling state. manager.PopState(); }
public override void Resume(StateExitValue results) { Debug.Log("resume StartUp"); if (results.sourceState == typeof(FetchUserData)) { Debug.Log("resume5 StartUp"); // manager.SwapState(new States.MainMenuMap()); if (CommonData.currentUserMarker == null) { Debug.Log("resume4 StartUp"); // If we can't fetch data, tell the user. manager.PushState(new BasicDialog(StringConstants.CouldNotFetchUserData)); } } else { throw new System.Exception("Returned from unknown state: " + results.sourceState); } }
public override void Resume(StateExitValue results) { ShowUI(); }
// Возобновkztncz состояние. // Вызывается, когда состояние становится активным при удалении верхнего состояния. // Это состояние может отправлять необязательный объект, содержащий любые результаты / данные. Результаты также могут быть пустыми, если данные не отправляются. public virtual void Resume(StateExitValue results) { }