Exemple #1
0
        /// <summary>
        /// 玩家准备或者取消协议
        /// </summary>
        /// <param name="buffer"></param>
        public void do8006(ByteBuffer buffer)
        {
            string username = buffer.readString();
            int    isReady  = buffer.readInt();
            int    position = buffer.readInt();

            UserNode userNode = userNodeDic[position];

            ////准备和取消设置(新版的)
            userNode.SetReadyImg(isReady, username);
            this.myRoom.isClick = false;

            //准备和取消设置(老版的)

            /*
             * if (username.Equals(Player.GetPlayer().Username))
             * {
             *
             *  if (isReady == 1)
             *  {
             *      this.myRoom.btnText.text = "取消";
             *  }
             *  else if (isReady == -1)
             *  {
             *      this.myRoom.btnText.text = "准备";
             *  }
             *  this.myRoom.isClick = false;
             * }
             * else
             * {
             *  if (isReady == 1)
             *  {
             *      userNode.txtReady.text = "准备";
             *  }
             *  else if(isReady==-1)
             *  {
             *      userNode.txtReady.text = "取消";
             *  }
             *
             * }
             */
        }
Exemple #2
0
        /// <summary>
        /// 玩家加入房间,某个玩家的消息发送给房间的其他所有人(自己加入房间也会收到自己的,所以要排除自己的)
        /// </summary>
        /// <param name="buffer"></param>
        public void do7001(ByteBuffer buffer)
        {
            string username  = buffer.readString();
            string userCname = buffer.readString();
            int    posation  = buffer.readInt();
            string userImage = buffer.readString();
            int    userReady = buffer.readInt();

            if (username.Equals(Player.GetPlayer().Username))
            {
                return;
            }
            User user = new User(username, userCname, posation, userImage, userReady);

            this.roomInfo.AddUser(user);
            UserNode userNode = userNodeDic[posation];

            userNode.SetUserCname(userCname);
            userNode.SetUserImageUrl(userImage);
            //设置玩家的状态(老版的)
            //userNode.SetReadyText(user);
            //设置玩家的状态(老版的)
            userNode.SetReadyImg(user.UserReady);
        }