Example #1
0
 public void SetData(Message.PlayerInfo info)
 {
     uid   = info.Uid;
     name  = info.Name;
     level = info.Level;
     exp   = info.Exp;
     gold  = info.Gold;
 }
Example #2
0
 public void SetData(Message.PlayerInfo info, int roomID, string token, bool isAI = false)
 {
     this.uid    = info.Uid;
     this.name   = info.Name;
     this.level  = info.Level;
     this.exp    = info.Exp;
     this.gold   = info.Gold;
     this.roomID = roomID;
     this.token  = token;
     this.isAI   = isAI;
 }
Example #3
0
        public RoomData MainServerRequsetCreateRoom(IList <Message.PlayerInfo> playerInfos)
        {
            var room  = GetProxy <RoomProxy>().CreateRoom();
            var users = new List <UserData>();

            foreach (var info in playerInfos)
            {
                var user = GetProxy <UserProxy>().AddUser(info, room.id, false);
                if (user == null)
                {
                    continue;
                }
                users.Add(user);
            }

            while (users.Count < 4)
            {
                Message.PlayerInfo info = new Message.PlayerInfo();
                info.Exp   = 0;
                info.Level = 1;
                info.Name  = GetRandomName();
                info.Uid   = -1;
                info.Gold  = 0;
                var user = GetProxy <UserProxy>().AddUser(info, room.id, true);
                if (user == null)
                {
                    continue;
                }
                users.Add(user);
            }

            room.SetUsers(users);
            NewPvL(room.id);
            Debug.LogInfo("房间创建【{0}】", room.id);
            return(room);
        }