private void InitializeControls(PuzzleTag form) { controlMap = new ControlMap(form); controlProvider = new ControlProvider.ControlProvider(controlMap); customButtonsCollection = new ButtonsCollection(controlMap); customButtonsCollection.InitializeByButtonNameAttribute("custom"); }
private void AddButtons(ButtonsCollection control, int idx) { for (int i = 0; i < control.ButtonsCount; i++) { var panel = new ButtonPanel(); panel.SetInfo(control, i + 1, idx); AddPanel(panel); RegiseterLink(panel.GetLink()); } }
public Ruler( CustomButtonsManager buttonManager, ButtonsCollection buttonCollection, ImageLibraryManager libManager, Players players) { this.buttonManager = buttonManager; this.libManager = libManager; this.buttonsCollection = buttonCollection; this.players = players; openCardDelay = Convert.ToInt32(Settings.Delay) * 1000; }
public void SetInfo(ButtonsCollection data, int i, int idx) { lblName.Text = data.Name + " " + i; Name = lnkOut.Name = data.ConstantName + "_" + idx + "_" + i; __ButtonIndex = i; #if MEGA2560 _ButtonMask = 1 << (i - 1); #endif #if STM32 _ButtonMask = 1; #endif __buttons = data; }
private void initButtonsList() { foreach (Button button in Components) { ButtonsCollection.Add(button); button.Highlighted += Button_Highlighted; } if (ButtonsCollection.Count > 0) { ButtonsCollection[m_CurrentHighlightedButtonIndex].IsHighlighted = true; } }
void Start() { TextAsset file = (TextAsset)Resources.Load("json"); reader = new StringReader(file.text); string json = reader.ReadToEnd(); reader.Close(); json = "{\"buttons\":" + json + "}"; ButtonsCollection buttonsCollection = jsonToBuildingUpgradeButtons(json); upgrades = buttonsCollection.buttons; upgradeButtons = new UpgradeButton[upgrades.Length]; buttonElementHolders = new GameObject[upgrades.Length]; buttonTexts = new Text[upgrades.Length]; popupTexts = new Text[upgrades.Length]; float y = 208f; for (int i = 0; i < buttonElementHolders.Length; i++) { buttonElementHolders[i] = new GameObject(); buttonElementHolders [i].transform.SetParent(renderCanvas.transform, false); buttonElementHolders[i].transform.localPosition = new Vector2(190f, y); upgradeButtons [i] = (UpgradeButton)Instantiate(upgradeButton, transform.position, transform.rotation); upgradeButtons [i].transform.SetParent(buttonElementHolders [i].transform, false); upgradeButtons [i].transform.localPosition = new Vector2(0f, 0f); buttonTexts[i] = Instantiate(text, transform.position, transform.rotation); buttonTexts[i].transform.SetParent(upgradeButtons [i].transform, false); buttonTexts[i].transform.localPosition = new Vector2(0f, 0f); buttonTexts [i].alignment = TextAnchor.MiddleCenter; popupTexts[i] = Instantiate(popupText, transform.position, transform.rotation); popupTexts[i].transform.SetParent(upgradeButtons [i].transform.GetChild(0).transform, false); popupTexts[i].rectTransform.localPosition = new Vector2(0f, 0f); // y -= 83.46f; y -= 62.4f; } }
private void Button_Highlighted(object sender, EventArgs e) { int indexOfButton = ButtonsCollection.IndexOf(sender as Button); CurrentHighlightedButtonIndex = indexOfButton; }