Exemplo n.º 1
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     this.Strength.Text      = user.Strength.ToString();
     this.Defence.Text       = user.Defence.ToString();
     this.Agility.Text       = user.Agility.ToString();
     this.Stamina.Text       = user.Stamina.ToString();
     this.Charisma.Text      = user.Charisma.ToString();
     this.NextStatPrice.Text = GoldController.CalculateNextStatLevelPrice(this.user).ToString();
     this.Gold.Text          = user.Gold.ToString();
 }
Exemplo n.º 2
0
        public void UpdateStat(object sender, CommandEventArgs e)
        {
            var statPrice = GoldController.CalculateNextStatLevelPrice(this.user);

            if (statPrice <= this.user.Gold)
            {
                switch (e.CommandArgument.ToString())
                {
                case "Strength":
                    ++this.user.Strength;
                    break;

                case "Defence":
                    ++this.user.Defence;
                    break;

                case "Agility":
                    ++this.user.Agility;
                    break;

                case "Charisma":
                    ++this.user.Charisma;
                    break;

                case "Stamina":
                    ++this.user.Stamina;
                    break;
                }

                this.user.Gold -= statPrice;

                this.dbcontext.SaveChanges();
            }
            else
            {
                this.error.Visible = true;
            }
        }