Пример #1
0
        public override void OnEnter()
        {
            var flag = true;

            foreach (var current in SkillSystem.SkillArray)
            {
                if (current.CurrentLevel < 1)
                {
                    flag = false;
                    break;
                }
            }
            if (flag)
            {
                GameUtil.UnlockAchievement("FEAR_OF_DECISIONS");
            }
            if (Game.PlayerStats.CurrentLevel >= 50)
            {
                GameUtil.UnlockAchievement("FEAR_OF_WEALTH");
            }
            m_lockControls = false;
            m_manor.GetChildAt(23).Visible = true;
            m_manor.GetChildAt(23).Opacity = 1f;
            Camera.Position = new Vector2(660f, 360f);
            var skillArray = SkillSystem.GetSkillArray();

            for (var i = 0; i < skillArray.Length; i++)
            {
                if (skillArray[i].CurrentLevel > 0)
                {
                    SetVisible(skillArray[i], false);
                }
            }
            if (!SoundManager.IsMusicPlaying)
            {
                SoundManager.PlayMusic("SkillTreeSong", true, 1f);
            }
            var skill = SkillSystem.GetSkill((int)m_selectedTraitIndex.X, (int)m_selectedTraitIndex.Y);

            m_selectionIcon.Position = SkillSystem.GetSkillPosition(skill);
            UpdateDescriptionPlate(skill);
            m_dialoguePlate.Visible = true;
            m_confirmText.Text      = "[Input:" + 0 + "] to purchase/upgrade skill";
            m_toggleIconsText.Text  = "[Input:" + 9 + "] to toggle icons off";
            m_continueText.Text     = "[Input:" + 2 + "] to exit the manor";
            if (InputManager.GamePadIsConnected(PlayerIndex.One))
            {
                m_navigationText.Text = "[Button:LeftStick] to navigate skills";
            }
            else
            {
                m_navigationText.Text = "Arrow keys to navigate skills";
            }
            SkillSystem.UpdateAllTraitSprites();
            base.OnEnter();
        }
Пример #2
0
 public override void HandleInput()
 {
     if (!m_cameraTweening && !m_lockControls)
     {
         var flag = false;
         if (Game.GlobalInput.JustPressed(9))
         {
             if (SkillSystem.IconsVisible)
             {
                 m_toggleIconsText.Text   = "[Input:" + 9 + "] to toggle icons on";
                 m_confirmText.Visible    = false;
                 m_continueText.Visible   = false;
                 m_navigationText.Visible = false;
                 SkillSystem.HideAllIcons();
                 m_selectionIcon.Opacity      = 0f;
                 m_dialoguePlate.Opacity      = 0f;
                 m_descriptionDivider.Opacity = 0f;
                 m_coinIcon.Opacity           = 0f;
                 m_playerMoney.Opacity        = 0f;
                 m_titleText.Opacity          = 0f;
             }
             else
             {
                 m_toggleIconsText.Text   = "[Input:" + 9 + "] to toggle icons off";
                 m_confirmText.Visible    = true;
                 m_continueText.Visible   = true;
                 m_navigationText.Visible = true;
                 SkillSystem.ShowAllIcons();
                 m_selectionIcon.Opacity      = 1f;
                 m_dialoguePlate.Opacity      = 1f;
                 m_descriptionDivider.Opacity = 1f;
                 m_coinIcon.Opacity           = 1f;
                 m_playerMoney.Opacity        = 1f;
                 m_titleText.Opacity          = 1f;
             }
             flag = true;
         }
         if (SkillSystem.IconsVisible)
         {
             var selectedTraitIndex = m_selectedTraitIndex;
             var vector             = new Vector2(-1f, -1f);
             if (Game.GlobalInput.JustPressed(16) || Game.GlobalInput.JustPressed(17))
             {
                 vector =
                     SkillSystem.GetSkillLink((int)m_selectedTraitIndex.X, (int)m_selectedTraitIndex.Y).TopLink;
                 var skill = SkillSystem.GetSkill(SkillType.SuperSecret);
                 if (!m_cameraTweening && skill.Visible && vector == new Vector2(7f, 1f))
                 {
                     m_cameraTweening = true;
                     Tween.To(Camera, 0.5f, Quad.EaseOut, "Y", 60f.ToString());
                     Tween.AddEndHandlerToLastTween(this, "EndCameraTween");
                 }
             }
             else if (Game.GlobalInput.JustPressed(18) || Game.GlobalInput.JustPressed(19))
             {
                 vector =
                     SkillSystem.GetSkillLink((int)m_selectedTraitIndex.X, (int)m_selectedTraitIndex.Y)
                     .BottomLink;
             }
             if (Game.GlobalInput.JustPressed(20) || Game.GlobalInput.JustPressed(21))
             {
                 vector =
                     SkillSystem.GetSkillLink((int)m_selectedTraitIndex.X, (int)m_selectedTraitIndex.Y)
                     .LeftLink;
             }
             else if (Game.GlobalInput.JustPressed(22) || Game.GlobalInput.JustPressed(23))
             {
                 vector =
                     SkillSystem.GetSkillLink((int)m_selectedTraitIndex.X, (int)m_selectedTraitIndex.Y)
                     .RightLink;
             }
             if (vector.X != -1f && vector.Y != -1f)
             {
                 var skill2 = SkillSystem.GetSkill((int)vector.X, (int)vector.Y);
                 if (skill2.TraitType != SkillType.Null && skill2.Visible)
                 {
                     m_selectedTraitIndex = vector;
                 }
             }
             if (selectedTraitIndex != m_selectedTraitIndex)
             {
                 var skill3 = SkillSystem.GetSkill((int)m_selectedTraitIndex.X,
                                                   (int)m_selectedTraitIndex.Y);
                 m_selectionIcon.Position = SkillSystem.GetSkillPosition(skill3);
                 UpdateDescriptionPlate(skill3);
                 SoundManager.PlaySound("ShopMenuMove");
                 skill3.Scale = new Vector2(1.1f, 1.1f);
                 Tween.To(skill3, 0.1f, Back.EaseOutLarge, "ScaleX", "1", "ScaleY", "1");
                 m_dialoguePlate.Visible = true;
             }
             var skill4 = SkillSystem.GetSkill((int)m_selectedTraitIndex.X, (int)m_selectedTraitIndex.Y);
             if ((Game.GlobalInput.JustPressed(0) || Game.GlobalInput.JustPressed(1)) &&
                 Game.PlayerStats.Gold >= skill4.TotalCost && skill4.CurrentLevel < skill4.MaxLevel)
             {
                 SoundManager.PlaySound("TraitUpgrade");
                 if (!m_fadingIn)
                 {
                     Game.PlayerStats.Gold -= skill4.TotalCost;
                     SetVisible(skill4, true);
                     SkillSystem.LevelUpTrait(skill4, true);
                     if (skill4.CurrentLevel >= skill4.MaxLevel)
                     {
                         SoundManager.PlaySound("TraitMaxxed");
                     }
                     UpdateDescriptionPlate(skill4);
                 }
             }
             else if ((Game.GlobalInput.JustPressed(0) || Game.GlobalInput.JustPressed(1)) &&
                      Game.PlayerStats.Gold < skill4.TotalCost)
             {
                 SoundManager.PlaySound("TraitPurchaseFail");
             }
             if (Game.GlobalInput.JustPressed(2) || (Game.GlobalInput.JustPressed(3) && !flag))
             {
                 m_lockControls = true;
                 var rCScreenManager = ScreenManager as RCScreenManager;
                 var levelScreen     = rCScreenManager.GetLevelScreen();
                 levelScreen.Reset();
                 if (levelScreen.CurrentRoom is StartingRoomObj)
                 {
                     rCScreenManager.StartWipeTransition();
                     Tween.RunFunction(0.2f, rCScreenManager, "HideCurrentScreen");
                     Tween.RunFunction(0.2f, levelScreen.CurrentRoom, "OnEnter");
                 }
                 else
                 {
                     (ScreenManager as RCScreenManager).DisplayScreen(15, true);
                 }
             }
             if (!LevelEV.RUN_DEMO_VERSION && !LevelEV.CREATE_RETAIL_VERSION &&
                 InputManager.JustPressed(Keys.Q, PlayerIndex.One))
             {
                 foreach (var current in SkillSystem.SkillArray)
                 {
                     if (current.CurrentLevel < current.MaxLevel)
                     {
                         SetVisible(current, false);
                         SkillSystem.LevelUpTrait(current, false);
                         CheckForSkillUnlock(current, false);
                     }
                 }
             }
         }
         base.HandleInput();
     }
 }