示例#1
0
    public override void OnMessage(Message message)
    {
        string name = message.Name;

        object[] body = message.Params;
        switch (name)
        {
        case MessageConst.CMD_BATTLE_SET_POWER:
            SetProgress((int)body[0], MaxPower);
            _battleCommon.Show();
            _model.IsGetBattleResult = true;
            ClientTimer.Instance.DelayCall(OnBattleResult, 1f);
            break;

        case MessageConst.CMD_BATTLE_CHANGE_POWER:
            _battleCommon.Show();
            Power += (int)body[0];
//                Debug.LogError("进度条增加的值==="+Power);
            SetProgress(Power, MaxPower);
            break;

        case MessageConst.CMD_BATTLE_SHOW_SUPPORTER_VIEW:
            _supporterPanel = new SupporterPanel();
            _supporterPanel.Init(this);
            _supporterPanel.Show(0);
            _currentPanel = _supporterPanel;
            break;

        case MessageConst.CMD_BATTLE_NEXT:
            if (_currentPanel == _supporterPanel)
            {
                //  _battleCommon.Hide();
                //显示广场和粉丝动画
                _currentPanel.Destroy();

                Queue <string> fansInfo  = (Queue <string>)body[0];
                int            tempPower = (int)body[1];
                _battlePanel.GetFansInfo(fansInfo);
                _battlePanel.GetPower(tempPower);
                _currentPanel = _battlePanel;
            }
            else if (_currentPanel == _battlePanel)
            {
                _superStarPanel = new SuperStarPanel();
                _superStarPanel.Init(this);
                _superStarPanel.Show(0);
                _currentPanel = _superStarPanel;
                _battleCommon.Hide();
            }
            break;


        case MessageConst.CMD_BATTLE_SUPERSTAR_CONFIRM:
            _model.IsShowingAnimation = true;
            _superStarPanel.Hide();
            _battleCommon.Show();
            Power += (int)body[0];
            SetProgress(Power, MaxPower);

            break;

        case MessageConst.CMD_BATTLE_SHOW_REWARD:
            _currentPanel.Destroy();
            _currentPanel = new FinalEstimateRewardPanel();
            _currentPanel.Init(this);

            _battleFinalBg.Show();
            _battleCommon.Hide();
            _battleFinalBg.transform.SetSiblingIndex(0);
            break;

        case MessageConst.CMD_BATTLE_FINISH:
//                if(body != null && body.Length > 0)
//                {
//                    string moduleName = (string) body[0];
//                    ModuleManager.Instance.EnterModule(moduleName);
//                }
//                else
//                {
//                    ModuleManager.Instance.GoBack();
//                }
            ClientTimer.Instance.DelayCall(() =>
            {
                if (body != null && body.Length > 0)
                {
                    string moduleName = (string)body[0];
                    ModuleManager.Instance.EnterModule(moduleName);
                }
                else
                {
                    //
                    ModuleManager.Instance.GoBack();
                }
            }, 0.3f);

            break;

        case MessageConst.CMD_BATTLE_RESTART:
            if (_model.LevelVo.CostEnergy > GlobalData.PlayerModel.PlayerVo.Energy)
            {
                FlowText.ShowMessage(I18NManager.Get("MainLine_BattleIntroductionPopupHint1"));
            }
            else
            {
                Reset();
            }
            break;

        case MessageConst.CMD_BATTLE_FANS_CALL_ANIMATION_FINISH:
            _model.IsShowingAnimation = false;
            OnBattleResult();
            break;

        case MessageConst.CMD_BATTLE_SEND_ROLE_ID:

            roleIds = (Queue <int>)body[0];


            break;

        case MessageConst.CMD_BATTLE_GET_RES:
            _battleCommon.Hide();
            _battlePanel.HideBackBtn();
            _battlePanel.GetRolesId(roleIds);
            break;

        case MessageConst.CMD_BATTLE_HIDE_PROGRESS:
            _battleCommon.Hide();
            break;
        }
    }