3 protected const string HOST_LOCALY =
"lan";
4 protected const string BIND_IP =
"bindAddress";
5 protected const string BIND_PORT =
"bindPort";
6 protected const string PUBLIC_IP =
"publicAddress";
7 protected const string PUBLIC_PORT =
"publicPort";
14 protected bool m_bWasPortEdited =
false;
17 protected ref ScriptInvoker<string> m_OnPortChanged;
20 ScriptInvoker GetOnPortChanged()
23 m_OnPortChanged =
new ScriptInvoker();
25 return m_OnPortChanged;
29 override void HandlerAttached(Widget w)
31 super.HandlerAttached(w);
37 if (m_HostLocalyCheck)
38 m_HostLocalyCheck.GetSpinBox().m_OnChanged.Insert(OnHostLocalyChanged);
42 m_PublicPortEdit.GetEditBoxComponent().m_OnChanged.Insert(OnPublicPortChanged);
46 m_BindPortEdit.GetEditBoxComponent().m_OnChanged.Insert(OnBindPortChanged);
52 bool selected = option == 1;
55 m_PublicAddress.SetInteractive(!selected);
60 m_PublicAddress.SetValue(SCR_WidgetEditFormatIP.LAN_VALUE);
65 m_PublicAddress.SetValue(
"");
73 if (!m_bWasPortEdited && !text.IsEmpty())
75 m_bWasPortEdited =
true;
77 else if (m_bWasPortEdited && text.IsEmpty())
79 m_bWasPortEdited =
false;
87 if (!m_bWasPortEdited && m_BindPortEdit)
89 m_BindPortEdit.SetValue(text);
90 m_BindPortEdit.ClearInvalidInput();
94 m_OnPortChanged.Invoke(text);
101 FindEntry(HOST_LOCALY).SetValue(
SCR_JsonApiStructHandler.BoolToString(config.publicAddress == SCR_WidgetEditFormatIP.LAN_VALUE));
102 FindEntry(PUBLIC_IP).SetValue(config.publicAddress);
103 FindEntry(PUBLIC_PORT).SetValue(config.publicPort.ToString());
104 FindEntry(BIND_IP).SetValue(config.bindAddress);
105 FindEntry(BIND_PORT).SetValue(config.bindPort.ToString());
109 void SetIPPort(DSConfig config)
111 FindEntry(PUBLIC_IP).SetValue(config.publicAddress);
112 FindEntry(PUBLIC_PORT).SetValue(config.publicPort.ToString());
113 FindEntry(BIND_IP).SetValue(config.bindAddress);
114 FindEntry(BIND_PORT).SetValue(config.bindPort.ToString());
118 void SetPorts(
string port)
120 m_PublicPortEdit.SetValue(port);
121 m_BindPortEdit.SetValue(port);