コード例 #1
0
        public ItemMenu(BattleScreen battle)
            : base("")
        {
            popUp = true;
            itemNames = new List<string>();
            topIndex = 0;
            numItems = 0;
            for (int i = 0; i < battle.Player.Items.Count; i++)
            {
                itemNames.Add(battle.Player.Items[i].Name);
                itemTextures.Add(TextureManager.GetInstance().ItemTextures[battle.Player.Items[i].Name]);
                numItems++;
            }

            for (int i = 0; i < numItems; i++)
            {
                MenuItem menuItem = new MenuItem("", false);
                MenuItems.Add(menuItem);
                menuItem.Selected += ItemSelected;
            }

            numShown = Math.Min(numItems - topIndex, 4);
            this.battle = battle;

            arrow = TextureManager.GetInstance().Arrow;
            backArrow = TextureManager.GetInstance().BackArrow;
            button = TextureManager.GetInstance().BattleMenuButton;
        }
コード例 #2
0
        public BattleMenu(BattleScreen battle)
            : base("")
        {
            popUp = true;

            MenuItem attackMenuItem = new MenuItem("", true);
            MenuItem fleeMenuItem = new MenuItem("FLEE", false);
            MenuItem magicMenuItem = new MenuItem("", false);
            MenuItem itemsMenuItem = new MenuItem("", false);

            //Set up menu events.
            attackMenuItem.Selected += AttackItemSelected;
            fleeMenuItem.Selected += FleeItemSelected;
            magicMenuItem.Selected += MagicItemSelected;
            itemsMenuItem.Selected += ItemsItemSelected;

            // Add entries to the menu.
            MenuItems.Add(attackMenuItem);
            MenuItems.Add(fleeMenuItem);
            MenuItems.Add(magicMenuItem);
            MenuItems.Add(itemsMenuItem);

            this.battle = battle;

            circRecButton = TextureManager.GetInstance().CircRecButton;
            sandTimer = TextureManager.GetInstance().SandTimer;
            battleMenuButton = TextureManager.GetInstance().BattleMenuButton;
            attackTexture = TextureManager.GetInstance().BattleMenuImages[0];
            itemTexture = TextureManager.GetInstance().BattleMenuImages[2];
            magicTexture = TextureManager.GetInstance().BattleMenuImages[3];
        }