Exemple #1
0
        /// <summary>
        /// Method used for handling explicit update events.
        /// </summary>
        public override void UpdateView(object source, EventArgs e)
        {
            this.flowLayoutPanel.Controls.Clear();

            if (!this.BuildScreen)
            {
                this.MapObject = Client.Instance.Selected;
            }

            foreach (LcogClient.Controls.Base c in LcogComponentFactory.GetComponentControl(this.MapObject, this.BuildScreen))
            {
                this.flowLayoutPanel.Controls.Add(c);
            }
        }
Exemple #2
0
 public override void UpdateView()
 {
     if (this.target == Target.NewShip)
     {
         this.labelTarget.Text = "Build a new ship";
         this.targetObj = new Ship();
         this.labelTargetID.Visible = false;
         this.textBoxTargetName.Text = "New ship";
         this.pictureBoxTarget.Image = global::LcogClient.Properties.Resources.ship;
         this.componentsTarget.MapObject = this.targetObj;
     }
     else
     {
         this.labelTarget.Text = "Upgrade";
         this.labelTargetID.Visible = true;
         this.labelTargetID.Text = this.targetObj.ID.ToString();
         this.textBoxTargetName.Text = this.targetObj.Name;
         this.pictureBoxTarget.Image = this.targetObj.Image;
         this.componentsTarget.MapObject = this.targetObj;
     }
     this.CalculateCost();
     this.componentsTarget.UpdateView(this, EventArgs.Empty);
 }
Exemple #3
0
 private void buttonBuildNewShip_Click(object sender, EventArgs e)
 {
     this.target = Target.NewShip;
     this.targetObj = new Ship();
     this.UpdateView();
 }
Exemple #4
0
        private void buttonUpgrade_Click(object sender, EventArgs e)
        {
            this.target = Target.Upgrade;

            if (Client.Instance.Map.GetAllOthersAtLocation(Client.Instance.Selected).Count > 0)
            {
                Select form = new Select("Select object to upgrade", Client.Instance.Map.GetAllAtLocation(Client.Instance.Selected.Location));
                form.ShowDialog();
                this.newComponents = new LcogClient.Model.Collections.Components();
                this.targetObj = Client.Instance.Target.Clone();
                if (Client.Instance.Target.GetType() == typeof(Planet))
                {
                    this.isPlanet = true;
                }
                else
                {
                    this.isPlanet = false;
                }
            }
            else
            {
                this.newComponents = new LcogClient.Model.Collections.Components();
                this.targetObj = Client.Instance.Selected.Clone();
                if (Client.Instance.Selected.GetType() == typeof(Planet))
                {
                    this.isPlanet = true;
                }
                else
                {
                    this.isPlanet = false;
                }
            }
            this.UpdateView();
        }
Exemple #5
0
 private void buttonClear_Click(object sender, EventArgs e)
 {
     if (this.target == Target.NewShip)
     {
         this.targetObj = new Ship();
     }
     else
     {
         this.newComponents = new LcogClient.Model.Collections.Components();
         this.targetObj = Client.Instance.Target.Clone();
     }
     this.UpdateView();
 }