예제 #1
0
    public override void Enter(GameStateParam param)
    {
        Logger.Log("enter switch state");

        m_loadingP       = 0;
        m_stateParam     = param as SwitchingStateParam;
        m_doneLoaded     = false;
        m_startedFadeIn  = false;
        m_doneFadeIn     = false;
        m_startedFadeOut = false;

        this.m_bManualClose     = this.m_stateParam.bManualClose;
        this.m_bManualCloseDone = false;

        ShowDarkMask(true);

        if (m_maskObj != null)
        {
            UnityEngine.Object.Destroy(m_maskObj);
        }

        Object orgin = Resources.Load(this.m_stateParam.PrefabPath);

        if (orgin != null)
        {
            this.m_maskObj       = (GameObject)UnityEngine.Object.Instantiate(orgin);
            this.m_maskAnimation = this.m_maskObj.transform.GetComponentsInChildren <Animation>()[0];
            UnityEngine.Object.DontDestroyOnLoad(this.m_maskObj);
        }
    }
예제 #2
0
 /// <summary>
 /// 激活最后进入的游戏状态
 /// </summary>
 public void PopWaitingState()
 {
     if (m_waitStateStack.Count > 0)
     {
         int            next  = m_waitStateStack.Pop();
         GameStateParam param = m_waitStateParamStack.Pop();
         SwitchTo(next, param);
     }
 }
예제 #3
0
 public override void OnEnter(StateParameter parameters)
 {
     base.OnEnter(parameters);
     param = (GameStateParam)parameters;
     if (!string.IsNullOrEmpty(param.sceneName))
     {
         asyncOperation = SceneManager.LoadSceneAsync(param.sceneName);
     }
 }
예제 #4
0
    public void ChangeGameState(object o)
    {
        object[]       objs      = o as object[];
        string         name      = objs[0] as string;
        GameStateParam gameState = objs[0] as GameStateParam;

        if (!string.IsNullOrEmpty(name))
        {
            startGame.ChangeState(name, gameState);
        }
    }
예제 #5
0
 /// <summary>
 /// 推入待机活游戏状态
 /// </summary>
 /// <param name="id"></param>
 /// <param name="param"></param>
 public void PushWaitingState(int id, GameStateParam param)
 {
     if (!m_stateDic.ContainsKey(id))
     {
         Logger.Log("invalid state :" + id);
     }
     else
     {
         m_waitStateStack.Push(id);
         m_waitStateParamStack.Push(param);
     }
 }
예제 #6
0
    public void Start()
    {
        gui = GameObject.Find("GUI");
        DontDestroyOnLoad(this);
        DontDestroyOnLoad(gui);

        startGame = new StartGame();
        startGame.Init();

        EventListenerManager.Instance.Subscribe(EventListernerEnum.EVENT_CHANGE_STATE, ChangeGameState);

        GameStateParam gameStateParam = new GameStateParam();

        gameStateParam.sceneName = "Battle";
        gameStateParam.nextState = GameStateEnum.Battle;
        startGame.ChangeState(GameStateEnum.Loading, gameStateParam);
    }
예제 #7
0
 /// <summary>
 /// 进入下一游戏状态
 /// </summary>
 /// <param name="id"></param>
 /// <param name="param"></param>
 public void SwitchTo(int next, GameStateParam param)
 {
     if (!this.m_stateDic.ContainsKey(next))
     {
         Logger.Log("invalid next state :" + next);
     }
     else
     {
         if (m_activeState != null)
         {
             m_oldActiveStateID = m_activeState.ID;
             m_activeState.Exit();
         }
         m_activeState = m_stateDic[next];
         if (m_activeState != null)
         {
             m_activeState.Enter(param);
         }
     }
 }
예제 #8
0
 public override void Enter(GameStateParam param)
 {
     Logger.Log("enter loading state");
 }
예제 #9
0
 public virtual void Enter(GameStateParam param)
 {
 }
예제 #10
0
 public override void Enter(GameStateParam param)
 {
     Logger.Log("enter boot state");
     GamePrepare();
 }