コード例 #1
0
 public override void Input(int input)
 {
     if (input == Globals.KEY_ACCEPT)
     {
         if (count == 0)
         {
             MapFactory.mapLoad("test");
             StateInGame.locX   = 4;
             StateInGame.locY   = 4;
             StateInGame.change = true;
             StateHandler.State = new StateInGame();
         }
         else if (count == 1)
         {
             StateHandler.State = new SubStateFeatureNotImplemented(this);
         }
         else if (count == 2)
         {
             StateHandler.State = new SubStateOptionsMenu(this);
         }
         else if (count == 3)
         {
             StateHandler.State = new StateCredits();
         }
     }
     else if (input == Globals.KEY_CANCEL)//used to prevent the user from exiting the main menu
     {
         StateHandler.AddDelay();
         MediaHandler.playSFX(FSCMStrikesBackLogic.Properties.Resources.menuBack, "menuBack");
     }
     else
     {
         base.Input(input);
     }
 }
コード例 #2
0
        public override void Update()
        {
            count++;
            if (fresh)
            {
                fresh = false;
                MediaHandler.playSFX(FSCMStrikesBackLogic.Properties.Resources.HoneyBadgers, "HoneyBadgers");
                MediaHandler.Background = "teamlogo.jpg";
            }

            if (count > 220)
            {
                StateHandler.State = new StateTitleScreen();
            }
        }
コード例 #3
0
 public override void Input(int input)
 {
     if (input == Globals.KEY_ACCEPT)
     {
         if (count < ItemHandler.runeList.Count && runeSlotTaken(ItemHandler.runeList[count].Wearflags))
         {
             MediaHandler.playSFX(FSCMStrikesBackLogic.Properties.Resources.menuBack, "error");
             return;
         }
         StateHandler.State = new SubStateConfirmEquipMenu(this, 310, 90, PCid, slot, count, Globals.ITEM_TYPE_RUNE);
     }
     else
     {
         StateHandler.AddDelay();
         base.Input(input);
         if (direction(input))
         {
             StateHandler.State = new SubStateRuneChange(this, PCid, slot, count);
         }
     }
 }//end input
コード例 #4
0
        public override void ParentInput(int input)
        {
            if (!won && !lost)
            {
                if (current != MonsterList[0])
                {
                    switch (input)
                    {
                    case Globals.MENU_ATTACK:
                        StateHandler.State = new SubStateAttackSelect(StateHandler.State, current);
                        MediaHandler.playSFX(FSCMStrikesBackLogic.Properties.Resources.attack, "attack");
                        break;

                    case Globals.MENU_DEFEND:
                        current.setDefend(true);
                        MediaHandler.playSFX(FSCMStrikesBackLogic.Properties.Resources.defend, "defend");
                        break;

                    case Globals.MENU_ITEM:
                        MediaHandler.playSFX(FSCMStrikesBackLogic.Properties.Resources.itemSelect, "selectItem");
                        break;

                    case Globals.MENU_MAGIC:
                        StateHandler.State = new SubStateRuneSelect(StateHandler.State, current);
                        MediaHandler.playSFX(FSCMStrikesBackLogic.Properties.Resources.magic, "magic");
                        break;

                    case Globals.MENU_ITEM_USED:
                        break;
                    }
                }

                if (input == Globals.MESSAGE_CONFIRMED)
                {
                    nextTurn();

                    if (!(current is PC))
                    {
                        foreach (Monster m in MonsterList)
                        {
                            m.act();
                        }
                        nextTurn();
                    }
                }
            }
            else if (won)
            {
                StateHandler.changeState(new StateInGame());
            }
            else if (input == Globals.MESSAGE_CONFIRMED)
            {
                StateHandler.changeState(new StateTitleScreen());
            }

            bool allDefeated = true;

            foreach (Monster m in MonsterList)
            {
                if (m.Health > 0)
                {
                    allDefeated = false;
                }
            }

            if (allDefeated)
            {
                Victory();
            }

            if (allDefeated && input == Globals.MESSAGE_CONFIRMED)
            {
                if (!won)
                {
                    Victory();
                }
                else
                {
                    StateHandler.State = new StateInGame();
                }
            }
        }
コード例 #5
0
        public override void Input(int input)
        {
            if (input == Globals.KEY_UP || input == Globals.KEY_DOWN)
            {
                MediaHandler.playSFX(FSCMStrikesBackLogic.Properties.Resources.menuMove, "menuMove");

                StateHandler.SetDelay(8);

                colors[count] = Color.DarkGray;

                if (input == Globals.KEY_UP)
                {
                    if (count == 0)
                    {
                        count = menu.Length - 1;
                    }
                    else
                    {
                        count--;
                    }
                }
                else if (input == Globals.KEY_DOWN)
                {
                    count = (count + 1) % menu.Length;
                }

                colors[count] = Color.White;

                int tempVal = (int)(Globals.hmod * height);

                tempVal /= Globals.FONT_HEIGHT;

                tempVal -= 1;

                Color[]  tempColor = null;
                string[] tempMenu  = null;
                int      prefCount = tempVal / 2;

                if (tempVal >= menu.Length || absolute) // The total amount of options is less than the size of the menu box
                {
                    tempColor = colors;
                    tempMenu  = menu;
                }
                else
                {
                    int realCount;
                    tempMenu = new string[tempVal];

                    if (prefCount > count)
                    {
                        realCount = count;
                        for (int i = 0; i < tempVal; i++)
                        {
                            tempMenu[i] = menu[i];
                        }
                    }
                    else if (prefCount >= menu.Length - count)
                    {
                        realCount = count - (menu.Length - tempVal);
                        // Menu from menu-tval to menu)
                        for (int i = 0; i < tempVal; i++)
                        {
                            tempMenu[i] = menu[(menu.Length - tempVal) + i];
                        }
                    }
                    else
                    {
                        realCount = tempVal / 2;
                        for (int i = 0; i < tempVal; i++)
                        {
                            tempMenu[i] = menu[(count - prefCount) + i];
                        }
                    }

                    tempColor = new Color[tempVal];

                    for (int i = 0; i < tempVal; i++)
                    {
                        tempColor[i] = Color.DarkGray;
                    }

                    tempColor[realCount] = Color.White;
                }

                messageBoxes[0] = new MessageBox(mX, mY, width, height, tempMenu, tempColor, true, messageBoxes[0].Scaling(), messageBoxes[0].IsChildMessage());
            }
            else if (input == Globals.KEY_CANCEL)
            {
                StateHandler.AddDelay();
                MediaHandler.playSFX(FSCMStrikesBackLogic.Properties.Resources.menuBack, "menuBack");

                StateHandler.State = Parent;
            }
        }