// //--------------------------------------------------------
|
// // [Author]: 玩个游戏
|
// // [ Date ]: Wednesday, January 10, 2018
|
// //--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine.UI;
|
using System;
|
using LitJson;
|
|
|
public class ServerInfoCommon
|
{
|
public ServerGroup recommend;
|
public ServerGroup[] common;
|
|
public bool FindServerData(int _id, out ServerData _serverData)
|
{
|
if (common == null)
|
{
|
_serverData = default(ServerData);
|
return false;
|
}
|
|
for (int i = 0; i < common.Length; i++)
|
{
|
if (common[i].FindServerData(_id, out _serverData))
|
{
|
return true;
|
}
|
}
|
|
_serverData = default(ServerData);
|
return false;
|
}
|
}
|
|
|
public class ServerInfoPlayer
|
{
|
public ServerGroup player;
|
public ServerGroup gametest;
|
public int white;
|
}
|
|
|
public class ServerGroup
|
{
|
public string group_title;
|
public ServerData[] group_list;
|
|
public bool FindServerData(int _id, out ServerData _serverData)
|
{
|
if (group_list == null)
|
{
|
_serverData = default(ServerData);
|
return false;
|
}
|
|
for (int i = 0; i < group_list.Length; i++)
|
{
|
if (group_list[i].region_flag == _id)
|
{
|
_serverData = group_list[i];
|
return true;
|
}
|
}
|
|
_serverData = default(ServerData);
|
return false;
|
}
|
}
|
|
|
public struct ServerData
|
{
|
public int region_flag;
|
public string name;
|
public int running_status;
|
public int statue;
|
public int is_recommend;
|
public string region_domain;
|
public int login_port;
|
public int game_port;
|
public DateTime start_date;
|
public int job;
|
public string roleid;
|
public int level;
|
public DateTime last_login_time;
|
|
// public ServerData(LoginSeverListConfig config)
|
// {
|
// region_flag = config.ID;
|
// name = config.serverName;
|
// running_status = 1;
|
// statue = 1;
|
// is_recommend = 0;
|
// region_domain = config.ip;
|
// int.TryParse(config.pagePort, out login_port);
|
// game_port = config.gatePort;
|
// start_date = DateTime.Now;
|
// job = 0;
|
// roleid = string.Empty;
|
// level = 0;
|
// last_login_time = DateTime.Now;
|
// }
|
|
public static int Compare(ServerData _lhs, ServerData _rhs)
|
{
|
if (_lhs.is_recommend != _rhs.is_recommend)
|
{
|
return _lhs.is_recommend == 1 ? -1 : 1;
|
}
|
|
return _lhs.region_flag > _rhs.region_flag ? -1 : 1;
|
}
|
|
public static int LastLoginTimeCompare(ServerData _lhs, ServerData _rhs)
|
{
|
return _lhs.last_login_time > _rhs.last_login_time ? -1 : 1;
|
}
|
|
}
|
|
public struct ServerDataCouple
|
{
|
public ServerData serverData1;
|
//public ServerData serverData2;
|
|
public ServerDataCouple(ServerData _data1)
|
{
|
serverData1 = _data1;
|
//serverData2 = default(ServerData);
|
}
|
|
public ServerDataCouple(ServerData _data1, ServerData _data2)
|
{
|
serverData1 = _data1;
|
//serverData2 = _data2;
|
}
|
}
|