Beispiel #1
0
    private void Reset()
    {
        Power = 0;

        if (_currentPanel != null)
        {
            _currentPanel.Destroy();
        }

        _visitSuperStarPanel = null;

        SetProgress(0, MaxPower);

        _model.Reset();
        _visitBattlePanel.Restart();

        _battleFinalBg.Hide();
        _battleCommon.Show();

        //_battleCommon.transform.SetSiblingIndex(0);

        _battleCommon.transform.Find("PowerBar").gameObject.Show();
        new AssetLoader().LoadAudio(AssetLoader.GetBackgrounMusicById("battleBgm"),
                                    (clip, loader) => { AudioManager.Instance.PlayBackgroundMusic(clip); });
    }
Beispiel #2
0
    public override void OnMessage(Message message)
    {
        string name = message.Name;

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

        case MessageConst.CMD_VISITBATTLE_CHANGE_POWER:
            _battleCommon.Show();
            Power += (int)body[0];
            SetProgress(Power, MaxPower);
            break;

        case MessageConst.CMD_VISITBATTLE_SHOW_SUPPORTER_VIEW:
            _visitSupporterPanel = new VisitSupporterPanel();
            _visitSupporterPanel.Init(this);
            _visitSupporterPanel.Show(0);
            _currentPanel = _visitSupporterPanel;
            break;

        case MessageConst.CMD_VISITBATTLE_NEXT:
            if (_currentPanel == _visitSupporterPanel)
            {
                //显示广场和粉丝动画
                _currentPanel.Destroy();
                _visitBattlePanel.ShowFans((bool)body[0], (bool)body[1]);

                _currentPanel = _visitBattlePanel;
            }
            else if (_currentPanel == _visitBattlePanel)
            {
                _visitCallSuperStarPanel = new VisitCallSuperStarPanel();
                _visitCallSuperStarPanel.Init(this);
                _visitCallSuperStarPanel.Show(0);
                _currentPanel = _visitCallSuperStarPanel;
            }
            else if (_currentPanel == _visitCallSuperStarPanel)
            {
                _currentPanel.Destroy();

                _visitSuperStarPanel = new VisitSuperStarPanel();
                _visitSuperStarPanel.Init(this);
                _visitSuperStarPanel.Show(0);
                _currentPanel = _visitSuperStarPanel;
                _battleCommon.Hide();
            }
            break;

        case MessageConst.CMD_VISITBATTLE_SUPERSTAR_CONFIRM:
            _model.IsShowingAnimation = true;
            _visitSuperStarPanel.Hide();
            _battleCommon.Show();

            _visitBattlePanel.DoNext();
            break;

        case MessageConst.CMD_VISITBATTLE_FINISH:
            ModuleManager.Instance.GoBack();
            break;

        case MessageConst.CMD_VISITBATTLE_RESTART:
            //todo 检查探班次数
            //if (_model.LevelVo.CostEnergy > GlobalData.PlayerModel.PlayerVo.Energy)
            //{
            //    FlowText.ShowMessage("体力不足");
            //}
            //else
            //{
            Reset();
            //}
            break;

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

        case MessageConst.CMD_VISITBATTLE_SHOW_REWARD:
            _currentPanel.Destroy();
            _currentPanel = new VisitFinalEstimateRewardPanel();
            _currentPanel.Init(this);
            _currentPanel.Show(0);

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