예제 #1
0
    // BAG POCKET
    public void SetBagPockets(List <ItemBattlePocket> list)
    {
        bagPocketBtns = new List <BTLUI_ButtonTxt>();
        bagPocketList = new List <ItemBattlePocket>(list);

        int realChoices = 0;

        for (int i = 0; i < list.Count; i++)
        {
            BTLUI_ButtonTxt newBtn = Instantiate(txtBtnPrefab, bagPocketOptionObj.transform);
            newBtn.InitializeSelf();
            CreateBagPocketBtn(list[i], newBtn);
            bagPocketBtns.Add(newBtn);

            if (list[i] == ItemBattlePocket.None)
            {
                newBtn.transform.localPosition += new Vector3(-22, 20);
                newBtn.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 48f);
            }
            else
            {
                int xPos = (realChoices % 2) * 96;
                int yPos = (realChoices < 2) ? 0 : -20;
                newBtn.transform.localPosition += new Vector3(xPos, yPos);
                realChoices++;
            }
        }

        bagPocketTxt.text = "Which type of\nitems to use?";
    }
예제 #2
0
 private void CreateBagPocketBtn(ItemBattlePocket objType, BTLUI_ButtonTxt btn)
 {
     btn.txt.text   = GetBagPocketString(objType);
     btn.colorSel   = colorSel;
     btn.colorUnsel = colorUnsel;
 }
예제 #3
0
 // GENERAL BUTTON
 private void SelectTxtBtn(BTLUI_ButtonTxt btn, bool select)
 {
     btn.image.color = select ? btn.colorSel : btn.colorUnsel;
     btn.txt.color   = select ? colorTxtSel : colorTxtUnsel;
 }