Esempio n. 1
0
        /// <summary>
        /// 派发消息
        /// </summary>
        /// <param name="notification"></param>
        private void send(XLNotification notification)
        {
            if (_observers.ContainsKey(notification.Name))
            {
                IList <IObserver> observers = _observers[notification.Name];

                for (int i = 0; i < observers.Count; i++)
                {
                    observers[i].handleNotification(notification);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 派发消息
        /// </summary>
        /// <param name="notification"></param>
        private void send(XLNotification notification)
        {
            if (_observers.ContainsKey(notification.Name))
            {
                IList<IObserver> observers = _observers[notification.Name];

                for (int i = 0; i < observers.Count; i++)
                {
                    observers[i].handleNotification(notification);
                }
            }
        }
Esempio n. 3
0
    /// <summary>
    /// 接收关心的消息的方法
    /// </summary>
    /// <param name="notification"></param>
    public void handleNotification(XLNotification notification)
    {
        //根据消息名对应处理
        switch (notification.Name)
        {
            case BATTLESTATE_START:   //战斗开始
                //显示战斗界面
                UIManager.getInstance().openPanel(PanelConfig.GAMEPANEL);

                //战役进度
                num--;

                //战役初始化
                BattleInit();

                //开始倒计时
                XLMessageManager.getInstance().sendNotification(BATTLESTATE_COUNTDOWN);
                break;

            case BATTLESTATE_COUNTDOWN:    //倒计时
                if (timeText != null)
                {
                    timeText.text = "";
                    timeText.gameObject.SetActive(true);
                }
                timerListener.number = 5;
                TimerManager.getInstance().addListener(timerListener);
                timerListener.isRunning = true;
                break;

            case BATTLESTATE_FIGHT:    //战斗
                fighting();
                break;

            case BATTLESTATE_FAILED:   //战斗失败
                battlestateFailed();
                break;

            case BATTLESTATE_VICTORY:  //战斗胜利
                battlestateVictory();
                break;

        }
    }