private void NpcTradeSetting_Load(object sender, EventArgs e)
        {
            this.mui.RefreshLanguage(this);
            this.nudThreshold = new NumericUpDown[]
            {
                this.nudThreshold1,
                this.nudThreshold2,
                this.nudThreshold3,
                this.nudThreshold4
            };

            this.nudDistribution = new NumericUpDown[]
            {
                this.nudDistribution1,
                this.nudDistribution2,
                this.nudDistribution3,
                this.nudDistribution4
            };

            TResAmount capacity  = this.Village.ResourceCapacity;
            TResAmount threshold = new TResAmount(0, 0, 0, capacity.Resources[3]);

            this.SetResources(this.nudThreshold, capacity, threshold);

            TResAmount distribution = new TResAmount(capacity);

            distribution.Resources[3] = 0;
            this.SetResources(this.nudDistribution, capacity, distribution);
        }
 private void SetResources(NumericUpDown[] nuds, TResAmount capacity, TResAmount value)
 {
     for (int i = 0; i < nuds.Length; i++)
     {
         nuds[i].Minimum   = 0;
         nuds[i].Maximum   = capacity.Resources[i];
         nuds[i].Increment = capacity.Resources[i] / 20;
         nuds[i].Value     = value.Resources[i];
     }
 }
Beispiel #3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            int[] limits = new int[this.nudLimits.Length];
            for (int i = 0; i < limits.Length; i++)
            {
                limits[i] = Convert.ToInt32(nudLimits[i].Value);
            }

            TResAmount newLimit = new TResAmount(limits);

            if (newLimit != this.Limit)
            {
                this.Return = newLimit;
            }
        }
Beispiel #4
0
        private void ResourceLimit_Load(object sender, EventArgs e)
        {
            this.mui.RefreshLanguage(this);
            this.lblVillage.Text     = String.Format("{0} ({1})", this.Village.Name, this.Village.Coord);
            this.lblDescription.Text = this.Description;
            this.nudLimits           = new NumericUpDown[]
            {
                this.nudLimit1,
                this.nudLimit2,
                this.nudLimit3,
                this.nudLimit4
            };

            TResAmount capacity = this.Village.ResourceCapacity;

            for (int i = 0; i < this.nudLimits.Length; i++)
            {
                this.nudLimits[i].Minimum   = 0;
                this.nudLimits[i].Maximum   = capacity.Resources[i];
                this.nudLimits[i].Increment = capacity.Resources[i] / 10;
                this.nudLimits[i].Value     = this.Limit.Resources[i];
            }
        }