Beispiel #1
0
        private void GetServerListFinish(bool success, string body)
        {
            ServerList result = new ServerList();

            result.success = success;
            if (success)
            {
                JSONNode node = JSONNode.Parse(body);
                result.tester = node["tester"].AsInt;
                result.time   = node["time"].AsLong;
                JSONArray         jsonArrayServers = node["list"].AsArray;
                List <ServerInfo> servers          = result.servers;
                foreach (JSONNode item in jsonArrayServers.Childs)
                {
                    ServerInfo serverInfo = new ServerInfo();
                    serverInfo.address    = item["address"].Value;
                    serverInfo.closeTime  = item["close_time"].AsLong;
                    serverInfo.label      = item["label"].Value;
                    serverInfo.openTime   = item["open_time"].AsLong;
                    serverInfo.serverId   = item["sid"].Value;
                    serverInfo.serverName = item["name"].Value;
                    serverInfo.status     = item["status"].AsInt;
                    serverInfo.tag        = item["tag"].Value;
                    List <GameRoleInfo> roles          = serverInfo.roles;
                    JSONArray           jsonArrayRoles = node["role"].AsArray;
                    foreach (JSONNode itemRole in jsonArrayRoles.Childs)
                    {
                        GameRoleInfo roleInfo = new GameRoleInfo();
                        roleInfo.extra      = itemRole["profile"].Value;
                        roleInfo.lastUpdate = itemRole["last_update"].AsInt;
                        roleInfo.roleId     = itemRole["role"].Value;
                        roleInfo.roleLevel  = itemRole["level"].AsInt;
                        roleInfo.roleName   = itemRole["name"].Value;
                        roleInfo.roleVip    = itemRole["vip"].Value;
                        roleInfo.serverId   = itemRole["server"].Value;
                        roleInfo.gender     = itemRole["gender"].AsInt;
                        roleInfo.balance    = itemRole["balance"].AsInt;
                        roles.Add(roleInfo);
                    }
                    servers.Add(serverInfo);
                }
            }
            else
            {
                result.message = body;
            }
            getServerListListener(result);
        }
Beispiel #2
0
        public virtual void UploadGameRoleInfo(GameRoleInfo gameRoleInfo)
        {
            JSONClass json = new JSONClass();

            json.Add("type", new JSONData(gameRoleInfo.type));
            json.Add("roleId", new JSONData(gameRoleInfo.roleId));
            json.Add("roleName", new JSONData(gameRoleInfo.roleName));
            json.Add("roleLevel", new JSONData(gameRoleInfo.roleLevel));
            json.Add("roleVip", new JSONData(gameRoleInfo.roleVip));
            json.Add("serverId", new JSONData(gameRoleInfo.serverId));
            json.Add("sex", new JSONData(gameRoleInfo.gender));
            json.Add("balance", new JSONData(gameRoleInfo.balance));
            json.Add("lastUpdate", new JSONData(gameRoleInfo.lastUpdate));
            json.Add("extra", new JSONData(gameRoleInfo.extra));
            currentActivity.Call("uploadGameRoleInfo", json.ToString());
        }
Beispiel #3
0
 void IBaseApi.UploadGameRoleInfo(GameRoleInfo gameRoleInfo)
 {
     throw new NotImplementedException();
 }
Beispiel #4
0
 public void UploadGameRoleInfo(GameRoleInfo gameRoleInfo)
 {
 }
Beispiel #5
0
 /// <summary>
 /// 上报角色信息
 /// </summary>
 /// <param name="gameRoleInfo">角色信息</param>
 /// <returns></returns>
 public virtual void UploadGameRoleInfo(GameRoleInfo gameRoleInfo)
 {
     instanceImpl.UploadGameRoleInfo(gameRoleInfo);
 }