public override GameObject createContent() // создание контента, на основе радиобатона, заполнение заготовленых айтемов { var goldFromCrystalExchange = windowController.getMarketExchange(); GameObject prefab = getResources().goldBuyItemPrefab; GameObject content = new GameObject("Content"); GameObject radioButtons = new GameObject("RadioButtons"); radioButtons.transform.parent = content.transform; RadioButtons rb = radioButtons.AddComponent <RadioButtons>(); rb.shift = new Vector2(0.0f, -2.09f); int len = goldFromCrystalExchange.Length; rb.init(prefab, len, RadioButtons.TypeDisposition.VERTICAL, 1.0f, true); isHaveBonuses = false; for (int i = 0; i < goldFromCrystalExchange.Length; i++) { if (goldFromCrystalExchange[i].Free > 0) { isHaveBonuses = true; } } fillGoldItems(rb); rb.subscribeOnRadioBtnSelected(onBuyGoldClick); return(content); }
float shiftValue = 0.06f; // значение смещения по вертикале при выборе void Start() { DigitsLabel label = transform.Find("Label").GetComponent <DigitsLabel>(); label.setValue(int.Parse(name)); RadioButtons rb = transform.parent.GetComponent <RadioButtons>(); var selectedButton = rb.getSelectedButton(); IAmSelected = selectedButton != null && gameObject == rb.getSelectedButton().gameObject; rb.subscribeOnRadioBtnSelected(OnNewSelected); if (IAmSelected) { select(true); Rooms.countTickets = int.Parse(this.gameObject.GetComponent <BaseController>().name); } }
public override GameObject createContent() // создание контента при условии полученых данных от сервера { var crystalItems = windowController.getCrystalItems(); GameObject prefab = getResources().crystalBuyItemPrefab; var market = windowController.getMarketEvent(); GameObject content = new GameObject("Content"); GameObject radioButtons = new GameObject("RadioButtons"); radioButtons.transform.parent = content.transform; RadioButtons rb = radioButtons.AddComponent <RadioButtons>(); rb.shift = new Vector2(0.0f, -1.67f); int len = crystalItems.Length; rb.init(prefab, len, RadioButtons.TypeDisposition.VERTICAL, 0.8f, true); rb.subscribeOnRadioBtnSelected(onBuyCrystalClick); fillCrystalItems(rb); // заполнение return(content); }