Ejemplo n.º 1
0
        //simple quick text file implementation for now
        //each row contains:
        //PlayerClassNum ItemID | in integer form
        internal static Barracks load()
        {
            string s;
            Barracks b = new Barracks();
            bool added = false;
            try {
                TextReader tr = new StreamReader(savefile);

                while ((s = tr.ReadLine()) != null) {
                    string[] strs = s.Split(SEPERATOR);
                    if(strs.Length <= 0) continue;
                    int x, y;
                    if (strs[0] == SPAREITEMS) {
                        for (int i = 1;i<strs.Length ;i++) {
                            ItemID newItem = (ItemID)int.Parse(strs[i]);
                            b.addItem(newItem);
                        }
                    }else if (strs.Length == 2) {
                        x = int.Parse(strs[0]);
                        y = int.Parse(strs[1]);
                        added = true;
                        b.addHero((PlayerClassNum)x, (ItemID)y);
                    }
                }

                tr.Close();
            } catch (Exception e) {
                Console.WriteLine(e.ToString());
            }

            if (!added)
                b = getNewGameBarracks();

            return b;
        }
Ejemplo n.º 2
0
        //totalbars - maxShown = max topBar
        internal BarracksScrollList(Barracks b, Vector2f start)
        {
            //int x = (overallRect.Height - 2 * 25) / champBarRect.Height;
            //scroll = overallRect.Height - (x * champBarRect.Height);
            maxShown = (int)((overallRect.Height - 2 * scroll) / champBarRect.Height - 1);
            totalBars = b.getTotalChamps();
            mBarracks = b;
            this.start = start;

            disabledButtons = new List<int>();
            champsItemIcons = new List<IconToolTip>();
            for(int i=0;i<totalBars;i++){
                ItemID item = mBarracks.getChamps()[i].item;
                Sprite itemS = new Sprite(Item.getItemTexture(item), new IntRect(0, 0, Item.ICON_WIDTH, Item.ICON_WIDTH));
                if (item == ItemID.none) {
                    IconToolTip itt = new IconToolTip(itemS, "none", "none");
                    champsItemIcons.Add(itt);
                } else {
                    Item ite = new Item(item);
                    champsItemIcons.Add(new IconToolTip(itemS, ite.name, ite.description));
                }
            }

            champBarSprite = new Sprite(champBarTexture);
            unitIconSprite = new Sprite();

            topBarDebugText = new Text(topBar + " ",GameBox.corbalFont,30U);
            topBarDebugText.Color = Color.Yellow;
            playerClassText = new Text("playerclass", GameBox.corbalFont, 15U);
            playerItemText = new Text("playeritem", GameBox.corbalFont, 15U);
        }
Ejemplo n.º 3
0
        internal RaidSelect2(BossFightID boss, Barracks barracks)
        {
            backButton = new Button(new IntRect(BACK_BUTTON_X, BUTTONS_Y, 50, 50),backButtonTexture);
            clearButton = new Button(new IntRect(CLEAR_BUTTON_X, BUTTONS_Y, 50, 50), clearButtonTexture);
            startButton = new Button(new IntRect(START_BUTTON_X, BUTTONS_Y, 200, 50), startButtonTexture);

            this.boss = boss;
            maxPlayers = (short)BossFightLibrary.getBossInfo(boss).maxplayers;
            barracksScrollList = new BarracksScrollList(barracks,new Vector2f(0, 210));
            pillarGroup = new PillarGroup(new FloatRect(200, 180,600,420));

            bossString = new Text(BossFightLibrary.getBossInfo(boss).name.ToUpper(), GameBox.pixelzimFont, 30U);
            bossString.Color = Color.White;
            bossString.Position = new Vector2f(265, 130);

            worldString = new Text("FOREST", GameBox.pixelzimFont, 30U);
            worldString.Color = Color.White;
            worldString.Position = new Vector2f(685, 130);

            barracksString = new Text("BARRACKS", GameBox.pixelzimFont, 30U);
            barracksString.Color = Color.White;
            barracksString.Position = new Vector2f(11, 175);

            currentPlayersString = new Text(currentPlayerAmt + "/" + maxPlayers, GameBox.corbalFont, 30U);
            currentPlayersString.Color = new Color(140,240,70);
            currentPlayersString.Position = new Vector2f(550, 400);

            draggedString = new Text("", GameBox.corbalFont, 30U);
            draggedString.Color = Color.White;

            //bossArtSprite, locationSprite, raidpartybgSprite, barracksListSprite;
            bossArtSprite = new Sprite(bossArt);
            bossArtSprite.Position = new Vector2f(0, 0);
            locationSprite = new Sprite(locationmarkerTexture);
            locationSprite.Position = new Vector2f(400, 0);
            raidpartybgSprite = new Sprite(raidpartybgTexture);
            raidpartybgSprite.Position = new Vector2f(200, 180);
            barracksListSprite = new Sprite(barracksListTexture);
            barracksListSprite.Position = new Vector2f(0, 180);
        }
Ejemplo n.º 4
0
        internal Inventory(Barracks barracks)
        {
            items = barracks.getSpareItems();
            sprites = new List<Sprite>();
            sprites.Add(new Sprite(Item.getItemTexture(ItemID.none)));//for no texture?
            //items.Add(ItemID.none); add no changes button correctly
            rows = 1;
            cols = 1;
            int amt = items.Count;//pressing the first box is equiping nothing
            for (int i = 1; i < amt; i++) {
                double d = ((double)GameBox.GAMERESX / cols) / (GameBox.GAMERESY / rows);//get the ratio of x to y

                if(i == rows*cols){//full
                    if (d >= 4.0 / 3) {
                        cols++;
                    } else {
                        rows++;
                    }
                }
                sprites.Add(new Sprite(Item.getItemTexture(items[i])));
            }
        }
Ejemplo n.º 5
0
        static Barracks getNewGameBarracks()
        {
            Barracks b = new Barracks();
            b.addHero(PlayerClassNum.vang, ItemID.none);
            b.addHero(PlayerClassNum.vang, ItemID.none);

            b.addHero(PlayerClassNum.puri, ItemID.none);
            b.addHero(PlayerClassNum.puri, ItemID.none);
            b.addHero(PlayerClassNum.puri, ItemID.none);

            b.addHero(PlayerClassNum.mage, ItemID.none);
            b.addHero(PlayerClassNum.mage, ItemID.none);
            b.addHero(PlayerClassNum.mage, ItemID.none);

            b.addHero(PlayerClassNum.assa, ItemID.none);
            b.addHero(PlayerClassNum.assa, ItemID.none);
            b.addHero(PlayerClassNum.assa, ItemID.none);

            b.addHero(PlayerClassNum.archer, ItemID.none);
            b.addHero(PlayerClassNum.archer, ItemID.none);
            b.addHero(PlayerClassNum.archer, ItemID.none);

            b.addHero(PlayerClassNum.bard, ItemID.none);
            b.addHero(PlayerClassNum.bard, ItemID.none);

            for (int i=0; i < InGame.randy.Next(10)+5;i++ ) {
                b.addItem(Item.getRandomItem());
            }

            return b;
        }
Ejemplo n.º 6
0
 internal static void save(Barracks b)
 {
     TextWriter tw = new StreamWriter(savefile);
     tw.Write(SPAREITEMS);
     foreach(ItemID item in b.spareItems){
         tw.Write(""+SEPERATOR + (int)item);
     }
     tw.WriteLine();
     foreach (ChampItemPair hp in b.champs) {
         string s = ""+(int)hp.hero + SEPERATOR + (int)hp.item;
         tw.WriteLine(s);
     }
     tw.Close();
 }
Ejemplo n.º 7
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        public void loadContent() {
            pixelzimFont = new Font("res/fonts/Pixelzim 3x5.ttf");
            corbalFont = new Font("res/fonts/Corbel.ttf");

            Moveable.LoadContent();
            GroundEffect.LoadContent();
            //enemys
            BasicAdd.LoadContent();
            BuseyBoss.LoadContent();
            TomHanks.LoadContent();
            CheckDPSBoss.LoadContent();
            EvilFraiserFight.LoadContent();
            UrsidorBossFight.LoadContent();
            //playerclasses
            Mage.LoadContent();
            Puri.LoadContent();
            Vanguard.LoadContent();
            Assassin.LoadContent();
            Archer.LoadContent();
            Bard.LoadContent();
            //heros
            GoodFraiser.LoadContent();
            //screens
            BossSelect.LoadContent();
            PostFight.LoadContent();
            //RaidSelect.LoadContent();
            RaidSelect2.LoadContent();
            MenuScreen.LoadContent();
            SettingsMenu.LoadContent();
            //other ui
            PlayerFrame.LoadContent();
            BarracksScrollList.LoadContent();
            IconToolTip.loadContent();
            Pillar.LoadContent();

            Item.LoadContent();
            SimpleModel.LoadContent();
            //props
            forest.LoadContent();
            
            menuScreen = new MenuScreen();
            settingsMenu = new SettingsMenu();
            bossSelect = new BossSelect();
            gameState = GameState.menuScreen;

            if (ALLUNLOCKS)
                unlockedHeroes = new UnlockedHeroes(true);
            else
                unlockedHeroes = new UnlockedHeroes(false);
            //mainmenu
            //play = new RollOverStringButton(

            currentBarracks = Barracks.load();

            mouseState = new SimpleMouseState(window);
        }