private void SpawnEntryButtons(string tag) { entryButtons.ClearButtons(); foreach (var entry in codexEntries) { if (entry.tag == tag) { UIButton button = buttonFactory.GetNewInstance(entryLeafPanel, entry.title, "Prefabs/UI/LeafButton"); entryButtons.Add(button); } } }
private void CreateButtons(ActButtonStruct buttonStruct) //create all the buttons for the act selection. Very clumsy, properly implemented would tie into the gmae logic. { UIButton newButton = buttonFactory.GetNewInstance(actBar, buttonStruct.act_1, "act_1", "Prefabs/UI/SelectorButton"); actButtons.Add(newButton); newButton = buttonFactory.GetNewInstance(actBar, buttonStruct.act_2, "act_2", "Prefabs/UI/SelectorButton"); actButtons.Add(newButton); newButton = buttonFactory.GetNewInstance(actBar, buttonStruct.act_3, "act_3", "Prefabs/UI/SelectorButton"); actButtons.Add(newButton); newButton = buttonFactory.GetNewInstance(actBar, buttonStruct.act_4, "act_4", "Prefabs/UI/SelectorButton"); actButtons.Add(newButton); inputButton = buttonFactory.GetNewInstance(fieldPanel, buttonStruct.add_note, "add_note", "Prefabs/UI/IndexButton"); inputButton.OnLeftClickEvent += inputText; }
public void Start() { //ideally the settings would be extensive, in this implementation it only selects a variable for the localization path settings = Registry.Instance.settings; buttonGroup.OnButtonPressed += ButtonSelected; string languagePrefix = settings.language.ToString(); TextAsset localizationJson = Resources.Load <TextAsset>("Data/Localization/" + languagePrefix + "/UI/topbar"); TopButtonStruct buttonStruct = JsonUtility.FromJson <TopButtonStruct>(localizationJson.text); //create the buttons for the top section UIButton newButton = buttonFactory.GetNewInstance(topBar, buttonStruct.codex, "codex", "Prefabs/UI/SelectorButton"); buttonGroup.Add(newButton); newButton = buttonFactory.GetNewInstance(topBar, buttonStruct.notes, "notes", "Prefabs/UI/SelectorButton"); buttonGroup.Add(newButton); //hack to go straight to the codex screen buttonGroup.SelectButton("codex"); }