Example #1
0
 internal override bool didClick(SimpleMouseState mouseState)
 {
     bool b = base.didClick(mouseState);
     if (b) {
         InGame.getInstance().setSelected(player);
     }
     return b;
 }
Example #2
0
 internal void Update(double gameTime, SimpleMouseState mouseState)
 {
     this.mouseState = mouseState;
     if (backButton.didClick(mouseState)) {
         GameBox.getInstance().setScreen(GameState.menuScreen);
     }
     //throw new NotImplementedException();
 }
Example #3
0
        internal void Update(double gameTime, SimpleMouseState mouseState)
        {
            if (play.didClick(mouseState)) //Game.getInstance().setScreen(GameState.bossSelect);
                GameBox.getInstance().initRaidSelect(BossFightID.urisdor);

            leaderboard.didClick(mouseState);
            stats.didClick(mouseState);

            settings.didClick(mouseState);
            //            if (settings.didClick(mouseState)) GameBox.getInstance().setScreen(GameState.settingsMenu);

            help.didClick(mouseState);

            if (exit.didClick(mouseState)) GameBox.getInstance().Exit();
        }
Example #4
0
 internal void Update(double gameTime,SimpleMouseState mouseState)
 {
     if (nextButton.didClick(mouseState)) {
         GameBox.getInstance().gotoBossSelect();
     }
     if (restartButton.didClick(mouseState)) {
         GameBox.getInstance().restartBossFight(BossFightLibrary.getBossFight(id),lastRaid);
     }
     if (reformPartyButton.didClick(mouseState)) {
         GameBox.getInstance().initRaidSelect(id);
     }
 }
        internal ItemID update(SimpleMouseState mouseState)
        {
            if (mouseState.DoneReleasedIt(mouseButton.LEFT)) {
                if (mouseState.getPos().Y >= 0 && mouseState.getPos().Y <= 600 && mouseState.getPos().X >= 0 && mouseState.getPos().X <= 800){
                    int rowC = mouseState.getPos().Y / (GameBox.GAMERESY / cols);
                    int colC = mouseState.getPos().X / (GameBox.GAMERESX / rows);
                    if (rowC * rows + colC >= items.Count) return ItemID.none;
                    return items[rowC * rows + colC];
                }
            }

            //if (selected) ;

            return ItemID.na;
        }
        //basic scroll right now
        internal void update(double gameTime, SimpleMouseState mouseState)
        {
            if (inventory != null && (invResult = inventory.update(mouseState)) != ItemID.na) {
                //if the inventory returns an item
                inventory = null;
                mBarracks.swapItems(changingChamp, invResult);
                return;
            }
            int mouseY = mouseState.getPos().Y;
            if (GeoLib.isInRect(start,overallRect, new Vector2f(mouseState.getPos().X, mouseState.getPos().Y))){//start.X <= mouseState.getPos().X && mouseState.getPos().X <= start.X + overallRect.Width) {
                if (start.Y <= mouseY && mouseY <= start.Y + scroll) {
                    //clicked in the top box
                    if (mouseState.DoneReleasedIt(mouseButton.LEFT)) {
                        backButton();
                    }
                }else if(start.Y + overallRect.Height - scroll <= mouseY && mouseY <= start.Y + overallRect.Height){
                    //bottom box
                    if (mouseState.DoneReleasedIt(mouseButton.LEFT)){
                        nextButton();
                    }
                } else if (start.Y + scroll <= mouseY && mouseY <= start.Y + overallRect.Height - scroll) {
                    //somewhere in the middle
                    if (draggedChamp != null && mouseState.getPos().X >= start.X + itemIconStart.X) {//if on right side to hover over icons
                        int hoveredOver = -1;//TODO this could be nicer
                        hoveredOver = (int)(topBar + (mouseState.getPos().Y - (int)start.Y - scroll) / (champBarRect.Height));

                        if (mouseState.DoneReleasedIt(mouseButton.LEFT))
                            clickedChampItem(hoveredOver);
                    }
                    //do drag logic
                    if (mouseState.DoneClickedIt(mouseButton.LEFT)) {
                        Vector2f current = new Vector2f(mouseState.getPos().X, mouseState.getPos().Y);
                        draggedChamp = mBarracks.getChamps()[(int)(topBar + (mouseState.getPos().Y - (int)start.Y - scroll) / (champBarRect.Height))];
                        lastClicked = current;
                    } else if (!mouseState.left) {
                        draggedChamp = null;
                    }
                    //do scroll logic
                    if (mouseState.mouseWheelPos - mouseState.prevMouseWheelPos >= 1) {
                        backButton();
                    }
                    if (mouseState.mouseWheelPos - mouseState.prevMouseWheelPos <= -1) {
                        nextButton();
                    }
                }
                for (int i = 0; i < maxShown; i++) {
                    ItemID item = mBarracks.getChamps()[topBar+ i].item;
                    champsItemIcons[topBar+ i].update(mouseState,
                        new Vector2f(start.X + itemIconStart.X, start.Y + itemIconStart.Y + champBarRect.Height * i + scroll),item);
                }
            }
            if (!mouseState.left)//released
                draggedChamp = null;
        }
Example #7
0
 internal void checkClicks(SimpleMouseState mouseState)
 {
     foreach (PlayerFrame pf in playerFrames) {
         pf.didClick(mouseState);
     }
 }
Example #8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="mouseState"></param>
        /// <param name="addedChamp"></param>
        /// <returns> if you could drop it there</returns>
        internal bool hoverAndDrop(Vector2f release, SimpleMouseState mouseState, ChampItemPair addedChamp)
        {
            //throw new System.NotImplementedException ();
            if (!GeoLib.isInRect(rect,release))
                return false;
            for(int i=0;i<GROUPS;i++){
                if(pillars[i].update(release)){
                    pillars[i].addUnit(addedChamp);
                    Console.WriteLine(i + " pillar");
                    return true;//only one of these can be true;
                }
            }

            return false;
        }
Example #9
0
 internal override bool didClick(SimpleMouseState mouseState) {
     rollover = didHit(mouseState.getPos());
     return mouseState.DoneClickedIt(mouseButton.LEFT) && rollover;
 }
Example #10
0
        //ineffici? EFF
        internal void update(SimpleMouseState mouseState, Vector2f pos, ItemID item)
        {
            icon.Texture = (Item.getItemTexture(item));
            if (item != mItem) {//if the current item is different...
                if (item != ItemID.none) {
                    Item ite = new Item(item);
                    title = ite.name;
                    desc = ite.description;
                    disable = false;
                    //delete ite;
                } else { title = desc = "noneZ"; disable = true; }//or disable tooltip
                mItem = item;
            }
            icon.Position = pos;//icon.rect.X = (int)pos.X; icon.rect.Y = (int)pos.Y;

            //very basic, doesnt care ifyou are near end of screen or anything
            FloatRect rect = icon.GetGlobalBounds();

            titleV = new Vector2f(rect.Left + rect.Width + 5, rect.Top);//TODOX we are making alot of news without any deletes here
            descV = new Vector2f(rect.Left, rect.Top + rect.Height + 5);

            float startX = rect.Left - 5, startY = rect.Top - 5;
            float width = 5 + rect.Width + 50 /*title.Length * 10*/ + 5;
            float height = 5 + rect.Height + 30;
            //outerRect = new Rect<float>(startX, startY, width, height);
            bgSprite.Position = new Vector2f((float)startX,(float)startY);
            bgSprite.Scale = new Vector2f((float)width, (float)height);

            titleText.DisplayedString = (title);
            titleText.Position = (titleV);
            descText.DisplayedString = (desc);
            descText.Position = (descV);

            hover = GeoLib.isInRect(icon.TextureRect, mouseState.getPos() );
        }
Example #11
0
        public void Update(double gameTime, SimpleMouseState mState, SimpleKeyboardState kState)
        {
            mouseState = mState;
            keyState = kState;
            mGameTime = gameTime;
            if (mouseState.right && mouseState.getPos().Y < 550) {
                tryImoveHere(selected, new Vector2f(mouseState.getPos().X, mouseState.getPos().Y), gameTime);
            }
            if (keyState.IsKeyDown(RESTART_KEY)) {//restart
                GameBox.getInstance().doLastBossFight();
            }
            if (keyState.IsKeyDown(Keyboard.Key.F1) && !prevKeyState.IsKeyDown(Keyboard.Key.F1)) {//lose fight
                if (fightStatus == FightStatus.fightEngaged || fightStatus == FightStatus.preFight) {
                    fightStatus = FightStatus.fightLost;
                    timer = new Timer(gameTime);
                } else {
                    GameBox.getInstance().initPostFight(bossFight.getFightID(), finalTime, getPlayerAmt(), damageMeter, fightStatus == FightStatus.fightWon, bossFight.getBossInfo().enragetimer,thisRaid);
                }
            }
            if (fightStatus == FightStatus.fightEngaged || fightStatus == FightStatus.preFight) {//stop updatings stuff after fight for now, later we might have mobs move around after
                foreach (Moveable m in moveables) {
                    m.Update(gameTime);
                    m.updateBuffs(gameTime);
                    //EFF check if i need all these checks inside this forloop
                    if (mouseState.left) {
                        if (targetNeeded && currentCursor == targetTexture && selected is PlayerClassI && m.isInMe(mouseState.getPos().X, mouseState.getPos().Y)) {//if looking for target
                            PlayerClassI p = (PlayerClassI)selected;
                            if (!targetAll)
                                p.setTarget(m, gameTime);
                            else
                                setAllPlayersTarget(m, gameTime);
                            targetNeeded = false;
                            targetAll = false;
                            currentCursor = null;
                        } else if (mouseState.DoneClickedIt(mouseButton.LEFT) && m.isInMe(mouseState.getPos().X, mouseState.getPos().Y)) {
                            //selection happens right here
                            //selected = m;
                            setSelected(m);
                        }
                    }
                }
            }
            if (kState.IsKeyDown(RAID_TAB_KEY) && !prevKeyState.IsKeyDown(RAID_TAB_KEY)){
                //if we hit *TAB* select next person in raid? (maybe closest ?)
                if(selected != null){
                    int index = moveables.IndexOf(selected);
                    do{
                        index = (index + 1) % moveables.Count;
                    }while(moveables[index] is Enemy);
                    setSelected(moveables[index]);
                }
            }
            if (selected is PlayerClassI && kState.IsKeyDown(TARGET_KEY) && !prevKeyState.IsKeyDown(TARGET_KEY)) {
                if (!targetNeeded) {
                    targetNeeded = true;
                    currentCursor = targetTexture;
                } else {
                    targetNeeded = false;
                    currentCursor = null;
                }
            }
            if (selected is PlayerClassI && kState.IsKeyDown(TARGETALL_KEY) && !prevKeyState.IsKeyDown(TARGETALL_KEY)) {
                if (!targetAll) {
                    targetNeeded = true;
                    targetAll = true;
                    currentCursor = targetTexture;
                } else {
                    targetNeeded = false;
                    targetAll = false;
                    currentCursor = null;
                }
            }
            if (selected is PlayerClassI && kState.IsKeyDown(USE_KEY) && !prevKeyState.IsKeyDown(USE_KEY)) {
                ((PlayerClassI)selected).doAbility();
            }

            foreach (Projectile p in projectiles) {
                p.Update(gameTime);
                if (p.doesCollide() ) {
                    foreach(PlayerClassI m in getAlivePlayerMoveables()){
                        if(p.getOwner() != m && m.isInMe(p.getMid()))
                            projectilesToRemove.Add(p);
                    }

                }
            }
            foreach (GroundEffect g in groundEffects) {
                if (g.update(gameTime)) {//if thats true, do groundfire
                    if (g.doAbility == null) {
                        removeGroundEffect(g);
                        continue;
                    }
                    List<PlayerClassI> peopleGotHit = new List<PlayerClassI>();
                    foreach (PlayerClassI p in getPlayerMoveables()) {
                        //add people to list near fire
                        if( Math.Sqrt(Math.Pow(p.getMid().X-g.getMid().X,2) + Math.Pow(p.getMid().Y-g.getMid().Y,2)) < 13){
                            peopleGotHit.Add(p);
                        }
                    }
                    foreach(PlayerClassI p in peopleGotHit){
                        g.doAbility(p);
                    }
                    removeGroundEffect(g);
                }
            }
            //clean up
            foreach (Projectile p in projectilesToRemove) {
                projectiles.Remove(p);
            }
            projectilesToRemove.Clear();
            foreach (GroundEffect g in groundEffectsToRemove) {
                groundEffects.Remove(g);
            }
            groundEffectsToRemove.Clear();
            foreach (Projectile p in projectilesToAdd) {
                projectiles.Add(p);
            }
            projectilesToAdd.Clear();
            //check if boss enrages
            if (fightStatus == FightStatus.fightEngaged && !bossEnraged && timer.getTime(gameTime) > bossFight.getBossInfo().enragetimer) {
                bossFight.setEnraged(true);
                bossEnraged = true;
            }

            //end game stuffs
            if (fightStatus == FightStatus.fightEngaged) {
                //check to see if either side has won
                if (bossFight.isBossFightDead()) {//bossdead
                    finalTime = timer.getFormattedTime(gameTime,3);
                    fightStatus = FightStatus.fightWon;
                    //addScreenNote(bossFight.getBossInfo().deathstring); TODO
                    //start timer to go to post game
                    timer.reset(gameTime);
                } else if (!areAnyPlayersAlive()) {//peopledead
                    finalTime = timer.getFormattedTime(gameTime,3);
                    fightStatus = FightStatus.fightLost;
                    //start timer to go to post game
                    timer.reset(gameTime);
                }
            }
            raidFrames.checkClicks(mouseState);
            if (fightStatus == FightStatus.fightLost || fightStatus == FightStatus.fightWon) {
                if (timer.getTime(gameTime) > TIMETILPOSTGAME) {
                    GameBox.getInstance().initPostFight(bossFight.getFightID(), finalTime, getPlayerAmt(), damageMeter, fightStatus == FightStatus.fightWon, bossFight.getBossInfo().enragetimer, thisRaid);
                }
            }
            //scripts
            if(fightStatus == FightStatus.fightEngaged)
                updateScripts(gameTime);
            //backdrops
            if (bUpdate = mBackdrop.update(gameTime, 600))//TODO make its so it moves ya know
                bUpdate = false;
            //objects? but this should be near other important stuff
            foreach (FightObject ob in fightObjects)
                ob.update(gameTime);

            prevMouseState = mouseState;
            prevKeyState = kState;
        }
Example #12
0
 internal override bool didClick(SimpleMouseState mouseState) {
     rollover = didHit(new Vector2i(mouseState.getPos().X, mouseState.getPos().Y));
     return mouseState.left && rollover;
 }
Example #13
0
		internal virtual bool didRelease(SimpleMouseState mouseState) {
            return mouseState.DoneReleasedIt(mouseButton.LEFT) && didHit(mouseState.getPos());
        }
Example #14
0
        internal virtual bool didClick(SimpleMouseState mouseState) {
            bool a = mouseState.DoneClickedIt(mouseButton.LEFT);
            bool b = didHit(mouseState.getPos());

            return a && b;
        }
Example #15
0
        internal void Update(double gameTime, SimpleMouseState mouseState)
        {
            this.mouseState = mouseState;
            if (backButton.didClick(mouseState)) {
                GameBox.getInstance().gotoBossSelect();
            }
            if (clearButton.didClick(mouseState)) {
                //clear raid button
                resetRaid();
            }
            if (startButton.didClick(mouseState)) {
                //would start fight
                startFight();
            }
            barracksScrollList.update(gameTime, mouseState);

            ChampItemPair? newDraggedChamp = barracksScrollList.checkHeroDrag();
            if (draggedChamp != null && currentPlayerAmt < maxPlayers)
            {
                //we want released over anything, because if they dont release it specifically over it..
                if(newDraggedChamp == null){
                //if (mouseState.getPos().left == ButtonState.Released /*mouseState.DoneReleasedIt(mouseButton.left)*/){
                    if(pillarGroup.hoverAndDrop(new Vector2f(mouseState.getPos().X, mouseState.getPos().Y), mouseState, (ChampItemPair)draggedChamp)) {
                        barracksScrollList.setDisabledChamp((ChampItemPair)draggedChamp,true);
                        //run added champ code here?
                        draggedChamp = null;
                        currentPlayerAmt++;
                    }else{
                        draggedChamp = null;
                    }
                }
            }
            draggedChamp = newDraggedChamp;
        }
Example #16
0
 internal void Update(double gameTime, SimpleMouseState mouseState)
 {
     if(selectedFight != BossFightID.none)
         if (mouseState.left && makeGroupButton.didHit(mouseState.getPos()) ) {
             GameBox.getInstance().initRaidSelect(selectedFight);
         }
     if (mouseState.left) {
         foreach (BossListButton b in bossListButtons) {
             if (b.didHit(mouseState.getPos())) {
                 selectedFight = b.getBossFight();
                 selectedStars = (BossStarInfo)stars[selectedFight];
             }
         }
     }
 }
Example #17
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);
        }