Exemple #1
0
        private NetworkItemView CheckIfNetworkAlreadyInList(ManualNetworkParams network)
        {
            NetworkItemView networkItemView;

            List <NetworkItemView> .Enumerator enumerator = this._networkList.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    NetworkItemView current = enumerator.Current;
                    if (!current.NetworkParams.NetParams.SSID.Equals(network.NetParams.SSID) || !current.NetworkParams.NetParams.securityType.Equals(network.NetParams.securityType))
                    {
                        continue;
                    }
                    networkItemView = current;
                    return(networkItemView);
                }
                return(null);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
            return(networkItemView);
        }
Exemple #2
0
 public void UpdateItem(ManualNetworkParams networkParams)
 {
     this._networkParams     = networkParams;
     this._networkName.text  = this._networkParams.NetParams.SSID;
     this._securityType.text = this._networkParams.NetParams.securityType;
     this._networkStrengthSprite.fillAmount = this._networkParams.NetParams.signalLevel / 100f;
 }
Exemple #3
0
 private void OnNetworkItemClick(ManualNetworkParams netParams)
 {
     if (this.OnNetworkSelected != null)
     {
         this.OnNetworkSelected(netParams);
     }
     this.Show(false);
 }
 private void OnNetworkSelected(ManualNetworkParams manualNetworkParams)
 {
     this._selectedNetwork       = manualNetworkParams;
     this._networkNameLabel.text = this._selectedNetwork.NetParams.SSID;
     this._networkNameLabel.gameObject.SetActive(true);
     this._networkNamePlaceholder.gameObject.SetActive(false);
     if (!string.IsNullOrEmpty(manualNetworkParams.Password))
     {
         this._networkPasswordInput.text = manualNetworkParams.Password;
     }
     else
     {
         this._networkPasswordInput.text = this.GetSavedNetworkPassword(this._selectedNetwork.NetParams.SSID);
     }
     this._networkPasswordInput.GetComponent <Selectable>().Select();
 }
Exemple #5
0
        private void AddNetworkItemView(ManualNetworkParams network)
        {
            NetworkItemView networkItemView = this.CheckIfNetworkAlreadyInList(network);

            if (networkItemView != null)
            {
                networkItemView.UpdateItem(network);
                return;
            }
            GameObject      gameObject = UnityEngine.Object.Instantiate <GameObject>(this._networkItemPrefab, this._networkItemPlace);
            NetworkItemView component  = gameObject.GetComponent <NetworkItemView>();

            component.UpdateItem(network);
            component.OnClick = new Action <ManualNetworkParams>(this.OnNetworkItemClick);
            gameObject.SetActive(true);
            this._networkList.Add(component);
        }
Exemple #6
0
 public void SetNetworkList(List <RIPENetworkScanListParamsType> networkList)
 {
     this.ShowHideScanningProcess(false);
     if (networkList == null)
     {
         return;
     }
     foreach (RIPENetworkScanListParamsType rIPENetworkScanListParamsType in networkList)
     {
         ManualNetworkParams manualNetworkParam = new ManualNetworkParams()
         {
             NetParams = rIPENetworkScanListParamsType,
             Password  = null
         };
         this.AddNetworkItemView(manualNetworkParam);
     }
 }
Exemple #7
0
        public void OnAddNetworkClick()
        {
            if (string.IsNullOrEmpty(this._networkNameInput.text))
            {
                this._networkNameInput.GetComponent <Image>().color = new Color(1f, 0.7f, 0.7f, 1f);
                return;
            }
            RIPENetworkScanListParamsType rIPENetworkScanListParamsType = new RIPENetworkScanListParamsType()
            {
                SSID         = this._networkNameInput.text,
                securityType = this._securityTypeDropdown.options[this._securityTypeDropdown.@value].text,
                signalLevel  = 50f
            };
            RIPENetworkScanListParamsType rIPENetworkScanListParamsType1 = rIPENetworkScanListParamsType;
            ManualNetworkParams           manualNetworkParam             = new ManualNetworkParams()
            {
                NetParams = rIPENetworkScanListParamsType1,
                Password  = this._networkPasswordInput.text
            };

            this.AddNetworkItemView(manualNetworkParam);
        }