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();
     }
 }
Пример #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();
    }
Пример #3
0
    private void Awake()
    {
        Ins                     = this;
        Log                     = new Log();
        ActiveState             = new List <PersistState>();
        GameOverlay             = new GameOverlayDialogState();
        FightState              = new FightState();
        ReplayState             = new ReplayState();
        NickNameDialogState     = new NickNameDialogState();
        BattleStatusDialogState = new BattleStatusDialogState();
        PlayerDialogState       = new PlayerDialogState();
        ChatDialogState         = new ChatDialogState();
        PsdEditDialogState      = new PsdEditDialogState();
        RoomChatDialogState     = new RoomChatDialogState();
        LoadingEx               = new LoadingEXDialogState();
        ItemInfoDialogState     = new ItemInfoDialogState();
        GunShootDialogStatus    = new GunShootDialogStatus();
        //面板管理器.
        DialogStateManager = new MainDialogStateManager();
        //顺序排队弹出框.
        PopupStateManager = new MainPopupStateManager();
        //各类游戏数据.
        GameStateMgr    = new GameStateMgr();
        UpdateHelper    = new UpdateHelper();
        AppInfo         = new AppInfo();
        CombatData      = new CombatData();
        GameNotice      = new GameNotice();
        MeteorManager   = new MeteorManager();
        ScriptMng       = new ScriptMng();
        SFXLoader       = new SFXLoader();
        ActionInterrupt = new ActionInterrupt();

        BuffMng         = new BuffMng();
        EventBus        = new EventBus();
        NetWorkBattle   = new NetWorkBattle();
        SceneMng        = new SceneMng();
        FrameSync       = new FrameSync();
        MeteorBehaviour = new MeteorBehaviour();
        DropMng         = new DropMng();
        //原版相关资源的加载器.
        MenuResLoader    = new MenuResLoader();
        SkcLoader        = new SkcLoader();
        BncLoader        = new BncLoader();
        FMCLoader        = new FMCLoader();
        GMBLoader        = new GMBLoader();
        GMCLoader        = new GMCLoader();
        DesLoader        = new DesLoader();
        FMCPoseLoader    = new FMCPoseLoader();
        DataMgr          = new DataMgr();
        SfxMeshGenerator = new SfxMeshGenerator();
        RoomMng          = new RoomMng();
        SoundManager     = new SoundManager();
        ResMng           = new ResMng();
        DlcMng           = new DlcMng();

        DontDestroyOnLoad(gameObject);
        Log.WriteError(string.Format("GameStart AppVersion:{0}", Main.Ins.AppInfo.AppVersion()));
    }
 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();
 }
Пример #5
0
 public void Init()
 {
     ActiveState             = new List <PersistState>();
     ReconnectDialogState    = new ReconnectDialogState();
     GameOverlay             = new GameOverlayDialogState();
     FightState              = new FightState();
     ReplayState             = new ReplayState();
     NickNameDialogState     = new NickNameDialogState();
     BattleStatusDialogState = new BattleStatusDialogState();
     ConnectServerState      = new ConnectServerDialogState();
     PlayerDialogState       = new PlayerDialogState();
     ChatDialogState         = new ChatDialogState();
     PsdEditDialogState      = new PsdEditDialogState();
     RoomChatDialogState     = new RoomChatDialogState();
     LoadingEx              = new LoadingEXDialogState();
     ItemInfoDialogState    = new ItemInfoDialogState();
     GunShootDialogState    = new GunShootDialogState();
     TipDialogState         = new TipDialogState();
     WaitDialogState        = new WaitDialogState();
     RecordSelectState      = new RecordSelectState();
     ScriptInputDialogState = new ScriptInputDialogState();
 }
Пример #6
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();
     }
 }
Пример #7
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);//隐藏掉该按钮
        });
    }