blob: b29aa30105e5c23cb6143e62517de0174011afff (
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
|
using System;
using System.Net;
using UnityEngine;
using UnityEngine.Events;
public class ServerSelector : MonoBehaviour
{
public ServerSelectUi Parent { get; set; }
public ServerInfo MyServer = new ServerInfo();
public TextRenderer Text;
public ButtonRolloverHandler Background;
public TextBox ipInput;
public void Start()
{
if (this.ipInput)
{
this.ipInput.SetText(this.MyServer.Ip, "");
this.ipInput.OnChange.AddListener(new UnityAction(this.OnIpChange));
return;
}
this.Text.Text = this.MyServer.Name;
}
private void OnIpChange()
{
IPAddress ipaddress;
if (!IPAddress.TryParse(this.ipInput.text, out ipaddress))
{
return;
}
this.MyServer.Name = "Custom";
this.MyServer.Ip = this.ipInput.text;
this.Select();
}
public void Select()
{
this.Background.OutColor = Color.green;
this.Background.DoMouseOut();
this.Parent.SelectServer(this);
}
internal void Unselect()
{
this.Background.OutColor = Color.white;
this.Background.DoMouseOut();
}
}
|