/* methods */
    protected override void DoEnable()
    {
        base.DoEnable();

        UiManager.Instance.backGround.switchBackGround("loginBackGround");
        initServerButtons(ServerManagerment.Instance.lastServer);
        List <Json_ServerInfo> serverList = ServerManagerment.Instance.getAllServer();

        foreach (Json_ServerInfo each in serverList)
        {
            GameObject   obj    = NGUITools.AddChild(ScrollContent.gameObject, serverButtonPrefab);
            ServerButton button = obj.GetComponent <ServerButton> ();
            button.initButton(each);
            button.fatherWindow = this;
            obj.AddComponent <UIDragScrollView> ();
        }
        UIGrid grid = ScrollContent.GetComponent <UIGrid> ();

        grid.enabled = true;
        grid.Reposition();
        if (GuideManager.Instance.guideUI != null)
        {
            GuideManager.Instance.hideGuideUI();
        }
        if (serverList.Count > 8)
        {
            downArrow.SetActive(true);
        }
        MaskWindow.UnlockUI();
    }
    public void updateUI()
    {
        initServerButtons(ServerManagerment.Instance.lastServer);


        for (int i = 0; i < ScrollContent.transform.childCount; i++)
        {
            GameObject go = ScrollContent.transform.GetChild(i).gameObject;
            DestroyImmediate(go);
        }

        List <Json_ServerInfo> serverList = ServerManagerment.Instance.getAllServer();

        foreach (Json_ServerInfo each in serverList)
        {
            GameObject   obj    = NGUITools.AddChild(ScrollContent.gameObject, serverButtonPrefab);
            ServerButton button = obj.GetComponent <ServerButton> ();
            button.initButton(each);
            button.fatherWindow = this;
            obj.AddComponent <UIDragScrollView> ();
        }
        UIGrid grid = ScrollContent.GetComponent <UIGrid> ();

        grid.enabled = true;
        grid.Reposition();
        if (GuideManager.Instance.guideUI != null)
        {
            GuideManager.Instance.hideGuideUI();
        }
        if (serverList.Count > 8)
        {
            downArrow.SetActive(true);
        }
    }
        //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        partial void ServerButtonTouch(UIButton sender)
        {
            DataManager.CurrentServer++;

            NSUserDefaults.StandardUserDefaults.SetInt(DataManager.CurrentServer, "CurrentServer");
            NSUserDefaults.StandardUserDefaults.Synchronize();

            ServerButton.SetTitle("Загрузка...", UIControlState.Normal);
        }
        //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        partial void ServerButton_TouchUpInside(UIButton sender)
        {
            DataManager.SwitchToNextServer();
            Application.StoreValues();

            ServerButton.SetTitle("Загрузка...", UIControlState.Normal);

            DataManager.ReconnectToServer(ChangeServerCallback);
        }
        //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        private void UpdateViewValues()
        {
            FilterTable.ReloadData();

            int index = DataManager.nodesFilters.FindIndex((NodeFilter obj) => obj.group == DataManager.selectedNodesFilter);

            if (index >= 0)
            {
                FilterTable.SelectRow(NSIndexPath.FromRowSection(index, 0), false, UITableViewScrollPosition.Middle);
            }

            ServerButton.SetTitle(DataManager.ServerName, UIControlState.Normal);
            UserButton.SetTitle(DataManager.UserName, UIControlState.Normal);
        }
    void FillServerList(string text)
    {
        foreach (Transform child in ListContents.gameObject.transform)
        {
            Destroy(child.gameObject);
        }

        List <Servidor> servidores = ServerJsonParser.Parse(text);

        foreach (Servidor servidor in servidores)
        {
            var btn = Instantiate(ButtonPrefab);
            btn.gameObject.transform.SetParent(ListContents.gameObject.transform);
            ServerButton svbt = btn.GetComponent <ServerButton>();
            svbt.SetInfo(servidor);
        }
    }
Beispiel #7
0
 public void UpdateList()
 {
     for (int i = 0; i < contentPanel.childCount; i++)
     {
         Destroy(contentPanel.GetChild(i).gameObject);
     }
     discoveryResponses = RTClient.GetInstance().GetServers();
     foreach (DiscoveryResponse server in discoveryResponses)
     {
         GameObject   newServer    = Instantiate(serverButtonPrefab) as GameObject;
         ServerButton serverButton = newServer.GetComponent <ServerButton>();
         serverButton.HostText.text      = server.HostName;
         serverButton.IpAddressText.text = server.IpAddress + ":" + server.Port;
         serverButton.InfoText.text      = server.InfoText;
         serverButton.response           = server;
         newServer.transform.SetParent(contentPanel);
     }
 }
        void ReleaseDesignerOutlets()
        {
            if (FilterTable != null)
            {
                FilterTable.Dispose();
                FilterTable = null;
            }

            if (ServerButton != null)
            {
                ServerButton.Dispose();
                ServerButton = null;
            }

            if (UserButton != null)
            {
                UserButton.Dispose();
                UserButton = null;
            }
        }
Beispiel #9
0
        //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        private void UpdateViewValues()
        {
            ServerButton.SetTitle(DataManager.ServerName, UIControlState.Normal);

            if (DataManager.ConnectState == ConnectStates.AuthPassed)
            {
                UserNameLabel.Text = DataManager.UserName;
            }
            else if (DataManager.ConnectState == ConnectStates.SocketConnected)
            {
                UserNameLabel.Text = "Нет авторизации";
            }
            else
            {
                UserNameLabel.Text = "Нет связи";
            }

            NotificationsFromHoursField.Text   = DataManager.userSettings.notificationsFrom.Hour.ToString("D2");
            NotificationsFromMinutesField.Text = DataManager.userSettings.notificationsFrom.Minute.ToString("D2");
            NotificationsToHoursField.Text     = DataManager.userSettings.notificationsTo.Hour.ToString("D2");
            NotificationsToMinutesField.Text   = DataManager.userSettings.notificationsTo.Minute.ToString("D2");
            SendNodesOfflineNotificationsSwitch.SetState(DataManager.userSettings.sendNodesOfflineNotifications, false);
        }
        void ReleaseDesignerOutlets()
        {
            if (ChangeUserButton != null)
            {
                ChangeUserButton.Dispose();
                ChangeUserButton = null;
            }

            if (LoginField != null)
            {
                LoginField.Dispose();
                LoginField = null;
            }

            if (NotificationsFromHoursField != null)
            {
                NotificationsFromHoursField.Dispose();
                NotificationsFromHoursField = null;
            }

            if (NotificationsFromMinutesField != null)
            {
                NotificationsFromMinutesField.Dispose();
                NotificationsFromMinutesField = null;
            }

            if (NotificationsToHoursField != null)
            {
                NotificationsToHoursField.Dispose();
                NotificationsToHoursField = null;
            }

            if (NotificationsToMinutesField != null)
            {
                NotificationsToMinutesField.Dispose();
                NotificationsToMinutesField = null;
            }

            if (PasswordField != null)
            {
                PasswordField.Dispose();
                PasswordField = null;
            }

            if (SendNodesOfflineNotificationsSwitch != null)
            {
                SendNodesOfflineNotificationsSwitch.Dispose();
                SendNodesOfflineNotificationsSwitch = null;
            }

            if (ServerButton != null)
            {
                ServerButton.Dispose();
                ServerButton = null;
            }

            if (UserNameLabel != null)
            {
                UserNameLabel.Dispose();
                UserNameLabel = null;
            }
        }
 /** 更新选择背景位置 */
 public void UpdateSelectBgPosition(ServerButton latelyServer)
 {
     selectBg.SetActive(true);
     selectBg.transform.localPosition = new Vector3(latelyServer.transform.localPosition.x, latelyServer.transform.localPosition.y, latelyServer.transform.localPosition.z);
 }
 public void joinRoom(ServerButton servButton)
 {
     PhotonNetwork.JoinRoom(servButton.roomName);
 }
 public void joinRoom(ServerButton servButton)
 {
     Debug.Log("joinRoom");
     PhotonNetwork.JoinRoom(servButton.roomName);
 }