Exemplo n.º 1
0
        public MenubarController()
        {
            gameStarted = false;

            menubarBuild   = new ImageSprite(Resources.LPull(NameSet.Res.SIDEBAR_1), 1, 1, 1);
            menubarUpgrade = new ImageSprite(Resources.LPull(NameSet.Res.SIDEBAR_2), 1, 1, 1);
            //escMenu = new ImageSprite(Resources.LPull(NameSet.Res.ESCMENU_BACKGROUND), 1, 1, 1);

            menubarBuild.setLocation(480 + 80, 240);
            menubarUpgrade.setLocation(480 + 80, 240);
            //escMenu.setLocation(320, 240);

            towerBuildButton          = new Button[5];
            towerBaitUpgradeButton    = new Button[4];
            towerFishingUpgradeButton = new Button[4];
            towerHarpoonUpgradeButton = new Button[4];
            towerNetUpgradeButton     = new Button[4];
            towerStoneUpgradeButton   = new Button[4];

            towerBuildButton[0] = new Button(Resources.LPull(NameSet.Res.TOWER_BUTTON_1)[0], Resources.LPull(NameSet.Res.TOWER_BUTTON_1)[1], Resources.LPull(NameSet.Res.TOWER_BUTTON_1)[2]);
            towerBuildButton[1] = new Button(Resources.LPull(NameSet.Res.TOWER_BUTTON_2)[0], Resources.LPull(NameSet.Res.TOWER_BUTTON_2)[1], Resources.LPull(NameSet.Res.TOWER_BUTTON_2)[2]);
            towerBuildButton[2] = new Button(Resources.LPull(NameSet.Res.TOWER_BUTTON_3)[0], Resources.LPull(NameSet.Res.TOWER_BUTTON_3)[1], Resources.LPull(NameSet.Res.TOWER_BUTTON_3)[2]);
            towerBuildButton[3] = new Button(Resources.LPull(NameSet.Res.TOWER_BUTTON_4)[0], Resources.LPull(NameSet.Res.TOWER_BUTTON_4)[1], Resources.LPull(NameSet.Res.TOWER_BUTTON_4)[2]);
            towerBuildButton[4] = new Button(Resources.LPull(NameSet.Res.TOWER_BUTTON_5)[0], Resources.LPull(NameSet.Res.TOWER_BUTTON_5)[1], Resources.LPull(NameSet.Res.TOWER_BUTTON_5)[2]);
            deselect            = new Button(Resources.LPull(NameSet.Res.DESELECT_BUTTON)[0], Resources.LPull(NameSet.Res.DESELECT_BUTTON)[0], Resources.LPull(NameSet.Res.DESELECT_BUTTON)[0]);

            towerBuildButton[0].setLocation(480 + 30, 125);
            towerBuildButton[1].setLocation(480 + 95, 125);
            towerBuildButton[2].setLocation(480 + 30, 195);
            towerBuildButton[3].setLocation(480 + 95, 195);
            towerBuildButton[4].setLocation(480 + 30, 265);
            deselect.setLocation(480 + 95, 265);


            towerBaitUpgradeButton[0] = new Button(Resources.LPull(NameSet.Res.BAIT_UPGRADE)[0], Resources.LPull(NameSet.Res.BAIT_UPGRADE)[1], Resources.LPull(NameSet.Res.BAIT_UPGRADE)[2]);
            towerBaitUpgradeButton[1] = new Button(Resources.LPull(NameSet.Res.BAIT_UPGRADE)[3], Resources.LPull(NameSet.Res.BAIT_UPGRADE)[4], Resources.LPull(NameSet.Res.BAIT_UPGRADE)[5]);
            towerBaitUpgradeButton[2] = new Button(Resources.LPull(NameSet.Res.BAIT_UPGRADE)[6], Resources.LPull(NameSet.Res.BAIT_UPGRADE)[7], Resources.LPull(NameSet.Res.BAIT_UPGRADE)[8]);
            towerBaitUpgradeButton[3] = new Button(Resources.LPull(NameSet.Res.BAIT_UPGRADE)[9], Resources.LPull(NameSet.Res.BAIT_UPGRADE)[10], Resources.LPull(NameSet.Res.BAIT_UPGRADE)[11]);

            towerBaitUpgradeButton[0].setLocation(480 + 32, 126);
            towerBaitUpgradeButton[1].setLocation(480 + 32, 176);
            towerBaitUpgradeButton[2].setLocation(480 + 32, 226);
            towerBaitUpgradeButton[3].setLocation(480 + 32, 276);


            towerFishingUpgradeButton[0] = new Button(Resources.LPull(NameSet.Res.FISHING_UPGRADE)[0], Resources.LPull(NameSet.Res.FISHING_UPGRADE)[1], Resources.LPull(NameSet.Res.FISHING_UPGRADE)[2]);
            towerFishingUpgradeButton[1] = new Button(Resources.LPull(NameSet.Res.FISHING_UPGRADE)[3], Resources.LPull(NameSet.Res.FISHING_UPGRADE)[4], Resources.LPull(NameSet.Res.FISHING_UPGRADE)[5]);
            towerFishingUpgradeButton[2] = new Button(Resources.LPull(NameSet.Res.FISHING_UPGRADE)[6], Resources.LPull(NameSet.Res.FISHING_UPGRADE)[7], Resources.LPull(NameSet.Res.FISHING_UPGRADE)[8]);
            towerFishingUpgradeButton[3] = new Button(Resources.LPull(NameSet.Res.FISHING_UPGRADE)[9], Resources.LPull(NameSet.Res.FISHING_UPGRADE)[10], Resources.LPull(NameSet.Res.FISHING_UPGRADE)[11]);

            towerFishingUpgradeButton[0].setLocation(480 + 32, 126);
            towerFishingUpgradeButton[1].setLocation(480 + 32, 176);
            towerFishingUpgradeButton[2].setLocation(480 + 32, 226);
            towerFishingUpgradeButton[3].setLocation(480 + 32, 276);


            towerHarpoonUpgradeButton[0] = new Button(Resources.LPull(NameSet.Res.HARPOON_UPGRADE)[0], Resources.LPull(NameSet.Res.HARPOON_UPGRADE)[1], Resources.LPull(NameSet.Res.HARPOON_UPGRADE)[2]);
            towerHarpoonUpgradeButton[1] = new Button(Resources.LPull(NameSet.Res.HARPOON_UPGRADE)[3], Resources.LPull(NameSet.Res.HARPOON_UPGRADE)[4], Resources.LPull(NameSet.Res.HARPOON_UPGRADE)[5]);
            towerHarpoonUpgradeButton[2] = new Button(Resources.LPull(NameSet.Res.HARPOON_UPGRADE)[6], Resources.LPull(NameSet.Res.HARPOON_UPGRADE)[7], Resources.LPull(NameSet.Res.HARPOON_UPGRADE)[8]);
            towerHarpoonUpgradeButton[3] = new Button(Resources.LPull(NameSet.Res.HARPOON_UPGRADE)[9], Resources.LPull(NameSet.Res.HARPOON_UPGRADE)[10], Resources.LPull(NameSet.Res.HARPOON_UPGRADE)[11]);

            towerHarpoonUpgradeButton[0].setLocation(480 + 32, 126);
            towerHarpoonUpgradeButton[1].setLocation(480 + 32, 176);
            towerHarpoonUpgradeButton[2].setLocation(480 + 32, 226);
            towerHarpoonUpgradeButton[3].setLocation(480 + 32, 276);


            towerNetUpgradeButton[0] = new Button(Resources.LPull(NameSet.Res.NET_UPGRADE)[0], Resources.LPull(NameSet.Res.NET_UPGRADE)[1], Resources.LPull(NameSet.Res.NET_UPGRADE)[2]);
            towerNetUpgradeButton[1] = new Button(Resources.LPull(NameSet.Res.NET_UPGRADE)[3], Resources.LPull(NameSet.Res.NET_UPGRADE)[4], Resources.LPull(NameSet.Res.NET_UPGRADE)[5]);
            towerNetUpgradeButton[2] = new Button(Resources.LPull(NameSet.Res.NET_UPGRADE)[6], Resources.LPull(NameSet.Res.NET_UPGRADE)[7], Resources.LPull(NameSet.Res.NET_UPGRADE)[8]);
            towerNetUpgradeButton[3] = new Button(Resources.LPull(NameSet.Res.NET_UPGRADE)[9], Resources.LPull(NameSet.Res.NET_UPGRADE)[10], Resources.LPull(NameSet.Res.NET_UPGRADE)[11]);

            towerNetUpgradeButton[0].setLocation(480 + 32, 126);
            towerNetUpgradeButton[1].setLocation(480 + 32, 176);
            towerNetUpgradeButton[2].setLocation(480 + 32, 226);
            towerNetUpgradeButton[3].setLocation(480 + 32, 276);


            towerStoneUpgradeButton[0] = new Button(Resources.LPull(NameSet.Res.STONE_UPGRADE)[0], Resources.LPull(NameSet.Res.STONE_UPGRADE)[1], Resources.LPull(NameSet.Res.STONE_UPGRADE)[2]);
            towerStoneUpgradeButton[1] = new Button(Resources.LPull(NameSet.Res.STONE_UPGRADE)[3], Resources.LPull(NameSet.Res.STONE_UPGRADE)[4], Resources.LPull(NameSet.Res.STONE_UPGRADE)[5]);
            towerStoneUpgradeButton[2] = new Button(Resources.LPull(NameSet.Res.STONE_UPGRADE)[6], Resources.LPull(NameSet.Res.STONE_UPGRADE)[7], Resources.LPull(NameSet.Res.STONE_UPGRADE)[8]);
            towerStoneUpgradeButton[3] = new Button(Resources.LPull(NameSet.Res.STONE_UPGRADE)[9], Resources.LPull(NameSet.Res.STONE_UPGRADE)[10], Resources.LPull(NameSet.Res.STONE_UPGRADE)[11]);

            towerStoneUpgradeButton[0].setLocation(480 + 32, 126);
            towerStoneUpgradeButton[1].setLocation(480 + 32, 176);
            towerStoneUpgradeButton[2].setLocation(480 + 32, 226);
            towerStoneUpgradeButton[3].setLocation(480 + 32, 276);


            goButton = new Button(Resources.LPull(NameSet.Res.GO_BUTTON)[0], Resources.LPull(NameSet.Res.GO_BUTTON)[1], Resources.LPull(NameSet.Res.GO_BUTTON)[2]);

            goButton.setLocation(480 + 20, 380);
            goButton.onClick(eventGoButton);

            stopButton = new Button(Resources.LPull(NameSet.Res.STOP_BUTTON)[0], Resources.LPull(NameSet.Res.STOP_BUTTON)[1], Resources.LPull(NameSet.Res.STOP_BUTTON)[2]);

            stopButton.setLocation(480 + 20, 380);
            stopButton.onClick(eventStopButton);


            homeButton = new Button(Resources.LPull(NameSet.Res.HOME_BUTTON)[0], Resources.LPull(NameSet.Res.HOME_BUTTON)[1], Resources.LPull(NameSet.Res.HOME_BUTTON)[2]);

            homeButton.setLocation(480 + 20, 410);


            soundToggleButton = new Button(Resources.LPull(NameSet.Res.SOUND_TOGGLE_BUTTON)[0], Resources.LPull(NameSet.Res.SOUND_TOGGLE_BUTTON)[1], Resources.LPull(NameSet.Res.SOUND_TOGGLE_BUTTON)[2]);

            soundToggleButton.setLocation(480 + 68, 410);


            towerSellButton = new Button(Resources.LPull(NameSet.Res.SELL_BUTTON)[0], Resources.LPull(NameSet.Res.SELL_BUTTON)[1], Resources.LPull(NameSet.Res.SELL_BUTTON)[2]);

            towerSellButton.setLocation(480 + 32, 325);
        }