diff options
| author | RogueAI42 <[email protected]> | 2017-06-13 20:06:38 +1000 |
|---|---|---|
| committer | RogueAI42 <[email protected]> | 2017-06-13 20:06:38 +1000 |
| commit | 2acfa34596061a9236bb6a9df1e3f3a0c01d6ff0 (patch) | |
| tree | 72954044f3dde5f9a17d12f99cd57a819f1b0f58 /ShiftOS.WinForms | |
| parent | a2db5d39096cbf4d32412ad40168769ca63d9493 (diff) | |
| download | shiftos_thereturn-2acfa34596061a9236bb6a9df1e3f3a0c01d6ff0.tar.gz shiftos_thereturn-2acfa34596061a9236bb6a9df1e3f3a0c01d6ff0.tar.bz2 shiftos_thereturn-2acfa34596061a9236bb6a9df1e3f3a0c01d6ff0.zip | |
Python API
It uses a meta-language and a CSharpCodeProvider on startup. I will
release a tutorial on the forums soon showing how to use it.
This commit also adds an extremely basic loading screen which shows
while Desktop is getting everything ready. Which can take a while
if you have any Python mods. Thanks, IronPython.
Diffstat (limited to 'ShiftOS.WinForms')
| -rw-r--r-- | ShiftOS.WinForms/App.config | 8 | ||||
| -rw-r--r-- | ShiftOS.WinForms/MainMenu/Loading.Designer.cs | 66 | ||||
| -rw-r--r-- | ShiftOS.WinForms/MainMenu/Loading.cs | 31 | ||||
| -rw-r--r-- | ShiftOS.WinForms/MainMenu/Loading.resx | 120 | ||||
| -rw-r--r-- | ShiftOS.WinForms/MainMenu/MainMenu.cs | 13 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Properties/Resources.Designer.cs | 15 | ||||
| -rw-r--r-- | ShiftOS.WinForms/ShiftOS.WinForms.csproj | 11 |
7 files changed, 254 insertions, 10 deletions
diff --git a/ShiftOS.WinForms/App.config b/ShiftOS.WinForms/App.config index a0a13df..b899c11 100644 --- a/ShiftOS.WinForms/App.config +++ b/ShiftOS.WinForms/App.config @@ -14,6 +14,14 @@ <assemblyIdentity name="System.Interactive.Async" publicKeyToken="94bc3704cddfc263" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.0.1000.0" newVersion="3.0.1000.0" /> </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Scripting" publicKeyToken="7f709c5b713576e1" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.1.2.22" newVersion="1.1.2.22" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="IronPython" publicKeyToken="7f709c5b713576e1" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-2.7.7.0" newVersion="2.7.7.0" /> + </dependentAssembly> </assemblyBinding> </runtime> </configuration>
\ No newline at end of file diff --git a/ShiftOS.WinForms/MainMenu/Loading.Designer.cs b/ShiftOS.WinForms/MainMenu/Loading.Designer.cs new file mode 100644 index 0000000..95619d9 --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/Loading.Designer.cs @@ -0,0 +1,66 @@ +namespace ShiftOS.WinForms.MainMenu +{ + partial class Loading + { + /// <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.label = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label + // + this.label.Dock = System.Windows.Forms.DockStyle.Fill; + this.label.Font = new System.Drawing.Font("Tahoma", 72F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label.ForeColor = System.Drawing.Color.White; + this.label.Location = new System.Drawing.Point(0, 0); + this.label.Name = "label"; + this.label.Size = new System.Drawing.Size(284, 262); + this.label.TabIndex = 0; + this.label.Text = "Loading..."; + this.label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Loading + // + 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(284, 262); + this.Controls.Add(this.label); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "Loading"; + this.Text = "Loading"; + this.WindowState = System.Windows.Forms.FormWindowState.Maximized; + this.Shown += new System.EventHandler(this.Loading_FormShown); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label; + } +}
\ No newline at end of file diff --git a/ShiftOS.WinForms/MainMenu/Loading.cs b/ShiftOS.WinForms/MainMenu/Loading.cs new file mode 100644 index 0000000..555f1d4 --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/Loading.cs @@ -0,0 +1,31 @@ +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.MainMenu +{ + public partial class Loading : Form + { + public Loading() + { + InitializeComponent(); + } + + private void Loading_FormShown(object sender, EventArgs e) + { + // This hideous timer thing is the most reliable way to make the form update + // before it starts doing stuff. + var callback = new Timer(); + callback.Tick += (o, a) => { Desktop.CurrentDesktop.Show(); Hide(); callback.Stop(); }; + callback.Interval = 1; + callback.Start(); + } + } +} diff --git a/ShiftOS.WinForms/MainMenu/Loading.resx b/ShiftOS.WinForms/MainMenu/Loading.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/Loading.resx @@ -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>
\ No newline at end of file diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.cs b/ShiftOS.WinForms/MainMenu/MainMenu.cs index e11edc2..1936fec 100644 --- a/ShiftOS.WinForms/MainMenu/MainMenu.cs +++ b/ShiftOS.WinForms/MainMenu/MainMenu.cs @@ -15,6 +15,11 @@ namespace ShiftOS.WinForms.MainMenu { public partial class MainMenu : Form { + private void StartGame() + { + new Loading().Show(); + } + public MainMenu(IDesktop desk) { InitializeComponent(); @@ -163,7 +168,7 @@ namespace ShiftOS.WinForms.MainMenu private void button2_Click(object sender, EventArgs e) { (Desktop.CurrentDesktop as WinformsDesktop).IsSandbox = true; - Desktop.CurrentDesktop.Show(); + StartGame(); } private void button3_Click(object sender, EventArgs e) @@ -239,7 +244,7 @@ namespace ShiftOS.WinForms.MainMenu private void btncontinue_Click(object sender, EventArgs e) { - Desktop.CurrentDesktop.Show(); + StartGame(); } @@ -253,13 +258,13 @@ namespace ShiftOS.WinForms.MainMenu if (result == true) { System.IO.File.Delete(path); - Desktop.CurrentDesktop.Show(); + StartGame(); } }); } else { - Desktop.CurrentDesktop.Show(); + StartGame(); } } } diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs index 137db4b..2cba3c9 100644 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -1094,7 +1094,7 @@ namespace ShiftOS.WinForms.Properties { /// Name: "NetXtreme Hyper Edition", /// CostPerMonth: 150, /// DownloadSpeed: 524288, //512 kb/s - /// Description: "It's time to supercharge your Shift [rest of string was truncated]";. + /// Description: "It's time to supercharge your Shiftnet experience. [rest of string was truncated]";. /// </summary> internal static string ShiftnetServices { get { @@ -1116,7 +1116,8 @@ namespace ShiftOS.WinForms.Properties { /// Name: "Icon Manager", /// Cost: 450, /// Description: "This tool allows you to add and edit application icons within ShiftOS for the small prive of 450 Codepoints!", - /// Dependencies: "skinning [rest of string was truncated]";. + /// Dependencies: "skinning", + /// Category [rest of string was truncated]";. /// </summary> internal static string Shiftorium { get { @@ -1126,7 +1127,7 @@ namespace ShiftOS.WinForms.Properties { /// <summary> /// Looks up a localized string similar to {\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} - ///{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f38\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;}{\fl [rest of string was truncated]";. + ///{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\f38\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0302020204030204}Calibri Light;}{\flo [rest of string was truncated]";. /// </summary> internal static string ShiftOS { get { @@ -1275,7 +1276,8 @@ namespace ShiftOS.WinForms.Properties { ///Eine kurze Erklärung wie du das Terminal benutzt lautet wiefolgt. Du kannst das command 'sos.help' benutzen um eine Liste aller commands aufzurufen. Schreib es ///einfach in das Terminal und drücke <enter> um alle commands anzuzeigen. /// - ///Commands können mit argumenten versehen werden, indem du ein key-value Paar in einem {} Block hinter dem command angibst. Zum Be [rest of string was truncated]";. + ///Commands können mit argumenten versehen werden, indem du ein key-value Paar in einem {} Block hinter dem command angibst. Zum Beispiel: + /// [rest of string was truncated]";. /// </summary> internal static string strings_de { get { @@ -1294,7 +1296,8 @@ namespace ShiftOS.WinForms.Properties { ///Commands can be sent arguments by specifying a key-value pair inside a {} block at the end of the command. For example: /// ///some.command{print:\"hello\"} - ///math.add{op1 [rest of string was truncated]";. + ///math.add{op1:1,op2:2} + /// [rest of string was truncated]";. /// </summary> internal static string strings_en { get { @@ -1482,7 +1485,7 @@ namespace ShiftOS.WinForms.Properties { /// "Before you can begin with ShiftOS, you'll need to know a few things about it.", /// "One: Terminal command syntax.", /// "Inside ShiftOS, the bulk of your time is going to be spent within the Terminal.", - /// "The Terminal is an application that starts up when you turn on your computer. It allows you to execute system commands, ope [rest of string was truncated]";. + /// "The Terminal is an application that starts up when you turn on your computer. It allows you to execute system commands, open program [rest of string was truncated]";. /// </summary> internal static string sys_shiftoriumstory { get { diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index e0a53ea..31de44e 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -37,6 +37,7 @@ <HintPath>..\packages\CommonMark.NET.0.15.0\lib\net45\CommonMark.dll</HintPath> <Private>True</Private> </Reference> + <Reference Include="Microsoft.Scripting, Version=1.1.2.22, Culture=neutral, PublicKeyToken=7f709c5b713576e1" /> <Reference Include="Microsoft.VisualBasic" /> <Reference Include="NAudio, Version=1.8.0.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\packages\NAudio.1.8.0\lib\net35\NAudio.dll</HintPath> @@ -356,6 +357,12 @@ <Compile Include="HackerCommands.cs" /> <Compile Include="IDesktopWidget.cs" /> <Compile Include="JobTasks.cs" /> + <Compile Include="MainMenu\Loading.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="MainMenu\Loading.Designer.cs"> + <DependentUpon>Loading.cs</DependentUpon> + </Compile> <Compile Include="MainMenu\MainMenu.cs"> <SubType>Form</SubType> </Compile> @@ -609,6 +616,9 @@ <EmbeddedResource Include="GUILogin.resx"> <DependentUpon>GUILogin.cs</DependentUpon> </EmbeddedResource> + <EmbeddedResource Include="MainMenu\Loading.resx"> + <DependentUpon>Loading.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="MainMenu\MainMenu.resx"> <DependentUpon>MainMenu.cs</DependentUpon> </EmbeddedResource> @@ -875,6 +885,7 @@ <None Include="Resources\notestate_connection_full.bmp" /> <None Include="Resources\iconSpeaker.bmp" /> <None Include="Resources\ShiftOSFull.png" /> + <Content Include="Resources\GuessTheNumber.py" /> <Content Include="SystemIcons\iconArtpad.png" /> <Content Include="SystemIcons\iconAudioPlayer.png" /> <Content Include="SystemIcons\iconBitnoteDigger.png" /> |
