Exemplo n.º 1
0
        public IHttpActionResult PutsubMenu(int id, subMenu subMenu)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != subMenu.idSubMenu)
            {
                return(BadRequest());
            }

            db.Entry(subMenu).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!subMenuExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public IHttpActionResult PostsubMenu(subMenu subMenu)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.subMenu.Add(subMenu);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (subMenuExists(subMenu.idSubMenu))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = subMenu.idSubMenu }, subMenu));
        }
Exemplo n.º 3
0
 private static void toJson(fastCSharp.emit.jsonSerializer toJsoner, subMenu value)
 {
     toJsoner.UnsafeWriteFirstName("name");
     toJsoner.UnsafeToJson(value.name);
     if (value.type != menuType.none)
     {
         toJsoner.UnsafeWriteNextName("type");
         toJsoner.UnsafeToJsonNotNull(value.type);
     }
     if (!string.IsNullOrEmpty(value.key))
     {
         toJsoner.UnsafeWriteNextName("key");
         toJsoner.UnsafeToJsonNotNull(value.key);
     }
     if (!string.IsNullOrEmpty(value.url))
     {
         toJsoner.UnsafeWriteNextName("url");
         toJsoner.UnsafeToJsonNotNull(value.url);
     }
     if (!string.IsNullOrEmpty(value.media_id))
     {
         toJsoner.UnsafeWriteNextName("media_id");
         toJsoner.UnsafeToJsonNotNull(value.media_id);
     }
     toJsoner.UnsafeCharStream.Write('}');
 }
Exemplo n.º 4
0
    private void DrawRoot()
    {
        int anchorX = Screen.width / 2 - 150;
        int anchorY = Screen.height / 2 - 150;

        // continue
        if (GUI.Button(new Rect(anchorX, anchorY, 300, 30), "Next Battle!"))
        {
            LevelManager.Instance.StartBattle();
        }
        // view stats
        if (GUI.Button(new Rect(anchorX, anchorY += 40, 300, 30), "My little Ponies"))
        {
            _rooster   = SaveFile.Active.GetUnlockedCharacters();
            _sub       = subMenu.Rooster;
            _zeroIndex = 0;
        }
        //
        if (GUI.Button(new Rect(anchorX, anchorY += 40, 300, 30), "Skills"))
        {
            _rooster   = SaveFile.Active.GetUnlockedCharacters();
            _sub       = subMenu.SkillOverview;
            _zeroIndex = 0;
        }
        // exit to main
        if (GUI.Button(new Rect(anchorX, anchorY += 40, 300, 30), "Main Menu"))
        {
            LevelManager.Instance.MainMenu(false);
        }
    }
Exemplo n.º 5
0
        public IHttpActionResult GetsubMenu(int id)
        {
            subMenu subMenu = db.subMenu.Find(id);

            if (subMenu == null)
            {
                return(NotFound());
            }

            return(Ok(subMenu));
        }
Exemplo n.º 6
0
    private void DrawRooster()
    {
        int rootX = Screen.width / 2 - 300;
        int rootY = 60;

        // calc capacity
        int cap = Screen.height;

        cap -= rootY + 30 + 60 + 30;         // top padding, header, bot padding, bot button
        cap /= 40;

        // boundingBox
        GUI.Box(new Rect(rootX - 5, rootY, 610, cap * 40 + 50), "");

        // heading
        DrawRoosterCell(rootX, rootY, "  Pony", "Lvl.", "HP", "Atk.", "Str.", "Agi.", "Int.", "Def.", "Res.", "Hit", "Dodge", false);

        // list with character
        rootY += 30;
        SaveFile.Active.UpdateUnit(_rooster);
        for (int i = 0; i + _zeroIndex < _rooster.Count && i < cap; i++)
        {
            DrawRoosterCell(rootX, rootY + 40 * (i), _rooster[i + _zeroIndex]);
        }
        // scrollbar if needed
        if (cap < _rooster.Count)
        {
            // show scroll buttons
            if (GUI.Button(new Rect(rootX + 630, rootY, 30, 60), "^"))
            {
                _zeroIndex--;
            }
            if (GUI.Button(new Rect(rootX + 630, rootY + cap * 40 - 70, 30, 60), "v"))
            {
                _zeroIndex++;
            }
            // constrain so we wont go OOB
            if (_zeroIndex < 0)
            {
                _zeroIndex = 0;
            }
            if (_zeroIndex + cap > _rooster.Count)
            {
                _zeroIndex--;
            }
        }

        // cancel button in the bottom.
        if (GUI.Button(new Rect(Screen.height / 2 - 100, Screen.height - 60, 200, 30), "Back"))
        {
            _sub = subMenu.Root;
        }
    }
Exemplo n.º 7
0
        public IHttpActionResult DeletesubMenu(int id)
        {
            subMenu subMenu = db.subMenu.Find(id);

            if (subMenu == null)
            {
                return(NotFound());
            }

            db.subMenu.Remove(subMenu);
            db.SaveChanges();

            return(Ok(subMenu));
        }
Exemplo n.º 8
0
        public override void Update(GameTime gameTime)
        {
            background.Update();
            counter += gameTime.ElapsedGameTime.Milliseconds;
            shootSpeed = Strings.ShootSpeed + " = " + (Game1.gammgr.saveGameData.playerShootspeed * 200).ToString();
            missileBank = Strings.MissileBank + " = " + (Game1.gammgr.saveGameData.maxMissiles).ToString();
            noOfBuffs = Strings.NumberBuffs + " = " + Game1.gammgr.saveGameData.totalPlayerBuffs.ToString();
            buffHealth = Strings.BuffHealth + " = " + Game1.gammgr.saveGameData.buffHealth.ToString();
            buffSpeed = Strings.BuffSpeed + " = " + Game1.gammgr.saveGameData.buffSpeed.ToString();
            missSplod = Strings.MissileStrength + " = " + (Game1.gammgr.saveGameData.missileExpolsion * 100).ToString();

            levHealthOrbs = Strings.ShieldStrength + " = " + Game1.gammgr.saveGameData.levelHeathOrbs.ToString();

            pickUpRate = Strings.PickUpRate + " = " + (Game1.gammgr.saveGameData.basePickUpRate * 100).ToString() + "%";

            if (Game1.inpmgr.playerOneKeyboard == false)
            {
                #region joystickSelection

                if (Game1.inpmgr.playerOneInput.leftStick.Y > 0.3f && !moved)
                {
                    moved = true;
                    menuSizes[(int)currentSelection] = 1;

                    Game1.sndmgr.playSound(SFX.menuMove);

                    switch (onSubMenu)
                    {
                        case subMenu.ShopMenu:
                            if (currentSelection == (int)shopMenu.otherMenu)
                            {
                                currentSelection = (int)shopMenu.shipMenu;
                            }
                            else
                            {
                                currentSelection++;
                            }
                            break;
                        case subMenu.ShipShopMenu:
                            if (currentSelection == (int)shipShopMenu.buffSpeed)
                            {
                                currentSelection = (int)shipShopMenu.playerBuffs;
                            }
                            else
                            {
                                currentSelection++;
                            }
                            break;
                        case subMenu.BulletShopMenu:

                            if (currentSelection == (int)bulletShopMenu.missileSplode)
                            {
                                currentSelection = (int)bulletShopMenu.shootSpeed;
                            }
                            else
                            {
                                currentSelection++;
                            }
                            break;
                        case subMenu.OtherShopMenu:

                            if (currentSelection == (int)otherShopMenu.pickups)
                            {
                                currentSelection = (int)otherShopMenu.levelHealthOrbs;
                            }
                            else
                            {
                                currentSelection++;
                            }
                            break;
                    }

                }
                else if (Game1.inpmgr.playerOneInput.leftStick.Y < -0.3f && !moved)
                {
                    moved = true;
                    menuSizes[(int)currentSelection] = 1;

                    Game1.sndmgr.playSound(SFX.menuMove);

                    switch (onSubMenu)
                    {
                        case subMenu.ShopMenu:
                            if (currentSelection == (int)shopMenu.shipMenu)
                            {
                                currentSelection = (int)shopMenu.otherMenu;
                            }
                            else
                            {
                                currentSelection--;
                            }
                            break;
                        case subMenu.ShipShopMenu:
                            if (currentSelection == (int)shipShopMenu.playerBuffs)
                            {
                                currentSelection = (int)shipShopMenu.buffSpeed;
                            }
                            else
                            {
                                currentSelection--;
                            }
                            break;
                        case subMenu.BulletShopMenu:

                            if (currentSelection == (int)bulletShopMenu.shootSpeed)
                            {
                                currentSelection = (int)bulletShopMenu.missileSplode;
                            }
                            else
                            {
                                currentSelection--;
                            }
                            break;
                        case subMenu.OtherShopMenu:

                            if (currentSelection == (int)otherShopMenu.levelHealthOrbs)
                            {
                                currentSelection = (int)otherShopMenu.pickups;
                            }
                            else
                            {
                                currentSelection--;
                            }
                            break;
                    }
                }
                else if (Game1.inpmgr.playerOneInput.leftStick.Y > -0.3f &&
                    Game1.inpmgr.playerOneInput.leftStick.Y < 0.3f && moved)
                {
                    moved = false;
                }

                #endregion
            }
            else
            {
                #region mouseSelection
                if (Game1.gammgr.playerShip.position.Y < Game1.scrmgr.menuTopPosition - 0.025f)
                {
                    currentSelection = -1;
                }
                else
                {
                    if (Game1.gammgr.playerShip.position.Y > Game1.scrmgr.menuTopPosition - 0.025f &&
                        Game1.gammgr.playerShip.position.Y < Game1.scrmgr.menuTopPosition + 0.025f)
                    {
                        //0.7f
                        currentSelection = 0;
                    }
                    else if (Game1.gammgr.playerShip.position.Y > Game1.scrmgr.menuTopPosition + 0.025f &&
                        Game1.gammgr.playerShip.position.Y < Game1.scrmgr.menuTopPosition + 0.075f)
                    {
                        //0.75f
                        currentSelection = 1;
                    }
                    else if (Game1.gammgr.playerShip.position.Y > Game1.scrmgr.menuTopPosition + 0.075f &&
                        Game1.gammgr.playerShip.position.Y < Game1.scrmgr.menuTopPosition + 0.125f)
                    {
                        //0.8f
                        currentSelection = 2;
                    }
                    else if (Game1.gammgr.playerShip.position.Y > Game1.scrmgr.menuTopPosition + 0.125f &&
                        Game1.gammgr.playerShip.position.Y < Game1.scrmgr.menuTopPosition + 0.175f)
                    {
                        //0.85f
                        currentSelection = 3;
                    }
                    else
                    {
                        currentSelection = -1;
                    }
                }
                #endregion
            }

            #region tipText
            switch (currentSelection)
            {
                case -1:
                    tipString = holdTip;
                    break;
                case 0:
                    switch (onSubMenu)
                    {
                        case subMenu.BulletShopMenu:
                            tipString = Strings.ShopBulletSpeed;
                            break;
                        case subMenu.OtherShopMenu:
                            tipString = Strings.ShopOtherWall;
                            break;
                        case subMenu.ShipShopMenu:
                            tipString = Strings.ShopShipNumber;
                            break;
                        case subMenu.ShopMenu:
                            tipString = holdTip;
                            break;
                    }
                    break;
                case 1:
                    switch (onSubMenu)
                    {
                        case subMenu.BulletShopMenu:
                            tipString = Strings.ShopBulletMisNum;
                            break;
                        case subMenu.OtherShopMenu:
                            tipString = Strings.ShopOtherPickups;
                            break;
                        case subMenu.ShipShopMenu:
                            tipString = Strings.ShopShipHealth;
                            break;
                        case subMenu.ShopMenu:
                            tipString = holdTip;
                            break;
                    }
                    break;
                case 2:
                    switch (onSubMenu)
                    {
                        case subMenu.BulletShopMenu:
                            tipString = Strings.ShopBulletMisStr;
                            break;
                        case subMenu.OtherShopMenu:
                            tipString = holdTip;
                            break;
                        case subMenu.ShipShopMenu:
                            tipString = Strings.ShopShipSpeed;
                            break;
                        case subMenu.ShopMenu:
                            tipString = holdTip;
                            break;
                    }
                    break;
            }
            #endregion

            #region selection colors
            for (int i = 0; i < menuColors.Count; i++)
            {
                if (i == (int)currentSelection)
                {
                    menuSizes[i] += 0.05f;
                    if (menuSizes[i] > 1.25f)
                        menuSizes[i] = 1.25f;
                    menuColors[i] = Color.White;
                }
                else
                {
                    menuSizes[i] -= 0.05f;
                    if (menuSizes[i] < 1)
                        menuSizes[i] = 1;
                    menuColors[i] = Color.SlateGray;
                }
            }
            #endregion

            #region shopColorings
            if (onSubMenu == subMenu.ShipShopMenu)
            {
                switch ((shipShopMenu)currentSelection)
                {
                    case shipShopMenu.playerBuffs:
                        if (Game1.gammgr.saveGameData.totalPlayerBuffs < playerBuffMaxSwitch)
                        {
                            noOfBuffs = Strings.NumberBuffs + " = " + Game1.gammgr.saveGameData.totalPlayerBuffs.ToString() +
                                " + 1 (" + calcPrice(0).ToString() + "p)";

                            if (Game1.gammgr.saveGameData.totalScore < calcPrice(0))
                            {
                                menuColors[currentSelection] = Color.Red;
                            }
                        }
                        else
                        {
                            noOfBuffs = Strings.NumberBuffs + " = " + Game1.gammgr.saveGameData.totalPlayerBuffs.ToString() +
                               maxString;
                            menuColors[currentSelection] = Color.Red;
                        }
                        break;
                    case shipShopMenu.buffHealth:
                        if (Game1.gammgr.saveGameData.buffHealth < buffHealthMaxSwitch)
                        {
                            buffHealth = Strings.BuffHealth + " = " + Game1.gammgr.saveGameData.buffHealth.ToString() +
                                " + 1 (" + calcPrice(1).ToString() + "p)";

                            if (Game1.gammgr.saveGameData.totalScore < calcPrice(1))
                            {
                                menuColors[currentSelection] = Color.Red;
                            }
                        }
                        else
                        {
                            buffHealth = Strings.BuffHealth + " = " + Game1.gammgr.saveGameData.buffHealth.ToString() +
                                maxString;
                            menuColors[currentSelection] = Color.Red;
                        }
                        break;
                    case shipShopMenu.buffSpeed:
                        if (Game1.gammgr.saveGameData.buffSpeed < buffSpeedMaxSwitch)
                        {
                            buffSpeed = Strings.BuffSpeed + " = " + Game1.gammgr.saveGameData.buffSpeed.ToString() +
                                " + 1 (" + calcPrice(7).ToString() + "p)";

                            if (Game1.gammgr.saveGameData.totalScore < calcPrice(7))
                            {
                                menuColors[currentSelection] = Color.Red;
                            }
                        }
                        else
                        {
                            buffSpeed = Strings.BuffSpeed + " = " + Game1.gammgr.saveGameData.buffSpeed.ToString() +
                                maxString;
                            menuColors[currentSelection] = Color.Red;
                        }
                        break;
                }
            }
            else if (onSubMenu == subMenu.BulletShopMenu)
            {
                switch ((bulletShopMenu)currentSelection)
                {
                    case bulletShopMenu.shootSpeed:
                        if (Game1.gammgr.saveGameData.playerShootspeed < shootSpeedMaxSwitch)
                        {
                            shootSpeed = Strings.ShootSpeed + " = " + (Game1.gammgr.saveGameData.playerShootspeed * 200).ToString() +
                                " + 2 (" + calcPrice(2).ToString() + "p)";

                            if (Game1.gammgr.saveGameData.totalScore < calcPrice(2))
                            {
                                menuColors[currentSelection] = Color.Red;
                            }
                        }
                        else
                        {
                            shootSpeed = Strings.ShootSpeed + " = " + (Game1.gammgr.saveGameData.playerShootspeed * 200).ToString() +
                                maxString;
                            menuColors[currentSelection] = Color.Red;
                        }
                        break;
                    case bulletShopMenu.missilebank:
                        if (Game1.gammgr.saveGameData.maxMissiles < missileBankMaxSwitch)
                        {
                            missileBank = Strings.MissileBank + " = " + (Game1.gammgr.saveGameData.maxMissiles).ToString() +
                                " + 10 (" + calcPrice(3).ToString() + "p)";

                            if (Game1.gammgr.saveGameData.totalScore < calcPrice(3))
                            {
                                menuColors[currentSelection] = Color.Red;
                            }
                        }
                        else
                        {
                            missileBank = Strings.MissileBank + " = " + (Game1.gammgr.saveGameData.maxMissiles).ToString() +
                                maxString;
                            menuColors[currentSelection] = Color.Red;
                        }
                        break;
                    case bulletShopMenu.missileSplode:
                        if (Game1.gammgr.saveGameData.missileExpolsion < missileSplodeMaxSwitch)
                        {
                            missSplod = Strings.MissileStrength + " = " + (Game1.gammgr.saveGameData.missileExpolsion * 100).ToString() +
                                " + 5 (" + calcPrice(4).ToString() + "p)";

                            if (Game1.gammgr.saveGameData.totalScore < calcPrice(4))
                            {
                                menuColors[currentSelection] = Color.Red;
                            }
                        }
                        else
                        {
                           missSplod = Strings.MissileBank + " = " + (Game1.gammgr.saveGameData.missileExpolsion * 100).ToString() +
                               maxString;
                           menuColors[currentSelection] = Color.Red;
                        }
                        break;
                }

            }
            else if (onSubMenu == subMenu.OtherShopMenu)
            {
                switch ((otherShopMenu)currentSelection)
                {
                    case otherShopMenu.levelHealthOrbs:
                        if (Game1.gammgr.saveGameData.levelHeathOrbs < levelHealthMaxSwitch)
                        {

                            levHealthOrbs = Strings.ShieldStrength + " = " + Game1.gammgr.saveGameData.levelHeathOrbs.ToString() +
                                " + 1 (" + calcPrice(5).ToString() + "p)";

                            if (Game1.gammgr.saveGameData.totalScore < calcPrice(5))
                            {
                                menuColors[currentSelection] = Color.Red;
                            }
                        }
                        else
                        {
                            levHealthOrbs = Strings.ShieldStrength + " = " + Game1.gammgr.saveGameData.levelHeathOrbs.ToString() +
                               maxString;
                            menuColors[currentSelection] = Color.Red;
                        }
                        break;
                    case otherShopMenu.pickups:
                        if (Game1.gammgr.saveGameData.basePickUpRate < pickUpRateMaxSwitch)
                        {

                            pickUpRate = Strings.PickUpRate + " = " + (Game1.gammgr.saveGameData.basePickUpRate * 100).ToString() +
                                "% + 0.5% (" + calcPrice(6).ToString() + "p)";

                            if (Game1.gammgr.saveGameData.totalScore < calcPrice(6))
                            {
                                menuColors[currentSelection] = Color.Red;
                            }
                        }
                        else
                        {
                            pickUpRate = Strings.PickUpRate + " = " + (Game1.gammgr.saveGameData.basePickUpRate * 100).ToString() + "% " +
                               maxString;
                            menuColors[currentSelection] = Color.Red;
                        }
                        break;
                }
            }
            #endregion

            #region Selection and Back
            if (Game1.inpmgr.playerOneInput.Start == expButtonState.Pressed ||
            Game1.inpmgr.playerOneInput.A == expButtonState.Pressed)
            {
                bool playSound = false;
                switch (onSubMenu)
                {
                    case subMenu.ShopMenu:
                        switch ((shopMenu)currentSelection)
                        {
                            case shopMenu.shipMenu:
                                onSubMenu = subMenu.ShipShopMenu;
                                currentSelection = 0;
                                playSound = true;
                                break;
                            case shopMenu.bulletMenu:
                                onSubMenu = subMenu.BulletShopMenu;
                                currentSelection = 0;
                                playSound = true;
                                break;
                            case shopMenu.otherMenu:
                                onSubMenu = subMenu.OtherShopMenu;
                                currentSelection = 0;
                                playSound = true;
                                break;
                        }
                        break;
                    case subMenu.ShipShopMenu:
                        switch ((shipShopMenu)currentSelection)
                        {
                            case shipShopMenu.playerBuffs:
                                if (Game1.gammgr.saveGameData.totalScore > calcPrice(0)
                                    && Game1.gammgr.saveGameData.totalPlayerBuffs < playerBuffMaxSwitch)
                                {
                                    Game1.gammgr.saveGameData.totalScore -= calcPrice(0);
                                    Game1.gammgr.saveGameData.totalPlayerBuffs++;
                                    Game1.gammgr.numBuffs = Game1.gammgr.saveGameData.totalPlayerBuffs;

                                    SaveGameManager.SaveGame(Game1.gammgr.currentPlayer, Game1.gammgr.saveGameData);
                                    playSound = true;
                                }
                                break;
                            case shipShopMenu.buffHealth:
                                if (Game1.gammgr.saveGameData.totalScore > calcPrice(1) &&
                                    Game1.gammgr.saveGameData.buffHealth < buffHealthMaxSwitch)
                                {
                                    Game1.gammgr.saveGameData.totalScore -= calcPrice(1);
                                    Game1.gammgr.saveGameData.buffHealth++;

                                    SaveGameManager.SaveGame(Game1.gammgr.currentPlayer, Game1.gammgr.saveGameData);
                                    playSound = true;
                                }
                                break;
                            case shipShopMenu.buffSpeed:
                                if (Game1.gammgr.saveGameData.totalScore > calcPrice(7) &&
                                    Game1.gammgr.saveGameData.buffSpeed < buffSpeedMaxSwitch)
                                {
                                    Game1.gammgr.saveGameData.totalScore -= calcPrice(7);
                                    Game1.gammgr.saveGameData.buffSpeed++;

                                    SaveGameManager.SaveGame(Game1.gammgr.currentPlayer, Game1.gammgr.saveGameData);
                                    playSound = true;
                                }
                                break;
                        }
                        break;
                    case subMenu.BulletShopMenu:
                        switch ((bulletShopMenu)currentSelection)
                        {
                            case bulletShopMenu.shootSpeed:
                                if (Game1.gammgr.saveGameData.totalScore > calcPrice(2) &&
                                    Game1.gammgr.saveGameData.playerShootspeed < shootSpeedMaxSwitch)
                                {
                                    Game1.gammgr.saveGameData.totalScore -= calcPrice(2);
                                    Game1.gammgr.saveGameData.playerShootspeed += 0.01f;

                                    if (Game1.gammgr.saveGameData.playerShootspeed > shootSpeedMaxSwitch)
                                        Game1.gammgr.saveGameData.playerShootspeed = shootSpeedMaxSwitch;

                                    SaveGameManager.SaveGame(Game1.gammgr.currentPlayer, Game1.gammgr.saveGameData);
                                    playSound = true;
                                }
                                break;
                            case bulletShopMenu.missilebank:
                                if (Game1.gammgr.saveGameData.totalScore > calcPrice(3) &&
                                    Game1.gammgr.saveGameData.maxMissiles < missileBankMaxSwitch)
                                {
                                    Game1.gammgr.saveGameData.totalScore -= calcPrice(3);
                                    Game1.gammgr.saveGameData.maxMissiles += 10;

                                    SaveGameManager.SaveGame(Game1.gammgr.currentPlayer, Game1.gammgr.saveGameData);
                                    playSound = true;
                                }
                                break;
                            case bulletShopMenu.missileSplode:
                                if (Game1.gammgr.saveGameData.totalScore > calcPrice(4) &&
                                    Game1.gammgr.saveGameData.missileExpolsion < missileSplodeMaxSwitch)
                                {
                                    Game1.gammgr.saveGameData.totalScore -= calcPrice(4);
                                    Game1.gammgr.saveGameData.missileExpolsion += 0.05;

                                    SaveGameManager.SaveGame(Game1.gammgr.currentPlayer, Game1.gammgr.saveGameData);
                                    playSound = true;
                                }
                                break;
                        }
                        break;
                    case subMenu.OtherShopMenu:
                        switch ((otherShopMenu)currentSelection)
                        {
                            case otherShopMenu.levelHealthOrbs:
                                if (Game1.gammgr.saveGameData.totalScore > calcPrice(5) &&
                                    Game1.gammgr.saveGameData.levelHeathOrbs < levelHealthMaxSwitch)
                                {
                                    Game1.gammgr.saveGameData.totalScore -= calcPrice(5);
                                    Game1.gammgr.saveGameData.levelHeathOrbs++;

                                    SaveGameManager.SaveGame(Game1.gammgr.currentPlayer, Game1.gammgr.saveGameData);
                                    playSound = true;
                                }
                                break;
                            case otherShopMenu.pickups:
                                if (Game1.gammgr.saveGameData.totalScore > calcPrice(6) &&
                                    Game1.gammgr.saveGameData.basePickUpRate < pickUpRateMaxSwitch)
                                {
                                    Game1.gammgr.saveGameData.totalScore -= calcPrice(6);
                                    Game1.gammgr.saveGameData.basePickUpRate += 0.005;

                                    SaveGameManager.SaveGame(Game1.gammgr.currentPlayer, Game1.gammgr.saveGameData);
                                    playSound = true;
                                }
                                break;
                        }
                        break;
                }

                if (playSound)
                {
                    Game1.sndmgr.playSound(SFX.menuSelect);

                    if (Game1.gammgr.saveGameData.playerShootspeed >= shootSpeedMaxSwitch &&
                        Game1.gammgr.saveGameData.maxMissiles >= missileBankMaxSwitch &&
                        Game1.gammgr.saveGameData.missileExpolsion >= missileSplodeMaxSwitch)
                    {
                        AwardsManager.checkMaxWeaponsAward();

                        if (Game1.gammgr.saveGameData.totalPlayerBuffs >= playerBuffMaxSwitch &&
                            Game1.gammgr.saveGameData.buffHealth >= buffHealthMaxSwitch &&
                            Game1.gammgr.saveGameData.buffSpeed >= buffSpeedMaxSwitch &&
                            Game1.gammgr.saveGameData.levelHeathOrbs >= levelHealthMaxSwitch &&
                            Game1.gammgr.saveGameData.basePickUpRate >= pickUpRateMaxSwitch)
                        {
                            AwardsManager.checkMaxEverythingAward();
                        }
                    }
                }
            }
            else if (Game1.inpmgr.playerOneInput.B == expButtonState.Pressed)
            {
                switch (onSubMenu)
                {
                    case subMenu.ShopMenu:
                        Game1.scrmgr.changeScreen(nextScreen);
                        break;
                    case subMenu.ShipShopMenu:
                        onSubMenu = subMenu.ShopMenu;
                        break;
                    case subMenu.BulletShopMenu:
                        onSubMenu = subMenu.ShopMenu;
                        break;
                    case subMenu.OtherShopMenu:
                        onSubMenu = subMenu.ShopMenu;
                        break;
                }
            }
            #endregion
        }
Exemplo n.º 9
0
        public override void Update(GameTime gameTime)
        {
            //Main Menu Input stuff;
            if (loaded)
            {
                resolutionString = ScreenManager.resolutions[(int)Game1.scrmgr.screenMode + tempResolutionMod, 0]
                              + "x" + ScreenManager.resolutions[(int)Game1.scrmgr.screenMode + tempResolutionMod, 1];

                fullScreenString = Strings.FullScreen + " = " + fullscreen;

                musVol = Strings.MusicVolume + " = " + (Game1.musman.volume * 10);
                sfxVol = Strings.EffectsVolume + " = " + (Game1.sndmgr.masterFXVolume * 10);

                particleModString = Strings.ParticleMod + ": " + (int)(SettingsManager.settings.particleMod * 100) + "%";

                string set = "";
                switch (SettingsManager.settings.postProcessQuality)
                {
                    case 0:
                        set = Strings.Off;
                        break;
                    case 1:
                        set = Strings.Low;
                        break;
                    case 2:
                        set = Strings.Mid;
                        break;
                    case 3:
                        set = Strings.High;
                        break;
                    case 4:
                        set = Strings.Ultra;
                        break;
                }
                postProcessString = Strings.PostProcess + ": " + set;

                background.Update();
                counter += gameTime.ElapsedGameTime.Milliseconds;
                if (playmusic)
                {
                    playmusic = false;
                    Game1.musman.PlayNewSong("Hallucinoshapes");
                }
                if (!playmusic && onControllerGrab)
                {
                    if (Game1.inpmgr.checkInitalInput())
                    {
                        Game1.inpmgr.playerOneInput.Start = expButtonState.Held;

                        Game1.gammgr.playerShip.visible = true;

                        onControllerGrab = false;
                    }
                }
                else if (onExitFrame)
                {
                    if (Game1.gammgr.playerShip.position.Y > 0.555f && Game1.gammgr.playerShip.position.Y < 0.595f)
                    {
                        ondemolink = true;
                        demoLinkSize += 0.05f;
                        if (demoLinkSize > 1.25f)
                            demoLinkSize = 1.25f;

                    }
                    else
                    {
                        ondemolink = false;
                        demoLinkSize -= 0.05f;
                        if (demoLinkSize < 1f)
                            demoLinkSize = 1f;
                    }

                    if (Game1.inpmgr.playerOneInput.A == expButtonState.Pressed)
                    {
            #if WINDOWS
                        if (Game1.IS_DEMO && ondemolink && !clickedBuy)
                        {
                            clickedBuy = true;
                            System.Diagnostics.Process.Start("http://store.indiecity.com/game/SHMUP");
                        }
            #endif
                        Game1.plzExit = true;
                    }
                    else if (Game1.inpmgr.playerOneInput.B == expButtonState.Pressed)
                        onExitFrame = false;
                }

                else if (!onControllerGrab)
                {

                    if (Game1.inpmgr.playerOneInput.A == expButtonState.notPressed &&
                        Game1.inpmgr.playerOneInput.Start == expButtonState.notPressed)
                    {
                        menusActive = true;
                    }

                    if (!finishedOnScreen)
                    {
                        if (Game1.inpmgr.playerOneKeyboard == false)
                        {
                            #region joystickSelection

                            if (Game1.inpmgr.playerOneInput.leftStick.Y > 0.3f && !moved)
                            {
                                moved = true;
                                menuSizes[(int)currentSelection] = 1;
                                tempResolutionMod = 0;

                                Game1.sndmgr.playSound(SFX.menuMove);

                                switch (onSubMenu)
                                {
                                    case subMenu.MainMenu:
                                        if (currentSelection == (int)mainMenu.credits)
                                        {
                                            currentSelection = (int)mainMenu.startGame;
                                        }
                                        else
                                        {
                                            currentSelection++;
                                        }
                                        break;
                                    case subMenu.PlayMenu:
                                        if (currentSelection == (int)playMenu.single)
                                        {
                                            currentSelection = (int)playMenu.original;
                                        }
                                        else
                                        {
                                            currentSelection++;
                                        }
                                        break;
                                    case subMenu.OptionsMenu:
                                        if (currentSelection == (int)optionsMenu.musicVolume)
                                        {
                                            currentSelection = (int)optionsMenu.postProcess;
                                        }
                                        else
                                        {
                                            currentSelection++;
                                        }
                                        break;
                                }

                            }
                            else if (Game1.inpmgr.playerOneInput.leftStick.Y < -0.3f && !moved)
                            {
                                moved = true;
                                menuSizes[(int)currentSelection] = 1;
                                tempResolutionMod = 0;

                                Game1.sndmgr.playSound(SFX.menuMove);

                                switch (onSubMenu)
                                {
                                    case subMenu.MainMenu:
                                        if (currentSelection == (int)mainMenu.startGame)
                                        {
                                            currentSelection = (int)mainMenu.credits;
                                        }
                                        else
                                        {
                                            currentSelection--;
                                        }
                                        break;
                                    case subMenu.PlayMenu:
                                        if (currentSelection == (int)playMenu.original)
                                        {
                                            currentSelection = (int)playMenu.single;
                                        }
                                        else
                                        {
                                            currentSelection--;
                                        }
                                        break;
                                    case subMenu.OptionsMenu:
                                        if (currentSelection == (int)optionsMenu.postProcess)
                                        {
                                            currentSelection = (int)optionsMenu.musicVolume;
                                        }
                                        else
                                        {
                                            currentSelection--;
                                        }
                                        break;
                                }
                            }
                            else if (Game1.inpmgr.playerOneInput.leftStick.Y > -0.3f &&
                                Game1.inpmgr.playerOneInput.leftStick.Y < 0.3f && moved)
                            {
                                moved = false;
                            }

                            #endregion
                        }
                        else
                        {
                            #region mouseSelection
                            if (Game1.gammgr.playerShip.position.Y < Game1.scrmgr.menuTopPosition - 0.025f)
                            {
                                currentSelection = -1;
                            }
                            else
                            {
                                if (Game1.gammgr.playerShip.position.Y > Game1.scrmgr.menuTopPosition - 0.025f &&
                                    Game1.gammgr.playerShip.position.Y < Game1.scrmgr.menuTopPosition + 0.025f)
                                {
                                    //0.7f
                                    currentSelection = 0;
                                }
                                else if (Game1.gammgr.playerShip.position.Y > Game1.scrmgr.menuTopPosition + 0.025f &&
                                    Game1.gammgr.playerShip.position.Y < Game1.scrmgr.menuTopPosition + 0.075f)
                                {
                                    //0.75f
                                    currentSelection = 1;
                                }
                                else if (Game1.gammgr.playerShip.position.Y > Game1.scrmgr.menuTopPosition + 0.075f &&
                                    Game1.gammgr.playerShip.position.Y < Game1.scrmgr.menuTopPosition + 0.125f)
                                {
                                    //0.8f
                                    currentSelection = 2;
                                }
                                else if (Game1.gammgr.playerShip.position.Y > Game1.scrmgr.menuTopPosition + 0.125f &&
                                    Game1.gammgr.playerShip.position.Y < Game1.scrmgr.menuTopPosition + 0.175f)
                                {
                                    //0.85f
                                    currentSelection = 3;
                                }
                                else if (Game1.gammgr.playerShip.position.Y > Game1.scrmgr.menuTopPosition + 0.175f &&
                                    Game1.gammgr.playerShip.position.Y < Game1.scrmgr.menuTopPosition + 0.225f)
                                {
                                    //0.9f
                                    currentSelection = 4;
                                }
                                else if (Game1.gammgr.playerShip.position.Y > Game1.scrmgr.menuTopPosition + 0.225f &&
                                    Game1.gammgr.playerShip.position.Y < Game1.scrmgr.menuTopPosition + 0.275f)
                                {
                                    //0.9f
                                    currentSelection = 5;
                                }
                                else
                                {
                                    currentSelection = -1;
                                }
                            }
                            #endregion
                        }

                        #region LMB Stuff
                        switch (currentSelection)
                        {
                            case -1:
                                showLMB = false;
                                break;
                            case 0:
                                if (onSubMenu == subMenu.OptionsMenu)
                                {
                                    showLMB = true;
                                    LMBisSelect = false;
                                }
                                else
                                {
                                    showLMB = true;
                                    LMBisSelect = true;
                                }
                                break;
                            case 1:
                            if (onSubMenu == subMenu.OptionsMenu)
                            {
                                showLMB = true;
                                LMBisSelect = false;
                            }
                            else
                            {
                                showLMB = true;
                                LMBisSelect = true;
                            }
                                break;
                            case 2:
                            if (onSubMenu == subMenu.OptionsMenu)
                            {
                                showLMB = false;
                            }
                            else
                            {
                                showLMB = true;
                                LMBisSelect = true;
                            }
                                break;
                            case 3:if (onSubMenu == subMenu.OptionsMenu)
                            {
                                showLMB = false;
                            }
                            else
                            {
                                showLMB = true;
                                LMBisSelect = true;
                            }
                                break;
                            case 4: if (onSubMenu == subMenu.OptionsMenu || onSubMenu == subMenu.PlayMenu)
                            {
                                showLMB = false;
                            }
                            else
                            {
                                showLMB = true;
                                LMBisSelect = true;
                            }
                                break;
                            case 5: if (onSubMenu == subMenu.OptionsMenu || onSubMenu == subMenu.PlayMenu || onSubMenu == subMenu.MainMenu)
                            {
                                showLMB = false;
                            }
                            else
                            {
                                showLMB = true;
                                LMBisSelect = true;
                            }
                                break;
                        }
                        #endregion

                        #region selection colors
                        for (int i = 0; i < menuColors.Count; i++)
                        {
                            if (i == (int)currentSelection)
                            {
                                menuSizes[i] += 0.05f;
                                if (menuSizes[i] > 1.25f)
                                    menuSizes[i] = 1.25f;
                                menuColors[i] = Color.White;
                            }
                            else
                            {
                                menuSizes[i] -= 0.05f;
                                if (menuSizes[i] < 1)
                                    menuSizes[i] = 1;
                                menuColors[i] = Color.SlateGray;
                            }
                        }
                        #endregion

                        if (Game1.inpmgr.playerOneKeyboard == false)
                        {
                            #region controlPadModification
                            if (onSubMenu == subMenu.OptionsMenu)
                            {
                                if (currentSelection == (int)optionsMenu.setResolution)
                                {
                                    resolutionString = "< " + ScreenManager.resolutions[(int)Game1.scrmgr.screenMode + tempResolutionMod, 0]
                                        + "x" + ScreenManager.resolutions[(int)Game1.scrmgr.screenMode + tempResolutionMod, 1] + " >";
                                    if (Game1.inpmgr.playerOneInput.leftStick.X > 0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if ((int)Game1.scrmgr.screenMode + tempResolutionMod == ScreenManager.resolutions.Length / 2 - 1)
                                        {
                                            tempResolutionMod = 0 - (int)Game1.scrmgr.screenMode;
                                        }
                                        else
                                        {
                                            tempResolutionMod++;
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X < -0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if ((int)Game1.scrmgr.screenMode + tempResolutionMod == 0)
                                        {
                                            tempResolutionMod = (ScreenManager.resolutions.Length / 2 - 1) - (int)Game1.scrmgr.screenMode;
                                        }
                                        else
                                        {
                                            tempResolutionMod--;
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X > -0.3f &&
                                        Game1.inpmgr.playerOneInput.leftStick.X < 0.3f && lrMoved)
                                    {
                                        lrMoved = false;
                                    }
                                }
                                else
                                {
                                    resolutionString = ScreenManager.resolutions[(int)Game1.scrmgr.screenMode + tempResolutionMod, 0]
                                        + "x" + ScreenManager.resolutions[(int)Game1.scrmgr.screenMode + tempResolutionMod, 1];
                                }

                                if (currentSelection == (int)optionsMenu.fullScreen)
                                {
                                    fullScreenString = "< " + Strings.FullScreen + " = " + fullscreen + " >";
                                    if (Game1.inpmgr.playerOneInput.leftStick.X > 0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (fullscreen)
                                            fullscreen = false;
                                        else
                                            fullscreen = true;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X < -0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (fullscreen)
                                            fullscreen = false;
                                        else
                                            fullscreen = true;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X > -0.3f &&
                                        Game1.inpmgr.playerOneInput.leftStick.X < 0.3f && lrMoved)
                                    {
                                        lrMoved = false;
                                    }
                                }
                                else
                                {
                                    fullscreen = Game1.scrmgr.isFullScreen;
                                    fullScreenString = Strings.FullScreen + " = " + fullscreen;
                                }

                                if (currentSelection == (int)optionsMenu.musicVolume)
                                {
                                    musVol = "< " + Strings.MusicVolume + " = " + (int)(Game1.musman.volume * 100) + " >";
                                    if (Game1.inpmgr.playerOneInput.leftStick.X > 0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (Game1.musman.volume < 1)
                                            Game1.musman.volume += 0.05m;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X < -0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (Game1.musman.volume > 0)
                                            Game1.musman.volume -= 0.05m;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X > -0.3f &&
                                        Game1.inpmgr.playerOneInput.leftStick.X < 0.3f && lrMoved)
                                    {
                                        lrMoved = false;
                                    }
                                }
                                else
                                {
                                    musVol = Strings.MusicVolume + " = " + (int)(Game1.musman.volume * 100);
                                }

                                if (currentSelection == (int)optionsMenu.sfxVolume)
                                {
                                    sfxVol = "< " + Strings.EffectsVolume + " = " + (int)(Game1.sndmgr.masterFXVolume * 100) + " >";
                                    if (Game1.inpmgr.playerOneInput.leftStick.X > 0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (Game1.sndmgr.masterFXVolume < 1)
                                            Game1.sndmgr.masterFXVolume += 0.05m;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X < -0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (Game1.sndmgr.masterFXVolume > 0)
                                            Game1.sndmgr.masterFXVolume -= 0.05m;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X > -0.3f &&
                                        Game1.inpmgr.playerOneInput.leftStick.X < 0.3f && lrMoved)
                                    {
                                        lrMoved = false;
                                    }
                                }
                                else
                                {
                                    sfxVol = Strings.EffectsVolume + " = " + (int)(Game1.sndmgr.masterFXVolume * 100);
                                }

                                if (currentSelection == (int)optionsMenu.numParticles)
                                {
                                    particleModString = "< " + Strings.ParticleMod + ": " + (int)(SettingsManager.settings.particleMod * 100) + "% >";
                                    if (Game1.inpmgr.playerOneInput.leftStick.X > 0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (SettingsManager.settings.particleMod > 0)
                                        {
                                            SettingsManager.settings.particleMod -= 0.05f;
                                            SettingsManager.SaveSettings();
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X < -0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (SettingsManager.settings.particleMod < 1)
                                        {
                                            SettingsManager.settings.particleMod += 0.05f;
                                            SettingsManager.SaveSettings();
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X > -0.3f &&
                                        Game1.inpmgr.playerOneInput.leftStick.X < 0.3f && lrMoved)
                                    {
                                        lrMoved = false;
                                    }
                                }
                                else
                                {
                                    particleModString = Strings.ParticleMod + ": " + (int)(SettingsManager.settings.particleMod * 100) + "%";
                                }

                                if (currentSelection == (int)optionsMenu.postProcess)
                                {
                                    string s = "";
                                    switch (SettingsManager.settings.postProcessQuality)
                                    {
                                        case 0:
                                            s = Strings.Off;
                                            break;
                                        case 1:
                                            s = Strings.Low;
                                            break;
                                        case 2:
                                            s = Strings.Mid;
                                            break;
                                        case 3:
                                            s = Strings.High;
                                            break;
                                        case 4:
                                            s = Strings.Ultra;
                                            break;
                                    }

                                    postProcessString = "< " + Strings.PostProcess + ": " + s + " >";
                                    if (Game1.inpmgr.playerOneInput.leftStick.X > 0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (SettingsManager.settings.postProcessQuality > 0)
                                        {
                                            SettingsManager.settings.postProcessQuality--;
                                            SettingsManager.SaveSettings();
                                            Game1.bloom.resetRenderTarget(SettingsManager.settings.postProcessQuality);
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X < -0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (SettingsManager.settings.postProcessQuality < 4)
                                        {
                                            SettingsManager.settings.postProcessQuality++;
                                            SettingsManager.SaveSettings();
                                            Game1.bloom.resetRenderTarget(SettingsManager.settings.postProcessQuality);
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X > -0.3f &&
                                        Game1.inpmgr.playerOneInput.leftStick.X < 0.3f && lrMoved)
                                    {
                                        lrMoved = false;
                                    }
                                }
                                else
                                {
                                    string s = "";
                                    switch (SettingsManager.settings.postProcessQuality)
                                    {
                                        case 0:
                                            s = Strings.Off;
                                            break;
                                        case 1:
                                            s = Strings.Low;
                                            break;
                                        case 2:
                                            s = Strings.Mid;
                                            break;
                                        case 3:
                                            s = Strings.High;
                                            break;
                                        case 4:
                                            s = Strings.Ultra;
                                            break;
                                    }

                                    postProcessString = Strings.PostProcess + ": " + s;
                                }
                            }

                            if (onSubMenu == subMenu.PlayMenu)
                            {
                                if (currentSelection == (int)playMenu.random)
                                {
                                    if (Game1.inpmgr.playerOneInput.leftStick.X > 0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;

                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if (randomLengthCount < 10)
                                            randomLengthCount++;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X < -0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;

                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if (randomLengthCount > 1)
                                            randomLengthCount--;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X > -0.3f &&
                                        Game1.inpmgr.playerOneInput.leftStick.X < 0.3f && lrMoved)
                                    {
                                        lrMoved = false;
                                    }
                                }
                                else if (currentSelection == (int)playMenu.single)
                                {
                                    if (Game1.inpmgr.playerOneInput.leftStick.X > 0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        singleLevelSelection++;
                                        if (singleLevelSelection == listOfLevels.Count)
                                        {
                                            singleLevelSelection = 0;
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X < -0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        singleLevelSelection--;
                                        if (singleLevelSelection < 0)
                                        {
                                            singleLevelSelection = listOfLevels.Count - 1;
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X > -0.3f &&
                                        Game1.inpmgr.playerOneInput.leftStick.X < 0.3f && lrMoved)
                                    {
                                        lrMoved = false;
                                    }
                                }

                            }
                            #endregion
                        }
                        else
                        {
                            #region mouseModification
                            if (onSubMenu == subMenu.OptionsMenu)
                            {
                                if (currentSelection == (int)optionsMenu.setResolution)
                                {
                                    resolutionString = "< " + ScreenManager.resolutions[(int)Game1.scrmgr.screenMode + tempResolutionMod, 0]
                                        + "x" + ScreenManager.resolutions[(int)Game1.scrmgr.screenMode + tempResolutionMod, 1] + " >";
                                    if (Game1.inpmgr.playerOneInput.mouseWheelState == 1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if ((int)Game1.scrmgr.screenMode + tempResolutionMod == ScreenManager.resolutions.Length / 2 - 1)
                                        {
                                            tempResolutionMod = 0 - (int)Game1.scrmgr.screenMode;
                                        }
                                        else
                                        {
                                            tempResolutionMod++;
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.mouseWheelState == -1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if ((int)Game1.scrmgr.screenMode + tempResolutionMod == 0)
                                        {
                                            tempResolutionMod = (ScreenManager.resolutions.Length / 2 - 1) - (int)Game1.scrmgr.screenMode;
                                        }
                                        else
                                        {
                                            tempResolutionMod--;
                                        }
                                    }
                                }
                                else
                                {
                                    resolutionString = ScreenManager.resolutions[(int)Game1.scrmgr.screenMode + tempResolutionMod, 0]
                                        + "x" + ScreenManager.resolutions[(int)Game1.scrmgr.screenMode + tempResolutionMod, 1];
                                }

                                if (currentSelection == (int)optionsMenu.fullScreen)
                                {
                                    fullScreenString = "< " + Strings.FullScreen + " = " + fullscreen + " >";
                                    if (Game1.inpmgr.playerOneInput.mouseWheelState == 1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if (fullscreen)
                                            fullscreen = false;
                                        else
                                            fullscreen = true;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.mouseWheelState == -1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if (fullscreen)
                                            fullscreen = false;
                                        else
                                            fullscreen = true;
                                    }
                                }
                                else
                                {
                                    fullscreen = Game1.scrmgr.isFullScreen;
                                    fullScreenString = Strings.FullScreen + " = " + fullscreen;
                                }

                                if (currentSelection == (int)optionsMenu.musicVolume)
                                {
                                    musVol = "< " + Strings.MusicVolume + " = " + (int)(Game1.musman.volume * 100) + " >";
                                    if (Game1.inpmgr.playerOneInput.mouseWheelState == 1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if (Game1.musman.volume < 1)
                                            Game1.musman.volume += 0.05m;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.mouseWheelState == -1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if (Game1.musman.volume > 0)
                                            Game1.musman.volume -= 0.05m;
                                    }
                                }
                                else
                                {
                                    musVol = Strings.MusicVolume + " = " + (int)(Game1.musman.volume * 100);
                                }

                                if (currentSelection == (int)optionsMenu.sfxVolume)
                                {
                                    sfxVol = "< " + Strings.EffectsVolume + " = " + (int)(Game1.sndmgr.masterFXVolume * 100) + " >";
                                    if (Game1.inpmgr.playerOneInput.mouseWheelState == 1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if (Game1.sndmgr.masterFXVolume < 1)
                                            Game1.sndmgr.masterFXVolume += 0.05m;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.mouseWheelState == -1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if (Game1.sndmgr.masterFXVolume > 0)
                                            Game1.sndmgr.masterFXVolume -= 0.05m;
                                    }
                                }
                                else
                                {
                                    sfxVol = Strings.EffectsVolume + " = " + (int)(Game1.sndmgr.masterFXVolume * 100);
                                }

                                if (currentSelection == (int)optionsMenu.numParticles)
                                {
                                    particleModString = "< " + Strings.ParticleMod + ": " + (int)(SettingsManager.settings.particleMod * 100) + "% >";
                                    if (Game1.inpmgr.playerOneInput.mouseWheelState == -1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if (SettingsManager.settings.particleMod > 0)
                                        {
                                            SettingsManager.settings.particleMod -= 0.1f;
                                            SettingsManager.SaveSettings();
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.mouseWheelState == 1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if (SettingsManager.settings.particleMod < 1)
                                        {
                                            SettingsManager.settings.particleMod += 0.1f;
                                            SettingsManager.SaveSettings();
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X > -0.3f &&
                                        Game1.inpmgr.playerOneInput.leftStick.X < 0.3f && lrMoved)
                                    {
                                        lrMoved = false;
                                    }
                                }
                                else
                                {
                                    particleModString = Strings.ParticleMod + ": " + (int)(SettingsManager.settings.particleMod * 100) + "%";
                                }

                                if (currentSelection == (int)optionsMenu.postProcess)
                                {
                                    string s = "";
                                    switch (SettingsManager.settings.postProcessQuality)
                                    {
                                        case 0:
                                            s = Strings.Off;
                                            break;
                                        case 1:
                                            s = Strings.Low;
                                            break;
                                        case 2:
                                            s = Strings.Mid;
                                            break;
                                        case 3:
                                            s = Strings.High;
                                            break;
                                        case 4:
                                            s = Strings.Ultra;
                                            break;
                                    }

                                    postProcessString = "< " + Strings.PostProcess + ": " + s + " >";

                                    if (Game1.inpmgr.playerOneInput.mouseWheelState == 1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);

                                        if (SettingsManager.settings.postProcessQuality < 4)
                                        {
                                            SettingsManager.settings.postProcessQuality++;
                                            SettingsManager.SaveSettings();
                                            Game1.bloom.resetRenderTarget(SettingsManager.settings.postProcessQuality);
                                        }
                                    }
                                    else
                                        if (Game1.inpmgr.playerOneInput.mouseWheelState == -1)
                                        {
                                            Game1.sndmgr.playSound(SFX.menuMove);

                                            if (SettingsManager.settings.postProcessQuality > 0)
                                            {
                                                SettingsManager.settings.postProcessQuality--;
                                                SettingsManager.SaveSettings();
                                                Game1.bloom.resetRenderTarget(SettingsManager.settings.postProcessQuality);
                                            }
                                        }
                                }
                                else
                                {
                                    string s = "";
                                    switch (SettingsManager.settings.postProcessQuality)
                                    {
                                        case 0:
                                            s = Strings.Off;
                                            break;
                                        case 1:
                                            s = Strings.Low;
                                            break;
                                        case 2:
                                            s = Strings.Mid;
                                            break;
                                        case 3:
                                            s = Strings.High;
                                            break;
                                        case 4:
                                            s = Strings.Ultra;
                                            break;
                                    }

                                    postProcessString = Strings.PostProcess + ": " + s;
                                }
                            }
                            else if (onSubMenu == subMenu.PlayMenu)
                            {
                                if (currentSelection == (int)playMenu.random)
                                {
                                    if (Game1.inpmgr.playerOneInput.mouseWheelState == 1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if (Game1.IS_DEMO)
                                        {
                                            if (randomLengthCount < 3)
                                                randomLengthCount++;
                                        }
                                        else
                                        {
                                            if (randomLengthCount < 10)
                                                randomLengthCount++;
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.mouseWheelState == -1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if (randomLengthCount > 1)
                                            randomLengthCount--;
                                    }
                                }
                                else if (currentSelection == (int)playMenu.single)
                                {
                                    if (Game1.inpmgr.playerOneInput.mouseWheelState == 1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        singleLevelSelection++;
                                        if (singleLevelSelection == listOfLevels.Count)
                                        {
                                            singleLevelSelection = 0;
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.mouseWheelState == -1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        singleLevelSelection--;
                                        if (singleLevelSelection < 0)
                                        {
                                            singleLevelSelection = listOfLevels.Count - 1;
                                        }
                                    }
                                }
                                else if (currentSelection == (int)playMenu.sequence && !Game1.IS_DEMO)
                                {
                                    if (Game1.inpmgr.playerOneInput.mouseWheelState == 1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        sequenceSelection++;
                                        if (sequenceSelection == listOfSequences.Count)
                                        {
                                            sequenceSelection = 0;
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.mouseWheelState == -1)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        sequenceSelection--;
                                        if (sequenceSelection < 0)
                                        {
                                            sequenceSelection = listOfSequences.Count - 1;
                                        }
                                    }
                                }
                            }
                            #endregion
                        }

                        #region Selection and Back
                        if (Game1.inpmgr.playerOneInput.Start == expButtonState.Pressed ||
                        Game1.inpmgr.playerOneInput.A == expButtonState.Pressed && menusActive)
                        {
                            bool playSound = false;

                            switch (onSubMenu)
                            {
                                case subMenu.MainMenu:
                                    switch ((mainMenu)currentSelection)
                                    {
                                        case mainMenu.startGame:
                                            onSubMenu = subMenu.PlayMenu;
                                            currentSelection = 0;
                                            playSound = true;
                                            break;
                                        case mainMenu.shopMenu:

                                            Game1.scrmgr.changeScreen(new Screens.ShopScreen(new Screens.MainMenuScreen(true), false));
                                            playSound = true;
                                            break;
                                        case mainMenu.optionsMenu:
                                            onSubMenu = subMenu.OptionsMenu;
                                            currentSelection = 0;
                                            playSound = true;
                                            break;
                                        case mainMenu.login:
                                            finishedOnScreen = true;
                                            Game1.scrmgr.changeScreen(new Screens.Credits());
                                            playSound = true;
                                           /* finishedOnScreen = true;
                                            Game1.scrmgr.changeScreen(new Screens.LoginScreen());
                                            playSound = true;*/
                                            break;
                                        case mainMenu.credits:
                                            break;
                                        case mainMenu.awardsMenu:
                                            finishedOnScreen = true;
                                            Game1.scrmgr.changeScreen(new Screens.AwardsStatsScreen());
                                            playSound = true;
                                            break;
                                    }
                                    break;
                                case subMenu.OptionsMenu:
                                    switch ((optionsMenu)currentSelection)
                                    {
                                        case optionsMenu.setResolution:
                                            Game1.scrmgr.changeResolution((ScreenMode)Game1.scrmgr.screenMode + tempResolutionMod, fullscreen);
                                            Game1.bloom.LC();
                                            tempResolutionMod = 0;
                                            playSound = true;
                                            SettingsManager.settings.resolution = (int)Game1.scrmgr.screenMode;
                                            SettingsManager.SaveSettings();
                                            break;
                                        case optionsMenu.fullScreen:
                                            Game1.scrmgr.changeResolution(Game1.scrmgr.screenMode, fullscreen);
                                            Game1.bloom.LC();
                                            playSound = true;
                                            SettingsManager.settings.fullScreen = fullscreen;
                                            SettingsManager.SaveSettings();
                                            break;
                                    }
                                    break;
                                case subMenu.PlayMenu:
                                    Game1.gammgr.numBuffs = Game1.gammgr.saveGameData.totalPlayerBuffs;
                                    switch ((playMenu)currentSelection)
                                    {
                                        case playMenu.original:
                                            finishedOnScreen = true;
                                            playSound = true;
                                            if (Game1.gammgr.saveGameData.skipTutorial)
                                            {
                                                Screens.Levels.LevelManager.GenerateOriginalLevelSequence();
                                                Game1.scrmgr.changeScreen(new Screens.Levels.LevelManLevel(Game1.gammgr.levelSequence[Game1.gammgr.currentLevelInSequence]));
                                            }
                                            else
                                            {
                                                Game1.scrmgr.changeScreen(new Screens.Levels.TutorialLevel());
                                            }
                                            break;
                                        case playMenu.random:
                                            finishedOnScreen = true;
                                            playSound = true;
                                            Levels.LevelManager.GanerateRandomLevelSet(randomLengthCount);

                                            Game1.gammgr.currentLevelInSequence = 0;
                                            Game1.scrmgr.changeScreen(new Screens.Levels.LevelManLevel(Game1.gammgr.levelSequence[Game1.gammgr.currentLevelInSequence]));
                                            break;
                                        case playMenu.single:
                                            finishedOnScreen = true;
                                            playSound = true;
                                            Game1.gammgr.levelSequence.Clear();
                                            Game1.gammgr.levelSequence.Add(listOfLevels[singleLevelSelection]);

                                            Game1.gammgr.currentLevelInSequence = 0;
                                            Game1.scrmgr.changeScreen(new Screens.Levels.LevelManLevel(Game1.gammgr.levelSequence[Game1.gammgr.currentLevelInSequence]));
                                            break;
                                        case playMenu.sequence:
                                            if (!Game1.IS_DEMO)
                                            {
                                                if (Levels.LevelManager.LoadLevelLists(listOfSequences[sequenceSelection]))
                                                {
                                                    finishedOnScreen = true;
                                                    playSound = true;

                                                    Game1.gammgr.currentLevelInSequence = 0;
                                                    Game1.scrmgr.changeScreen(new Screens.Levels.LevelManLevel(Game1.gammgr.levelSequence[Game1.gammgr.currentLevelInSequence]));
                                                }
                                            }
                                            break;
                                    }
                                    break;
                            }

                            if (playSound)
                            {
                                Game1.sndmgr.playSound(SFX.menuSelect);
                            }
                        }
                        else if (Game1.inpmgr.playerOneInput.B == expButtonState.Pressed && menusActive)
                        {
                            switch (onSubMenu)
                            {
                                case subMenu.MainMenu:
                                    onExitFrame = true;
                                    break;
                                case subMenu.OptionsMenu:
                                    onSubMenu = subMenu.MainMenu;
                                    break;
                                case subMenu.PlayMenu:
                                    onSubMenu = subMenu.MainMenu;
                                    break;
                            }
                        }
                        #endregion
                    }
                }
            }
            else
            {
                throw new Exception("Screen Not Loaded");
            }
        }
Exemplo n.º 10
0
        public override void Update(GameTime gameTime)
        {
            //Main Menu Input stuff;
            if (loaded)
            {
                Game1.gammgr.playerShip.visible = false;

                musVol = Strings.MusicVolume + " = " + (int)(Game1.musman.volume * 100);
                sfxVol = Strings.EffectsVolume + " = " + (int)(Game1.sndmgr.masterFXVolume * 100) ;
                cursorSpeed = Strings.CursorSpeed + " = " + (int)(SettingsManager.settings.stickMod * 100);

                background.Update();
                counter += gameTime.ElapsedGameTime.Milliseconds;
                if (playmusic)
                {
                    playmusic = false;
                    Game1.musman.PlayNewSong("Hallucinoshapes");
                }
                if (!playmusic && onControllerGrab)
                {
                    if (Game1.inpmgr.checkInitalInput())
                    {

                        Game1.inpmgr.playerOneInput.Start = expButtonState.Held;

                        Game1.gammgr.playerShip.visible = true;

                        onControllerGrab = false;
                    }
                }

                else if (!onControllerGrab)
                {

                    if (Game1.inpmgr.playerOneInput.A == expButtonState.notPressed &&
                        Game1.inpmgr.playerOneInput.Start == expButtonState.notPressed)
                    {
                        menusActive = true;
                    }

                    if (!finishedOnScreen)
                    {
                        if (Game1.inpmgr.playerOneKeyboard == false)
                        {
                            #region joystickSelection

                            if (Game1.inpmgr.playerOneInput.leftStick.Y > 0.3f && !moved)
                            {
                                moved = true;
                                menuSizes[(int)currentSelection] = 1;

                                Game1.sndmgr.playSound(SFX.menuMove);

                                switch (onSubMenu)
                                {
                                    case subMenu.MainMenu:
                                        if (currentSelection == (int)mainMenu.credits)
                                        {
                                            currentSelection = (int)mainMenu.startGame;
                                        }
                                        else
                                        {
                                            currentSelection++;
                                        }
                                        break;
                                    case subMenu.PlayMenu:
                                        if (currentSelection == (int)playMenu.single)
                                        {
                                            currentSelection = (int)playMenu.original;
                                        }
                                        else
                                        {
                                            currentSelection++;
                                        }
                                        break;
                                    case subMenu.OptionsMenu:
                                        if (currentSelection == (int)optionsMenu.cursorSpeed)
                                        {
                                            currentSelection = (int)optionsMenu.sfxVolume;
                                        }
                                        else
                                        {
                                            currentSelection++;
                                        }
                                        break;
                                }

                            }
                            else if (Game1.inpmgr.playerOneInput.leftStick.Y < -0.3f && !moved)
                            {
                                moved = true;
                                menuSizes[(int)currentSelection] = 1;

                                Game1.sndmgr.playSound(SFX.menuMove);

                                switch (onSubMenu)
                                {
                                    case subMenu.MainMenu:
                                        if (currentSelection == (int)mainMenu.startGame)
                                        {
                                            currentSelection = (int)mainMenu.credits;
                                        }
                                        else
                                        {
                                            currentSelection--;
                                        }
                                        break;
                                    case subMenu.PlayMenu:
                                        if (currentSelection == (int)playMenu.original)
                                        {
                                            currentSelection = (int)playMenu.single;
                                        }
                                        else
                                        {
                                            currentSelection--;
                                        }
                                        break;
                                    case subMenu.OptionsMenu:
                                        if (currentSelection == (int)optionsMenu.sfxVolume)
                                        {
                                            currentSelection = (int)optionsMenu.cursorSpeed;
                                        }
                                        else
                                        {
                                            currentSelection--;
                                        }
                                        break;
                                }
                            }
                            else if (Game1.inpmgr.playerOneInput.leftStick.Y > -0.3f &&
                                Game1.inpmgr.playerOneInput.leftStick.Y < 0.3f && moved)
                            {
                                moved = false;
                            }

                            #endregion
                        }
                        #region selection colors
                        for (int i = 0; i < menuColors.Count; i++)
                        {
                            if (i == (int)currentSelection)
                            {
                                menuSizes[i] = 1 + (float)(Math.Sin(counter / 200) / 10);
                                menuColors[i] = Color.White;
                            }
                            else
                            {
                                menuSizes[i] = 1;
                                menuColors[i] = Color.SlateGray;
                            }
                        }
                        #endregion

                        if (Game1.inpmgr.playerOneKeyboard == false)
                        {
                            #region controlPadModification
                            if (onSubMenu == subMenu.OptionsMenu)
                            {
                                if (currentSelection == (int)optionsMenu.musicVolume)
                                {
                                    musVol = "< " + Strings.MusicVolume + " = " + (int)(Game1.musman.volume * 100) + " >";
                                    if (Game1.inpmgr.playerOneInput.leftStick.X > 0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (Game1.musman.volume < 1)
                                            Game1.musman.volume += 0.05m;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X < -0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (Game1.musman.volume > 0)
                                            Game1.musman.volume -= 0.05m;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X > -0.3f &&
                                        Game1.inpmgr.playerOneInput.leftStick.X < 0.3f && lrMoved)
                                    {
                                        lrMoved = false;
                                    }
                                }
                                else
                                {
                                    musVol = Strings.MusicVolume + " = " + (int)(Game1.musman.volume * 100);
                                }

                                if (currentSelection == (int)optionsMenu.sfxVolume)
                                {
                                    sfxVol = "< " + Strings.EffectsVolume + " = " + (int)(Game1.sndmgr.masterFXVolume * 100) + " >";
                                    if (Game1.inpmgr.playerOneInput.leftStick.X > 0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (Game1.sndmgr.masterFXVolume < 1)
                                            Game1.sndmgr.masterFXVolume += 0.05m;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X < -0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (Game1.sndmgr.masterFXVolume > 0)
                                            Game1.sndmgr.masterFXVolume -= 0.05m;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X > -0.3f &&
                                        Game1.inpmgr.playerOneInput.leftStick.X < 0.3f && lrMoved)
                                    {
                                        lrMoved = false;
                                    }
                                }
                                else
                                {
                                    sfxVol = Strings.EffectsVolume + " = " + (int)(Game1.sndmgr.masterFXVolume * 100);
                                }

                                if (currentSelection == (int)optionsMenu.cursorSpeed)
                                {
                                    cursorSpeed = "<" + Strings.CursorSpeed + " = " + (int)(SettingsManager.settings.stickMod * 100) + ">";

                                    if (Game1.inpmgr.playerOneInput.leftStick.X > 0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (SettingsManager.settings.stickMod < 1)
                                            SettingsManager.settings.stickMod += 0.05f;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X < -0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        if (SettingsManager.settings.stickMod > 0.1)
                                            SettingsManager.settings.stickMod -= 0.05f;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X > -0.3f &&
                                        Game1.inpmgr.playerOneInput.leftStick.X < 0.3f && lrMoved)
                                    {
                                        lrMoved = false;
                                    }
                                }
                                else
                                {
                                    cursorSpeed = Strings.CursorSpeed + " = " + (int)(SettingsManager.settings.stickMod * 100);
                                }
                            }

                            if (onSubMenu == subMenu.PlayMenu)
                            {
                                if (currentSelection == (int)playMenu.random)
                                {
                                    if (Game1.inpmgr.playerOneInput.leftStick.X > 0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;

                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if (randomLengthCount < 10)
                                            randomLengthCount++;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X < -0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;

                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        if (randomLengthCount > 1)
                                            randomLengthCount--;
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X > -0.3f &&
                                        Game1.inpmgr.playerOneInput.leftStick.X < 0.3f && lrMoved)
                                    {
                                        lrMoved = false;
                                    }
                                }
                                else if (currentSelection == (int)playMenu.single)
                                {
                                    if (Game1.inpmgr.playerOneInput.leftStick.X > 0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        singleLevelSelection++;
                                        if (singleLevelSelection == listOfLevels.Count)
                                        {
                                            singleLevelSelection = 0;
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X < -0.3f && !lrMoved)
                                    {
                                        Game1.sndmgr.playSound(SFX.menuMove);
                                        lrMoved = true;
                                        singleLevelSelection--;
                                        if (singleLevelSelection < 0)
                                        {
                                            singleLevelSelection = listOfLevels.Count - 1;
                                        }
                                    }
                                    else if (Game1.inpmgr.playerOneInput.leftStick.X > -0.3f &&
                                        Game1.inpmgr.playerOneInput.leftStick.X < 0.3f && lrMoved)
                                    {
                                        lrMoved = false;
                                    }
                                }

                            }
                            #endregion
                        }

                        #region Selection and Back
                        if (Game1.inpmgr.playerOneInput.Start == expButtonState.Pressed ||
                        Game1.inpmgr.playerOneInput.A == expButtonState.Pressed && menusActive)
                        {
                            bool playSound = false;
                            switch (onSubMenu)
                            {
                                case subMenu.MainMenu:
                                    switch ((mainMenu)currentSelection)
                                    {
                                        case mainMenu.startGame:
                                            onSubMenu = subMenu.PlayMenu;
                                            currentSelection = 0;
                                            playSound = true;
                                            break;
                                        case mainMenu.shopMenu:
                                            Game1.scrmgr.changeScreen(new Screens.ShopScreen(new Screens.XBMainMenuScreen(true), false));
                                            playSound = true;
                                            break;
                                        case mainMenu.optionsMenu:
                                            onSubMenu = subMenu.OptionsMenu;
                                            currentSelection = 0;
                                            playSound = true;
                                            break;
                                        case mainMenu.awardsMenu:
                                            finishedOnScreen = true;
                                            Game1.scrmgr.changeScreen(new Screens.AwardsStatsScreen());
                                            playSound = true;
                                            break;
                                        case mainMenu.credits:
                                            finishedOnScreen = true;
                                            Game1.scrmgr.changeScreen(new Screens.Credits());
                                            playSound = true;
                                            break;
                                    }
                                    break;
                                case subMenu.PlayMenu:
                                    Game1.gammgr.numBuffs = Game1.gammgr.saveGameData.totalPlayerBuffs;
                                    switch ((playMenu)currentSelection)
                                    {
                                        case playMenu.original:
                                            finishedOnScreen = true;
                                            playSound = true;
                                            if (Game1.gammgr.saveGameData.skipTutorial)
                                            {
                                                Screens.Levels.LevelManager.GenerateOriginalLevelSequence();
                                                Game1.scrmgr.changeScreen(new Screens.Levels.LevelManLevel(Game1.gammgr.levelSequence[Game1.gammgr.currentLevelInSequence]));
                                            }
                                            else
                                            {
                                                Game1.scrmgr.changeScreen(new Screens.Levels.TutorialLevel());
                                            }
                                            break;
                                        case playMenu.random:
                                            finishedOnScreen = true;
                                            playSound = true;
                                            Levels.LevelManager.GanerateRandomLevelSet(randomLengthCount);

                                            Game1.gammgr.currentLevelInSequence = 0;
                                            Game1.scrmgr.changeScreen(new Screens.Levels.LevelManLevel(Game1.gammgr.levelSequence[Game1.gammgr.currentLevelInSequence]));
                                            break;
                                        case playMenu.single:
                                            finishedOnScreen = true;
                                            playSound = true;
                                            Game1.gammgr.levelSequence.Clear();
                                            Game1.gammgr.levelSequence.Add(listOfLevels[singleLevelSelection]);

                                            Game1.gammgr.currentLevelInSequence = 0;
                                            Game1.scrmgr.changeScreen(new Screens.Levels.LevelManLevel(Game1.gammgr.levelSequence[Game1.gammgr.currentLevelInSequence]));
                                            break;
                                        case playMenu.sequence:
                                            if (Levels.LevelManager.LoadLevelLists(listOfSequences[sequenceSelection]))
                                            {
                                            finishedOnScreen = true;
                                            playSound = true;

                                            Game1.gammgr.currentLevelInSequence = 0;
                                            Game1.scrmgr.changeScreen(new Screens.Levels.LevelManLevel(Game1.gammgr.levelSequence[Game1.gammgr.currentLevelInSequence]));
                                            }
                                            break;
                                    }
                                    break;
                            }

                            if (playSound)
                            {
                                Game1.sndmgr.playSound(SFX.menuSelect);
                            }
                        }
                        else if (Game1.inpmgr.playerOneInput.B == expButtonState.Pressed && menusActive)
                        {
                            switch (onSubMenu)
                            {
                                case subMenu.MainMenu:
                                    Game1.plzExit = true;
                                    break;
                                case subMenu.OptionsMenu:
                                    onSubMenu = subMenu.MainMenu;
                                    break;
                                case subMenu.PlayMenu:
                                    onSubMenu = subMenu.MainMenu;
                                    break;
                            }
                        }
                        #endregion
                    }
                }
            }
            else
            {
                throw new Exception("Screen Not Loaded");
            }
        }
Exemplo n.º 11
0
    private void DrawPonySkillWindow()
    {
        int anchorX = Screen.width / 2 - 300;
        int anchorY = 100;

        // pony name at top!
        GUI.Box(new Rect(anchorX, anchorY - 40, 600, 30), "");
        DrawSkillCell(anchorX, anchorY - 40, _selectedPony, SaveFile.Active.skillpointsAvailable(_selectedPony).ToString(), false);

        // calc cap
        int cap = Screen.height;

        cap -= anchorY + 30 + 60 + 30;         // top padding, header, bot padding, bot button
        cap /= 40;

        // get available skills
        for (int i = 0; i + _zeroIndex < _skills.Length && i < cap; i++)
        {
            string skill      = _skills[i + _zeroIndex];
            string preformat  = "";
            string postformat = "";
            if (skill == _selectedSkill)
            {
                preformat += "<b>"; postformat += "</b>";
            }
            if (_learnedSkills.Contains(skill))
            {
                preformat += "<color=#ffa500ff>"; postformat = "</color>" + postformat;
            }
            if (GUI.Button(new Rect(anchorX + 410, anchorY + 40 * (i), 190, 30), preformat + skill + postformat))
            {
                //Debug.Log(_skills[i+_zeroIndex]);
                _selectedSkill    = skill;
                _skillDescription = oldSkillDB.GetDescription(skill);
            }
        }

        // show skill description
        GUI.Box(new Rect(anchorX, anchorY, 400, cap * 40 + 50), "");
        GUI.Box(new Rect(anchorX + 5, anchorY + 5, 390, cap * 40 + 40), string.Format(_skillDescription, _selectedPony), StyleDB.Instance.white);

        // Learn button!
        if (_selectedSkill.Length > 0)
        {
            bool   canlearn = SaveFile.Active.skillpointsAvailable(_selectedPony) > 0;
            string msg      = "Need 1 Skillpoint to Learn.";
            if (canlearn)
            {
                msg = "Learn";
            }
            if (_learnedSkills.Contains(_selectedSkill))
            {
                msg      = "Already Known";
                canlearn = false;
            }
            if (GUI.Button(new Rect(anchorX + 100, cap * 40 + 80, 200, 39), msg))
            {
                if (canlearn)
                {
                    _learnedSkills.Add(_selectedSkill);
                }
            }
        }

        // scrollbar if needed
        if (cap < _skills.Length)
        {
            // show scroll buttons
            if (GUI.Button(new Rect(anchorX + 630, anchorY, 30, 60), "^"))
            {
                _zeroIndex--;
            }
            if (GUI.Button(new Rect(anchorX + 630, anchorY + cap * 40 - 70, 30, 60), "v"))
            {
                _zeroIndex++;
            }
            // constrain so we wont go OOB
            if (_zeroIndex < 0)
            {
                _zeroIndex = 0;
            }
            if (_zeroIndex + cap > _skills.Length)
            {
                _zeroIndex--;
            }
        }

        // cancel button in the bottom.
        if (GUI.Button(new Rect(Screen.height / 2 - 100, Screen.height - 60, 200, 30), "Back"))
        {
            _sub       = subMenu.SkillOverview;
            _zeroIndex = 0;
        }
    }
Exemplo n.º 12
0
    private void DrawSkillOverview()
    {
        int rootX = Screen.width / 2 - 300;
        int rootY = 60;

        // calc capacity
        int cap = Screen.height;

        cap -= rootY + 30 + 60 + 30;         // top padding, header, bot padding, bot button
        cap /= 40;

        // boundingBox
        GUI.Box(new Rect(rootX - 5, rootY, 610, cap * 40 + 50), "");

        // heading
        //DrawRoosterCell(rootX, rootY, "Name", "Lvl.", "HP", "Atk.", "Def.", "Res.", "???", false);
        DrawSkillCell(rootX, rootY, "  Pony", "Available Skillpoints", false);

        // list with character
        SaveFile sv = SaveFile.Active;

        rootY += 30;
        SaveFile.Active.UpdateUnit(_rooster);
        for (int i = 0; i + _zeroIndex < _rooster.Count && i < cap; i++)
        {
            string name = _rooster[i + _zeroIndex].name;
            if (DrawSkillCell(rootX, rootY + 40 * (i), name, "    " + sv.skillpointsAvailable(name).ToString()))
            {
                _selectedPony     = name;
                _sub              = subMenu.ViewPonySkills;
                _skills           = oldSkillDB.GetSkills(name);
                _zeroIndex        = 0;
                _skillDescription = "select ability for details";
                _learnedSkills    = new List <string>(SaveFile.Active.GetAbilities(name));
                break;
            }
        }
        // scrollbar if needed
        if (cap < _rooster.Count)
        {
            // show scroll buttons
            if (GUI.Button(new Rect(rootX + 630, rootY, 30, 60), "^"))
            {
                _zeroIndex--;
            }
            if (GUI.Button(new Rect(rootX + 630, rootY + cap * 40 - 70, 30, 60), "v"))
            {
                _zeroIndex++;
            }
            // constrain so we wont go OOB
            if (_zeroIndex < 0)
            {
                _zeroIndex = 0;
            }
            if (_zeroIndex + cap > _rooster.Count)
            {
                _zeroIndex--;
            }
        }

        // cancel button in the bottom.
        if (GUI.Button(new Rect(Screen.height / 2 - 100, Screen.height - 60, 200, 30), "Back"))
        {
            _sub           = subMenu.Root;
            _selectedSkill = "";
        }
    }