Newer
Older
using UnityEngine;
using UnityEngine.UI; //andr
using static CommunicationEvents;
using static StreamingAssetLoader;
public class SaveNetwAddr_mobile : MonoBehaviour
{
public GameObject SaveSlot1_B_GObj;
public GameObject SaveSlot2_B_GObj;
public GameObject SaveSlot3_B_GObj;
Stefan Richter
committed
public GameObject SaveSlot4_B_GObj;
public GameObject SaveSlot5_B_GObj;
private Color32 firstColB;
private float transCol;
private ColorBlock tempColB;
public string Ip1_sup;
public string Ip2_sup;
public string Ip3_sup;
Stefan Richter
committed
public string Ip4_sup;
public string Ip5_sup;
void Start()
{
Ip1_sup = CommunicationEvents.IPslot1;
Ip2_sup = CommunicationEvents.IPslot2;
Ip3_sup = CommunicationEvents.IPslot3;
Stefan Richter
committed
Ip4_sup = CommunicationEvents.IPslot4;
Ip5_sup = CommunicationEvents.IPslot5;
}
private void Update()
{
UpdateUI_3_f();
UpdateUI_4_f();
UpdateUI_5_f();
Stefan Richter
committed
UpdateUI_7_f();
UpdateUI_8_f();
}
public void Refresh_pressed()
{
Ip1_sup = CommunicationEvents.IPslot1;
Ip3_sup = CommunicationEvents.IPslot3;
Stefan Richter
committed
Ip3_sup = CommunicationEvents.IPslot4;
Ip3_sup = CommunicationEvents.IPslot5;
//print("se" + Ip1_sup);
void UpdateUI_3_f()
{
//------------------------------------------------------------------------
tempColB = SaveSlot1_B_GObj.GetComponent<Button>().colors;
tempColB.pressedColor = colPressed;
tempColB.selectedColor = colSelect;
if (CommunicationEvents.ServerRunningA[3] == 0)
{
tempColB.normalColor = colOffline;
if (string.IsNullOrEmpty(CommunicationEvents.IPslot1))// || CommunicationEvents.IPslot1.Length < 1)
SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \n< empty >";
}
else
{
if (Ip1_sup.Equals(CommunicationEvents.IPslot1))
Stefan Richter
committed
SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer 1 (Offline) \n" + CommunicationEvents.IPslot1;
print("sss" + Ip1_sup.Equals(CommunicationEvents.IPslot1));
SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot1;
}
else
{
if (CommunicationEvents.ServerRunningA[3] == 2)
print("test" + Ip1_sup);
if (Ip1_sup.Equals(CommunicationEvents.IPslot1))
Stefan Richter
committed
SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer 1 (Online) \n" + CommunicationEvents.IPslot1;
print("s3ss" + Ip1_sup.Equals(CommunicationEvents.IPslot1));
SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot1;
print("ww" + Ip1_sup);
print("we" + CommunicationEvents.IPslot1);
else
{
tempColB.normalColor = colOffline;
SaveSlot1_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \n< empty >";
}
}
SaveSlot1_B_GObj.GetComponent<Button>().colors = tempColB;
}
void UpdateUI_4_f()
{
//-------------------------------------------------------------------------
tempColB = SaveSlot2_B_GObj.GetComponent<Button>().colors;
tempColB.pressedColor = colPressed;
tempColB.selectedColor = colSelect;
if (CommunicationEvents.ServerRunningA[4] == 0)
{
tempColB.normalColor = colOffline;
if (string.IsNullOrEmpty(CommunicationEvents.IPslot2))// || CommunicationEvents.IPslot2.Length<1)
{
SaveSlot2_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \n< empty >";
}
else
{
if (Ip2_sup.Equals(CommunicationEvents.IPslot2))
{
Stefan Richter
committed
SaveSlot2_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer 2 (Offline) \n" + CommunicationEvents.IPslot2;
}
else
{
SaveSlot2_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot2;
}
}
}
else
{
if (CommunicationEvents.ServerRunningA[4] == 2)
{
if (Ip2_sup.Equals(CommunicationEvents.IPslot2))
{
tempColB.normalColor = colOnline;
Stefan Richter
committed
SaveSlot2_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer 2 (Online) \n" + CommunicationEvents.IPslot2;
}
else
{
SaveSlot2_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot2;
}
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
}
else
{
tempColB.normalColor = colOffline;
SaveSlot2_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \n< empty >";
}
}
SaveSlot2_B_GObj.GetComponent<Button>().colors = tempColB;
}
void UpdateUI_5_f()
{
//---------------------------------------------------------------------------
tempColB = SaveSlot3_B_GObj.GetComponent<Button>().colors;
tempColB.pressedColor = colPressed;
tempColB.selectedColor = colSelect;
if (CommunicationEvents.ServerRunningA[5] == 0)
{
tempColB.normalColor = colOffline;
if (string.IsNullOrEmpty(CommunicationEvents.IPslot3))// || CommunicationEvents.IPslot3.Length < 1)
{
SaveSlot3_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \n< empty >";
}
else
{
if (Ip3_sup.Equals(CommunicationEvents.IPslot3))
{
Stefan Richter
committed
SaveSlot3_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer 3 (Offline) \n" + CommunicationEvents.IPslot3;
}
else
{
SaveSlot3_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot3;
}
}
}
else
{
if (CommunicationEvents.ServerRunningA[5] == 2)
{
if (Ip3_sup.Equals(CommunicationEvents.IPslot3))
{
tempColB.normalColor = colOnline;
Stefan Richter
committed
SaveSlot3_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer 3 (Onnline) \n" + CommunicationEvents.IPslot3;
}
else
{
SaveSlot3_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot3;
}
}
else
{
tempColB.normalColor = colOffline;
SaveSlot3_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \n< empty >";
}
}
SaveSlot3_B_GObj.GetComponent<Button>().colors = tempColB;
}
Stefan Richter
committed
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
void UpdateUI_7_f()
{
//---------------------------------------------------------------------------
tempColB = SaveSlot4_B_GObj.GetComponent<Button>().colors;
tempColB.pressedColor = colPressed;
tempColB.selectedColor = colSelect;
if (CommunicationEvents.ServerRunningA[7] == 0)
{
tempColB.normalColor = colOffline;
if (string.IsNullOrEmpty(CommunicationEvents.IPslot4))// || CommunicationEvents.IPslot3.Length < 1)
{
SaveSlot4_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \n< empty >";
}
else
{
if (Ip4_sup.Equals(CommunicationEvents.IPslot4))
{
SaveSlot4_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer 4 (Offline) \n" + CommunicationEvents.IPslot4;
}
else
{
SaveSlot4_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot4;
}
}
}
else
{
if (CommunicationEvents.ServerRunningA[7] == 2)
{
if (Ip4_sup.Equals(CommunicationEvents.IPslot4))
{
tempColB.normalColor = colOnline;
SaveSlot4_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer 4 (Online) \n" + CommunicationEvents.IPslot4;
}
else
{
SaveSlot4_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot4;
}
}
else
{
tempColB.normalColor = colOffline;
SaveSlot4_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \n< empty >";
}
}
SaveSlot4_B_GObj.GetComponent<Button>().colors = tempColB;
}
void UpdateUI_8_f()
{
//---------------------------------------------------------------------------
tempColB = SaveSlot3_B_GObj.GetComponent<Button>().colors;
tempColB.pressedColor = colPressed;
tempColB.selectedColor = colSelect;
if (CommunicationEvents.ServerRunningA[8] == 0)
{
tempColB.normalColor = colOffline;
if (string.IsNullOrEmpty(CommunicationEvents.IPslot5))// || CommunicationEvents.IPslot3.Length < 1)
{
SaveSlot5_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \n< empty >";
}
else
{
if (Ip5_sup.Equals(CommunicationEvents.IPslot5))
{
SaveSlot5_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer 5 (Offline) \n" + CommunicationEvents.IPslot5;
}
else
{
SaveSlot5_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot5;
}
}
}
else
{
if (CommunicationEvents.ServerRunningA[8] == 2)
{
if (Ip5_sup.Equals(CommunicationEvents.IPslot5))
{
tempColB.normalColor = colOnline;
SaveSlot5_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer 5 (Online) \n" + CommunicationEvents.IPslot5;
}
else
{
SaveSlot5_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \nServer " + CommunicationEvents.IPslot5;
}
}
else
{
tempColB.normalColor = colOffline;
SaveSlot5_B_GObj.GetComponentInChildren<Text>().text = "OVERWRITE: \n< empty >";
}
}
SaveSlot5_B_GObj.GetComponent<Button>().colors = tempColB;
}
public void Slot1_s()
{
CommunicationEvents.IPslot1 = CommunicationEvents.newIP;
//CommunicationEvents.ServerAdress = "http://" + CommunicationEvents.ServerAddress1;
Update();
NetworkJSON_Save();
//CSform.CheckIPAdr();
}
public void Slot2_s()
{
//CommunicationEvents.ServerAdress = "http://" + CommunicationEvents.ServerAddress2;
CommunicationEvents.IPslot2 = CommunicationEvents.newIP;
Update();
NetworkJSON_Save();
//CSform.CheckIPAdr();
}
public void Slot3_s()
{
//CheckServer ani = new CheckServer();//= obj.AddComponent<CheckServer>();
// ani.StartCheck();
CommunicationEvents.IPslot3 = CommunicationEvents.newIP;
Update();
CheckServerA[5] = 1;
Refresh_pressed();
NetworkJSON_Save();
//CSform.CheckIPAdr();
}
Stefan Richter
committed
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
public void Slot4_s()
{
//CheckServer ani = new CheckServer();//= obj.AddComponent<CheckServer>();
// ani.StartCheck();
CommunicationEvents.IPslot4 = CommunicationEvents.newIP;
Update();
CheckServerA[7] = 1;
Refresh_pressed();
NetworkJSON_Save();
//CSform.CheckIPAdr();
}
public void Slot5_s()
{
//CheckServer ani = new CheckServer();//= obj.AddComponent<CheckServer>();
// ani.StartCheck();
CommunicationEvents.IPslot5 = CommunicationEvents.newIP;
Update();
CheckServerA[8] = 1;
Refresh_pressed();
NetworkJSON_Save();
//CSform.CheckIPAdr();
}