Example #1
0
        public void FastQuitGame()
        {
            //正常退出,则清除

            Game.PopupComponent.CloseNoticeUI();

            ClearReBackData();

            DDZGameHelper.Reset();

            DDZUIFactory.gameScene.Remove();

            UI overUI = Game.Scene.GetComponent <UIComponent>().Get(UIType.UIDDZOverPanel);

            if (overUI != null)
            {
                DDZUIFactory.overPanel.Remove();
            }

            this.Reset();

            DataCenterComponent.Instance.userInfo.deleteAllUserExcptMe();

            if (DDZConfig.GameScene.PlayerListsPanel != null)
            {
                Game.PopupComponent.ClosePlayerListPanel();
            }

            if (_BackHall)
            {
                Game.EventSystem.Run(EventIdType.SubGameReBackLobby);

                //音乐切换为大厅

                SoundHelper.SubGameExitResetSound();

                SoundComponent.Instance.Stop(CurrentSoundName);

                var _soundVolume = PlayerPrefs.GetFloat("SoundVolume", 1);

                SoundComponent.Instance.PlayMusic(DataCenterComponent.Instance.soundInfo.bg_hall, 0, _soundVolume, true);
            }
        }
Example #2
0
        /// <summary>
        /// 进入斗地主
        /// </summary>
        private async void OnDDZ_LevelButton()
        {
            try
            {
                Game.PopupComponent.ShowLoadingLockUI(DataCenterComponent.Instance.tipInfo.EnterSubGameTip);

                var response = (G2C_JionRoom_Res)await SessionComponent.Instance.Session.Call(
                    new C2G_JionRoom_Req()
                {
                    AreaId = GameHelper.AreaList[DDZGameHelper.CurrentGameInfo.GameId][0].AreaId,
                    GameId = DDZGameHelper.CurrentGameInfo.GameId,
                    UserId = GamePrefs.GetUserId(),
                });

                Game.PopupComponent.CloseLoadingLockUI();

                if (response.Error != 0)
                {
                    Game.PopupComponent.ShowMessageBox(response.Message);
                    return;
                }

                DDZGameHelper.RoomId = response.RoomId;

                GameLobbyFactory.Remove();

                DDZUIFactory.fieldScene.Remove();

                SoundHelper.FadeOutPlaySound();

                DDZUIFactory.gameScene.Create();
            }
            catch (Exception e)
            {
                Game.PopupComponent.ShowMessageBox(e.Message);
                throw;
            }
        }