| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using LitJson; |
| | | using System; |
| | | using Snxxz.UI; |
| | | using TableConfig; |
| | | |
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | | using LitJson;
|
| | | using System;
|
| | | using Snxxz.UI;
|
| | | using TableConfig;
|
| | |
|
| | | public class ServerListCenter : Singleton<ServerListCenter>
|
| | | {
|
| | | public static readonly string[] JUMP_URL = new string[] { "http://pub.game.2460web.com:11000/server_list/?"
|
| | |
| | | public ServerInfoCommon serverInfoCommon { get; private set; }
|
| | |
|
| | | ServerData m_CurrentServer;
|
| | | public ServerData currentServer {
|
| | | public ServerData currentServer
|
| | | {
|
| | | get { return m_CurrentServer; }
|
| | | set {
|
| | | set
|
| | | {
|
| | | m_CurrentServer = value;
|
| | | m_SelectedServer = true;
|
| | |
|
| | |
| | | }
|
| | |
|
| | | string m_CurrentServerGroup = string.Empty;
|
| | | public string currentServerGroup {
|
| | | get {
|
| | | public string currentServerGroup
|
| | | {
|
| | | get
|
| | | {
|
| | | return m_CurrentServerGroup;
|
| | | }
|
| | | set {
|
| | | set
|
| | | {
|
| | | if (m_CurrentServerGroup != value)
|
| | | {
|
| | | m_CurrentServerGroup = value;
|
| | |
| | | bool serverListPlayerPartGot = false;
|
| | | bool serverListCommonPartGot = false;
|
| | |
|
| | | public bool serverListGot {
|
| | | public bool serverListGot
|
| | | {
|
| | | get { return serverListCommonPartGot; }
|
| | | }
|
| | |
|
| | | string accountNameBuf;
|
| | |
|
| | | public event Action onServerListRefreshEvent; |
| | | public event Action serverGroupSelectEvent; |
| | | public event Action onServerListRefreshEvent;
|
| | | public event Action serverGroupSelectEvent;
|
| | | public event Action serverSelectEvent;
|
| | |
|
| | | const string LOGIN_SERVER = "LoginServer";
|
| | | public int localSaveServerId {
|
| | | get {
|
| | | public int localSaveServerId
|
| | | {
|
| | | get
|
| | | {
|
| | | return LocalSave.GetInt(LOGIN_SERVER);
|
| | | }
|
| | | set {
|
| | | set
|
| | | {
|
| | | LocalSave.SetInt(LOGIN_SERVER, value);
|
| | | }
|
| | | } |
| | | |
| | | int jumpUrlIndex = 0; |
| | | |
| | | }
|
| | |
|
| | | int jumpUrlIndex = 0;
|
| | |
|
| | | public ServerData GetServerData(int _id)
|
| | | {
|
| | | if (serverInfoPlayer != null && serverInfoPlayer.player != null && serverInfoPlayer.player.group_list != null)
|
| | |
| | | var url = StringUtility.Contact(JUMP_URL[jumpUrlIndex % 2], "flag=", VersionConfig.Get().appId, "_", VersionConfig.Get().branch, "_", VersionConfig.Get().version);
|
| | | jumpUrlIndex++;
|
| | | HttpRequest.Instance.RequestHttpGet(url, HttpRequest.defaultHttpContentType, 1, OnRequestJumpUrl);
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | private void OnRequestJumpUrl(bool _ok, string _result)
|
| | | {
|
| | | if (_ok)
|
| | |
| | | {
|
| | | Clock.Create(DateTime.Now + new TimeSpan(TimeSpan.TicksPerSecond), RequestJumpUrl);
|
| | | }
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | public void RequestServerList()
|
| | | {
|
| | | serverListCommonPartGot = false;
|
| | |
| | |
|
| | | public void RequestServerListPlayer(string _accountName)
|
| | | {
|
| | | _accountName = "alee18";
|
| | | accountNameBuf = _accountName;
|
| | | var url = string.Empty;
|
| | | var tables = new Dictionary<string, string>();
|
| | |
| | | }
|
| | |
|
| | | HttpRequest.Instance.RequestHttpGet(url, HttpRequest.defaultHttpContentType, 1, OnGetServerListPlayer);
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | private void OnGetServerListPlayer(bool _ok, string _result)
|
| | | {
|
| | | if (_ok)
|
| | |
| | | });
|
| | | }
|
| | | }
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | public bool TryGetServerGroup(string _key, out ServerGroup _group)
|
| | | {
|
| | | if (serverInfoPlayer != null && serverInfoPlayer.player != null && _key == serverInfoPlayer.player.group_title)
|
| | |
| | |
|
| | | _group = null;
|
| | | return false;
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | public List<string> GetAllServerGroup()
|
| | | {
|
| | | var serverGroupTitles = new List<string>();
|
| | |
| | | }
|
| | |
|
| | | return serverGroupTitles;
|
| | | } |
| | | |
| | | |
| | | }
|
| | |
|
| | |
|
| | | private void ProcessRecentServerData()
|
| | | {
|
| | | if (serverInfoPlayer != null && serverInfoPlayer.player != null && serverInfoCommon != null)
|
| | |
| | | group.Sort(ServerData.LastLoginTimeCompare);
|
| | | serverInfoPlayer.player.group_list = group.ToArray();
|
| | | }
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | private void FiltrateDefaultServerAndServerGroup()
|
| | | {
|
| | | if (serverInfoPlayer != null && serverInfoPlayer.player != null && serverInfoPlayer.player.group_list != null && serverInfoPlayer.player.group_list.Length > 0)
|
| | |
| | |
|
| | | }
|
| | |
|
| | | } |
| | | |
| | | } |
| | | }
|
| | |
|
| | | }
|