示例#1
0
        private void UpgradeStat(UIMouseEvent evt, UIElement listeningElement, Stat stat, int amount)
        {
            if (!visible)
            {
                return;
            }
            Main.PlaySound(SoundID.MenuOpen);
            if (Main.keyState.PressingShift())
            {
                if ((Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl)))
                {
                    while (Char.FreePtns > 0)
                    {
                        Char.SpendPoints(stat, Char.GetStatXPMax(stat) - Char.GetStatXP(stat));
                    }
                    return;
                }

                for (int i = 0; i < amount; i++)
                {
                    Char.SpendPoints(stat, Char.GetStatXPMax(stat) - Char.GetStatXP(stat));
                }
                return;
            }
            Char.SpendPoints(stat, amount);
        }
示例#2
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            RPGPlayer player   = Main.player[Main.myPlayer].GetModPlayer <RPGPlayer>();
            float     quotient = 1f;

            //Calculate quotient


            quotient = (float)player.GetStatXP(stat) / (float)player.GetStatXPMax(stat);

            this.Width.Set(quotient * width, 0f);
            //Left.Set((1 - quotient) * width, 0);
            Recalculate(); // recalculate the position and size

            base.Draw(spriteBatch);
        }