Пример #1
0
 public virtual void Reset()
 {
     if (QLogger.CanLogInfo)
     {
         QLogger.LogInfo("Reset called for " + this.GetType());
     }
 }
Пример #2
0
 public virtual void OnExit()
 {
     if (QLogger.CanLogInfo)
     {
         QLogger.LogInfo("OnExit called for " + this.GetType());
     }
 }
Пример #3
0
 public virtual void OnPushedToFront()
 {
     if (QLogger.CanLogInfo)
     {
         QLogger.LogInfo("OnPushedToFront called for " + this.GetType());
     }
 }
Пример #4
0
 public virtual void OnPusedBack()
 {
     if (QLogger.CanLogInfo)
     {
         QLogger.LogInfo("OnPushedBack called for " + this.GetType());
     }
 }
Пример #5
0
    public override void Update()
    {
        if (Main.Instance.uIManager == null)
        {
            GameObject uiManagerGo = GameObject.Instantiate(ResourceManager.Instance.LoadAsset <UnityEngine.Object> ("UI/UiManager")) as GameObject;
            if (uiManagerGo == null)
            {
                QLogger.LogErrorAndThrowException("UiManager was not instantiated");
            }

            Main.Instance.uIManager = uiManagerGo.GetComponent <UIManager>();
            if (Main.Instance.uIManager == null)
            {
                QLogger.LogErrorAndThrowException("UiManager script was not instantiated");
            }

            if (QLogger.CanLogInfo)
            {
                QLogger.LogInfo("UI manager was instantiated");
            }

            ResourceManager.Instance.LoadLevel("Lobby", true,
                                               delegate()
            {
                Main.Instance.gameStateManager.SetGameState(GameStateManager.GameStates.Frontend, null);
            }, true
                                               );
        }
    }
Пример #6
0
        private void Send_Immediate(EventDetails evnt)
        {
            SuscribeListenerCallback actionListener;

            listeners.TryGetValue(evnt.category, out actionListener);

            if (actionListener != null)
            {
                actionListener(evnt.action, evnt.sender, evnt.context);
                return;
            }

            if (QLogger.CanLogInfo)
            {
                QLogger.LogInfo(string.Format("GlobalEventsManager.Send found unhandled Event. [ Category: {0}   Action: {1}  Sender: {2}  Context: {3} ]",
                                              evnt.category, evnt.action, (evnt.sender == null ? "null" : evnt.sender.ToString()), (evnt.context == null ? "null" : evnt.context.ToString())));
            }
        }
Пример #7
0
            public void QueueState(T newState, System.Object context)
            {
                if (currentState.HasValue && currentState.Value.Equals(newState))
                {
                    if (QLogger.CanLogWarning)
                    {
                        QLogger.LogWarning(" Setting same state again " + newState.ToString());
                    }
                    return;
                }

                if (QLogger.CanLogInfo)
                {
                    QLogger.LogInfo(string.Format("FSM:Queued \"{0}\" state ", newState));
                }
                nextState           = newState;
                contextForNextState = context;
            }
Пример #8
0
            void SetNextState()
            {
                if (currentState.HasValue)
                {
                    if (GetKeyValueMap(currentState.Value, nextState.Value) == null)
                    {
                        QLogger.LogErrorAndThrowException("There is no mapping between " + currentState.Value.ToString() + " and " + nextState.Value.ToString());
                        nextState = null;
                        return;
                    }
                }
                //set current to peviousState
                previousState = currentState;
                //exit previousState
                if (previousState.HasValue)
                {
                    if (QLogger.CanLogInfo)
                    {
                        QLogger.LogInfo(string.Format("FSM:On Exit called for \"{0}\" state ", previousState.Value));
                    }
                    statesDictionary[previousState.Value].OnExit();
                }

                //set currentState to Next
                currentState = nextState;
                //enter current state
                if (currentState.HasValue)
                {
                    if (QLogger.CanLogInfo)
                    {
                        QLogger.LogInfo(string.Format("FSM:On Enter called for \"{0}\" state ", currentState.Value));
                    }
                    statesDictionary[currentState.Value].OnEnter();

                    statesDictionary[currentState.Value].OnContext(contextForNextState /* this can be null if there is no context */);
                }

                //set nextState to Null
                nextState           = null;
                contextForNextState = null;
            }