public void InitDataPlaying()
 {
     if (_BOL_PlayBattleleft == null)
     {
         _BOL_PlayBattleleft = listStateScene.BOL_PlayBattle_left;
     }
     if (_BOL_PlayBattleright == null)
     {
         _BOL_PlayBattleright = listStateScene.BOL_PlayBattle_right;
     }
     isInitSuccess = true;
     _BOL_ChoiceHero.ResetData();
     if (tweenScale != null)
     {
         LeanTween.cancel(BOL_ChoiceHero.instance.TableChoice, tweenScale.uniqueId);
         tweenScale = null;
     }
     tweenScale = LeanTween.scale(BOL_ChoiceHero.instance.TableChoice, Vector3.zero, 0.2f).setOnComplete(() =>
     {
         tweenScale = null;
         tweenScale = LeanTween.scale(BOL_ChoiceHero.instance.imageVS, Vector3.zero, 0.2f).setOnComplete(() =>
         {
             tweenScale = null;
             Debug.Log(" null tweanscale");
         });
     }).setEase(LeanTweenType.easeOutBack).setOnCompleteOnStart(true);
     //_BOL_ShowPlayer = null;
     panelUserInfo.Hide();
 }
 public void InitDataWaiting()
 {
     if (_BOL_ChoiceHero == null)
     {
         _BOL_ChoiceHero = listStateScene.BOL_ChoiceHero;
         _BOL_ChoiceHero.InitData();
     }
     //if (_BOL_ShowPlayer == null) {
     //	_BOL_ShowPlayer = listStateScene.BOL_ShowPlayer;
     //	_BOL_ShowPlayer.InitData();
     //}
     isInitSuccess = true;
     if (_BOL_PlayBattleleft != null)
     {
         _BOL_PlayBattleleft.ResetData();
         _BOL_PlayBattleleft.SelfDestruction();
         _BOL_PlayBattle_left = null;
         _BOL_PlayBattleleft  = null;
     }
     if (_BOL_PlayBattleright != null)
     {
         _BOL_PlayBattleright.ResetData();
         _BOL_PlayBattleright.SelfDestruction();
         _BOL_PlayBattle_right = null;
         _BOL_PlayBattleright  = null;
     }
     panelUserInfo.RefreshGoldInfo();
 }
示例#3
0
    void ActionWaiting(StateScene stateStatus)
    {
        switch (stateStatus)
        {
        case StateScene.showheroandskill:
            _BOL_ShowHeroAndSkill = listStateScene.BOL_ShowHeroAndSkill;
            _BOL_ShowHeroAndSkill.Hide();
            break;

        case StateScene.showplayer:
            //_BOL_ShowPlayer = listStateScene.BOL_ShowPlayer;
            _BOL_ChoiceHero = listStateScene.BOL_ChoiceHero;
            _BOL_ShowPlayer.InitData();
            _BOL_ChoiceHero.Hide();
            break;

        case StateScene.choicehero:
            //_BOL_ShowPlayer = listStateScene.BOL_ShowPlayer;
            _BOL_ChoiceHero = listStateScene.BOL_ChoiceHero;
            _BOL_ShowPlayer.SelfDestruction();
            _BOL_ChoiceHero.Show();
            break;
        }
    }
    public void ActionFinish(StateScene state, Action action = null)
    {
        isInitSuccess = false;
        _BOL_ShowHeroAndSkill.Hide();
        panelUserInfo.RefreshGoldInfo(true);
        panelUserInfo.Show();
#if TEST
        Debug.Log("ChairPosition " + ChairPosition);
#endif
        if (ChairPosition == Constant.CHAIR_LEFT || ChairPosition == Constant.CHAIR_RIGHT)
        {
            switch (state)
            {
            case StateScene.win:
                if (_BOL_ShowFinishWin == null)
                {
#if TEST
                    Debug.Log("show win");
#endif
                    _BOL_ShowFinishWin = listStateScene.BOL_ShowFinishWin;
                    Delay(5, () =>
                    {
                        _BOL_ShowFinishWin.ResetData();
                        _BOL_ShowFinishWin.SelfDestruction();
                        _BOL_ShowFinishWin = null;
                        if (ChairPosition != Constant.CHAIR_PLAYER && ChairPosition != Constant.CHAIR_VIEWER)
                        {
                            BOL_PlaySkill_Controller.instance.isStartGame = false;
                        }
                    });
                    StartInitData(InitDataWaiting, () =>
                    {
                        ActionWaiting(StateScene.choiceherofinishgame);
                        int mySessionid = DataManager.instance.userData.sessionId;
                        if (mySessionid == BOL_ShowPlayer_Manager.instance.listUserPlayGame[0].sessionId)
                        {
                            //BOL_ChoiceHero.instance.SetActiveImageChoice(Constant.CHAIR_LEFT, false, true);
                            BOL_ChoiceHero.instance.btnChoiceChairLeft.isChoiceChair = true;
                            BOL_ChoiceHero.instance.Show();
                        }
                        else if (mySessionid == BOL_ShowPlayer_Manager.instance.listUserPlayGame[1].sessionId)
                        {
                            BOL_ChoiceHero.instance.btnChoiceChairRight.isChoiceChair = true;
                            //BOL_ChoiceHero.instance.SetActiveImageChoice(Constant.CHAIR_RIGHT, false, true);
                            BOL_ChoiceHero.instance.Show();
                        }
                    });
                }
                break;

            case StateScene.lose:
                if (_BOL_ShowFinishLose == null)
                {
                    _BOL_ShowFinishLose = listStateScene.BOL_ShowFinishLose;
                    Delay(5, () =>
                    {
                        _BOL_ShowFinishLose.ResetData();
                        _BOL_ShowFinishLose.SelfDestruction();
                        _BOL_ShowFinishLose = null;
                        if (ChairPosition != Constant.CHAIR_PLAYER && ChairPosition != Constant.CHAIR_VIEWER)
                        {
                            BOL_PlaySkill_Controller.instance.isStartGame = false;
                        }
                    });
                    StartInitData(InitDataWaiting, () =>
                    {
                        ActionWaiting(StateScene.choiceherofinishgame);
                        int mySessionid = DataManager.instance.userData.sessionId;
                        if (mySessionid == BOL_ShowPlayer_Manager.instance.listUserPlayGame[0].sessionId)
                        {
                            //BOL_ChoiceHero.instance.SetActiveImageChoice(Constant.CHAIR_LEFT, false, true);
                            BOL_ChoiceHero.instance.btnChoiceChairLeft.isChoiceChair = true;
                            BOL_ChoiceHero.instance.Show();
                        }
                        else if (mySessionid == BOL_ShowPlayer_Manager.instance.listUserPlayGame[1].sessionId)
                        {
                            //BOL_ChoiceHero.instance.SetActiveImageChoice(Constant.CHAIR_RIGHT, false, true);
                            BOL_ChoiceHero.instance.btnChoiceChairRight.isChoiceChair = true;
                            BOL_ChoiceHero.instance.Show();
                        }
                    });
                }
                break;

            case StateScene.tie:
                break;

            case StateScene.viewer:
                break;

            default:
#if TEST
                Debug.Log(Debugs.ColorString("không show cái gì cả", Color.red));
#endif
                break;
            }
        }
        else
        {
            //if (tweenScale != null) {
            //	LeanTween.cancel(imageVS.gameObject, tweenScale.uniqueId);
            //	tweenScale = null;
            //}
            //tweenScale = LeanTween.scale(imageVS.gameObject, Vector3.one, 0.5f).setOnComplete(() => {
            //	tweenScale = null;
            //}).setEase(LeanTweenType.easeOutBack);
        }
    }