Example #1
0
    public void Start()
    {
        settings = Registry.Instance.settings;
        actButtons.OnButtonPressed += ButtonSelected;

        string          languagePrefix   = settings.language.ToString();
        TextAsset       localizationJson = Resources.Load <TextAsset>("Data/Localization/" + languagePrefix + "/UI/actbuttons");
        ActButtonStruct buttonStruct     = JsonUtility.FromJson <ActButtonStruct>(localizationJson.text);

        //create the buttons
        CreateButtons(buttonStruct);
    }
Example #2
0
    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;
    }