示例#1
0
        public void RemoveLastState(UIStateEnum newState)
        {
            UpdateState(newState);
            DisableAllPanelsInStack();

            _stateStack.Pop();
        }
示例#2
0
        /// <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
            );
 }
示例#4
0
        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();
        }
示例#5
0
        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;
                        }
                    }
                }
            }
        }
示例#6
0
        public void AddState(UIStateEnum newState)
        {
            UpdateState(newState);
            DisableAllPanelsInStack();

            _stateStack.Push(newState);
        }
示例#7
0
 /// <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);
 }
示例#11
0
 //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);
 }
示例#12
0
 public NotificationEvent(UIStateEnum State)
 {
     MessageId  = Guid.NewGuid();
     this.State = State;
 }
示例#13
0
 /// <summary>
 /// 设置UI的状态
 /// </summary>
 /// <param name="state"></param>
 protected abstract void SetUIState(UIStateEnum state);
示例#14
0
 /// <summary>
 /// UI状态改变的处理函数
 /// </summary>
 /// <param name="currentState"></param>
 /// <param name="targetState"></param>
 protected abstract void HandleState(UIStateEnum currentState, UIStateEnum targetState);
示例#15
0
 /// <summary>
 /// 设置UI状态
 /// </summary>
 /// <param name="state"></param>
 protected override void SetUIState(UIStateEnum state)
 {
     HandleState(uiState, state);
     uiState = state;
 }
示例#16
0
 void Start()
 {
     uiState = UIStateEnum.Inventory;
 }
示例#17
0
 private void UpdateState(UIStateEnum state)
 {
     _actualStateEnum = state;
 }