main menu system + sandbox mode

This commit is contained in:
Michael 2017-06-10 10:17:10 -04:00
parent 7dd109719b
commit c40d071d58
16 changed files with 827 additions and 104 deletions

View file

@ -76,10 +76,14 @@ namespace ShiftOS.Objects
_setCpCallbacks.Remove(callback);
}
public bool IsSandbox = false;
public ulong Codepoints
{
get
{
if (IsSandbox == true)
return 0;
if (_updTimer == null)
_updTimer = new Timer((o) => syncCp(), null, 0, 300000);
lock (_cpLock)
@ -89,6 +93,8 @@ namespace ShiftOS.Objects
}
set
{
if (IsSandbox == true)
return;
lock (_cpLock)
{
_cp = value;

View file

@ -0,0 +1,147 @@
namespace ShiftOS.WinForms.MainMenu
{
partial class MainMenu
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.flmenu = new System.Windows.Forms.FlowLayoutPanel();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.lbticker = new System.Windows.Forms.Label();
this.flmenu.SuspendLayout();
this.SuspendLayout();
//
// flmenu
//
this.flmenu.AutoSize = true;
this.flmenu.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.flmenu.Controls.Add(this.button1);
this.flmenu.Controls.Add(this.button2);
this.flmenu.Controls.Add(this.button3);
this.flmenu.Controls.Add(this.button4);
this.flmenu.Controls.Add(this.button5);
this.flmenu.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flmenu.Location = new System.Drawing.Point(46, 218);
this.flmenu.Name = "flmenu";
this.flmenu.Size = new System.Drawing.Size(187, 145);
this.flmenu.TabIndex = 0;
//
// button1
//
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Location = new System.Drawing.Point(3, 3);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(181, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Campaign";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.Location = new System.Drawing.Point(3, 32);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(181, 23);
this.button2.TabIndex = 1;
this.button2.Text = "Sandbox";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button3.Location = new System.Drawing.Point(3, 61);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(181, 23);
this.button3.TabIndex = 2;
this.button3.Text = "Settings";
this.button3.UseVisualStyleBackColor = true;
//
// button4
//
this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button4.Location = new System.Drawing.Point(3, 90);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(181, 23);
this.button4.TabIndex = 3;
this.button4.Text = "About";
this.button4.UseVisualStyleBackColor = true;
//
// button5
//
this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button5.Location = new System.Drawing.Point(3, 119);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(181, 23);
this.button5.TabIndex = 4;
this.button5.Text = "Exit";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// lbticker
//
this.lbticker.AutoSize = true;
this.lbticker.Location = new System.Drawing.Point(29, 515);
this.lbticker.Name = "lbticker";
this.lbticker.Size = new System.Drawing.Size(93, 13);
this.lbticker.TabIndex = 1;
this.lbticker.Tag = "header3";
this.lbticker.Text = "This is a tickerbar.";
//
// MainMenu
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(1161, 566);
this.Controls.Add(this.lbticker);
this.Controls.Add(this.flmenu);
this.ForeColor = System.Drawing.Color.White;
this.Name = "MainMenu";
this.Text = "MainMenu";
this.Load += new System.EventHandler(this.MainMenu_Load);
this.flmenu.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.FlowLayoutPanel flmenu;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Label lbticker;
}
}

View file

@ -0,0 +1,100 @@
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;
using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.MainMenu
{
public partial class MainMenu : Form
{
public MainMenu(IDesktop desk)
{
InitializeComponent();
(desk as WinformsDesktop).ParentMenu = this;
var tickermove = new Timer();
var tickerreset = new Timer();
tickermove.Tick += (o, a) =>
{
if(lbticker.Left <= (0 - lbticker.Width))
{
tickermove.Stop();
tickerreset.Start();
}
else
{
lbticker.Top = (this.ClientSize.Height - (lbticker.Height * 2));
lbticker.Left -= 2;
}
};
tickerreset.Tick += (o, a) =>
{
lbticker.Visible = false;
lbticker.Text = GetTickerMessage();
lbticker.Left = this.Width;
lbticker.Visible = true;
tickerreset.Stop();
tickermove.Start();
};
tickermove.Interval = 1;
tickerreset.Interval = 1000;
flmenu.CenterParent();
tickerreset.Start();
}
private void MainMenu_Load(object sender, EventArgs e)
{
Tools.ControlManager.SetupControls(this);
}
private Random rnd = new Random();
private string GetTickerMessage()
{
switch (rnd.Next(0, 10))
{
case 0:
return "Did you know that you can skin this very menu? Just goes to show how much you can shift it your way.";
case 1:
return "Want to pick up a few skins or mods from the community? Head on over to http://getshiftos.ml/Skins!";
case 2:
return "Sandbox mode is a special version of ShiftOS that allows you to use the operating system without having to deal with Codepoints, the Shiftorium or having to play through the storyline. Handy...";
case 3:
return "ArtPad not good enough? You can use an external image editor to create ShiftOS skin textures. Just save your files to the Shared Directory and they'll be imported into ShiftOS on the 1:/ drive.";
case 4:
return "Terminal too weird for ya? You can use the Format Editor to generate your own Terminal command parser. No coding knowledge needed!";
case 5:
return "Contests are a good way to earn heaps of Codepoints. Head on over to http://getshiftos.ml/Contests for info on current community contests.";
default:
return "Good God. We don't know what to put here.";
}
}
private void button1_Click(object sender, EventArgs e)
{
Desktop.CurrentDesktop.Show();
}
private void button5_Click(object sender, EventArgs e)
{
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
(Desktop.CurrentDesktop as WinformsDesktop).IsSandbox = true;
Desktop.CurrentDesktop.Show();
}
}
}

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -50,6 +50,21 @@ namespace ShiftOS.WinForms
Application.SetCompatibleTextRenderingDefault(false);
//if ANYONE puts code before those two winforms config lines they will be declared a drunky. - Michael
SkinEngine.SetPostProcessor(new DitheringSkinPostProcessor());
LoginManager.Init(new GUILoginFrontend());
CrashHandler.SetGameMetadata(Assembly.GetExecutingAssembly());
SkinEngine.SetIconProber(new ShiftOSIconProvider());
TerminalBackend.TerminalRequested += () =>
{
AppearanceManager.SetupWindow(new Applications.Terminal());
};
Localization.RegisterProvider(new WFLanguageProvider());
Infobox.Init(new Dialog());
FileSkimmerBackend.Init(new WinformsFSFrontend());
var desk = new WinformsDesktop();
Desktop.Init(desk);
OutOfBoxExperience.Init(new Oobe());
AppearanceManager.Initiate(new WinformsWindowManager());
#if OLD
SaveSystem.PreDigitalSocietyConnection += () =>
{
Action completed = null;
@ -63,25 +78,11 @@ namespace ShiftOS.WinForms
Engine.AudioManager.PlayStream(Properties.Resources.dial_up_modem_02);
};
LoginManager.Init(new GUILoginFrontend());
CrashHandler.SetGameMetadata(Assembly.GetExecutingAssembly());
SkinEngine.SetIconProber(new ShiftOSIconProvider());
ShiftOS.Engine.AudioManager.Init(new ShiftOSAudioProvider());
Localization.RegisterProvider(new WFLanguageProvider());
TutorialManager.RegisterTutorial(new Oobe());
TerminalBackend.TerminalRequested += () =>
{
AppearanceManager.SetupWindow(new Applications.Terminal());
};
Infobox.Init(new Dialog());
FileSkimmerBackend.Init(new WinformsFSFrontend());
var desk = new WinformsDesktop();
Desktop.Init(desk);
OutOfBoxExperience.Init(new Oobe());
AppearanceManager.Initiate(new WinformsWindowManager());
Application.Run(desk);
#else
Application.Run(new MainMenu.MainMenu(desk));
#endif
}
}

View file

@ -356,6 +356,12 @@
<Compile Include="HackerCommands.cs" />
<Compile Include="IDesktopWidget.cs" />
<Compile Include="JobTasks.cs" />
<Compile Include="MainMenu\MainMenu.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainMenu\MainMenu.Designer.cs">
<DependentUpon>MainMenu.cs</DependentUpon>
</Compile>
<Compile Include="Oobe.cs">
<SubType>Form</SubType>
</Compile>
@ -603,6 +609,9 @@
<EmbeddedResource Include="GUILogin.resx">
<DependentUpon>GUILogin.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainMenu\MainMenu.resx">
<DependentUpon>MainMenu.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Oobe.resx">
<DependentUpon>Oobe.cs</DependentUpon>
</EmbeddedResource>

View file

@ -28,27 +28,198 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShiftSoft));
this.label1 = new System.Windows.Forms.Label();
this.pnldivider = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.flbuttons = new System.Windows.Forms.FlowLayoutPanel();
this.btnhome = new System.Windows.Forms.Button();
this.btnservices = new System.Windows.Forms.Button();
this.btnping = new System.Windows.Forms.Button();
this.pnlhome = new System.Windows.Forms.Panel();
this.lbwhere = new System.Windows.Forms.Label();
this.lbdesc = new System.Windows.Forms.Label();
this.pnlservices = new System.Windows.Forms.Panel();
this.lbfreebiedesc = new System.Windows.Forms.Label();
this.lbfreebie = new System.Windows.Forms.Label();
this.btnjoinfreebie = new System.Windows.Forms.Button();
this.flbuttons.SuspendLayout();
this.pnlhome.SuspendLayout();
this.pnlservices.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Franklin Gothic Heavy", 24.75F, System.Drawing.FontStyle.Italic);
this.label1.Location = new System.Drawing.Point(13, 17);
this.label1.Location = new System.Drawing.Point(13, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(152, 38);
this.label1.TabIndex = 0;
this.label1.Tag = "keepfont";
this.label1.Text = "Shiftsoft";
//
// pnldivider
//
this.pnldivider.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pnldivider.Location = new System.Drawing.Point(20, 71);
this.pnldivider.Name = "pnldivider";
this.pnldivider.Size = new System.Drawing.Size(654, 2);
this.pnldivider.TabIndex = 1;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(17, 46);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(163, 13);
this.label2.TabIndex = 2;
this.label2.Text = "What do you want to shift today?";
//
// flbuttons
//
this.flbuttons.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.flbuttons.AutoSize = true;
this.flbuttons.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.flbuttons.Controls.Add(this.btnhome);
this.flbuttons.Controls.Add(this.btnservices);
this.flbuttons.Controls.Add(this.btnping);
this.flbuttons.Location = new System.Drawing.Point(515, 17);
this.flbuttons.Name = "flbuttons";
this.flbuttons.Size = new System.Drawing.Size(159, 29);
this.flbuttons.TabIndex = 3;
//
// btnhome
//
this.btnhome.AutoSize = true;
this.btnhome.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnhome.Location = new System.Drawing.Point(3, 3);
this.btnhome.Name = "btnhome";
this.btnhome.Size = new System.Drawing.Size(45, 23);
this.btnhome.TabIndex = 0;
this.btnhome.Tag = "header3";
this.btnhome.Text = "Home";
this.btnhome.UseVisualStyleBackColor = true;
this.btnhome.Click += new System.EventHandler(this.btnhome_Click);
//
// btnservices
//
this.btnservices.AutoSize = true;
this.btnservices.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnservices.Location = new System.Drawing.Point(54, 3);
this.btnservices.Name = "btnservices";
this.btnservices.Size = new System.Drawing.Size(58, 23);
this.btnservices.TabIndex = 1;
this.btnservices.Tag = "header3";
this.btnservices.Text = "Services";
this.btnservices.UseVisualStyleBackColor = true;
this.btnservices.Click += new System.EventHandler(this.btnservices_Click);
//
// btnping
//
this.btnping.AutoSize = true;
this.btnping.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnping.Location = new System.Drawing.Point(118, 3);
this.btnping.Name = "btnping";
this.btnping.Size = new System.Drawing.Size(38, 23);
this.btnping.TabIndex = 2;
this.btnping.Tag = "header3";
this.btnping.Text = "Ping";
this.btnping.UseVisualStyleBackColor = true;
this.btnping.Click += new System.EventHandler(this.btnping_Click);
//
// pnlhome
//
this.pnlhome.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.pnlhome.Controls.Add(this.lbdesc);
this.pnlhome.Controls.Add(this.lbwhere);
this.pnlhome.Location = new System.Drawing.Point(20, 92);
this.pnlhome.Name = "pnlhome";
this.pnlhome.Size = new System.Drawing.Size(654, 271);
this.pnlhome.TabIndex = 4;
//
// lbwhere
//
this.lbwhere.AutoSize = true;
this.lbwhere.Location = new System.Drawing.Point(4, 4);
this.lbwhere.Name = "lbwhere";
this.lbwhere.Size = new System.Drawing.Size(169, 13);
this.lbwhere.TabIndex = 0;
this.lbwhere.Tag = "header2";
this.lbwhere.Text = "Where do you want to shift today?";
//
// lbdesc
//
this.lbdesc.Location = new System.Drawing.Point(4, 17);
this.lbdesc.Name = "lbdesc";
this.lbdesc.Size = new System.Drawing.Size(361, 160);
this.lbdesc.TabIndex = 1;
this.lbdesc.Text = resources.GetString("lbdesc.Text");
//
// pnlservices
//
this.pnlservices.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.pnlservices.Controls.Add(this.btnjoinfreebie);
this.pnlservices.Controls.Add(this.lbfreebiedesc);
this.pnlservices.Controls.Add(this.lbfreebie);
this.pnlservices.Location = new System.Drawing.Point(20, 92);
this.pnlservices.Name = "pnlservices";
this.pnlservices.Size = new System.Drawing.Size(654, 271);
this.pnlservices.TabIndex = 5;
//
// lbfreebiedesc
//
this.lbfreebiedesc.Location = new System.Drawing.Point(4, 17);
this.lbfreebiedesc.Name = "lbfreebiedesc";
this.lbfreebiedesc.Size = new System.Drawing.Size(361, 105);
this.lbfreebiedesc.TabIndex = 1;
this.lbfreebiedesc.Text = resources.GetString("lbfreebiedesc.Text");
//
// lbfreebie
//
this.lbfreebie.AutoSize = true;
this.lbfreebie.Location = new System.Drawing.Point(4, 4);
this.lbfreebie.Name = "lbfreebie";
this.lbfreebie.Size = new System.Drawing.Size(88, 13);
this.lbfreebie.TabIndex = 0;
this.lbfreebie.Tag = "header2";
this.lbfreebie.Text = "Freebie Solutions";
//
// btnjoinfreebie
//
this.btnjoinfreebie.AutoSize = true;
this.btnjoinfreebie.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnjoinfreebie.Location = new System.Drawing.Point(245, 125);
this.btnjoinfreebie.Name = "btnjoinfreebie";
this.btnjoinfreebie.Size = new System.Drawing.Size(120, 23);
this.btnjoinfreebie.TabIndex = 2;
this.btnjoinfreebie.Text = "Join Freebie Solutions";
this.btnjoinfreebie.UseVisualStyleBackColor = true;
this.btnjoinfreebie.Click += new System.EventHandler(this.btnjoinfreebie_Click);
//
// ShiftSoft
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.pnlservices);
this.Controls.Add(this.pnlhome);
this.Controls.Add(this.flbuttons);
this.Controls.Add(this.label2);
this.Controls.Add(this.pnldivider);
this.Controls.Add(this.label1);
this.Name = "ShiftSoft";
this.Size = new System.Drawing.Size(523, 384);
this.Size = new System.Drawing.Size(694, 384);
this.flbuttons.ResumeLayout(false);
this.flbuttons.PerformLayout();
this.pnlhome.ResumeLayout(false);
this.pnlhome.PerformLayout();
this.pnlservices.ResumeLayout(false);
this.pnlservices.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -57,5 +228,18 @@
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel pnldivider;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.FlowLayoutPanel flbuttons;
private System.Windows.Forms.Button btnhome;
private System.Windows.Forms.Button btnservices;
private System.Windows.Forms.Button btnping;
private System.Windows.Forms.Panel pnlhome;
private System.Windows.Forms.Label lbdesc;
private System.Windows.Forms.Label lbwhere;
private System.Windows.Forms.Panel pnlservices;
private System.Windows.Forms.Label lbfreebiedesc;
private System.Windows.Forms.Label lbfreebie;
private System.Windows.Forms.Button btnjoinfreebie;
}
}

View file

@ -25,6 +25,18 @@ namespace ShiftOS.WinForms.ShiftnetSites
public void OnSkinLoad()
{
pnldivider.Tag = "keepbg";
pnldivider.BackColor = SkinEngine.LoadedSkin.ControlTextColor;
Tools.ControlManager.SetupControls(flbuttons);
Tools.ControlManager.SetupControls(pnlhome);
Tools.ControlManager.SetupControls(pnlservices);
lbfreebiedesc.Top = lbfreebie.Top + lbfreebie.Height + 5;
btnjoinfreebie.Top = lbfreebiedesc.Top + lbfreebiedesc.Height + 5;
SetupFreebieUI();
lbdesc.Top = lbwhere.Top + lbwhere.Height + 5;
}
public void OnUpgrade()
@ -33,6 +45,50 @@ namespace ShiftOS.WinForms.ShiftnetSites
public void Setup()
{
pnlhome.BringToFront();
}
private void btnping_Click(object sender, EventArgs e)
{
GoToUrl?.Invoke("shiftnet/shiftsoft/ping");
}
private void btnhome_Click(object sender, EventArgs e)
{
pnlhome.BringToFront();
}
private void btnservices_Click(object sender, EventArgs e)
{
pnlservices.BringToFront();
SetupFreebieUI();
}
public void SetupFreebieUI()
{
if(SaveSystem.CurrentSave.ShiftnetSubscription == 0)
{
btnjoinfreebie.Enabled = false;
btnjoinfreebie.Text = "You are already subscribed to Freebie Solutions.";
}
else
{
btnjoinfreebie.Enabled = true;
btnjoinfreebie.Text = "Join Freebie Solutions";
}
btnjoinfreebie.Left = (lbfreebiedesc.Left + lbfreebiedesc.Width) - btnjoinfreebie.Width;
}
private void btnjoinfreebie_Click(object sender, EventArgs e)
{
Infobox.PromptYesNo("Switch providers", "Would you like to switch from your current Shiftnet provider, " + Applications.DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription].Name + ", to Freebie Solutions by ShiftSoft?", (res) =>
{
if(res == true)
{
SaveSystem.CurrentSave.ShiftnetSubscription = 0;
Infobox.Show("Switch providers", "The operation has completed successfully.");
}
});
}
}
}

View file

@ -117,4 +117,14 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="lbdesc.Text" xml:space="preserve">
<value>Welcome to ShiftSoft. We understand the troubles of being locked within a digital society. For some, it's a prison. For others, it's all they know. It's what life means for them.
But for us, it's a safe-haven. We may all be locked within an evolving operating system with no possibility of escaping, but we can at least develop ways of improving life within this binary world, and that's what we at ShiftSoft are doing.</value>
</data>
<data name="lbfreebiedesc.Text" xml:space="preserve">
<value>The Shiftnet is a wonderful place full of apps, utilities, enhancements and much more for ShiftOS, but it comes at a cost.
Freebie Solutions takes that cost away. You get free Shiftnet usage, but are locked to sites listed on Ping and you are limited to 256 byte-per-second downloads. Perfect for those situations where Codepoints and shiftnet connectivity are a needed resource.</value>
</data>
</root>

View file

@ -74,22 +74,10 @@ namespace ShiftOS.WinForms.Stories
WriteLine("Anyways, that's all I'll say for now. Have fun on the Shiftnet. I have to go work on something.");
WriteLine("One of my friends'll contact you once you've gotten a new service provider.");
Story.PushObjective("Register with a new Shiftnet service provider.", "You've just unlocked the Shiftnet, which has opened up a whole new world of applications and features for ShiftOS. Before you go nuts with it, you may want to register with a better service provider than Freebie Solutions.", () =>
{
return SaveSystem.CurrentSave.ShiftnetSubscription != 0;
},
() =>
{
Story.Context.MarkComplete();
SaveSystem.SaveGame();
TerminalBackend.PrintPrompt();
Story.Start("hacker101_breakingbonds_1");
});
TerminalBackend.PrefixEnabled = true;
TerminalBackend.PrintPrompt();
Story.Context.AutoComplete = false;
Story.Context.MarkComplete();
Story.Start("aiden_shiftnet2");
}
[Story("hacker101_breakingbonds_1")]
@ -111,6 +99,9 @@ namespace ShiftOS.WinForms.Stories
WriteLine("Before I can do that, however, I need you to do a few things.");
WriteLine("I'll assign what I need you to do as an objective. When you're done, I'll tell you what you need to know.");
Story.Context.MarkComplete();
TerminalBackend.PrefixEnabled = true;
Story.PushObjective("Breaking the Bonds: Errand Boy", @"hacker101 has something he needs to show you, however before he can, you need to do the following:
- Buy ""TriWrite"" from Appscape
@ -127,14 +118,25 @@ namespace ShiftOS.WinForms.Stories
SaveSystem.SaveGame();
Story.Start("hacker101_breakingbonds_2");
});
TerminalBackend.PrefixEnabled = true;
TerminalBackend.PrintPrompt();
Story.Context.AutoComplete = false;
}
[Story("aiden_shiftnet2")]
public static void AidenShiftnet2()
{
Story.PushObjective("Register with a new Shiftnet service provider.", "You've just unlocked the Shiftnet, which has opened up a whole new world of applications and features for ShiftOS. Before you go nuts with it, you may want to register with a better service provider than Freebie Solutions.", () =>
{
return SaveSystem.CurrentSave.ShiftnetSubscription != 0;
},
() =>
{
Story.Context.MarkComplete();
SaveSystem.SaveGame();
TerminalBackend.PrintPrompt();
Story.Start("hacker101_breakingbonds_1");
});
Story.Context.AutoComplete = false;
}
private static void WriteLine(string text, bool showCharacterName=true)
{
@ -159,7 +161,7 @@ namespace ShiftOS.WinForms.Stories
{
Console.Write(c);
ConsoleEx.OnFlush?.Invoke();
Thread.Sleep(45);
Thread.Sleep(5);
}
Thread.Sleep(1000);
}

View file

@ -50,6 +50,8 @@ namespace ShiftOS.WinForms
[Namespace("desktop")]
public partial class WinformsDesktop : Form, IDesktop
{
public MainMenu.MainMenu ParentMenu = null;
[Command("pushnote")]
[RequiresArgument("target")]
[RequiresArgument("title")]
@ -921,7 +923,7 @@ namespace ShiftOS.WinForms
/// <param name="e">E.</param>
private void Desktop_Load(object sender, EventArgs e)
{
SaveSystem.IsSandbox = this.IsSandbox;
SaveSystem.Begin();
SetupDesktop();
@ -964,6 +966,7 @@ namespace ShiftOS.WinForms
}
private IWindowBorder focused = null;
internal bool IsSandbox = false;
public string DesktopName
{
@ -1033,10 +1036,17 @@ namespace ShiftOS.WinForms
{
try
{
this.Invoke(new Action(() =>
if (this.Visible == true)
{
act?.Invoke();
}));
this.Invoke(new Action(() =>
{
act?.Invoke();
}));
}
else
{
ParentMenu?.Invoke(act);
}
}
catch
{
@ -1105,12 +1115,16 @@ namespace ShiftOS.WinForms
public void HideAppLauncher()
{
this.Invoke(new Action(() =>
try
{
currentSettingsPane?.Hide();
currentSettingsPane = null;
pnladvancedal.Hide();
}));
this.Invoke(new Action(() =>
{
currentSettingsPane?.Hide();
currentSettingsPane = null;
pnladvancedal.Hide();
}));
}
catch { }
}
}

View file

@ -126,6 +126,7 @@ namespace ShiftOS.Engine
}
// Provides a list of all open ShiftOS windows.
public static List<IWindowBorder> OpenForms = new List<IWindowBorder>();

View file

@ -67,6 +67,7 @@ namespace ShiftOS.Engine
/// Boolean representing whether the save system is ready to be used.
/// </summary>
public static bool Ready = false;
public static bool IsSandbox = false;
/// <summary>
/// Occurs before the save system connects to the ShiftOS Digital Society.
@ -140,64 +141,127 @@ namespace ShiftOS.Engine
Console.WriteLine("[simpl-conf] Reading configuration files (global-3.conf)");
Console.WriteLine("[termdb] Building command database from filesystem...");
TerminalBackend.PopulateTerminalCommands();
Console.WriteLine("[inetd] Connecting to network...");
Ready = false;
if (PreDigitalSocietyConnection != null)
if (IsSandbox == false)
{
PreDigitalSocietyConnection?.Invoke();
Console.WriteLine("[inetd] Connecting to network...");
while (!Ready)
Ready = false;
if (PreDigitalSocietyConnection != null)
{
Thread.Sleep(10);
PreDigitalSocietyConnection?.Invoke();
while (!Ready)
{
Thread.Sleep(10);
}
}
}
bool guidReceived = false;
ServerManager.GUIDReceived += (str) =>
{
//Connection successful! Stop waiting!
guidReceived = true;
Console.WriteLine("[inetd] Connection successful.");
};
try
{
ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort);
//This haults the client until the connection is successful.
while (ServerManager.thisGuid == new Guid())
bool guidReceived = false;
ServerManager.GUIDReceived += (str) =>
{
Thread.Sleep(10);
//Connection successful! Stop waiting!
guidReceived = true;
Console.WriteLine("[inetd] Connection successful.");
};
try
{
ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort);
//This haults the client until the connection is successful.
while (ServerManager.thisGuid == new Guid())
{
Thread.Sleep(10);
}
Console.WriteLine("[inetd] DHCP GUID recieved, finished setup");
FinishBootstrap();
}
Console.WriteLine("[inetd] DHCP GUID recieved, finished setup");
FinishBootstrap();
catch (Exception ex)
{
//No errors, this never gets called.
Console.WriteLine("[inetd] SEVERE: " + ex.Message);
Thread.Sleep(3000);
Console.WriteLine("[sys] SEVERE: Cannot connect to server. Shutting down in 5...");
Thread.Sleep(1000);
Console.WriteLine("[sys] 4...");
Thread.Sleep(1000);
Console.WriteLine("[sys] 3...");
Thread.Sleep(1000);
Console.WriteLine("[sys] 2...");
Thread.Sleep(1000);
Console.WriteLine("[sys] 1...");
Thread.Sleep(1000);
Console.WriteLine("[sys] Bye bye.");
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
//Nothing happens past this point - but the client IS connected! It shouldn't be stuck in that while loop above.
}
catch (Exception ex)
else
{
//No errors, this never gets called.
Console.WriteLine("[inetd] SEVERE: " + ex.Message);
Thread.Sleep(3000);
Console.WriteLine("[sys] SEVERE: Cannot connect to server. Shutting down in 5...");
Thread.Sleep(1000);
Console.WriteLine("[sys] 4...");
Thread.Sleep(1000);
Console.WriteLine("[sys] 3...");
Thread.Sleep(1000);
Console.WriteLine("[sys] 2...");
Thread.Sleep(1000);
Console.WriteLine("[sys] 1...");
Thread.Sleep(1000);
Console.WriteLine("[sys] Bye bye.");
System.Diagnostics.Process.GetCurrentProcess().Kill();
Console.WriteLine("[inetd] Sandbox mode initiating...");
CurrentSave = new Save
{
IsSandbox = true,
Username = "sandbox",
Password = "sandbox",
SystemName = "shiftos",
Users = new List<ClientSave>
{
new ClientSave
{
Username = "user",
Password = "",
Permissions = 0
}
},
Class = 0,
ID = new Guid(),
Upgrades = new Dictionary<string, bool>(),
CurrentLegions = null,
IsMUDAdmin = false,
IsPatreon = false,
Language = "english",
LastMonthPaid = 0,
MajorVersion = 1,
MinorVersion = 0,
MusicEnabled = false,
MusicVolume = 100,
MyShop = "",
PasswordHashed = false,
PickupPoint = "",
RawReputation = 0.0f,
Revision = 0,
ShiftnetSubscription = 0,
SoundEnabled = true,
StoriesExperienced = null,
StoryPosition = 0,
UniteAuthToken = "",
};
CurrentUser = CurrentSave.Users.First();
Localization.SetupTHETRUEDefaultLocals();
Shiftorium.Init();
TerminalBackend.InStory = false;
TerminalBackend.PrefixEnabled = true;
Desktop.InvokeOnWorkerThread(new Action(() =>
{
ShiftOS.Engine.Scripting.LuaInterpreter.RunSft(Paths.GetPath("kernel.sft"));
}));
Desktop.InvokeOnWorkerThread(new Action(() => Desktop.PopulateAppLauncher()));
GameReady?.Invoke();
}
//Nothing happens past this point - but the client IS connected! It shouldn't be stuck in that while loop above.
}));
thread.IsBackground = true;
thread.Start();
@ -243,10 +307,6 @@ namespace ShiftOS.Engine
Thread.Sleep(10);
}
Localization.SetupTHETRUEDefaultLocals();
Shiftorium.Init();
while (CurrentSave.StoryPosition < 1)
{
Thread.Sleep(10);

View file

@ -302,15 +302,17 @@ Ping: {ServerManager.DigitalSocietyPing} ms
/// <param name="contents">The message body</param>
public static void SendMessage(string name, string contents)
{
var sMsg = new ServerMessage
if (!SaveSystem.IsSandbox)
{
Name = name,
Contents = contents,
GUID = thisGuid.ToString(),
};
PingTimer.Start();
client.Send(new NetObject("msg", sMsg));
var sMsg = new ServerMessage
{
Name = name,
Contents = contents,
GUID = thisGuid.ToString(),
};
PingTimer.Start();
client.Send(new NetObject("msg", sMsg));
}
}
private static bool singleplayer = false;

View file

@ -429,6 +429,9 @@ namespace ShiftOS.Engine
/// <returns>Whether the upgrade is installed.</returns>
public static bool UpgradeInstalled(string id)
{
if (SaveSystem.IsSandbox == true)
return true;
if (string.IsNullOrWhiteSpace(id))
return true;
if (SaveSystem.CurrentSave != null)

View file

@ -115,8 +115,16 @@ namespace ShiftOS.Engine
t.IsBackground = true;
t.Start();
Console.WriteLine();
ConsoleEx.ForegroundColor = ConsoleColor.Red;
ConsoleEx.Bold = true;
Console.WriteLine("NEW OBJECTIVE:");
Console.WriteLine();
ConsoleEx.ForegroundColor = ConsoleColor.White;
ConsoleEx.Bold = false;
Console.WriteLine("A new objective has been added to your system. Run sos.status to find out what you need to do.");
TerminalBackend.PrintPrompt();
}