| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 | 
							- using LightReflectiveMirror;
 
- using Mirror;
 
- using System.Collections;
 
- using System.Collections.Generic;
 
- using UnityEngine;
 
- using UnityEngine.UI;
 
- public class menuController : MonoBehaviour
 
- {
 
-     public GameObject modSelectionPanel;
 
-     public GameObject serverSelectionPanel;
 
-     [Header("Server List")]
 
-     public Transform scrollParent;
 
-     public GameObject serverRow;
 
-     public float heightPerRow = 30;
 
-     public int curSelected = 0;
 
-     private LightReflectiveMirrorTransport _LRM;
 
-     public Toggle isPrivate;
 
-     public InputField serverNameInput;
 
-     void Start()
 
-     {
 
-         if (_LRM == null)
 
-         {
 
-             _LRM = (LightReflectiveMirrorTransport)Transport.activeTransport;
 
-             _LRM.serverListUpdated.AddListener(ServerListUpdate);
 
-         }
 
-     }
 
-     // Update is called once per frame
 
-     void Update()
 
-     {
 
-         
 
-     }
 
-     void OnDisable()
 
-     {
 
-         if (_LRM != null) { _LRM.serverListUpdated.RemoveListener(ServerListUpdate); }
 
-     }
 
-     public void refreshServers()
 
-     {
 
-         _LRM.RequestServerList();
 
-     }
 
-     public void ServerListUpdate()
 
-     {
 
-        // 
 
-         //clear all entries
 
-         foreach(Transform t in scrollParent) { Destroy(t.gameObject); }
 
-         bool b1 = false;
 
-         modSelector ModSelector = FindObjectOfType<modSelector>();
 
-         for (int i =0; i < _LRM.relayServerList.Count; i++)
 
-         {
 
-             //int mapId = int.Parse(_LRM.relayServerList[i].serverName.Substring(0, 1));
 
-             if(NetworkManager.singleton.onlineScene == ModSelector.scenes[ModSelector.currentSelectedId])
 
-           //  if(mapId == FindObjectOfType<modSelector>().currentSelectedId)
 
-             {
 
-                 GameObject go = Instantiate(serverRow, scrollParent);
 
-                 go.transform.GetChild(0).GetComponent<Text>().text = _LRM.relayServerList[i].serverName;
 
-                 go.transform.GetChild(1).GetComponent<Text>().text = _LRM.relayServerList[i].currentPlayers + "/" + _LRM.relayServerList[i].maxPlayers;
 
-                 go.GetComponent<Button>().onClick.AddListener(() => { selectServer(i - 1); });
 
-                 if (!b1)
 
-                 {
 
-                     go.GetComponent<Image>().color = Color.grey;
 
-                     b1 = true;
 
-                 }
 
-             }            
 
-         }
 
-         scrollParent.GetComponent<RectTransform>().sizeDelta = new Vector2(scrollParent.GetComponent<RectTransform>().sizeDelta.x, heightPerRow *(_LRM.relayServerList.Count+1));
 
-     }
 
-     public void selectServer(int id)
 
-     {
 
-         Debug.Log("Selected server :" + id);
 
-         if(id < scrollParent.childCount-1) { return; }
 
-         curSelected = id;
 
-         foreach(Transform t in scrollParent.GetComponentsInChildren<Transform>())
 
-         {
 
-             if(t.GetComponent<Image>()!=null)t.GetComponent<Image>().color = serverRow.GetComponent<Image>().color;
 
-         }
 
-         scrollParent.GetChild(id).GetComponent<Image>().color = Color.grey;
 
-     }
 
-     public void joinServer()
 
-     {
 
-         
 
-             NetworkManager.singleton.networkAddress= _LRM.relayServerList[curSelected].serverId.ToString();
 
-             NetworkManager.singleton.StartClient();
 
-         
 
-     }
 
-     public void hostClicked()
 
-     {
 
-         if (serverNameInput.text.Length > 3)
 
-         {
 
-             modSelector ModSelector = FindObjectOfType<modSelector>();
 
-             _LRM.serverName = serverNameInput.text;
 
-             _LRM.extraServerData = ModSelector.scenes[ModSelector.currentSelectedId];
 
-             _LRM.isPublicServer = !isPrivate.isOn;
 
-             _LRM.ServerStart();
 
-             NetworkManager.singleton.StartHost();
 
-         }
 
-     }
 
-     public void selectMod(int modId)
 
-     {
 
-         modSelectionPanel.SetActive(false);
 
-         serverSelectionPanel.SetActive(true);
 
-     }
 
-     public void gotoModSelection()
 
-     {
 
-         modSelectionPanel.SetActive(true);
 
-         serverSelectionPanel.SetActive(false);
 
-     }
 
- }
 
 
  |