Esempio n. 1
0
        //function for creating actions panel
        private Panel buildMonsterActions()
        {
            Panel monsterActionsPanel = new Panel();

            monsterActionsPanel.Height      = 312;
            monsterActionsPanel.Width       = 975;
            monsterActionsPanel.Location    = new Point((int)((double)currentSelected.Width * 0.3384615384615385), (int)((double)currentSelected.Height * 0.5444325481798715));
            monsterActionsPanel.BorderStyle = BorderStyle.FixedSingle;

            List <MonsterAction> actionList    = toFight.getActions();
            List <Button>        actionButtons = new List <Button>();

            for (int i = 0; i < actionList.Count; i++)
            {
                //define current Action
                MonsterAction currAction = actionList[i];

                Button actionSelect = new Button();
                actionSelect.Width    = monsterActionsPanel.Width / actionList.Count;
                actionSelect.Height   = 30;
                actionSelect.Text     = currAction.getActionName();
                actionSelect.Location = new Point(i * (monsterActionsPanel.Width / actionList.Count), 0);

                //if number of uses is limited, include in name
                if (currAction.getNumberUses() != 0)
                {
                    actionSelect.Text += "[" + currAction.getNumberUses() + "]";
                }

                //if action is legendary, cover in gold
                if (currAction.getIsLegendary())
                {
                    actionSelect.BackColor = Color.Gold;
                }

                //add actionButton to list
                actionButtons.Add(actionSelect);
                monsterActionsPanel.Controls.Add(actionSelect);
            }

            return(monsterActionsPanel);
        }