mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-22 18:02:16 +00:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # ShiftOS.WinForms/ShiftOS.WinForms.csproj
This commit is contained in:
commit
5bebd4411b
11 changed files with 566 additions and 74 deletions
|
@ -14,24 +14,27 @@ namespace ShiftOS.Objects
|
|||
public string DigitalSocietyAddress { get; set; }
|
||||
public int DigitalSocietyPort { get; set; }
|
||||
|
||||
public static UserConfig Get()
|
||||
{
|
||||
var conf = new UserConfig
|
||||
private static UserConfig def = new UserConfig
|
||||
{
|
||||
Language = "english",
|
||||
DigitalSocietyAddress = "michaeltheshifter.me",
|
||||
DigitalSocietyPort = 13370
|
||||
};
|
||||
|
||||
if (!File.Exists("servers.json"))
|
||||
{
|
||||
File.WriteAllText("servers.json", JsonConvert.SerializeObject(conf, Formatting.Indented));
|
||||
}
|
||||
public static UserConfig current = null;
|
||||
|
||||
public static UserConfig Get()
|
||||
{
|
||||
if (current != null)
|
||||
return current;
|
||||
if (File.Exists("servers.json"))
|
||||
current = JsonConvert.DeserializeObject<UserConfig>(File.ReadAllText("servers.json"));
|
||||
else
|
||||
{
|
||||
conf = JsonConvert.DeserializeObject<UserConfig>(File.ReadAllText("servers.json"));
|
||||
File.WriteAllText("servers.json", JsonConvert.SerializeObject(def, Formatting.Indented));
|
||||
current = def;
|
||||
}
|
||||
return conf;
|
||||
return current;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
181
ShiftOS.WinForms/Applications/ButtonMaster.Designer.cs
generated
Normal file
181
ShiftOS.WinForms/Applications/ButtonMaster.Designer.cs
generated
Normal file
|
@ -0,0 +1,181 @@
|
|||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
partial class ButtonMaster
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ButtonMaster));
|
||||
this.startpnl = new System.Windows.Forms.Panel();
|
||||
this.quitbtn = new System.Windows.Forms.Button();
|
||||
this.playbtn = new System.Windows.Forms.Button();
|
||||
this.difficultysel = new System.Windows.Forms.ListBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.desclabel = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.scorecounter = new System.Windows.Forms.Label();
|
||||
this.startpnl.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// startpnl
|
||||
//
|
||||
this.startpnl.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.startpnl.Controls.Add(this.quitbtn);
|
||||
this.startpnl.Controls.Add(this.playbtn);
|
||||
this.startpnl.Controls.Add(this.difficultysel);
|
||||
this.startpnl.Controls.Add(this.label3);
|
||||
this.startpnl.Controls.Add(this.desclabel);
|
||||
this.startpnl.Controls.Add(this.label2);
|
||||
this.startpnl.Controls.Add(this.label1);
|
||||
this.startpnl.Location = new System.Drawing.Point(27, 31);
|
||||
this.startpnl.Name = "startpnl";
|
||||
this.startpnl.Size = new System.Drawing.Size(580, 409);
|
||||
this.startpnl.TabIndex = 0;
|
||||
//
|
||||
// quitbtn
|
||||
//
|
||||
this.quitbtn.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.quitbtn.Location = new System.Drawing.Point(291, 303);
|
||||
this.quitbtn.Name = "quitbtn";
|
||||
this.quitbtn.Size = new System.Drawing.Size(58, 23);
|
||||
this.quitbtn.TabIndex = 7;
|
||||
this.quitbtn.Text = "Quit";
|
||||
this.quitbtn.UseVisualStyleBackColor = true;
|
||||
this.quitbtn.Click += new System.EventHandler(this.quitbtn_Click);
|
||||
//
|
||||
// playbtn
|
||||
//
|
||||
this.playbtn.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.playbtn.Location = new System.Drawing.Point(229, 303);
|
||||
this.playbtn.Name = "playbtn";
|
||||
this.playbtn.Size = new System.Drawing.Size(56, 23);
|
||||
this.playbtn.TabIndex = 6;
|
||||
this.playbtn.Text = "Play";
|
||||
this.playbtn.UseVisualStyleBackColor = true;
|
||||
this.playbtn.Click += new System.EventHandler(this.playbtn_Click);
|
||||
//
|
||||
// difficultysel
|
||||
//
|
||||
this.difficultysel.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.difficultysel.FormattingEnabled = true;
|
||||
this.difficultysel.Location = new System.Drawing.Point(152, 202);
|
||||
this.difficultysel.Name = "difficultysel";
|
||||
this.difficultysel.Size = new System.Drawing.Size(276, 95);
|
||||
this.difficultysel.TabIndex = 5;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label3.Location = new System.Drawing.Point(243, 179);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(79, 20);
|
||||
this.label3.TabIndex = 4;
|
||||
this.label3.Tag = "header2";
|
||||
this.label3.Text = "Difficulty";
|
||||
//
|
||||
// desclabel
|
||||
//
|
||||
this.desclabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.desclabel.Location = new System.Drawing.Point(3, 67);
|
||||
this.desclabel.Name = "desclabel";
|
||||
this.desclabel.Size = new System.Drawing.Size(577, 112);
|
||||
this.desclabel.TabIndex = 2;
|
||||
this.desclabel.Tag = "";
|
||||
this.desclabel.Text = resources.GetString("desclabel.Text");
|
||||
this.desclabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(235, 37);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(105, 13);
|
||||
this.label2.TabIndex = 1;
|
||||
this.label2.Text = "by Appscape Games";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label1.Location = new System.Drawing.Point(211, 12);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(152, 25);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Tag = "header1";
|
||||
this.label1.Text = "ButtonMaster";
|
||||
//
|
||||
// scorecounter
|
||||
//
|
||||
this.scorecounter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.scorecounter.BackColor = System.Drawing.Color.Transparent;
|
||||
this.scorecounter.Font = new System.Drawing.Font("Courier New", 15.75F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.scorecounter.ForeColor = System.Drawing.Color.Red;
|
||||
this.scorecounter.Location = new System.Drawing.Point(548, 454);
|
||||
this.scorecounter.Name = "scorecounter";
|
||||
this.scorecounter.Size = new System.Drawing.Size(92, 26);
|
||||
this.scorecounter.TabIndex = 1;
|
||||
this.scorecounter.Tag = "keepfont keepfg keepbg";
|
||||
this.scorecounter.Text = "score";
|
||||
this.scorecounter.TextAlign = System.Drawing.ContentAlignment.BottomRight;
|
||||
this.scorecounter.Visible = false;
|
||||
//
|
||||
// ButtonMaster
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackgroundImage = global::ShiftOS.WinForms.Properties.Resources.BlueBlueVerticalGradient;
|
||||
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.Controls.Add(this.scorecounter);
|
||||
this.Controls.Add(this.startpnl);
|
||||
this.Name = "ButtonMaster";
|
||||
this.Size = new System.Drawing.Size(640, 480);
|
||||
this.startpnl.ResumeLayout(false);
|
||||
this.startpnl.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel startpnl;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label desclabel;
|
||||
private System.Windows.Forms.ListBox difficultysel;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Button playbtn;
|
||||
private System.Windows.Forms.Button quitbtn;
|
||||
private System.Windows.Forms.Label scorecounter;
|
||||
}
|
||||
}
|
176
ShiftOS.WinForms/Applications/ButtonMaster.cs
Normal file
176
ShiftOS.WinForms/Applications/ButtonMaster.cs
Normal file
|
@ -0,0 +1,176 @@
|
|||
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.Engine;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
// Behold... The ShiftOS program that doesn't use threading.
|
||||
[WinOpen("buttonmaster")]
|
||||
[Launcher("Button Master", false, "", "Games")]
|
||||
[AppscapeEntry("buttonmaster", "ButtonMaster", "Can you click all the buttons in 60 seconds?", 300, 10000)]
|
||||
public partial class ButtonMaster : UserControl, IShiftOSWindow
|
||||
{
|
||||
public ushort Buttons;
|
||||
public double Codepoints, Loss;
|
||||
private ulong RoundedCodepoints { get { return (ulong) Math.Round(Codepoints); } }
|
||||
public Timer clock = new Timer();
|
||||
private ButtonObject[] ButtonObjects;
|
||||
private static ButtonMasterDifficulty[] difficulties = new ButtonMasterDifficulty[]
|
||||
{
|
||||
new ButtonMasterDifficulty("Easy", 24, 500),
|
||||
new ButtonMasterDifficulty("Medium", 48, 1000),
|
||||
new ButtonMasterDifficulty("Hard", 100, 2000),
|
||||
new ButtonMasterDifficulty("Super Hard", 500, 10000)
|
||||
};
|
||||
public ButtonMaster()
|
||||
{
|
||||
InitializeComponent();
|
||||
difficultysel.Items.AddRange(difficulties);
|
||||
difficultysel.SelectedIndex = 0;
|
||||
clock.Interval = 20;
|
||||
clock.Tick += gameloop;
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void quitbtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
AppearanceManager.Close(this);
|
||||
}
|
||||
|
||||
private void playbtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
var difficulty = difficultysel.SelectedItem as ButtonMasterDifficulty;
|
||||
Buttons = difficulty.Buttons;
|
||||
Codepoints = difficulty.Codepoints;
|
||||
Loss = difficulty.Codepoints / 3000.0;
|
||||
startpnl.Hide();
|
||||
scorecounter.Text = difficulty.Codepoints.ToString();
|
||||
scorecounter.Show();
|
||||
ButtonObjects = new ButtonObject[Buttons];
|
||||
for (ushort i = 0; i < Buttons; i++)
|
||||
ButtonObjects[i] = new ButtonObject(this);
|
||||
Controls.AddRange(ButtonObjects.Select(b => b.ctl).ToArray());
|
||||
clock.Start();
|
||||
}
|
||||
|
||||
private void StopGame(string text)
|
||||
{
|
||||
desclabel.Text = text;
|
||||
startpnl.Show();
|
||||
clock.Stop();
|
||||
scorecounter.Hide();
|
||||
foreach (var b in ButtonObjects)
|
||||
{
|
||||
clock.Tick -= b.move;
|
||||
Controls.Remove(b.ctl);
|
||||
}
|
||||
}
|
||||
|
||||
private void gameloop(object sender, EventArgs e)
|
||||
{
|
||||
if (Codepoints <= 0)
|
||||
{
|
||||
Codepoints = 0;
|
||||
string text = String.Format("You lost. There were {0} buttons to go.", Buttons);
|
||||
if (difficultysel.SelectedIndex > 0)
|
||||
text += " Try an easier difficulty?";
|
||||
StopGame(text);
|
||||
}
|
||||
else if (Buttons <= 0)
|
||||
{
|
||||
SaveSystem.CurrentSave.Codepoints += RoundedCodepoints;
|
||||
string text = String.Format("You won! {0} Codepoints have been transferred to your system.", RoundedCodepoints);
|
||||
StopGame(text);
|
||||
}
|
||||
else
|
||||
{
|
||||
Codepoints -= Loss;
|
||||
scorecounter.Text = RoundedCodepoints.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
public class ButtonMasterDifficulty
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public ushort Buttons { get; private set; }
|
||||
public uint Codepoints { get; private set; }
|
||||
public string Display { get; private set; }
|
||||
public override string ToString()
|
||||
{
|
||||
return Display;
|
||||
}
|
||||
public ButtonMasterDifficulty(string in_Name, ushort in_Buttons, uint in_Codepoints)
|
||||
{
|
||||
Name = in_Name;
|
||||
Buttons = in_Buttons;
|
||||
Codepoints = in_Codepoints;
|
||||
Display = String.Format("{0} ({1} Buttons, {2} Codepoints)", Name, Buttons, Codepoints);
|
||||
}
|
||||
}
|
||||
|
||||
public class ButtonObject
|
||||
{
|
||||
public Button ctl;
|
||||
public sbyte xspeed, yspeed;
|
||||
public ButtonMaster parent;
|
||||
private static Random rnd = new Random();
|
||||
public void move(object sender, EventArgs e)
|
||||
{
|
||||
ctl.Top += yspeed;
|
||||
if (ctl.Top < 0 || ctl.Bottom > parent.Height)
|
||||
yspeed = (sbyte)(Math.Abs(yspeed) * -(ctl.Top / Math.Abs(ctl.Top))); // Change the sign of yspeed to be the opposite of that of ctl.Top
|
||||
ctl.Left += xspeed;
|
||||
if (ctl.Left < 0 || ctl.Right > parent.Width)
|
||||
xspeed = (sbyte)(Math.Abs(xspeed) * -(ctl.Left / Math.Abs(ctl.Left)));
|
||||
}
|
||||
public void click(object sender, EventArgs e)
|
||||
{
|
||||
parent.Buttons--;
|
||||
ctl.Hide();
|
||||
parent.clock.Tick -= move;
|
||||
}
|
||||
public ButtonObject(ButtonMaster in_parent)
|
||||
{
|
||||
xspeed = (sbyte) rnd.Next(10, 20);
|
||||
yspeed = (sbyte) rnd.Next(10, 20);
|
||||
parent = in_parent;
|
||||
parent.clock.Tick += move;
|
||||
ctl = new Button();
|
||||
ctl.Click += click;
|
||||
ctl.Top = rnd.Next(parent.Height);
|
||||
ctl.Left = rnd.Next(parent.Width);
|
||||
ctl.Width = 75;
|
||||
ctl.Height = 23;
|
||||
ctl.Text = "Click";
|
||||
// Time to invoke a private method using reflection. What could possibly go wrong?
|
||||
// This stops the player from just holding down space to beat the level.
|
||||
typeof(Button).GetMethod("SetStyle", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(ctl, new object[] { ControlStyles.Selectable, false });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
130
ShiftOS.WinForms/Applications/ButtonMaster.resx
Normal file
130
ShiftOS.WinForms/Applications/ButtonMaster.resx
Normal file
|
@ -0,0 +1,130 @@
|
|||
<?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>
|
||||
<data name="desclabel.Text" xml:space="preserve">
|
||||
<value>In the game of ButtonMaster, dozens of buttons bounce
|
||||
around the window. Your task is to click all of them in
|
||||
60 seconds. The quicker you pull it off, the more points
|
||||
you earn.
|
||||
|
||||
In this special ShiftOS version, any points you earn are
|
||||
added to your Codepoints balance at the end of the game.
|
||||
So, what are you waiting for?</value>
|
||||
</data>
|
||||
</root>
|
|
@ -71,7 +71,7 @@ namespace ShiftOS.WinForms
|
|||
Action completed = null;
|
||||
completed = () =>
|
||||
{
|
||||
SaveSystem.Ready = true;
|
||||
SaveSystem.Ready.Set();
|
||||
Engine.AudioManager.PlayCompleted -= completed;
|
||||
AudioManager.StartAmbientLoop();
|
||||
};
|
||||
|
|
30
ShiftOS.WinForms/Properties/Resources.Designer.cs
generated
30
ShiftOS.WinForms/Properties/Resources.Designer.cs
generated
|
@ -388,6 +388,16 @@ namespace ShiftOS.WinForms.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap BlueBlueVerticalGradient {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("BlueBlueVerticalGradient", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
|
@ -1150,7 +1160,8 @@ namespace ShiftOS.WinForms.Properties {
|
|||
/// "ReadAccessToLowUsers": false,
|
||||
/// "permissions": 0
|
||||
/// },
|
||||
/// [rest of string was truncated]";.
|
||||
/// {
|
||||
/// "Name" [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string PebcakDevelFS {
|
||||
get {
|
||||
|
@ -1184,7 +1195,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 {
|
||||
|
@ -1206,7 +1217,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 {
|
||||
|
@ -1216,7 +1228,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 {
|
||||
|
@ -1365,7 +1377,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 {
|
||||
|
@ -1390,7 +1403,7 @@ namespace ShiftOS.WinForms.Properties {
|
|||
/// "{GEN_WELCOME}": "Welcome to ShiftOS.",
|
||||
/// "{GEN_SYSTEMNAME}": "System name",
|
||||
/// "{GEN_PASSWORD}": "Password",
|
||||
/// "{GEN_LPROMPT [rest of string was truncated]";.
|
||||
/// "{GEN_LPROMPT}": "%sysname lo [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string strings_en {
|
||||
get {
|
||||
|
@ -1414,7 +1427,8 @@ namespace ShiftOS.WinForms.Properties {
|
|||
/// "{GEN_CURRENTPROCESSES}": "Les procèdures actuelles",
|
||||
/// "{GEN_WELCOME}": "Bienvenue au ShiftOS.",
|
||||
/// "{GEN_SYSTEMNAME}": "Nom de système",
|
||||
/// "{GEN_PASSWORD}": "Mot de [rest of string was truncated]";.
|
||||
/// "{GEN_PASSWORD}": "Mot de passe",
|
||||
/// "{GEN [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string strings_fr {
|
||||
get {
|
||||
|
@ -1602,7 +1616,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 {
|
||||
|
|
|
@ -34631,4 +34631,7 @@
|
|||
<data name="PebcakDevelFS" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\PebcakDevelFS.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||
</data>
|
||||
<data name="BlueBlueVerticalGradient" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\BlueBlueVerticalGradient.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
ShiftOS.WinForms/Resources/BlueBlueVerticalGradient.png
Normal file
BIN
ShiftOS.WinForms/Resources/BlueBlueVerticalGradient.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 154 B |
|
@ -71,6 +71,12 @@
|
|||
<Compile Include="Applications\About.Designer.cs">
|
||||
<DependentUpon>About.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Applications\ButtonMaster.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Applications\ButtonMaster.Designer.cs">
|
||||
<DependentUpon>ButtonMaster.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Applications\Clock.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
@ -483,6 +489,9 @@
|
|||
<EmbeddedResource Include="Applications\About.resx">
|
||||
<DependentUpon>About.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Applications\ButtonMaster.resx">
|
||||
<DependentUpon>ButtonMaster.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Applications\Clock.resx">
|
||||
<DependentUpon>Clock.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -876,6 +885,7 @@
|
|||
<None Include="Resources\austmicrotrends.png" />
|
||||
<None Include="Resources\brute.mp3" />
|
||||
<None Include="Resources\AppscapeServerFS.txt" />
|
||||
<None Include="Resources\BlueBlueVerticalGradient.png" />
|
||||
<Content Include="Resources\fileiconcf.bmp" />
|
||||
<None Include="Resources\infobox.wav" />
|
||||
<None Include="Resources\typesound.wav" />
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace ShiftOS.Engine
|
|||
/// <summary>
|
||||
/// Boolean representing whether the save system is ready to be used.
|
||||
/// </summary>
|
||||
public static bool Ready = false;
|
||||
public static AutoResetEvent Ready = new AutoResetEvent(false);
|
||||
public static bool IsSandbox = false;
|
||||
|
||||
/// <summary>
|
||||
|
@ -154,25 +154,17 @@ namespace ShiftOS.Engine
|
|||
{
|
||||
Console.WriteLine("{MISC_CONNECTINGTONETWORK}");
|
||||
|
||||
Ready = false;
|
||||
Ready.Reset();
|
||||
|
||||
if (PreDigitalSocietyConnection != null)
|
||||
{
|
||||
PreDigitalSocietyConnection?.Invoke();
|
||||
|
||||
while (!Ready)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
Ready.WaitOne();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool guidReceived = false;
|
||||
ServerManager.GUIDReceived += (str) =>
|
||||
{
|
||||
//Connection successful! Stop waiting!
|
||||
guidReceived = true;
|
||||
Console.WriteLine("{MISC_CONNECTIONSUCCESSFUL}");
|
||||
Thread.Sleep(100);
|
||||
Console.WriteLine("{LOADINGMSG2_" + loadingJoke2 + "}");
|
||||
|
@ -184,37 +176,25 @@ namespace ShiftOS.Engine
|
|||
if (ServerManager.ServerOnline)
|
||||
{
|
||||
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);
|
||||
}
|
||||
// This halts the client until the connection is successful.
|
||||
ServerManager.guidReceiveARE.WaitOne();
|
||||
Console.WriteLine("{MISC_DHCPHANDSHAKEFINISHED}");
|
||||
FinishBootstrap();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("{MISC_NONETWORK}");
|
||||
Console.WriteLine("{LOADINGMSG2_" + loadingJoke2 + "}");
|
||||
FinishBootstrap();
|
||||
}
|
||||
FinishBootstrap();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//No errors, this never gets called.
|
||||
// "No errors, this never gets called."
|
||||
Console.WriteLine("[inetd] SEVERE: " + ex.Message);
|
||||
string dest = "Startup Exception " + DateTime.Now.ToString() + ".txt";
|
||||
System.IO.File.WriteAllText(dest, ex.ToString());
|
||||
Console.WriteLine("[inetd] Full exception details have been saved to: " + dest);
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -571,8 +551,6 @@ namespace ShiftOS.Engine
|
|||
/// <param name="amount">The amount of Codepoints to deduct.</param>
|
||||
public static void TransferCodepointsToVoid(ulong amount)
|
||||
{
|
||||
if (amount < 0)
|
||||
throw new ArgumentOutOfRangeException("We see what you did there. Trying to pull Codepoints from the void? That won't work.");
|
||||
CurrentSave.Codepoints -= amount;
|
||||
NotificationDaemon.AddNotification(NotificationType.CodepointsSent, amount);
|
||||
}
|
||||
|
@ -591,36 +569,35 @@ namespace ShiftOS.Engine
|
|||
/// </summary>
|
||||
public static void ReadSave()
|
||||
{
|
||||
string path;
|
||||
|
||||
path = "C:\\ShiftOS2\\";
|
||||
//Migrate old saves.
|
||||
if (System.IO.Directory.Exists("C:\\ShiftOS2"))
|
||||
if (System.IO.Directory.Exists(path) && !System.IO.File.Exists(path + "havemigrated"))
|
||||
{
|
||||
Console.WriteLine("Old save detected. Migrating filesystem to MFS...");
|
||||
foreach (string file in System.IO.Directory.EnumerateDirectories("C:\\ShiftOS2")
|
||||
.Select(d => new DirectoryInfo(d).FullName))
|
||||
foreach (string file in System.IO.Directory.EnumerateFileSystemEntries(path))
|
||||
{
|
||||
if (!Utils.DirectoryExists(file.Replace("C:\\ShiftOS2\\", "0:/").Replace("\\", "/")))
|
||||
Utils.CreateDirectory(file.Replace("C:\\ShiftOS2\\", "0:/").Replace("\\", "/"));
|
||||
string dest = file.Replace(path, "0:/").Replace("\\", "/");
|
||||
if (System.IO.File.GetAttributes(file).HasFlag(FileAttributes.Directory))
|
||||
if (!Utils.DirectoryExists(dest))
|
||||
Utils.CreateDirectory(dest);
|
||||
else
|
||||
{
|
||||
string rfile = Path.GetFileName(file);
|
||||
Utils.WriteAllBytes(dest, System.IO.File.ReadAllBytes(file));
|
||||
Console.WriteLine("Exported file " + file);
|
||||
}
|
||||
}
|
||||
foreach (string file in System.IO.Directory.EnumerateFiles("C:\\ShiftOS2"))
|
||||
{
|
||||
|
||||
string rfile = Path.GetFileName(file);
|
||||
Utils.WriteAllBytes(file.Replace("C:\\ShiftOS2\\", "0:/").Replace("\\", "/"), System.IO.File.ReadAllBytes(file));
|
||||
Console.WriteLine("Exported file " + file);
|
||||
}
|
||||
|
||||
System.IO.File.WriteAllText(path + "havemigrated", "1.0 BETA");
|
||||
}
|
||||
|
||||
string path = Path.Combine(Paths.SaveDirectory, "autosave.save");
|
||||
path = Path.Combine(Paths.SaveDirectory, "autosave.save");
|
||||
|
||||
if (System.IO.File.Exists(Path.Combine(Paths.SaveDirectory, "autosave.save")))
|
||||
{
|
||||
if (System.IO.File.Exists(path))
|
||||
CurrentSave = JsonConvert.DeserializeObject<Save>(System.IO.File.ReadAllText(path));
|
||||
}
|
||||
else
|
||||
{
|
||||
NewSave();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -667,11 +644,8 @@ namespace ShiftOS.Engine
|
|||
})
|
||||
{ IsBackground = false }.Start();
|
||||
if (!System.IO.Directory.Exists(Paths.SaveDirectory))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(Paths.SaveDirectory);
|
||||
|
||||
}
|
||||
|
||||
System.IO.File.WriteAllText(Path.Combine(Paths.SaveDirectory, "autosave.save"), serialisedSaveFile);
|
||||
}
|
||||
if (!Shiftorium.Silent)
|
||||
|
@ -688,8 +662,6 @@ namespace ShiftOS.Engine
|
|||
/// <param name="amount">The amount of Codepoints.</param>
|
||||
public static void TransferCodepointsFrom(string who, ulong amount)
|
||||
{
|
||||
if (amount < 0)
|
||||
throw new ArgumentOutOfRangeException("We see what you did there... You can't just give a fake character Codepoints like that. It's better if you transfer them to the void.");
|
||||
NotificationDaemon.AddNotification(NotificationType.CodepointsReceived, amount);
|
||||
CurrentSave.Codepoints += amount;
|
||||
}
|
||||
|
|
|
@ -89,6 +89,8 @@ Ping: {ServerManager.DigitalSocietyPing} ms
|
|||
/// </summary>
|
||||
public static Guid thisGuid { get; private set; }
|
||||
|
||||
public static AutoResetEvent guidReceiveARE = new AutoResetEvent(false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the underlying NetSockets client for this connection.
|
||||
/// </summary>
|
||||
|
@ -241,6 +243,7 @@ Ping: {ServerManager.DigitalSocietyPing} ms
|
|||
{
|
||||
thisGuid = new Guid(msg.Contents);
|
||||
GUIDReceived?.Invoke(msg.Contents);
|
||||
guidReceiveARE.Set();
|
||||
TerminalBackend.PrefixEnabled = true;
|
||||
TerminalBackend.PrintPrompt();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue