void OnEnable()
 {
     m_Master        = GetComponentInParent <ButtonToggleList> ();
     m_CurrentButton = GetComponent <Button> ();
     m_CurrentUser   = GetComponent <User> ();
     m_CurrentButton.onClick.AddListener(OnSubmit);
 }
    void Start()
    {
        Transform scrollContent = this.transform.Find("Content");

        serverList = this.transform.Find("Server List").GetComponent <ButtonToggleList>();

        int i = 0;

        foreach (ServerPlacedScript server in GameData.servers)
        {
            if (server.CPULeft() > currentClient.reqPPower &&
                server.RAMLeft() > currentClient.reqRam &&
                server.StorageLeft() > currentClient.reqStorage &&
                server.HasPortsOpen(currentClient.reqPorts))
            {
                GameObject serverItem = (GameObject)Instantiate(serverItemPrefab);
                serverItem.GetComponentInChildren <Text>().text = server.data.serverName;
                serverItem.GetComponent <ServerItem>().server   = server;
                serverItem.transform.SetParent(list, false);
            }

            i++;
        }

        this.transform.Find("OK").GetComponent <Button>().onClick.AddListener(delegate
        {
            if (serverList.selected == null)
            {
                this.transform.Find("Error Select Server").gameObject.SetActive(true);
            }
            else
            {
                currentClient.id = GameData.storage.clients.AddClient(currentClient);
                serverList.selected.GetComponent <ServerItem>().server.data.clients.Add(currentClient.id);

                GameObject.Find("Time").GetComponent <EventManager>().Trigger("NewClient", currentClient);

                GameData.generatedClients[currentClient.difficulty].client = clientList.GenClient(currentClient.difficulty).client;
            }
        });
    }
    // Use this for initialization
    void Start()
    {
        ServerPlacedScript server = GameData.CurrentServer;

        clientObj  = this.transform.Find("Client Info");
        toggleList = this.transform.Find("Clients List").Find("List").GetComponent <ButtonToggleList>();

        clientObj.Find("Remove Client").GetComponent <Button>().onClick.AddListener(delegate
        {
            if (client != null)
            {
                removeClientWindow.gameObject.SetActive(true);
                removeClientWindow.client = client;
            }
        });

        int i = 0;

        foreach (int clientId in server.data.clients)
        {
            Client     client     = GameData.storage.clients.GetClient(clientId);
            GameObject clientItem = (GameObject)Instantiate(clientPrefab);

            clientItem.GetComponentInChildren <Text>().text = client.reqName;
            clientItem.transform.SetParent(list, false);

            clientItem.GetComponent <Button>().onClick.AddListener(delegate
            {
                this.client = client;
            });

            clientList.Add(client, clientItem);

            i++;
        }
    }