summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/ServerManager.cs
blob: 0b281839e4c7c9c6c6fa03da07f6aa56adb761b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Collections;
using System.IO;
using UnityEngine;

public class ServerManager : DestroyableSingleton<ServerManager>
{
	public string OnlineNetAddress
	{
		get
		{
			return this.LastServer.Ip;
		}
	}

	public const string DefaultOnlineServer = "50.116.1.42";

	public static readonly ServerInfo DefaultServer = new ServerInfo
	{
		Name = "Primary",
		Ip = "50.116.1.42",
		Default = true
	};

	public ServerInfo[] availableServers;

	public ServerInfo LastServer = ServerManager.DefaultServer;

	private string serverInfoFile;

	private ServerManager.UpdateState state;

	private enum UpdateState
	{
		Connecting,
		Failed,
		Success
	}

	public void Start()
	{
		this.serverInfoFile = Path.Combine(Application.persistentDataPath, "serverInfo.dat");
		this.LastServer = ServerManager.DefaultServer;
		this.availableServers = new ServerInfo[]
		{
			this.LastServer
		};
		this.state = ServerManager.UpdateState.Success;
	}

	public IEnumerator WaitForServers()
	{
		while (this.state == ServerManager.UpdateState.Connecting)
		{
			yield return null;
		}
		yield break;
	}
}