C&C Remastered Map Editor
Initial commit of C&C Remastered Map Editor code
This commit is contained in:
parent
1f6350fe6e
commit
e37e174be1
289 changed files with 80922 additions and 7 deletions
518
CnCTDRAMapEditor/Controls/BasicSettings.Designer.cs
generated
Normal file
518
CnCTDRAMapEditor/Controls/BasicSettings.Designer.cs
generated
Normal file
|
@ -0,0 +1,518 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
partial class BasicSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.loseComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.isSinglePlayerCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.win4ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.win3ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.win2ComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.winComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.actionComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.briefComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.introComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.win4Label = new System.Windows.Forms.Label();
|
||||
this.win3Label = new System.Windows.Forms.Label();
|
||||
this.win2Label = new System.Windows.Forms.Label();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.buildLevelLabel = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.nameTxt = new System.Windows.Forms.TextBox();
|
||||
this.playerComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.buidLevelNud = new System.Windows.Forms.NumericUpDown();
|
||||
this.percentNud = new System.Windows.Forms.NumericUpDown();
|
||||
this.carryOverMoneyNud = new System.Windows.Forms.NumericUpDown();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.authorTxt = new System.Windows.Forms.TextBox();
|
||||
this.baseLabel = new System.Windows.Forms.Label();
|
||||
this.baseComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.buidLevelNud)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.percentNud)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.carryOverMoneyNud)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.AutoSize = true;
|
||||
this.tableLayoutPanel1.ColumnCount = 2;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.label10, 0, 15);
|
||||
this.tableLayoutPanel1.Controls.Add(this.loseComboBox, 1, 15);
|
||||
this.tableLayoutPanel1.Controls.Add(this.isSinglePlayerCheckBox, 1, 16);
|
||||
this.tableLayoutPanel1.Controls.Add(this.win4ComboBox, 1, 14);
|
||||
this.tableLayoutPanel1.Controls.Add(this.win3ComboBox, 1, 13);
|
||||
this.tableLayoutPanel1.Controls.Add(this.win2ComboBox, 1, 12);
|
||||
this.tableLayoutPanel1.Controls.Add(this.winComboBox, 1, 11);
|
||||
this.tableLayoutPanel1.Controls.Add(this.actionComboBox, 1, 10);
|
||||
this.tableLayoutPanel1.Controls.Add(this.briefComboBox, 1, 9);
|
||||
this.tableLayoutPanel1.Controls.Add(this.introComboBox, 1, 8);
|
||||
this.tableLayoutPanel1.Controls.Add(this.win4Label, 0, 14);
|
||||
this.tableLayoutPanel1.Controls.Add(this.win3Label, 0, 13);
|
||||
this.tableLayoutPanel1.Controls.Add(this.win2Label, 0, 12);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label9, 0, 11);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label8, 0, 10);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label7, 0, 9);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 8);
|
||||
this.tableLayoutPanel1.Controls.Add(this.buildLevelLabel, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label3, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label4, 0, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label5, 0, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.nameTxt, 1, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.playerComboBox, 1, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.buidLevelNud, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.percentNud, 1, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.carryOverMoneyNud, 1, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label6, 0, 5);
|
||||
this.tableLayoutPanel1.Controls.Add(this.authorTxt, 1, 5);
|
||||
this.tableLayoutPanel1.Controls.Add(this.baseLabel, 0, 6);
|
||||
this.tableLayoutPanel1.Controls.Add(this.baseComboBox, 1, 6);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 17;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(300, 403);
|
||||
this.tableLayoutPanel1.TabIndex = 1;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label10.Location = new System.Drawing.Point(2, 355);
|
||||
this.label10.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(87, 25);
|
||||
this.label10.TabIndex = 35;
|
||||
this.label10.Text = "Lose";
|
||||
this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// loseComboBox
|
||||
//
|
||||
this.loseComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.loseComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.loseComboBox.FormattingEnabled = true;
|
||||
this.loseComboBox.Location = new System.Drawing.Point(93, 357);
|
||||
this.loseComboBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.loseComboBox.Name = "loseComboBox";
|
||||
this.loseComboBox.Size = new System.Drawing.Size(205, 21);
|
||||
this.loseComboBox.TabIndex = 34;
|
||||
//
|
||||
// isSinglePlayerCheckBox
|
||||
//
|
||||
this.isSinglePlayerCheckBox.AutoSize = true;
|
||||
this.isSinglePlayerCheckBox.Location = new System.Drawing.Point(93, 382);
|
||||
this.isSinglePlayerCheckBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.isSinglePlayerCheckBox.Name = "isSinglePlayerCheckBox";
|
||||
this.isSinglePlayerCheckBox.Size = new System.Drawing.Size(87, 17);
|
||||
this.isSinglePlayerCheckBox.TabIndex = 32;
|
||||
this.isSinglePlayerCheckBox.Text = "Single-Player";
|
||||
this.isSinglePlayerCheckBox.UseVisualStyleBackColor = true;
|
||||
this.isSinglePlayerCheckBox.CheckedChanged += new System.EventHandler(this.isSinglePlayerCheckBox_CheckedChanged);
|
||||
//
|
||||
// win4ComboBox
|
||||
//
|
||||
this.win4ComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.win4ComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.win4ComboBox.FormattingEnabled = true;
|
||||
this.win4ComboBox.Location = new System.Drawing.Point(93, 332);
|
||||
this.win4ComboBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.win4ComboBox.Name = "win4ComboBox";
|
||||
this.win4ComboBox.Size = new System.Drawing.Size(205, 21);
|
||||
this.win4ComboBox.TabIndex = 31;
|
||||
//
|
||||
// win3ComboBox
|
||||
//
|
||||
this.win3ComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.win3ComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.win3ComboBox.FormattingEnabled = true;
|
||||
this.win3ComboBox.Location = new System.Drawing.Point(93, 307);
|
||||
this.win3ComboBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.win3ComboBox.Name = "win3ComboBox";
|
||||
this.win3ComboBox.Size = new System.Drawing.Size(205, 21);
|
||||
this.win3ComboBox.TabIndex = 30;
|
||||
//
|
||||
// win2ComboBox
|
||||
//
|
||||
this.win2ComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.win2ComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.win2ComboBox.FormattingEnabled = true;
|
||||
this.win2ComboBox.Location = new System.Drawing.Point(93, 282);
|
||||
this.win2ComboBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.win2ComboBox.Name = "win2ComboBox";
|
||||
this.win2ComboBox.Size = new System.Drawing.Size(205, 21);
|
||||
this.win2ComboBox.TabIndex = 29;
|
||||
//
|
||||
// winComboBox
|
||||
//
|
||||
this.winComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.winComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.winComboBox.FormattingEnabled = true;
|
||||
this.winComboBox.Location = new System.Drawing.Point(93, 257);
|
||||
this.winComboBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.winComboBox.Name = "winComboBox";
|
||||
this.winComboBox.Size = new System.Drawing.Size(205, 21);
|
||||
this.winComboBox.TabIndex = 28;
|
||||
//
|
||||
// actionComboBox
|
||||
//
|
||||
this.actionComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.actionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.actionComboBox.FormattingEnabled = true;
|
||||
this.actionComboBox.Location = new System.Drawing.Point(93, 232);
|
||||
this.actionComboBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.actionComboBox.Name = "actionComboBox";
|
||||
this.actionComboBox.Size = new System.Drawing.Size(205, 21);
|
||||
this.actionComboBox.TabIndex = 27;
|
||||
//
|
||||
// briefComboBox
|
||||
//
|
||||
this.briefComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.briefComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.briefComboBox.FormattingEnabled = true;
|
||||
this.briefComboBox.Location = new System.Drawing.Point(93, 207);
|
||||
this.briefComboBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.briefComboBox.Name = "briefComboBox";
|
||||
this.briefComboBox.Size = new System.Drawing.Size(205, 21);
|
||||
this.briefComboBox.TabIndex = 26;
|
||||
//
|
||||
// introComboBox
|
||||
//
|
||||
this.introComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.introComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.introComboBox.FormattingEnabled = true;
|
||||
this.introComboBox.Location = new System.Drawing.Point(93, 182);
|
||||
this.introComboBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.introComboBox.Name = "introComboBox";
|
||||
this.introComboBox.Size = new System.Drawing.Size(205, 21);
|
||||
this.introComboBox.TabIndex = 25;
|
||||
//
|
||||
// win4Label
|
||||
//
|
||||
this.win4Label.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.win4Label.Location = new System.Drawing.Point(2, 330);
|
||||
this.win4Label.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.win4Label.Name = "win4Label";
|
||||
this.win4Label.Size = new System.Drawing.Size(87, 25);
|
||||
this.win4Label.TabIndex = 24;
|
||||
this.win4Label.Text = "Win4";
|
||||
this.win4Label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// win3Label
|
||||
//
|
||||
this.win3Label.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.win3Label.Location = new System.Drawing.Point(2, 305);
|
||||
this.win3Label.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.win3Label.Name = "win3Label";
|
||||
this.win3Label.Size = new System.Drawing.Size(87, 25);
|
||||
this.win3Label.TabIndex = 23;
|
||||
this.win3Label.Text = "Win3";
|
||||
this.win3Label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// win2Label
|
||||
//
|
||||
this.win2Label.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.win2Label.Location = new System.Drawing.Point(2, 280);
|
||||
this.win2Label.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.win2Label.Name = "win2Label";
|
||||
this.win2Label.Size = new System.Drawing.Size(87, 25);
|
||||
this.win2Label.TabIndex = 22;
|
||||
this.win2Label.Text = "Win2";
|
||||
this.win2Label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label9.Location = new System.Drawing.Point(2, 255);
|
||||
this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(87, 25);
|
||||
this.label9.TabIndex = 21;
|
||||
this.label9.Text = "Win";
|
||||
this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label8.Location = new System.Drawing.Point(2, 230);
|
||||
this.label8.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(87, 25);
|
||||
this.label8.TabIndex = 20;
|
||||
this.label8.Text = "Action";
|
||||
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label7.Location = new System.Drawing.Point(2, 205);
|
||||
this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(87, 25);
|
||||
this.label7.TabIndex = 19;
|
||||
this.label7.Text = "Brief";
|
||||
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label1.Location = new System.Drawing.Point(2, 180);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(87, 25);
|
||||
this.label1.TabIndex = 18;
|
||||
this.label1.Text = "Intro";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// buildLevelLabel
|
||||
//
|
||||
this.buildLevelLabel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.buildLevelLabel.Location = new System.Drawing.Point(3, 0);
|
||||
this.buildLevelLabel.Name = "buildLevelLabel";
|
||||
this.buildLevelLabel.Size = new System.Drawing.Size(85, 26);
|
||||
this.buildLevelLabel.TabIndex = 0;
|
||||
this.buildLevelLabel.Text = "Build Level";
|
||||
this.buildLevelLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label2.Location = new System.Drawing.Point(3, 26);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(85, 26);
|
||||
this.label2.TabIndex = 2;
|
||||
this.label2.Text = "Carryover Money";
|
||||
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label3.Location = new System.Drawing.Point(3, 52);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(85, 26);
|
||||
this.label3.TabIndex = 3;
|
||||
this.label3.Text = "Name";
|
||||
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label4.Location = new System.Drawing.Point(3, 78);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(85, 26);
|
||||
this.label4.TabIndex = 4;
|
||||
this.label4.Text = "Percent";
|
||||
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label5.Location = new System.Drawing.Point(3, 104);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(85, 27);
|
||||
this.label5.TabIndex = 5;
|
||||
this.label5.Text = "Player";
|
||||
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// nameTxt
|
||||
//
|
||||
this.nameTxt.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.nameTxt.Location = new System.Drawing.Point(94, 55);
|
||||
this.nameTxt.Name = "nameTxt";
|
||||
this.nameTxt.Size = new System.Drawing.Size(203, 20);
|
||||
this.nameTxt.TabIndex = 7;
|
||||
//
|
||||
// playerComboBox
|
||||
//
|
||||
this.playerComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.playerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.playerComboBox.FormattingEnabled = true;
|
||||
this.playerComboBox.Location = new System.Drawing.Point(94, 107);
|
||||
this.playerComboBox.Name = "playerComboBox";
|
||||
this.playerComboBox.Size = new System.Drawing.Size(203, 21);
|
||||
this.playerComboBox.TabIndex = 9;
|
||||
//
|
||||
// buidLevelNud
|
||||
//
|
||||
this.buidLevelNud.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.buidLevelNud.Location = new System.Drawing.Point(94, 3);
|
||||
this.buidLevelNud.Name = "buidLevelNud";
|
||||
this.buidLevelNud.Size = new System.Drawing.Size(203, 20);
|
||||
this.buidLevelNud.TabIndex = 10;
|
||||
//
|
||||
// percentNud
|
||||
//
|
||||
this.percentNud.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.percentNud.Location = new System.Drawing.Point(94, 81);
|
||||
this.percentNud.Name = "percentNud";
|
||||
this.percentNud.Size = new System.Drawing.Size(203, 20);
|
||||
this.percentNud.TabIndex = 11;
|
||||
//
|
||||
// carryOverMoneyNud
|
||||
//
|
||||
this.carryOverMoneyNud.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.carryOverMoneyNud.Location = new System.Drawing.Point(94, 29);
|
||||
this.carryOverMoneyNud.Name = "carryOverMoneyNud";
|
||||
this.carryOverMoneyNud.Size = new System.Drawing.Size(203, 20);
|
||||
this.carryOverMoneyNud.TabIndex = 12;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label6.Location = new System.Drawing.Point(2, 131);
|
||||
this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(87, 24);
|
||||
this.label6.TabIndex = 13;
|
||||
this.label6.Text = "Author";
|
||||
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// authorTxt
|
||||
//
|
||||
this.authorTxt.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.authorTxt.Location = new System.Drawing.Point(93, 133);
|
||||
this.authorTxt.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.authorTxt.Name = "authorTxt";
|
||||
this.authorTxt.Size = new System.Drawing.Size(205, 20);
|
||||
this.authorTxt.TabIndex = 14;
|
||||
//
|
||||
// baseLabel
|
||||
//
|
||||
this.baseLabel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.baseLabel.Location = new System.Drawing.Point(2, 155);
|
||||
this.baseLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.baseLabel.Name = "baseLabel";
|
||||
this.baseLabel.Size = new System.Drawing.Size(87, 25);
|
||||
this.baseLabel.TabIndex = 15;
|
||||
this.baseLabel.Text = "Base";
|
||||
this.baseLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// baseComboBox
|
||||
//
|
||||
this.baseComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.baseComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.baseComboBox.FormattingEnabled = true;
|
||||
this.baseComboBox.Location = new System.Drawing.Point(93, 157);
|
||||
this.baseComboBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.baseComboBox.Name = "baseComboBox";
|
||||
this.baseComboBox.Size = new System.Drawing.Size(205, 21);
|
||||
this.baseComboBox.TabIndex = 16;
|
||||
//
|
||||
// BasicSettings
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Name = "BasicSettings";
|
||||
this.Size = new System.Drawing.Size(300, 403);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.buidLevelNud)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.percentNud)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.carryOverMoneyNud)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Label buildLevelLabel;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox nameTxt;
|
||||
private System.Windows.Forms.ComboBox playerComboBox;
|
||||
private System.Windows.Forms.NumericUpDown buidLevelNud;
|
||||
private System.Windows.Forms.NumericUpDown percentNud;
|
||||
private System.Windows.Forms.NumericUpDown carryOverMoneyNud;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.TextBox authorTxt;
|
||||
private System.Windows.Forms.Label baseLabel;
|
||||
private System.Windows.Forms.ComboBox baseComboBox;
|
||||
private System.Windows.Forms.Label win4Label;
|
||||
private System.Windows.Forms.Label win3Label;
|
||||
private System.Windows.Forms.Label win2Label;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.CheckBox isSinglePlayerCheckBox;
|
||||
private System.Windows.Forms.ComboBox win4ComboBox;
|
||||
private System.Windows.Forms.ComboBox win3ComboBox;
|
||||
private System.Windows.Forms.ComboBox win2ComboBox;
|
||||
private System.Windows.Forms.ComboBox winComboBox;
|
||||
private System.Windows.Forms.ComboBox actionComboBox;
|
||||
private System.Windows.Forms.ComboBox briefComboBox;
|
||||
private System.Windows.Forms.ComboBox introComboBox;
|
||||
private System.Windows.Forms.ComboBox loseComboBox;
|
||||
private System.Windows.Forms.Label label10;
|
||||
}
|
||||
}
|
80
CnCTDRAMapEditor/Controls/BasicSettings.cs
Normal file
80
CnCTDRAMapEditor/Controls/BasicSettings.cs
Normal file
|
@ -0,0 +1,80 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
using MobiusEditor.Interface;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
public partial class BasicSettings : UserControl
|
||||
{
|
||||
public BasicSettings(IGamePlugin plugin, dynamic basicSection)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
playerComboBox.DataSource = plugin.Map.Houses.Select(h => h.Type.Name).ToArray();
|
||||
baseComboBox.DataSource = plugin.Map.Houses.Select(h => h.Type.Name).ToArray();
|
||||
introComboBox.DataSource = plugin.Map.MovieTypes.ToArray();
|
||||
briefComboBox.DataSource = plugin.Map.MovieTypes.ToArray();
|
||||
actionComboBox.DataSource = plugin.Map.MovieTypes.ToArray();
|
||||
winComboBox.DataSource = plugin.Map.MovieTypes.ToArray();
|
||||
win2ComboBox.DataSource = plugin.Map.MovieTypes.ToArray();
|
||||
win3ComboBox.DataSource = plugin.Map.MovieTypes.ToArray();
|
||||
win4ComboBox.DataSource = plugin.Map.MovieTypes.ToArray();
|
||||
loseComboBox.DataSource = plugin.Map.MovieTypes.ToArray();
|
||||
|
||||
carryOverMoneyNud.DataBindings.Add("Value", basicSection, "CarryOverMoney");
|
||||
nameTxt.DataBindings.Add("Text", basicSection, "Name");
|
||||
percentNud.DataBindings.Add("Value", basicSection, "Percent");
|
||||
playerComboBox.DataBindings.Add("SelectedItem", basicSection, "Player");
|
||||
authorTxt.DataBindings.Add("Text", basicSection, "Author");
|
||||
isSinglePlayerCheckBox.DataBindings.Add("Checked", basicSection, "SoloMission");
|
||||
introComboBox.DataBindings.Add("SelectedItem", basicSection, "Intro");
|
||||
briefComboBox.DataBindings.Add("SelectedItem", basicSection, "Brief");
|
||||
actionComboBox.DataBindings.Add("SelectedItem", basicSection, "Action");
|
||||
winComboBox.DataBindings.Add("SelectedItem", basicSection, "Win");
|
||||
loseComboBox.DataBindings.Add("SelectedItem", basicSection, "Lose");
|
||||
|
||||
switch (plugin.GameType)
|
||||
{
|
||||
case GameType.TiberianDawn:
|
||||
buidLevelNud.DataBindings.Add("Value", basicSection, "BuildLevel");
|
||||
baseLabel.Visible = baseComboBox.Visible = false;
|
||||
win2Label.Visible = win2ComboBox.Visible = false;
|
||||
win3Label.Visible = win3ComboBox.Visible = false;
|
||||
win4Label.Visible = win4ComboBox.Visible = false;
|
||||
break;
|
||||
case GameType.RedAlert:
|
||||
buidLevelNud.Visible = buildLevelLabel.Visible = false;
|
||||
baseComboBox.DataBindings.Add("SelectedItem", basicSection, "BasePlayer");
|
||||
win2ComboBox.DataBindings.Add("SelectedItem", basicSection, "Win2");
|
||||
win3ComboBox.DataBindings.Add("SelectedItem", basicSection, "Win3");
|
||||
win4ComboBox.DataBindings.Add("SelectedItem", basicSection, "Win4");
|
||||
break;
|
||||
}
|
||||
|
||||
introComboBox.Enabled = briefComboBox.Enabled = actionComboBox.Enabled = loseComboBox.Enabled = isSinglePlayerCheckBox.Checked;
|
||||
winComboBox.Enabled = win2ComboBox.Enabled = win3ComboBox.Enabled = win4ComboBox.Enabled = isSinglePlayerCheckBox.Checked;
|
||||
}
|
||||
|
||||
private void isSinglePlayerCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
introComboBox.Enabled = briefComboBox.Enabled = actionComboBox.Enabled = loseComboBox.Enabled = isSinglePlayerCheckBox.Checked;
|
||||
winComboBox.Enabled = win2ComboBox.Enabled = win3ComboBox.Enabled = win4ComboBox.Enabled = isSinglePlayerCheckBox.Checked;
|
||||
}
|
||||
}
|
||||
}
|
120
CnCTDRAMapEditor/Controls/BasicSettings.resx
Normal file
120
CnCTDRAMapEditor/Controls/BasicSettings.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
75
CnCTDRAMapEditor/Controls/BriefingSettings.Designer.cs
generated
Normal file
75
CnCTDRAMapEditor/Controls/BriefingSettings.Designer.cs
generated
Normal file
|
@ -0,0 +1,75 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
partial class BriefingSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.briefingTxt = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// briefingTxt
|
||||
//
|
||||
this.briefingTxt.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.briefingTxt.Location = new System.Drawing.Point(0, 0);
|
||||
this.briefingTxt.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.briefingTxt.Multiline = true;
|
||||
this.briefingTxt.Name = "briefingTxt";
|
||||
this.briefingTxt.Size = new System.Drawing.Size(600, 400);
|
||||
this.briefingTxt.TabIndex = 0;
|
||||
//
|
||||
// BriefingSettings
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.briefingTxt);
|
||||
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.Name = "BriefingSettings";
|
||||
this.Size = new System.Drawing.Size(600, 400);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox briefingTxt;
|
||||
}
|
||||
}
|
29
CnCTDRAMapEditor/Controls/BriefingSettings.cs
Normal file
29
CnCTDRAMapEditor/Controls/BriefingSettings.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
using MobiusEditor.Interface;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
public partial class BriefingSettings : UserControl
|
||||
{
|
||||
public BriefingSettings(IGamePlugin plugin, dynamic briefingSection)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
briefingTxt.DataBindings.Add("Text", briefingSection, "Briefing");
|
||||
}
|
||||
}
|
||||
}
|
120
CnCTDRAMapEditor/Controls/BriefingSettings.resx
Normal file
120
CnCTDRAMapEditor/Controls/BriefingSettings.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
50
CnCTDRAMapEditor/Controls/ImageTooltip.Designer.cs
generated
Normal file
50
CnCTDRAMapEditor/Controls/ImageTooltip.Designer.cs
generated
Normal file
|
@ -0,0 +1,50 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
partial class ImageTooltip
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
64
CnCTDRAMapEditor/Controls/ImageTooltip.cs
Normal file
64
CnCTDRAMapEditor/Controls/ImageTooltip.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
public partial class ImageTooltip : ToolTip
|
||||
{
|
||||
public Size MaxSize { get; set; } = Size.Empty;
|
||||
|
||||
public ImageTooltip()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
OwnerDraw = true;
|
||||
Popup += ImageTooltip_Popup;
|
||||
Draw += ImageTooltip_Draw;
|
||||
}
|
||||
|
||||
private void ImageTooltip_Popup(object sender, PopupEventArgs e)
|
||||
{
|
||||
if (e.AssociatedControl.Tag is Image image)
|
||||
{
|
||||
var size = image.Size;
|
||||
if (MaxSize.Width > 0)
|
||||
{
|
||||
size.Width = Math.Min(MaxSize.Width, size.Width);
|
||||
}
|
||||
if (MaxSize.Height > 0)
|
||||
{
|
||||
size.Height = Math.Min(MaxSize.Height, size.Height);
|
||||
}
|
||||
|
||||
e.ToolTipSize = size;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ImageTooltip_Draw(object sender, DrawToolTipEventArgs e)
|
||||
{
|
||||
if (e.AssociatedControl.Tag is Image image)
|
||||
{
|
||||
e.Graphics.DrawImage(image, e.Bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
52
CnCTDRAMapEditor/Controls/MapPanel.Designer.cs
generated
Normal file
52
CnCTDRAMapEditor/Controls/MapPanel.Designer.cs
generated
Normal file
|
@ -0,0 +1,52 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
partial class MapPanel
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.SuspendLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
535
CnCTDRAMapEditor/Controls/MapPanel.cs
Normal file
535
CnCTDRAMapEditor/Controls/MapPanel.cs
Normal file
|
@ -0,0 +1,535 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
using MobiusEditor.Event;
|
||||
using MobiusEditor.Interface;
|
||||
using MobiusEditor.Model;
|
||||
using MobiusEditor.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
public partial class MapPanel : Panel
|
||||
{
|
||||
private bool updatingCamera;
|
||||
private Rectangle cameraBounds;
|
||||
private Point lastScrollPosition;
|
||||
|
||||
private (Point map, SizeF client)? referencePositions;
|
||||
|
||||
private Matrix mapToViewTransform = new Matrix();
|
||||
private Matrix viewToPageTransform = new Matrix();
|
||||
|
||||
private Matrix compositeTransform = new Matrix();
|
||||
private Matrix invCompositeTransform = new Matrix();
|
||||
|
||||
private readonly HashSet<Point> invalidateCells = new HashSet<Point>();
|
||||
private bool fullInvalidation;
|
||||
|
||||
private Image mapImage;
|
||||
public Image MapImage
|
||||
{
|
||||
get => mapImage;
|
||||
set
|
||||
{
|
||||
if (mapImage != value)
|
||||
{
|
||||
mapImage = value;
|
||||
UpdateCamera();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int minZoom = 1;
|
||||
public int MinZoom
|
||||
{
|
||||
get => minZoom;
|
||||
set
|
||||
{
|
||||
if (minZoom != value)
|
||||
{
|
||||
minZoom = value;
|
||||
Zoom = zoom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int maxZoom = 8;
|
||||
public int MaxZoom
|
||||
{
|
||||
get => maxZoom;
|
||||
set
|
||||
{
|
||||
if (maxZoom != value)
|
||||
{
|
||||
maxZoom = value;
|
||||
Zoom = zoom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int zoomStep = 1;
|
||||
public int ZoomStep
|
||||
{
|
||||
get => zoomStep;
|
||||
set
|
||||
{
|
||||
if (zoomStep != value)
|
||||
{
|
||||
zoomStep = value;
|
||||
Zoom = (Zoom / zoomStep) * zoomStep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int zoom = 1;
|
||||
public int Zoom
|
||||
{
|
||||
get => zoom;
|
||||
set
|
||||
{
|
||||
var newZoom = Math.Max(MinZoom, Math.Min(MaxZoom, value));
|
||||
if (zoom != newZoom)
|
||||
{
|
||||
zoom = newZoom;
|
||||
|
||||
var clientPosition = PointToClient(MousePosition);
|
||||
referencePositions = (ClientToMap(clientPosition), new SizeF(clientPosition.X / (float)ClientSize.Width, clientPosition.Y / (float)ClientSize.Height));
|
||||
|
||||
UpdateCamera();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int quality = Properties.Settings.Default.Quality;
|
||||
public int Quality
|
||||
{
|
||||
get => quality;
|
||||
set
|
||||
{
|
||||
if (quality != value)
|
||||
{
|
||||
quality = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Category("Behavior")]
|
||||
[DefaultValue(false)]
|
||||
public bool FocusOnMouseEnter { get; set; }
|
||||
|
||||
public event EventHandler<RenderEventArgs> PreRender;
|
||||
public event EventHandler<RenderEventArgs> PostRender;
|
||||
|
||||
public MapPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
DoubleBuffered = true;
|
||||
}
|
||||
|
||||
public Point MapToClient(Point point)
|
||||
{
|
||||
var points = new Point[] { point };
|
||||
compositeTransform.TransformPoints(points);
|
||||
return points[0];
|
||||
}
|
||||
|
||||
public Size MapToClient(Size size)
|
||||
{
|
||||
var points = new Point[] { (Point)size };
|
||||
compositeTransform.VectorTransformPoints(points);
|
||||
return (Size)points[0];
|
||||
}
|
||||
|
||||
public Rectangle MapToClient(Rectangle rectangle)
|
||||
{
|
||||
var points = new Point[] { rectangle.Location, new Point(rectangle.Right, rectangle.Bottom) };
|
||||
compositeTransform.TransformPoints(points);
|
||||
return new Rectangle(points[0], new Size(points[1].X - points[0].X, points[1].Y - points[0].Y));
|
||||
}
|
||||
|
||||
public Point ClientToMap(Point point)
|
||||
{
|
||||
var points = new Point[] { point };
|
||||
invCompositeTransform.TransformPoints(points);
|
||||
return points[0];
|
||||
}
|
||||
|
||||
public Size ClientToMap(Size size)
|
||||
{
|
||||
var points = new Point[] { (Point)size };
|
||||
invCompositeTransform.VectorTransformPoints(points);
|
||||
return (Size)points[0];
|
||||
}
|
||||
|
||||
public Rectangle ClientToMap(Rectangle rectangle)
|
||||
{
|
||||
var points = new Point[] { rectangle.Location, new Point(rectangle.Right, rectangle.Bottom) };
|
||||
invCompositeTransform.TransformPoints(points);
|
||||
return new Rectangle(points[0], new Size(points[1].X - points[0].X, points[1].Y - points[0].Y));
|
||||
}
|
||||
|
||||
public void Invalidate(Map invalidateMap)
|
||||
{
|
||||
if (!fullInvalidation)
|
||||
{
|
||||
invalidateCells.Clear();
|
||||
fullInvalidation = true;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public void Invalidate(Map invalidateMap, Rectangle cellBounds)
|
||||
{
|
||||
if (fullInvalidation)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var count = invalidateCells.Count;
|
||||
invalidateCells.UnionWith(cellBounds.Points());
|
||||
if (invalidateCells.Count > count)
|
||||
{
|
||||
var overlapCells = invalidateMap.Overlappers.Overlaps(invalidateCells).ToHashSet();
|
||||
invalidateCells.UnionWith(overlapCells);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public void Invalidate(Map invalidateMap, IEnumerable<Rectangle> cellBounds)
|
||||
{
|
||||
if (fullInvalidation)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var count = invalidateCells.Count;
|
||||
invalidateCells.UnionWith(cellBounds.SelectMany(c => c.Points()));
|
||||
if (invalidateCells.Count > count)
|
||||
{
|
||||
var overlapCells = invalidateMap.Overlappers.Overlaps(invalidateCells).ToHashSet();
|
||||
invalidateCells.UnionWith(overlapCells);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public void Invalidate(Map invalidateMap, Point location)
|
||||
{
|
||||
if (fullInvalidation)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Invalidate(invalidateMap, new Rectangle(location, new Size(1, 1)));
|
||||
}
|
||||
|
||||
public void Invalidate(Map invalidateMap, IEnumerable<Point> locations)
|
||||
{
|
||||
if (fullInvalidation)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Invalidate(invalidateMap, locations.Select(l => new Rectangle(l, new Size(1, 1))));
|
||||
}
|
||||
|
||||
public void Invalidate(Map invalidateMap, int cell)
|
||||
{
|
||||
if (fullInvalidation)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (invalidateMap.Metrics.GetLocation(cell, out Point location))
|
||||
{
|
||||
Invalidate(invalidateMap, location);
|
||||
}
|
||||
}
|
||||
|
||||
public void Invalidate(Map invalidateMap, IEnumerable<int> cells)
|
||||
{
|
||||
if (fullInvalidation)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Invalidate(invalidateMap, cells
|
||||
.Where(c => invalidateMap.Metrics.GetLocation(c, out Point location))
|
||||
.Select(c =>
|
||||
{
|
||||
invalidateMap.Metrics.GetLocation(c, out Point location);
|
||||
return location;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public void Invalidate(Map invalidateMap, ICellOverlapper overlapper)
|
||||
{
|
||||
if (fullInvalidation)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var rectangle = invalidateMap.Overlappers[overlapper];
|
||||
if (rectangle.HasValue)
|
||||
{
|
||||
Invalidate(invalidateMap, rectangle.Value);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseEnter(EventArgs e)
|
||||
{
|
||||
base.OnMouseEnter(e);
|
||||
|
||||
if (FocusOnMouseEnter)
|
||||
{
|
||||
Focus();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseWheel(MouseEventArgs e)
|
||||
{
|
||||
Zoom += ZoomStep * Math.Sign(e.Delta);
|
||||
}
|
||||
|
||||
protected override void OnClientSizeChanged(EventArgs e)
|
||||
{
|
||||
base.OnClientSizeChanged(e);
|
||||
|
||||
UpdateCamera();
|
||||
}
|
||||
|
||||
protected override void OnScroll(ScrollEventArgs se)
|
||||
{
|
||||
base.OnScroll(se);
|
||||
|
||||
InvalidateScroll();
|
||||
}
|
||||
|
||||
protected override void OnPaintBackground(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaintBackground(e);
|
||||
|
||||
e.Graphics.Clear(BackColor);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
base.OnPaint(pe);
|
||||
|
||||
InvalidateScroll();
|
||||
|
||||
PreRender?.Invoke(this, new RenderEventArgs(pe.Graphics, fullInvalidation ? null : invalidateCells));
|
||||
|
||||
if (mapImage != null)
|
||||
{
|
||||
pe.Graphics.Transform = compositeTransform;
|
||||
|
||||
var oldCompositingMode = pe.Graphics.CompositingMode;
|
||||
var oldCompositingQuality = pe.Graphics.CompositingQuality;
|
||||
var oldInterpolationMode = pe.Graphics.InterpolationMode;
|
||||
if (Quality > 1)
|
||||
{
|
||||
pe.Graphics.CompositingMode = CompositingMode.SourceCopy;
|
||||
pe.Graphics.CompositingQuality = CompositingQuality.HighSpeed;
|
||||
}
|
||||
|
||||
pe.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||
pe.Graphics.DrawImage(mapImage, 0, 0);
|
||||
|
||||
pe.Graphics.CompositingMode = oldCompositingMode;
|
||||
pe.Graphics.CompositingQuality = oldCompositingQuality;
|
||||
pe.Graphics.InterpolationMode = oldInterpolationMode;
|
||||
}
|
||||
|
||||
PostRender?.Invoke(this, new RenderEventArgs(pe.Graphics, fullInvalidation ? null : invalidateCells));
|
||||
|
||||
#if DEVELOPER
|
||||
if (Globals.Developer.ShowOverlapCells)
|
||||
{
|
||||
var invalidPen = new Pen(Color.DarkRed);
|
||||
foreach (var cell in invalidateCells)
|
||||
{
|
||||
pe.Graphics.DrawRectangle(invalidPen, new Rectangle(cell.X * Globals.TileWidth, cell.Y * Globals.TileHeight, Globals.TileWidth, Globals.TileHeight));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
invalidateCells.Clear();
|
||||
fullInvalidation = false;
|
||||
}
|
||||
|
||||
private void UpdateCamera()
|
||||
{
|
||||
if (mapImage == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ClientSize.IsEmpty)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updatingCamera = true;
|
||||
|
||||
var mapAspect = (double)mapImage.Width / mapImage.Height;
|
||||
var panelAspect = (double)ClientSize.Width / ClientSize.Height;
|
||||
var cameraLocation = cameraBounds.Location;
|
||||
|
||||
var size = Size.Empty;
|
||||
if (panelAspect > mapAspect)
|
||||
{
|
||||
size.Height = mapImage.Height / zoom;
|
||||
size.Width = (int)(size.Height * panelAspect);
|
||||
}
|
||||
else
|
||||
{
|
||||
size.Width = mapImage.Width / zoom;
|
||||
size.Height = (int)(size.Width / panelAspect);
|
||||
}
|
||||
|
||||
var location = Point.Empty;
|
||||
var scrollSize = Size.Empty;
|
||||
if (size.Width < mapImage.Width)
|
||||
{
|
||||
location.X = Math.Max(0, Math.Min(mapImage.Width - size.Width, cameraBounds.Left));
|
||||
scrollSize.Width = mapImage.Width * ClientSize.Width / size.Width;
|
||||
}
|
||||
else
|
||||
{
|
||||
location.X = (mapImage.Width - size.Width) / 2;
|
||||
}
|
||||
|
||||
if (size.Height < mapImage.Height)
|
||||
{
|
||||
location.Y = Math.Max(0, Math.Min(mapImage.Height - size.Height, cameraBounds.Top));
|
||||
scrollSize.Height = mapImage.Height * ClientSize.Height / size.Height;
|
||||
}
|
||||
else
|
||||
{
|
||||
location.Y = (mapImage.Height - size.Height) / 2;
|
||||
}
|
||||
|
||||
cameraBounds = new Rectangle(location, size);
|
||||
RecalculateTransforms();
|
||||
|
||||
if (referencePositions.HasValue)
|
||||
{
|
||||
var mapPoint = referencePositions.Value.map;
|
||||
var clientSize = referencePositions.Value.client;
|
||||
|
||||
cameraLocation = cameraBounds.Location;
|
||||
if (scrollSize.Width != 0)
|
||||
{
|
||||
cameraLocation.X = Math.Max(0, Math.Min(mapImage.Width - cameraBounds.Width, (int)(mapPoint.X - (cameraBounds.Width * clientSize.Width))));
|
||||
}
|
||||
if (scrollSize.Height != 0)
|
||||
{
|
||||
cameraLocation.Y = Math.Max(0, Math.Min(mapImage.Height - cameraBounds.Height, (int)(mapPoint.Y - (cameraBounds.Height * clientSize.Height))));
|
||||
}
|
||||
if (!scrollSize.IsEmpty)
|
||||
{
|
||||
cameraBounds.Location = cameraLocation;
|
||||
RecalculateTransforms();
|
||||
}
|
||||
|
||||
referencePositions = null;
|
||||
}
|
||||
|
||||
SuspendDrawing();
|
||||
AutoScrollMinSize = scrollSize;
|
||||
AutoScrollPosition = (Point)MapToClient((Size)cameraBounds.Location);
|
||||
lastScrollPosition = AutoScrollPosition;
|
||||
ResumeDrawing();
|
||||
|
||||
updatingCamera = false;
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
private void RecalculateTransforms()
|
||||
{
|
||||
mapToViewTransform.Reset();
|
||||
mapToViewTransform.Translate(cameraBounds.Left, cameraBounds.Top);
|
||||
mapToViewTransform.Scale(cameraBounds.Width, cameraBounds.Height);
|
||||
mapToViewTransform.Invert();
|
||||
|
||||
viewToPageTransform.Reset();
|
||||
viewToPageTransform.Scale(ClientSize.Width, ClientSize.Height);
|
||||
|
||||
compositeTransform.Reset();
|
||||
compositeTransform.Multiply(viewToPageTransform);
|
||||
compositeTransform.Multiply(mapToViewTransform);
|
||||
|
||||
invCompositeTransform.Reset();
|
||||
invCompositeTransform.Multiply(compositeTransform);
|
||||
invCompositeTransform.Invert();
|
||||
}
|
||||
|
||||
private void InvalidateScroll()
|
||||
{
|
||||
if (updatingCamera)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((lastScrollPosition.X != AutoScrollPosition.X) || (lastScrollPosition.Y != AutoScrollPosition.Y))
|
||||
{
|
||||
var delta = ClientToMap((Size)(lastScrollPosition - (Size)AutoScrollPosition));
|
||||
lastScrollPosition = AutoScrollPosition;
|
||||
|
||||
var cameraLocation = cameraBounds.Location;
|
||||
if (AutoScrollMinSize.Width != 0)
|
||||
{
|
||||
cameraLocation.X = Math.Max(0, Math.Min(mapImage.Width - cameraBounds.Width, cameraBounds.Left + delta.Width));
|
||||
}
|
||||
if (AutoScrollMinSize.Height != 0)
|
||||
{
|
||||
cameraLocation.Y = Math.Max(0, Math.Min(mapImage.Height - cameraBounds.Height, cameraBounds.Top + delta.Height));
|
||||
}
|
||||
if (!AutoScrollMinSize.IsEmpty)
|
||||
{
|
||||
cameraBounds.Location = cameraLocation;
|
||||
RecalculateTransforms();
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam);
|
||||
|
||||
private const int WM_SETREDRAW = 11;
|
||||
|
||||
private void SuspendDrawing()
|
||||
{
|
||||
SendMessage(Handle, WM_SETREDRAW, false, 0);
|
||||
}
|
||||
|
||||
private void ResumeDrawing()
|
||||
{
|
||||
SendMessage(Handle, WM_SETREDRAW, true, 0);
|
||||
}
|
||||
}
|
||||
}
|
123
CnCTDRAMapEditor/Controls/MapPanel.resx
Normal file
123
CnCTDRAMapEditor/Controls/MapPanel.resx
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
50
CnCTDRAMapEditor/Controls/MenuButton.Designer.cs
generated
Normal file
50
CnCTDRAMapEditor/Controls/MenuButton.Designer.cs
generated
Normal file
|
@ -0,0 +1,50 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
partial class MenuButton
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
74
CnCTDRAMapEditor/Controls/MenuButton.cs
Normal file
74
CnCTDRAMapEditor/Controls/MenuButton.cs
Normal file
|
@ -0,0 +1,74 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
public partial class MenuButton : Button
|
||||
{
|
||||
public const int DefaultSplitWidth = 20;
|
||||
|
||||
[DefaultValue(null), Browsable(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public ContextMenuStrip Menu { get; set; }
|
||||
|
||||
[DefaultValue(DefaultSplitWidth), Browsable(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
public int SplitWidth { get; set; } = DefaultSplitWidth;
|
||||
|
||||
public MenuButton()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs mevent)
|
||||
{
|
||||
var splitRect = new Rectangle(Width - SplitWidth, 0, SplitWidth, Height);
|
||||
|
||||
if ((Menu != null) && (mevent.Button == MouseButtons.Left) && splitRect.Contains(mevent.Location))
|
||||
{
|
||||
Menu.Show(this, 0, Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnMouseDown(mevent);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pevent)
|
||||
{
|
||||
base.OnPaint(pevent);
|
||||
|
||||
if ((Menu != null) && (SplitWidth > 0))
|
||||
{
|
||||
int arrowX = ClientRectangle.Width - 14;
|
||||
int arrowY = ClientRectangle.Height / 2 - 1;
|
||||
|
||||
var arrowBrush = Enabled ? SystemBrushes.ControlText : SystemBrushes.ButtonShadow;
|
||||
var arrows = new[] { new Point(arrowX, arrowY), new Point(arrowX + 7, arrowY), new Point(arrowX + 3, arrowY + 4) };
|
||||
pevent.Graphics.FillPolygon(arrowBrush, arrows);
|
||||
|
||||
int lineX = ClientRectangle.Width - SplitWidth;
|
||||
int lineYFrom = arrowY - 4;
|
||||
int lineYTo = arrowY + 8;
|
||||
using (var separatorPen = new Pen(Brushes.DarkGray) { DashStyle = DashStyle.Dot })
|
||||
{
|
||||
pevent.Graphics.DrawLine(separatorPen, lineX, lineYFrom, lineX, lineYTo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
345
CnCTDRAMapEditor/Controls/ObjectProperties.Designer.cs
generated
Normal file
345
CnCTDRAMapEditor/Controls/ObjectProperties.Designer.cs
generated
Normal file
|
@ -0,0 +1,345 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
partial class ObjectProperties
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.directionLabel = new System.Windows.Forms.Label();
|
||||
this.missionLabel = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.houseComboBox = new MobiusEditor.Controls.PropertiesComboBox();
|
||||
this.strengthNud = new System.Windows.Forms.NumericUpDown();
|
||||
this.directionComboBox = new MobiusEditor.Controls.PropertiesComboBox();
|
||||
this.missionComboBox = new MobiusEditor.Controls.PropertiesComboBox();
|
||||
this.triggerComboBox = new MobiusEditor.Controls.PropertiesComboBox();
|
||||
this.basePriorityNud = new System.Windows.Forms.NumericUpDown();
|
||||
this.prebuiltCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.basePriorityLabel = new System.Windows.Forms.Label();
|
||||
this.sellableCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.rebuildCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.strengthNud)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.basePriorityNud)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 2;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 31.25F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 68.75F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.directionLabel, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.missionLabel, 0, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label5, 0, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.houseComboBox, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.strengthNud, 1, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.directionComboBox, 1, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.missionComboBox, 1, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.triggerComboBox, 1, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.basePriorityNud, 1, 5);
|
||||
this.tableLayoutPanel1.Controls.Add(this.prebuiltCheckBox, 1, 7);
|
||||
this.tableLayoutPanel1.Controls.Add(this.basePriorityLabel, 0, 5);
|
||||
this.tableLayoutPanel1.Controls.Add(this.sellableCheckBox, 1, 8);
|
||||
this.tableLayoutPanel1.Controls.Add(this.rebuildCheckBox, 1, 9);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 11;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(299, 262);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label1.Location = new System.Drawing.Point(4, 0);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(85, 32);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "House";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label2.Location = new System.Drawing.Point(4, 32);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(85, 30);
|
||||
this.label2.TabIndex = 1;
|
||||
this.label2.Text = "Strength";
|
||||
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// directionLabel
|
||||
//
|
||||
this.directionLabel.AutoSize = true;
|
||||
this.directionLabel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.directionLabel.Location = new System.Drawing.Point(4, 62);
|
||||
this.directionLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.directionLabel.Name = "directionLabel";
|
||||
this.directionLabel.Size = new System.Drawing.Size(85, 32);
|
||||
this.directionLabel.TabIndex = 2;
|
||||
this.directionLabel.Text = "Direction";
|
||||
this.directionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// missionLabel
|
||||
//
|
||||
this.missionLabel.AutoSize = true;
|
||||
this.missionLabel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.missionLabel.Location = new System.Drawing.Point(4, 94);
|
||||
this.missionLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.missionLabel.Name = "missionLabel";
|
||||
this.missionLabel.Size = new System.Drawing.Size(85, 32);
|
||||
this.missionLabel.TabIndex = 3;
|
||||
this.missionLabel.Text = "Mission";
|
||||
this.missionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label5.Location = new System.Drawing.Point(4, 126);
|
||||
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(85, 32);
|
||||
this.label5.TabIndex = 4;
|
||||
this.label5.Text = "Trigger";
|
||||
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// houseComboBox
|
||||
//
|
||||
this.houseComboBox.DisplayMember = "Name";
|
||||
this.houseComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.houseComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.houseComboBox.FormattingEnabled = true;
|
||||
this.houseComboBox.Location = new System.Drawing.Point(97, 4);
|
||||
this.houseComboBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.houseComboBox.Name = "houseComboBox";
|
||||
this.houseComboBox.Size = new System.Drawing.Size(198, 24);
|
||||
this.houseComboBox.TabIndex = 5;
|
||||
this.houseComboBox.ValueMember = "Type";
|
||||
this.houseComboBox.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedValueChanged);
|
||||
//
|
||||
// strengthNud
|
||||
//
|
||||
this.strengthNud.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.strengthNud.Location = new System.Drawing.Point(97, 36);
|
||||
this.strengthNud.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.strengthNud.Maximum = new decimal(new int[] {
|
||||
256,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.strengthNud.Minimum = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.strengthNud.Name = "strengthNud";
|
||||
this.strengthNud.Size = new System.Drawing.Size(198, 22);
|
||||
this.strengthNud.TabIndex = 6;
|
||||
this.strengthNud.Value = new decimal(new int[] {
|
||||
256,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.strengthNud.ValueChanged += new System.EventHandler(this.nud_ValueChanged);
|
||||
//
|
||||
// directionComboBox
|
||||
//
|
||||
this.directionComboBox.DisplayMember = "Name";
|
||||
this.directionComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.directionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.directionComboBox.FormattingEnabled = true;
|
||||
this.directionComboBox.Location = new System.Drawing.Point(97, 66);
|
||||
this.directionComboBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.directionComboBox.Name = "directionComboBox";
|
||||
this.directionComboBox.Size = new System.Drawing.Size(198, 24);
|
||||
this.directionComboBox.TabIndex = 7;
|
||||
this.directionComboBox.ValueMember = "Type";
|
||||
this.directionComboBox.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedValueChanged);
|
||||
//
|
||||
// missionComboBox
|
||||
//
|
||||
this.missionComboBox.DisplayMember = "Name";
|
||||
this.missionComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.missionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.missionComboBox.FormattingEnabled = true;
|
||||
this.missionComboBox.Location = new System.Drawing.Point(97, 98);
|
||||
this.missionComboBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.missionComboBox.Name = "missionComboBox";
|
||||
this.missionComboBox.Size = new System.Drawing.Size(198, 24);
|
||||
this.missionComboBox.TabIndex = 8;
|
||||
this.missionComboBox.ValueMember = "Type";
|
||||
this.missionComboBox.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedValueChanged);
|
||||
//
|
||||
// triggerComboBox
|
||||
//
|
||||
this.triggerComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.triggerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.triggerComboBox.FormattingEnabled = true;
|
||||
this.triggerComboBox.Location = new System.Drawing.Point(97, 130);
|
||||
this.triggerComboBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.triggerComboBox.Name = "triggerComboBox";
|
||||
this.triggerComboBox.Size = new System.Drawing.Size(198, 24);
|
||||
this.triggerComboBox.TabIndex = 9;
|
||||
this.triggerComboBox.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedValueChanged);
|
||||
//
|
||||
// basePriorityNud
|
||||
//
|
||||
this.basePriorityNud.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.basePriorityNud.Location = new System.Drawing.Point(96, 160);
|
||||
this.basePriorityNud.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.basePriorityNud.Maximum = new decimal(new int[] {
|
||||
2147483647,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.basePriorityNud.Minimum = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.basePriorityNud.Name = "basePriorityNud";
|
||||
this.basePriorityNud.Size = new System.Drawing.Size(200, 22);
|
||||
this.basePriorityNud.TabIndex = 11;
|
||||
this.basePriorityNud.ValueChanged += new System.EventHandler(this.nud_ValueChanged);
|
||||
//
|
||||
// prebuiltCheckBox
|
||||
//
|
||||
this.prebuiltCheckBox.AutoSize = true;
|
||||
this.prebuiltCheckBox.Location = new System.Drawing.Point(96, 186);
|
||||
this.prebuiltCheckBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.prebuiltCheckBox.Name = "prebuiltCheckBox";
|
||||
this.prebuiltCheckBox.Size = new System.Drawing.Size(78, 21);
|
||||
this.prebuiltCheckBox.TabIndex = 12;
|
||||
this.prebuiltCheckBox.Text = "Prebuilt";
|
||||
this.prebuiltCheckBox.UseVisualStyleBackColor = true;
|
||||
this.prebuiltCheckBox.CheckedChanged += new System.EventHandler(this.checkBox_CheckedChanged);
|
||||
//
|
||||
// basePriorityLabel
|
||||
//
|
||||
this.basePriorityLabel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.basePriorityLabel.Location = new System.Drawing.Point(3, 158);
|
||||
this.basePriorityLabel.Name = "basePriorityLabel";
|
||||
this.basePriorityLabel.Size = new System.Drawing.Size(87, 26);
|
||||
this.basePriorityLabel.TabIndex = 13;
|
||||
this.basePriorityLabel.Text = "Base Priority";
|
||||
this.basePriorityLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// sellableCheckBox
|
||||
//
|
||||
this.sellableCheckBox.AutoSize = true;
|
||||
this.sellableCheckBox.Location = new System.Drawing.Point(96, 211);
|
||||
this.sellableCheckBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.sellableCheckBox.Name = "sellableCheckBox";
|
||||
this.sellableCheckBox.Size = new System.Drawing.Size(80, 21);
|
||||
this.sellableCheckBox.TabIndex = 14;
|
||||
this.sellableCheckBox.Text = "Sellable";
|
||||
this.sellableCheckBox.UseVisualStyleBackColor = true;
|
||||
this.sellableCheckBox.CheckedChanged += new System.EventHandler(this.checkBox_CheckedChanged);
|
||||
//
|
||||
// rebuildCheckBox
|
||||
//
|
||||
this.rebuildCheckBox.AutoSize = true;
|
||||
this.rebuildCheckBox.Location = new System.Drawing.Point(96, 236);
|
||||
this.rebuildCheckBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.rebuildCheckBox.Name = "rebuildCheckBox";
|
||||
this.rebuildCheckBox.Size = new System.Drawing.Size(78, 21);
|
||||
this.rebuildCheckBox.TabIndex = 15;
|
||||
this.rebuildCheckBox.Text = "Rebuild";
|
||||
this.rebuildCheckBox.UseVisualStyleBackColor = true;
|
||||
this.rebuildCheckBox.CheckedChanged += new System.EventHandler(this.checkBox_CheckedChanged);
|
||||
//
|
||||
// ObjectProperties
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.Name = "ObjectProperties";
|
||||
this.Size = new System.Drawing.Size(299, 262);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.strengthNud)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.basePriorityNud)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label directionLabel;
|
||||
private System.Windows.Forms.Label missionLabel;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private MobiusEditor.Controls.PropertiesComboBox houseComboBox;
|
||||
private System.Windows.Forms.NumericUpDown strengthNud;
|
||||
private MobiusEditor.Controls.PropertiesComboBox directionComboBox;
|
||||
private MobiusEditor.Controls.PropertiesComboBox missionComboBox;
|
||||
private MobiusEditor.Controls.PropertiesComboBox triggerComboBox;
|
||||
private System.Windows.Forms.NumericUpDown basePriorityNud;
|
||||
private System.Windows.Forms.CheckBox prebuiltCheckBox;
|
||||
private System.Windows.Forms.Label basePriorityLabel;
|
||||
private System.Windows.Forms.CheckBox sellableCheckBox;
|
||||
private System.Windows.Forms.CheckBox rebuildCheckBox;
|
||||
}
|
||||
}
|
272
CnCTDRAMapEditor/Controls/ObjectProperties.cs
Normal file
272
CnCTDRAMapEditor/Controls/ObjectProperties.cs
Normal file
|
@ -0,0 +1,272 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
using MobiusEditor.Interface;
|
||||
using MobiusEditor.Model;
|
||||
using MobiusEditor.Utility;
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
public partial class ObjectProperties : UserControl
|
||||
{
|
||||
private bool isMockObject;
|
||||
|
||||
public IGamePlugin Plugin { get; private set; }
|
||||
|
||||
private INotifyPropertyChanged obj;
|
||||
public INotifyPropertyChanged Object
|
||||
{
|
||||
get => obj;
|
||||
set
|
||||
{
|
||||
if (obj != value)
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
obj.PropertyChanged -= Obj_PropertyChanged;
|
||||
}
|
||||
|
||||
obj = value;
|
||||
|
||||
if (obj != null)
|
||||
{
|
||||
obj.PropertyChanged += Obj_PropertyChanged;
|
||||
}
|
||||
|
||||
Rebind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ObjectProperties()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void Initialize(IGamePlugin plugin, bool isMockObject)
|
||||
{
|
||||
this.isMockObject = isMockObject;
|
||||
|
||||
Plugin = plugin;
|
||||
plugin.Map.Triggers.CollectionChanged += Triggers_CollectionChanged;
|
||||
|
||||
houseComboBox.DataSource = plugin.Map.Houses.Select(t => new TypeItem<HouseType>(t.Type.Name, t.Type)).ToArray();
|
||||
missionComboBox.DataSource = plugin.Map.MissionTypes;
|
||||
|
||||
UpdateDataSource();
|
||||
|
||||
Disposed += (sender, e) =>
|
||||
{
|
||||
Object = null;
|
||||
plugin.Map.Triggers.CollectionChanged -= Triggers_CollectionChanged;
|
||||
};
|
||||
}
|
||||
|
||||
private void Triggers_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
UpdateDataSource();
|
||||
}
|
||||
|
||||
private void UpdateDataSource()
|
||||
{
|
||||
triggerComboBox.DataSource = Trigger.None.Yield().Concat(Plugin.Map.Triggers.Select(t => t.Name).Distinct()).ToArray();
|
||||
}
|
||||
|
||||
private void Rebind()
|
||||
{
|
||||
houseComboBox.DataBindings.Clear();
|
||||
strengthNud.DataBindings.Clear();
|
||||
directionComboBox.DataBindings.Clear();
|
||||
missionComboBox.DataBindings.Clear();
|
||||
triggerComboBox.DataBindings.Clear();
|
||||
basePriorityNud.DataBindings.Clear();
|
||||
prebuiltCheckBox.DataBindings.Clear();
|
||||
sellableCheckBox.DataBindings.Clear();
|
||||
rebuildCheckBox.DataBindings.Clear();
|
||||
|
||||
if (obj == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (obj)
|
||||
{
|
||||
case Infantry infantry:
|
||||
{
|
||||
houseComboBox.Enabled = true;
|
||||
directionComboBox.DataSource = Plugin.Map.DirectionTypes
|
||||
.Where(t => t.Facing != FacingType.None)
|
||||
.Select(t => new TypeItem<DirectionType>(t.Name, t)).ToArray();
|
||||
|
||||
missionComboBox.DataBindings.Add("SelectedItem", obj, "Mission");
|
||||
missionLabel.Visible = missionComboBox.Visible = true;
|
||||
basePriorityLabel.Visible = basePriorityNud.Visible = false;
|
||||
prebuiltCheckBox.Visible = false;
|
||||
sellableCheckBox.Visible = false;
|
||||
rebuildCheckBox.Visible = false;
|
||||
}
|
||||
break;
|
||||
case Unit unit:
|
||||
{
|
||||
houseComboBox.Enabled = true;
|
||||
directionComboBox.DataSource = Plugin.Map.DirectionTypes.Select(t => new TypeItem<DirectionType>(t.Name, t)).ToArray();
|
||||
missionComboBox.DataBindings.Add("SelectedItem", obj, "Mission");
|
||||
missionLabel.Visible = missionComboBox.Visible = true;
|
||||
basePriorityLabel.Visible = basePriorityNud.Visible = false;
|
||||
prebuiltCheckBox.Visible = false;
|
||||
sellableCheckBox.Visible = false;
|
||||
rebuildCheckBox.Visible = false;
|
||||
}
|
||||
break;
|
||||
case Building building:
|
||||
{
|
||||
houseComboBox.Enabled = building.IsPrebuilt;
|
||||
directionComboBox.DataSource = Plugin.Map.DirectionTypes.Select(t => new TypeItem<DirectionType>(t.Name, t)).ToArray();
|
||||
directionComboBox.Visible = (building.Type != null) && building.Type.HasTurret;
|
||||
missionLabel.Visible = missionComboBox.Visible = false;
|
||||
basePriorityLabel.Visible = basePriorityNud.Visible = true;
|
||||
prebuiltCheckBox.Visible = true;
|
||||
prebuiltCheckBox.Enabled = building.BasePriority >= 0;
|
||||
|
||||
basePriorityNud.DataBindings.Add("Value", obj, "BasePriority");
|
||||
prebuiltCheckBox.DataBindings.Add("Checked", obj, "IsPrebuilt");
|
||||
|
||||
switch (Plugin.GameType)
|
||||
{
|
||||
case GameType.TiberianDawn:
|
||||
{
|
||||
sellableCheckBox.Visible = false;
|
||||
rebuildCheckBox.Visible = false;
|
||||
} break;
|
||||
case GameType.RedAlert:
|
||||
{
|
||||
sellableCheckBox.DataBindings.Add("Checked", obj, "Sellable");
|
||||
rebuildCheckBox.DataBindings.Add("Checked", obj, "Rebuild");
|
||||
sellableCheckBox.Visible = true;
|
||||
rebuildCheckBox.Visible = true;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
houseComboBox.DataBindings.Add("SelectedValue", obj, "House");
|
||||
strengthNud.DataBindings.Add("Value", obj, "Strength");
|
||||
directionComboBox.DataBindings.Add("SelectedValue", obj, "Direction");
|
||||
triggerComboBox.DataBindings.Add("SelectedItem", obj, "Trigger");
|
||||
}
|
||||
|
||||
private void Obj_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
switch (e.PropertyName)
|
||||
{
|
||||
case "Type":
|
||||
{
|
||||
Rebind();
|
||||
}
|
||||
break;
|
||||
case "BasePriority":
|
||||
{
|
||||
if (obj is Building building)
|
||||
{
|
||||
prebuiltCheckBox.Enabled = building.BasePriority >= 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "IsPrebuilt":
|
||||
{
|
||||
if (obj is Building building)
|
||||
{
|
||||
if (!building.IsPrebuilt)
|
||||
{
|
||||
var basePlayer = Plugin.Map.HouseTypes.Where(h => h.Equals(Plugin.Map.BasicSection.BasePlayer)).FirstOrDefault() ?? Plugin.Map.HouseTypes.First();
|
||||
building.House = basePlayer;
|
||||
}
|
||||
houseComboBox.Enabled = building.IsPrebuilt;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
||||
if (!isMockObject)
|
||||
{
|
||||
Plugin.Dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBox_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
foreach (Binding binding in (sender as ComboBox).DataBindings)
|
||||
{
|
||||
binding.WriteValue();
|
||||
}
|
||||
}
|
||||
|
||||
private void nud_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
foreach (Binding binding in (sender as NumericUpDown).DataBindings)
|
||||
{
|
||||
binding.WriteValue();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
foreach (Binding binding in (sender as CheckBox).DataBindings)
|
||||
{
|
||||
binding.WriteValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ObjectPropertiesPopup : ToolStripDropDown
|
||||
{
|
||||
private readonly ToolStripControlHost host;
|
||||
|
||||
public ObjectProperties ObjectProperties { get; private set; }
|
||||
|
||||
public ObjectPropertiesPopup(IGamePlugin plugin, INotifyPropertyChanged obj)
|
||||
{
|
||||
ObjectProperties = new ObjectProperties();
|
||||
ObjectProperties.Initialize(plugin, false);
|
||||
ObjectProperties.Object = obj;
|
||||
|
||||
host = new ToolStripControlHost(ObjectProperties);
|
||||
Padding = Margin = host.Padding = host.Margin = Padding.Empty;
|
||||
MinimumSize = ObjectProperties.MinimumSize;
|
||||
ObjectProperties.MinimumSize = ObjectProperties.Size;
|
||||
MaximumSize = ObjectProperties.MaximumSize;
|
||||
ObjectProperties.MaximumSize = ObjectProperties.Size;
|
||||
Size = ObjectProperties.Size;
|
||||
Items.Add(host);
|
||||
ObjectProperties.Disposed += (sender, e) =>
|
||||
{
|
||||
ObjectProperties = null;
|
||||
Dispose(true);
|
||||
};
|
||||
}
|
||||
|
||||
protected override void OnClosed(ToolStripDropDownClosedEventArgs e)
|
||||
{
|
||||
base.OnClosed(e);
|
||||
|
||||
ObjectProperties.Object = null;
|
||||
}
|
||||
}
|
||||
}
|
120
CnCTDRAMapEditor/Controls/ObjectProperties.resx
Normal file
120
CnCTDRAMapEditor/Controls/ObjectProperties.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
375
CnCTDRAMapEditor/Controls/PlayerSettings.Designer.cs
generated
Normal file
375
CnCTDRAMapEditor/Controls/PlayerSettings.Designer.cs
generated
Normal file
|
@ -0,0 +1,375 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
partial class PlayerSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.iqNud = new System.Windows.Forms.NumericUpDown();
|
||||
this.techLevelNud = new System.Windows.Forms.NumericUpDown();
|
||||
this.maxVesselsNud = new System.Windows.Forms.NumericUpDown();
|
||||
this.maxInfantryNud = new System.Windows.Forms.NumericUpDown();
|
||||
this.iqLbl = new System.Windows.Forms.Label();
|
||||
this.techLevelLbl = new System.Windows.Forms.Label();
|
||||
this.maxVesselsLbl = new System.Windows.Forms.Label();
|
||||
this.maxInfantryLbl = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.edgeComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.creditsNud = new System.Windows.Forms.NumericUpDown();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.maxBuildingsNud = new System.Windows.Forms.NumericUpDown();
|
||||
this.maxUnitsNud = new System.Windows.Forms.NumericUpDown();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.playersListBox = new System.Windows.Forms.ListBox();
|
||||
this.playerControlLbl = new System.Windows.Forms.Label();
|
||||
this.playerControlCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.iqNud)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.techLevelNud)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.maxVesselsNud)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.maxInfantryNud)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.creditsNud)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.maxBuildingsNud)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.maxUnitsNud)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.AutoSize = true;
|
||||
this.tableLayoutPanel1.ColumnCount = 2;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel1.Controls.Add(this.playerControlLbl, 0, 8);
|
||||
this.tableLayoutPanel1.Controls.Add(this.iqNud, 1, 7);
|
||||
this.tableLayoutPanel1.Controls.Add(this.techLevelNud, 1, 6);
|
||||
this.tableLayoutPanel1.Controls.Add(this.maxVesselsNud, 1, 5);
|
||||
this.tableLayoutPanel1.Controls.Add(this.maxInfantryNud, 1, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.iqLbl, 0, 7);
|
||||
this.tableLayoutPanel1.Controls.Add(this.techLevelLbl, 0, 6);
|
||||
this.tableLayoutPanel1.Controls.Add(this.maxVesselsLbl, 0, 5);
|
||||
this.tableLayoutPanel1.Controls.Add(this.maxInfantryLbl, 0, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.edgeComboBox, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.creditsNud, 1, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label3, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label4, 0, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.maxBuildingsNud, 1, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.maxUnitsNud, 1, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.label5, 0, 9);
|
||||
this.tableLayoutPanel1.Controls.Add(this.playersListBox, 1, 9);
|
||||
this.tableLayoutPanel1.Controls.Add(this.playerControlCheckBox, 1, 8);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 10;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(329, 372);
|
||||
this.tableLayoutPanel1.TabIndex = 2;
|
||||
//
|
||||
// iqNud
|
||||
//
|
||||
this.iqNud.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.iqNud.Location = new System.Drawing.Point(81, 186);
|
||||
this.iqNud.Maximum = new decimal(new int[] {
|
||||
2147483647,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.iqNud.Name = "iqNud";
|
||||
this.iqNud.Size = new System.Drawing.Size(245, 20);
|
||||
this.iqNud.TabIndex = 26;
|
||||
//
|
||||
// techLevelNud
|
||||
//
|
||||
this.techLevelNud.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.techLevelNud.Location = new System.Drawing.Point(81, 160);
|
||||
this.techLevelNud.Maximum = new decimal(new int[] {
|
||||
2147483647,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.techLevelNud.Name = "techLevelNud";
|
||||
this.techLevelNud.Size = new System.Drawing.Size(245, 20);
|
||||
this.techLevelNud.TabIndex = 25;
|
||||
//
|
||||
// maxVesselsNud
|
||||
//
|
||||
this.maxVesselsNud.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.maxVesselsNud.Location = new System.Drawing.Point(81, 134);
|
||||
this.maxVesselsNud.Maximum = new decimal(new int[] {
|
||||
2147483647,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.maxVesselsNud.Name = "maxVesselsNud";
|
||||
this.maxVesselsNud.Size = new System.Drawing.Size(245, 20);
|
||||
this.maxVesselsNud.TabIndex = 24;
|
||||
//
|
||||
// maxInfantryNud
|
||||
//
|
||||
this.maxInfantryNud.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.maxInfantryNud.Location = new System.Drawing.Point(81, 108);
|
||||
this.maxInfantryNud.Maximum = new decimal(new int[] {
|
||||
2147483647,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.maxInfantryNud.Name = "maxInfantryNud";
|
||||
this.maxInfantryNud.Size = new System.Drawing.Size(245, 20);
|
||||
this.maxInfantryNud.TabIndex = 23;
|
||||
//
|
||||
// iqLbl
|
||||
//
|
||||
this.iqLbl.AutoSize = true;
|
||||
this.iqLbl.Location = new System.Drawing.Point(3, 183);
|
||||
this.iqLbl.Name = "iqLbl";
|
||||
this.iqLbl.Size = new System.Drawing.Size(18, 13);
|
||||
this.iqLbl.TabIndex = 22;
|
||||
this.iqLbl.Text = "IQ";
|
||||
//
|
||||
// techLevelLbl
|
||||
//
|
||||
this.techLevelLbl.AutoSize = true;
|
||||
this.techLevelLbl.Location = new System.Drawing.Point(3, 157);
|
||||
this.techLevelLbl.Name = "techLevelLbl";
|
||||
this.techLevelLbl.Size = new System.Drawing.Size(61, 13);
|
||||
this.techLevelLbl.TabIndex = 21;
|
||||
this.techLevelLbl.Text = "Tech Level";
|
||||
//
|
||||
// maxVesselsLbl
|
||||
//
|
||||
this.maxVesselsLbl.AutoSize = true;
|
||||
this.maxVesselsLbl.Location = new System.Drawing.Point(3, 131);
|
||||
this.maxVesselsLbl.Name = "maxVesselsLbl";
|
||||
this.maxVesselsLbl.Size = new System.Drawing.Size(66, 13);
|
||||
this.maxVesselsLbl.TabIndex = 20;
|
||||
this.maxVesselsLbl.Text = "Max Vessels";
|
||||
//
|
||||
// maxInfantryLbl
|
||||
//
|
||||
this.maxInfantryLbl.AutoSize = true;
|
||||
this.maxInfantryLbl.Location = new System.Drawing.Point(3, 105);
|
||||
this.maxInfantryLbl.Name = "maxInfantryLbl";
|
||||
this.maxInfantryLbl.Size = new System.Drawing.Size(65, 13);
|
||||
this.maxInfantryLbl.TabIndex = 19;
|
||||
this.maxInfantryLbl.Text = "Max Infantry";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(3, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(32, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Edge";
|
||||
//
|
||||
// edgeComboBox
|
||||
//
|
||||
this.edgeComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.edgeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.edgeComboBox.FormattingEnabled = true;
|
||||
this.edgeComboBox.Location = new System.Drawing.Point(81, 3);
|
||||
this.edgeComboBox.Name = "edgeComboBox";
|
||||
this.edgeComboBox.Size = new System.Drawing.Size(245, 21);
|
||||
this.edgeComboBox.TabIndex = 10;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(3, 27);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(39, 13);
|
||||
this.label2.TabIndex = 11;
|
||||
this.label2.Text = "Credits";
|
||||
//
|
||||
// creditsNud
|
||||
//
|
||||
this.creditsNud.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.creditsNud.Location = new System.Drawing.Point(81, 30);
|
||||
this.creditsNud.Maximum = new decimal(new int[] {
|
||||
2147483647,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.creditsNud.Name = "creditsNud";
|
||||
this.creditsNud.Size = new System.Drawing.Size(245, 20);
|
||||
this.creditsNud.TabIndex = 12;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(3, 53);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(72, 13);
|
||||
this.label3.TabIndex = 13;
|
||||
this.label3.Text = "Max Buildings";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(3, 79);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(54, 13);
|
||||
this.label4.TabIndex = 14;
|
||||
this.label4.Text = "Max Units";
|
||||
//
|
||||
// maxBuildingsNud
|
||||
//
|
||||
this.maxBuildingsNud.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.maxBuildingsNud.Location = new System.Drawing.Point(81, 56);
|
||||
this.maxBuildingsNud.Maximum = new decimal(new int[] {
|
||||
2147483647,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.maxBuildingsNud.Name = "maxBuildingsNud";
|
||||
this.maxBuildingsNud.Size = new System.Drawing.Size(245, 20);
|
||||
this.maxBuildingsNud.TabIndex = 15;
|
||||
//
|
||||
// maxUnitsNud
|
||||
//
|
||||
this.maxUnitsNud.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.maxUnitsNud.Location = new System.Drawing.Point(81, 82);
|
||||
this.maxUnitsNud.Maximum = new decimal(new int[] {
|
||||
2147483647,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.maxUnitsNud.Name = "maxUnitsNud";
|
||||
this.maxUnitsNud.Size = new System.Drawing.Size(245, 20);
|
||||
this.maxUnitsNud.TabIndex = 16;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(3, 229);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(31, 13);
|
||||
this.label5.TabIndex = 17;
|
||||
this.label5.Text = "Allies";
|
||||
//
|
||||
// playersListBox
|
||||
//
|
||||
this.playersListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.playersListBox.FormattingEnabled = true;
|
||||
this.playersListBox.Location = new System.Drawing.Point(81, 232);
|
||||
this.playersListBox.Name = "playersListBox";
|
||||
this.playersListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
|
||||
this.playersListBox.Size = new System.Drawing.Size(100, 134);
|
||||
this.playersListBox.TabIndex = 18;
|
||||
//
|
||||
// playerControlLbl
|
||||
//
|
||||
this.playerControlLbl.AutoSize = true;
|
||||
this.playerControlLbl.Location = new System.Drawing.Point(3, 209);
|
||||
this.playerControlLbl.Name = "playerControlLbl";
|
||||
this.playerControlLbl.Size = new System.Drawing.Size(72, 13);
|
||||
this.playerControlLbl.TabIndex = 27;
|
||||
this.playerControlLbl.Text = "Player Control";
|
||||
//
|
||||
// playerControlCheckBox
|
||||
//
|
||||
this.playerControlCheckBox.AutoSize = true;
|
||||
this.playerControlCheckBox.Location = new System.Drawing.Point(81, 212);
|
||||
this.playerControlCheckBox.Name = "playerControlCheckBox";
|
||||
this.playerControlCheckBox.Size = new System.Drawing.Size(15, 14);
|
||||
this.playerControlCheckBox.TabIndex = 28;
|
||||
this.playerControlCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// PlayerSettings
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Name = "PlayerSettings";
|
||||
this.Size = new System.Drawing.Size(329, 372);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.iqNud)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.techLevelNud)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.maxVesselsNud)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.maxInfantryNud)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.creditsNud)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.maxBuildingsNud)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.maxUnitsNud)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ComboBox edgeComboBox;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.NumericUpDown creditsNud;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.NumericUpDown maxBuildingsNud;
|
||||
private System.Windows.Forms.NumericUpDown maxUnitsNud;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.ListBox playersListBox;
|
||||
private System.Windows.Forms.Label techLevelLbl;
|
||||
private System.Windows.Forms.Label maxVesselsLbl;
|
||||
private System.Windows.Forms.Label maxInfantryLbl;
|
||||
private System.Windows.Forms.Label iqLbl;
|
||||
private System.Windows.Forms.NumericUpDown maxVesselsNud;
|
||||
private System.Windows.Forms.NumericUpDown maxInfantryNud;
|
||||
private System.Windows.Forms.NumericUpDown iqNud;
|
||||
private System.Windows.Forms.NumericUpDown techLevelNud;
|
||||
private System.Windows.Forms.Label playerControlLbl;
|
||||
private System.Windows.Forms.CheckBox playerControlCheckBox;
|
||||
}
|
||||
}
|
86
CnCTDRAMapEditor/Controls/PlayerSettings.cs
Normal file
86
CnCTDRAMapEditor/Controls/PlayerSettings.cs
Normal file
|
@ -0,0 +1,86 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
using MobiusEditor.Interface;
|
||||
using MobiusEditor.Model;
|
||||
using MobiusEditor.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
public partial class PlayerSettings : UserControl
|
||||
{
|
||||
private readonly PropertyTracker<House> houseSettingsTracker;
|
||||
private readonly dynamic house;
|
||||
|
||||
public PlayerSettings(IGamePlugin plugin, PropertyTracker<House> houseSettingsTracker)
|
||||
{
|
||||
this.houseSettingsTracker = houseSettingsTracker;
|
||||
house = houseSettingsTracker;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
edgeComboBox.Items.Clear();
|
||||
edgeComboBox.Items.AddRange(new string[] { "North", "South", "West", "East" });
|
||||
|
||||
creditsNud.DataBindings.Add("Value", houseSettingsTracker, "Credits");
|
||||
maxBuildingsNud.DataBindings.Add("Value", houseSettingsTracker, "MaxBuilding");
|
||||
maxUnitsNud.DataBindings.Add("Value", houseSettingsTracker, "MaxUnit");
|
||||
edgeComboBox.DataBindings.Add("SelectedItem", houseSettingsTracker, "Edge");
|
||||
|
||||
switch (plugin.GameType)
|
||||
{
|
||||
case GameType.TiberianDawn:
|
||||
maxInfantryNud.Visible = maxInfantryLbl.Visible = false;
|
||||
maxVesselsNud.Visible = maxVesselsLbl.Visible = false;
|
||||
techLevelNud.Visible = techLevelLbl.Visible = false;
|
||||
iqNud.Visible = iqLbl.Visible = false;
|
||||
playerControlCheckBox.Visible = playerControlLbl.Visible = false;
|
||||
break;
|
||||
case GameType.RedAlert:
|
||||
maxInfantryNud.DataBindings.Add("Value", houseSettingsTracker, "MaxInfantry");
|
||||
maxVesselsNud.DataBindings.Add("Value", houseSettingsTracker, "MaxVessel");
|
||||
techLevelNud.DataBindings.Add("Value", houseSettingsTracker, "TechLevel");
|
||||
iqNud.DataBindings.Add("Value", houseSettingsTracker, "IQ");
|
||||
playerControlCheckBox.DataBindings.Add("Checked", houseSettingsTracker, "PlayerControl");
|
||||
break;
|
||||
}
|
||||
|
||||
playersListBox.Items.Clear();
|
||||
playersListBox.Items.AddRange(plugin.Map.Houses.Select(h => h.Type.Name).ToArray());
|
||||
|
||||
var selectedIndices = new List<int>();
|
||||
foreach (var id in house.Allies)
|
||||
{
|
||||
playersListBox.SetSelected(id, true);
|
||||
}
|
||||
|
||||
playersListBox.SelectedIndexChanged += playersListBox_SelectedIndexChanged;
|
||||
}
|
||||
|
||||
private void playersListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
var allies = 0;
|
||||
foreach (int selectedIndex in playersListBox.SelectedIndices)
|
||||
{
|
||||
allies |= 1 << selectedIndex;
|
||||
}
|
||||
house.Allies = new AlliesMask(allies);
|
||||
}
|
||||
}
|
||||
}
|
120
CnCTDRAMapEditor/Controls/PlayerSettings.resx
Normal file
120
CnCTDRAMapEditor/Controls/PlayerSettings.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
50
CnCTDRAMapEditor/Controls/PropertiesComboBox.Designer.cs
generated
Normal file
50
CnCTDRAMapEditor/Controls/PropertiesComboBox.Designer.cs
generated
Normal file
|
@ -0,0 +1,50 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
partial class PropertiesComboBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
65
CnCTDRAMapEditor/Controls/PropertiesComboBox.cs
Normal file
65
CnCTDRAMapEditor/Controls/PropertiesComboBox.cs
Normal file
|
@ -0,0 +1,65 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
public partial class PropertiesComboBox : ComboBox
|
||||
{
|
||||
private bool savedAutoClose;
|
||||
|
||||
private ToolStripDropDown DropDownHost
|
||||
{
|
||||
get
|
||||
{
|
||||
var parent = Parent;
|
||||
while ((parent != null) && !(parent is ToolStripDropDown))
|
||||
{
|
||||
parent = parent.Parent;
|
||||
}
|
||||
return parent as ToolStripDropDown;
|
||||
}
|
||||
}
|
||||
|
||||
public PropertiesComboBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnDropDownClosed(EventArgs e)
|
||||
{
|
||||
var dropDownHost = DropDownHost;
|
||||
if (dropDownHost != null)
|
||||
{
|
||||
dropDownHost.AutoClose = savedAutoClose;
|
||||
}
|
||||
|
||||
base.OnDropDownClosed(e);
|
||||
}
|
||||
|
||||
protected override void OnDropDown(EventArgs e)
|
||||
{
|
||||
var dropDownHost = DropDownHost;
|
||||
if (dropDownHost != null)
|
||||
{
|
||||
savedAutoClose = dropDownHost.AutoClose;
|
||||
dropDownHost.AutoClose = false;
|
||||
}
|
||||
|
||||
base.OnDropDown(e);
|
||||
}
|
||||
}
|
||||
}
|
112
CnCTDRAMapEditor/Controls/TerrainProperties.Designer.cs
generated
Normal file
112
CnCTDRAMapEditor/Controls/TerrainProperties.Designer.cs
generated
Normal file
|
@ -0,0 +1,112 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
partial class TerrainProperties
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.triggerComboBox = new MobiusEditor.Controls.PropertiesComboBox();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 2;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 31.25F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 68.75F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.label5, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.triggerComboBox, 1, 0);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 1;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(336, 38);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.label5.Location = new System.Drawing.Point(4, 0);
|
||||
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(97, 38);
|
||||
this.label5.TabIndex = 4;
|
||||
this.label5.Text = "Trigger";
|
||||
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// triggerComboBox
|
||||
//
|
||||
this.triggerComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.triggerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.triggerComboBox.FormattingEnabled = true;
|
||||
this.triggerComboBox.Location = new System.Drawing.Point(109, 5);
|
||||
this.triggerComboBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.triggerComboBox.Name = "triggerComboBox";
|
||||
this.triggerComboBox.Size = new System.Drawing.Size(223, 28);
|
||||
this.triggerComboBox.TabIndex = 9;
|
||||
this.triggerComboBox.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedValueChanged);
|
||||
//
|
||||
// TriggerProperties
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
|
||||
this.Name = "TriggerProperties";
|
||||
this.Size = new System.Drawing.Size(336, 38);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private MobiusEditor.Controls.PropertiesComboBox triggerComboBox;
|
||||
}
|
||||
}
|
158
CnCTDRAMapEditor/Controls/TerrainProperties.cs
Normal file
158
CnCTDRAMapEditor/Controls/TerrainProperties.cs
Normal file
|
@ -0,0 +1,158 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
using MobiusEditor.Interface;
|
||||
using MobiusEditor.Model;
|
||||
using MobiusEditor.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
public partial class TerrainProperties : UserControl
|
||||
{
|
||||
private bool isMockObject;
|
||||
|
||||
public IGamePlugin Plugin { get; private set; }
|
||||
|
||||
private Terrain terrain;
|
||||
public Terrain Terrain
|
||||
{
|
||||
get => terrain;
|
||||
set
|
||||
{
|
||||
if (terrain != value)
|
||||
{
|
||||
terrain = value;
|
||||
Rebind();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TerrainProperties()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void Initialize(IGamePlugin plugin, bool isMockObject)
|
||||
{
|
||||
this.isMockObject = isMockObject;
|
||||
|
||||
Plugin = plugin;
|
||||
plugin.Map.Triggers.CollectionChanged += Triggers_CollectionChanged;
|
||||
|
||||
UpdateDataSource();
|
||||
|
||||
Disposed += (sender, e) =>
|
||||
{
|
||||
Terrain = null;
|
||||
plugin.Map.Triggers.CollectionChanged -= Triggers_CollectionChanged;
|
||||
};
|
||||
}
|
||||
|
||||
private void Triggers_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
UpdateDataSource();
|
||||
}
|
||||
|
||||
private void UpdateDataSource()
|
||||
{
|
||||
triggerComboBox.DataSource = Trigger.None.Yield().Concat(Plugin.Map.Triggers.Select(t => t.Name).Distinct()).ToArray();
|
||||
}
|
||||
|
||||
private void Rebind()
|
||||
{
|
||||
triggerComboBox.DataBindings.Clear();
|
||||
|
||||
if (terrain == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
triggerComboBox.DataBindings.Add("SelectedItem", terrain, "Trigger");
|
||||
}
|
||||
|
||||
private void Obj_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
switch (e.PropertyName)
|
||||
{
|
||||
case "Type":
|
||||
{
|
||||
Rebind();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isMockObject)
|
||||
{
|
||||
Plugin.Dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBox_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
foreach (Binding binding in (sender as ComboBox).DataBindings)
|
||||
{
|
||||
binding.WriteValue();
|
||||
}
|
||||
}
|
||||
|
||||
private void nud_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
foreach (Binding binding in (sender as NumericUpDown).DataBindings)
|
||||
{
|
||||
binding.WriteValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TerrainPropertiesPopup : ToolStripDropDown
|
||||
{
|
||||
private readonly ToolStripControlHost host;
|
||||
|
||||
public TerrainProperties TerrainProperties { get; private set; }
|
||||
|
||||
public TerrainPropertiesPopup(IGamePlugin plugin, Terrain terrain)
|
||||
{
|
||||
TerrainProperties = new TerrainProperties();
|
||||
TerrainProperties.Initialize(plugin, false);
|
||||
TerrainProperties.Terrain = terrain;
|
||||
|
||||
host = new ToolStripControlHost(TerrainProperties);
|
||||
Padding = Margin = host.Padding = host.Margin = Padding.Empty;
|
||||
MinimumSize = TerrainProperties.MinimumSize;
|
||||
TerrainProperties.MinimumSize = TerrainProperties.Size;
|
||||
MaximumSize = TerrainProperties.MaximumSize;
|
||||
TerrainProperties.MaximumSize = TerrainProperties.Size;
|
||||
Size = TerrainProperties.Size;
|
||||
Items.Add(host);
|
||||
TerrainProperties.Disposed += (sender, e) =>
|
||||
{
|
||||
TerrainProperties = null;
|
||||
Dispose(true);
|
||||
};
|
||||
}
|
||||
|
||||
protected override void OnClosed(ToolStripDropDownClosedEventArgs e)
|
||||
{
|
||||
base.OnClosed(e);
|
||||
|
||||
TerrainProperties.Terrain = null;
|
||||
}
|
||||
}
|
||||
}
|
120
CnCTDRAMapEditor/Controls/TerrainProperties.resx
Normal file
120
CnCTDRAMapEditor/Controls/TerrainProperties.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
50
CnCTDRAMapEditor/Controls/TypeComboBox.Designer.cs
generated
Normal file
50
CnCTDRAMapEditor/Controls/TypeComboBox.Designer.cs
generated
Normal file
|
@ -0,0 +1,50 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
partial class TypeComboBox
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
98
CnCTDRAMapEditor/Controls/TypeComboBox.cs
Normal file
98
CnCTDRAMapEditor/Controls/TypeComboBox.cs
Normal file
|
@ -0,0 +1,98 @@
|
|||
//
|
||||
// Copyright 2020 Electronic Arts Inc.
|
||||
//
|
||||
// The Command & Conquer Map Editor and corresponding source code is free
|
||||
// software: you can redistribute it and/or modify it under the terms of
|
||||
// the GNU General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
// The Command & Conquer Map Editor and corresponding source code is distributed
|
||||
// in the hope that it will be useful, but with permitted additional restrictions
|
||||
// under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
|
||||
// distributed with this program. You should have received a copy of the
|
||||
// GNU General Public License along with permitted additional restrictions
|
||||
// with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
|
||||
using MobiusEditor.Interface;
|
||||
using MobiusEditor.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MobiusEditor.Controls
|
||||
{
|
||||
public partial class TypeComboBox : ComboBox
|
||||
{
|
||||
[Category("Behavior")]
|
||||
public Image MissingThumbnail { get; set; } = SystemIcons.Error.ToBitmap();
|
||||
|
||||
public IEnumerable<IBrowsableType> Types
|
||||
{
|
||||
get => Items.Cast<TypeItem<IBrowsableType>>().Select(t => t.Type);
|
||||
set
|
||||
{
|
||||
DataSource = value.Select(t => new TypeItem<IBrowsableType>(t.DisplayName, t)).ToArray();
|
||||
DropDownHeight = Math.Max(DropDownHeight, value.Max(t => (t.Thumbnail?.Height ?? MissingThumbnail.Height) * 3));
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public IBrowsableType SelectedType => SelectedValue as IBrowsableType;
|
||||
|
||||
public TypeComboBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DisplayMember = "Name";
|
||||
ValueMember = "Type";
|
||||
}
|
||||
|
||||
protected override void OnMeasureItem(MeasureItemEventArgs e)
|
||||
{
|
||||
base.OnMeasureItem(e);
|
||||
|
||||
var typeItem = Items[e.Index] as TypeItem<IBrowsableType>;
|
||||
if (typeItem?.Type != null)
|
||||
{
|
||||
e.ItemHeight = typeItem.Type.Thumbnail?.Height ?? MissingThumbnail.Height;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDrawItem(DrawItemEventArgs e)
|
||||
{
|
||||
base.OnDrawItem(e);
|
||||
|
||||
e.DrawBackground();
|
||||
|
||||
if ((e.Index >= 0) && (e.Index < Items.Count))
|
||||
{
|
||||
var typeItem = Items[e.Index] as TypeItem<IBrowsableType>;
|
||||
if (typeItem?.Type != null)
|
||||
{
|
||||
StringFormat stringFormat = new StringFormat
|
||||
{
|
||||
LineAlignment = StringAlignment.Center
|
||||
};
|
||||
|
||||
var textColor = ((e.State & DrawItemState.Selected) == DrawItemState.Selected) ? SystemBrushes.HighlightText : SystemBrushes.WindowText;
|
||||
var textSize = e.Graphics.MeasureString(typeItem.Name, Font, e.Bounds.Width, stringFormat);
|
||||
e.Graphics.DrawString(typeItem.Name, Font, textColor, e.Bounds, stringFormat);
|
||||
|
||||
if ((e.State & DrawItemState.ComboBoxEdit) == DrawItemState.None)
|
||||
{
|
||||
var thumbnail = typeItem.Type.Thumbnail ?? MissingThumbnail;
|
||||
var thumbnailWidth = (int)Math.Min(e.Bounds.Width - textSize.Width, thumbnail.Width);
|
||||
var thumbnailSize = new Size(thumbnailWidth, thumbnailWidth * thumbnail.Height / thumbnail.Width);
|
||||
var thumbnailBounds = new Rectangle(new Point(e.Bounds.Right - thumbnailSize.Width, e.Bounds.Top), thumbnailSize);
|
||||
e.Graphics.DrawImage(thumbnail, thumbnailBounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
e.DrawFocusRectangle();
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue