void OnLeave()
 {
     Main.Ins.GameStateMgr.SaveState();
     Main.Ins.GameBattleEx.Pause();
     Main.Ins.StopAllCoroutines();
     Main.Ins.SoundManager.StopAll();
     Main.Ins.BuffMng.Clear();
     Main.Ins.MeteorManager.Clear();
     OnBackPress();
     Main.Ins.ExitState(Main.Ins.FightState);
     if (GameOverlayDialogState.Exist())
     {
         GameOverlayDialogState.Instance.ClearSystemMsg();
     }
     //离开副本
     if (Main.Ins.CombatData.GLevelMode == LevelMode.MultiplyPlayer)
     {
         UdpClientProxy.LeaveLevel();
     }
     else
     {
         FrameReplay.Instance.OnDisconnected();
         U3D.GoBack();
     }
 }
Exemplo n.º 2
0
    void OnChangeVer(string ver)
    {
        if (Main.Ins.CombatData.GLevelMode == LevelMode.MultiplyPlayer)
        {
            U3D.PopupTip("联机中无法切换版本");
            return;
        }

        if (Main.Ins.AppInfo.MeteorVersion == ver)
        {
            U3D.PopupTip(string.Format("当前流星版本已为{0}", ver));
            return;
        }
        Main.Ins.AppInfo.MeteorVersion = ver;
        Main.Ins.GameStateMgr.gameStatus.MeteorVersion = Main.Ins.AppInfo.MeteorVersion;
        Main.Ins.GameStateMgr.SaveState();
        //提示返回到主场景,然后重新加载数据
        Main.Ins.GameBattleEx.Pause();
        Main.Ins.StopAllCoroutines();
        Main.Ins.SoundManager.StopAll();
        Main.Ins.BuffMng.Clear();
        Main.Ins.MeteorManager.Clear();
        Main.Ins.ExitState(Main.Ins.FightState);
        Main.Ins.DialogStateManager.CheckAndCloseCurrentDialogIfPresent(Main.Ins.DialogStateManager.EscDialogState);

        if (GameOverlayDialogState.Exist())
        {
            GameOverlayDialogState.Instance.ClearSystemMsg();
        }
        U3D.ReStart();
    }
 void OnChangeVer(string ver)
 {
     if (Main.Ins.AppInfo.MeteorVersion == ver)
     {
         U3D.PopupTip(string.Format("当前流星版本已为{0}", ver));
         return;
     }
     Main.Ins.AppInfo.MeteorVersion = ver;
     Main.Ins.GameStateMgr.gameStatus.MeteorVersion = Main.Ins.AppInfo.MeteorVersion;
     Main.Ins.GameStateMgr.SaveState();
     if (GameOverlayDialogState.Exist())
     {
         GameOverlayDialogState.Instance.ClearSystemMsg();
     }
     OnBackPress();
     U3D.ReStart();
 }
Exemplo n.º 4
0
 void OnLeave()
 {
     GameStateMgr.Ins.SaveState();
     Main.Ins.GameBattleEx.Pause();
     SoundManager.Ins.StopAll();
     Main.Ins.StopAllCoroutines();
     PathHelper.Ins.StopCalc();
     FightState.State.Close();
     MeteorManager.Ins.Reset();
     if (GameOverlayDialogState.Exist())
     {
         GameOverlayDialogState.Instance.ClearSystemMsg();
     }
     //离开副本
     if (U3D.IsMultiplyPlayer())
     {
         TcpClientProxy.Ins.LeaveLevel();
     }
     else
     {
         FrameReplay.Ins.OnDisconnected();
         U3D.GoBack();
     }
 }
Exemplo n.º 5
0
    public void SetResult(int result)
    {
        if (result == 1)
        {
            for (int i = 0; i < MeteorManager.Ins.UnitInfos.Count; i++)
            {
                if (MeteorManager.Ins.UnitInfos[i].StateMachine != null)
                {
                    MeteorManager.Ins.UnitInfos[i].StateMachine.Stop();
                }
                MeteorManager.Ins.UnitInfos[i].meteorController.Input.ResetVector();
                MeteorManager.Ins.UnitInfos[i].OnGameResult(result);
            }
        }

        if (CombatData.Ins.GGameMode == GameMode.MENGZHU)
        {
            U3D.InsertSystemMsg("回合结束");
        }
        else
        {
            string mat = "";
            Text   txt;
            switch (result)
            {
            case -1:
            case 0:
                mat = "BattleLose";
                txt = Control("ButterflyWin").GetComponent <Text>();
                U3D.InsertSystemMsg("蝴蝶阵营 获胜");
                txt.text = "1";
                break;

            case 1:
            case 2:
                mat = "BattleWin";
                txt = Control("MeteorWin").GetComponent <Text>();
                U3D.InsertSystemMsg("流星阵营 获胜");
                txt.text = "1";
                break;

            case 3:
                mat = "BattleNone";
                U3D.InsertSystemMsg("和局");
                break;
            }
            BattleResult.GetComponent <Image>().material = Resources.Load <Material>(mat);
            BattleResult.SetActive(true);
            BattleTitle.SetActive(true);
        }
        Control("Close").SetActive(CombatData.Ins.GLevelMode != LevelMode.MultiplyPlayer);
        if (CombatData.Ins.GLevelMode == LevelMode.MultiplyPlayer)
        {
            Timer t = Timer.once(3.0f, ReEnterLevel);
        }
        Control("Close").GetComponent <Button>().onClick.AddListener(() =>
        {
            GameStateMgr.Ins.SaveState();
            Main.Ins.GameBattleEx.Pause();
            Main.Ins.StopAllCoroutines();
            SoundManager.Ins.StopAll();
            OnBackPress();
            if (FightState.Exist())
            {
                FightState.State.Close();
            }
            if (GameOverlayDialogState.Exist())
            {
                GameOverlayDialogState.Instance.ClearSystemMsg();
            }
            //离开副本
            if (U3D.IsMultiplyPlayer())
            {
            }
            else
            {
                FrameReplay.Ins.OnDisconnected();
                Main.Ins.GotoMenu();
            }
        });
        //Control("SaveRecord").SetActive(false);
        //Control("SaveRecord").GetComponent<Button>().onClick.AddListener(() => {
        //    Main.Ins.EnterState(Main.Ins.WaitDialogState, "正在保存录像,请稍后");
        //    //单独开一个线程去保存录像信息.
        //    RecordMgr.Ins.WriteFile();
        //    Control("SaveRecord").SetActive(false);//隐藏掉该按钮
        //});
    }
    public void SetResult(int result)
    {
        if (result == 1)
        {
            for (int i = 0; i < Main.Ins.MeteorManager.UnitInfos.Count; i++)
            {
                if (Main.Ins.MeteorManager.UnitInfos[i].StateMachine != null)
                {
                    Main.Ins.MeteorManager.UnitInfos[i].StateMachine.Stop();
                }
                Main.Ins.MeteorManager.UnitInfos[i].controller.Input.ResetVector();
                Main.Ins.MeteorManager.UnitInfos[i].OnGameResult(result);
            }
        }

        if (Main.Ins.CombatData.GGameMode == GameMode.MENGZHU)
        {
            U3D.InsertSystemMsg("回合结束");
        }
        else
        {
            string mat = "";
            Text   txt;
            switch (result)
            {
            case -1:
            case 0:
                mat = "BattleLose";
                txt = Control("ButterflyWin").GetComponent <Text>();
                U3D.InsertSystemMsg("蝴蝶阵营 获胜");
                txt.text = "1";
                break;

            case 1:
            case 2:
                mat = "BattleWin";
                txt = Control("MeteorWin").GetComponent <Text>();
                U3D.InsertSystemMsg("流星阵营 获胜");
                txt.text = "1";
                break;

            case 3:
                mat = "BattleNone";
                U3D.InsertSystemMsg("和局");
                break;
            }
            BattleResult.GetComponent <Image>().material = Resources.Load <Material>(mat);
            BattleResult.SetActive(true);
            BattleTitle.SetActive(true);
        }
        Control("Close").SetActive(true);
        Control("Close").GetComponent <Button>().onClick.AddListener(() =>
        {
            Main.Ins.GameStateMgr.SaveState();
            Main.Ins.GameBattleEx.Pause();
            Main.Ins.StopAllCoroutines();
            Main.Ins.SoundManager.StopAll();
            Main.Ins.BuffMng.Clear();
            Main.Ins.MeteorManager.Clear();
            OnBackPress();
            Main.Ins.ExitState(Main.Ins.FightState);
            if (GameOverlayDialogState.Exist())
            {
                GameOverlayDialogState.Instance.ClearSystemMsg();
            }
            //离开副本
            if (Main.Ins.CombatData.GLevelMode == LevelMode.MultiplyPlayer)
            {
                UdpClientProxy.LeaveLevel();
            }
            else
            {
                FrameReplay.Instance.OnDisconnected();
                Main.Ins.PlayEndMovie(result == 1);
            }
        });
        Control("SaveRecord").SetActive(true);
        Control("SaveRecord").GetComponent <Button>().onClick.AddListener(() => {
            DialogUtils.Ins.OpenWait("正在保存录像,请稍后");
            //单独开一个线程去保存录像信息.
            RecordMgr.Ins.WriteFile();
            Control("SaveRecord").SetActive(false);//隐藏掉该按钮
        });
    }