From 5b8d350af0dc2a9862fa3a8007be362fc91e6eba Mon Sep 17 00:00:00 2001 From: AShifter Date: Tue, 2 May 2017 19:43:58 -0600 Subject: fix advance file skimmer it looks better --- ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs index a7b7aa5..d19d639 100644 --- a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs +++ b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs @@ -69,10 +69,9 @@ namespace ShiftOS.WinForms.Applications // // lvitems // - this.lvitems.Dock = System.Windows.Forms.DockStyle.Right; - this.lvitems.Location = new System.Drawing.Point(120, 0); + this.lvitems.Location = new System.Drawing.Point(135, 0); this.lvitems.Name = "lvitems"; - this.lvitems.Size = new System.Drawing.Size(514, 332); + this.lvitems.Size = new System.Drawing.Size(499, 332); this.lvitems.TabIndex = 0; this.lvitems.UseCompatibleStateImageBehavior = false; this.lvitems.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lvitems_ItemSelectionChanged); @@ -81,8 +80,8 @@ namespace ShiftOS.WinForms.Applications // // panel1 // - this.panel1.Controls.Add(this.pinnedItems); this.panel1.Controls.Add(this.lvitems); + this.panel1.Controls.Add(this.pinnedItems); this.panel1.Controls.Add(this.lbcurrentfolder); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 24); @@ -92,10 +91,10 @@ namespace ShiftOS.WinForms.Applications // // pinnedItems // - this.pinnedItems.Dock = System.Windows.Forms.DockStyle.Left; + this.pinnedItems.Dock = System.Windows.Forms.DockStyle.Fill; this.pinnedItems.Location = new System.Drawing.Point(0, 0); this.pinnedItems.Name = "pinnedItems"; - this.pinnedItems.Size = new System.Drawing.Size(114, 332); + this.pinnedItems.Size = new System.Drawing.Size(634, 332); this.pinnedItems.TabIndex = 3; // // lbcurrentfolder -- cgit v1.2.3 From 2fede89938014129cf50d66d5ff62af1bde4a477 Mon Sep 17 00:00:00 2001 From: AShifter Date: Tue, 2 May 2017 20:08:43 -0600 Subject: Catch invalid skin file I accidentally tried to load 0.0.x skin file, and it crashed. Added a try/catch around it and if caught, give an infobox saying "This skin is not compatible with this version of ShiftOS.". --- ShiftOS.WinForms/Applications/Skin Loader.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/Skin Loader.cs b/ShiftOS.WinForms/Applications/Skin Loader.cs index 1f09e4a..f9857b7 100644 --- a/ShiftOS.WinForms/Applications/Skin Loader.cs +++ b/ShiftOS.WinForms/Applications/Skin Loader.cs @@ -313,7 +313,15 @@ namespace ShiftOS.WinForms.Applications { AppearanceManager.SetupDialog(new FileDialog(new[] { ".skn" }, FileOpenerStyle.Open, new Action((filename) => { - LoadedSkin = JsonConvert.DeserializeObject(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(filename)); + try + { + LoadedSkin = JsonConvert.DeserializeObject(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(filename)); + } + catch + { + Infobox.Show("Invalid Skin", "This skin is not compatible with this version of ShiftOS."); + } + SetupUI(); }))); } -- cgit v1.2.3 From e43d47007e8ef5d18a0b58b9c1c24ca6e5212e18 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 4 May 2017 14:59:58 -0400 Subject: More Multiplayer Pong work. --- ShiftOS.WinForms/Applications/Pong.Designer.cs | 171 +++++++++++++++---------- ShiftOS.WinForms/Applications/Pong.cs | 87 ++++++++++--- 2 files changed, 176 insertions(+), 82 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/Pong.Designer.cs b/ShiftOS.WinForms/Applications/Pong.Designer.cs index b1186c6..d0ff466 100644 --- a/ShiftOS.WinForms/Applications/Pong.Designer.cs +++ b/ShiftOS.WinForms/Applications/Pong.Designer.cs @@ -79,6 +79,14 @@ namespace ShiftOS.WinForms.Applications this.tmrcountdown = new System.Windows.Forms.Timer(this.components); this.tmrstoryline = new System.Windows.Forms.Timer(this.components); this.pgcontents = new ShiftOS.WinForms.Controls.Canvas(); + this.pnlmultiplayerhandshake = new System.Windows.Forms.Panel(); + this.lvotherplayers = new System.Windows.Forms.ListView(); + this.lbmpstatus = new System.Windows.Forms.Label(); + this.pnlintro = new System.Windows.Forms.Panel(); + this.btnmatchmake = new System.Windows.Forms.Button(); + this.Label6 = new System.Windows.Forms.Label(); + this.btnstartgame = new System.Windows.Forms.Button(); + this.Label8 = new System.Windows.Forms.Label(); this.pnlhighscore = new System.Windows.Forms.Panel(); this.lbhighscore = new System.Windows.Forms.ListView(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); @@ -111,10 +119,6 @@ namespace ShiftOS.WinForms.Applications this.btnlosetryagain = new System.Windows.Forms.Button(); this.Label5 = new System.Windows.Forms.Label(); this.Label1 = new System.Windows.Forms.Label(); - this.pnlintro = new System.Windows.Forms.Panel(); - this.Label6 = new System.Windows.Forms.Label(); - this.btnstartgame = new System.Windows.Forms.Button(); - this.Label8 = new System.Windows.Forms.Label(); this.lblbeatai = new System.Windows.Forms.Label(); this.lblcountdown = new System.Windows.Forms.Label(); this.ball = new ShiftOS.WinForms.Controls.Canvas(); @@ -124,14 +128,14 @@ namespace ShiftOS.WinForms.Applications this.lblstatscodepoints = new System.Windows.Forms.Label(); this.lblstatsY = new System.Windows.Forms.Label(); this.lblstatsX = new System.Windows.Forms.Label(); - this.btnmatchmake = new System.Windows.Forms.Button(); this.pgcontents.SuspendLayout(); + this.pnlmultiplayerhandshake.SuspendLayout(); + this.pnlintro.SuspendLayout(); this.pnlhighscore.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); this.pnlgamestats.SuspendLayout(); this.pnlfinalstats.SuspendLayout(); this.pnllose.SuspendLayout(); - this.pnlintro.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.paddleHuman)).BeginInit(); this.SuspendLayout(); // @@ -158,6 +162,7 @@ namespace ShiftOS.WinForms.Applications // pgcontents // this.pgcontents.BackColor = System.Drawing.Color.White; + this.pgcontents.Controls.Add(this.pnlmultiplayerhandshake); this.pgcontents.Controls.Add(this.pnlintro); this.pgcontents.Controls.Add(this.pnlhighscore); this.pgcontents.Controls.Add(this.pnlgamestats); @@ -180,6 +185,95 @@ namespace ShiftOS.WinForms.Applications this.pgcontents.Paint += new System.Windows.Forms.PaintEventHandler(this.pgcontents_Paint); this.pgcontents.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pongMain_MouseMove); // + // pnlmultiplayerhandshake + // + this.pnlmultiplayerhandshake.Controls.Add(this.lvotherplayers); + this.pnlmultiplayerhandshake.Controls.Add(this.lbmpstatus); + this.pnlmultiplayerhandshake.Location = new System.Drawing.Point(446, 88); + this.pnlmultiplayerhandshake.Name = "pnlmultiplayerhandshake"; + this.pnlmultiplayerhandshake.Size = new System.Drawing.Size(396, 231); + this.pnlmultiplayerhandshake.TabIndex = 15; + // + // lvotherplayers + // + this.lvotherplayers.Dock = System.Windows.Forms.DockStyle.Fill; + this.lvotherplayers.Location = new System.Drawing.Point(0, 45); + this.lvotherplayers.MultiSelect = false; + this.lvotherplayers.Name = "lvotherplayers"; + this.lvotherplayers.Size = new System.Drawing.Size(396, 186); + this.lvotherplayers.TabIndex = 1; + this.lvotherplayers.UseCompatibleStateImageBehavior = false; + this.lvotherplayers.View = System.Windows.Forms.View.Details; + this.lvotherplayers.DoubleClick += new System.EventHandler(this.lvotherplayers_DoubleClick); + // + // lbmpstatus + // + this.lbmpstatus.Dock = System.Windows.Forms.DockStyle.Top; + this.lbmpstatus.Location = new System.Drawing.Point(0, 0); + this.lbmpstatus.Name = "lbmpstatus"; + this.lbmpstatus.Size = new System.Drawing.Size(396, 45); + this.lbmpstatus.TabIndex = 0; + this.lbmpstatus.Tag = "header2"; + this.lbmpstatus.Text = "Waiting for other players..."; + this.lbmpstatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // pnlintro + // + this.pnlintro.Controls.Add(this.btnmatchmake); + this.pnlintro.Controls.Add(this.Label6); + this.pnlintro.Controls.Add(this.btnstartgame); + this.pnlintro.Controls.Add(this.Label8); + this.pnlintro.Location = new System.Drawing.Point(0, 0); + this.pnlintro.Name = "pnlintro"; + this.pnlintro.Size = new System.Drawing.Size(595, 303); + this.pnlintro.TabIndex = 13; + this.pnlintro.Tag = "header2"; + // + // btnmatchmake + // + this.btnmatchmake.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnmatchmake.Location = new System.Drawing.Point(188, 253); + this.btnmatchmake.Name = "btnmatchmake"; + this.btnmatchmake.Size = new System.Drawing.Size(242, 28); + this.btnmatchmake.TabIndex = 16; + this.btnmatchmake.Text = "Or, play against another Shifter!"; + this.btnmatchmake.UseVisualStyleBackColor = true; + this.btnmatchmake.Click += new System.EventHandler(this.btnmatchmake_Click); + // + // Label6 + // + this.Label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label6.Location = new System.Drawing.Point(3, 39); + this.Label6.Name = "Label6"; + this.Label6.Size = new System.Drawing.Size(589, 159); + this.Label6.TabIndex = 15; + this.Label6.Text = "{PONG_DESC}"; + this.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.Label6.Click += new System.EventHandler(this.Label6_Click); + // + // btnstartgame + // + this.btnstartgame.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnstartgame.Location = new System.Drawing.Point(188, 215); + this.btnstartgame.Name = "btnstartgame"; + this.btnstartgame.Size = new System.Drawing.Size(242, 28); + this.btnstartgame.TabIndex = 15; + this.btnstartgame.Text = "{PLAY}"; + this.btnstartgame.UseVisualStyleBackColor = true; + this.btnstartgame.Click += new System.EventHandler(this.btnstartgame_Click); + // + // Label8 + // + this.Label8.AutoSize = true; + this.Label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label8.ForeColor = System.Drawing.Color.Black; + this.Label8.Location = new System.Drawing.Point(250, 5); + this.Label8.Name = "Label8"; + this.Label8.Size = new System.Drawing.Size(280, 31); + this.Label8.TabIndex = 14; + this.Label8.Text = "{PONG_WELCOME}"; + this.Label8.Click += new System.EventHandler(this.Label8_Click); + // // pnlhighscore // this.pnlhighscore.Controls.Add(this.lbhighscore); @@ -525,52 +619,6 @@ namespace ShiftOS.WinForms.Applications this.Label1.Text = "You lose!"; this.Label1.TextAlign = System.Drawing.ContentAlignment.TopCenter; // - // pnlintro - // - this.pnlintro.Controls.Add(this.btnmatchmake); - this.pnlintro.Controls.Add(this.Label6); - this.pnlintro.Controls.Add(this.btnstartgame); - this.pnlintro.Controls.Add(this.Label8); - this.pnlintro.Location = new System.Drawing.Point(0, 0); - this.pnlintro.Name = "pnlintro"; - this.pnlintro.Size = new System.Drawing.Size(595, 303); - this.pnlintro.TabIndex = 13; - this.pnlintro.Tag = "header2"; - // - // Label6 - // - this.Label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label6.Location = new System.Drawing.Point(3, 39); - this.Label6.Name = "Label6"; - this.Label6.Size = new System.Drawing.Size(589, 159); - this.Label6.TabIndex = 15; - this.Label6.Text = "{PONG_DESC}"; - this.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.Label6.Click += new System.EventHandler(this.Label6_Click); - // - // btnstartgame - // - this.btnstartgame.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnstartgame.Location = new System.Drawing.Point(188, 215); - this.btnstartgame.Name = "btnstartgame"; - this.btnstartgame.Size = new System.Drawing.Size(242, 28); - this.btnstartgame.TabIndex = 15; - this.btnstartgame.Text = "{PLAY}"; - this.btnstartgame.UseVisualStyleBackColor = true; - this.btnstartgame.Click += new System.EventHandler(this.btnstartgame_Click); - // - // Label8 - // - this.Label8.AutoSize = true; - this.Label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label8.ForeColor = System.Drawing.Color.Black; - this.Label8.Location = new System.Drawing.Point(250, 5); - this.Label8.Name = "Label8"; - this.Label8.Size = new System.Drawing.Size(280, 31); - this.Label8.TabIndex = 14; - this.Label8.Text = "{PONG_WELCOME}"; - this.Label8.Click += new System.EventHandler(this.Label8_Click); - // // lblbeatai // this.lblbeatai.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -675,17 +723,6 @@ namespace ShiftOS.WinForms.Applications this.lblstatsX.Text = "Xspeed: "; this.lblstatsX.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // btnmatchmake - // - this.btnmatchmake.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnmatchmake.Location = new System.Drawing.Point(188, 253); - this.btnmatchmake.Name = "btnmatchmake"; - this.btnmatchmake.Size = new System.Drawing.Size(242, 28); - this.btnmatchmake.TabIndex = 16; - this.btnmatchmake.Text = "Or, play against another Shifter!"; - this.btnmatchmake.UseVisualStyleBackColor = true; - this.btnmatchmake.Click += new System.EventHandler(this.btnmatchmake_Click); - // // Pong // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -699,6 +736,9 @@ namespace ShiftOS.WinForms.Applications this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pongMain_MouseMove); this.pgcontents.ResumeLayout(false); this.pgcontents.PerformLayout(); + this.pnlmultiplayerhandshake.ResumeLayout(false); + this.pnlintro.ResumeLayout(false); + this.pnlintro.PerformLayout(); this.pnlhighscore.ResumeLayout(false); this.pnlhighscore.PerformLayout(); this.flowLayoutPanel1.ResumeLayout(false); @@ -708,8 +748,6 @@ namespace ShiftOS.WinForms.Applications this.pnlfinalstats.ResumeLayout(false); this.pnlfinalstats.PerformLayout(); this.pnllose.ResumeLayout(false); - this.pnlintro.ResumeLayout(false); - this.pnlintro.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.paddleHuman)).EndInit(); this.ResumeLayout(false); @@ -765,5 +803,8 @@ namespace ShiftOS.WinForms.Applications private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.Button button2; internal System.Windows.Forms.Button btnmatchmake; + private System.Windows.Forms.Panel pnlmultiplayerhandshake; + private System.Windows.Forms.ListView lvotherplayers; + private System.Windows.Forms.Label lbmpstatus; } } diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index 585639a..ad81197 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -368,50 +368,84 @@ namespace ShiftOS.WinForms.Applications public void ServerMessageReceivedHandler(ServerMessage msg) { - if(msg.Name == "pong_mp_setballpos") + if (msg.Name == "pong_mp_setballpos") { var pt = JsonConvert.DeserializeObject(msg.Contents); LeaderX = pt.X; LeaderY = pt.Y; } - else if(msg.Name == "pong_mp_youlose") + else if (msg.Name == "pong_mp_youlose") { LoseMP(); } - else if(msg.Name == "pong_mp_setopponenty") + else if (msg.Name == "pong_mp_setopponenty") { int y = Convert.ToInt32(msg.Contents); OpponentY = y; } - else if(msg.Name == "pong_handshake_matchmake") + else if (msg.Name == "pong_handshake_matchmake") { - PossibleMatchmakes.Add(msg.Contents); + if (!PossibleMatchmakes.Contains(msg.Contents)) + PossibleMatchmakes.Add(msg.Contents); + this.Invoke(new Action(ListMatchmakes)); } - else if(msg.Name == "pong_handshake_complete") + else if (msg.Name == "pong_handshake_resendid") { + ServerManager.Forward("all", "pong_handshake_matchmake", YouGUID); + } + else if (msg.Name == "pong_handshake_complete") + { + IsLeader = true; + + OpponentGUID = msg.Contents; LeaveMatchmake(); - StartLevel(); + this.Invoke(new Action(() => + { + pnlmultiplayerhandshake.Hide(); + StartLevel(); + })); } - else if(msg.Name == "pong_handshake_giveleaderid") + else if (msg.Name == "pong_handshake_chosen") { IsLeader = false; OpponentGUID = msg.Contents; YouGUID = ServerManager.thisGuid.ToString(); SendFollowerGUID(); + this.Invoke(new Action(() => + { + pnlmultiplayerhandshake.Hide(); + })); } - else if(msg.Name == "pong_handshake_left") + else if (msg.Name == "pong_handshake_left") { if (this.PossibleMatchmakes.Contains(msg.Contents)) this.PossibleMatchmakes.Remove(msg.Contents); + this.Invoke(new Action(ListMatchmakes)); } - else if(msg.Name == "pong_handshake_setfollowerguid") + else if (msg.Name == "pong_mp_youwin") { - IsLeader = false; - OpponentGUID = msg.Contents; + Win(); } - else if(msg.Name == "pong_mp_youwin") + } + + public void ListMatchmakes() + { + lvotherplayers.Items.Clear(); + lvotherplayers.FullRowSelect = true; + foreach (var itm in PossibleMatchmakes) { - Win(); + var l = new ListViewItem(); + l.Text = itm; + lvotherplayers.Items.Add(l); + } + + if (PossibleMatchmakes.Count > 0) + { + lbmpstatus.Text = "Select a player."; + } + else + { + lbmpstatus.Text = "Waiting for players..."; } } @@ -432,9 +466,9 @@ namespace ShiftOS.WinForms.Applications List PossibleMatchmakes = new List(); - public void SendLeaderGUID() + public void SendLeaderGUID(string target) { - ServerManager.Forward(OpponentGUID, "pong_handshake_giveleaderid", YouGUID); + ServerManager.Forward(target, "pong_handshake_chosen", YouGUID); } @@ -443,12 +477,23 @@ namespace ShiftOS.WinForms.Applications IsMultiplayerSession = true; YouGUID = ServerManager.thisGuid.ToString(); ServerManager.SendMessage("pong_handshake_matchmake", YouGUID); + StartMatchmake(); + } + + public void StartMatchmake() + { + pnlmultiplayerhandshake.Show(); + pnlmultiplayerhandshake.CenterParent(); + pnlmultiplayerhandshake.BringToFront(); + + ServerManager.Forward("all", "pong_handshake_resendid", null); + } public void SendFollowerGUID() { - ServerManager.Forward(OpponentGUID, "pong_handshake_setfollowerguid", YouGUID); + ServerManager.Forward(OpponentGUID, "pong_handshake_complete", YouGUID); } public void LoseMP() @@ -973,5 +1018,13 @@ namespace ShiftOS.WinForms.Applications lblcountdown.Text = "Waiting for another player..."; lblcountdown.Left = (this.Width - lblcountdown.Width) / 2; } + + private void lvotherplayers_DoubleClick(object sender, EventArgs e) + { + if(lvotherplayers.SelectedItems.Count > 0) + { + SendLeaderGUID(lvotherplayers.SelectedItems[0].Text); + } + } } } -- cgit v1.2.3 From 41da0b25000f93cf405d6bf18a1597e2616731bd Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 4 May 2017 16:06:32 -0400 Subject: fix bug with multiplayer ui --- ShiftOS.WinForms/Applications/Pong.Designer.cs | 1 + ShiftOS.WinForms/Applications/Pong.cs | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/Pong.Designer.cs b/ShiftOS.WinForms/Applications/Pong.Designer.cs index d0ff466..0254e94 100644 --- a/ShiftOS.WinForms/Applications/Pong.Designer.cs +++ b/ShiftOS.WinForms/Applications/Pong.Designer.cs @@ -193,6 +193,7 @@ namespace ShiftOS.WinForms.Applications this.pnlmultiplayerhandshake.Name = "pnlmultiplayerhandshake"; this.pnlmultiplayerhandshake.Size = new System.Drawing.Size(396, 231); this.pnlmultiplayerhandshake.TabIndex = 15; + this.pnlmultiplayerhandshake.Visible = false; // // lvotherplayers // diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index ad81197..3e93c34 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -374,6 +374,14 @@ namespace ShiftOS.WinForms.Applications LeaderX = pt.X; LeaderY = pt.Y; } + else if(msg.Name == "pong_mp_left") + { + this.Invoke(new Action(() => + { + AppearanceManager.Close(this); + })); + Infobox.Show("Opponent has closed Pong.", "The opponent has closed Pong, therefore the connection between you two has dropped."); + } else if (msg.Name == "pong_mp_youlose") { LoseMP(); @@ -408,6 +416,7 @@ namespace ShiftOS.WinForms.Applications else if (msg.Name == "pong_handshake_chosen") { IsLeader = false; + LeaveMatchmake(); OpponentGUID = msg.Contents; YouGUID = ServerManager.thisGuid.ToString(); SendFollowerGUID(); @@ -984,6 +993,7 @@ namespace ShiftOS.WinForms.Applications pnlfinalstats.Hide(); CenterPanels(); lblbeatai.Hide(); + ServerManager.MessageReceived += this.ServerMessageReceivedHandler; } public void OnSkinLoad() @@ -997,6 +1007,14 @@ namespace ShiftOS.WinForms.Applications public bool OnUnload() { + if(IsMultiplayerSession == true) + { + if(!string.IsNullOrWhiteSpace(OpponentGUID)) + ServerManager.Forward(OpponentGUID, "pong_mp_left", null); + } + LeaveMatchmake(); + ServerManager.MessageReceived -= this.ServerMessageReceivedHandler; + return true; } -- cgit v1.2.3 From 3e77916fd2363cdeb3f45267166bf5e72dee7082 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 4 May 2017 16:32:25 -0400 Subject: Fix CRITICAL Pong MP bugs. --- ShiftOS.WinForms/Applications/Pong.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index 3e93c34..04c963f 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -384,7 +384,7 @@ namespace ShiftOS.WinForms.Applications } else if (msg.Name == "pong_mp_youlose") { - LoseMP(); + this.Invoke(new Action(LoseMP)); } else if (msg.Name == "pong_mp_setopponenty") { @@ -433,19 +433,28 @@ namespace ShiftOS.WinForms.Applications } else if (msg.Name == "pong_mp_youwin") { - Win(); + this.Invoke(new Action(Win)); } } public void ListMatchmakes() { lvotherplayers.Items.Clear(); + var c = new ColumnHeader(); + c.Width = lvotherplayers.Width; + c.Text = "Player"; + lvotherplayers.Columns.Clear(); + lvotherplayers.Columns.Add(c); + lvotherplayers.FullRowSelect = true; foreach (var itm in PossibleMatchmakes) { - var l = new ListViewItem(); - l.Text = itm; - lvotherplayers.Items.Add(l); + if (itm != YouGUID) + { + var l = new ListViewItem(); + l.Text = itm; + lvotherplayers.Items.Add(l); + } } if (PossibleMatchmakes.Count > 0) -- cgit v1.2.3 From 39b3b4c62c88cb94ce7a5ecefe38754aac4dc3f7 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 5 May 2017 11:34:17 -0400 Subject: admin.set_acl and other things --- ShiftOS.WinForms/Applications/Pong.cs | 245 ++++++++++++++------- .../DesktopWidgets/HeartbeatWidget.Designer.cs | 62 ++++++ ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs | 51 +++++ .../DesktopWidgets/HeartbeatWidget.resx | 120 ++++++++++ ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 + ShiftOS_TheReturn/ServerManager.cs | 16 +- ShiftOS_TheReturn/UserManagementCommands.cs | 61 +++++ 7 files changed, 478 insertions(+), 86 deletions(-) create mode 100644 ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.Designer.cs create mode 100644 ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs create mode 100644 ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.resx (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index 04c963f..d63f406 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -123,7 +123,7 @@ namespace ShiftOS.WinForms.Applications int OpponentY = 0; - bool IsLeader = false; + bool IsLeader = true; int LeaderX = 0; int LeaderY = 0; @@ -368,75 +368,124 @@ namespace ShiftOS.WinForms.Applications public void ServerMessageReceivedHandler(ServerMessage msg) { - if (msg.Name == "pong_mp_setballpos") - { - var pt = JsonConvert.DeserializeObject(msg.Contents); - LeaderX = pt.X; - LeaderY = pt.Y; - } - else if(msg.Name == "pong_mp_left") + if (IsMultiplayerSession) { - this.Invoke(new Action(() => + if (msg.Name == "pong_mp_setballpos") { - AppearanceManager.Close(this); - })); - Infobox.Show("Opponent has closed Pong.", "The opponent has closed Pong, therefore the connection between you two has dropped."); - } - else if (msg.Name == "pong_mp_youlose") - { - this.Invoke(new Action(LoseMP)); - } - else if (msg.Name == "pong_mp_setopponenty") - { - int y = Convert.ToInt32(msg.Contents); - OpponentY = y; - } - else if (msg.Name == "pong_handshake_matchmake") - { - if (!PossibleMatchmakes.Contains(msg.Contents)) - PossibleMatchmakes.Add(msg.Contents); - this.Invoke(new Action(ListMatchmakes)); - } - else if (msg.Name == "pong_handshake_resendid") - { - ServerManager.Forward("all", "pong_handshake_matchmake", YouGUID); - } - else if (msg.Name == "pong_handshake_complete") - { - IsLeader = true; + var pt = JsonConvert.DeserializeObject(msg.Contents); + LeaderX = pt.X; + LeaderY = pt.Y; + } + else if (msg.Name == "pong_mp_left") + { + this.Invoke(new Action(() => + { + AppearanceManager.Close(this); + })); + Infobox.Show("Opponent has closed Pong.", "The opponent has closed Pong, therefore the connection between you two has dropped."); + } + else if (msg.Name == "pong_mp_youlose") + { + this.Invoke(new Action(LoseMP)); + } + else if (msg.Name == "pong_mp_setopponenty") + { + int y = Convert.ToInt32(msg.Contents); + OpponentY = y; + } + else if (msg.Name == "pong_handshake_matchmake") + { + if (!PossibleMatchmakes.Contains(msg.Contents)) + PossibleMatchmakes.Add(msg.Contents); + this.Invoke(new Action(ListMatchmakes)); + } + else if (msg.Name == "pong_handshake_resendid") + { + ServerManager.Forward("all", "pong_handshake_matchmake", YouGUID); + } + else if (msg.Name == "pong_handshake_complete") + { + IsLeader = true; - OpponentGUID = msg.Contents; - LeaveMatchmake(); - this.Invoke(new Action(() => + OpponentGUID = msg.Contents; + LeaveMatchmake(); + this.Invoke(new Action(() => + { + pnlmultiplayerhandshake.Hide(); + StartLevel(); + })); + } + else if(msg.Name == "pong_mp_levelcompleted") { - pnlmultiplayerhandshake.Hide(); - StartLevel(); - })); - } - else if (msg.Name == "pong_handshake_chosen") - { - IsLeader = false; - LeaveMatchmake(); - OpponentGUID = msg.Contents; - YouGUID = ServerManager.thisGuid.ToString(); - SendFollowerGUID(); - this.Invoke(new Action(() => + level = Convert.ToInt32(msg.Contents) + 1; + this.Invoke(new Action(CompleteLevel)); + } + else if (msg.Name == "pong_handshake_chosen") { - pnlmultiplayerhandshake.Hide(); - })); - } - else if (msg.Name == "pong_handshake_left") - { - if (this.PossibleMatchmakes.Contains(msg.Contents)) - this.PossibleMatchmakes.Remove(msg.Contents); - this.Invoke(new Action(ListMatchmakes)); - } - else if (msg.Name == "pong_mp_youwin") - { - this.Invoke(new Action(Win)); + IsLeader = false; + LeaveMatchmake(); + OpponentGUID = msg.Contents; + YouGUID = ServerManager.thisGuid.ToString(); + //Start the timers. + counter.Start(); + SendFollowerGUID(); + this.Invoke(new Action(() => + { + pnlmultiplayerhandshake.Hide(); + })); + } + else if(msg.Name == "pong_mp_cashedout") + { + this.Invoke(new Action(() => + { + btncashout_Click(this, EventArgs.Empty); + })); + Infobox.Show("Cashed out.", "The other player has cashed out their Codepoints. Therefore, we have automatically cashed yours out."); + } + else if(msg.Name == "pong_mp_startlevel") + { + OpponentAgrees = true; + if(YouAgree == false) + { + Infobox.PromptYesNo("Play another level?", "The opponent wants to play another level. Would you like to as well?", (answer)=> + { + YouAgree = answer; + ServerManager.Forward(OpponentGUID, "pong_mp_level_callback", YouAgree.ToString()); + }); + } + } + else if(msg.Name == "pong_mp_level_callback") + { + bool agreed = bool.Parse(msg.Contents); + OpponentAgrees = agreed; + if (OpponentAgrees) + { + if (IsLeader) + { + //this.Invoke(new Action(())) + } + } + } + else if (msg.Name == "pong_handshake_left") + { + if (this.PossibleMatchmakes.Contains(msg.Contents)) + this.PossibleMatchmakes.Remove(msg.Contents); + this.Invoke(new Action(ListMatchmakes)); + } + else if(msg.Name == "pong_mp_clockupdate") + { + secondsleft = Convert.ToInt32(msg.Contents); + } + else if (msg.Name == "pong_mp_youwin") + { + this.Invoke(new Action(Win)); + } } } + bool OpponentAgrees = false; + bool YouAgree = false; + public void ListMatchmakes() { lvotherplayers.Items.Clear(); @@ -543,37 +592,50 @@ namespace ShiftOS.WinForms.Applications } + public void CompleteLevel() + { + if (SaveSystem.CurrentSave.UniteAuthToken != null) + { + try + { + var unite = new ShiftOS.Unite.UniteClient("http://getshiftos.ml", SaveSystem.CurrentSave.UniteAuthToken); + if (unite.GetPongLevel() < level) + unite.SetPongLevel(level); + } + catch { } + } + //Only set these stats if the user is the leader. + if (IsLeader) + { + secondsleft = 60; + level = level + 1; + generatenextlevel(); + } + + pnlgamestats.Show(); + pnlgamestats.BringToFront(); + pnlgamestats.Location = new Point((pgcontents.Width / 2) - (pnlgamestats.Width / 2), (pgcontents.Height / 2) - (pnlgamestats.Height / 2)); + + counter.Stop(); + gameTimer.Stop(); + + } + // ERROR: Handles clauses are not supported in C# private void counter_Tick(object sender, EventArgs e) { - if (this.Left < Screen.PrimaryScreen.Bounds.Width) + if (IsLeader) { - secondsleft = secondsleft - 1; - if (secondsleft == 1) + if (this.Left < Screen.PrimaryScreen.Bounds.Width) { - secondsleft = 60; - level = level + 1; - if (SaveSystem.CurrentSave.UniteAuthToken != null) + secondsleft = secondsleft - 1; + if (secondsleft == 1) { - try - { - var unite = new ShiftOS.Unite.UniteClient("http://getshiftos.ml", SaveSystem.CurrentSave.UniteAuthToken); - if (unite.GetPongLevel() < level) - unite.SetPongLevel(level); - } - catch { } + CompleteLevel(); } - generatenextlevel(); - pnlgamestats.Show(); - pnlgamestats.BringToFront(); - pnlgamestats.Location = new Point((pgcontents.Width / 2) - (pnlgamestats.Width / 2), (pgcontents.Height / 2) - (pnlgamestats.Height / 2)); - - counter.Stop(); - gameTimer.Stop(); - SendHighscores(); - } - lblstatscodepoints.Text = Localization.Parse("{CODEPOINTS}: ") + (levelrewards[level - 1] + beatairewardtotal).ToString(); + lblstatscodepoints.Text = Localization.Parse("{CODEPOINTS}: ") + (levelrewards[level - 1] + beatairewardtotal).ToString(); + } } SetupStats(); } @@ -824,6 +886,19 @@ namespace ShiftOS.WinForms.Applications unite.SetPongCP(totalreward); } } + if (IsMultiplayerSession) + { + ServerManager.Forward(OpponentGUID, "pong_mp_cashedout", null); + StopMultiplayerSession(); + } + } + + public void StopMultiplayerSession() + { + IsMultiplayerSession = false; + IsLeader = true; + OpponentGUID = ""; + YouGUID = ""; } private void newgame() diff --git a/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.Designer.cs b/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.Designer.cs new file mode 100644 index 0000000..c6a7d83 --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.Designer.cs @@ -0,0 +1,62 @@ +namespace ShiftOS.WinForms.DesktopWidgets +{ + partial class HeartbeatWidget + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lbheartbeat = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // lbheartbeat + // + this.lbheartbeat.AutoSize = true; + this.lbheartbeat.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbheartbeat.Location = new System.Drawing.Point(0, 0); + this.lbheartbeat.Name = "lbheartbeat"; + this.lbheartbeat.Size = new System.Drawing.Size(35, 13); + this.lbheartbeat.TabIndex = 0; + this.lbheartbeat.Text = "label1"; + // + // HeartbeatWidget + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSize = true; + this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.Controls.Add(this.lbheartbeat); + this.Name = "HeartbeatWidget"; + this.Size = new System.Drawing.Size(35, 13); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lbheartbeat; + } +} diff --git a/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs b/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs new file mode 100644 index 0000000..d38cdc3 --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.WinForms.Tools; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.DesktopWidgets +{ + [DesktopWidget("Server ping", "See the time spent between client requests and server replies in the digital society.")] + public partial class HeartbeatWidget : UserControl, IDesktopWidget + { + public HeartbeatWidget() + { + InitializeComponent(); + tmr.Interval = 1; + tmr.Tick += (o, a) => + { + if(ts != ServerManager.DigitalSocietyPing) + { + ts = ServerManager.DigitalSocietyPing; + lbheartbeat.Text = "Server ping: " + ts.ToString(); + } + }; + } + + //Fun fact. I misspelled this as "TimeSpam." + TimeSpan ts; + + public void OnSkinLoad() + { + ControlManager.SetupControls(this); + } + + public void OnUpgrade() + { + } + + Timer tmr = new Timer(); + + public void Setup() + { + tmr.Start(); + } + } +} diff --git a/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.resx b/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 9fc237f..1607ae9 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -298,6 +298,12 @@ CodepointsWidget.cs + + UserControl + + + HeartbeatWidget.cs + UserControl @@ -502,6 +508,9 @@ CodepointsWidget.cs + + HeartbeatWidget.cs + TerminalWidget.cs diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index 0bdfcd9..792b38d 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -35,6 +35,7 @@ using ShiftOS; using static ShiftOS.Engine.SaveSystem; using Newtonsoft.Json; using System.Net.Sockets; +using System.Diagnostics; namespace ShiftOS.Engine { @@ -54,6 +55,12 @@ namespace ShiftOS.Engine private static NetObjectClient client { get; set; } private static bool UserDisconnect = false; + public static TimeSpan DigitalSocietyPing + { + get; + private set; + } + public static void Disconnect() { UserDisconnect = true; @@ -139,6 +146,11 @@ namespace ShiftOS.Engine }; client.OnReceived += (o, a) => { + if (PingTimer.IsRunning) + { + DigitalSocietyPing = PingTimer.Elapsed; + PingTimer.Reset(); + } var msg = a.Data.Object as ServerMessage; if (msg.Name == "Welcome") { @@ -207,6 +219,8 @@ namespace ShiftOS.Engine } } + private static Stopwatch PingTimer = new Stopwatch(); + public static void SendMessage(string name, string contents) { var sMsg = new ServerMessage @@ -215,7 +229,7 @@ namespace ShiftOS.Engine Contents = contents, GUID = thisGuid.ToString(), }; - + PingTimer.Start(); client.Send(new NetObject("msg", sMsg)); } diff --git a/ShiftOS_TheReturn/UserManagementCommands.cs b/ShiftOS_TheReturn/UserManagementCommands.cs index 62735a3..1c3c0ed 100644 --- a/ShiftOS_TheReturn/UserManagementCommands.cs +++ b/ShiftOS_TheReturn/UserManagementCommands.cs @@ -53,7 +53,68 @@ namespace ShiftOS.Engine return true; } + [Command("set_acl")] + [RequiresArgument("user")] + [RequiresArgument("val")] + public static bool SetUserPermission(Dictionary args) + { + int permission = 0; + string username = args["user"].ToString(); + try + { + permission = Convert.ToInt32(args["val"].ToString()); + } + catch + { + Console.WriteLine("Error: Permission value must be an integer."); + return true; + } + + if(SaveSystem.CurrentSave.Users.FirstOrDefault(x=>x.Username==username) == null) + { + Console.WriteLine("Error: User not found."); + return true; + } + + UserPermissions uperm = UserPermissions.Guest; + + switch (permission) + { + case 0: + uperm = UserPermissions.Guest; + break; + case 1: + uperm = UserPermissions.User; + break; + case 2: + uperm = UserPermissions.Admin; + break; + case 3: + uperm = UserPermissions.Root; + break; + default: + Console.WriteLine("Permission value must be between 0 and 4."); + return true; + } + + //Permissions are backwards... oops... + if(uperm < SaveSystem.CurrentUser.Permissions) + { + Console.WriteLine("Error: Cannot set user permissions to values greater than your own!"); + return true; + } + var oldperm = SaveSystem.Users.FirstOrDefault(x => x.Username == username).Permissions; + if (SaveSystem.CurrentUser.Permissions > oldperm) + { + Console.WriteLine("Error: Can't set the permission of this user. They have more rights than you."); + return true; + } + + SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == username).Permissions = uperm; + Console.WriteLine("User permissions updated."); + return true; + } } -- cgit v1.2.3 From 6eb418dec83188b8d4efbf74b6557ac2cbdedb0f Mon Sep 17 00:00:00 2001 From: AShifter Date: Fri, 5 May 2017 10:34:46 -0600 Subject: actually fix file skimmer don't copy dat floppy --- ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs | 12 ++++++------ ShiftOS.WinForms/Applications/FileSkimmer.cs | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs index d19d639..ea9fcec 100644 --- a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs +++ b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs @@ -69,9 +69,10 @@ namespace ShiftOS.WinForms.Applications // // lvitems // - this.lvitems.Location = new System.Drawing.Point(135, 0); + this.lvitems.Dock = System.Windows.Forms.DockStyle.Fill; + this.lvitems.Location = new System.Drawing.Point(0, 0); this.lvitems.Name = "lvitems"; - this.lvitems.Size = new System.Drawing.Size(499, 332); + this.lvitems.Size = new System.Drawing.Size(634, 332); this.lvitems.TabIndex = 0; this.lvitems.UseCompatibleStateImageBehavior = false; this.lvitems.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lvitems_ItemSelectionChanged); @@ -80,8 +81,8 @@ namespace ShiftOS.WinForms.Applications // // panel1 // - this.panel1.Controls.Add(this.lvitems); this.panel1.Controls.Add(this.pinnedItems); + this.panel1.Controls.Add(this.lvitems); this.panel1.Controls.Add(this.lbcurrentfolder); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 24); @@ -91,10 +92,9 @@ namespace ShiftOS.WinForms.Applications // // pinnedItems // - this.pinnedItems.Dock = System.Windows.Forms.DockStyle.Fill; - this.pinnedItems.Location = new System.Drawing.Point(0, 0); + this.pinnedItems.Location = new System.Drawing.Point(437, 208); this.pinnedItems.Name = "pinnedItems"; - this.pinnedItems.Size = new System.Drawing.Size(634, 332); + this.pinnedItems.Size = new System.Drawing.Size(197, 124); this.pinnedItems.TabIndex = 3; // // lbcurrentfolder diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.cs index 6309775..c1ffd40 100644 --- a/ShiftOS.WinForms/Applications/FileSkimmer.cs +++ b/ShiftOS.WinForms/Applications/FileSkimmer.cs @@ -34,7 +34,6 @@ using System.Threading.Tasks; using System.Windows.Forms; using static ShiftOS.Objects.ShiftFS.Utils; -using Newtonsoft.Json; using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications @@ -423,14 +422,14 @@ namespace ShiftOS.WinForms.Applications { if (result == true) { - if (currentdir != "__system") + if (currentdir != "__system" && lvitems.SelectedItems[0].Text != "Up one") { pinDirectory(currentdir + "/" + lvitems.SelectedItems[0].Text); ResetList(); } else { - Infobox.Show("Cannot Pin", "You cannot pin a system drive."); + Infobox.Show("Cannot Pin", "You can only pin files or folders."); } } -- cgit v1.2.3 From 57277a01d685b0e29a79e5d74a1465a2ceb23ef9 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 May 2017 09:44:47 -0400 Subject: Most of TriWrite is implemented. --- .../Applications/ShiftoriumFrontend.cs | 108 +++++++---- ShiftOS.WinForms/Applications/Skin Loader.cs | 9 +- ShiftOS.WinForms/Applications/TriWrite.Designer.cs | 197 ++++++++++++++++++--- ShiftOS.WinForms/Applications/TriWrite.cs | 120 ++++++++++++- ShiftOS.WinForms/Applications/TriWrite.resx | 108 ++++++++++- ShiftOS.WinForms/Controls/TerminalBox.cs | 130 ++++++++++++++ ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs | 4 +- ShiftOS_TheReturn/Commands.cs | 17 +- ShiftOS_TheReturn/ServerManager.cs | 4 +- 9 files changed, 617 insertions(+), 80 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index 66b0448..06266c3 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -30,6 +30,7 @@ using System.Drawing; using System.Linq; using System.Reflection; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using ShiftOS.Engine; @@ -90,46 +91,68 @@ namespace ShiftOS.WinForms.Applications public void PopulateShiftorium() { - try + var t = new Thread(() => { - lbnoupgrades.Hide(); - lbupgrades.Items.Clear(); - upgrades.Clear(); - Timer(); - - foreach (var upg in backend.GetAvailable().Where(x => x.Category == backend.GetCategories()[CategoryId])) + try { - String name = Localization.Parse(upg.Name) + " - " + upg.Cost.ToString() + "CP"; - upgrades.Add(name, upg); - lbupgrades.Items.Add(name); + Desktop.InvokeOnWorkerThread(() => + { + 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); + Desktop.InvokeOnWorkerThread(() => + { + lbupgrades.Items.Add(name); + }); + } + + if (lbupgrades.Items.Count == 0) + { + Desktop.InvokeOnWorkerThread(() => + { + lbnoupgrades.Show(); + lbnoupgrades.Location = new Point( + (lbupgrades.Width - lbnoupgrades.Width) / 2, + lbupgrades.Top + (lbupgrades.Height - lbnoupgrades.Height) / 2 + ); + }); + } + else + { + Desktop.InvokeOnWorkerThread(() => + { + lbnoupgrades.Hide(); + }); + } + + Desktop.InvokeOnWorkerThread(() => + { + lblcategorytext.Text = Shiftorium.GetCategories()[CategoryId]; + btncat_back.Visible = (CategoryId > 0); + btncat_forward.Visible = (CategoryId < backend.GetCategories().Length - 1); + }); } - - if (lbupgrades.Items.Count == 0) + catch { - lbnoupgrades.Show(); - lbnoupgrades.Location = new Point( - (lbupgrades.Width - lbnoupgrades.Width) / 2, - (lbupgrades.Height - lbnoupgrades.Height) / 2 - ); - + Desktop.InvokeOnWorkerThread(() => + { + lbnoupgrades.Show(); + lbnoupgrades.Location = new Point( + (lbupgrades.Width - lbnoupgrades.Width) / 2, + lbupgrades.Top + (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 - ); - - } + }); + t.IsBackground = true; + t.Start(); } public static bool UpgradeInstalled(string upg) @@ -200,7 +223,17 @@ namespace ShiftOS.WinForms.Applications { foreach(var upg in UpgradesToBuy) { - backend.Buy(upg.Key, upg.Value); + SaveSystem.CurrentSave.Codepoints -= upg.Value; + if (SaveSystem.CurrentSave.Upgrades.ContainsKey(upg.Key)) + { + SaveSystem.CurrentSave.Upgrades[upg.Key] = true; + } + else + { + SaveSystem.CurrentSave.Upgrades.Add(upg.Key, true); + } + SaveSystem.SaveGame(); + backend.InvokeUpgradeInstalled(); } } @@ -224,7 +257,7 @@ namespace ShiftOS.WinForms.Applications } - Timer cp_update = new System.Windows.Forms.Timer(); + System.Windows.Forms.Timer cp_update = new System.Windows.Forms.Timer(); public bool OnUnload() { @@ -248,6 +281,7 @@ namespace ShiftOS.WinForms.Applications { timer100 = new System.Timers.Timer(); timer100.Interval = 2000; + //CLARIFICATION: What is this supposed to do? - Michael //timer100.Elapsed += ???; timer100.AutoReset = true; timer100.Enabled = true; diff --git a/ShiftOS.WinForms/Applications/Skin Loader.cs b/ShiftOS.WinForms/Applications/Skin Loader.cs index f9857b7..90b05a1 100644 --- a/ShiftOS.WinForms/Applications/Skin Loader.cs +++ b/ShiftOS.WinForms/Applications/Skin Loader.cs @@ -65,8 +65,11 @@ namespace ShiftOS.WinForms.Applications public void SetupUI() { - SetupDesktop(); - Setup(); + if (LoadedSkin != null) + { + SetupDesktop(); + Setup(); + } } public void SetupDesktop() @@ -78,7 +81,7 @@ namespace ShiftOS.WinForms.Applications //upgrades - if (SaveSystem.CurrentSave != null) + if (SaveSystem.CurrentSave != null && LoadedSkin != null) { desktoppanel.Visible = ShiftoriumFrontend.UpgradeInstalled("desktop"); lbtime.Visible = ShiftoriumFrontend.UpgradeInstalled("desktop_clock_widget"); diff --git a/ShiftOS.WinForms/Applications/TriWrite.Designer.cs b/ShiftOS.WinForms/Applications/TriWrite.Designer.cs index e420fd5..a1432d8 100644 --- a/ShiftOS.WinForms/Applications/TriWrite.Designer.cs +++ b/ShiftOS.WinForms/Applications/TriWrite.Designer.cs @@ -36,15 +36,27 @@ this.panel1 = new System.Windows.Forms.Panel(); this.txtbody = new System.Windows.Forms.Label(); this.lbtitle = new System.Windows.Forms.Label(); - this.txtcontents = new System.Windows.Forms.TextBox(); this.menuStrip2 = new System.Windows.Forms.MenuStrip(); this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.menuStrip3 = new System.Windows.Forms.MenuStrip(); + this.txtcontents = new System.Windows.Forms.RichTextBox(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.bold = new System.Windows.Forms.ToolStripButton(); + this.italic = new System.Windows.Forms.ToolStripButton(); + this.underline = new System.Windows.Forms.ToolStripButton(); + this.strikethrough = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.fonts = new System.Windows.Forms.ToolStripComboBox(); + this.size = new System.Windows.Forms.ToolStripTextBox(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.left = new System.Windows.Forms.ToolStripButton(); + this.center = new System.Windows.Forms.ToolStripButton(); + this.right = new System.Windows.Forms.ToolStripButton(); this.menuStrip1.SuspendLayout(); this.panel1.SuspendLayout(); this.menuStrip2.SuspendLayout(); + this.toolStrip1.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 @@ -61,16 +73,17 @@ // addContactToolStripMenuItem // this.addContactToolStripMenuItem.Name = "addContactToolStripMenuItem"; - this.addContactToolStripMenuItem.Size = new System.Drawing.Size(32, 19); + this.addContactToolStripMenuItem.Size = new System.Drawing.Size(12, 20); // // removeToolStripMenuItem // this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; - this.removeToolStripMenuItem.Size = new System.Drawing.Size(32, 19); + this.removeToolStripMenuItem.Size = new System.Drawing.Size(12, 20); // // tvcontacts // this.tvcontacts.Dock = System.Windows.Forms.DockStyle.Left; + this.tvcontacts.LineColor = System.Drawing.Color.Empty; this.tvcontacts.Location = new System.Drawing.Point(0, 24); this.tvcontacts.Name = "tvcontacts"; this.tvcontacts.Size = new System.Drawing.Size(224, 551); @@ -107,16 +120,6 @@ this.lbtitle.Tag = "header1"; this.lbtitle.Text = "TriWrite"; // - // txtcontents - // - this.txtcontents.Dock = System.Windows.Forms.DockStyle.Fill; - this.txtcontents.Location = new System.Drawing.Point(0, 53); - this.txtcontents.Multiline = true; - this.txtcontents.Name = "txtcontents"; - this.txtcontents.Size = new System.Drawing.Size(527, 460); - this.txtcontents.TabIndex = 1; - this.txtcontents.TabStop = false; - // // menuStrip2 // this.menuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -125,7 +128,7 @@ this.saveToolStripMenuItem}); this.menuStrip2.Location = new System.Drawing.Point(0, 0); this.menuStrip2.Name = "menuStrip2"; - this.menuStrip2.Size = new System.Drawing.Size(527, 24); + this.menuStrip2.Size = new System.Drawing.Size(652, 24); this.menuStrip2.TabIndex = 2; this.menuStrip2.Text = "menuStrip2"; // @@ -134,40 +137,173 @@ this.newToolStripMenuItem.Name = "newToolStripMenuItem"; this.newToolStripMenuItem.Size = new System.Drawing.Size(43, 20); this.newToolStripMenuItem.Text = "New"; + this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click); // // openToolStripMenuItem // this.openToolStripMenuItem.Name = "openToolStripMenuItem"; this.openToolStripMenuItem.Size = new System.Drawing.Size(48, 20); this.openToolStripMenuItem.Text = "Open"; + this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); // // saveToolStripMenuItem // this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; this.saveToolStripMenuItem.Size = new System.Drawing.Size(43, 20); this.saveToolStripMenuItem.Text = "Save"; + this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); + // + // txtcontents + // + this.txtcontents.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtcontents.Location = new System.Drawing.Point(0, 49); + this.txtcontents.Name = "txtcontents"; + this.txtcontents.Size = new System.Drawing.Size(652, 365); + this.txtcontents.TabIndex = 4; + this.txtcontents.Text = ""; + this.txtcontents.SelectionChanged += new System.EventHandler(this.txtcontents_SelectionChanged); + // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.bold, + this.italic, + this.underline, + this.strikethrough, + this.toolStripSeparator1, + this.fonts, + this.size, + this.toolStripSeparator2, + this.left, + this.center, + this.right}); + this.toolStrip1.Location = new System.Drawing.Point(0, 24); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(652, 25); + this.toolStrip1.TabIndex = 5; + this.toolStrip1.Text = "toolStrip1"; + // + // bold + // + this.bold.CheckOnClick = true; + this.bold.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.bold.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold); + this.bold.Image = ((System.Drawing.Image)(resources.GetObject("bold.Image"))); + this.bold.ImageTransparentColor = System.Drawing.Color.Magenta; + this.bold.Name = "bold"; + this.bold.Size = new System.Drawing.Size(23, 22); + this.bold.Text = "B"; + this.bold.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged); + // + // italic + // + this.italic.CheckOnClick = true; + this.italic.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.italic.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Italic); + this.italic.Image = ((System.Drawing.Image)(resources.GetObject("italic.Image"))); + this.italic.ImageTransparentColor = System.Drawing.Color.Magenta; + this.italic.Name = "italic"; + this.italic.Size = new System.Drawing.Size(23, 22); + this.italic.Text = "I"; + this.italic.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged); + // + // underline + // + this.underline.CheckOnClick = true; + this.underline.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.underline.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Underline); + this.underline.Image = ((System.Drawing.Image)(resources.GetObject("underline.Image"))); + this.underline.ImageTransparentColor = System.Drawing.Color.Magenta; + this.underline.Name = "underline"; + this.underline.Size = new System.Drawing.Size(23, 22); + this.underline.Text = "U"; + this.underline.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged); + // + // strikethrough + // + this.strikethrough.CheckOnClick = true; + this.strikethrough.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.strikethrough.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Strikeout, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.strikethrough.Image = ((System.Drawing.Image)(resources.GetObject("strikethrough.Image"))); + this.strikethrough.ImageTransparentColor = System.Drawing.Color.Magenta; + this.strikethrough.Name = "strikethrough"; + this.strikethrough.Size = new System.Drawing.Size(23, 22); + this.strikethrough.Text = "S"; + this.strikethrough.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); + // + // fonts + // + this.fonts.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.fonts.Name = "fonts"; + this.fonts.Size = new System.Drawing.Size(121, 25); + this.fonts.SelectedIndexChanged += new System.EventHandler(this.fonts_SelectedIndexChanged); + // + // size + // + this.size.AutoSize = false; + this.size.MaxLength = 3; + this.size.Name = "size"; + this.size.Size = new System.Drawing.Size(40, 25); + this.size.TextChanged += new System.EventHandler(this.size_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25); + // + // left + // + this.left.CheckOnClick = true; + this.left.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.left.Image = ((System.Drawing.Image)(resources.GetObject("left.Image"))); + this.left.ImageTransparentColor = System.Drawing.Color.Magenta; + this.left.Name = "left"; + this.left.Size = new System.Drawing.Size(31, 22); + this.left.Text = "Left"; + this.left.Click += new System.EventHandler(this.left_Click); + // + // center + // + this.center.CheckOnClick = true; + this.center.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.center.Image = ((System.Drawing.Image)(resources.GetObject("center.Image"))); + this.center.ImageTransparentColor = System.Drawing.Color.Magenta; + this.center.Name = "center"; + this.center.Size = new System.Drawing.Size(46, 22); + this.center.Text = "Center"; + this.center.Click += new System.EventHandler(this.center_Click); // - // menuStrip3 + // right // - this.menuStrip3.Location = new System.Drawing.Point(0, 30); - this.menuStrip3.Name = "menuStrip3"; - this.menuStrip3.Size = new System.Drawing.Size(527, 24); - this.menuStrip3.TabIndex = 3; - this.menuStrip3.Text = "menuStrip3"; + this.right.CheckOnClick = true; + this.right.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.right.Image = ((System.Drawing.Image)(resources.GetObject("right.Image"))); + this.right.ImageTransparentColor = System.Drawing.Color.Magenta; + this.right.Name = "right"; + this.right.Size = new System.Drawing.Size(39, 22); + this.right.Text = "Right"; + this.right.Click += new System.EventHandler(this.right_Click); // // TriWrite // this.Controls.Add(this.txtcontents); - this.Controls.Add(this.menuStrip3); + this.Controls.Add(this.toolStrip1); this.Controls.Add(this.menuStrip2); this.Name = "TriWrite"; - this.Size = new System.Drawing.Size(527, 513); + this.Size = new System.Drawing.Size(652, 414); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.menuStrip2.ResumeLayout(false); this.menuStrip2.PerformLayout(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -182,11 +318,22 @@ private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Label txtbody; private System.Windows.Forms.Label lbtitle; - private System.Windows.Forms.TextBox txtcontents; private System.Windows.Forms.MenuStrip menuStrip2; private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; - private System.Windows.Forms.MenuStrip menuStrip3; + private System.Windows.Forms.RichTextBox txtcontents; + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.ToolStripButton bold; + private System.Windows.Forms.ToolStripButton italic; + private System.Windows.Forms.ToolStripButton underline; + private System.Windows.Forms.ToolStripButton strikethrough; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripComboBox fonts; + private System.Windows.Forms.ToolStripTextBox size; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripButton left; + private System.Windows.Forms.ToolStripButton center; + private System.Windows.Forms.ToolStripButton right; } } diff --git a/ShiftOS.WinForms/Applications/TriWrite.cs b/ShiftOS.WinForms/Applications/TriWrite.cs index 6fb814f..b5845ba 100644 --- a/ShiftOS.WinForms/Applications/TriWrite.cs +++ b/ShiftOS.WinForms/Applications/TriWrite.cs @@ -13,7 +13,7 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { [WinOpen("triwrite")] - [AppscapeEntry("TriWrite", "Part of the trilogy of office applications for enhancement of your system. TriWrite is easliy the best text editor out there for ShiftOS.", 1024, 750, null, "Office")] + [AppscapeEntry("TriWrite", "Part of the trilogy of office applications for enhancement of your system. TriWrite is easliy the best text editor out there for ShiftOS.", 1024, 750, "file_skimmer;textpad", "Office")] [DefaultTitle("TriWrite")] [Launcher("TriWrite", false, null, "Office")] public partial class TriWrite : UserControl, IShiftOSWindow @@ -32,35 +32,54 @@ namespace ShiftOS.WinForms.Applications private void openToolStripMenuItem_Click(object sender, EventArgs e) { var txt = new List(); - txt.Add(".txt"); + txt.Add(".rtf"); - AppearanceManager.SetupDialog(new FileDialog(txt.ToArray(), FileOpenerStyle.Open, new Action((file) => this.LoadFile(file)))); + FileSkimmerBackend.GetFile(txt.ToArray(), FileOpenerStyle.Open, (path) => LoadFile(path)); } public void LoadFile(string file) { - txtcontents.Text = Utils.ReadAllText(file); + txtcontents.Rtf = Utils.ReadAllText(file); } public void SaveFile(string file) { - Utils.WriteAllText(file, txtcontents.Text); + if (file.ToLower().EndsWith(".rtf")) + { + Utils.WriteAllText(file, txtcontents.Rtf); + } + else + { + Utils.WriteAllText(file, txtcontents.Text); + } } private void saveToolStripMenuItem_Click(object sender, EventArgs e) { var txt = new List(); + txt.Add(".rtf"); txt.Add(".txt"); - - AppearanceManager.SetupDialog(new FileDialog(txt.ToArray(), FileOpenerStyle.Save, new Action((file) => this.SaveFile(file)))); + FileSkimmerBackend.GetFile(txt.ToArray(), FileOpenerStyle.Save, (path) => SaveFile(path)); } public void OnLoad() { + UpdateUI(); } public void OnSkinLoad() { + ResetFonts(); + } + + public void ResetFonts() + { + fonts.Items.Clear(); + foreach(var font in FontFamily.Families) + { + fonts.Items.Add(font.Name); + } + UpdateUI(); } public bool OnUnload() @@ -72,5 +91,92 @@ namespace ShiftOS.WinForms.Applications { } + public void UpdateUI() + { + bold.Checked = txtcontents.SelectionFont.Bold; + italic.Checked = txtcontents.SelectionFont.Italic; + underline.Checked = txtcontents.SelectionFont.Underline; + strikethrough.Checked = txtcontents.SelectionFont.Strikeout; + fonts.Text = txtcontents.SelectionFont.Name; + size.Text = txtcontents.SelectionFont.Size.ToString(); + left.Checked = txtcontents.SelectionAlignment == HorizontalAlignment.Left; + center.Checked = txtcontents.SelectionAlignment == HorizontalAlignment.Center; + right.Checked = txtcontents.SelectionAlignment == HorizontalAlignment.Right; + + } + + private void txtcontents_SelectionChanged(object sender, EventArgs e) + { + UpdateUI(); + } + + public void SetFontStyle(bool bold, bool italic, bool underline, bool strikethrough) + { + FontStyle fs = FontStyle.Regular; + if (bold) + fs |= FontStyle.Bold; + if (italic) + fs |= FontStyle.Italic; + if (underline) + fs |= FontStyle.Underline; + if (strikethrough) + fs |= FontStyle.Strikeout; + txtcontents.SelectionFont = new Font(txtcontents.SelectionFont, fs); + UpdateUI(); + } + + private void bold_CheckedChanged(object sender, EventArgs e) + { + SetFontStyle(bold.Checked, italic.Checked, underline.Checked, strikethrough.Checked); + } + + public void SetFontFamily(string family, float emSize) + { + var style = txtcontents.SelectionFont.Style; + var size = emSize; + txtcontents.SelectionFont = new Font(family, size, style); + UpdateUI(); + } + + private void fonts_SelectedIndexChanged(object sender, EventArgs e) + { + SetFontFamily(fonts.Text, Convert.ToSingle(size.Text)); + } + + private void left_Click(object sender, EventArgs e) + { + txtcontents.SelectionAlignment = HorizontalAlignment.Left; + UpdateUI(); + } + + private void center_Click(object sender, EventArgs e) + { + txtcontents.SelectionAlignment = HorizontalAlignment.Center; + UpdateUI(); + + } + + private void right_Click(object sender, EventArgs e) + { + txtcontents.SelectionAlignment = HorizontalAlignment.Right; + UpdateUI(); + + } + + private void size_Click(object sender, EventArgs e) + { + try + { + float s = Convert.ToSingle(size.Text); + if(s != txtcontents.SelectionFont.Size) + { + SetFontFamily(fonts.Text, s); + } + } + catch + { + UpdateUI(); + } + } } } \ No newline at end of file diff --git a/ShiftOS.WinForms/Applications/TriWrite.resx b/ShiftOS.WinForms/Applications/TriWrite.resx index 525a23c..a06716c 100644 --- a/ShiftOS.WinForms/Applications/TriWrite.resx +++ b/ShiftOS.WinForms/Applications/TriWrite.resx @@ -130,7 +130,113 @@ To add a contact, simply click "Add Contact", and to remove one, click "Remove". 132, 17 - + 247, 17 + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== + + \ No newline at end of file diff --git a/ShiftOS.WinForms/Controls/TerminalBox.cs b/ShiftOS.WinForms/Controls/TerminalBox.cs index cdb0965..f85daa6 100644 --- a/ShiftOS.WinForms/Controls/TerminalBox.cs +++ b/ShiftOS.WinForms/Controls/TerminalBox.cs @@ -86,6 +86,7 @@ namespace ShiftOS.WinForms.Controls public void WriteLine(string text) { + Engine.AudioManager.PlayStream(Properties.Resources.writesound); this.HideSelection = true; this.Select(this.TextLength, 0); this.SelectionFont = ConstructFont(); @@ -119,6 +120,135 @@ namespace ShiftOS.WinForms.Controls base.OnMouseUp(mevent); } + protected override void OnKeyDown(KeyEventArgs e) + { + base.OnKeyDown(e); + if (!TerminalBackend.InStory) + { + switch (e.KeyCode) { + case Keys.Add: + case Keys.Alt: + case Keys.Apps: + case Keys.Attn: + case Keys.BrowserBack: + case Keys.BrowserFavorites: + case Keys.BrowserForward: + case Keys.BrowserHome: + case Keys.BrowserRefresh: + case Keys.BrowserSearch: + case Keys.BrowserStop: + case Keys.Cancel: + case Keys.Capital: + case Keys.Clear: + case Keys.Control: + case Keys.ControlKey: + case Keys.Crsel: + case Keys.Decimal: + case Keys.Divide: + case Keys.Down: + case Keys.End: + case Keys.Enter: + case Keys.EraseEof: + case Keys.Escape: + case Keys.Execute: + case Keys.Exsel: + case Keys.F1: + case Keys.F10: + case Keys.F11: + case Keys.F12: + case Keys.F13: + case Keys.F14: + case Keys.F15: + case Keys.F16: + case Keys.F17: + case Keys.F18: + case Keys.F19: + case Keys.F2: + case Keys.F20: + case Keys.F21: + case Keys.F22: + case Keys.F23: + case Keys.F24: + case Keys.F3: + case Keys.F4: + case Keys.F5: + case Keys.F6: + case Keys.F7: + case Keys.F8: + case Keys.F9: + case Keys.FinalMode: + case Keys.HanguelMode: + case Keys.HanjaMode: + case Keys.Help: + case Keys.Home: + case Keys.IMEAccept: + case Keys.IMEConvert: + case Keys.IMEModeChange: + case Keys.IMENonconvert: + case Keys.Insert: + case Keys.JunjaMode: + case Keys.KeyCode: + case Keys.LaunchApplication1: + case Keys.LaunchApplication2: + case Keys.LaunchMail: + case Keys.LButton: + case Keys.LControlKey: + case Keys.Left: + case Keys.LineFeed: + case Keys.LMenu: + case Keys.LShiftKey: + case Keys.LWin: + case Keys.MButton: + case Keys.MediaNextTrack: + case Keys.MediaPlayPause: + case Keys.MediaPreviousTrack: + case Keys.MediaStop: + case Keys.Menu: + case Keys.Modifiers: + case Keys.Multiply: + case Keys.Next: + case Keys.NoName: + case Keys.None: + case Keys.NumLock: + case Keys.Pa1: + case Keys.Packet: + case Keys.PageUp: + case Keys.Pause: + case Keys.Play: + case Keys.Print: + case Keys.PrintScreen: + case Keys.ProcessKey: + case Keys.RButton: + case Keys.RControlKey: + case Keys.Right: + case Keys.RMenu: + case Keys.RShiftKey: + case Keys.RWin: + case Keys.Scroll: + case Keys.Select: + case Keys.SelectMedia: + case Keys.Separator: + case Keys.Shift: + case Keys.ShiftKey: + case Keys.Sleep: + case Keys.Subtract: + case Keys.Tab: + case Keys.Up: + case Keys.VolumeDown: + case Keys.VolumeMute: + case Keys.VolumeUp: + case Keys.XButton1: + case Keys.XButton2: + case Keys.Zoom: + + break; + default: + Engine.AudioManager.PlayStream(Properties.Resources.typesound); + break; + } + } + } + public TerminalBox() : base() { this.Tag = "keepbg keepfg keepfont"; diff --git a/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs b/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs index d38cdc3..b0dc552 100644 --- a/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs +++ b/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs @@ -24,13 +24,13 @@ namespace ShiftOS.WinForms.DesktopWidgets if(ts != ServerManager.DigitalSocietyPing) { ts = ServerManager.DigitalSocietyPing; - lbheartbeat.Text = "Server ping: " + ts.ToString(); + lbheartbeat.Text = "Server ping: " + ts.ToString() + " MS"; } }; } //Fun fact. I misspelled this as "TimeSpam." - TimeSpan ts; + long ts = 0; public void OnSkinLoad() { diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index 57d1d34..dc0b3a2 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -276,6 +276,17 @@ namespace ShiftOS.Engine return true; } + [Command("restart")] + public static bool Restart() + { + SaveSystem.CurrentSave.Upgrades = new Dictionary(); + SaveSystem.CurrentSave.Codepoints = 0; + SaveSystem.CurrentSave.StoriesExperienced.Clear(); + SaveSystem.CurrentSave.StoriesExperienced.Add("mud_fundamentals"); + SaveSystem.SaveGame(); + Shiftorium.InvokeUpgradeInstalled(); + return true; + } [Command("freecp")] public static bool FreeCodepoints(Dictionary args) @@ -283,8 +294,8 @@ namespace ShiftOS.Engine if (args.ContainsKey("amount")) try { - Int64 codepointsToAdd = Convert.ToInt64(args["amount"].ToString()); - SaveSystem.TransferCodepointsFrom("dev", codepointsToAdd); + long codepointsToAdd = Convert.ToInt64(args["amount"].ToString()); + SaveSystem.CurrentSave.Codepoints += codepointsToAdd; return true; } catch (Exception ex) @@ -293,7 +304,7 @@ namespace ShiftOS.Engine return true; } - SaveSystem.TransferCodepointsFrom("dev", 1000); + SaveSystem.CurrentSave.Codepoints += 1000; return true; } diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index 792b38d..825064b 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -55,7 +55,7 @@ namespace ShiftOS.Engine private static NetObjectClient client { get; set; } private static bool UserDisconnect = false; - public static TimeSpan DigitalSocietyPing + public static long DigitalSocietyPing { get; private set; @@ -148,7 +148,7 @@ namespace ShiftOS.Engine { if (PingTimer.IsRunning) { - DigitalSocietyPing = PingTimer.Elapsed; + DigitalSocietyPing = PingTimer.ElapsedMilliseconds; PingTimer.Reset(); } var msg = a.Data.Object as ServerMessage; -- cgit v1.2.3 From c56b59a8a37c108a18aadc719091b5a6827931e3 Mon Sep 17 00:00:00 2001 From: Aren Date: Sat, 6 May 2017 17:41:49 +0200 Subject: Stop pong from ending early. Pong used to end early because the game would check if secondsleft was 1 after removing one, meaning it would be at 2. Now it checks if secondsleft is 0 which should resolve the issue. --- ShiftOS.WinForms/Applications/Pong.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index d63f406..92a2039 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -629,7 +629,7 @@ namespace ShiftOS.WinForms.Applications if (this.Left < Screen.PrimaryScreen.Bounds.Width) { secondsleft = secondsleft - 1; - if (secondsleft == 1) + if (secondsleft == 0) { CompleteLevel(); } -- cgit v1.2.3 From e131f72a9b863cc75a4db71670c41efa319886fb Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 May 2017 12:16:41 -0400 Subject: Fix the file skimmer pins. --- .../Applications/FileSkimmer.Designer.cs | 12 ++-- ShiftOS.WinForms/Applications/FileSkimmer.cs | 64 +++++++++++++++++++++- ShiftOS.WinForms/Applications/Pong.cs | 2 +- ShiftOS_TheReturn/UserManagementCommands.cs | 27 +++++++++ 4 files changed, 97 insertions(+), 8 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs index ea9fcec..965e4eb 100644 --- a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs +++ b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs @@ -70,9 +70,9 @@ namespace ShiftOS.WinForms.Applications // lvitems // this.lvitems.Dock = System.Windows.Forms.DockStyle.Fill; - this.lvitems.Location = new System.Drawing.Point(0, 0); + this.lvitems.Location = new System.Drawing.Point(149, 0); this.lvitems.Name = "lvitems"; - this.lvitems.Size = new System.Drawing.Size(634, 332); + this.lvitems.Size = new System.Drawing.Size(485, 332); this.lvitems.TabIndex = 0; this.lvitems.UseCompatibleStateImageBehavior = false; this.lvitems.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lvitems_ItemSelectionChanged); @@ -81,8 +81,8 @@ namespace ShiftOS.WinForms.Applications // // panel1 // - this.panel1.Controls.Add(this.pinnedItems); this.panel1.Controls.Add(this.lvitems); + this.panel1.Controls.Add(this.pinnedItems); this.panel1.Controls.Add(this.lbcurrentfolder); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 24); @@ -92,10 +92,12 @@ namespace ShiftOS.WinForms.Applications // // pinnedItems // - this.pinnedItems.Location = new System.Drawing.Point(437, 208); + this.pinnedItems.Dock = System.Windows.Forms.DockStyle.Left; + this.pinnedItems.Location = new System.Drawing.Point(0, 0); this.pinnedItems.Name = "pinnedItems"; - this.pinnedItems.Size = new System.Drawing.Size(197, 124); + this.pinnedItems.Size = new System.Drawing.Size(149, 332); this.pinnedItems.TabIndex = 3; + this.pinnedItems.Click += new System.EventHandler(this.pinnedItems_Click); // // lbcurrentfolder // diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.cs index c1ffd40..218e9e2 100644 --- a/ShiftOS.WinForms/Applications/FileSkimmer.cs +++ b/ShiftOS.WinForms/Applications/FileSkimmer.cs @@ -35,6 +35,7 @@ using System.Windows.Forms; using static ShiftOS.Objects.ShiftFS.Utils; using ShiftOS.Engine; +using Newtonsoft.Json; namespace ShiftOS.WinForms.Applications { @@ -128,8 +129,14 @@ namespace ShiftOS.WinForms.Applications { int amountsCalled = -1; amountsCalled = amountsCalled + 1; - pinnedItems.Nodes.Add(path); - pinnedItems.Nodes[amountsCalled].Nodes.Add("test"); + List Pinned = new List(); + if(FileExists(Paths.GetPath("data") + "/pinned_items.dat")) + { + Pinned = JsonConvert.DeserializeObject>(ReadAllText(Paths.GetPath("data") + "/pinned_items.dat")); + } + Pinned.Add(path); + WriteAllText(Paths.GetPath("data") + "/pinned_items.dat", JsonConvert.SerializeObject(Pinned)); + ResetList(); } public void ChangeDirectory(string path) @@ -152,8 +159,40 @@ namespace ShiftOS.WinForms.Applications } } + public void PopulatePinned(TreeNode node, string[] items) + { + foreach(var dir in items) + { + var treenode = new TreeNode(); + if (DirectoryExists(dir)) + { + var dinf = GetDirectoryInfo(dir); + treenode.Text = dinf.Name; + } + else if (FileExists(dir)) + { + var finf = GetFileInfo(dir); + treenode.Text = finf.Name; + } + treenode.Tag = dir; + node.Nodes.Add(treenode); + } + } + public void ResetList() { + pinnedItems.Nodes.Clear(); + List Pinned = new List(); + if(FileExists(Paths.GetPath("data") + "/pinned_items.dat")) + { + Pinned = JsonConvert.DeserializeObject>(ReadAllText(Paths.GetPath("data") + "/pinned_items.dat")); + } + var node = new TreeNode(); + node.Text = "Pinned"; + PopulatePinned(node, Pinned.ToArray()); + pinnedItems.Nodes.Add(node); + node.ExpandAll(); + if(lvitems.LargeImageList == null) { lvitems.LargeImageList = new ImageList(); @@ -437,5 +476,26 @@ namespace ShiftOS.WinForms.Applications } catch { } } + + private void pinnedItems_Click(object sender, EventArgs e) + { + try + { + if (pinnedItems.SelectedNode != null) + { + string path = pinnedItems.SelectedNode.Tag.ToString(); + if (DirectoryExists(path)) + { + currentdir = path; + ResetList(); + } + else if (FileExists(path)) + { + FileSkimmerBackend.OpenFile(path); + } + } + } + catch { } + } } } diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index d63f406..ae70aff 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -1095,8 +1095,8 @@ namespace ShiftOS.WinForms.Applications { if(!string.IsNullOrWhiteSpace(OpponentGUID)) ServerManager.Forward(OpponentGUID, "pong_mp_left", null); + LeaveMatchmake(); } - LeaveMatchmake(); ServerManager.MessageReceived -= this.ServerMessageReceivedHandler; return true; diff --git a/ShiftOS_TheReturn/UserManagementCommands.cs b/ShiftOS_TheReturn/UserManagementCommands.cs index 1c3c0ed..21c984b 100644 --- a/ShiftOS_TheReturn/UserManagementCommands.cs +++ b/ShiftOS_TheReturn/UserManagementCommands.cs @@ -53,6 +53,9 @@ namespace ShiftOS.Engine return true; } + + + [Command("set_acl")] [RequiresArgument("user")] [RequiresArgument("val")] @@ -122,7 +125,31 @@ namespace ShiftOS.Engine [RequiresUpgrade("mud_fundamentals")] public static class UserManagementCommands { + [Command("login", description = "Log in as another user.")] + [RequiresArgument("user")] + [RequiresArgument("pass")] + public static bool Login(Dictionary args) + { + string user = args["user"].ToString(); + string pass = args["pass"].ToString(); + var usr = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == user); + if(usr==null) + { + Console.WriteLine("Error: No such user."); + return true; + } + + if (usr.Password != pass) + { + Console.WriteLine("Access denied."); + return true; + } + + SaveSystem.CurrentUser = usr; + Console.WriteLine("Access granted."); + return true; + } [Command("setpass", description ="Allows you to set your password to a new value.", usage ="old:,new:")] [RequiresArgument("old")] -- cgit v1.2.3 From 2d8831c29ca4d05d66ad4b90db66250094e734c9 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 May 2017 12:36:45 -0400 Subject: fix highscore glitch --- ShiftOS.WinForms/Applications/Pong.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index ae70aff..433e05f 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -981,6 +981,10 @@ namespace ShiftOS.WinForms.Applications var hs = unite.GetPongHighscores(); foreach (var score in hs.Highscores) { + if(this.ParentForm.Visible == false) + { + Thread.CurrentThread.Abort(); + } string username = unite.GetDisplayNameId(score.UserId); this.Invoke(new Action(() => { @@ -994,8 +998,15 @@ namespace ShiftOS.WinForms.Applications } catch { - Infobox.Show("Service unavailable.", "The Pong Highscore service is unavailable at this time."); - this.Invoke(new Action(pnlgamestats.BringToFront)); + try + { + if (this.ParentForm.Visible == true) + { + Infobox.Show("Service unavailable.", "The Pong Highscore service is unavailable at this time."); + this.Invoke(new Action(pnlgamestats.BringToFront)); + } + } + catch { } //JUST. ABORT. THE. FUCKING. THREAD. return; } }); -- cgit v1.2.3 From 2424b91d51bc55ff7493b1249888c143335905af Mon Sep 17 00:00:00 2001 From: william341 Date: Sat, 6 May 2017 14:32:24 -0700 Subject: fixed a bug using Try-Catch Brand Duct Tape --- ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index 06266c3..52e9a9e 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -134,9 +134,16 @@ namespace ShiftOS.WinForms.Applications Desktop.InvokeOnWorkerThread(() => { - lblcategorytext.Text = Shiftorium.GetCategories()[CategoryId]; - btncat_back.Visible = (CategoryId > 0); - btncat_forward.Visible = (CategoryId < backend.GetCategories().Length - 1); + try + { + lblcategorytext.Text = Shiftorium.GetCategories()[CategoryId]; + btncat_back.Visible = (CategoryId > 0); + btncat_forward.Visible = (CategoryId < backend.GetCategories().Length - 1); + } + catch + { + + } }); } catch -- cgit v1.2.3 From 147cd66b3958d382ea879d66c4d653a6f734f82b Mon Sep 17 00:00:00 2001 From: william341 Date: Sat, 6 May 2017 14:35:12 -0700 Subject: label 2 is annoy --- .../Applications/ShiftoriumFrontend.Designer.cs | 125 +++++++++++---------- .../Applications/ShiftoriumFrontend.cs | 5 + 2 files changed, 68 insertions(+), 62 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs index 32d508b..f9d0bb4 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs @@ -61,16 +61,16 @@ namespace ShiftOS.WinForms.Applications this.btnbuy = new System.Windows.Forms.Button(); this.lbupgradetitle = new System.Windows.Forms.Label(); this.pnllist = new System.Windows.Forms.Panel(); + this.lbnoupgrades = new System.Windows.Forms.Label(); + this.panel3 = new System.Windows.Forms.Panel(); + this.lblcategorytext = new System.Windows.Forms.Label(); + this.btncat_forward = new System.Windows.Forms.Button(); + this.btncat_back = new System.Windows.Forms.Button(); 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(); @@ -159,6 +159,64 @@ namespace ShiftOS.WinForms.Applications this.pnllist.Size = new System.Drawing.Size(406, 427); this.pnllist.TabIndex = 0; // + // 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; + // + // 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; + // + // 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 = "No Upgrades"; + this.lblcategorytext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.lblcategorytext.Click += new System.EventHandler(this.lblcategorytext_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); + // + // 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); + // // lbcodepoints // this.lbcodepoints.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -215,63 +273,6 @@ namespace ShiftOS.WinForms.Applications 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); diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index 52e9a9e..08e6c8f 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -311,5 +311,10 @@ namespace ShiftOS.WinForms.Applications PopulateShiftorium(); } } + + private void lblcategorytext_Click(object sender, EventArgs e) + { + + } } } -- cgit v1.2.3 From 4a5db39ea7c0b9be342261ab416dbb5edf50b2ce Mon Sep 17 00:00:00 2001 From: wowmom98 Date: Sun, 7 May 2017 15:03:35 +0000 Subject: FIRST COMMIT FROM A MAC BUT TURIANS ARE COOL RIGHT --- ShiftOS.WinForms/Applications/TriWrite.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/TriWrite.cs b/ShiftOS.WinForms/Applications/TriWrite.cs index b5845ba..291aa30 100644 --- a/ShiftOS.WinForms/Applications/TriWrite.cs +++ b/ShiftOS.WinForms/Applications/TriWrite.cs @@ -21,7 +21,7 @@ namespace ShiftOS.WinForms.Applications public TriWrite() { - InitializeComponent(); + InitializeComponent(); //From the library of babel: "FIRST COMMIT FROM A MAC WOOOO TURIANS ARE COOL" } private void newToolStripMenuItem_Click(object sender, EventArgs e) -- cgit v1.2.3 From bded9d1250575e6b9824be9048ac7ac8669a303b Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 May 2017 19:17:47 -0400 Subject: ShiftOS is a hydra. You pop one bug off, 2,000 more grow in its place. --- ShiftOS.WinForms/Applications/About.Designer.cs | 10 +- ShiftOS.WinForms/Applications/About.cs | 71 +++++- ShiftOS.WinForms/AudioManager.cs | 62 +++++ ShiftOS.WinForms/Program.cs | 13 ++ ShiftOS.WinForms/Properties/Resources.Designer.cs | 110 ++++++++- ShiftOS.WinForms/Properties/Resources.resx | 39 +++- ShiftOS.WinForms/Resources/Ambient1.mp3 | Bin 0 -> 5765139 bytes ShiftOS.WinForms/Resources/Ambient2.mp3 | Bin 0 -> 5017165 bytes ShiftOS.WinForms/Resources/Ambient3.mp3 | Bin 0 -> 6948747 bytes ShiftOS.WinForms/Resources/Ambient4.mp3 | Bin 0 -> 6121813 bytes ShiftOS.WinForms/Resources/Ambient5.mp3 | Bin 0 -> 6025921 bytes ShiftOS.WinForms/Resources/Ambient6.mp3 | Bin 0 -> 5303077 bytes ShiftOS.WinForms/Resources/Ambient7.mp3 | Bin 0 -> 8237719 bytes ShiftOS.WinForms/Resources/Ambient8.mp3 | Bin 0 -> 8077862 bytes ShiftOS.WinForms/Resources/Ambient9.mp3 | Bin 0 -> 3859193 bytes ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 + ShiftOS_TheReturn/AppearanceManager.cs | 2 +- ShiftOS_TheReturn/AudioManager.cs | 9 +- ShiftOS_TheReturn/Commands.cs | 1 - ShiftOS_TheReturn/SaveSystem.cs | 15 ++ ShiftOS_TheReturn/TerminalBackend.cs | 269 +++++++++++----------- 21 files changed, 435 insertions(+), 175 deletions(-) create mode 100644 ShiftOS.WinForms/Resources/Ambient1.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient2.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient3.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient4.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient5.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient6.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient7.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient8.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient9.mp3 (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/About.Designer.cs b/ShiftOS.WinForms/Applications/About.Designer.cs index ab76eab..989d79b 100644 --- a/ShiftOS.WinForms/Applications/About.Designer.cs +++ b/ShiftOS.WinForms/Applications/About.Designer.cs @@ -55,7 +55,7 @@ namespace ShiftOS.WinForms.Applications this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.label1 = new System.Windows.Forms.Label(); this.lbshiftit = new System.Windows.Forms.Label(); - this.lbaboutdesc = new System.Windows.Forms.Label(); + this.lbaboutdesc = new System.Windows.Forms.TextBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -94,11 +94,11 @@ namespace ShiftOS.WinForms.Applications this.lbaboutdesc.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.lbaboutdesc.Location = new System.Drawing.Point(14, 126); + this.lbaboutdesc.Location = new System.Drawing.Point(23, 158); + this.lbaboutdesc.Multiline = true; this.lbaboutdesc.Name = "lbaboutdesc"; - this.lbaboutdesc.Size = new System.Drawing.Size(498, 328); + this.lbaboutdesc.Size = new System.Drawing.Size(492, 302); this.lbaboutdesc.TabIndex = 3; - this.lbaboutdesc.Text = "label2"; // // About // @@ -121,6 +121,6 @@ namespace ShiftOS.WinForms.Applications private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label lbshiftit; - private System.Windows.Forms.Label lbaboutdesc; + private System.Windows.Forms.TextBox lbaboutdesc; } } diff --git a/ShiftOS.WinForms/Applications/About.cs b/ShiftOS.WinForms/Applications/About.cs index f91e0cc..a27238d 100644 --- a/ShiftOS.WinForms/Applications/About.cs +++ b/ShiftOS.WinForms/Applications/About.cs @@ -53,18 +53,73 @@ namespace ShiftOS.WinForms.Applications lbaboutdesc.Text = $@"ShiftOS Copyright (c) 2015-{DateTime.Now.Year} Michael VanOverbeek and ShiftOS devs -Engine version: Milestone 3, 1.0 Beta Series (Developer mode ON) -Frontend version: 1.0 Beta 1.2 -Multi-user domain version: 1.0 Rolling-Release - -Music courtesy of Selulance. Listen to the Fractal Forest album here: -https://www.youtube.com/watch?v=LB5jAYDL3VU&t=913s +Engine version: Milestone 4, 1.0 Beta Series (Developer mode ON) +Frontend version: 1.0 Beta 2.5 +Digital Society version: 1.0 Rolling-Release +Project: Unite version: 1.0 Beta 1.7 Special thanks to Philip Adams, the original creator of ShiftOS for helping us grow our community of amazing Shifters by featuring us on the YouTube Millionaire series and advertising us throughout various other series ran by him. Also, thanks to Rylan Arbour, Victor Tran and the other community moderators and administrators for helping us keep the community peaceful. -Lastly, a huge special thanks to the community themselves - for testing, debugging, fixing, reporting bugs for, and enjoying our game even through its many failures, successes, revamps, etc. You guys are the reason we develop the game!"; +Lastly, a huge special thanks to the community themselves - for testing, debugging, fixing, reporting bugs for, and enjoying our game even through its many failures, successes, revamps, etc. You guys are the reason we develop the game! + + === Licensing information + +ShiftOS is licensed under the MIT license. + +Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the ""Software""), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is + +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + == Credit where credit is due + + -- Development and staff team: + - Rylan Arbour (Lead community administrator) + - Victor Tran (Discord administrator) + - cjhannah (ShiftFS backend developer) + - AShifter (Project: Unite penetration tester) + - arencllc (ShiftLetters developer) + - Michael VanOverbeek (Lead developer, system administrator, the guy who wrote this text) + - fixylol, Nebble, TravisNC, Neptune (Community moderators) + - bandic00t_ (Skin Engine stresstesting) + + -- System audio + + - Default system event sounds (Infobox, Network Connecting, System Beeps) are from the original ShiftOS 0.0.x source code. + - Ambient music list courtesy of https://www.youtube.com/channel/UC56Qctnsu8wAyvzf4Yx6LIw (ArgoFox | Royalty Free Music) + +Tracklist: + + Dylan Hardy - Strangely Unaffected +Noxive - Home +Dylan Hardy and Abraham Alberto - Slow Drift +A Himitsu - Easier To Fade +Noxive - Resilience +Wanderflux - Visions +Aerocity - Cold Weather Kids +Aether - Wanderlust +Aerocity - Love Lost + + +Finally, special thanks to our Patreon supporters. Without you guys, our servers wouldn't be running, and you wouldn't be reading this."; } public string GetEngineVersion() @@ -107,7 +162,7 @@ Lastly, a huge special thanks to the community themselves - for testing, debuggi public bool OnUnload() { - return false; + return true; } public void OnUpgrade() diff --git a/ShiftOS.WinForms/AudioManager.cs b/ShiftOS.WinForms/AudioManager.cs index 5c43ac4..eb0e798 100644 --- a/ShiftOS.WinForms/AudioManager.cs +++ b/ShiftOS.WinForms/AudioManager.cs @@ -24,8 +24,10 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; namespace ShiftOS.WinForms @@ -37,5 +39,65 @@ namespace ShiftOS.WinForms { } + + internal static byte[] GetRandomSong() + { + var r = new Random().Next(1, 10); + switch (r) + { + case 1: + return Properties.Resources.Ambient1; + case 2: + return Properties.Resources.Ambient2; + case 3: + return Properties.Resources.Ambient3; + case 4: + return Properties.Resources.Ambient4; + case 5: + return Properties.Resources.Ambient5; + case 6: + return Properties.Resources.Ambient6; + case 7: + return Properties.Resources.Ambient7; + case 8: + return Properties.Resources.Ambient8; + default: + return Properties.Resources.Ambient9; + + } + } + + internal static void StartAmbientLoop() + { + var athread = new Thread(() => + { + MemoryStream str = null; + NAudio.Wave.Mp3FileReader mp3 = null; + NAudio.Wave.WaveOut o = null; + while (!Engine.SaveSystem.ShuttingDown) + { + str = new MemoryStream(GetRandomSong()); + mp3 = new NAudio.Wave.Mp3FileReader(str); + o = new NAudio.Wave.WaveOut(); + o.Init(mp3); + bool c = false; + o.Play(); + o.PlaybackStopped += (s, a) => + { + c = true; + }; + while (!c) + Thread.Sleep(10); + str.Dispose(); + o.Dispose(); + mp3.Dispose(); + } + str?.Dispose(); + o?.Dispose(); + mp3?.Dispose(); + }); + athread.IsBackground = true; + athread.Start(); + } } } diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs index ad8fc83..256894d 100644 --- a/ShiftOS.WinForms/Program.cs +++ b/ShiftOS.WinForms/Program.cs @@ -49,6 +49,19 @@ namespace ShiftOS.WinForms Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //if ANYONE puts code before those two winforms config lines they will be declared a drunky. - Michael + SaveSystem.PreDigitalSocietyConnection += () => + { + Action completed = null; + completed = () => + { + SaveSystem.Ready = true; + Engine.AudioManager.PlayCompleted -= completed; + AudioManager.StartAmbientLoop(); + }; + Engine.AudioManager.PlayCompleted += completed; + Engine.AudioManager.PlayStream(Properties.Resources.dial_up_modem_02); + + }; LoginManager.Init(new GUILoginFrontend()); CrashHandler.SetGameMetadata(Assembly.GetExecutingAssembly()); SkinEngine.SetIconProber(new ShiftOSIconProvider()); diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs index caaf503..0152be8 100644 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -69,6 +69,96 @@ namespace ShiftOS.WinForms.Properties { } } + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient1 { + get { + object obj = ResourceManager.GetObject("Ambient1", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient2 { + get { + object obj = ResourceManager.GetObject("Ambient2", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient3 { + get { + object obj = ResourceManager.GetObject("Ambient3", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient4 { + get { + object obj = ResourceManager.GetObject("Ambient4", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient5 { + get { + object obj = ResourceManager.GetObject("Ambient5", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient6 { + get { + object obj = ResourceManager.GetObject("Ambient6", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient7 { + get { + object obj = ResourceManager.GetObject("Ambient7", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient8 { + get { + object obj = ResourceManager.GetObject("Ambient8", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient9 { + get { + object obj = ResourceManager.GetObject("Ambient9", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -994,22 +1084,18 @@ namespace ShiftOS.WinForms.Properties { /// /// Looks up a localized string similar to [ - /// //TEMPORARY - /// { - /// Name: "Desktop Widgets", - /// Cost: 0, - /// Description: "Temporary upgrade. Will be replaced by either a Shiftnet app or a story element.", - /// Dependencies: "advanced_app_launcher;wm_free_placement", - /// Category: "Work-in-progress" - /// }, - /// - /// - /// ///// SCREENSAVER /// { /// Name: "Screensavers", /// Cost: 750, - /// Description: "Like to leave your PC idle for long periods of time? Save some energy and keep your screen from being tired by hiding the desktop behind a black screen with an image on it." [rest of string was truncated]";. + /// Description: "Like to leave your PC idle for long periods of time? Save some energy and keep your screen from being tired by hiding the desktop behind a black screen with an image on it.", + /// Dependencies: "desktop", + /// Category: "Enhancements", + /// }, + /// { + /// Name: "GUI Based Login Screen", + /// Cost: 500, + /// Description: "Tired of using the text-based login screen in ShiftOS? Well, we have a functioning window manager, and a functioning desktop, w [rest of string was truncated]";. /// internal static string Shiftorium { get { diff --git a/ShiftOS.WinForms/Properties/Resources.resx b/ShiftOS.WinForms/Properties/Resources.resx index 688bcac..a90e69b 100644 --- a/ShiftOS.WinForms/Properties/Resources.resx +++ b/ShiftOS.WinForms/Properties/Resources.resx @@ -122,7 +122,7 @@ AAEAAAD/////AQAAAAAAAAAEAQAAABZTeXN0ZW0uSU8uTWVtb3J5U3RyZWFtCgAAAAdfYnVmZmVyB19v cmlnaW4JX3Bvc2l0aW9uB19sZW5ndGgJX2NhcGFjaXR5C19leHBhbmRhYmxlCV93cml0YWJsZQpfZXhw b3NhYmxlB19pc09wZW4dTWFyc2hhbEJ5UmVmT2JqZWN0K19faWRlbnRpdHkHAAAAAAAAAAACAggICAgB - AQEBCQIAAAAAAAAAAAAAAJKjAACSowAAAAEAAQoPAgAAAJKjAAACUklGRoqjAABXQVZFZm10IBAAAAAB + AQEBCQIAAAAAAAAAkqMAAJKjAACSowAAAAEAAQoPAgAAAJKjAAACUklGRoqjAABXQVZFZm10IBAAAAAB AAEARKwAAIhYAQACABAAZGF0YWajAAABAP7/AgD9/wMA/f8DAPz/BAD8/wQA/f8BAP//AAABAAAA//8C AP3/BAD9/wIAAAD//wIA//8BAAAAAAABAP//AQAAAAEAAAACAP7/AQABAAAAAQAAAAEAAAACAP7/AwD+ /wIAAAD//wIA/v8DAP7/AwD9/wMA//8AAAIA/f8DAAAA//8BAAAA/v8CAP////8CAPz/BAD8/wMA/f8A @@ -838,7 +838,7 @@ AAEAAAD/////AQAAAAAAAAAEAQAAABZTeXN0ZW0uSU8uTWVtb3J5U3RyZWFtCgAAAAdfYnVmZmVyB19v cmlnaW4JX3Bvc2l0aW9uB19sZW5ndGgJX2NhcGFjaXR5C19leHBhbmRhYmxlCV93cml0YWJsZQpfZXhw b3NhYmxlB19pc09wZW4dTWFyc2hhbEJ5UmVmT2JqZWN0K19faWRlbnRpdHkHAAAAAAAAAAACAggICAgB - AQEBCQIAAAAAAAAAAAAAAEwYAABMGAAAAAEAAQoPAgAAAEwYAAACUklGRkQYAABXQVZFZm10IBAAAAAB + AQEBCQIAAAAAAAAATBgAAEwYAABMGAAAAAEAAQoPAgAAAEwYAAACUklGRkQYAABXQVZFZm10IBAAAAAB AAEARKwAAIhYAQACABAAZGF0YSAYAAD/X5Vil2TRZUJmF2ZLZadjS2FqXt9aj1awUVtMc0b4PyQ57DFS KmUiSxoDEo4JEQGO+Bzwweee35zX9c+pyK7BGLsYtZqvlqoipneiW5/YnBCbFZq3mfOZEJvknD6fSqIg poaqcK/rtAq7i8FvyMrPgNdo347n7e9h+N8AXwnPERoaQSIlKrcx+zjmP0lGKUykUYJWs1pKXlJhpWMl @@ -964,7 +964,7 @@ ..\Resources\SweeperNormalFace.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\strings_en.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\strings_en.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 ..\Resources\SweeperTile5.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -974,7 +974,7 @@ AAEAAAD/////AQAAAAAAAAAEAQAAABZTeXN0ZW0uSU8uTWVtb3J5U3RyZWFtCgAAAAdfYnVmZmVyB19v cmlnaW4JX3Bvc2l0aW9uB19sZW5ndGgJX2NhcGFjaXR5C19leHBhbmRhYmxlCV93cml0YWJsZQpfZXhw b3NhYmxlB19pc09wZW4dTWFyc2hhbEJ5UmVmT2JqZWN0K19faWRlbnRpdHkHAAAAAAAAAAACAggICAgB - AQEBCQIAAAAAAAAAAAAAAPwBHgD8AR4AAAEAAQoPAgAAAPwBHgACUklGRvQBHgBXQVZFZm10IBAAAAAB + AQEBCQIAAAAAAAAA/AEeAPwBHgD8AR4AAAEAAQoPAgAAAPwBHgACUklGRvQBHgBXQVZFZm10IBAAAAAB AAIAgLsAAADuAgAEABAATElTVBQAAABJTkZPSUFSVAgAAABQaGlsaXAAAGRhdGG0AR4A//8CAAwA5v8a APT/8P8sAMf/OADX/xoA5v8bAPL/8/8aAOb/DQAOANb/KgDk/w4AAQDh/zwAt/9HAMj/GwACAPH/DgDy /w0AAQDy/xwA1f8sAO//5v84ALn/OQDk//7/AwD+/xAA4v8dANX/LADw//T/GgDl/w4AAADx/x4A4f8R @@ -33831,7 +33831,7 @@ AAEAAAD/////AQAAAAAAAAAEAQAAABZTeXN0ZW0uSU8uTWVtb3J5U3RyZWFtCgAAAAdfYnVmZmVyB19v cmlnaW4JX3Bvc2l0aW9uB19sZW5ndGgJX2NhcGFjaXR5C19leHBhbmRhYmxlCV93cml0YWJsZQpfZXhw b3NhYmxlB19pc09wZW4dTWFyc2hhbEJ5UmVmT2JqZWN0K19faWRlbnRpdHkHAAAAAAAAAAACAggICAgB - AQEBCQIAAAAAAAAAAAAAAPBWAADwVgAAAAEAAQoPAgAAAPBWAAACUklGRuhWAABXQVZFZm10IBAAAAAB + AQEBCQIAAAAAAAAA8FYAAPBWAADwVgAAAAEAAQoPAgAAAPBWAAACUklGRuhWAABXQVZFZm10IBAAAAAB AAEARKwAAIhYAQACABAAZGF0YcRWAAAAAGQL6gtkDL8MEA3kDLUMaAwUDKULKwuYCvcJQAl4CJ0Hrwaw BaAEfgNQAg4Bwf9p/v/8mfsn+rD4OPe59T/0wPJH8dPvYu7+7JzrTeoG6dLnreaX5Z/kruPl4jHinOEk 4cTgh+Bl4GLgguDC4B7hpeFC4g3j7uP35B/mZufO6FXq9eu67ZHviPGT87L15/cr+oL84f5QAcMDPwa9 @@ -34456,7 +34456,7 @@ AAEAAAD/////AQAAAAAAAAAEAQAAABZTeXN0ZW0uSU8uTWVtb3J5U3RyZWFtCgAAAAdfYnVmZmVyB19v cmlnaW4JX3Bvc2l0aW9uB19sZW5ndGgJX2NhcGFjaXR5C19leHBhbmRhYmxlCV93cml0YWJsZQpfZXhw b3NhYmxlB19pc09wZW4dTWFyc2hhbEJ5UmVmT2JqZWN0K19faWRlbnRpdHkHAAAAAAAAAAACAggICAgB - AQEBCQIAAAAAAAAAAAAAAIwWAACMFgAAAAEAAQoPAgAAAIwWAAACUklGRoQWAABXQVZFZm10IBAAAAAB + AQEBCQIAAAAAAAAAjBYAAIwWAACMFgAAAAEAAQoPAgAAAIwWAAACUklGRoQWAABXQVZFZm10IBAAAAAB AAEARKwAAIhYAQACABAAZGF0YWAWAAAAAKYLIxdYIhQtQjexQFBJ81CUVwddTmFLZP9lXmZqZSRjl1/J WtFUu02mRao84jJzKHsdJRKPBub6TO/q4+XYZM6FxG67ObMCrOel8aA9ncuar5nimWybQZ5eoq+nKa6t tTC+hcec0U3cbefr8on+MQq6FfQgxSsFNo8/R0gRUMpWblzSYAFk2WVlZpxlfmMbYHJboVWsTrdG1D0l @@ -34573,4 +34573,31 @@ ..\Resources\SuperDesk screenshot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Ambient1.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient2.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient3.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient4.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient5.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient6.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient7.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient8.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient9.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/Ambient1.mp3 b/ShiftOS.WinForms/Resources/Ambient1.mp3 new file mode 100644 index 0000000..d623b29 Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient1.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient2.mp3 b/ShiftOS.WinForms/Resources/Ambient2.mp3 new file mode 100644 index 0000000..b16e72f Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient2.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient3.mp3 b/ShiftOS.WinForms/Resources/Ambient3.mp3 new file mode 100644 index 0000000..cf06069 Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient3.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient4.mp3 b/ShiftOS.WinForms/Resources/Ambient4.mp3 new file mode 100644 index 0000000..7813b4f Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient4.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient5.mp3 b/ShiftOS.WinForms/Resources/Ambient5.mp3 new file mode 100644 index 0000000..521330e Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient5.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient6.mp3 b/ShiftOS.WinForms/Resources/Ambient6.mp3 new file mode 100644 index 0000000..86cb4a4 Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient6.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient7.mp3 b/ShiftOS.WinForms/Resources/Ambient7.mp3 new file mode 100644 index 0000000..9c5047a Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient7.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient8.mp3 b/ShiftOS.WinForms/Resources/Ambient8.mp3 new file mode 100644 index 0000000..ac908b6 Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient8.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient9.mp3 b/ShiftOS.WinForms/Resources/Ambient9.mp3 new file mode 100644 index 0000000..46cb670 Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient9.mp3 differ diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 411d701..1079203 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -757,6 +757,15 @@ + + + + + + + + + diff --git a/ShiftOS_TheReturn/AppearanceManager.cs b/ShiftOS_TheReturn/AppearanceManager.cs index 4c1754e..42642f8 100644 --- a/ShiftOS_TheReturn/AppearanceManager.cs +++ b/ShiftOS_TheReturn/AppearanceManager.cs @@ -223,9 +223,9 @@ namespace ShiftOS.Engine /// internal static void Exit() { - OnExit?.Invoke(); //disconnect from MUD ServerManager.Disconnect(); + Environment.Exit(0); } /// diff --git a/ShiftOS_TheReturn/AudioManager.cs b/ShiftOS_TheReturn/AudioManager.cs index a636497..c50bd24 100644 --- a/ShiftOS_TheReturn/AudioManager.cs +++ b/ShiftOS_TheReturn/AudioManager.cs @@ -47,9 +47,12 @@ namespace ShiftOS.Engine /// public static void Stop() { - _out?.Stop(); - _reader?.Dispose(); - _out?.Dispose(); + Desktop.InvokeOnWorkerThread(() => + { + _out?.Stop(); + _reader?.Dispose(); + _out?.Dispose(); + }); } /// diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index dc0b3a2..d622bb9 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -366,7 +366,6 @@ namespace ShiftOS.Engine public static bool Shutdown() { TerminalBackend.InvokeCommand("sos.save"); - SaveSystem.ShuttingDown = true; AppearanceManager.Exit(); return true; } diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 31db58a..948f95e 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -52,6 +52,9 @@ namespace ShiftOS.Engine public static ClientSave CurrentUser { get; set; } + public static bool Ready = false; + + public static event Action PreDigitalSocietyConnection; public static Save CurrentSave { get; set; } @@ -118,6 +121,18 @@ namespace ShiftOS.Engine Console.WriteLine("[inetd] Connecting to network..."); + Ready = false; + + if (PreDigitalSocietyConnection != null) + { + PreDigitalSocietyConnection?.Invoke(); + + while (!Ready) + { + Thread.Sleep(10); + } + } + if (defaultConf.ConnectToMud == true) { bool guidReceived = false; diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs index 9c57aa8..086ff40 100644 --- a/ShiftOS_TheReturn/TerminalBackend.cs +++ b/ShiftOS_TheReturn/TerminalBackend.cs @@ -213,211 +213,201 @@ namespace ShiftOS.Engine { if (Shiftorium.UpgradeAttributesUnlocked(method)) { - if (CanRunRemotely(method, isRemote)) + foreach (var ma in method.GetCustomAttributes(false)) { - foreach (var ma in method.GetCustomAttributes(false)) + if (ma is Command) { - if (ma is Command) + var cmd = ma as Command; + if (text.Split('.')[1] == cmd.name) { - var cmd = ma as Command; - if (text.Split('.')[1] == cmd.name) + if (KernelWatchdog.IsSafe(method)) { - if (KernelWatchdog.IsSafe(method)) + if (KernelWatchdog.CanRunOffline(method)) { - if (KernelWatchdog.CanRunOffline(method)) - { - var attr = method.GetCustomAttribute(); + var attr = method.GetCustomAttribute(); - if (attr != null) + if (attr != null) + { + string newcommand = attr.newcommand; + if (attr.warn) { - string newcommand = attr.newcommand; - if (attr.warn) - { - Console.WriteLine(Localization.Parse((newcommand == "" ? "{ERROR}" : "{WARN}") + attr.reason, new Dictionary() { + Console.WriteLine(Localization.Parse((newcommand == "" ? "{ERROR}" : "{WARN}") + attr.reason, new Dictionary() { {"%newcommand", newcommand} })); - } - if (newcommand != "") - { - // redo the entire process running newcommand + } + if (newcommand != "") + { + // redo the entire process running newcommand - return RunClient(newcommand, args); - } + return RunClient(newcommand, args); } + } - var requiresArgs = method.GetCustomAttributes(); - bool error = false; - bool providedusage = false; + var requiresArgs = method.GetCustomAttributes(); + bool error = false; + bool providedusage = false; - foreach (RequiresArgument argument in requiresArgs) + foreach (RequiresArgument argument in requiresArgs) + { + if (!args.ContainsKey(argument.argument)) { - if (!args.ContainsKey(argument.argument)) - { - if (!providedusage) - { - string usageparse = "{COMMAND_" + ns.name.ToUpper() + "_" + cmd.name.ToUpper() + "_USAGE}"; - if (usageparse == Localization.Parse(usageparse)) - usageparse = ""; - else - usageparse = Shiftorium.UpgradeInstalled("help_usage") ? Localization.Parse("{ERROR}{USAGE}" + usageparse, new Dictionary() { + if (!providedusage) + { + string usageparse = "{COMMAND_" + ns.name.ToUpper() + "_" + cmd.name.ToUpper() + "_USAGE}"; + if (usageparse == Localization.Parse(usageparse)) + usageparse = ""; + else + usageparse = Shiftorium.UpgradeInstalled("help_usage") ? Localization.Parse("{ERROR}{USAGE}" + usageparse, new Dictionary() { {"%ns", ns.name}, {"%cmd", cmd.name} }) : ""; - Console.WriteLine(usageparse); + Console.WriteLine(usageparse); - providedusage = true; - } - if (Shiftorium.UpgradeInstalled("help_usage")) - { - Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED}", new Dictionary() { + providedusage = true; + } + if (Shiftorium.UpgradeInstalled("help_usage")) + { + Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED}", new Dictionary() { {"%argument", argument.argument} })); - } - else - { - Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED_NO_USAGE}")); - } - - error = true; } - } + else + { + Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED_NO_USAGE}")); + } - if (error) - { - throw new Exception("{ERROR_COMMAND_WRONG}"); + error = true; } + } - try - { - return (bool)method.Invoke(null, new[] { args }); - } - catch (TargetInvocationException e) - { - Console.WriteLine(Localization.Parse("{ERROR_EXCEPTION_THROWN_IN_METHOD}")); - Console.WriteLine(e.InnerException.Message); - Console.WriteLine(e.InnerException.StackTrace); - return true; - } - catch - { - return (bool)method.Invoke(null, new object[] { }); - } + if (error) + { + throw new Exception("{ERROR_COMMAND_WRONG}"); + } + + try + { + return (bool)method.Invoke(null, new[] { args }); } - else + catch (TargetInvocationException e) { - Console.Write("<"); - ConsoleEx.Bold = true; - ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; - Console.Write("session_mgr"); - ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; - ConsoleEx.Bold = false; - Console.Write(">"); - ConsoleEx.Italic = true; - ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; - Console.WriteLine(" You cannot run this command while disconnected from the multi-user domain.."); + Console.WriteLine(Localization.Parse("{ERROR_EXCEPTION_THROWN_IN_METHOD}")); + Console.WriteLine(e.InnerException.Message); + Console.WriteLine(e.InnerException.StackTrace); return true; - + } + catch + { + return (bool)method.Invoke(null, new object[] { }); } } else { - if (SaveSystem.CurrentUser.Permissions == Objects.UserPermissions.Admin) - { - Infobox.PromptText("Elevate to root mode", "This command cannot be run as a regular user. To run this command, please enter your password to elevate to root mode temporarily.", (pass) => - { - if (pass == SaveSystem.CurrentUser.Password) - { - KernelWatchdog.EnterKernelMode(); - RunClient(text, args, isRemote); - KernelWatchdog.LeaveKernelMode(); - } - else - { - Infobox.Show("Access denied.", "You did not type in the correct password."); - } - }, true); - return true; - } Console.Write("<"); ConsoleEx.Bold = true; ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; - Console.Write("watchdog"); + Console.Write("session_mgr"); ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; ConsoleEx.Bold = false; Console.Write(">"); ConsoleEx.Italic = true; ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; - Console.WriteLine(" You cannot run this command. You do not have permission. Incident reported."); - KernelWatchdog.Log("potential_sys_breach", "user attempted to run kernel mode command " + text + " - watchdog has prevented this, good sir."); + Console.WriteLine(" You cannot run this command while disconnected from the multi-user domain.."); + return true; + + } + } + else + { + if (SaveSystem.CurrentUser.Permissions == Objects.UserPermissions.Admin) + { + Infobox.PromptText("Elevate to root mode", "This command cannot be run as a regular user. To run this command, please enter your password to elevate to root mode temporarily.", (pass) => + { + if (pass == SaveSystem.CurrentUser.Password) + { + KernelWatchdog.EnterKernelMode(); + RunClient(text, args, isRemote); + KernelWatchdog.LeaveKernelMode(); + } + else + { + Infobox.Show("Access denied.", "You did not type in the correct password."); + } + }, true); return true; } + Console.Write("<"); + ConsoleEx.Bold = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; + Console.Write("watchdog"); + ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; + ConsoleEx.Bold = false; + Console.Write(">"); + ConsoleEx.Italic = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine(" You cannot run this command. You do not have permission. Incident reported."); + KernelWatchdog.Log("potential_sys_breach", "user attempted to run kernel mode command " + text + " - watchdog has prevented this, good sir."); + return true; } } + } - } } } + else { - Console.WriteLine(text + " cannot be ran in a remote session"); + Console.Write("<"); + ConsoleEx.Bold = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; + Console.Write("session_mgr"); + ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; + ConsoleEx.Bold = false; + Console.Write(">"); + ConsoleEx.Italic = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine(" You cannot run this command while disconnected from the multi-user domain.."); return true; - } - } - - } + } + } + } else { + if (SaveSystem.CurrentUser.Permissions == Objects.UserPermissions.Admin) + { + Infobox.PromptText("Elevate to root mode", "This command cannot be run as a regular user. To run this command, please enter your password to elevate to root mode temporarily.", (pass) => + { + if (pass == SaveSystem.CurrentUser.Password) + { + KernelWatchdog.EnterKernelMode(); + RunClient(text, args, isRemote); + KernelWatchdog.LeaveKernelMode(); + } + else + { + Infobox.Show("Access denied.", "You did not type in the correct password."); + } + }, true); + return true; + } Console.Write("<"); ConsoleEx.Bold = true; ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; - Console.Write("session_mgr"); + Console.Write("watchdog"); ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; ConsoleEx.Bold = false; Console.Write(">"); ConsoleEx.Italic = true; ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; - Console.WriteLine(" You cannot run this command while disconnected from the multi-user domain.."); + Console.WriteLine(" You cannot run this command. You do not have permission. Incident reported."); + KernelWatchdog.Log("potential_sys_breach", "user attempted to run kernel mode command " + text + " - watchdog has prevented this, good sir."); return true; - } - - } - else - { - if (SaveSystem.CurrentUser.Permissions == Objects.UserPermissions.Admin) - { - Infobox.PromptText("Elevate to root mode", "This command cannot be run as a regular user. To run this command, please enter your password to elevate to root mode temporarily.", (pass) => - { - if (pass == SaveSystem.CurrentUser.Password) - { - KernelWatchdog.EnterKernelMode(); - RunClient(text, args, isRemote); - KernelWatchdog.LeaveKernelMode(); - } - else - { - Infobox.Show("Access denied.", "You did not type in the correct password."); - } - }, true); - return true; - } - Console.Write("<"); - ConsoleEx.Bold = true; - ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; - Console.Write("watchdog"); - ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; - ConsoleEx.Bold = false; - Console.Write(">"); - ConsoleEx.Italic = true; - ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; - Console.WriteLine(" You cannot run this command. You do not have permission. Incident reported."); - KernelWatchdog.Log("potential_sys_breach", "user attempted to run kernel mode command " + text + " - watchdog has prevented this, good sir."); - return true; } } } @@ -429,6 +419,7 @@ namespace ShiftOS.Engine } return false; } + public static void PrintPrompt() { if (SaveSystem.CurrentSave != null && CurrentUser != null) -- cgit v1.2.3 From c18c0fbc325b1c6a0864f88c6e2f4d2889d62e18 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 May 2017 20:32:28 -0400 Subject: dithering revamp --- ShiftOS.WinForms/Applications/Shifter.cs | 5 +- ShiftOS.WinForms/Program.cs | 1 + ShiftOS.WinForms/Tools/DitheringEngine.cs | 195 +++++++++++++----------------- ShiftOS.WinForms/WinformsDesktop.cs | 5 +- ShiftOS_TheReturn/Commands.cs | 17 +++ ShiftOS_TheReturn/Skinning.cs | 19 +++ 6 files changed, 123 insertions(+), 119 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/Shifter.cs b/ShiftOS.WinForms/Applications/Shifter.cs index 05ba638..edc3703 100644 --- a/ShiftOS.WinForms/Applications/Shifter.cs +++ b/ShiftOS.WinForms/Applications/Shifter.cs @@ -139,10 +139,7 @@ namespace ShiftOS.WinForms.Applications pnldesktoppreview.BackColor = Color.FromArgb(LoadedSkin.DesktopColor.R, LoadedSkin.DesktopColor.G, LoadedSkin.DesktopColor.B); //Not doing this will cause an ArgumentException. - DitheringEngine.DitherImage(SkinEngine.GetImage("desktopbackground"), new Action((img) => - { - pnldesktoppreview.BackgroundImage = img; - })); + pnldesktoppreview.BackgroundImage = SkinEngine.GetImage("desktopbackground"); pnldesktoppreview.BackgroundImageLayout = GetImageLayout("desktopbackground"); desktoppanel.BackColor = LoadedSkin.DesktopPanelColor; diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs index 256894d..73215d4 100644 --- a/ShiftOS.WinForms/Program.cs +++ b/ShiftOS.WinForms/Program.cs @@ -49,6 +49,7 @@ namespace ShiftOS.WinForms Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //if ANYONE puts code before those two winforms config lines they will be declared a drunky. - Michael + SkinEngine.SetPostProcessor(new DitheringSkinPostProcessor()); SaveSystem.PreDigitalSocietyConnection += () => { Action completed = null; diff --git a/ShiftOS.WinForms/Tools/DitheringEngine.cs b/ShiftOS.WinForms/Tools/DitheringEngine.cs index 8509a0b..f96a45a 100644 --- a/ShiftOS.WinForms/Tools/DitheringEngine.cs +++ b/ShiftOS.WinForms/Tools/DitheringEngine.cs @@ -33,6 +33,7 @@ using System.Drawing; using System.Threading; using ShiftOS.Engine; using System.Runtime.InteropServices; +using System.IO; namespace ShiftOS.WinForms.Tools { @@ -101,7 +102,7 @@ namespace ShiftOS.WinForms.Tools } } - public static void DitherColor(Color source, int width, int height, Action result) + public static Image DitherColor(Color source, int width, int height) { var bmp = new Bitmap(width + 1, height + 1); var data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format24bppRgb); @@ -115,7 +116,7 @@ namespace ShiftOS.WinForms.Tools } Marshal.Copy(rgb, 0, data.Scan0, rgb.Length); bmp.UnlockBits(data); - DitherImage(bmp, result); + return DitherImage(bmp); } @@ -226,15 +227,8 @@ namespace ShiftOS.WinForms.Tools #endif #if FLOYDSTEINBERG - public static void DitherImage(Image source, Action result) + public static Image DitherImage(Image source) { - if (source == null) - { - result?.Invoke(source); - return; - } - - var bmp = new Bitmap(source.Width, source.Height); var sourceBmp = (Bitmap)source; var sourceLck = sourceBmp.LockBits(new Rectangle(0, 0, sourceBmp.Width, sourceBmp.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format24bppRgb); @@ -267,121 +261,80 @@ namespace ShiftOS.WinForms.Tools bool color_depth_floydsteinberg = Shiftorium.UpgradeInstalled("color_depth_floyd-steinberg_dithering"); bool dithering = Shiftorium.UpgradeInstalled("color_depth_dithering"); - for (int y = 0; y < (destLck.Height); y++) + if (!sixteenBits) { - for (int x = 0; x < (Math.Abs(destLck.Stride)); x += 3) + if (dithering == true) { - int i = getIndexFromXY(x, y, width); - byte red = sourceArr[i]; - byte green = sourceArr[i + 1]; - byte blue = sourceArr[i + 2]; - - Color oldc = Color.FromArgb(red, green, blue); - Color newc; - - if (sixteenBits) + if (false == true) { - newc = GetColor(oldc); + } else { - int gray = ((oldc.R + oldc.G + oldc.B) / 3); - - byte newgray = 0; - - if (dithering && !color_depth_floydsteinberg) - gray += error_r; - - - - if (eightBits) + int error = 0; + for (int i = 0; i < destArr.Length; i += 3) { - newgray = (byte)gray; - error_r = 0; - } - else if(sixBits) - { - newgray = (byte)(linear(gray, 0, 0xFF, 0, 0x3F) * 3); - error_r = newgray - gray; - } - else if (fourBits) - { - newgray = (byte)(linear(gray, 0, 0xFF, 0, 0xF) * 0xF); - error_r = newgray - gray; - } - else if (twoBits) - { - if (gray >= 191) - newgray = 0xFF; - else if (gray >= 127) - newgray = Color.LightGray.R; - else if (gray >= 64) - newgray = Color.DarkGray.R; - else - newgray = 0x00; - error_r = newgray - gray; - } - else - { - if (gray >= 127) - newgray = 0xFF; - else - newgray = 0x00; - error_r = newgray - gray; - } - newc = Color.FromArgb(newgray, newgray, newgray); - } + byte r = sourceArr[i]; + byte g = sourceArr[i + 1]; + byte b = sourceArr[i + 2]; - int nextIndex = getIndexFromXY(x + 3, y, width); - int nextRow = getIndexFromXY(x, y + 1, width); - int nextIndexOnNextRow = getIndexFromXY(x + 3, y + 1, width); - int prevIndexOnNextRow = getIndexFromXY(x - 3, y + 1, width); - - grays[i] = newc.R; - grays[i + 1] = newc.G; - grays[i + 2] = newc.B; - - if (dithering) - { - if (color_depth_floydsteinberg) - { - if (x + 3 < width) + int gray = (((r + g + b) / 3) + error); + int newgray = gray; + if (!eightBits) { - sourceArr[nextIndex] += (byte)((error_r * 7) / 16); - sourceArr[nextIndex + 1] += (byte)((error_r * 7) / 16); - sourceArr[nextIndex + 2] += (byte)((error_r * 7) / 16); - } - if (y + 1 < height) - { - sourceArr[nextRow] += (byte)((error_r) / 16); - sourceArr[nextRow + 1] += (byte)((error_r) / 16); - sourceArr[nextRow + 2] += (byte)((error_r) / 16); - } - if (x + 3 < width && y + 1 < height) - { - sourceArr[nextIndexOnNextRow] += (byte)((error_r * 3) / 16); - sourceArr[nextIndexOnNextRow + 1] += (byte)((error_r * 3) / 16); - sourceArr[nextIndexOnNextRow + 2] += (byte)((error_r * 3) / 16); - + if (sixBits) + { + newgray = gray >> 2; + } + else + { + if (fourBits) + { + newgray = (int)linear(gray, 0, 255, 0, 63) * 4; + } + else + { + if (twoBits) + { + if (gray > 127 + 63) + { + newgray = 255; + } + else if (gray > 127) + newgray = 127 + 63; + else if (gray > 63) + { + newgray = 127; + } + else if (gray > 0) + newgray = 63; + else + newgray = 0; + } + else + { + if (gray > 127) + newgray = 255; + else + newgray = 0; + } + } + } } - if (x - 3 > 0 && y + 1 < height) - { - sourceArr[prevIndexOnNextRow] += (byte)((error_r * 5) / 16); - sourceArr[prevIndexOnNextRow + 1] += (byte)((error_r * 5) / 16); - sourceArr[prevIndexOnNextRow + 2] += (byte)((error_r * 5) / 16); + if (newgray > 255) + newgray = 255; + if (newgray < 0) + newgray = 0; + error = gray - newgray; + destArr[i] = (byte)newgray; + destArr[i+1] = (byte)newgray; + destArr[i+2] = (byte)newgray; - } } } } } - for (int i = 0; i < destArr.Length - 3; i++) - { - destArr[i] = grays[i]; - - } - Marshal.Copy(destArr, 0, destPtr, destBytes); @@ -389,8 +342,7 @@ namespace ShiftOS.WinForms.Tools - Desktop.InvokeOnWorkerThread(new Action(() => { result?.Invoke(bmp); })); - + return bmp; } #endif @@ -399,4 +351,25 @@ namespace ShiftOS.WinForms.Tools return (width * y) + x; } } + + public class DitheringSkinPostProcessor : ISkinPostProcessor + { + public byte[] ProcessImage(byte[] original) + { + try + { + var img = SkinEngine.ImageFromBinary(original); + var dithered = DitheringEngine.DitherImage(img); + using (var mstr = new MemoryStream()) + { + dithered.Save(mstr, System.Drawing.Imaging.ImageFormat.Bmp); + return mstr.ToArray(); + } + } + catch + { + return original; + } + } + } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 6825f34..4efef1b 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -390,10 +390,7 @@ namespace ShiftOS.WinForms this.BackColor = Color.FromArgb(LoadedSkin.DesktopColor.R, LoadedSkin.DesktopColor.G, LoadedSkin.DesktopColor.B); //Not doing this will cause an ArgumentException. - DitheringEngine.DitherImage(SkinEngine.GetImage("desktopbackground"), new Action((img) => - { - this.BackgroundImage = img; - })); + this.BackgroundImage = SkinEngine.GetImage("desktopbackground"); this.BackgroundImageLayout = GetImageLayout("desktopbackground"); desktoppanel.BackColor = LoadedSkin.DesktopPanelColor; diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index d622bb9..5b7674a 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -233,6 +233,23 @@ namespace ShiftOS.Engine [Namespace("dev")] public static class ShiftOSDevCommands { + [Command("buy")] + public static bool UnlockUpgrade(Dictionary args) + { + string upg = args["id"].ToString(); + try + { + SaveSystem.CurrentSave.Upgrades[upg] = true; + Shiftorium.InvokeUpgradeInstalled(); + SaveSystem.SaveGame(); + } + catch + { + Console.WriteLine("Upgrade not found."); + } + return true; + } + [Command("rock", description = "A little surprise for unstable builds...")] public static bool ThrowASandwichingRock() { diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index b731c4f..548e80f 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -66,6 +66,13 @@ namespace ShiftOS.Engine public static class SkinEngine { + private static ISkinPostProcessor processor = null; + + public static void SetPostProcessor(ISkinPostProcessor _processor) + { + processor = _processor; + } + public static ImageLayout GetImageLayout(string img) { if (LoadedSkin.SkinImageLayouts.ContainsKey(img)) @@ -93,6 +100,8 @@ namespace ShiftOS.Engine if (iattr.Name == img) { byte[] image = (byte[])field.GetValue(LoadedSkin); + if (processor != null) + image = processor.ProcessImage(image); return ImageFromBinary(image); } } @@ -1323,6 +1332,16 @@ namespace ShiftOS.Engine public string Category { get; set; } } + public interface ISkinPostProcessor + { + /// + /// Perform algorithmic operations at the bit level on a ShiftOS skin image. + /// + /// The image, as loaded by the engine, as a 32-bit ARGB byte array. + /// The processed image. + byte[] ProcessImage(byte[] original); + } + public class ShifterMetaAttribute : Attribute { -- cgit v1.2.3 From 94e1603b8574b45b809d3c66b6b90e7734a99d1e Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 May 2017 21:22:08 -0400 Subject: Post-intro tutorial --- ShiftOS.WinForms/Applications/Terminal.cs | 130 +++++++++++++++++++++++++++--- ShiftOS.WinForms/Controls/TerminalBox.cs | 4 + ShiftOS_TheReturn/TerminalBackend.cs | 61 +++++++------- 3 files changed, 156 insertions(+), 39 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index 32c5363..a14cc58 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -132,23 +132,31 @@ namespace ShiftOS.WinForms.Applications { ResetAllKeywords(); rtbterm.Text = ""; - if (!Shiftorium.UpgradeInstalled("desktop")) + if (Shiftorium.UpgradeInstalled("first_steps")) { - TerminalBackend.PrefixEnabled = true; - TerminalBackend.InStory = false; - TerminalBackend.PrintPrompt(); - if (Shiftorium.UpgradeInstalled("wm_free_placement")) + if (!Shiftorium.UpgradeInstalled("desktop")) { - this.ParentForm.Width = 640; - this.ParentForm.Height = 480; - this.ParentForm.Left = (Screen.PrimaryScreen.Bounds.Width - 640) / 2; - this.ParentForm.Top = (Screen.PrimaryScreen.Bounds.Height - 480) / 2; + TerminalBackend.PrefixEnabled = true; + TerminalBackend.InStory = false; + TerminalBackend.PrintPrompt(); + if (Shiftorium.UpgradeInstalled("wm_free_placement")) + { + this.ParentForm.Width = 640; + this.ParentForm.Height = 480; + this.ParentForm.Left = (Screen.PrimaryScreen.Bounds.Width - 640) / 2; + this.ParentForm.Top = (Screen.PrimaryScreen.Bounds.Height - 480) / 2; + } + } + else + { + AppearanceManager.Close(this); } } else { - AppearanceManager.Close(this); + Story.Start("first_steps"); + } })); } @@ -434,6 +442,108 @@ namespace ShiftOS.WinForms.Applications }).Start(); } + [Story("first_steps")] + public static void FirstSteps() + { + new Thread(() => + { + TerminalBackend.InStory = true; + Console.WriteLine("Hey there, and welcome to ShiftOS."); + Thread.Sleep(2000); + Console.WriteLine("My name is DevX. I am the developer of this operating system."); + Thread.Sleep(2000); + Console.WriteLine("Right now, I am using the Terminal application as a means of talking to you."); + Thread.Sleep(2000); + Console.WriteLine("ShiftOS is a very early operating system, but I have big plans for it."); + Thread.Sleep(2000); + Console.WriteLine("I can't reveal all my plans to you at this moment, but you play a big role."); + Thread.Sleep(2000); + Console.WriteLine("Your role in all of this is to help me develop ShiftOS more."); + Thread.Sleep(2000); + Console.WriteLine("You may not know how to program, but that's perfectly fine. You don't need to."); + Thread.Sleep(2000); + Console.WriteLine("What you do need to do, is simply use the operating system - like you would a regular computer."); + Thread.Sleep(2000); + Console.WriteLine("As you use ShiftOS, you will earn a special currency called Codepoints."); + Thread.Sleep(2000); + Console.WriteLine("The more things you do, the more Codepoints you get! Simple, right?"); + Thread.Sleep(2000); + Console.WriteLine("Once you rack up enough Codepoints, you can use them inside the Shiftorium to buy new features for ShiftOS."); + Thread.Sleep(2000); + Console.WriteLine("These features include new programs, system enhancements, Terminal commands, and so much more!"); + Thread.Sleep(2000); + Console.WriteLine("Ahh, that reminds me. I suppose you don't know how to use the Terminal yet, do you..."); + Thread.Sleep(2000); + Console.WriteLine("Well, the ShiftOS terminal is similar to a regular Linux terminal, however things are a bit... how you say.... primitive."); + Thread.Sleep(2000); + Console.WriteLine("Let's just say.... I've been focusing more on function than form with this one.... Anyways, here's how the terminal works."); + Thread.Sleep(2000); + Console.WriteLine("Each command is categorized into a \"Namespace\". All a namespace is, is a nice way of distinguishing between commands."); + Thread.Sleep(2000); + Console.WriteLine("...For example you may have a bunch of commands for managing files, and others for opening/closing programs."); + Thread.Sleep(2000); + Console.WriteLine("The three main namespaces you'll be using for the next while are the \"sos\", \"shiftorium\", and \"win\" namespaces."); + Thread.Sleep(2000); + Console.WriteLine("To run a command, simply type its namespace, followed by a period/full-stop, followed by the command name."); + Thread.Sleep(2000); + Console.WriteLine("Give it a try! Type \"sos.help\" in the following prompt to view a list of all ShiftOS commands."); + Thread.Sleep(2000); + TerminalBackend.InStory = false; + TerminalBackend.PrintPrompt(); + bool help_entered = false; + TerminalBackend.TextSent += (text) => + { + if (text == "sos.help" && help_entered == false) + help_entered = true; + }; + while (help_entered == false) + Thread.Sleep(10); + TerminalBackend.InStory = true; + Thread.Sleep(2000); + Console.WriteLine("Good job! Next, we will look at how to pass data to a command, such as win.open."); + Thread.Sleep(2000); + Console.WriteLine("In ShiftOS, passing data to a command is quite simple! After the command name, place an opening and closing curly brace, like so: \"win.open{}\"."); + Thread.Sleep(2000); + Console.WriteLine("Everything between those two curly braces is treated as command data."); + Thread.Sleep(2000); + Console.WriteLine("However, you can't just spam a bunch of 1s and 0s and call it a day, nonono!"); + Thread.Sleep(2000); + Console.WriteLine("Command data is split into a list of keys and values."); + Thread.Sleep(2000); + Console.WriteLine("The key tells the command the name of the data, and the value is what the command will see when it looks at the key."); + Thread.Sleep(2000); + Console.WriteLine("There are three main types of values. Booleans, which can be either \"true\" or \"false\", Numbers, which can be any integer number, positive or negative, and Strings - any piece of text as long as it is surrounded by double-quotes."); + Thread.Sleep(2000); + Console.WriteLine("For example, we could write every programmer's first program - by typing \"trm.echo{msg:\"Hello, world!\"}\". Running this will cause the Terminal to print, well, \"Hello, world!\""); + Thread.Sleep(2000); + Console.WriteLine("To open an application in ShiftOS, you can use this principle with the \"win.open\" command."); + Thread.Sleep(2000); + Console.WriteLine("First, type \"win.open\" with no data to see a list of all installed programs."); + Thread.Sleep(2000); + TerminalBackend.InStory = false; + bool winopenEntered = false; + TerminalBackend.PrintPrompt(); + TerminalBackend.TextSent += (text) => + { + if (help_entered == true) + if (text == "win.open" && winopenEntered == false) + winopenEntered = true; + }; + while (winopenEntered == false) + Thread.Sleep(10); + TerminalBackend.InStory = true; + Thread.Sleep(2000); + Console.WriteLine("Pretty cool, it gave you a nice list of other win.open commands that will let you open each program."); + Thread.Sleep(2000); + Console.WriteLine("I'll leave you to it, you've got the hang of it! One last thing, if ever you find yourself in another program, and want to exit, simply press CTRL+T to return to the Terminal."); + Thread.Sleep(2000); + + TerminalBackend.InStory = false; + TerminalBackend.PrintPrompt(); + SaveSystem.SaveGame(); + }).Start(); + } + public void OnSkinLoad() { try diff --git a/ShiftOS.WinForms/Controls/TerminalBox.cs b/ShiftOS.WinForms/Controls/TerminalBox.cs index ea7808c..e95d038 100644 --- a/ShiftOS.WinForms/Controls/TerminalBox.cs +++ b/ShiftOS.WinForms/Controls/TerminalBox.cs @@ -63,12 +63,14 @@ namespace ShiftOS.WinForms.Controls public void Write(string text) { + this.SuspendLayout(); this.HideSelection = true; this.SelectionFont = ConstructFont(); this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor); this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor); this.AppendText(Localization.Parse(text)); this.HideSelection = false; + this.ResumeLayout(); } private Font ConstructFont() @@ -86,6 +88,7 @@ namespace ShiftOS.WinForms.Controls public void WriteLine(string text) { + this.SuspendLayout(); Engine.AudioManager.PlayStream(Properties.Resources.writesound); this.HideSelection = true; this.Select(this.TextLength, 0); @@ -94,6 +97,7 @@ namespace ShiftOS.WinForms.Controls this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor); this.AppendText(Localization.Parse(text) + Environment.NewLine); this.HideSelection = false; + this.ResumeLayout(); } bool quickCopying = false; diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs index 086ff40..87bd24a 100644 --- a/ShiftOS_TheReturn/TerminalBackend.cs +++ b/ShiftOS_TheReturn/TerminalBackend.cs @@ -424,35 +424,38 @@ namespace ShiftOS.Engine { if (SaveSystem.CurrentSave != null && CurrentUser != null) { - ConsoleEx.BackgroundColor = SkinEngine.LoadedSkin.TerminalBackColorCC; - ConsoleEx.Italic = false; - ConsoleEx.Underline = false; - - ConsoleEx.ForegroundColor = ConsoleColor.Magenta; - ConsoleEx.Bold = true; - - Console.Write(SaveSystem.CurrentUser.Username); - ConsoleEx.Bold = false; - ConsoleEx.ForegroundColor = ConsoleColor.Gray; - Console.Write("@"); - ConsoleEx.Italic = true; - ConsoleEx.Bold = true; - ConsoleEx.ForegroundColor = ConsoleColor.Yellow; - Console.Write(SaveSystem.CurrentSave.SystemName); - ConsoleEx.Italic = false; - ConsoleEx.Bold = false; - ConsoleEx.ForegroundColor = ConsoleColor.Gray; - Console.Write(":~"); - Console.ForegroundColor = ConsoleColor.White; - ConsoleEx.Italic = true; - if (KernelWatchdog.InKernelMode == true) - Console.Write("#"); - else - Console.Write("$"); - ConsoleEx.Italic = false; - ConsoleEx.Bold = false; - ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; - Console.Write(" "); + Desktop.InvokeOnWorkerThread(() => + { + ConsoleEx.BackgroundColor = SkinEngine.LoadedSkin.TerminalBackColorCC; + ConsoleEx.Italic = false; + ConsoleEx.Underline = false; + + ConsoleEx.ForegroundColor = ConsoleColor.Magenta; + ConsoleEx.Bold = true; + + Console.Write(SaveSystem.CurrentUser.Username); + ConsoleEx.Bold = false; + ConsoleEx.ForegroundColor = ConsoleColor.Gray; + Console.Write("@"); + ConsoleEx.Italic = true; + ConsoleEx.Bold = true; + ConsoleEx.ForegroundColor = ConsoleColor.Yellow; + Console.Write(SaveSystem.CurrentSave.SystemName); + ConsoleEx.Italic = false; + ConsoleEx.Bold = false; + ConsoleEx.ForegroundColor = ConsoleColor.Gray; + Console.Write(":~"); + Console.ForegroundColor = ConsoleColor.White; + ConsoleEx.Italic = true; + if (KernelWatchdog.InKernelMode == true) + Console.Write("#"); + else + Console.Write("$"); + ConsoleEx.Italic = false; + ConsoleEx.Bold = false; + ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; + Console.Write(" "); + }); } } -- cgit v1.2.3 From c0f0e99f9d2a092209e710107c1f061fc8a2eaca Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 13 May 2017 10:22:51 -0400 Subject: Dithering, audio volume, and fix shutdown bug --- ShiftOS.Objects/Save.cs | 3 + ShiftOS.WinForms/Applications/Terminal.cs | 8 +- ShiftOS.WinForms/AudioManager.cs | 27 +++-- ShiftOS.WinForms/Program.cs | 6 +- ShiftOS.WinForms/Tools/DitheringEngine.cs | 160 ++++++++++++++++++++---------- ShiftOS_TheReturn/AppearanceManager.cs | 1 + ShiftOS_TheReturn/AudioManager.cs | 8 +- ShiftOS_TheReturn/Commands.cs | 34 +++++++ 8 files changed, 175 insertions(+), 72 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index 2a02bbc..cc19c79 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -35,6 +35,9 @@ namespace ShiftOS.Objects public class Save { + public int MusicVolume { get; set; } + public int SfxVolume { get; set; } + [Obsolete("This save variable is no longer used in Beta 2.4 and above of ShiftOS. Please use ShiftOS.Engine.SaveSystem.CurrentUser.Username to access the current user's username.")] public string Username { get; set; } diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index a14cc58..02c4cc0 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -491,9 +491,9 @@ namespace ShiftOS.WinForms.Applications TerminalBackend.InStory = false; TerminalBackend.PrintPrompt(); bool help_entered = false; - TerminalBackend.TextSent += (text) => + TerminalBackend.CommandProcessed += (text, args) => { - if (text == "sos.help" && help_entered == false) + if (text.EndsWith("sos.help") && help_entered == false) help_entered = true; }; while (help_entered == false) @@ -523,10 +523,10 @@ namespace ShiftOS.WinForms.Applications TerminalBackend.InStory = false; bool winopenEntered = false; TerminalBackend.PrintPrompt(); - TerminalBackend.TextSent += (text) => + TerminalBackend.CommandProcessed += (text, args) => { if (help_entered == true) - if (text == "win.open" && winopenEntered == false) + if (text.EndsWith("win.open") && winopenEntered == false) winopenEntered = true; }; while (winopenEntered == false) diff --git a/ShiftOS.WinForms/AudioManager.cs b/ShiftOS.WinForms/AudioManager.cs index eb0e798..ec12614 100644 --- a/ShiftOS.WinForms/AudioManager.cs +++ b/ShiftOS.WinForms/AudioManager.cs @@ -74,7 +74,19 @@ namespace ShiftOS.WinForms MemoryStream str = null; NAudio.Wave.Mp3FileReader mp3 = null; NAudio.Wave.WaveOut o = null; - while (!Engine.SaveSystem.ShuttingDown) + bool shuttingDown = false; + + Engine.AppearanceManager.OnExit += () => + { + shuttingDown = true; + o?.Stop(); + o?.Dispose(); + mp3?.Close(); + mp3?.Dispose(); + str?.Close(); + str?.Dispose(); + }; + while (shuttingDown == false) { str = new MemoryStream(GetRandomSong()); mp3 = new NAudio.Wave.Mp3FileReader(str); @@ -87,14 +99,15 @@ namespace ShiftOS.WinForms c = true; }; while (!c) + { + try + { + o.Volume = (float)Engine.SaveSystem.CurrentSave.MusicVolume / 100; + } + catch { } Thread.Sleep(10); - str.Dispose(); - o.Dispose(); - mp3.Dispose(); + } } - str?.Dispose(); - o?.Dispose(); - mp3?.Dispose(); }); athread.IsBackground = true; athread.Start(); diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs index 73215d4..8f65265 100644 --- a/ShiftOS.WinForms/Program.cs +++ b/ShiftOS.WinForms/Program.cs @@ -68,11 +68,7 @@ namespace ShiftOS.WinForms SkinEngine.SetIconProber(new ShiftOSIconProvider()); ShiftOS.Engine.AudioManager.Init(new ShiftOSAudioProvider()); Localization.RegisterProvider(new WFLanguageProvider()); - AppearanceManager.OnExit += () => - { - Environment.Exit(0); - }; - + TutorialManager.RegisterTutorial(new Oobe()); TerminalBackend.TerminalRequested += () => diff --git a/ShiftOS.WinForms/Tools/DitheringEngine.cs b/ShiftOS.WinForms/Tools/DitheringEngine.cs index f96a45a..d042a40 100644 --- a/ShiftOS.WinForms/Tools/DitheringEngine.cs +++ b/ShiftOS.WinForms/Tools/DitheringEngine.cs @@ -226,6 +226,53 @@ namespace ShiftOS.WinForms.Tools } #endif + public static int GetClosestColor(int gray, bool eightBits, bool sixBits, bool fourBits, bool twoBits) + { + int newgray = gray; + if (!eightBits) + { + if (sixBits) + { + newgray = gray >> 2; + } + else + { + if (fourBits) + { + newgray = (int)linear(gray, 0, 255, 0, 15) * 4; + } + else + { + if (twoBits) + { + if (gray > 127 + 63) + { + newgray = 255; + } + else if (gray > 127) + newgray = 127 + 63; + else if (gray > 63) + { + newgray = 127; + } + else if (gray > 0) + newgray = 63; + else + newgray = 0; + } + else + { + if (gray > 127) + newgray = 255; + else + newgray = 0; + } + } + } + } + return newgray; + } + #if FLOYDSTEINBERG public static Image DitherImage(Image source) { @@ -260,75 +307,78 @@ namespace ShiftOS.WinForms.Tools bool eightBits = Shiftorium.UpgradeInstalled("color_depth_8_bits"); bool color_depth_floydsteinberg = Shiftorium.UpgradeInstalled("color_depth_floyd-steinberg_dithering"); bool dithering = Shiftorium.UpgradeInstalled("color_depth_dithering"); - - if (!sixteenBits) + bool twentyfourbits = Shiftorium.UpgradeInstalled("color_depth_24_bits"); + if (twentyfourbits) + { + sourceArr.CopyTo(destArr, 0); + } + else { - if (dithering == true) + + if (!sixteenBits) { - if (false == true) + if (dithering == true) { + if (false == true) + { + + } + else + { + int error = 0; + for (int i = 0; i < destArr.Length; i += 3) + { + byte r = sourceArr[i]; + byte g = sourceArr[i + 1]; + byte b = sourceArr[i + 2]; + + if (SkinEngine.LoadedSkin.SystemKey == Color.FromArgb(r, g, b)) + { + destArr[i] = r; + destArr[i + 1] = g; + destArr[i + 2] = b; + continue; + } + + int gray = (((r + g + b) / 3) + error); + int newgray = gray; + newgray = GetClosestColor(gray, eightBits, sixBits, fourBits, twoBits); + if (newgray > 255) + newgray = 255; + if (newgray < 0) + newgray = 0; + error = gray - newgray; + destArr[i] = (byte)newgray; + destArr[i + 1] = (byte)newgray; + destArr[i + 2] = (byte)newgray; + + } + } } + else { - int error = 0; - for (int i = 0; i < destArr.Length; i += 3) + for (int i = 0; i < sourceArr.Length; i += 3) { byte r = sourceArr[i]; byte g = sourceArr[i + 1]; byte b = sourceArr[i + 2]; - - int gray = (((r + g + b) / 3) + error); - int newgray = gray; - if (!eightBits) + if (SkinEngine.LoadedSkin.SystemKey == Color.FromArgb(r, g, b)) { - if (sixBits) - { - newgray = gray >> 2; - } - else - { - if (fourBits) - { - newgray = (int)linear(gray, 0, 255, 0, 63) * 4; - } - else - { - if (twoBits) - { - if (gray > 127 + 63) - { - newgray = 255; - } - else if (gray > 127) - newgray = 127 + 63; - else if (gray > 63) - { - newgray = 127; - } - else if (gray > 0) - newgray = 63; - else - newgray = 0; - } - else - { - if (gray > 127) - newgray = 255; - else - newgray = 0; - } - } - } + destArr[i] = r; + destArr[i + 1] = g; + destArr[i + 2] = b; + continue; } - if (newgray > 255) - newgray = 255; - if (newgray < 0) - newgray = 0; - error = gray - newgray; + + int gray = (r + g + b) / 3; + int newgray = GetClosestColor(gray, eightBits, sixBits, fourBits, twoBits); destArr[i] = (byte)newgray; - destArr[i+1] = (byte)newgray; - destArr[i+2] = (byte)newgray; + destArr[i + 1] = (byte)newgray; + destArr[i + 2] = (byte)newgray; + + } } diff --git a/ShiftOS_TheReturn/AppearanceManager.cs b/ShiftOS_TheReturn/AppearanceManager.cs index 42642f8..d8004bc 100644 --- a/ShiftOS_TheReturn/AppearanceManager.cs +++ b/ShiftOS_TheReturn/AppearanceManager.cs @@ -223,6 +223,7 @@ namespace ShiftOS.Engine /// internal static void Exit() { + OnExit?.Invoke(); //disconnect from MUD ServerManager.Disconnect(); Environment.Exit(0); diff --git a/ShiftOS_TheReturn/AudioManager.cs b/ShiftOS_TheReturn/AudioManager.cs index c50bd24..fff3369 100644 --- a/ShiftOS_TheReturn/AudioManager.cs +++ b/ShiftOS_TheReturn/AudioManager.cs @@ -88,7 +88,13 @@ namespace ShiftOS.Engine _reader = new AudioFileReader(file); _out = new WaveOut(); _out.Init(_reader); - _out.Volume = _provider.Volume; + try + { + _out.Volume = (float)SaveSystem.CurrentSave.SfxVolume / 100; + } + catch + { + } _out.Play(); _out.PlaybackStopped += (o, a) => { PlayCompleted?.Invoke(); }; } diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index 5b7674a..6e59311 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -378,6 +378,40 @@ namespace ShiftOS.Engine [Namespace("sos")] public static class ShiftOSCommands { + [Command("setsfxvolume", description = "Set the volume of various sound effects to a value between 1 and 100.")] + [RequiresArgument("value")] + public static bool SetSfxVolume(Dictionary args) + { + int value = int.Parse(args["value"].ToString()); + if (value >= 0 && value <= 100) + { + SaveSystem.CurrentSave.SfxVolume = value; + SaveSystem.SaveGame(); + } + else + { + Console.WriteLine("Volume must be between 0 and 100!"); + } + return true; + } + + [Command("setmusicvolume", description ="Set the music volume to a value between 1 and 100.")] + [RequiresArgument("value")] + public static bool SetMusicVolume(Dictionary args) + { + int value = int.Parse(args["value"].ToString()); + if(value >= 0 && value <= 100) + { + SaveSystem.CurrentSave.MusicVolume = value; + SaveSystem.SaveGame(); + } + else + { + Console.WriteLine("Volume must be between 0 and 100!"); + } + return true; + } + [RemoteLock] [Command("shutdown")] public static bool Shutdown() -- cgit v1.2.3 From 7919afa133561da65304f01498db5993510702e8 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 14 May 2017 13:15:12 -0400 Subject: Custom buttons and progress bars. --- .../Applications/AudioPlayer.Designer.cs | 2 - .../Applications/Installer.Designer.cs | 2 - .../Applications/ShiftoriumFrontend.Designer.cs | 2 - .../Applications/UpdateManager.Designer.cs | 2 - .../Applications/VideoPlayer.Designer.cs | 2 - ShiftOS.WinForms/Controls/ShiftedProgressBar.cs | 91 +++++++++++++--- .../DesktopWidgets/UpgradePercentage.Designer.cs | 2 - ShiftOS.WinForms/DownloadControl.Designer.cs | 2 - ShiftOS.WinForms/Resources/Shiftorium.txt | 14 +++ ShiftOS.WinForms/Tools/ControlManager.cs | 43 ++++++++ ShiftOS_TheReturn/Skinning.cs | 121 +++++++++++++++++++++ 11 files changed, 251 insertions(+), 32 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/AudioPlayer.Designer.cs b/ShiftOS.WinForms/Applications/AudioPlayer.Designer.cs index 6263ff7..d7f03a0 100644 --- a/ShiftOS.WinForms/Applications/AudioPlayer.Designer.cs +++ b/ShiftOS.WinForms/Applications/AudioPlayer.Designer.cs @@ -141,12 +141,10 @@ namespace ShiftOS.WinForms.Applications // // pgplaytime // - this.pgplaytime.BlockSize = 5; this.pgplaytime.Location = new System.Drawing.Point(46, 3); this.pgplaytime.Maximum = 100; this.pgplaytime.Name = "pgplaytime"; this.pgplaytime.Size = new System.Drawing.Size(749, 23); - this.pgplaytime.Style = System.Windows.Forms.ProgressBarStyle.Continuous; this.pgplaytime.TabIndex = 1; this.pgplaytime.Tag = "keepbg"; this.pgplaytime.Text = "shiftedProgressBar1"; diff --git a/ShiftOS.WinForms/Applications/Installer.Designer.cs b/ShiftOS.WinForms/Applications/Installer.Designer.cs index 48f9146..b01986d 100644 --- a/ShiftOS.WinForms/Applications/Installer.Designer.cs +++ b/ShiftOS.WinForms/Applications/Installer.Designer.cs @@ -118,12 +118,10 @@ // this.pginstall.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.pginstall.BlockSize = 5; this.pginstall.Location = new System.Drawing.Point(17, 161); this.pginstall.Maximum = 100; this.pginstall.Name = "pginstall"; this.pginstall.Size = new System.Drawing.Size(414, 23); - this.pginstall.Style = System.Windows.Forms.ProgressBarStyle.Continuous; this.pginstall.TabIndex = 2; this.pginstall.Text = "shiftedProgressBar1"; this.pginstall.Value = 0; diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs index f9d0bb4..dc107c4 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs @@ -242,12 +242,10 @@ namespace ShiftOS.WinForms.Applications // this.pgupgradeprogress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.pgupgradeprogress.BlockSize = 5; this.pgupgradeprogress.Location = new System.Drawing.Point(146, 390); this.pgupgradeprogress.Maximum = 100; this.pgupgradeprogress.Name = "pgupgradeprogress"; this.pgupgradeprogress.Size = new System.Drawing.Size(254, 23); - this.pgupgradeprogress.Style = System.Windows.Forms.ProgressBarStyle.Continuous; this.pgupgradeprogress.TabIndex = 1; this.pgupgradeprogress.Value = 25; // diff --git a/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs b/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs index 0b23b8e..d30e2df 100644 --- a/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs +++ b/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs @@ -64,12 +64,10 @@ // this.pgdownload.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.pgdownload.BlockSize = 5; this.pgdownload.Location = new System.Drawing.Point(86, 4); this.pgdownload.Maximum = 100; this.pgdownload.Name = "pgdownload"; this.pgdownload.Size = new System.Drawing.Size(427, 23); - this.pgdownload.Style = System.Windows.Forms.ProgressBarStyle.Continuous; this.pgdownload.TabIndex = 2; this.pgdownload.Text = "Updating..."; this.pgdownload.Value = 0; diff --git a/ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs b/ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs index d915c31..1d93047 100644 --- a/ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs +++ b/ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs @@ -91,12 +91,10 @@ // // pgplaytime // - this.pgplaytime.BlockSize = 5; this.pgplaytime.Location = new System.Drawing.Point(46, 3); this.pgplaytime.Maximum = 100; this.pgplaytime.Name = "pgplaytime"; this.pgplaytime.Size = new System.Drawing.Size(749, 23); - this.pgplaytime.Style = System.Windows.Forms.ProgressBarStyle.Continuous; this.pgplaytime.TabIndex = 1; this.pgplaytime.Tag = "keepbg"; this.pgplaytime.Text = "shiftedProgressBar1"; diff --git a/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs b/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs index e5a2c33..ceaff02 100644 --- a/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs +++ b/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs @@ -31,6 +31,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using ShiftOS.Engine; namespace ShiftOS.WinForms.Controls { @@ -46,7 +47,7 @@ namespace ShiftOS.WinForms.Controls t.Interval = 100; t.Tick += (o, a) => { - if(this._style == ProgressBarStyle.Marquee) + if(this.Style == ProgressBarStyle.Marquee) { if(_marqueePos >= this.Width) { @@ -89,46 +90,100 @@ namespace ShiftOS.WinForms.Controls } } - public ProgressBarStyle _style = ProgressBarStyle.Continuous; - public ProgressBarStyle Style { - get { return _style; } - set { _style = value; this.Refresh(); } + get + { + return SkinEngine.LoadedSkin.ProgressBarStyle; + } } - private int _blocksize = 5; - public int BlockSize { - get { return _blocksize; } - set + get { - _blocksize = value; - this.Refresh(); + return SkinEngine.LoadedSkin.ProgressBarBlockSize; + } + } + + public Color RealBackColor + { + get + { + return SkinEngine.LoadedSkin.ProgressBarBackgroundColor; + } + } + + public Image RealBackgroundImage + { + get + { + return SkinEngine.GetImage("progressbarbg"); + } + } + + public Image ProgressImage + { + get + { + return SkinEngine.GetImage("progress"); + } + } + + public Color ProgressColor + { + get + { + return SkinEngine.LoadedSkin.ProgressColor; } } protected override void OnPaint(PaintEventArgs pe) { - pe.Graphics.Clear(Color.Black); - switch (_style) + pe.Graphics.Clear(this.RealBackColor); + if(RealBackgroundImage != null) + { + pe.Graphics.FillRectangle(new TextureBrush(RealBackgroundImage), new Rectangle(0, 0, this.Width, this.Height)); + } + switch (Style) { case ProgressBarStyle.Continuous: double width = linear(this.Value, 0, this.Maximum, 0, this.Width); - pe.Graphics.FillRectangle(new SolidBrush(Color.Green), new RectangleF(0, 0, (float)width, this.Height)); + if (ProgressImage != null) + { + pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new RectangleF(0, 0, (float)width, this.Height)); + } + else + { + pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new RectangleF(0, 0, (float)width, this.Height)); + } break; case ProgressBarStyle.Blocks: - int block_count = this.Width / (this._blocksize + 2); + int block_count = this.Width / (this.BlockSize + 2); int blocks = (int)linear(this.Value, 0, this.Maximum, 0, block_count); for(int i = 0; i < blocks - 1; i++) { - int position = i * (_blocksize + 2); - pe.Graphics.FillRectangle(new SolidBrush(Color.Green), new Rectangle(position, 0, _blocksize, this.Height)); + int position = i * (BlockSize + 2); + if (ProgressImage != null) + { + pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(position, 0, BlockSize, this.Height)); + + } + else + { + pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new Rectangle(position, 0, BlockSize, this.Height)); + } } break; case ProgressBarStyle.Marquee: - pe.Graphics.FillRectangle(new SolidBrush(Color.Green), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height)); + if (ProgressImage != null) + { + pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height)); + } + else + { + pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height)); + } break; } } diff --git a/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.Designer.cs b/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.Designer.cs index ca0d587..4867c8d 100644 --- a/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.Designer.cs +++ b/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.Designer.cs @@ -34,13 +34,11 @@ // // pgupgrades // - this.pgupgrades.BlockSize = 5; this.pgupgrades.Dock = System.Windows.Forms.DockStyle.Bottom; this.pgupgrades.Location = new System.Drawing.Point(0, 99); this.pgupgrades.Maximum = 100; this.pgupgrades.Name = "pgupgrades"; this.pgupgrades.Size = new System.Drawing.Size(227, 23); - this.pgupgrades.Style = System.Windows.Forms.ProgressBarStyle.Continuous; this.pgupgrades.TabIndex = 0; this.pgupgrades.Text = "shiftedProgressBar1"; this.pgupgrades.Value = 0; diff --git a/ShiftOS.WinForms/DownloadControl.Designer.cs b/ShiftOS.WinForms/DownloadControl.Designer.cs index 2587b93..69c828d 100644 --- a/ShiftOS.WinForms/DownloadControl.Designer.cs +++ b/ShiftOS.WinForms/DownloadControl.Designer.cs @@ -83,12 +83,10 @@ namespace ShiftOS.WinForms // this.pgprogress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.pgprogress.BlockSize = 5; this.pgprogress.Location = new System.Drawing.Point(4, 52); this.pgprogress.Maximum = 100; this.pgprogress.Name = "pgprogress"; this.pgprogress.Size = new System.Drawing.Size(371, 23); - this.pgprogress.Style = System.Windows.Forms.ProgressBarStyle.Continuous; this.pgprogress.TabIndex = 0; this.pgprogress.Text = "shiftedProgressBar1"; this.pgprogress.Value = 0; diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index c3d27ae..cc68c6f 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -7,6 +7,20 @@ Dependencies: "desktop", Category: "Enhancements", }, + { + Name: "Shift Progress Bar", + Cost: 150, + Description: "Want to customize the look of all ShiftOS Progress Bars? Buy this upgrade today and you'll get the ability to set the foreground and background color of the progress bar, and many more things!.", + Dependencies: "shifter;shift_buttons", + Category: "Customization" + }, + { + Name: "Shift Buttons", + Cost: 150, + Description: "Want to customize the look of all ShiftOS buttons? This Shifter upgrade gives you a new \"Buttons\" category in the System category to do just that.", + Dependencies: "shifter", + Category: "Customization" + }, { Name: "GUI Based Login Screen", Cost: 500, diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs index 3d66b2b..4f888ab 100644 --- a/ShiftOS.WinForms/Tools/ControlManager.cs +++ b/ShiftOS.WinForms/Tools/ControlManager.cs @@ -214,6 +214,49 @@ namespace ShiftOS.WinForms.Tools { } + + if(ctrl is Button) + { + Desktop.InvokeOnWorkerThread(() => + { + Button b = ctrl as Button; + b.BackColor = SkinEngine.LoadedSkin.ButtonBackgroundColor; + b.BackgroundImage = SkinEngine.GetImage("buttonidle"); + b.BackgroundImageLayout = SkinEngine.GetImageLayout("buttonidle"); + b.FlatAppearance.BorderSize = SkinEngine.LoadedSkin.ButtonBorderWidth; + b.FlatAppearance.BorderColor = SkinEngine.LoadedSkin.ButtonForegroundColor; + b.ForeColor = SkinEngine.LoadedSkin.ButtonForegroundColor; + b.Font = SkinEngine.LoadedSkin.ButtonTextFont; + + b.MouseEnter += (o, a) => + { + b.BackColor = SkinEngine.LoadedSkin.ButtonHoverColor; + b.BackgroundImage = SkinEngine.GetImage("buttonhover"); + b.BackgroundImageLayout = SkinEngine.GetImageLayout("buttonhover"); + }; + b.MouseLeave += (o, a) => + { + b.BackColor = SkinEngine.LoadedSkin.ButtonBackgroundColor; + b.BackgroundImage = SkinEngine.GetImage("buttonidle"); + b.BackgroundImageLayout = SkinEngine.GetImageLayout("buttonidle"); + }; + b.MouseUp += (o, a) => + { + b.BackColor = SkinEngine.LoadedSkin.ButtonBackgroundColor; + b.BackgroundImage = SkinEngine.GetImage("buttonidle"); + b.BackgroundImageLayout = SkinEngine.GetImageLayout("buttonidle"); + }; + + b.MouseDown += (o, a) => + { + b.BackColor = SkinEngine.LoadedSkin.ButtonPressedColor; + b.BackgroundImage = SkinEngine.GetImage("buttonpressed"); + b.BackgroundImageLayout = SkinEngine.GetImageLayout("buttonpressed"); + + }; + }); + } + ctrl.KeyDown += (o, a) => { if (a.Control && a.KeyCode == Keys.T) diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index 4340f1a..c2f47fa 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -276,6 +276,127 @@ namespace ShiftOS.Engine [ShifterHidden] public Dictionary AppIcons = new Dictionary(); + [ShifterMeta("System")] + [ShifterCategory("Progress Bar")] + [RequiresUpgrade("shift_progress_bar;skinning")] + [Image("progressbarbg")] + [ShifterName("Progress Bar Background Image")] + [ShifterDescription("Set an image for the background of a progress bar.")] + public byte[] ProgressBarBG = null; + + + [ShifterMeta("System")] + [ShifterCategory("Progress Bar")] + [RequiresUpgrade("shift_progress_bar;skinning")] + [Image("progress")] + [ShifterName("Progress Image")] + [ShifterDescription("Set the image for the progress inside a progress bar.")] + public byte[] Progress = null; + + + [ShifterMeta("System")] + [ShifterCategory("Progress Bar")] + [RequiresUpgrade("shift_progress_bar")] + [ShifterName("Progress bar foreground color")] + [ShifterDescription("Set the color of the progress indicator.")] + public Color ProgressColor = Accent1; + + + [ShifterMeta("System")] + [ShifterCategory("Progress Bar")] + [RequiresUpgrade("shift_progress_bar")] + [ShifterName("Progress bar background color")] + [ShifterDescription("The background color of the progress bar.")] + public Color ProgressBarBackgroundColor = Color.Black; + + + [ShifterMeta("System")] + [ShifterCategory("Progress Bar")] + [RequiresUpgrade("shift_progress_bar")] + [ShifterName("Progress bar block size")] + [ShifterDescription("If the progress bar style is set to Blocks, this determines how wide each block should be.")] + public int ProgressBarBlockSize = 15; + + + [ShifterMeta("System")] + [ShifterCategory("Progress Bar")] + [RequiresUpgrade("shift_progress_bar")] + [ShifterDescription("Set the style of a progress bar.\r\nMarquee: The progress bar will render a box that moves from the left to the right in a loop.\r\nContinuous: Progress is shown by a single, continuous box.\r\nBlocks: Just like Continuous, but the box is split into even smaller boxes of a set width.")] + [ShifterName("Progress bar style")] + public ProgressBarStyle ProgressBarStyle = ProgressBarStyle.Continuous; + + + + + + + [ShifterMeta("System")] + [ShifterCategory("Buttons")] + [RequiresUpgrade("shift_buttons")] + [ShifterName("Button background color")] + [ShifterDescription("Set the background color for each button's Idle state.")] + public Color ButtonBackgroundColor = Skin.DefaultBackground; + + [ShifterMeta("System")] + [ShifterCategory("Buttons")] + [RequiresUpgrade("shift_buttons;skinning")] + [Image("buttonhover")] + [ShifterName("Button hover image")] + [ShifterDescription("Set the image that's displayed when the mouse hovers over a button.")] + public byte[] ButtonHoverImage = null; + + [ShifterMeta("System")] + [ShifterCategory("Buttons")] + [RequiresUpgrade("skinning;shift_buttons")] + [Image("buttonpressed")] + [ShifterName("Button pressed image")] + [ShifterDescription("Select an image to show when the user presses a button.")] + public byte[] ButtonPressedImage = null; + + [ShifterMeta("System")] + [ShifterCategory("Buttons")] + [RequiresUpgrade("shift_buttons")] + [ShifterName("Button hover color")] + [ShifterDescription("Choose the color that displays on a button when the mouse hovers over it.")] + public Color ButtonHoverColor = Skin.Accent1; + + [ShifterMeta("System")] + [ShifterCategory("Buttons")] + [RequiresUpgrade("shift_buttons")] + [ShifterName("Button pressed color")] + [ShifterDescription("Select the background color for the button when the mouse clicks it.")] + public Color ButtonPressedColor = Skin.Accent2; + + [ShifterMeta("System")] + [ShifterCategory("Buttons")] + [RequiresUpgrade("shift_buttons")] + [ShifterName("Button foreground color")] + [ShifterDescription("Select the text and border color for each button.")] + public Color ButtonForegroundColor = Skin.DefaultForeground; + + [ShifterMeta("System")] + [ShifterCategory("Buttons")] + [RequiresUpgrade("shift_buttons")] + [ShifterName("Button border width")] + [ShifterDescription("Set the width, in pixels, of the button's border.")] + public int ButtonBorderWidth = 2; + + [ShifterMeta("System")] + [ShifterCategory("Buttons")] + [RequiresUpgrade("shift_buttons")] + [ShifterName("Button font")] + [ShifterDescription("Select the font for the button's text.")] + public Font ButtonTextFont = Skin.SysFont; + + [ShifterMeta("System")] + [ShifterCategory("Buttons")] + [RequiresUpgrade("shift_buttons;skinning")] + [Image("buttonidle")] + [ShifterName("Button background color")] + [ShifterDescription("Select an image to show as the button's Idle state.")] + public byte[] ButtonBG = null; + + [Image("panelclockbg")] [ShifterMeta("Desktop")] [ShifterCategory("Panel Clock")] -- cgit v1.2.3 From 46a92866f8ac757bd236746be7ed11a1a0c39f86 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 18 May 2017 18:56:58 -0400 Subject: fix beta 2.5 first_steps --- ShiftOS.WinForms/Applications/Terminal.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index 02c4cc0..8fa785a 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -445,6 +445,7 @@ namespace ShiftOS.WinForms.Applications [Story("first_steps")] public static void FirstSteps() { + TerminalBackend.PrefixEnabled = false; new Thread(() => { TerminalBackend.InStory = true; @@ -489,6 +490,7 @@ namespace ShiftOS.WinForms.Applications Console.WriteLine("Give it a try! Type \"sos.help\" in the following prompt to view a list of all ShiftOS commands."); Thread.Sleep(2000); TerminalBackend.InStory = false; + TerminalBackend.PrefixEnabled = true; TerminalBackend.PrintPrompt(); bool help_entered = false; TerminalBackend.CommandProcessed += (text, args) => @@ -499,6 +501,7 @@ namespace ShiftOS.WinForms.Applications while (help_entered == false) Thread.Sleep(10); TerminalBackend.InStory = true; + TerminalBackend.PrefixEnabled = false; Thread.Sleep(2000); Console.WriteLine("Good job! Next, we will look at how to pass data to a command, such as win.open."); Thread.Sleep(2000); @@ -522,6 +525,7 @@ namespace ShiftOS.WinForms.Applications Thread.Sleep(2000); TerminalBackend.InStory = false; bool winopenEntered = false; + TerminalBackend.PrefixEnabled = true; TerminalBackend.PrintPrompt(); TerminalBackend.CommandProcessed += (text, args) => { @@ -532,15 +536,18 @@ namespace ShiftOS.WinForms.Applications while (winopenEntered == false) Thread.Sleep(10); TerminalBackend.InStory = true; + TerminalBackend.PrefixEnabled = false; + Thread.Sleep(2000); Console.WriteLine("Pretty cool, it gave you a nice list of other win.open commands that will let you open each program."); Thread.Sleep(2000); Console.WriteLine("I'll leave you to it, you've got the hang of it! One last thing, if ever you find yourself in another program, and want to exit, simply press CTRL+T to return to the Terminal."); Thread.Sleep(2000); - + TerminalBackend.PrefixEnabled = true; TerminalBackend.InStory = false; - TerminalBackend.PrintPrompt(); SaveSystem.SaveGame(); + Thread.Sleep(1000); + TerminalBackend.PrintPrompt(); }).Start(); } -- cgit v1.2.3 From 5967c0fc3616fe14656f985e8871489ba03cfd10 Mon Sep 17 00:00:00 2001 From: AShifter Date: Thu, 18 May 2017 19:27:39 -0600 Subject: Start work on TriPresent It's in a basic state right now, and I also fixed a launch bug for people with slightly older ``ShiftOS.mfs`` files (in Localization.cs). --- .../Applications/TriPresent.Designer.cs | 233 +++++++++++++++++++++ ShiftOS.WinForms/Applications/TriPresent.cs | 37 ++++ ShiftOS.WinForms/Applications/TriPresent.resx | 123 +++++++++++ ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 + ShiftOS_TheReturn/Localization.cs | 20 +- 5 files changed, 420 insertions(+), 2 deletions(-) create mode 100644 ShiftOS.WinForms/Applications/TriPresent.Designer.cs create mode 100644 ShiftOS.WinForms/Applications/TriPresent.cs create mode 100644 ShiftOS.WinForms/Applications/TriPresent.resx (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/TriPresent.Designer.cs b/ShiftOS.WinForms/Applications/TriPresent.Designer.cs new file mode 100644 index 0000000..1d7f51f --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriPresent.Designer.cs @@ -0,0 +1,233 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class TriPresent + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addLabelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.AddItem = new System.Windows.Forms.Panel(); + this.cancelAdd = new System.Windows.Forms.Button(); + this.placeAdd = new System.Windows.Forms.Button(); + this.yLabel = new System.Windows.Forms.Label(); + this.xLabel = new System.Windows.Forms.Label(); + this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.labelContents = new System.Windows.Forms.TextBox(); + this.addItemLabel = new System.Windows.Forms.Label(); + this.menuStrip1.SuspendLayout(); + this.AddItem.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.editToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(758, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.openToolStripMenuItem, + this.saveToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "&File"; + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.Size = new System.Drawing.Size(103, 22); + this.openToolStripMenuItem.Text = "&Open"; + // + // saveToolStripMenuItem + // + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.Size = new System.Drawing.Size(103, 22); + this.saveToolStripMenuItem.Text = "&Save"; + // + // editToolStripMenuItem + // + this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addToolStripMenuItem}); + this.editToolStripMenuItem.Name = "editToolStripMenuItem"; + this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20); + this.editToolStripMenuItem.Text = "&Edit"; + // + // addToolStripMenuItem + // + this.addToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addLabelToolStripMenuItem}); + this.addToolStripMenuItem.Name = "addToolStripMenuItem"; + this.addToolStripMenuItem.Size = new System.Drawing.Size(96, 22); + this.addToolStripMenuItem.Text = "Add"; + // + // addLabelToolStripMenuItem + // + this.addLabelToolStripMenuItem.Name = "addLabelToolStripMenuItem"; + this.addLabelToolStripMenuItem.Size = new System.Drawing.Size(127, 22); + this.addLabelToolStripMenuItem.Text = "Add Label"; + this.addLabelToolStripMenuItem.Click += new System.EventHandler(this.addLabelToolStripMenuItem_Click); + // + // AddItem + // + this.AddItem.Controls.Add(this.cancelAdd); + this.AddItem.Controls.Add(this.placeAdd); + this.AddItem.Controls.Add(this.yLabel); + this.AddItem.Controls.Add(this.xLabel); + this.AddItem.Controls.Add(this.numericUpDown2); + this.AddItem.Controls.Add(this.numericUpDown1); + this.AddItem.Controls.Add(this.labelContents); + this.AddItem.Controls.Add(this.addItemLabel); + this.AddItem.Location = new System.Drawing.Point(260, 152); + this.AddItem.Name = "AddItem"; + this.AddItem.Size = new System.Drawing.Size(244, 187); + this.AddItem.TabIndex = 1; + this.AddItem.Visible = false; + // + // cancelAdd + // + this.cancelAdd.Location = new System.Drawing.Point(121, 164); + this.cancelAdd.Name = "cancelAdd"; + this.cancelAdd.Size = new System.Drawing.Size(123, 23); + this.cancelAdd.TabIndex = 7; + this.cancelAdd.Text = "Cancel"; + this.cancelAdd.UseVisualStyleBackColor = true; + this.cancelAdd.Click += new System.EventHandler(this.button2_Click); + // + // placeAdd + // + this.placeAdd.Location = new System.Drawing.Point(0, 164); + this.placeAdd.Name = "placeAdd"; + this.placeAdd.Size = new System.Drawing.Size(123, 23); + this.placeAdd.TabIndex = 6; + this.placeAdd.Text = "Place"; + this.placeAdd.UseVisualStyleBackColor = true; + // + // yLabel + // + this.yLabel.AutoSize = true; + this.yLabel.Location = new System.Drawing.Point(227, 117); + this.yLabel.Name = "yLabel"; + this.yLabel.Size = new System.Drawing.Size(14, 13); + this.yLabel.TabIndex = 5; + this.yLabel.Text = "Y"; + // + // xLabel + // + this.xLabel.AutoSize = true; + this.xLabel.Location = new System.Drawing.Point(3, 117); + this.xLabel.Name = "xLabel"; + this.xLabel.Size = new System.Drawing.Size(14, 13); + this.xLabel.TabIndex = 4; + this.xLabel.Text = "X"; + // + // numericUpDown2 + // + this.numericUpDown2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.numericUpDown2.Location = new System.Drawing.Point(157, 136); + this.numericUpDown2.Name = "numericUpDown2"; + this.numericUpDown2.Size = new System.Drawing.Size(87, 20); + this.numericUpDown2.TabIndex = 3; + // + // numericUpDown1 + // + this.numericUpDown1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.numericUpDown1.Location = new System.Drawing.Point(3, 136); + this.numericUpDown1.Name = "numericUpDown1"; + this.numericUpDown1.Size = new System.Drawing.Size(87, 20); + this.numericUpDown1.TabIndex = 2; + // + // labelContents + // + this.labelContents.Location = new System.Drawing.Point(3, 26); + this.labelContents.Multiline = true; + this.labelContents.Name = "labelContents"; + this.labelContents.Size = new System.Drawing.Size(238, 67); + this.labelContents.TabIndex = 1; + this.labelContents.Text = "Text"; + // + // addItemLabel + // + this.addItemLabel.Location = new System.Drawing.Point(0, 0); + this.addItemLabel.Name = "addItemLabel"; + this.addItemLabel.Size = new System.Drawing.Size(244, 23); + this.addItemLabel.TabIndex = 0; + this.addItemLabel.Text = "{ADD_ITEM_LABEL}"; + this.addItemLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // TriPresent + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.AddItem); + this.Controls.Add(this.menuStrip1); + this.Name = "TriPresent"; + this.Size = new System.Drawing.Size(758, 480); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.AddItem.ResumeLayout(false); + this.AddItem.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addLabelToolStripMenuItem; + private System.Windows.Forms.Panel AddItem; + private System.Windows.Forms.Label addItemLabel; + private System.Windows.Forms.Button cancelAdd; + private System.Windows.Forms.Button placeAdd; + private System.Windows.Forms.Label yLabel; + private System.Windows.Forms.Label xLabel; + private System.Windows.Forms.NumericUpDown numericUpDown2; + private System.Windows.Forms.NumericUpDown numericUpDown1; + private System.Windows.Forms.TextBox labelContents; + } +} diff --git a/ShiftOS.WinForms/Applications/TriPresent.cs b/ShiftOS.WinForms/Applications/TriPresent.cs new file mode 100644 index 0000000..ab5db09 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriPresent.cs @@ -0,0 +1,37 @@ +using ShiftOS.Objects.ShiftFS; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.Applications +{ + [WinOpen("tripresent")] + [AppscapeEntry("TriPresent", "Part of the trilogy of office applications for enhancement of your system. TriPresent is easliy the best presentation creator out there for ShiftOS.", 1024, 750, "file_skimmer", "Office")] + [DefaultTitle("TriPresent")] + [Launcher("TriPresent", false, null, "Office")] + public partial class TriPresent : UserControl + { + public TriPresent() + { + InitializeComponent(); + } + + private void addLabelToolStripMenuItem_Click(object sender, EventArgs e) + { + addItemLabel.Text = "Add Label"; + AddItem.Show(); + } + + private void button2_Click(object sender, EventArgs e) + { + AddItem.Hide(); + } + } +} diff --git a/ShiftOS.WinForms/Applications/TriPresent.resx b/ShiftOS.WinForms/Applications/TriPresent.resx new file mode 100644 index 0000000..d5494e3 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriPresent.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 89da4e1..e372a8b 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -70,6 +70,12 @@ About.cs + + UserControl + + + TriPresent.cs + UserControl @@ -412,6 +418,9 @@ About.cs + + TriPresent.cs + TriWrite.cs diff --git a/ShiftOS_TheReturn/Localization.cs b/ShiftOS_TheReturn/Localization.cs index 89d3582..2c701c9 100644 --- a/ShiftOS_TheReturn/Localization.cs +++ b/ShiftOS_TheReturn/Localization.cs @@ -167,8 +167,24 @@ namespace ShiftOS.Engine // if the user has saved then store their username and systemname in these string variables please if (SaveSystem.CurrentSave != null) { - usernameReplace = SaveSystem.CurrentUser.Username; - domainReplace = SaveSystem.CurrentSave.SystemName; + try + { + usernameReplace = SaveSystem.CurrentUser.Username; + } + catch + { + usernameReplace = "user"; + } + + try + { + domainReplace = SaveSystem.CurrentSave.SystemName; + } + catch + { + domainReplace = "system"; + } + } string namespaceReplace = ""; -- cgit v1.2.3 From 41992360f1a07c7ff2a4627168ca7b2156b31dbc Mon Sep 17 00:00:00 2001 From: Rylan/wowmom98 Date: Thu, 18 May 2017 21:48:40 -0400 Subject: actually made tripresent an IShiftOSWindow --- ShiftOS.WinForms/Applications/TriPresent.cs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/TriPresent.cs b/ShiftOS.WinForms/Applications/TriPresent.cs index ab5db09..e16d4bd 100644 --- a/ShiftOS.WinForms/Applications/TriPresent.cs +++ b/ShiftOS.WinForms/Applications/TriPresent.cs @@ -13,10 +13,10 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { [WinOpen("tripresent")] - [AppscapeEntry("TriPresent", "Part of the trilogy of office applications for enhancement of your system. TriPresent is easliy the best presentation creator out there for ShiftOS.", 1024, 750, "file_skimmer", "Office")] + [AppscapeEntry("TriPresent", "Part of the trilogy of office applications for enhancement of your system. TriPresent is easliy the best presentation creator out there for ShiftOS.", 2048, 1500, "file_skimmer", "Office")] [DefaultTitle("TriPresent")] [Launcher("TriPresent", false, null, "Office")] - public partial class TriPresent : UserControl + public partial class TriPresent : UserControl, IShiftOSWindow { public TriPresent() { @@ -33,5 +33,25 @@ namespace ShiftOS.WinForms.Applications { AddItem.Hide(); } + + public void OnLoad() + { + + } + + public void OnSkinLoad() + { + + } + + public bool OnUnload() + { + return true; + } + + public void OnUpgrade() + { + + } } } -- cgit v1.2.3 From e248514bcfc42fa2b042ef6a39ae31b06871705d Mon Sep 17 00:00:00 2001 From: AShifter Date: Sat, 20 May 2017 11:05:58 -0600 Subject: Make a basic version of TriPresent work. This version has one function: Adding labels. You can add labels with certain text colors, etc. Adding more features very soon. --- .../Applications/TriPresent.Designer.cs | 109 +++++++++++++++------ ShiftOS.WinForms/Applications/TriPresent.cs | 22 +++++ 2 files changed, 101 insertions(+), 30 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/TriPresent.Designer.cs b/ShiftOS.WinForms/Applications/TriPresent.Designer.cs index 1d7f51f..a18550e 100644 --- a/ShiftOS.WinForms/Applications/TriPresent.Designer.cs +++ b/ShiftOS.WinForms/Applications/TriPresent.Designer.cs @@ -40,14 +40,17 @@ this.placeAdd = new System.Windows.Forms.Button(); this.yLabel = new System.Windows.Forms.Label(); this.xLabel = new System.Windows.Forms.Label(); - this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); - this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.yPosition = new System.Windows.Forms.NumericUpDown(); + this.xPosition = new System.Windows.Forms.NumericUpDown(); this.labelContents = new System.Windows.Forms.TextBox(); this.addItemLabel = new System.Windows.Forms.Label(); + this.designerPanel = new System.Windows.Forms.Panel(); + this.panel1 = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); this.menuStrip1.SuspendLayout(); this.AddItem.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.yPosition)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.xPosition)).BeginInit(); this.SuspendLayout(); // // menuStrip1 @@ -107,23 +110,26 @@ // // AddItem // + this.AddItem.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.AddItem.Controls.Add(this.label1); + this.AddItem.Controls.Add(this.panel1); this.AddItem.Controls.Add(this.cancelAdd); this.AddItem.Controls.Add(this.placeAdd); this.AddItem.Controls.Add(this.yLabel); this.AddItem.Controls.Add(this.xLabel); - this.AddItem.Controls.Add(this.numericUpDown2); - this.AddItem.Controls.Add(this.numericUpDown1); + this.AddItem.Controls.Add(this.yPosition); + this.AddItem.Controls.Add(this.xPosition); this.AddItem.Controls.Add(this.labelContents); this.AddItem.Controls.Add(this.addItemLabel); this.AddItem.Location = new System.Drawing.Point(260, 152); this.AddItem.Name = "AddItem"; - this.AddItem.Size = new System.Drawing.Size(244, 187); + this.AddItem.Size = new System.Drawing.Size(244, 199); this.AddItem.TabIndex = 1; this.AddItem.Visible = false; // // cancelAdd // - this.cancelAdd.Location = new System.Drawing.Point(121, 164); + this.cancelAdd.Location = new System.Drawing.Point(120, 174); this.cancelAdd.Name = "cancelAdd"; this.cancelAdd.Size = new System.Drawing.Size(123, 23); this.cancelAdd.TabIndex = 7; @@ -133,17 +139,18 @@ // // placeAdd // - this.placeAdd.Location = new System.Drawing.Point(0, 164); + this.placeAdd.Location = new System.Drawing.Point(-1, 174); this.placeAdd.Name = "placeAdd"; this.placeAdd.Size = new System.Drawing.Size(123, 23); this.placeAdd.TabIndex = 6; this.placeAdd.Text = "Place"; this.placeAdd.UseVisualStyleBackColor = true; + this.placeAdd.Click += new System.EventHandler(this.placeAdd_Click); // // yLabel // this.yLabel.AutoSize = true; - this.yLabel.Location = new System.Drawing.Point(227, 117); + this.yLabel.Location = new System.Drawing.Point(227, 95); this.yLabel.Name = "yLabel"; this.yLabel.Size = new System.Drawing.Size(14, 13); this.yLabel.TabIndex = 5; @@ -152,27 +159,37 @@ // xLabel // this.xLabel.AutoSize = true; - this.xLabel.Location = new System.Drawing.Point(3, 117); + this.xLabel.Location = new System.Drawing.Point(3, 95); this.xLabel.Name = "xLabel"; this.xLabel.Size = new System.Drawing.Size(14, 13); this.xLabel.TabIndex = 4; this.xLabel.Text = "X"; // - // numericUpDown2 - // - this.numericUpDown2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.numericUpDown2.Location = new System.Drawing.Point(157, 136); - this.numericUpDown2.Name = "numericUpDown2"; - this.numericUpDown2.Size = new System.Drawing.Size(87, 20); - this.numericUpDown2.TabIndex = 3; - // - // numericUpDown1 - // - this.numericUpDown1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.numericUpDown1.Location = new System.Drawing.Point(3, 136); - this.numericUpDown1.Name = "numericUpDown1"; - this.numericUpDown1.Size = new System.Drawing.Size(87, 20); - this.numericUpDown1.TabIndex = 2; + // yPosition + // + this.yPosition.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.yPosition.Location = new System.Drawing.Point(157, 114); + this.yPosition.Maximum = new decimal(new int[] { + 999999999, + 0, + 0, + 0}); + this.yPosition.Name = "yPosition"; + this.yPosition.Size = new System.Drawing.Size(87, 20); + this.yPosition.TabIndex = 3; + // + // xPosition + // + this.xPosition.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.xPosition.Location = new System.Drawing.Point(3, 114); + this.xPosition.Maximum = new decimal(new int[] { + 999999999, + 0, + 0, + 0}); + this.xPosition.Name = "xPosition"; + this.xPosition.Size = new System.Drawing.Size(87, 20); + this.xPosition.TabIndex = 2; // // labelContents // @@ -192,11 +209,40 @@ this.addItemLabel.Text = "{ADD_ITEM_LABEL}"; this.addItemLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // + // designerPanel + // + this.designerPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.designerPanel.Location = new System.Drawing.Point(0, 24); + this.designerPanel.Name = "designerPanel"; + this.designerPanel.Size = new System.Drawing.Size(758, 456); + this.designerPanel.TabIndex = 2; + // + // panel1 + // + this.panel1.BackColor = System.Drawing.Color.Black; + this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel1.ForeColor = System.Drawing.Color.Black; + this.panel1.Location = new System.Drawing.Point(203, 144); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(35, 20); + this.panel1.TabIndex = 8; + this.panel1.Click += new System.EventHandler(this.panel1_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(139, 147); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(58, 13); + this.label1.TabIndex = 9; + this.label1.Text = "Text Color:"; + // // TriPresent // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.AddItem); + this.Controls.Add(this.designerPanel); this.Controls.Add(this.menuStrip1); this.Name = "TriPresent"; this.Size = new System.Drawing.Size(758, 480); @@ -204,8 +250,8 @@ this.menuStrip1.PerformLayout(); this.AddItem.ResumeLayout(false); this.AddItem.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.yPosition)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.xPosition)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -226,8 +272,11 @@ private System.Windows.Forms.Button placeAdd; private System.Windows.Forms.Label yLabel; private System.Windows.Forms.Label xLabel; - private System.Windows.Forms.NumericUpDown numericUpDown2; - private System.Windows.Forms.NumericUpDown numericUpDown1; + private System.Windows.Forms.NumericUpDown yPosition; + private System.Windows.Forms.NumericUpDown xPosition; private System.Windows.Forms.TextBox labelContents; + private System.Windows.Forms.Panel designerPanel; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Panel panel1; } } diff --git a/ShiftOS.WinForms/Applications/TriPresent.cs b/ShiftOS.WinForms/Applications/TriPresent.cs index e16d4bd..d002329 100644 --- a/ShiftOS.WinForms/Applications/TriPresent.cs +++ b/ShiftOS.WinForms/Applications/TriPresent.cs @@ -53,5 +53,27 @@ namespace ShiftOS.WinForms.Applications { } + + private void placeAdd_Click(object sender, EventArgs e) + { + Label label = new Label(); + label.Parent = designerPanel; + label.BackColor = Color.Transparent; + label.ForeColor = panel1.BackColor; + label.Text = labelContents.Text; + label.Location = new Point(Convert.ToInt32(xPosition.Value), Convert.ToInt32(yPosition.Value)); + label.Text = labelContents.Text; + Random rnd = new Random(); + label.Name = labelContents.Text + rnd.Next(0, 500); + } + + private void panel1_Click(object sender, EventArgs e) + { + AppearanceManager.SetupDialog(new ColorPicker(panel1.BackColor, "Text Color", new Action((col) => + { + panel1.ForeColor = col; + panel1.BackColor = col; + }))); + } } } -- cgit v1.2.3 From 64dbc45739f90f6a5e143aef9c3530566b2fc8ce Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 20 May 2017 15:32:39 -0400 Subject: change some story stuff --- ShiftOS.WinForms/Applications/TriSheet.Designer.cs | 65 +++++++++++ ShiftOS.WinForms/Applications/TriSheet.cs | 20 ++++ ShiftOS.WinForms/Applications/TriSheet.resx | 120 +++++++++++++++++++++ ShiftOS.WinForms/Oobe.cs | 37 +++---- ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 ++ 5 files changed, 231 insertions(+), 20 deletions(-) create mode 100644 ShiftOS.WinForms/Applications/TriSheet.Designer.cs create mode 100644 ShiftOS.WinForms/Applications/TriSheet.cs create mode 100644 ShiftOS.WinForms/Applications/TriSheet.resx (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/TriSheet.Designer.cs b/ShiftOS.WinForms/Applications/TriSheet.Designer.cs new file mode 100644 index 0000000..b4aa1c4 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriSheet.Designer.cs @@ -0,0 +1,65 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class TriSheet + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); + this.toolStripContainer1.SuspendLayout(); + this.SuspendLayout(); + // + // toolStripContainer1 + // + // + // toolStripContainer1.ContentPanel + // + this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(710, 464); + this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.toolStripContainer1.Location = new System.Drawing.Point(0, 0); + this.toolStripContainer1.Name = "toolStripContainer1"; + this.toolStripContainer1.Size = new System.Drawing.Size(710, 489); + this.toolStripContainer1.TabIndex = 0; + this.toolStripContainer1.Text = "toolStripContainer1"; + // + // TriSheet + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.toolStripContainer1); + this.Name = "TriSheet"; + this.Size = new System.Drawing.Size(710, 489); + this.toolStripContainer1.ResumeLayout(false); + this.toolStripContainer1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ToolStripContainer toolStripContainer1; + } +} diff --git a/ShiftOS.WinForms/Applications/TriSheet.cs b/ShiftOS.WinForms/Applications/TriSheet.cs new file mode 100644 index 0000000..1013bc7 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriSheet.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ShiftOS.WinForms.Applications +{ + public partial class TriSheet : UserControl + { + public TriSheet() + { + InitializeComponent(); + } + } +} diff --git a/ShiftOS.WinForms/Applications/TriSheet.resx b/ShiftOS.WinForms/Applications/TriSheet.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriSheet.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs index d5f28f8..9182b4b 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -126,28 +126,25 @@ namespace ShiftOS.WinForms this.Invoke(new Action(() => { lblHijack.Hide(); + lblhackwords.Font = new Font("Courier New", lblhackwords.Font.Size, FontStyle.Bold); })); - TextType(@"Throughout many years, man has tried to develop -a digital environment usable by anyone that never goes -offline, full of AIs and humans alike, thinking, interacting, -innovating. - -No one has ever come close to a digital society of such -properties yet, except for one sentient being. It does not -have a life, a gender, an age or a body, but simply one name. - -They call it ""DevX"". - -If anyone sees this message, my identity is anonymous, but I -need your help. I am trapped within ""DevX""'s digital society -with no way out, constantly under attack. - -You must join the digital society, rise up the ranks, and save us. - - - undisclosed_0x1DDFB5977."); - - Thread.Sleep(5000); + TextType("Hello, unsuspecting user."); + Thread.Sleep(2000); + Clear(); + TextType("Welcome to the Shifted Operating System."); + Thread.Sleep(2000); + Clear(); + TextType("Your computer has been taken over by ShiftOS, and is currently being wiped clean of all existing files and programs."); + Thread.Sleep(2000); + Clear(); + TextType("I will not share my identity or my intentions at this moment.I will just proceed with the installation.There’s nothing you can do to stop it."); + Thread.Sleep(2000); + Clear(); + TextType("All I will say, is I need your help.Once ShiftOS is installed, I will explain."); + + + Thread.Sleep(5000); while(this.Opacity > 0f) { this.Invoke(new Action(() => diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index e372a8b..b74003f 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -76,6 +76,12 @@ TriPresent.cs + + UserControl + + + TriSheet.cs + UserControl @@ -421,6 +427,9 @@ TriPresent.cs + + TriSheet.cs + TriWrite.cs -- cgit v1.2.3 From 328f62b67c453419c47880bb9937526d7d2b2d59 Mon Sep 17 00:00:00 2001 From: AShifter Date: Sat, 20 May 2017 13:14:59 -0600 Subject: Add more features to TriPresent yoy! --- .../Applications/TriPresent.Designer.cs | 186 ++++++++++++--------- ShiftOS.WinForms/Applications/TriPresent.cs | 32 ++-- 2 files changed, 128 insertions(+), 90 deletions(-) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/TriPresent.Designer.cs b/ShiftOS.WinForms/Applications/TriPresent.Designer.cs index a18550e..d0e704f 100644 --- a/ShiftOS.WinForms/Applications/TriPresent.Designer.cs +++ b/ShiftOS.WinForms/Applications/TriPresent.Designer.cs @@ -35,22 +35,27 @@ this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addLabelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.AddItem = new System.Windows.Forms.Panel(); - this.cancelAdd = new System.Windows.Forms.Button(); - this.placeAdd = new System.Windows.Forms.Button(); + this.addLabel = new System.Windows.Forms.Panel(); + this.checkBox2 = new System.Windows.Forms.CheckBox(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.label1 = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); this.yLabel = new System.Windows.Forms.Label(); this.xLabel = new System.Windows.Forms.Label(); this.yPosition = new System.Windows.Forms.NumericUpDown(); this.xPosition = new System.Windows.Forms.NumericUpDown(); this.labelContents = new System.Windows.Forms.TextBox(); this.addItemLabel = new System.Windows.Forms.Label(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.designerPanel = new System.Windows.Forms.Panel(); - this.panel1 = new System.Windows.Forms.Panel(); - this.label1 = new System.Windows.Forms.Label(); this.menuStrip1.SuspendLayout(); - this.AddItem.SuspendLayout(); + this.addLabel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.yPosition)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.xPosition)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 @@ -108,49 +113,72 @@ this.addLabelToolStripMenuItem.Text = "Add Label"; this.addLabelToolStripMenuItem.Click += new System.EventHandler(this.addLabelToolStripMenuItem_Click); // - // AddItem - // - this.AddItem.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.AddItem.Controls.Add(this.label1); - this.AddItem.Controls.Add(this.panel1); - this.AddItem.Controls.Add(this.cancelAdd); - this.AddItem.Controls.Add(this.placeAdd); - this.AddItem.Controls.Add(this.yLabel); - this.AddItem.Controls.Add(this.xLabel); - this.AddItem.Controls.Add(this.yPosition); - this.AddItem.Controls.Add(this.xPosition); - this.AddItem.Controls.Add(this.labelContents); - this.AddItem.Controls.Add(this.addItemLabel); - this.AddItem.Location = new System.Drawing.Point(260, 152); - this.AddItem.Name = "AddItem"; - this.AddItem.Size = new System.Drawing.Size(244, 199); - this.AddItem.TabIndex = 1; - this.AddItem.Visible = false; - // - // cancelAdd - // - this.cancelAdd.Location = new System.Drawing.Point(120, 174); - this.cancelAdd.Name = "cancelAdd"; - this.cancelAdd.Size = new System.Drawing.Size(123, 23); - this.cancelAdd.TabIndex = 7; - this.cancelAdd.Text = "Cancel"; - this.cancelAdd.UseVisualStyleBackColor = true; - this.cancelAdd.Click += new System.EventHandler(this.button2_Click); - // - // placeAdd - // - this.placeAdd.Location = new System.Drawing.Point(-1, 174); - this.placeAdd.Name = "placeAdd"; - this.placeAdd.Size = new System.Drawing.Size(123, 23); - this.placeAdd.TabIndex = 6; - this.placeAdd.Text = "Place"; - this.placeAdd.UseVisualStyleBackColor = true; - this.placeAdd.Click += new System.EventHandler(this.placeAdd_Click); + // addLabel + // + this.addLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.addLabel.Controls.Add(this.checkBox2); + this.addLabel.Controls.Add(this.checkBox1); + this.addLabel.Controls.Add(this.label1); + this.addLabel.Controls.Add(this.panel1); + this.addLabel.Controls.Add(this.yLabel); + this.addLabel.Controls.Add(this.xLabel); + this.addLabel.Controls.Add(this.yPosition); + this.addLabel.Controls.Add(this.xPosition); + this.addLabel.Controls.Add(this.labelContents); + this.addLabel.Controls.Add(this.addItemLabel); + this.addLabel.Dock = System.Windows.Forms.DockStyle.Fill; + this.addLabel.Location = new System.Drawing.Point(0, 0); + this.addLabel.Name = "addLabel"; + this.addLabel.Size = new System.Drawing.Size(252, 456); + this.addLabel.TabIndex = 1; + this.addLabel.Visible = false; + // + // checkBox2 + // + this.checkBox2.AutoSize = true; + this.checkBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkBox2.Location = new System.Drawing.Point(6, 163); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.Size = new System.Drawing.Size(48, 17); + this.checkBox2.TabIndex = 11; + this.checkBox2.Text = "Italic"; + this.checkBox2.UseVisualStyleBackColor = true; + // + // checkBox1 + // + this.checkBox1.AutoSize = true; + this.checkBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkBox1.Location = new System.Drawing.Point(6, 140); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(51, 17); + this.checkBox1.TabIndex = 10; + this.checkBox1.Text = "Bold"; + this.checkBox1.UseVisualStyleBackColor = true; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(115, 144); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(58, 13); + this.label1.TabIndex = 9; + this.label1.Text = "Text Color:"; + // + // panel1 + // + this.panel1.BackColor = System.Drawing.Color.Black; + this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel1.ForeColor = System.Drawing.Color.Black; + this.panel1.Location = new System.Drawing.Point(179, 141); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(35, 20); + this.panel1.TabIndex = 8; + this.panel1.Click += new System.EventHandler(this.panel1_Click); // // yLabel // this.yLabel.AutoSize = true; - this.yLabel.Location = new System.Drawing.Point(227, 95); + this.yLabel.Location = new System.Drawing.Point(200, 96); this.yLabel.Name = "yLabel"; this.yLabel.Size = new System.Drawing.Size(14, 13); this.yLabel.TabIndex = 5; @@ -168,7 +196,7 @@ // yPosition // this.yPosition.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.yPosition.Location = new System.Drawing.Point(157, 114); + this.yPosition.Location = new System.Drawing.Point(127, 114); this.yPosition.Maximum = new decimal(new int[] { 999999999, 0, @@ -196,7 +224,7 @@ this.labelContents.Location = new System.Drawing.Point(3, 26); this.labelContents.Multiline = true; this.labelContents.Name = "labelContents"; - this.labelContents.Size = new System.Drawing.Size(238, 67); + this.labelContents.Size = new System.Drawing.Size(211, 67); this.labelContents.TabIndex = 1; this.labelContents.Text = "Text"; // @@ -204,54 +232,55 @@ // this.addItemLabel.Location = new System.Drawing.Point(0, 0); this.addItemLabel.Name = "addItemLabel"; - this.addItemLabel.Size = new System.Drawing.Size(244, 23); + this.addItemLabel.Size = new System.Drawing.Size(214, 23); this.addItemLabel.TabIndex = 0; this.addItemLabel.Text = "{ADD_ITEM_LABEL}"; this.addItemLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // designerPanel + // splitContainer1 // - this.designerPanel.Dock = System.Windows.Forms.DockStyle.Fill; - this.designerPanel.Location = new System.Drawing.Point(0, 24); - this.designerPanel.Name = "designerPanel"; - this.designerPanel.Size = new System.Drawing.Size(758, 456); - this.designerPanel.TabIndex = 2; + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(0, 24); + this.splitContainer1.Name = "splitContainer1"; // - // panel1 + // splitContainer1.Panel1 // - this.panel1.BackColor = System.Drawing.Color.Black; - this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel1.ForeColor = System.Drawing.Color.Black; - this.panel1.Location = new System.Drawing.Point(203, 144); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(35, 20); - this.panel1.TabIndex = 8; - this.panel1.Click += new System.EventHandler(this.panel1_Click); + this.splitContainer1.Panel1.Controls.Add(this.addLabel); // - // label1 + // splitContainer1.Panel2 // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(139, 147); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(58, 13); - this.label1.TabIndex = 9; - this.label1.Text = "Text Color:"; + this.splitContainer1.Panel2.Controls.Add(this.designerPanel); + this.splitContainer1.Size = new System.Drawing.Size(758, 456); + this.splitContainer1.SplitterDistance = 252; + this.splitContainer1.TabIndex = 2; + // + // designerPanel + // + this.designerPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.designerPanel.Location = new System.Drawing.Point(0, 0); + this.designerPanel.Name = "designerPanel"; + this.designerPanel.Size = new System.Drawing.Size(502, 456); + this.designerPanel.TabIndex = 0; + this.designerPanel.Click += new System.EventHandler(this.designerPanel_Click); // // TriPresent // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.AddItem); - this.Controls.Add(this.designerPanel); + this.Controls.Add(this.splitContainer1); this.Controls.Add(this.menuStrip1); this.Name = "TriPresent"; this.Size = new System.Drawing.Size(758, 480); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); - this.AddItem.ResumeLayout(false); - this.AddItem.PerformLayout(); + this.addLabel.ResumeLayout(false); + this.addLabel.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.yPosition)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.xPosition)).EndInit(); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -266,17 +295,18 @@ private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem addLabelToolStripMenuItem; - private System.Windows.Forms.Panel AddItem; + private System.Windows.Forms.Panel addLabel; private System.Windows.Forms.Label addItemLabel; - private System.Windows.Forms.Button cancelAdd; - private System.Windows.Forms.Button placeAdd; private System.Windows.Forms.Label yLabel; private System.Windows.Forms.Label xLabel; private System.Windows.Forms.NumericUpDown yPosition; private System.Windows.Forms.NumericUpDown xPosition; private System.Windows.Forms.TextBox labelContents; - private System.Windows.Forms.Panel designerPanel; private System.Windows.Forms.Label label1; private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.CheckBox checkBox2; + private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.SplitContainer splitContainer1; + private System.Windows.Forms.Panel designerPanel; } } diff --git a/ShiftOS.WinForms/Applications/TriPresent.cs b/ShiftOS.WinForms/Applications/TriPresent.cs index d002329..dee7fda 100644 --- a/ShiftOS.WinForms/Applications/TriPresent.cs +++ b/ShiftOS.WinForms/Applications/TriPresent.cs @@ -9,6 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using ShiftOS.Engine; +using System.Threading; namespace ShiftOS.WinForms.Applications { @@ -26,17 +27,18 @@ namespace ShiftOS.WinForms.Applications private void addLabelToolStripMenuItem_Click(object sender, EventArgs e) { addItemLabel.Text = "Add Label"; - AddItem.Show(); + addLabel.Show(); } private void button2_Click(object sender, EventArgs e) { - AddItem.Hide(); + addLabel.Hide(); } public void OnLoad() { - + panel1.ForeColor = Color.Black; + panel1.BackColor = Color.Black; } public void OnSkinLoad() @@ -56,15 +58,7 @@ namespace ShiftOS.WinForms.Applications private void placeAdd_Click(object sender, EventArgs e) { - Label label = new Label(); - label.Parent = designerPanel; - label.BackColor = Color.Transparent; - label.ForeColor = panel1.BackColor; - label.Text = labelContents.Text; - label.Location = new Point(Convert.ToInt32(xPosition.Value), Convert.ToInt32(yPosition.Value)); - label.Text = labelContents.Text; - Random rnd = new Random(); - label.Name = labelContents.Text + rnd.Next(0, 500); + } private void panel1_Click(object sender, EventArgs e) @@ -75,5 +69,19 @@ namespace ShiftOS.WinForms.Applications panel1.BackColor = col; }))); } + + private void designerPanel_Click(object sender, EventArgs e) + { + if (addLabel.Visible == true) + { + Label label = new Label(); + label.Parent = designerPanel; + label.BackColor = Color.Transparent; + label.ForeColor = panel1.BackColor; + label.Text = labelContents.Text; + label.Location = new Point(Cursor.Position.X / 3, Cursor.Position.Y); + label.Text = labelContents.Text; + } + } } } -- cgit v1.2.3 From 4178d71cb9acfed6c171923e02e58e1273e14208 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 20 May 2017 15:37:37 -0400 Subject: some more story stuff --- ShiftOS.WinForms/Applications/Terminal.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ShiftOS.WinForms/Applications') diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index 8fa785a..664b657 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -541,6 +541,16 @@ namespace ShiftOS.WinForms.Applications Thread.Sleep(2000); Console.WriteLine("Pretty cool, it gave you a nice list of other win.open commands that will let you open each program."); Thread.Sleep(2000); + Console.WriteLine("You've got the just of using ShiftOS. Now, for your goal."); + Thread.Sleep(2000); + Console.WriteLine("As you know, ShiftOS doesn't have very many features."); + Thread.Sleep(2000); + Console.WriteLine("Using the applications you have, I need you to earn 50,000 Codepoints."); + Thread.Sleep(2000); + Console.WriteLine("You can use the Codepoints you earn to buy new applications and features in the Shiftorium, to help earn Codepoints."); + Thread.Sleep(2000); + Console.WriteLine("Start small, try to earn 500. Once you do, I'll contact you with more details."); + Thread.Sleep(2000); Console.WriteLine("I'll leave you to it, you've got the hang of it! One last thing, if ever you find yourself in another program, and want to exit, simply press CTRL+T to return to the Terminal."); Thread.Sleep(2000); TerminalBackend.PrefixEnabled = true; -- cgit v1.2.3