mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-23 02:12:14 +00:00
Categorize Shiftorium GUI
This commit is contained in:
parent
3e56dfce88
commit
47561a09ea
2 changed files with 154 additions and 34 deletions
|
@ -56,20 +56,26 @@ namespace ShiftOS.WinForms.Applications
|
|||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.lbcodepoints = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.lbupgradedesc = new System.Windows.Forms.Label();
|
||||
this.pnlupgradeactions = new System.Windows.Forms.Panel();
|
||||
this.btnbuy = new System.Windows.Forms.Button();
|
||||
this.lbupgradetitle = new System.Windows.Forms.Label();
|
||||
this.pnllist = new System.Windows.Forms.Panel();
|
||||
this.lbcodepoints = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.pgupgradeprogress = new ShiftOS.WinForms.Controls.ShiftedProgressBar();
|
||||
this.lbupgrades = new System.Windows.Forms.ListBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.btncat_back = new System.Windows.Forms.Button();
|
||||
this.btncat_forward = new System.Windows.Forms.Button();
|
||||
this.lblcategorytext = new System.Windows.Forms.Label();
|
||||
this.lbnoupgrades = new System.Windows.Forms.Label();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.pnlupgradeactions.SuspendLayout();
|
||||
this.pnllist.SuspendLayout();
|
||||
this.panel3.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
|
@ -93,17 +99,6 @@ namespace ShiftOS.WinForms.Applications
|
|||
this.panel2.Size = new System.Drawing.Size(376, 427);
|
||||
this.panel2.TabIndex = 1;
|
||||
//
|
||||
// lbcodepoints
|
||||
//
|
||||
this.lbcodepoints.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lbcodepoints.AutoSize = true;
|
||||
this.lbcodepoints.Location = new System.Drawing.Point(128, 357);
|
||||
this.lbcodepoints.Name = "lbcodepoints";
|
||||
this.lbcodepoints.Size = new System.Drawing.Size(135, 13);
|
||||
this.lbcodepoints.TabIndex = 3;
|
||||
this.lbcodepoints.Text = "You have: %cp Codepoints";
|
||||
this.lbcodepoints.Click += new System.EventHandler(this.lbcodepoints_Click);
|
||||
//
|
||||
// lbupgradedesc
|
||||
//
|
||||
this.lbupgradedesc.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
|
@ -152,6 +147,8 @@ namespace ShiftOS.WinForms.Applications
|
|||
//
|
||||
// pnllist
|
||||
//
|
||||
this.pnllist.Controls.Add(this.lbnoupgrades);
|
||||
this.pnllist.Controls.Add(this.panel3);
|
||||
this.pnllist.Controls.Add(this.lbcodepoints);
|
||||
this.pnllist.Controls.Add(this.label1);
|
||||
this.pnllist.Controls.Add(this.pgupgradeprogress);
|
||||
|
@ -162,6 +159,17 @@ namespace ShiftOS.WinForms.Applications
|
|||
this.pnllist.Size = new System.Drawing.Size(406, 427);
|
||||
this.pnllist.TabIndex = 0;
|
||||
//
|
||||
// lbcodepoints
|
||||
//
|
||||
this.lbcodepoints.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.lbcodepoints.AutoSize = true;
|
||||
this.lbcodepoints.Location = new System.Drawing.Point(128, 357);
|
||||
this.lbcodepoints.Name = "lbcodepoints";
|
||||
this.lbcodepoints.Size = new System.Drawing.Size(135, 13);
|
||||
this.lbcodepoints.TabIndex = 3;
|
||||
this.lbcodepoints.Text = "You have: %cp Codepoints";
|
||||
this.lbcodepoints.Click += new System.EventHandler(this.lbcodepoints_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
|
@ -172,15 +180,6 @@ namespace ShiftOS.WinForms.Applications
|
|||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "{UPGRADE_PROGRESS}:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(3, 399);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(137, 13);
|
||||
this.label3.TabIndex = 2;
|
||||
//
|
||||
// pgupgradeprogress
|
||||
//
|
||||
this.pgupgradeprogress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
|
@ -201,12 +200,78 @@ namespace ShiftOS.WinForms.Applications
|
|||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lbupgrades.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
|
||||
this.lbupgrades.FormattingEnabled = true;
|
||||
this.lbupgrades.Location = new System.Drawing.Point(3, 66);
|
||||
this.lbupgrades.Location = new System.Drawing.Point(3, 105);
|
||||
this.lbupgrades.Name = "lbupgrades";
|
||||
this.lbupgrades.Size = new System.Drawing.Size(397, 277);
|
||||
this.lbupgrades.Size = new System.Drawing.Size(397, 238);
|
||||
this.lbupgrades.TabIndex = 0;
|
||||
this.lbupgrades.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.lbupgrades_DrawItem);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(3, 399);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(137, 13);
|
||||
this.label3.TabIndex = 2;
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
this.panel3.Controls.Add(this.lblcategorytext);
|
||||
this.panel3.Controls.Add(this.btncat_forward);
|
||||
this.panel3.Controls.Add(this.btncat_back);
|
||||
this.panel3.Location = new System.Drawing.Point(6, 76);
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.Size = new System.Drawing.Size(394, 23);
|
||||
this.panel3.TabIndex = 5;
|
||||
//
|
||||
// btncat_back
|
||||
//
|
||||
this.btncat_back.AutoSize = true;
|
||||
this.btncat_back.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btncat_back.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.btncat_back.Location = new System.Drawing.Point(0, 0);
|
||||
this.btncat_back.Name = "btncat_back";
|
||||
this.btncat_back.Size = new System.Drawing.Size(29, 23);
|
||||
this.btncat_back.TabIndex = 0;
|
||||
this.btncat_back.Text = "<--";
|
||||
this.btncat_back.UseVisualStyleBackColor = true;
|
||||
this.btncat_back.Click += new System.EventHandler(this.btncat_back_Click);
|
||||
//
|
||||
// btncat_forward
|
||||
//
|
||||
this.btncat_forward.AutoSize = true;
|
||||
this.btncat_forward.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btncat_forward.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.btncat_forward.Location = new System.Drawing.Point(365, 0);
|
||||
this.btncat_forward.Name = "btncat_forward";
|
||||
this.btncat_forward.Size = new System.Drawing.Size(29, 23);
|
||||
this.btncat_forward.TabIndex = 1;
|
||||
this.btncat_forward.Text = "-->";
|
||||
this.btncat_forward.UseVisualStyleBackColor = true;
|
||||
this.btncat_forward.Click += new System.EventHandler(this.btncat_forward_Click);
|
||||
//
|
||||
// lblcategorytext
|
||||
//
|
||||
this.lblcategorytext.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lblcategorytext.Location = new System.Drawing.Point(29, 0);
|
||||
this.lblcategorytext.Name = "lblcategorytext";
|
||||
this.lblcategorytext.Size = new System.Drawing.Size(336, 23);
|
||||
this.lblcategorytext.TabIndex = 2;
|
||||
this.lblcategorytext.Text = "label2";
|
||||
this.lblcategorytext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lbnoupgrades
|
||||
//
|
||||
this.lbnoupgrades.AutoSize = true;
|
||||
this.lbnoupgrades.Location = new System.Drawing.Point(69, 183);
|
||||
this.lbnoupgrades.Name = "lbnoupgrades";
|
||||
this.lbnoupgrades.Size = new System.Drawing.Size(71, 13);
|
||||
this.lbnoupgrades.TabIndex = 6;
|
||||
this.lbnoupgrades.Tag = "header2";
|
||||
this.lbnoupgrades.Text = "No upgrades!";
|
||||
this.lbnoupgrades.Visible = false;
|
||||
//
|
||||
// ShiftoriumFrontend
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -215,7 +280,6 @@ namespace ShiftOS.WinForms.Applications
|
|||
this.Controls.Add(this.panel1);
|
||||
this.ForeColor = System.Drawing.Color.LightGreen;
|
||||
this.Name = "ShiftoriumFrontend";
|
||||
this.Text = "{SHIFTORIUM_NAME}";
|
||||
this.Size = new System.Drawing.Size(782, 427);
|
||||
this.Load += new System.EventHandler(this.Shiftorium_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
|
@ -224,6 +288,8 @@ namespace ShiftOS.WinForms.Applications
|
|||
this.pnlupgradeactions.PerformLayout();
|
||||
this.pnllist.ResumeLayout(false);
|
||||
this.pnllist.PerformLayout();
|
||||
this.panel3.ResumeLayout(false);
|
||||
this.panel3.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
@ -242,5 +308,10 @@ namespace ShiftOS.WinForms.Applications
|
|||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label lbcodepoints;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Panel panel3;
|
||||
private System.Windows.Forms.Label lblcategorytext;
|
||||
private System.Windows.Forms.Button btncat_forward;
|
||||
private System.Windows.Forms.Button btncat_back;
|
||||
private System.Windows.Forms.Label lbnoupgrades;
|
||||
}
|
||||
}
|
|
@ -45,7 +45,7 @@ namespace ShiftOS.WinForms.Applications
|
|||
[DefaultIcon("iconShiftorium")]
|
||||
public partial class ShiftoriumFrontend : UserControl, IShiftOSWindow
|
||||
{
|
||||
|
||||
public int CategoryId = 0;
|
||||
public static System.Timers.Timer timer100;
|
||||
|
||||
|
||||
|
@ -90,15 +90,45 @@ namespace ShiftOS.WinForms.Applications
|
|||
|
||||
public void PopulateShiftorium()
|
||||
{
|
||||
lbupgrades.Items.Clear();
|
||||
upgrades.Clear();
|
||||
Timer();
|
||||
|
||||
foreach (var upg in backend.GetAvailable())
|
||||
try
|
||||
{
|
||||
String name = Localization.Parse(upg.Name) + " - " + upg.Cost.ToString() + "CP";
|
||||
upgrades.Add(name, upg);
|
||||
lbupgrades.Items.Add(name);
|
||||
lbnoupgrades.Hide();
|
||||
lbupgrades.Items.Clear();
|
||||
upgrades.Clear();
|
||||
Timer();
|
||||
|
||||
foreach (var upg in backend.GetAvailable().Where(x => x.Category == backend.GetCategories()[CategoryId]))
|
||||
{
|
||||
String name = Localization.Parse(upg.Name) + " - " + upg.Cost.ToString() + "CP";
|
||||
upgrades.Add(name, upg);
|
||||
lbupgrades.Items.Add(name);
|
||||
}
|
||||
|
||||
if (lbupgrades.Items.Count == 0)
|
||||
{
|
||||
lbnoupgrades.Show();
|
||||
lbnoupgrades.Location = new Point(
|
||||
(lbupgrades.Width - lbnoupgrades.Width) / 2,
|
||||
(lbupgrades.Height - lbnoupgrades.Height) / 2
|
||||
);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
lbnoupgrades.Hide();
|
||||
}
|
||||
lblcategorytext.Text = Shiftorium.GetCategories()[CategoryId];
|
||||
btncat_back.Visible = (CategoryId > 0);
|
||||
btncat_forward.Visible = (CategoryId < backend.GetCategories().Length - 1);
|
||||
}
|
||||
catch
|
||||
{
|
||||
lbnoupgrades.Show();
|
||||
lbnoupgrades.Location = new Point(
|
||||
(lbupgrades.Width - lbnoupgrades.Width) / 2,
|
||||
(lbupgrades.Height - lbnoupgrades.Height) / 2
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,6 +216,7 @@ namespace ShiftOS.WinForms.Applications
|
|||
public void OnLoad()
|
||||
{
|
||||
cp_update.Start();
|
||||
lbnoupgrades.Hide();
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
|
@ -221,5 +252,23 @@ namespace ShiftOS.WinForms.Applications
|
|||
timer100.AutoReset = true;
|
||||
timer100.Enabled = true;
|
||||
}
|
||||
|
||||
private void btncat_back_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(CategoryId > 0)
|
||||
{
|
||||
CategoryId--;
|
||||
PopulateShiftorium();
|
||||
}
|
||||
}
|
||||
|
||||
private void btncat_forward_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(CategoryId < backend.GetCategories().Length - 1)
|
||||
{
|
||||
CategoryId++;
|
||||
PopulateShiftorium();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue