Esempio n. 1
0
        /// <summary>
        /// 切换到场景回调
        /// </summary>
        public void ChangeSceneHandler()
        {
            GameController.Instance.InitTime(Utils.READY_TIME);
            CodeController.Instance.SetAlpha();
            ///倒计时结束
            GameController.Instance.OnReadyEndTime += (() =>
            {
                ///游戏准备好了要做的事情
                GameDataHandle.GameReadyImpl();
                GameStarusIsGame();
            });


            //_uiAnimation.readyTime.readyTimeDoneEvent -= _GameStarusIsSundGlass;
            Debug.LogError("-------------- _GameStarusIsSundGlass -------------- ");
        }
Esempio n. 2
0
        public override List <IGameMessage> HandleData(GameUserSession session, dataNewConnect data)
        {
            session.GameAttr.UserName = data.UserName;
            session.GameAttr.Weight   = data.Weight;

            session.KeepOneSession(data.OpenId);

            List <IGameMessage> msgList = new List <IGameMessage>();
            var GameManager             = session.GameManager;
            var r = GameManager.FindAvailableRoom(data.Weight);

            if (r.IsSuccess)
            {
                //表明是新房间,则初始化新游戏的数据
                if (r.IntMsg == 0)
                {
                    GameDataHandle.GenerateEmptyGame(session.GameServer, r.SuccessMsg);
                }
                else
                {
                    GameDataHandle.ReCoverData(session.GameServer, r.SuccessMsg);
                }

                session.GameAttr.RoomCode = r.SuccessMsg;
                //用户进入房间
                r = GameManager.UserEntryRoom(r.SuccessMsg);
            }
            if (r.IsSuccess)
            {
                /*【注】如果服务器宕机,GameDataHandle将空*/
                var DataHandle = GameManager.GameDataHandle;
                var oneGame    = DataHandle.GetGameData(true);
                msgList.Add(oneGame);
            }
            else
            {
                msgList.Add(new MessageNormalError(r.ErrorMsg));
            }



            return(msgList);
        }