示例#1
0
        /// <summary>
        /// 隐藏所有的庄
        /// </summary>
        public static void HideAllImg_Banker(this GameDataComponent GameData)
        {
            GameData.MySelf.GetComponent <GamerUIComponent>().HideRobBanker();

            foreach (KeyValuePair <ushort, Gamer> keyValuePair in GameData.UserInfos)
            {
                keyValuePair.Value.GetComponent <GamerUIComponent>().HideRobBanker();
            }
        }
示例#2
0
 public static void Awake(this GameDataComponent GameData, Gamer user)
 {
     if (user == null)
     {
         Log.Debug("user is NULL!!!!!!");
         return;
     }
     GameData.MySelf = user;
 }
示例#3
0
 /// <summary>
 /// 清除所有的玩家数据
 /// </summary>
 /// <param name="GameData"></param>
 public static void RemoveAll(this GameDataComponent GameData)
 {
     GameData.MySelf.GetComponent <GamerUIComponent>().Dispose();
     foreach (KeyValuePair <ushort, Gamer> gameDataUserInfo in GameData.UserInfos)
     {
         gameDataUserInfo.Value.Dispose();
     }
     GameData.UserInfos.Clear();
 }
示例#4
0
        /// <summary>
        /// 添加玩家信息
        /// </summary>
        /// <param name="GameData"></param>
        /// <param name="wChairId"></param>
        /// <param name="user"></param>
        public static void Add(this GameDataComponent GameData, ushort wChairId, Gamer user)
        {
            if (GameData.UserInfos.ContainsKey(wChairId))
            {
                Log.Error($"Is Exit This Key !!!!  ------- {wChairId} -----------");
                return;
            }

            GameData.UserInfos.Add(wChairId, user);
        }
示例#5
0
        /// <summary>
        /// 得到玩家信息
        /// </summary>
        /// <param name="GameData"></param>
        /// <param name="wChairId"></param>
        /// <returns></returns>
        public static Gamer GetUser(this GameDataComponent GameData, ushort wChairId)
        {
            if (!GameData.UserInfos.ContainsKey(wChairId))
            {
                Log.Error($"Not Find This Key !!!!  ------- {wChairId} -----------");
                return(null);
            }

            return(GameData.UserInfos[wChairId]);
        }
示例#6
0
 /// <summary>
 /// 删除玩家信息
 /// </summary>
 /// <param name="GameData"></param>
 /// <param name="wChairId"></param>
 public static void Remove(this GameDataComponent GameData, ushort wChairId)
 {
     if (!GameData.UserInfos.ContainsKey(wChairId))
     {
         Log.Error($"Not Find This Key !!!!  ------- {wChairId} -----------");
         return;
     }
     //释放掉
     GameData.UserInfos[wChairId].Dispose();
     //移除
     GameData.UserInfos.Remove(wChairId);
 }
示例#7
0
        protected override void Run(ETModel.Session session, Actor_GamerExitRoom_Ntt message)
        {
            //如果是自己退出房间
            if (message.ChairId == GameTools.GetUser().ChairId)
            {
                GameTools.GetUser().ChairId = 255;
                Game.Scene.GetComponent <UIComponent>().Remove(UIType.UIRoom);
                Game.Scene.GetComponent <UIComponent>().CreateOrShow(UIType.UILobby);
                return;
            }
            //有其他玩家退出房间
            GameDataComponent GameData = Game.Scene.GetComponent <GameDataComponent>();

            GameData.Remove(message.ChairId);
            Game.EventSystem.Run(EventIdType.UpdateView);
        }
示例#8
0
        /// <summary>
        /// 游戏开始
        /// </summary>
        public void GameStart()
        {
            GameDataComponent GameData = Game.Scene.GetComponent <GameDataComponent>();

            foreach (KeyValuePair <ushort, Gamer> info in GameData.UserInfos)
            {
                //如果是自己就跳过
                if (info.Key == GameTools.GetUser().ChairId)
                {
                    continue;
                }
                ushort ViewId = info.Key.ToView();
                PlayerPukes[ViewId].SetActive(true);
                info.Value.GetComponent <GamerUIComponent>().SetPanel(this.PlayerPukes[ViewId]);
            }
            PlayerPukes[0].SetActive(true);
            GameData.MySelf.GetComponent <GamerUIComponent>().SetPanel(PlayerPukes[0]);
        }
示例#9
0
        protected override void Run(ETModel.Session session, Actor_GamerEnterRoom_Ntt message)
        {
            GameDataComponent GameData = Game.Scene.GetComponent <GameDataComponent>();

            for (int i = 0; i < message.users.Count; i++)
            {
                GamerInfo user = message.users[i];
                //如果User为空  如果已经添加了此玩家的信息               如果是自己的信息
                if (user == null || GameData.IsExist(user.ChairID) || user.ChairID == GameTools.GetUser().ChairId)
                {
                    continue;
                }
                Gamer gamer = GamerFactory.CreateOther(user.ChairID, false);
                gamer.Loses    = user.Loses;
                gamer.Money    = user.Money;
                gamer.NickName = user.NickName;
                gamer.Wins     = user.Wins;
                GameData.Add(user.ChairID, gamer);
                Log.Debug($"存储新来的玩家的信息:{gamer.NickName}");
            }

            Game.EventSystem.Run(EventIdType.UpdateView);
        }
示例#10
0
 /// <summary>
 /// 是否存在此玩家信息
 /// </summary>
 /// <param name="GameData"></param>
 /// <param name="wChairId"></param>
 /// <returns></returns>
 public static bool IsExist(this GameDataComponent GameData, ushort wChairId)
 {
     return(GameData.UserInfos.ContainsKey(wChairId));
 }