public static SearchViewCheckbox Create(string text, int index) { GameObject go = GameObject.Instantiate(Resources.Load("Prefabs/Dialog/SearchView/SearchViewCheckbox")) as GameObject; SearchViewCheckbox cbSearchView = go.GetComponent <SearchViewCheckbox>(); cbSearchView.SetData(text, index); return(cbSearchView); }
void Start() { btnExits.GetComponent <UISprite>().SetAnchor(NGUITools.GetRoot(gameObject).transform); btnExits.GetComponent <UISprite>().topAnchor.absolute = 0; btnExits.GetComponent <UISprite>().leftAnchor.absolute = 0; btnExits.GetComponent <UISprite>().rightAnchor.absolute = 0; btnExits.GetComponent <UISprite>().bottomAnchor.absolute = 0; LobbyScene lobby = GameObject.Find("Lobby Scene").GetComponent <LobbyScene>(); valuesBetting = lobby.presenter.SelectedChannel.configuration.betting; for (int i = 0; i < valuesBetting.Length; i++) { double currentBetting = valuesBetting[i]; string value = Utility.Convert.ConvertShortcutMoney(currentBetting / 2) + "/" + Utility.Convert.ConvertShortcutMoney(currentBetting); SearchViewCheckbox item = SearchViewCheckbox.Create(value, i); item.name = "" + i; item.transform.parent = tableBetValue.transform; item.transform.localScale = Vector3.one; item.transform.localPosition = Vector3.zero; if (lobby.isFiltered()) { item.GetComponent <UIToggle>().value = false; } } tableBetValue.Reposition(); if (lobby.isFiltered()) { txtInput.value = lobby.TxtSearch(); if (lobby.options() != null) { foreach (int key in lobby.options().Keys) { if (key == TYPE_5_PEOPLE) { cbFivePeople.value = lobby.options()[key]; } if (key == TYPE_9_PEOPLE) { cbNinePeople.value = lobby.options()[key]; } } } foreach (double value in lobby.presenter.betValueSearch) { int index = Array.FindIndex <double>(valuesBetting, a => a == value); tableBetValue.GetChildList()[index].GetComponent <UIToggle>().value = true; } } }