コード例 #1
0
 private void CreateCmdBtn(BattleCommandType commandType, BTLUI_ButtonCmd btn)
 {
     btn.commandType = commandType;
     btn.txt.text    = commandType.ToString();
     btn.colorSel    = colorSel;
     btn.colorUnsel  = colorUnsel;
 }
コード例 #2
0
    // COMMAND
    public void SetCommands(Pokemon pokemon, List <BattleCommandType> commands)
    {
        cmdBtns = new List <BTLUI_ButtonCmd>();
        cmdList = new List <BattleCommandType>(commands);

        int realChoices = 0;

        for (int i = 0; i < cmdList.Count; i++)
        {
            BTLUI_ButtonCmd newBtn = Instantiate(cmdBtnPrefab, cmdOptionObj.transform);
            newBtn.InitializeSelf();
            CreateCmdBtn(cmdList[i], newBtn);
            cmdBtns.Add(newBtn);

            if (commands[i] == BattleCommandType.Back)
            {
                newBtn.transform.localPosition += new Vector3(-14, 20);
                newBtn.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 48f);
            }
            else
            {
                int xPos = (realChoices % 2) * 80;
                int yPos = (realChoices < 2) ? 0 : -20;
                newBtn.transform.localPosition += new Vector3(xPos, yPos);
                realChoices++;
            }
        }

        string promptString = "What will \\cyellow\\" + pokemon.nickname + "\\c.\\ do?";

        StartCoroutine(DrawTextInstant(text: promptString, textBox: cmdTxt));
    }
コード例 #3
0
 private void SelectCmdBtn(BTLUI_ButtonCmd btn, bool select)
 {
     btn.image.color = select ? btn.colorSel : btn.colorUnsel;
     btn.txt.color   = select ? colorTxtSel : colorTxtUnsel;
 }