public void RemoveLastState(UIStateEnum newState) { UpdateState(newState); DisableAllPanelsInStack(); _stateStack.Pop(); }
/// <summary> /// UI状态的处理函数 /// </summary> /// <param name="currentState"></param> /// <param name="targetState"></param> protected override void HandleState(UIStateEnum currentState, UIStateEnum targetState) { switch (targetState) { case UIStateEnum.INIT: Init(); break; case UIStateEnum.SHOW: if (currentState == UIStateEnum.NOTINIT) { Init(); Show(); } else { Show(); } break; case UIStateEnum.HIDE: Hide(); break; } }
bool IsSilenceMode(UIStateEnum eState) { return(eState == UIStateEnum.eSchoolMode || eState == UIStateEnum.eSleepMode //|| eState == UIStateEnum.eOtherMode ); }
private void Awake() { if (Instance == null) { Instance = this; } else { Destroy(Instance); } // Get all panels in the root canvas containing the name "Menu" and // store them into the _panelMenuList FetchObjects("Menu", transform, _panelMenuList); // Generate a dictionnary of states from thoses panels GenerateStates(); // Add the first newState into the queue states _stateStack.Push(GetFirstState()); _actualStateEnum = GetFirstState(); // Disable all panels DisableAllPanels(); }
private void GenerateStates() { foreach (var container in _panelMenuList) { Type typeName = Type.GetType(GetType().Namespace + "." + container.name + "State"); if (typeName != null) { Object[] args = { this }; AUIState newAuiState = Activator.CreateInstance(typeName, args) as AUIState; string typeNameStr = typeName.Name.ToLower(); for (UIStateEnum state = UIStateEnum.NONE; state <= UIStateEnum.OPTIONSMENU; ++state) { if (newAuiState != null && !_stateDictionary.ContainsKey(state) && typeNameStr.Contains(state.ToString().ToLower())) { newAuiState.Setup(container.transform); _stateDictionary.Add(state, newAuiState); break; } } } } }
public void AddState(UIStateEnum newState) { UpdateState(newState); DisableAllPanelsInStack(); _stateStack.Push(newState); }
/// <summary> /// 初始化UI /// </summary> /// <param name="id"></param> /// <param name="dataHandlerName"></param> protected void InitUI <T>(T id, string dataHandlerName = null) { ID = id.ToString(); uiState = UIStateEnum.NOTINIT; if (!string.IsNullOrEmpty(dataHandlerName)) { dataHandler = GetDataHandlerManager().GetHandler(dataHandlerName); dataHandler.UpdateShow += UpdateShow; } }
public void PushNewState(UIStateEnum stateEnum, object valueIn = null, object valueIn1 = null, bool bNeedWait = true, object valueIn2 = null) { GuLog.Debug("<><DrinkWaterUIPresentManager> PushNewState: " + stateEnum.ToString()); PushNewState(new UIState { state = stateEnum, value0 = valueIn, value1 = valueIn1, value2 = valueIn2, needWait = bNeedWait }); }
public bool IsExistState(UIStateEnum eState) { if (CurrentPresent != null && CurrentPresent.GetStateEnum() == eState) { return(true); } foreach (var state in listState) { if (state.state == eState) { return(true); } } return(false); }
MainPresentBase GetPresentByEnum(UIStateEnum state) { if (allIPresents == null) { return(null); } foreach (var ret in allIPresents) { if (state == ret.GetStateEnum()) { GuLog.Debug("<><DrinkWaterUIPresentManager> NextState:" + state.ToString()); return(ret); } } return(null); }
//public void ShowAlertPair(AlertBoard.AlertType type) //{ // alertBoardSignal.Dispatch(type); //} public override void TestSerializeField() { //Assert.IsNotNull(silenceTimeProcess); Assert.IsNotNull(mainUIObject); Assert.IsNotNull(rolePlayer); Assert.IsNotNull(guestPlayer); Assert.IsNotNull(objTextTmallRoot); MainPresentBase[] allIPresents = transform.GetComponentsInChildren <MainPresentBase>(true); for (UIStateEnum i = UIStateEnum.eStartDailyProcessBar; i < UIStateEnum.eTotalUiState; ++i) { bool bFound = false; foreach (var p in allIPresents) { if (p.GetStateEnum() == i) { bFound = true; break; } } Assert.IsTrue(bFound, "No present:" + i.ToString()); } //Assert.IsTrue(aniTmallRemind != null); }
public NotificationEvent(UIStateEnum State) { MessageId = Guid.NewGuid(); this.State = State; }
/// <summary> /// 设置UI的状态 /// </summary> /// <param name="state"></param> protected abstract void SetUIState(UIStateEnum state);
/// <summary> /// UI状态改变的处理函数 /// </summary> /// <param name="currentState"></param> /// <param name="targetState"></param> protected abstract void HandleState(UIStateEnum currentState, UIStateEnum targetState);
/// <summary> /// 设置UI状态 /// </summary> /// <param name="state"></param> protected override void SetUIState(UIStateEnum state) { HandleState(uiState, state); uiState = state; }
void Start() { uiState = UIStateEnum.Inventory; }
private void UpdateState(UIStateEnum state) { _actualStateEnum = state; }