From e85832a5a4caefe854f3f27b7e60663e2bf26624 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 28 May 2017 16:05:51 -0400 Subject: fix double login issue and oobe bugs --- ShiftOS_TheReturn/SaveSystem.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 55f5cd5..c8996d4 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -21,6 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +// #define NOSAVE //#define ONLINEMODE @@ -213,15 +214,14 @@ namespace ShiftOS.Engine savehandshake = (msg) => { + ServerManager.MessageReceived -= savehandshake; if (msg.Name == "mud_savefile") { CurrentSave = JsonConvert.DeserializeObject(msg.Contents); - ServerManager.MessageReceived -= savehandshake; } else if (msg.Name == "mud_login_denied") { oobe.PromptForLogin(); - ServerManager.MessageReceived -= savehandshake; } }; ServerManager.MessageReceived += savehandshake; @@ -554,6 +554,7 @@ namespace ShiftOS.Engine /// public static void SaveGame() { +#if !NOSAVE if(!Shiftorium.Silent) Console.WriteLine(""); if(!Shiftorium.Silent) @@ -566,6 +567,7 @@ namespace ShiftOS.Engine if (!Shiftorium.Silent) Console.WriteLine(" ...{DONE}."); System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0)); +#endif } /// -- cgit v1.2.3 From ff47625d2547deed441a853569f9fe84197e23b6 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 29 May 2017 16:08:59 -0400 Subject: fix some clientside save softlocks --- ShiftOS.WinForms/Applications/Terminal.cs | 31 +++++++++++++++++-------------- ShiftOS.WinForms/Oobe.cs | 3 ++- ShiftOS_TheReturn/SaveSystem.cs | 15 ++++++++++++--- 3 files changed, 31 insertions(+), 18 deletions(-) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index 2d2b4c5..080e8bb 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -313,21 +313,24 @@ namespace ShiftOS.WinForms.Applications } else if (a.KeyCode == Keys.Left) { - var getstring = txt.Lines[txt.Lines.Length - 1]; - var stringlen = getstring.Length + 1; - var header = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; - var headerlen = header.Length + 1; - var selstart = txt.SelectionStart; - var remstrlen = txt.TextLength - stringlen; - var finalnum = selstart - remstrlen; - - if (finalnum != headerlen) + if (SaveSystem.CurrentSave != null) { - AppearanceManager.CurrentPosition--; - } - else - { - a.SuppressKeyPress = true; + var getstring = txt.Lines[txt.Lines.Length - 1]; + var stringlen = getstring.Length + 1; + var header = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; + var headerlen = header.Length + 1; + var selstart = txt.SelectionStart; + var remstrlen = txt.TextLength - stringlen; + var finalnum = selstart - remstrlen; + + if (finalnum != headerlen) + { + AppearanceManager.CurrentPosition--; + } + else + { + a.SuppressKeyPress = true; + } } } else if (a.KeyCode == Keys.Up) diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs index 9182b4b..96c2bf5 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -207,14 +207,15 @@ namespace ShiftOS.WinForms ServerMessageReceived smr = null; smr = (msg) => { - ServerManager.MessageReceived -= smr; if (msg.Name == "mud_savefile") { + ServerManager.MessageReceived -= smr; SaveSystem.CurrentSave = JsonConvert.DeserializeObject(msg.Contents); SaveSystem.SaveGame(); } else if(msg.Name=="mud_login_denied") { + ServerManager.MessageReceived -= smr; LinkSaveFile(token); } }; diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index c8996d4..d1b92fd 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -214,13 +214,22 @@ namespace ShiftOS.Engine savehandshake = (msg) => { - ServerManager.MessageReceived -= savehandshake; if (msg.Name == "mud_savefile") { - CurrentSave = JsonConvert.DeserializeObject(msg.Contents); - } + ServerManager.MessageReceived -= savehandshake; + try + { + CurrentSave = JsonConvert.DeserializeObject(msg.Contents); + } + catch + { + Console.WriteLine("[system] [SEVERE] Cannot parse configuration file."); + oobe.PromptForLogin(); + } + } else if (msg.Name == "mud_login_denied") { + ServerManager.MessageReceived -= savehandshake; oobe.PromptForLogin(); } }; -- cgit v1.2.3 From 37ac4c684ce3904c5ec614362ed99bb9867ca0f3 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 29 May 2017 20:08:30 -0400 Subject: It's amazing what talking to Rylan can do to an integer datatype. --- ShiftOS.Objects/EngineShiftnetSubscription.cs | 2 +- ShiftOS.Objects/Save.cs | 4 ++-- ShiftOS.Objects/Shop.cs | 2 +- ShiftOS.Objects/UniteClient.cs | 12 ++++++------ ShiftOS.WinForms/Applications/Pong.cs | 20 ++++++++++---------- ShiftOS.WinForms/Applications/ShiftLetters.cs | 2 +- ShiftOS.WinForms/Applications/ShiftLotto.cs | 4 ++-- ShiftOS.WinForms/Applications/ShiftSweeper.cs | 8 ++++---- ShiftOS.WinForms/Applications/Shifter.cs | 2 +- ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs | 4 ++-- ShiftOS.WinForms/Applications/ShopItemCreator.cs | 4 ++-- ShiftOS.WinForms/HackerCommands.cs | 2 +- ShiftOS.WinForms/JobTasks.cs | 4 ++-- ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs | 4 ++-- ShiftOS.WinForms/WinformsDesktop.cs | 2 +- ShiftOS_TheReturn/Commands.cs | 4 ++-- ShiftOS_TheReturn/SaveSystem.cs | 4 ++-- ShiftOS_TheReturn/Scripting.cs | 4 ++-- ShiftOS_TheReturn/ServerManager.cs | 2 +- ShiftOS_TheReturn/Shiftorium.cs | 10 +++++----- 20 files changed, 50 insertions(+), 50 deletions(-) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS.Objects/EngineShiftnetSubscription.cs b/ShiftOS.Objects/EngineShiftnetSubscription.cs index 1296a98..c319f18 100644 --- a/ShiftOS.Objects/EngineShiftnetSubscription.cs +++ b/ShiftOS.Objects/EngineShiftnetSubscription.cs @@ -10,7 +10,7 @@ namespace ShiftOS.Objects { public string Name { get; set; } public string Description { get; set; } - public int CostPerMonth { get; set; } + public uint CostPerMonth { get; set; } public int DownloadSpeed { get; set; } public string Company { get; set; } } diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index 8675a35..0fef7b3 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -41,9 +41,9 @@ namespace ShiftOS.Objects [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; } - private long _cp = 0; + private ulong _cp = 0; - public long Codepoints + public ulong Codepoints { get { diff --git a/ShiftOS.Objects/Shop.cs b/ShiftOS.Objects/Shop.cs index 65f5746..c603523 100644 --- a/ShiftOS.Objects/Shop.cs +++ b/ShiftOS.Objects/Shop.cs @@ -42,7 +42,7 @@ namespace ShiftOS.Objects { public string Name { get; set; } public string Description { get; set; } - public int Cost { get; set; } + public ulong Cost { get; set; } public int FileType { get; set; } public byte[] MUDFile { get; set; } } diff --git a/ShiftOS.Objects/UniteClient.cs b/ShiftOS.Objects/UniteClient.cs index d8e34b7..ccd721b 100644 --- a/ShiftOS.Objects/UniteClient.cs +++ b/ShiftOS.Objects/UniteClient.cs @@ -83,9 +83,9 @@ namespace ShiftOS.Unite /// Get the Pong codepoint highscore for the current user. /// /// The amount of Codepoints returned by the server - public int GetPongCP() + public ulong GetPongCP() { - return Convert.ToInt32(MakeCall("/API/GetPongCP")); + return Convert.ToUInt64(MakeCall("/API/GetPongCP")); } /// @@ -110,7 +110,7 @@ namespace ShiftOS.Unite /// Set the pong Codepoints record for the user /// /// The amount of Codepoints to set the record to - public void SetPongCP(int value) + public void SetPongCP(ulong value) { MakeCall("/API/SetPongCP/" + value.ToString()); } @@ -182,16 +182,16 @@ namespace ShiftOS.Unite /// Get the user's codepoints. /// /// The amount of codepoints stored on the server for this user. - public long GetCodepoints() + public ulong GetCodepoints() { - return Convert.ToInt64(MakeCall("/API/GetCodepoints")); + return Convert.ToUInt64(MakeCall("/API/GetCodepoints")); } /// /// Set the user's codepoints. /// /// The amount of codepoints to set the user's codepoints value to. - public void SetCodepoints(long value) + public void SetCodepoints(ulong value) { MakeCall("/API/SetCodepoints/" + value.ToString()); } diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index 84177b7..6d81c64 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -58,10 +58,10 @@ namespace ShiftOS.WinForms.Applications double incrementy = 0.2; int levelxspeed = 3; int levelyspeed = 3; - int beatairewardtotal; - int beataireward = 1; - int[] levelrewards = new int[50]; - int totalreward; + ulong beatairewardtotal; + ulong beataireward = 1; + ulong[] levelrewards = new ulong[50]; + ulong totalreward; int countdown = 3; bool aiShouldIsbeEnabled = true; @@ -297,11 +297,11 @@ namespace ShiftOS.WinForms.Applications lblmissedout.Text = Localization.Parse("{YOU_MISSED_OUT_ON}:") + Environment.NewLine + lblstatscodepoints.Text.Replace(Localization.Parse("{CODEPOINTS}: "), "") + Localization.Parse(" {CODEPOINTS}"); if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade_2")) { - totalreward = levelrewards[level - 1] + beatairewardtotal; + totalreward = (ulong)(levelrewards[level - 1] + beatairewardtotal); double onePercent = (totalreward / 100); lblbutyougained.Show(); lblbutyougained.Text = Localization.Parse("{BUT_YOU_GAINED}:") + Environment.NewLine + onePercent.ToString("") + (Localization.Parse(" {CODEPOINTS}")); - SaveSystem.TransferCodepointsFrom("pong", (totalreward / 100)); + SaveSystem.TransferCodepointsFrom("pong", (ulong)(totalreward / 100)); } else { @@ -715,10 +715,10 @@ namespace ShiftOS.WinForms.Applications { if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) { - beataireward = level * 10; + beataireward = (ulong)(level * 10); } else { - beataireward = level * 5; + beataireward = (ulong)(level * 5); } } else @@ -726,11 +726,11 @@ namespace ShiftOS.WinForms.Applications if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) { double br = levelrewards[level - 1] / 10; - beataireward = (int)Math.Round(br) * 10; + beataireward = (ulong)Math.Round(br) * 10; } else { double br = levelrewards[level - 1] / 10; - beataireward = (int)Math.Round(br) * 5; + beataireward = (ulong)Math.Round(br) * 5; } } diff --git a/ShiftOS.WinForms/Applications/ShiftLetters.cs b/ShiftOS.WinForms/Applications/ShiftLetters.cs index 42e19f8..0e9f74a 100644 --- a/ShiftOS.WinForms/Applications/ShiftLetters.cs +++ b/ShiftOS.WinForms/Applications/ShiftLetters.cs @@ -217,7 +217,7 @@ namespace ShiftOS.WinForms.Applications if (!lblword.Text.Contains("_")) { int oldlives = lives; - int cp = (word.Length * oldlives) * 2; //drunky michael made this 5x... + ulong cp = (ulong)(word.Length * oldlives) * 2; //drunky michael made this 5x... SaveSystem.TransferCodepointsFrom("shiftletters", cp); StartGame(); } diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.cs b/ShiftOS.WinForms/Applications/ShiftLotto.cs index 5ab8154..3f940c7 100644 --- a/ShiftOS.WinForms/Applications/ShiftLotto.cs +++ b/ShiftOS.WinForms/Applications/ShiftLotto.cs @@ -88,7 +88,7 @@ namespace ShiftOS.WinForms.Applications } else { - if (SaveSystem.CurrentSave.Codepoints - (codePoints * difficulty) <= 0) + if (SaveSystem.CurrentSave.Codepoints - (ulong)(codePoints * difficulty) <= 0) { Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to gamble this amount!"); } @@ -102,7 +102,7 @@ namespace ShiftOS.WinForms.Applications int winningNumber = rnd.Next(0, difficulty); // Multiply CodePoints * Difficulty - int jackpot = codePoints * difficulty; + ulong jackpot = (ulong)(codePoints * difficulty); // Test the random ints if (guessedNumber == winningNumber) diff --git a/ShiftOS.WinForms/Applications/ShiftSweeper.cs b/ShiftOS.WinForms/Applications/ShiftSweeper.cs index f23ed73..772ec26 100644 --- a/ShiftOS.WinForms/Applications/ShiftSweeper.cs +++ b/ShiftOS.WinForms/Applications/ShiftSweeper.cs @@ -300,12 +300,12 @@ namespace ShiftOS.WinForms.Applications { } public void winGame() { - int cp = 0; - int origminecount = gameBombCount * 10; + ulong cp = 0; + ulong origminecount = (ulong)(gameBombCount * 10); if (minetimer < 31) cp = (origminecount * 3); - else if (minetimer < 61) cp = (Int32)(origminecount * 2.5); + else if (minetimer < 61) cp = (ulong)(origminecount * 2.5); else if (minetimer < 91) cp = (origminecount * 2); - else if (minetimer < 121) cp = (Int32)(origminecount * 1.5); + else if (minetimer < 121) cp = (ulong)(origminecount * 1.5); else if (minetimer > 120) cp = (origminecount * 1); SaveSystem.TransferCodepointsFrom("shiftsweeper", cp); panelGameStatus.Image = Properties.Resources.SweeperWinFace; diff --git a/ShiftOS.WinForms/Applications/Shifter.cs b/ShiftOS.WinForms/Applications/Shifter.cs index 1a59c80..3b3a4f1 100644 --- a/ShiftOS.WinForms/Applications/Shifter.cs +++ b/ShiftOS.WinForms/Applications/Shifter.cs @@ -391,7 +391,7 @@ namespace ShiftOS.WinForms.Applications } - public int CodepointValue = 0; + public uint CodepointValue = 0; public List settings = new List(); public Skin LoadedSkin = null; diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index 08e6c8f..d6b014d 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -213,9 +213,9 @@ namespace ShiftOS.WinForms.Applications private void btnbuy_Click(object sender, EventArgs e) { - long cpCost = 0; + ulong cpCost = 0; backend.Silent = true; - Dictionary UpgradesToBuy = new Dictionary(); + Dictionary UpgradesToBuy = new Dictionary(); foreach (var itm in lbupgrades.SelectedItems) { cpCost += upgrades[itm.ToString()].Cost; diff --git a/ShiftOS.WinForms/Applications/ShopItemCreator.cs b/ShiftOS.WinForms/Applications/ShopItemCreator.cs index 61e7491..d2836ee 100644 --- a/ShiftOS.WinForms/Applications/ShopItemCreator.cs +++ b/ShiftOS.WinForms/Applications/ShopItemCreator.cs @@ -73,7 +73,7 @@ namespace ShiftOS.WinForms.Applications Infobox.Show("No file chosen.", "Please select a file to sell."); return; } - Item.Cost = Convert.ToInt32(txtcost.Text); + Item.Cost = Convert.ToUInt64(txtcost.Text); Item.Description = txtdescription.Text; Item.Name = txtitemname.Text; Callback?.Invoke(Item); @@ -101,7 +101,7 @@ namespace ShiftOS.WinForms.Applications { try { - Item.Cost = Convert.ToInt32(txtcost.Text); + Item.Cost = Convert.ToUInt64(txtcost.Text); } catch { diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index 47b486d..f467eb2 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -504,7 +504,7 @@ namespace ShiftOS.WinForms string usr = args["user"].ToString(); string sys = args["sys"].ToString(); string pass = args["pass"].ToString(); - long amount = (long)args["amount"]; + ulong amount = (ulong)args["amount"]; if(amount < 0) { Console.WriteLine("--invalid codepoint amount - halting..."); diff --git a/ShiftOS.WinForms/JobTasks.cs b/ShiftOS.WinForms/JobTasks.cs index 622e287..d862961 100644 --- a/ShiftOS.WinForms/JobTasks.cs +++ b/ShiftOS.WinForms/JobTasks.cs @@ -35,12 +35,12 @@ namespace ShiftOS.WinForms { public class AcquireCodepointsJobTask : JobTask { - public AcquireCodepointsJobTask(int amount) + public AcquireCodepointsJobTask(uint amount) { CodepointsRequired = SaveSystem.CurrentSave.Codepoints + amount; } - public long CodepointsRequired { get; private set; } + public ulong CodepointsRequired { get; private set; } public override bool IsComplete { diff --git a/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs index fa575f4..c7830d0 100644 --- a/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs +++ b/ShiftOS.WinForms/ShiftnetSites/AppscapeMain.cs @@ -372,7 +372,7 @@ namespace ShiftOS.WinForms /// public class AppscapeEntryAttribute : RequiresUpgradeAttribute { - public AppscapeEntryAttribute(string name, string description, int downloadSize, long cost, string dependencies = "", string category = "Misc") : base(name.ToLower().Replace(' ', '_')) + public AppscapeEntryAttribute(string name, string description, int downloadSize, ulong cost, string dependencies = "", string category = "Misc") : base(name.ToLower().Replace(' ', '_')) { Name = name; Description = description; @@ -385,7 +385,7 @@ namespace ShiftOS.WinForms public string Name { get; private set; } public string Description { get; private set; } public string Category { get; private set; } - public long Cost { get; private set; } + public ulong Cost { get; private set; } public string DependencyString { get; private set; } public int DownloadSize { get; private set; } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 85eab55..95e7c1a 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -192,7 +192,7 @@ namespace ShiftOS.WinForms SetupDesktop(); }; - long lastcp = 0; + ulong lastcp = 0; var storythread = new Thread(() => { diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index b97cd1d..ec89539 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -311,7 +311,7 @@ namespace ShiftOS.Engine if (args.ContainsKey("amount")) try { - long codepointsToAdd = Convert.ToInt64(args["amount"].ToString()); + ulong codepointsToAdd = Convert.ToUInt64(args["amount"].ToString()); SaveSystem.CurrentSave.Codepoints += codepointsToAdd; return true; } @@ -639,7 +639,7 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}"); cat = args["cat"].ToString(); } - Dictionary upgrades = new Dictionary(); + Dictionary upgrades = new Dictionary(); int maxLength = 5; IEnumerable upglist = Shiftorium.GetAvailable(); diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index d1b92fd..395db85 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -480,7 +480,7 @@ namespace ShiftOS.Engine /// Deducts a set amount of Codepoints from the save file... and sends them to a place where they'll never be seen again. /// /// The amount of Codepoints to deduct. - public static void TransferCodepointsToVoid(long amount) + 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."); @@ -584,7 +584,7 @@ namespace ShiftOS.Engine /// /// The character name /// The amount of Codepoints. - public static void TransferCodepointsFrom(string who, long amount) + 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."); diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index 61c6676..5021f50 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -444,7 +444,7 @@ end"); /// Retrieves the user's Codepoints from the save file. /// /// The user's Codepoints. - public long getCodepoints() { return SaveSystem.CurrentSave.Codepoints; } + public ulong getCodepoints() { return SaveSystem.CurrentSave.Codepoints; } /// /// Run a command in the Terminal. @@ -462,7 +462,7 @@ end"); /// Adds the specified amount of Codepoints to the save flie. /// /// The codepoints to add. - public void addCodepoints(int cp) + public void addCodepoints(uint cp) { if (cp > 100 || cp <= 0) { diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index abb674d..1439c0d 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -246,7 +246,7 @@ Ping: {ServerManager.DigitalSocietyPing} ms var args = JsonConvert.DeserializeObject>(msg.Contents); if(args["username"] as string == SaveSystem.CurrentUser.Username) { - SaveSystem.CurrentSave.Codepoints += (long)args["amount"]; + SaveSystem.CurrentSave.Codepoints += (ulong)args["amount"]; Desktop.InvokeOnWorkerThread(new Action(() => { Infobox.Show($"MUD Control Centre", $"Someone bought an item in your shop, and they have paid {args["amount"]}, and as such, you have been granted these Codepoints."); diff --git a/ShiftOS_TheReturn/Shiftorium.cs b/ShiftOS_TheReturn/Shiftorium.cs index bd7105f..975939f 100644 --- a/ShiftOS_TheReturn/Shiftorium.cs +++ b/ShiftOS_TheReturn/Shiftorium.cs @@ -112,7 +112,7 @@ namespace ShiftOS.Engine /// The upgrade ID to buy /// The amount of Codepoints to deduct /// True if the upgrade was installed successfully, false if the user didn't have enough Codepoints or the upgrade wasn' found. - public static bool Buy(string id, long cost) + public static bool Buy(string id, ulong cost) { if (SaveSystem.CurrentSave.Codepoints >= cost) { @@ -365,7 +365,7 @@ namespace ShiftOS.Engine /// /// The upgrade ID to search /// The codepoint value. - public static long GetCPValue(string id) + public static ulong GetCPValue(string id) { foreach (var upg in GetDefaults()) { @@ -520,7 +520,7 @@ namespace ShiftOS.Engine { public string Name { get; set; } public string Description { get; set; } - public long Cost { get; set; } + public ulong Cost { get; set; } public string ID { get { return (this.Id != null ? this.Id : (Name.ToLower().Replace(" ", "_"))); } } public string Id { get; set; } public string Category { get; set; } @@ -536,7 +536,7 @@ namespace ShiftOS.Engine public class ShiftoriumUpgradeAttribute : RequiresUpgradeAttribute { - public ShiftoriumUpgradeAttribute(string name, long cost, string desc, string dependencies, string category) : base(name.ToLower().Replace(" ", "_")) + public ShiftoriumUpgradeAttribute(string name, ulong cost, string desc, string dependencies, string category) : base(name.ToLower().Replace(" ", "_")) { Name = name; Description = desc; @@ -547,7 +547,7 @@ namespace ShiftOS.Engine public string Name { get; private set; } public string Description { get; private set; } - public long Cost { get; private set; } + public ulong Cost { get; private set; } public string Dependencies { get; private set; } public string Category { get; private set; } } -- cgit v1.2.3 From 7fe5d790dc9d73056e86af8116ba4db9674fd612 Mon Sep 17 00:00:00 2001 From: RogueAI42 Date: Sun, 4 Jun 2017 01:29:21 +1000 Subject: fixed shiftorium just in time for chrimbus --- ShiftOS.Objects/Save.cs | 75 +++++++-- .../Applications/ShiftoriumFrontend.Designer.cs | 3 - .../Applications/ShiftoriumFrontend.cs | 186 ++++++++------------- ShiftOS_TheReturn/SaveSystem.cs | 11 +- 4 files changed, 136 insertions(+), 139 deletions(-) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index cbd77e2..e0282e8 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -26,8 +26,7 @@ using System; using System.Collections.Generic; using System.Dynamic; using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Threading; namespace ShiftOS.Objects { @@ -41,33 +40,77 @@ namespace ShiftOS.Objects [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; } - private ulong _cp = 0; + private List _setCpCallbacks = new List(); // everything in this list is called by Codepoints.set() and syncCp(). + private ulong _cp = 0; // locally cached codepoints counter + private Object _cpLock = new Object(); // locked when modifying or reading the codepoints counter + private Object _webLock = new Object(); // locked when communicating with the server + private Timer _updTimer; // timer to start a new sync thread every 5 minutes + + // Sync local Codepoints count with the server. + public void syncCp() + { + new Thread(() => + { + lock (_cpLock) + { + lock (_webLock) + { + var uc = new ShiftOS.Unite.UniteClient("", UniteAuthToken); + _cp = uc.GetCodepoints(); + } + } + foreach (Action a in _setCpCallbacks) + a(); + }).Start(); + } + + // we have to write these wrapper functions so we can keep _setCpCallbacks private, + // so that it doesn't get serialised + public void addSetCpCallback(Action callback) + { + _setCpCallbacks.Add(callback); + } + + public void removeSetCpCallback(Action callback) + { + _setCpCallbacks.Remove(callback); + } public ulong Codepoints { get { - try - { - var uc = new ShiftOS.Unite.UniteClient("", UniteAuthToken); - return uc.GetCodepoints(); - } - catch + if (_updTimer == null) + _updTimer = new Timer((o) => syncCp(), null, 0, 300000); + lock (_cpLock) { return _cp; } } set { - try + lock (_cpLock) + { + _cp = value; + new Thread(() => { - var uc = new ShiftOS.Unite.UniteClient("", UniteAuthToken); - uc.SetCodepoints(value); - } - catch + lock (_webLock) + { + try + { + var uc = new ShiftOS.Unite.UniteClient("", UniteAuthToken); + uc.SetCodepoints(value); + } + catch + { } + } + }) { - _cp = value; - } + IsBackground = false + }.Start(); + } + foreach (Action a in _setCpCallbacks) + a(); } } diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs index dc107c4..e4e493e 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs @@ -189,7 +189,6 @@ namespace ShiftOS.WinForms.Applications 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 // @@ -226,7 +225,6 @@ namespace ShiftOS.WinForms.Applications this.lbcodepoints.Size = new System.Drawing.Size(135, 13); this.lbcodepoints.TabIndex = 3; this.lbcodepoints.Text = "You have: %cp Codepoints"; - this.lbcodepoints.Click += new System.EventHandler(this.lbcodepoints_Click); // // label1 // @@ -280,7 +278,6 @@ namespace ShiftOS.WinForms.Applications this.ForeColor = System.Drawing.Color.LightGreen; this.Name = "ShiftoriumFrontend"; this.Size = new System.Drawing.Size(782, 427); - this.Load += new System.EventHandler(this.Shiftorium_Load); this.panel1.ResumeLayout(false); this.panel2.ResumeLayout(false); this.pnlupgradeactions.ResumeLayout(false); diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index d6b014d..0ae0803 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -47,19 +47,22 @@ namespace ShiftOS.WinForms.Applications public partial class ShiftoriumFrontend : UserControl, IShiftOSWindow { public int CategoryId = 0; - public static System.Timers.Timer timer100; + private string[] cats = backend.GetCategories(); + private ShiftoriumUpgrade[] avail; + public void updatecounter() + { + Desktop.InvokeOnWorkerThread(() => { lbcodepoints.Text = $"You have {SaveSystem.CurrentSave.Codepoints} Codepoints."; }); + } + public ShiftoriumFrontend() { - cp_update = new System.Windows.Forms.Timer(); - cp_update.Tick += (o, a) => - { - lbcodepoints.Text = $"You have {SaveSystem.CurrentSave.Codepoints} Codepoints."; - }; - cp_update.Interval = 100; InitializeComponent(); - PopulateShiftorium(); + SaveSystem.CurrentSave.addSetCpCallback(updatecounter); + updatecounter(); + Populate(); + SetList(); lbupgrades.SelectedIndexChanged += (o, a) => { try @@ -82,84 +85,57 @@ namespace ShiftOS.WinForms.Applications public void SelectUpgrade(string name) { btnbuy.Show(); - var upg = upgrades[name]; + var upg = upgrades[CategoryId][name]; lbupgradetitle.Text = Localization.Parse(upg.Name); lbupgradedesc.Text = Localization.Parse(upg.Description); } - Dictionary upgrades = new Dictionary(); - - public void PopulateShiftorium() + Dictionary[] upgrades; + + private void Populate() { - var t = new Thread(() => + upgrades = new Dictionary[cats.Length]; + int numComplete = 0; + avail = backend.GetAvailable(); + foreach (var it in cats.Select((catName, catId) => new { catName, catId })) { - try + var upl = new Dictionary(); + upgrades[it.catId] = upl; + var t = new Thread((tupobj) => { - 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(() => - { - try - { - lblcategorytext.Text = Shiftorium.GetCategories()[CategoryId]; - btncat_back.Visible = (CategoryId > 0); - btncat_forward.Visible = (CategoryId < backend.GetCategories().Length - 1); - } - catch - { + foreach (var upg in avail.Where(x => x.Category == it.catName)) + upl.Add(Localization.Parse(upg.Name) + " - " + upg.Cost.ToString() + "CP", upg); + numComplete++; + }); + t.Start(); + } + while (numComplete < cats.Length) { } // wait for all threads to finish their job + } - } - }); - } - catch - { - Desktop.InvokeOnWorkerThread(() => - { - lbnoupgrades.Show(); - lbnoupgrades.Location = new Point( - (lbupgrades.Width - lbnoupgrades.Width) / 2, - lbupgrades.Top + (lbupgrades.Height - lbnoupgrades.Height) / 2 - ); - }); - } - }); - t.IsBackground = true; - t.Start(); + private void SetList() + { + lbnoupgrades.Hide(); + lbupgrades.Items.Clear(); + try + { + lbupgrades.Items.AddRange(upgrades[CategoryId].Keys.ToArray()); + } + catch + { + Engine.Infobox.Show("Shiftorium Machine Broke", "Category ID " + CategoryId.ToString() + " is invalid, modulo is broken, and the world is doomed. Please tell Declan about this."); + return; + } + if (lbupgrades.Items.Count == 0) + { + lbnoupgrades.Show(); + lbnoupgrades.Location = new Point( + (lbupgrades.Width - lbnoupgrades.Width) / 2, + lbupgrades.Top + (lbupgrades.Height - lbnoupgrades.Height) / 2 + ); + } + else + lbnoupgrades.Hide(); + lblcategorytext.Text = cats[CategoryId]; } public static bool UpgradeInstalled(string upg) @@ -218,8 +194,9 @@ namespace ShiftOS.WinForms.Applications Dictionary UpgradesToBuy = new Dictionary(); foreach (var itm in lbupgrades.SelectedItems) { - cpCost += upgrades[itm.ToString()].Cost; - UpgradesToBuy.Add(upgrades[itm.ToString()].ID, upgrades[itm.ToString()].Cost); + var upg = upgrades[CategoryId][itm.ToString()]; + cpCost += upg.Cost; + UpgradesToBuy.Add(upg.ID, upg.Cost); } if (SaveSystem.CurrentSave.Codepoints < cpCost) { @@ -230,7 +207,6 @@ namespace ShiftOS.WinForms.Applications { foreach(var upg in UpgradesToBuy) { - SaveSystem.CurrentSave.Codepoints -= upg.Value; if (SaveSystem.CurrentSave.Upgrades.ContainsKey(upg.Key)) { SaveSystem.CurrentSave.Upgrades[upg.Key] = true; @@ -242,20 +218,15 @@ namespace ShiftOS.WinForms.Applications SaveSystem.SaveGame(); backend.InvokeUpgradeInstalled(); } + SaveSystem.CurrentSave.Codepoints -= cpCost; } backend.Silent = false; - PopulateShiftorium(); btnbuy.Hide(); } - private void Shiftorium_Load(object sender, EventArgs e) { - - } - public void OnLoad() { - cp_update.Start(); lbnoupgrades.Hide(); } @@ -264,12 +235,9 @@ namespace ShiftOS.WinForms.Applications } - System.Windows.Forms.Timer cp_update = new System.Windows.Forms.Timer(); - public bool OnUnload() { - cp_update.Stop(); - cp_update = null; + SaveSystem.CurrentSave.removeSetCpCallback(updatecounter); return true; } @@ -277,44 +245,26 @@ namespace ShiftOS.WinForms.Applications { lbupgrades.SelectionMode = (UpgradeInstalled("shiftorium_gui_bulk_buy") == true) ? SelectionMode.MultiExtended : SelectionMode.One; lbcodepoints.Visible = Shiftorium.UpgradeInstalled("shiftorium_gui_codepoints_display"); + Populate(); + SetList(); } - private void lbcodepoints_Click(object sender, EventArgs e) + private void moveCat(short direction) // direction is -1 to move backwards or 1 to move forwards { - - } - - void Timer() - { - timer100 = new System.Timers.Timer(); - timer100.Interval = 2000; - //CLARIFICATION: What is this supposed to do? - Michael - //timer100.Elapsed += ???; - timer100.AutoReset = true; - timer100.Enabled = true; + CategoryId += direction; + CategoryId %= cats.Length; + if (CategoryId < 0) CategoryId += cats.Length; // fix modulo on negatives + SetList(); } private void btncat_back_Click(object sender, EventArgs e) { - if(CategoryId > 0) - { - CategoryId--; - PopulateShiftorium(); - } + moveCat(-1); } private void btncat_forward_Click(object sender, EventArgs e) { - if(CategoryId < backend.GetCategories().Length - 1) - { - CategoryId++; - PopulateShiftorium(); - } - } - - private void lblcategorytext_Click(object sender, EventArgs e) - { - + moveCat(1); } } } diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 395db85..155f002 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -570,8 +570,15 @@ namespace ShiftOS.Engine Console.Write("{SE_SAVING}... "); if (SaveSystem.CurrentSave != null) { - Utils.WriteAllText(Paths.GetPath("user.dat"), CurrentSave.UniteAuthToken); - ServerManager.SendMessage("mud_save", JsonConvert.SerializeObject(CurrentSave, Formatting.Indented)); + Utils.WriteAllText(Paths.GetPath("user.dat"), CurrentSave.UniteAuthToken); + var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); + new Thread(() => + { + // please don't do networking on the main thread if you're just going to + // discard the response, it's extremely slow + ServerManager.SendMessage("mud_save", serialisedSaveFile); + }) + { IsBackground = false }.Start(); } if (!Shiftorium.Silent) Console.WriteLine(" ...{DONE}."); -- cgit v1.2.3 From 69aba3b373f9c9c70ec4ef2250e71465d3327299 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 4 Jun 2017 15:18:53 -0400 Subject: A fuckton of storyline features. --- ShiftOS.Objects/Save.cs | 5 ++ ShiftOS.WinForms/Applications/Terminal.cs | 82 ++++++++++++++++- ShiftOS.WinForms/Commands.cs | 1 - ShiftOS.WinForms/Oobe.cs | 6 +- ShiftOS.WinForms/Stories/LegionStory.cs | 144 +++++++++++++++++++++--------- ShiftOS.WinForms/Tools/ControlManager.cs | 12 ++- ShiftOS_TheReturn/Commands.cs | 27 ++++-- ShiftOS_TheReturn/SaveSystem.cs | 10 +++ ShiftOS_TheReturn/Story.cs | 25 ++---- 9 files changed, 239 insertions(+), 73 deletions(-) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index e0282e8..7891a22 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -173,6 +173,11 @@ namespace ShiftOS.Objects } public List Users { get; set; } + + /// + /// DO NOT MODIFY THIS. EVER. YOU WILL BREAK THE STORYLINE. Let the engine do it's job. + /// + public string PickupPoint { get; set; } } public class SettingsObject : DynamicObject diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index a4b77ae..687b2b9 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -410,8 +410,6 @@ namespace ShiftOS.WinForms.Applications public static void FirstSteps() { TerminalBackend.PrefixEnabled = false; - new Thread(() => - { TerminalBackend.InStory = true; Console.WriteLine("Hey there, and welcome to ShiftOS."); Thread.Sleep(2000); @@ -521,8 +519,86 @@ namespace ShiftOS.WinForms.Applications TerminalBackend.InStory = false; SaveSystem.SaveGame(); Thread.Sleep(1000); + + Story.Context.AutoComplete = false; + + Console.WriteLine(@"Welcome to the ShiftOS Newbie's Guide. + +This tutorial will guide you through the more intermediate features of ShiftOS, +such as earning Codepoints, buying Shiftoorium Upgrades, and using the objectives system. + +Every now and then, you'll get a notification in your terminal of a ""NEW OBJECTIVE"". +This means that someone has instructed you to do something inside ShiftOS. At any moment +you may type ""sos.status"" in your Terminal to see your current objectives. + +This command is very useful as not only does it allow you to see your current objectives +but you can also see the amount of Codepoints you have as well as the upgrades you've +installed and how many upgrades are available. + +Now, onto your first objective! All you need to do is earn 200 Codepoints using any +program on your system."); + + Story.PushObjective("First Steps: Your First Codepoints", "Play a few rounds of Pong, or use another program to earn 200 Codepoints.", () => + { + return SaveSystem.CurrentSave.Codepoints >= 200; + }, () => + { + Desktop.InvokeOnWorkerThread(() => + { + AppearanceManager.SetupWindow(new Terminal()); + }); + Console.WriteLine("Good job! You've earned " + SaveSystem.CurrentSave.Codepoints + @" Codepoints! You can use these inside the +Shiftorium to buy new upgrades inside ShiftOS. + +These upgrades can give ShiftOS more features, fixes and programs, +which can make the operating system easier to use and navigate around +and also make it easier for you to earn more Codepoints and thus upgrade +te system further. + +Be cautious though! Only certain upgrades offer the ability to earn more +Codepoints. These upgrades are typically in the form of new programs. + +So, try to get as many new programs as possible for your computer, and save +the system feature upgrades for later unless you absolutely need them. + +The worst thing that could happen is you end up stuck with very little Codepoints +and only a few small programs to use to earn very little amounts of Codepoints. + +Now, let's get you your first Shiftorium upgrade!"); + + Story.PushObjective("First Steps: The Shiftorium", "Buy your first Shiftorium upgrade with your new Codepoints using shiftorium.list, shiftorium.info and shiftorium.buy.", + () => + { + return SaveSystem.CurrentSave.CountUpgrades() > 0; + }, () => + { + Console.WriteLine("This concludes the ShiftOS Newbie's Guide! Now, go, and shift it your way!"); + Console.WriteLine(@" +Your goal: Earn 1,000 Codepoints."); + Story.Context.MarkComplete(); + Story.Start("first_steps_transition"); + }); TerminalBackend.PrintPrompt(); - }).Start(); + }); + + TerminalBackend.PrintPrompt(); + } + + + [Story("first_steps_transition")] + public static void FirstStepsTransition() + { + Story.PushObjective("Earn 1000 Codepoints", "You now know the basics of ShiftOS. Let's get your system up and running with a few upgrades, and get a decent amount of Codepoints.", () => + { + return SaveSystem.CurrentSave.Codepoints >= 1000; + }, + () => + { + Story.Context.MarkComplete(); + Story.Start("victortran_shiftnet"); + }); + + Story.Context.AutoComplete = false; } public void OnSkinLoad() diff --git a/ShiftOS.WinForms/Commands.cs b/ShiftOS.WinForms/Commands.cs index 2d297f5..b04ffe7 100644 --- a/ShiftOS.WinForms/Commands.cs +++ b/ShiftOS.WinForms/Commands.cs @@ -80,7 +80,6 @@ namespace ShiftOS.WinForms } } - [Namespace("coherence")] [RequiresUpgrade("kernel_coherence")] public static class CoherenceCommands diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs index 96c2bf5..271e1fd 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -91,6 +91,7 @@ namespace ShiftOS.WinForms slashcount++; if (slashcount == 5) slashcount = 1; + Engine.AudioManager.PlayStream(Properties.Resources.writesound); Thread.Sleep(50); } rtext += Environment.NewLine; @@ -138,7 +139,10 @@ namespace ShiftOS.WinForms 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."); + TextType("I will not share my identity or my intentions at this moment."); + Thread.Sleep(2000); + Clear(); + TextType("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."); diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index a0fc9bf..8c79f0e 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -16,8 +16,8 @@ namespace ShiftOS.WinForms.Stories [Story("victortran_shiftnet")] public static void ShiftnetStoryFeaturingTheBlueSmileyFaceHolyFuckThisFunctionNameIsLong() { - CharacterName = "victor_tran"; - SysName = "theos"; + CharacterName = "aiden"; + SysName = "appscape_main"; bool waiting = false; var installer = new Applications.Installer(); installer.InstallCompleted += () => @@ -35,53 +35,107 @@ namespace ShiftOS.WinForms.Stories AppearanceManager.SetupWindow(term); } - var t = new Thread(() => + WriteLine("aiden@appscape_main - user connecting to your system.", false); + Thread.Sleep(2000); + WriteLine("Hello there! My name's Aiden Nirh."); + WriteLine("I run a small Shiftnet website known simply as \"Appscape\"."); + WriteLine("Oh - wait... you don't know what the Shiftnet is..."); + WriteLine("Well, the Shiftnet is like... a private Internet, only accessible through ShiftOS."); + WriteLine("It has many sites and companies on it - banks, software centres, service providers, you name it."); + WriteLine("Appscape is one of them. I host many applications on Appscape, from games to utilities to productivity programs, and anything in between. If it exists as a ShiftOS program, it's either on the Shiftorium or Appscape."); + WriteLine("I'm going to assume you're interested... and I'll install the Shiftnet just in case."); + WriteLine("Beginning installation of Shiftnet..."); + //Set up an Installer. + waiting = true; + Desktop.InvokeOnWorkerThread(() => { - WriteLine("victortran@theos - user connecting to your system.", false); - Thread.Sleep(2000); - WriteLine("Hey there - yes, I am not just a sentient being. I am indeed Victor Tran."); - WriteLine("I am the creator of a Linux desktop environment called theShell."); - WriteLine("I'm in the middle of working on a ShiftOS version of it."); - WriteLine("However, before I start, I feel I need to show you something."); - WriteLine("You have a lot of ShiftOS applications, and you can earn lots of Codepoints - and you already have lots."); - WriteLine("Well, you'd be a perfect candidate for me to install the Shiftnet Client on your system."); - WriteLine("I'll begin the installation right now."); - //Set up an Installer. - waiting = true; - Desktop.InvokeOnWorkerThread(() => - { - Story.Start("installer"); - while (!Shiftorium.UpgradeInstalled("installer")) - Thread.Sleep(20); - AppearanceManager.SetupWindow(installer); - installer.InitiateInstall(new ShiftnetInstallation()); - }); - while (waiting == true) - Thread.Sleep(25); + SaveSystem.CurrentSave.StoriesExperienced.Add("installer"); + SaveSystem.CurrentSave.StoriesExperienced.Add("downloader"); - WriteLine("All installed! Once I disconnect, type win.open to see a list of your new apps."); - WriteLine("The Shiftnet is a vast network of websites only accessible through ShiftOS."); - WriteLine("Think of it as the DarkNet, but much darker, and much more secretive."); - WriteLine("There are lots of apps, games, skins and utilities on the Shiftnet."); - WriteLine("There are also lots of companies offering many services."); - WriteLine("I'd stay on the shiftnet/ cluster though, others may be dangerous."); - WriteLine("I'd also stick to the sites listed on shiftnet/shiftsoft/ping - that site is regularly updated with the most safe Shiftnet sites."); - WriteLine("Oh, that reminds me. I have set you up with ShiftSoft's service provider, Freebie Solutions."); - WriteLine("It's a free provider, but it offers only 256 bytes per second download and upload speeds."); - WriteLine("You may want to go look for another provider when you can afford it."); - WriteLine("Trust me - with this provider, things get slow."); - WriteLine("Anyways, it was nice meeting you, hopefully someday you'll give theShell a try."); + while (!Shiftorium.UpgradeInstalled("installer")) + Thread.Sleep(20); + AppearanceManager.SetupWindow(installer); + installer.InitiateInstall(new ShiftnetInstallation()); + }); + while (waiting == true) + Thread.Sleep(25); - TerminalBackend.PrefixEnabled = true; + WriteLine("All good to go! Once I disconnect, type win.open to see a list of your new apps."); + WriteLine("I've installed everything you need, for free."); + WriteLine("You've got the Downloader, a simple application to help you track Shiftnet file downloads..."); + WriteLine("...the Installer which will help you unpack programs from .stp files and install them to your system..."); + WriteLine("...and lastly, the Shiftnet browser itself. This program lets you browse the Shiftnet, much like you would the real Internet."); + WriteLine("I'd stay on the shiftnet/ cluster though, because although there are many services on the Shiftnet, some of them may try to scam you into losing loads of Codepoints, or worse, wrecking your system with viruses."); + WriteLine("If you want a nice list of safe Shiftnet services, head to ShiftSoft's \"Ping\" site, at shiftnet/shiftsoft/ping."); + WriteLine("Oh, also, the Shiftnet, much like the real internet, is not free."); + WriteLine("It requires a service provider. Service providers cost a fair amount of Codepoints, but if you want to get faster speeds and more reliable connections on the Shiftnet, finding a good service provider is a necessity."); + WriteLine("Right now, you are on ShiftSoft's free trial plan, Freebie Solutions, which gives you access to the Shiftnet however you are locked at 256 bytes per second file downloads and can't leave the shiftnet/ cluster."); + WriteLine("It's enough to get you started - you'll want to find a faster provider though.."); + 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"); }); - t.IsBackground = true; - t.Start(); - TerminalBackend.PrefixEnabled = false; + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); + Story.Context.AutoComplete = false; } + [Story("hacker101_breakingbonds_1")] + public static void BreakingTheBondsIntro() + { + CharacterName = "hacker101"; + SysName = "pebcak"; + + if (!terminalOpen()) + { + var term = new Applications.Terminal(); + AppearanceManager.SetupWindow(term); + } + + WriteLine("hacker101@pebcak - user connecting to your system.", false); + Thread.Sleep(2000); + WriteLine("Greetings, user."); + WriteLine("My name is hacker101. I have a few things to show you."); + 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.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 + - Buy ""Address Book"" from Appscape + - Buy ""SimpleSRC"" from Appscape", () => + { + bool flag1 = Shiftorium.UpgradeInstalled("address_book"); + bool flag2 = Shiftorium.UpgradeInstalled("triwrite"); + bool flag3 = Shiftorium.UpgradeInstalled("simplesrc"); + return flag1 && flag2 && flag3; + }, () => + { + Story.Context.MarkComplete(); + SaveSystem.SaveGame(); + Story.Start("hacker101_breakingbonds_2"); + }); + + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); + + Story.Context.AutoComplete = false; + + } + + private static void WriteLine(string text, bool showCharacterName=true) { Console.WriteLine(); @@ -90,15 +144,23 @@ namespace ShiftOS.WinForms.Stories ConsoleEx.Bold = true; ConsoleEx.ForegroundColor = ConsoleColor.DarkMagenta; Console.Write(CharacterName); + ConsoleEx.OnFlush?.Invoke(); Console.ForegroundColor = ConsoleColor.White; Console.Write("@"); + ConsoleEx.OnFlush?.Invoke(); ConsoleEx.ForegroundColor = ConsoleColor.Yellow; Console.Write(SysName + ": "); + ConsoleEx.OnFlush?.Invoke(); } ConsoleEx.ForegroundColor = ConsoleColor.Gray; ConsoleEx.Bold = false; - Console.WriteLine(text); + foreach(var c in text) + { + Console.Write(c); + ConsoleEx.OnFlush?.Invoke(); + Thread.Sleep(45); + } Thread.Sleep(1000); } diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs index 548a62a..7fbfd1b 100644 --- a/ShiftOS.WinForms/Tools/ControlManager.cs +++ b/ShiftOS.WinForms/Tools/ControlManager.cs @@ -137,10 +137,14 @@ namespace ShiftOS.WinForms.Tools /// The control to center (this is an extension method - you can call it on a control as though it was a method in that control) public static void CenterParent(this Control ctrl) { - ctrl.Location = new Point( - (ctrl.Parent.Width - ctrl.Width) / 2, - (ctrl.Parent.Height - ctrl.Height) / 2 - ); + try + { + ctrl.Location = new Point( + (ctrl.Parent.Width - ctrl.Width) / 2, + (ctrl.Parent.Height - ctrl.Height) / 2 + ); + } + catch { } } public static void SetupControl(Control ctrl) diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index 72bccb1..f37bcb3 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -538,15 +538,28 @@ Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed, "; Console.WriteLine(status); - - if(Story.CurrentObjective != null) + Console.WriteLine("Objectives:"); + try + { + if (Story.CurrentObjectives.Count > 0) + { + foreach (var obj in Story.CurrentObjectives) + { + Console.WriteLine(obj.Name); + Console.WriteLine("-------------------------------"); + Console.WriteLine(); + Console.WriteLine(obj.Description); + } + } + else + { + Console.WriteLine(" - No objectives are running. Check back later!"); + } + } + catch { - Console.WriteLine("CURRENT OBJECTIVE: " + Story.CurrentObjective.Name); - Console.WriteLine("-------------------------------"); - Console.WriteLine(); - Console.WriteLine(Story.CurrentObjective.Description); + Console.WriteLine(" - No objectives are running. Check back later!"); } - return true; } } diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 155f002..e98a51e 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -453,6 +453,16 @@ namespace ShiftOS.Engine Desktop.InvokeOnWorkerThread(new Action(() => Desktop.PopulateAppLauncher())); GameReady?.Invoke(); + + if (!string.IsNullOrWhiteSpace(CurrentSave.PickupPoint)) + { + try + { + Story.Start(CurrentSave.PickupPoint); + TerminalBackend.PrintPrompt(); + } + catch { } + } } /// diff --git a/ShiftOS_TheReturn/Story.cs b/ShiftOS_TheReturn/Story.cs index 848c757..4d1d5cc 100644 --- a/ShiftOS_TheReturn/Story.cs +++ b/ShiftOS_TheReturn/Story.cs @@ -93,33 +93,24 @@ namespace ShiftOS.Engine { public static StoryContext Context { get; private set; } public static event Action StoryComplete; - public static Objective CurrentObjective { get; private set; } + public static List CurrentObjectives { get; private set; } public static void PushObjective(string name, string desc, Func completeFunc, Action onComplete) { - if (CurrentObjective != null) - { - if (CurrentObjective.IsComplete == false) - { - throw new Exception("Cannot start objective - an objective is already running."); - } - else - { - CurrentObjective = null; - } - } - - CurrentObjective = new Objective(name, desc, completeFunc, onComplete); + if (CurrentObjectives == null) + CurrentObjectives = new List(); + var currentObjective = new Objective(name, desc, completeFunc, onComplete); + CurrentObjectives.Add(currentObjective); var t = new Thread(() => { - var obj = CurrentObjective; + var obj = currentObjective; while (!obj.IsComplete) { Thread.Sleep(5000); } + CurrentObjectives.Remove(obj); obj.Complete(); - CurrentObjective = null; }); t.IsBackground = true; t.Start(); @@ -163,9 +154,11 @@ namespace ShiftOS.Engine Method = mth, AutoComplete = true, }; + SaveSystem.CurrentSave.Password = Context.Id; Context.OnComplete += () => { StoryComplete?.Invoke(stid); + SaveSystem.CurrentSave.PickupPoint = null; }; mth.Invoke(null, null); if (Context.AutoComplete) -- cgit v1.2.3 From c40d071d58859e25b3781299b949b91caa0548fe Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 10 Jun 2017 10:17:10 -0400 Subject: main menu system + sandbox mode --- ShiftOS.Objects/Save.cs | 6 + ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs | 147 ++++++++++++++++ ShiftOS.WinForms/MainMenu/MainMenu.cs | 100 +++++++++++ ShiftOS.WinForms/MainMenu/MainMenu.resx | 120 +++++++++++++ ShiftOS.WinForms/Program.cs | 35 ++-- ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 + .../ShiftnetSites/ShiftSoft.Designer.cs | 188 ++++++++++++++++++++- ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs | 56 ++++++ ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx | 10 ++ ShiftOS.WinForms/Stories/LegionStory.cs | 42 ++--- ShiftOS.WinForms/WinformsDesktop.cs | 32 +++- ShiftOS_TheReturn/AppearanceManager.cs | 1 + ShiftOS_TheReturn/SaveSystem.cs | 152 ++++++++++++----- ShiftOS_TheReturn/ServerManager.cs | 18 +- ShiftOS_TheReturn/Shiftorium.cs | 3 + ShiftOS_TheReturn/Story.cs | 8 + 16 files changed, 825 insertions(+), 102 deletions(-) create mode 100644 ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs create mode 100644 ShiftOS.WinForms/MainMenu/MainMenu.cs create mode 100644 ShiftOS.WinForms/MainMenu/MainMenu.resx (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index 7891a22..6e7f167 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -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; diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs new file mode 100644 index 0000000..62db46d --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs @@ -0,0 +1,147 @@ +namespace ShiftOS.WinForms.MainMenu +{ + partial class MainMenu + { + /// + /// 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 Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.cs b/ShiftOS.WinForms/MainMenu/MainMenu.cs new file mode 100644 index 0000000..20cd4ec --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/MainMenu.cs @@ -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(); + } + } +} diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.resx b/ShiftOS.WinForms/MainMenu/MainMenu.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/MainMenu.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/Program.cs b/ShiftOS.WinForms/Program.cs index 8f65265..b07d97a 100644 --- a/ShiftOS.WinForms/Program.cs +++ b/ShiftOS.WinForms/Program.cs @@ -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 } } diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index e1afa84..d589ed4 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -356,6 +356,12 @@ + + Form + + + MainMenu.cs + Form @@ -603,6 +609,9 @@ GUILogin.cs + + MainMenu.cs + Oobe.cs diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs index a62b5a8..b3e408f 100644 --- a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs @@ -28,27 +28,198 @@ /// 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; } } diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs index 18968cd..0d84ecc 100644 --- a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs @@ -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."); + } + }); } } } diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx index 1af7de1..cd314f0 100644 --- a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx @@ -117,4 +117,14 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 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. + + + 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. + \ No newline at end of file diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 056fe85..c52732e 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -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); } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 4614842..f6c4383 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -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 /// E. 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 { } } } diff --git a/ShiftOS_TheReturn/AppearanceManager.cs b/ShiftOS_TheReturn/AppearanceManager.cs index 7cf06c9..e244b77 100644 --- a/ShiftOS_TheReturn/AppearanceManager.cs +++ b/ShiftOS_TheReturn/AppearanceManager.cs @@ -126,6 +126,7 @@ namespace ShiftOS.Engine } + // Provides a list of all open ShiftOS windows. public static List OpenForms = new List(); diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index e98a51e..e36fee6 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -67,6 +67,7 @@ namespace ShiftOS.Engine /// Boolean representing whether the save system is ready to be used. /// public static bool Ready = false; + public static bool IsSandbox = false; /// /// Occurs before the save system connects to the ShiftOS Digital Society. @@ -140,63 +141,126 @@ 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..."); + + Ready = false; - while (!Ready) + 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 - { + bool guidReceived = false; + ServerManager.GUIDReceived += (str) => + { + //Connection successful! Stop waiting! + guidReceived = true; + Console.WriteLine("[inetd] Connection successful."); + }; - ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort); - //This haults the client until the connection is successful. - while (ServerManager.thisGuid == new Guid()) + try { - Thread.Sleep(10); + + 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 + { + new ClientSave + { + Username = "user", + Password = "", + Permissions = 0 + } + }, + Class = 0, + ID = new Guid(), + Upgrades = new Dictionary(), + 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")); + })); - //Nothing happens past this point - but the client IS connected! It shouldn't be stuck in that while loop above. + Desktop.InvokeOnWorkerThread(new Action(() => Desktop.PopulateAppLauncher())); + GameReady?.Invoke(); + } })); thread.IsBackground = true; @@ -243,10 +307,6 @@ namespace ShiftOS.Engine Thread.Sleep(10); } - Localization.SetupTHETRUEDefaultLocals(); - - Shiftorium.Init(); - while (CurrentSave.StoryPosition < 1) { Thread.Sleep(10); diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index 1439c0d..be4f086 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -302,15 +302,17 @@ Ping: {ServerManager.DigitalSocietyPing} ms /// The message body 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; diff --git a/ShiftOS_TheReturn/Shiftorium.cs b/ShiftOS_TheReturn/Shiftorium.cs index 975939f..7faf336 100644 --- a/ShiftOS_TheReturn/Shiftorium.cs +++ b/ShiftOS_TheReturn/Shiftorium.cs @@ -429,6 +429,9 @@ namespace ShiftOS.Engine /// Whether the upgrade is installed. public static bool UpgradeInstalled(string id) { + if (SaveSystem.IsSandbox == true) + return true; + if (string.IsNullOrWhiteSpace(id)) return true; if (SaveSystem.CurrentSave != null) diff --git a/ShiftOS_TheReturn/Story.cs b/ShiftOS_TheReturn/Story.cs index f473f89..e44d2be 100644 --- a/ShiftOS_TheReturn/Story.cs +++ b/ShiftOS_TheReturn/Story.cs @@ -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(); } -- cgit v1.2.3 From 920e33a2fd329ccbdfeb38ddedd0b4d87e97ed86 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 10 Jun 2017 12:58:09 -0400 Subject: Fix Shiftorium init bug. --- ShiftOS.WinForms/Program.cs | 1 + ShiftOS_TheReturn/SaveSystem.cs | 41 +++++++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 18 deletions(-) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs index b07d97a..b5fb731 100644 --- a/ShiftOS.WinForms/Program.cs +++ b/ShiftOS.WinForms/Program.cs @@ -59,6 +59,7 @@ namespace ShiftOS.WinForms }; Localization.RegisterProvider(new WFLanguageProvider()); Infobox.Init(new Dialog()); + LoginManager.Init(new WinForms.GUILoginFrontend()); FileSkimmerBackend.Init(new WinformsFSFrontend()); var desk = new WinformsDesktop(); Desktop.Init(desk); diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index e36fee6..c5a6a51 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -307,6 +307,8 @@ namespace ShiftOS.Engine Thread.Sleep(10); } + Shiftorium.Init(); + while (CurrentSave.StoryPosition < 1) { Thread.Sleep(10); @@ -633,27 +635,30 @@ namespace ShiftOS.Engine /// public static void SaveGame() { -#if !NOSAVE - if(!Shiftorium.Silent) - Console.WriteLine(""); - if(!Shiftorium.Silent) - Console.Write("{SE_SAVING}... "); - if (SaveSystem.CurrentSave != null) + if (IsSandbox == false) { - Utils.WriteAllText(Paths.GetPath("user.dat"), CurrentSave.UniteAuthToken); - var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); - new Thread(() => +#if !NOSAVE + if (!Shiftorium.Silent) + Console.WriteLine(""); + if (!Shiftorium.Silent) + Console.Write("{SE_SAVING}... "); + if (SaveSystem.CurrentSave != null) { - // please don't do networking on the main thread if you're just going to - // discard the response, it's extremely slow - ServerManager.SendMessage("mud_save", serialisedSaveFile); - }) - { IsBackground = false }.Start(); - } - if (!Shiftorium.Silent) - Console.WriteLine(" ...{DONE}."); - System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0)); + Utils.WriteAllText(Paths.GetPath("user.dat"), CurrentSave.UniteAuthToken); + var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); + new Thread(() => + { + // please don't do networking on the main thread if you're just going to + // discard the response, it's extremely slow + ServerManager.SendMessage("mud_save", serialisedSaveFile); + }) + { IsBackground = false }.Start(); + } + if (!Shiftorium.Silent) + Console.WriteLine(" ...{DONE}."); + System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0)); #endif + } } /// -- cgit v1.2.3 From c3deaa23fffb7011efb2b5b0f7fc3e754d21f600 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 10 Jun 2017 22:02:10 -0400 Subject: Even more menu work. --- ShiftOS.Objects/Save.cs | 78 +-------- .../Applications/ShiftoriumFrontend.cs | 2 - ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs | 188 ++++++++++++++++++++- ShiftOS.WinForms/MainMenu/MainMenu.cs | 120 ++++++++++++- ShiftOS_TheReturn/AudioManager.cs | 4 + ShiftOS_TheReturn/Paths.cs | 9 + ShiftOS_TheReturn/SaveSystem.cs | 41 ++--- 7 files changed, 342 insertions(+), 100 deletions(-) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index 6e7f167..7323028 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -40,85 +40,9 @@ namespace ShiftOS.Objects [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; } - private List _setCpCallbacks = new List(); // everything in this list is called by Codepoints.set() and syncCp(). - private ulong _cp = 0; // locally cached codepoints counter - private Object _cpLock = new Object(); // locked when modifying or reading the codepoints counter - private Object _webLock = new Object(); // locked when communicating with the server - private Timer _updTimer; // timer to start a new sync thread every 5 minutes - - // Sync local Codepoints count with the server. - public void syncCp() - { - new Thread(() => - { - lock (_cpLock) - { - lock (_webLock) - { - var uc = new ShiftOS.Unite.UniteClient("", UniteAuthToken); - _cp = uc.GetCodepoints(); - } - } - foreach (Action a in _setCpCallbacks) - a(); - }).Start(); - } - - // we have to write these wrapper functions so we can keep _setCpCallbacks private, - // so that it doesn't get serialised - public void addSetCpCallback(Action callback) - { - _setCpCallbacks.Add(callback); - } - - public void removeSetCpCallback(Action callback) - { - _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) - { - return _cp; - } - } - set - { - if (IsSandbox == true) - return; - lock (_cpLock) - { - _cp = value; - new Thread(() => - { - lock (_webLock) - { - try - { - var uc = new ShiftOS.Unite.UniteClient("", UniteAuthToken); - uc.SetCodepoints(value); - } - catch - { } - } - }) - { - IsBackground = false - }.Start(); - } - foreach (Action a in _setCpCallbacks) - a(); - } - } + public ulong Codepoints { get; set; } public Dictionary Upgrades { get; set; } public int StoryPosition { get; set; } diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index 5dfb98e..eebd897 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -59,7 +59,6 @@ namespace ShiftOS.WinForms.Applications public ShiftoriumFrontend() { InitializeComponent(); - SaveSystem.CurrentSave.addSetCpCallback(updatecounter); updatecounter(); Populate(); SetList(); @@ -238,7 +237,6 @@ namespace ShiftOS.WinForms.Applications public bool OnUnload() { - SaveSystem.CurrentSave.removeSetCpCallback(updatecounter); return true; } diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs index 62db46d..a056866 100644 --- a/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs +++ b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs @@ -35,7 +35,24 @@ this.button4 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); this.lbticker = new System.Windows.Forms.Label(); + this.pnloptions = new System.Windows.Forms.Panel(); + this.txtubase = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.txtdsport = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.txtdsaddress = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.opt_btncancel = new System.Windows.Forms.Button(); + this.btnsave = new System.Windows.Forms.Button(); + this.flcampaign = new System.Windows.Forms.FlowLayoutPanel(); + this.btnnewgame = new System.Windows.Forms.Button(); + this.btncontinue = new System.Windows.Forms.Button(); + this.button10 = new System.Windows.Forms.Button(); this.flmenu.SuspendLayout(); + this.pnloptions.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + this.flcampaign.SuspendLayout(); this.SuspendLayout(); // // flmenu @@ -48,7 +65,7 @@ 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.Location = new System.Drawing.Point(49, 367); this.flmenu.Name = "flmenu"; this.flmenu.Size = new System.Drawing.Size(187, 145); this.flmenu.TabIndex = 0; @@ -84,6 +101,7 @@ this.button3.TabIndex = 2; this.button3.Text = "Settings"; this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); // // button4 // @@ -116,12 +134,161 @@ this.lbticker.Tag = "header3"; this.lbticker.Text = "This is a tickerbar."; // + // pnloptions + // + this.pnloptions.Controls.Add(this.txtubase); + this.pnloptions.Controls.Add(this.label3); + this.pnloptions.Controls.Add(this.txtdsport); + this.pnloptions.Controls.Add(this.label2); + this.pnloptions.Controls.Add(this.txtdsaddress); + this.pnloptions.Controls.Add(this.label1); + this.pnloptions.Controls.Add(this.flowLayoutPanel1); + this.pnloptions.Location = new System.Drawing.Point(49, 26); + this.pnloptions.Name = "pnloptions"; + this.pnloptions.Size = new System.Drawing.Size(432, 290); + this.pnloptions.TabIndex = 2; + // + // txtubase + // + this.txtubase.Location = new System.Drawing.Point(146, 133); + this.txtubase.Name = "txtubase"; + this.txtubase.Size = new System.Drawing.Size(225, 20); + this.txtubase.TabIndex = 6; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(22, 136); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(106, 13); + this.label3.TabIndex = 5; + this.label3.Text = "Unite API base URL:"; + // + // txtdsport + // + this.txtdsport.Location = new System.Drawing.Point(146, 85); + this.txtdsport.Name = "txtdsport"; + this.txtdsport.Size = new System.Drawing.Size(225, 20); + this.txtdsport.TabIndex = 4; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(22, 88); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(99, 13); + this.label2.TabIndex = 3; + this.label2.Text = "Digital Society Port:"; + // + // txtdsaddress + // + this.txtdsaddress.Location = new System.Drawing.Point(146, 54); + this.txtdsaddress.Name = "txtdsaddress"; + this.txtdsaddress.Size = new System.Drawing.Size(225, 20); + this.txtdsaddress.TabIndex = 2; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(22, 57); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(118, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Digital Society Address:"; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.AutoSize = true; + this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel1.Controls.Add(this.opt_btncancel); + this.flowLayoutPanel1.Controls.Add(this.btnsave); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 259); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(432, 31); + this.flowLayoutPanel1.TabIndex = 0; + // + // opt_btncancel + // + this.opt_btncancel.AutoSize = true; + this.opt_btncancel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.opt_btncancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.opt_btncancel.Location = new System.Drawing.Point(377, 3); + this.opt_btncancel.Name = "opt_btncancel"; + this.opt_btncancel.Size = new System.Drawing.Size(52, 25); + this.opt_btncancel.TabIndex = 0; + this.opt_btncancel.Text = "Cancel"; + this.opt_btncancel.UseVisualStyleBackColor = true; + this.opt_btncancel.Click += new System.EventHandler(this.opt_btncancel_Click); + // + // btnsave + // + this.btnsave.AutoSize = true; + this.btnsave.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnsave.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnsave.Location = new System.Drawing.Point(327, 3); + this.btnsave.Name = "btnsave"; + this.btnsave.Size = new System.Drawing.Size(44, 25); + this.btnsave.TabIndex = 1; + this.btnsave.Text = "Save"; + this.btnsave.UseVisualStyleBackColor = true; + this.btnsave.Click += new System.EventHandler(this.btnsave_Click); + // + // flcampaign + // + this.flcampaign.AutoSize = true; + this.flcampaign.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flcampaign.Controls.Add(this.btnnewgame); + this.flcampaign.Controls.Add(this.btncontinue); + this.flcampaign.Controls.Add(this.button10); + this.flcampaign.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flcampaign.Location = new System.Drawing.Point(242, 364); + this.flcampaign.Name = "flcampaign"; + this.flcampaign.Size = new System.Drawing.Size(187, 87); + this.flcampaign.TabIndex = 3; + // + // btnnewgame + // + this.btnnewgame.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnnewgame.Location = new System.Drawing.Point(3, 3); + this.btnnewgame.Name = "btnnewgame"; + this.btnnewgame.Size = new System.Drawing.Size(181, 23); + this.btnnewgame.TabIndex = 0; + this.btnnewgame.Text = "New Game"; + this.btnnewgame.UseVisualStyleBackColor = true; + this.btnnewgame.Click += new System.EventHandler(this.btnnewgame_Click); + // + // btncontinue + // + this.btncontinue.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btncontinue.Location = new System.Drawing.Point(3, 32); + this.btncontinue.Name = "btncontinue"; + this.btncontinue.Size = new System.Drawing.Size(181, 23); + this.btncontinue.TabIndex = 1; + this.btncontinue.Text = "Continue"; + this.btncontinue.UseVisualStyleBackColor = true; + this.btncontinue.Click += new System.EventHandler(this.btncontinue_Click); + // + // button10 + // + this.button10.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button10.Location = new System.Drawing.Point(3, 61); + this.button10.Name = "button10"; + this.button10.Size = new System.Drawing.Size(181, 23); + this.button10.TabIndex = 4; + this.button10.Text = "Back"; + this.button10.UseVisualStyleBackColor = true; + this.button10.Click += new System.EventHandler(this.button10_Click); + // // 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.flcampaign); + this.Controls.Add(this.pnloptions); this.Controls.Add(this.lbticker); this.Controls.Add(this.flmenu); this.ForeColor = System.Drawing.Color.White; @@ -129,6 +296,11 @@ this.Text = "MainMenu"; this.Load += new System.EventHandler(this.MainMenu_Load); this.flmenu.ResumeLayout(false); + this.pnloptions.ResumeLayout(false); + this.pnloptions.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); + this.flcampaign.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -143,5 +315,19 @@ private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button5; private System.Windows.Forms.Label lbticker; + private System.Windows.Forms.Panel pnloptions; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Button opt_btncancel; + private System.Windows.Forms.Button btnsave; + private System.Windows.Forms.TextBox txtubase; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox txtdsport; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox txtdsaddress; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.FlowLayoutPanel flcampaign; + private System.Windows.Forms.Button btnnewgame; + private System.Windows.Forms.Button btncontinue; + private System.Windows.Forms.Button button10; } } \ No newline at end of file diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.cs b/ShiftOS.WinForms/MainMenu/MainMenu.cs index 20cd4ec..4b510e2 100644 --- a/ShiftOS.WinForms/MainMenu/MainMenu.cs +++ b/ShiftOS.WinForms/MainMenu/MainMenu.cs @@ -47,11 +47,20 @@ namespace ShiftOS.WinForms.MainMenu tickermove.Interval = 1; tickerreset.Interval = 1000; + pnloptions.Hide(); + flcampaign.Hide(); flmenu.CenterParent(); tickerreset.Start(); } + public void HideOptions() + { + pnloptions.Hide(); + flmenu.BringToFront(); + flmenu.CenterParent(); + } + private void MainMenu_Load(object sender, EventArgs e) { Tools.ControlManager.SetupControls(this); @@ -76,6 +85,12 @@ namespace ShiftOS.WinForms.MainMenu 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."; + case 6: + return "There's no bugs in this game... But if you find some, please submit them to http://getshiftos.ml/Bugs."; + case 7: + return "SHIFTOS - PROPERTY OF MICHAEL VANOVERBEEK. FOR INTERNAL USE ONLY. Build number = sos_tr_133764 [Just kidding. ShiftOS is open-source. Find the code at http://github.com/shiftos-game/ShiftOS!]"; + case 8: + return "Hold your Codepoints against the wall... when they take everything away. Hold your Codepoints against the wall..."; default: return "Good God. We don't know what to put here."; } @@ -83,7 +98,18 @@ namespace ShiftOS.WinForms.MainMenu private void button1_Click(object sender, EventArgs e) { - Desktop.CurrentDesktop.Show(); + if(System.IO.File.Exists(System.IO.Path.Combine(Paths.SaveDirectory, "autosave.save"))) + { + btncontinue.Show(); + } + else + { + btncontinue.Hide(); + } + flmenu.Hide(); + flcampaign.Show(); + flcampaign.BringToFront(); + flcampaign.CenterParent(); } private void button5_Click(object sender, EventArgs e) @@ -96,5 +122,97 @@ namespace ShiftOS.WinForms.MainMenu (Desktop.CurrentDesktop as WinformsDesktop).IsSandbox = true; Desktop.CurrentDesktop.Show(); } + + private void button3_Click(object sender, EventArgs e) + { + var conf = ShiftOS.Objects.UserConfig.Get(); + + txtubase.Text = conf.UniteUrl; + txtdsaddress.Text = conf.DigitalSocietyAddress; + txtdsport.Text = conf.DigitalSocietyPort.ToString(); + + + pnloptions.Show(); + pnloptions.BringToFront(); + pnloptions.CenterParent(); + } + + private void opt_btncancel_Click(object sender, EventArgs e) + { + HideOptions(); + } + + private void btnsave_Click(object sender, EventArgs e) + { + var conf = ShiftOS.Objects.UserConfig.Get(); + + conf.DigitalSocietyAddress = txtdsaddress.Text; + + int p = 0; + + if(int.TryParse(txtdsport.Text, out p) == false) + { + Infobox.Show("Invalid port number", "The Digital Society Port must be a valid whole number between 0 and 65535."); + return; + } + else + { + if(p < 0 || p > 65535) + { + Infobox.Show("Invalid port number", "The Digital Society Port must be a valid whole number between 0 and 65535."); + return; + } + } + + conf.DigitalSocietyPort = p; + + string unite = txtubase.Text; + if (unite.EndsWith("/")) + { + int len = unite.Length; + int index = len - 1; + int end = 1; + unite = unite.Remove(index, end); + } + conf.UniteUrl = unite; + + System.IO.File.WriteAllText("servers.json", Newtonsoft.Json.JsonConvert.SerializeObject(conf, Newtonsoft.Json.Formatting.Indented)); + + HideOptions(); + } + + private void button10_Click(object sender, EventArgs e) + { + flcampaign.Hide(); + flmenu.Show(); + flmenu.BringToFront(); + flmenu.CenterParent(); + } + + private void btncontinue_Click(object sender, EventArgs e) + { + Desktop.CurrentDesktop.Show(); + + } + + private void btnnewgame_Click(object sender, EventArgs e) + { + string path = System.IO.Path.Combine(Paths.SaveDirectory, "autosave.save"); + if (System.IO.File.Exists(path)) + { + Infobox.PromptYesNo("Campaign", "You are about to start a new game, which will erase any previous progress. Are you sure you want to do this?", (result) => + { + if (result == true) + { + System.IO.File.Delete(path); + Desktop.CurrentDesktop.Show(); + } + }); + } + else + { + Desktop.CurrentDesktop.Show(); + } + } } } diff --git a/ShiftOS_TheReturn/AudioManager.cs b/ShiftOS_TheReturn/AudioManager.cs index 0a1a210..0950b55 100644 --- a/ShiftOS_TheReturn/AudioManager.cs +++ b/ShiftOS_TheReturn/AudioManager.cs @@ -125,6 +125,10 @@ namespace ShiftOS.Engine } if (play) { + while(_out.PlaybackState == PlaybackState.Playing) + { + Thread.Sleep(10); + } ShiftOS.Engine.AudioManager.Stop(); _out = new WaveOut(); var mp3 = new WaveFileReader(str); diff --git a/ShiftOS_TheReturn/Paths.cs b/ShiftOS_TheReturn/Paths.cs index 5b75ae6..332cdd3 100644 --- a/ShiftOS_TheReturn/Paths.cs +++ b/ShiftOS_TheReturn/Paths.cs @@ -94,6 +94,15 @@ namespace ShiftOS.Engine } + public static string SaveDirectory + { + get + { + string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); + return System.IO.Path.Combine(appdata, "ShiftOS", "saves"); + } + } + /// /// Gets all full paths without their keynames. /// diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index c5a6a51..18f8f78 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -575,14 +575,14 @@ namespace ShiftOS.Engine public static void ReadSave() { //Migrate old saves. - if(System.IO.Directory.Exists("C:\\ShiftOS2")) + if (System.IO.Directory.Exists("C:\\ShiftOS2")) { 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)) { - if(!Utils.DirectoryExists(file.Replace("C:\\ShiftOS2\\", "0:/").Replace("\\", "/"))) - Utils.CreateDirectory(file.Replace("C:\\ShiftOS2\\", "0:/").Replace("\\", "/")); + if (!Utils.DirectoryExists(file.Replace("C:\\ShiftOS2\\", "0:/").Replace("\\", "/"))) + Utils.CreateDirectory(file.Replace("C:\\ShiftOS2\\", "0:/").Replace("\\", "/")); } foreach (string file in System.IO.Directory.EnumerateFiles("C:\\ShiftOS2")) { @@ -594,25 +594,18 @@ namespace ShiftOS.Engine } + string path = Path.Combine(Paths.SaveDirectory, "autosave.save"); - if (Utils.FileExists(Paths.SaveFileInner)) + if (System.IO.File.Exists(Path.Combine(Paths.SaveDirectory, "autosave.save"))) { - oobe.ShowSaveTransfer(JsonConvert.DeserializeObject(Utils.ReadAllText(Paths.SaveFileInner))); + CurrentSave = JsonConvert.DeserializeObject(System.IO.File.ReadAllText(path)); } else { - if (Utils.FileExists(Paths.GetPath("user.dat"))) - { - string token = Utils.ReadAllText(Paths.GetPath("user.dat")); - - ServerManager.SendMessage("mud_token_login", token); - } - else - { - NewSave(); - } + NewSave(); } + } /// @@ -644,15 +637,25 @@ namespace ShiftOS.Engine Console.Write("{SE_SAVING}... "); if (SaveSystem.CurrentSave != null) { - Utils.WriteAllText(Paths.GetPath("user.dat"), CurrentSave.UniteAuthToken); var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); new Thread(() => { - // please don't do networking on the main thread if you're just going to - // discard the response, it's extremely slow - ServerManager.SendMessage("mud_save", serialisedSaveFile); + try + { + // please don't do networking on the main thread if you're just going to + // discard the response, it's extremely slow + ServerManager.SendMessage("mud_save", serialisedSaveFile); + } + catch { } }) { 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) Console.WriteLine(" ...{DONE}."); -- cgit v1.2.3 From 0d75f701778a0900a58343c4c80c124279bc231f Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 11 Jun 2017 07:41:07 -0400 Subject: skip server connection if server is offline --- ShiftOS_TheReturn/SaveSystem.cs | 25 ++++++++++++++++--------- ShiftOS_TheReturn/ServerManager.cs | 24 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 9 deletions(-) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 18f8f78..b9bef47 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -163,22 +163,29 @@ namespace ShiftOS.Engine bool guidReceived = false; ServerManager.GUIDReceived += (str) => { - //Connection successful! Stop waiting! - guidReceived = true; + //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()) + if (ServerManager.ServerOnline) { - Thread.Sleep(10); + 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(); + } + else + { + Console.WriteLine("[inetd] No suitable network interface card found, skipping network connection."); + FinishBootstrap(); } - Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); - FinishBootstrap(); } catch (Exception ex) { diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index be4f086..00f9653 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -38,6 +38,7 @@ using System.Net.Sockets; using System.Diagnostics; using System.IO; using System.Reflection; +using System.Net.NetworkInformation; namespace ShiftOS.Engine { @@ -46,6 +47,29 @@ namespace ShiftOS.Engine /// public static class ServerManager { + + public static bool ServerOnline + { + get + { + try + { + Ping myPing = new Ping(); + String host = UserConfig.Get().DigitalSocietyAddress; + byte[] buffer = new byte[32]; + int timeout = 1000; + PingOptions pingOptions = new PingOptions(); + PingReply reply = myPing.Send(host, timeout, buffer, pingOptions); + return (reply.Status == IPStatus.Success); + } + catch (Exception) + { + return false; + } + } + } + + /// /// Print connection diagnostic information. /// -- cgit v1.2.3 From c0017e35a46eb20e7ba2717009171eedaf9785e7 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 11 Jun 2017 17:58:35 -0400 Subject: Creation of new games is possible again! --- ShiftOS.WinForms/Applications/Terminal.cs | 2 +- ShiftOS.WinForms/Controls/TerminalBox.cs | 2 + ShiftOS.WinForms/Oobe.cs | 127 +-------------------- ShiftOS.WinForms/OobeStory.cs | 32 +++++- ShiftOS.WinForms/UniteSignupDialog.Designer.cs | 147 +++++-------------------- ShiftOS.WinForms/UniteSignupDialog.cs | 97 +++------------- ShiftOS.WinForms/UniteSignupDialog.resx | 11 -- ShiftOS_TheReturn/SaveSystem.cs | 6 +- ShiftOS_TheReturn/Story.cs | 1 + 9 files changed, 88 insertions(+), 337 deletions(-) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index 687b2b9..0470d68 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -624,7 +624,7 @@ Your goal: Earn 1,000 Codepoints."); { if (AppearanceManager.OpenForms.Count <= 1) { - Console.WriteLine(""); + //Console.WriteLine(""); Console.WriteLine("{WIN_CANTCLOSETERMINAL}"); try { diff --git a/ShiftOS.WinForms/Controls/TerminalBox.cs b/ShiftOS.WinForms/Controls/TerminalBox.cs index c188321..b454a77 100644 --- a/ShiftOS.WinForms/Controls/TerminalBox.cs +++ b/ShiftOS.WinForms/Controls/TerminalBox.cs @@ -63,6 +63,7 @@ namespace ShiftOS.WinForms.Controls public void Write(string text) { + Thread.Sleep(5); this.HideSelection = true; this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor); this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor); @@ -86,6 +87,7 @@ namespace ShiftOS.WinForms.Controls public void WriteLine(string text) { + Thread.Sleep(5); Engine.AudioManager.PlayStream(Properties.Resources.writesound); this.HideSelection = true; this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor); diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs index 271e1fd..b2f8cd2 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -194,137 +194,14 @@ namespace ShiftOS.WinForms } + [Obsolete("Unite code stub.")] public void PromptForLogin() { - Infobox.Show("Login", "Since the last time you've played ShiftOS, some changes have been made to the login system. You must now login using your website credentials.", () => - { - Infobox.PromptYesNo("Website account", "Do you have an account at http://getshiftos.ml?", (hasAccount) => - { - if(hasAccount == true) - { - var loginDialog = new UniteLoginDialog((success)=> - { - string token = success; - var uClient = new UniteClient("http://getshiftos.ml", token); - Infobox.Show("Welcome to ShiftOS.", $"Hello, {uClient.GetDisplayName()}! We've signed you into your account. We'll now try to link your ShiftOS account with your save file.", () => - { - ServerMessageReceived smr = null; - smr = (msg) => - { - if (msg.Name == "mud_savefile") - { - ServerManager.MessageReceived -= smr; - SaveSystem.CurrentSave = JsonConvert.DeserializeObject(msg.Contents); - SaveSystem.SaveGame(); - } - else if(msg.Name=="mud_login_denied") - { - ServerManager.MessageReceived -= smr; - LinkSaveFile(token); - } - }; - ServerManager.MessageReceived += smr; - ServerManager.SendMessage("mud_token_login", token); - }); - }); - AppearanceManager.SetupDialog(loginDialog); - } - else - { - var signupDialog = new UniteSignupDialog((token) => - { - ServerMessageReceived smr = null; - smr = (msg) => - { - ServerManager.MessageReceived -= smr; - if (msg.Name == "mud_savefile") - { - SaveSystem.CurrentSave = JsonConvert.DeserializeObject(msg.Contents); - SaveSystem.SaveGame(); - } - else if (msg.Name == "mud_login_denied") - { - LinkSaveFile(token); - } - }; - ServerManager.MessageReceived += smr; - ServerManager.SendMessage("mud_token_login", token); - - }); - AppearanceManager.SetupDialog(signupDialog); - } - }); - }); } + [Obsolete("Unite code stub.")] public void LinkSaveFile(string token) { - if (Utils.FileExists(Paths.GetPath("user.dat"))) - { - try - { - var details = JsonConvert.DeserializeObject(Utils.ReadAllText(Paths.GetPath("user.dat"))); - ServerMessageReceived smr = null; - bool msgreceived = false; - bool found = false; - smr = (msg) => - { - if (msg.Name == "mud_savefile") - { - var save = JsonConvert.DeserializeObject(msg.Contents); - save.UniteAuthToken = token; - Infobox.Show("Migration complete.", "We have migrated your old save file to the new system successfully. You can still log in using the old system on old builds of ShiftOS.", () => - { - SaveSystem.CurrentSave = save; - SaveSystem.SaveGame(); - found = true; - msgreceived = true; - }); - } - else if (msg.Name == "mud_login_denied") - { - found = false; - msgreceived = true; - } - ServerManager.MessageReceived -= smr; - }; - ServerManager.MessageReceived += smr; - ServerManager.SendMessage("mud_login", JsonConvert.SerializeObject(new - { - username = details.Username, - password = details.Password - })); - while (msgreceived == false) - Thread.Sleep(10); - if (found == true) - return; - } - catch - { - - } - } - - var client = new UniteClient("http://getshiftos.ml", token); - var sve = new Save(); - sve.Username = client.GetEmail(); - sve.Password = Guid.NewGuid().ToString(); - sve.SystemName = client.GetSysName(); - sve.UniteAuthToken = token; - sve.Codepoints = 0; - sve.Upgrades = new Dictionary(); - sve.ID = Guid.NewGuid(); - sve.StoriesExperienced = new List(); - sve.StoriesExperienced.Add("mud_fundamentals"); - Infobox.Show("Welcome to ShiftOS.", "Welcome to ShiftOS, " + client.GetDisplayName() + ". We have created a save file for you. Now, go on and Shift It Your Way.", () => - { - sve.StoryPosition = 8675309; - SaveSystem.CurrentSave = sve; - Shiftorium.Silent = true; - SaveSystem.SaveGame(); - Shiftorium.Silent = false; - - }); } public void ForceReboot() diff --git a/ShiftOS.WinForms/OobeStory.cs b/ShiftOS.WinForms/OobeStory.cs index 8d86b9e..f2a4930 100644 --- a/ShiftOS.WinForms/OobeStory.cs +++ b/ShiftOS.WinForms/OobeStory.cs @@ -143,7 +143,37 @@ namespace ShiftOS.WinForms Console.WriteLine(); Console.WriteLine("Next, let's get user information."); Console.WriteLine(); - ShiftOS.Engine.OutOfBoxExperience.PromptForLogin(); + Desktop.InvokeOnWorkerThread(() => + { + var uSignUpDialog = new UniteSignupDialog((result) => + { + var sve = new Save(); + sve.SystemName = result.SystemName; + sve.Codepoints = 0; + sve.Upgrades = new Dictionary(); + sve.ID = Guid.NewGuid(); + sve.StoriesExperienced = new List(); + sve.StoriesExperienced.Add("mud_fundamentals"); + sve.Users = new List + { + new ClientSave + { + Username = "root", + Password = result.RootPassword, + Permissions = 0 + } + }; + + sve.StoryPosition = 8675309; + SaveSystem.CurrentSave = sve; + Shiftorium.Silent = true; + SaveSystem.SaveGame(); + Shiftorium.Silent = false; + + + }); + AppearanceManager.SetupDialog(uSignUpDialog); + }); } private static bool isValid(string text, string chars) diff --git a/ShiftOS.WinForms/UniteSignupDialog.Designer.cs b/ShiftOS.WinForms/UniteSignupDialog.Designer.cs index a1509d7..52c06b7 100644 --- a/ShiftOS.WinForms/UniteSignupDialog.Designer.cs +++ b/ShiftOS.WinForms/UniteSignupDialog.Designer.cs @@ -28,165 +28,83 @@ /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UniteSignupDialog)); this.btnlogin = new System.Windows.Forms.Button(); - this.txtpassword = new System.Windows.Forms.TextBox(); - this.txtusername = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); - this.txtconfirm = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.txtdisplay = new System.Windows.Forms.TextBox(); + this.txtsys = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.txtsysname = new System.Windows.Forms.TextBox(); + this.txtroot = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // btnlogin // this.btnlogin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnlogin.Location = new System.Drawing.Point(462, 479); + this.btnlogin.Location = new System.Drawing.Point(462, 168); this.btnlogin.Name = "btnlogin"; this.btnlogin.Size = new System.Drawing.Size(75, 23); this.btnlogin.TabIndex = 11; - this.btnlogin.Text = "Submit"; + this.btnlogin.Text = "{UI_SUBMIT}"; this.btnlogin.UseVisualStyleBackColor = true; this.btnlogin.Click += new System.EventHandler(this.btnlogin_Click); // - // txtpassword - // - this.txtpassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtpassword.Location = new System.Drawing.Point(113, 133); - this.txtpassword.Name = "txtpassword"; - this.txtpassword.Size = new System.Drawing.Size(424, 20); - this.txtpassword.TabIndex = 10; - this.txtpassword.UseSystemPasswordChar = true; - // - // txtusername - // - this.txtusername.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtusername.Location = new System.Drawing.Point(113, 100); - this.txtusername.Name = "txtusername"; - this.txtusername.Size = new System.Drawing.Size(424, 20); - this.txtusername.TabIndex = 9; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(17, 136); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(56, 13); - this.label3.TabIndex = 8; - this.label3.Text = "Password:"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(17, 103); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(76, 13); - this.label2.TabIndex = 7; - this.label2.Text = "Email Address:"; - // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(17, 36); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(120, 13); + this.label1.Size = new System.Drawing.Size(169, 13); this.label1.TabIndex = 6; this.label1.Tag = "header2"; - this.label1.Text = "Create ShiftOS Account"; + this.label1.Text = "{INIT_SYSTEM_PREPARATION}"; // - // txtconfirm + // txtsys // - this.txtconfirm.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.txtsys.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.txtconfirm.Location = new System.Drawing.Point(113, 159); - this.txtconfirm.Name = "txtconfirm"; - this.txtconfirm.Size = new System.Drawing.Size(424, 20); - this.txtconfirm.TabIndex = 13; - this.txtconfirm.UseSystemPasswordChar = true; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(17, 162); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(45, 13); - this.label4.TabIndex = 12; - this.label4.Text = "Confirm:"; - // - // txtdisplay - // - this.txtdisplay.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtdisplay.Location = new System.Drawing.Point(113, 197); - this.txtdisplay.Name = "txtdisplay"; - this.txtdisplay.Size = new System.Drawing.Size(424, 20); - this.txtdisplay.TabIndex = 15; + this.txtsys.Location = new System.Drawing.Point(113, 100); + this.txtsys.Name = "txtsys"; + this.txtsys.Size = new System.Drawing.Size(424, 20); + this.txtsys.TabIndex = 15; // // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(17, 200); + this.label5.Location = new System.Drawing.Point(17, 103); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(73, 13); + this.label5.Size = new System.Drawing.Size(116, 13); this.label5.TabIndex = 14; - this.label5.Text = "Display name:"; - // - // label6 - // - this.label6.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.label6.Location = new System.Drawing.Point(20, 267); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(517, 209); - this.label6.TabIndex = 16; - this.label6.Text = resources.GetString("label6.Text"); + this.label5.Text = "{SE_SYSTEM_NAME}"; // - // txtsysname + // txtroot // - this.txtsysname.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.txtroot.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.txtsysname.Location = new System.Drawing.Point(113, 223); - this.txtsysname.Name = "txtsysname"; - this.txtsysname.Size = new System.Drawing.Size(424, 20); - this.txtsysname.TabIndex = 18; + this.txtroot.Location = new System.Drawing.Point(113, 126); + this.txtroot.Name = "txtroot"; + this.txtroot.Size = new System.Drawing.Size(424, 20); + this.txtroot.TabIndex = 18; // // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(17, 226); + this.label7.Location = new System.Drawing.Point(17, 129); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(73, 13); + this.label7.Size = new System.Drawing.Size(135, 13); this.label7.TabIndex = 17; - this.label7.Text = "System name:"; + this.label7.Text = "{SE_ROOT_PASSWORD}"; // // UniteSignupDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.txtsysname); + this.Controls.Add(this.txtroot); this.Controls.Add(this.label7); - this.Controls.Add(this.label6); - this.Controls.Add(this.txtdisplay); + this.Controls.Add(this.txtsys); this.Controls.Add(this.label5); - this.Controls.Add(this.txtconfirm); - this.Controls.Add(this.label4); this.Controls.Add(this.btnlogin); - this.Controls.Add(this.txtpassword); - this.Controls.Add(this.txtusername); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Name = "UniteSignupDialog"; - this.Size = new System.Drawing.Size(555, 519); + this.Size = new System.Drawing.Size(555, 208); this.ResumeLayout(false); this.PerformLayout(); @@ -195,17 +113,10 @@ #endregion private System.Windows.Forms.Button btnlogin; - private System.Windows.Forms.TextBox txtpassword; - private System.Windows.Forms.TextBox txtusername; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox txtconfirm; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox txtdisplay; + private System.Windows.Forms.TextBox txtsys; private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.TextBox txtsysname; + private System.Windows.Forms.TextBox txtroot; private System.Windows.Forms.Label label7; } } diff --git a/ShiftOS.WinForms/UniteSignupDialog.cs b/ShiftOS.WinForms/UniteSignupDialog.cs index 7d0fd33..b2b5052 100644 --- a/ShiftOS.WinForms/UniteSignupDialog.cs +++ b/ShiftOS.WinForms/UniteSignupDialog.cs @@ -16,13 +16,19 @@ namespace ShiftOS.WinForms { public partial class UniteSignupDialog : UserControl, IShiftOSWindow { - public UniteSignupDialog(Action callback) + public class SignupCredentials + { + public string SystemName { get; set; } + public string RootPassword { get; set; } + } + + public UniteSignupDialog(Action callback) { InitializeComponent(); Callback = callback; } - private Action Callback { get; set; } + private Action Callback { get; set; } public void OnLoad() @@ -45,92 +51,25 @@ namespace ShiftOS.WinForms private void btnlogin_Click(object sender, EventArgs e) { - string u = txtusername.Text; - string p = txtpassword.Text; + string sys = txtsys.Text; + string root = txtroot.Text; - if (string.IsNullOrWhiteSpace(u)) + if (string.IsNullOrWhiteSpace(sys)) { - Infobox.Show("Please enter a username.", "You must enter a proper email address."); + Infobox.Show("{TITLE_EMPTY_SYSNAME}", "{MSG_EMPTY_SYSNAME}"); return; } - - if (string.IsNullOrWhiteSpace(p)) + if(sys.Length < 5) { - Infobox.Show("Please enter a password.", "You must enter a valid password."); + Infobox.Show("{TITLE_VALIDATION_ERROR}", "{MSG_VALIDATION_ERROR_SYSNAME_LENGTH}"); return; } - if(p != txtconfirm.Text) + Callback?.Invoke(new SignupCredentials { - Infobox.Show("Passwords don't match.", "The \"Password\" and \"Confirm\" boxes must match."); - return; - } - - if (string.IsNullOrWhiteSpace(txtdisplay.Text)) - { - Infobox.Show("Empty display name", "Please choose a proper display name."); - return; - } - - if (string.IsNullOrWhiteSpace(txtsysname.Text)) - { - Infobox.Show("Empty system name", "Please name your computer!"); - return; - } - - if(p.Length < 7) - { - Infobox.Show("Password error", "Your password must have at least 7 characters."); - return; - } - - if (!(p.Any(char.IsUpper) && - p.Any(char.IsLower) && - p.Any(char.IsDigit))) - { - Infobox.Show("Password error", "Your password must contain at least one uppercase, lowercase, digit and symbol character."); - return; - } - - if (!u.Contains("@")) - { - Infobox.Show("Valid email required.", "You must specify a valid email address."); - return; - } - - try - { - var webrequest = HttpWebRequest.Create(UserConfig.Get().UniteUrl + "/Auth/Register?appname=ShiftOS&appdesc=ShiftOS+client&version=1_0_beta_2_4&displayname=" + txtdisplay.Text + "&sysname=" + txtsysname.Text); - string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{u}:{p}")); - webrequest.Headers.Add("Authentication: Basic " + base64); - var response = webrequest.GetResponse(); - var str = response.GetResponseStream(); - var reader = new System.IO.StreamReader(str); - string result = reader.ReadToEnd(); - if (result.StartsWith("{")) - { - var exc = JsonConvert.DeserializeObject(result); - Infobox.Show("Error", exc.Message); - return; - } - reader.Close(); - str.Close(); - str.Dispose(); - response.Dispose(); - Callback?.Invoke(result); - AppearanceManager.Close(this); - } -#if DEBUG - catch (Exception ex) - { - Infobox.Show("Error", ex.ToString()); - } -#else - catch - { - Infobox.Show("Login failed.", "The login attempt failed due to an incorrect username and password pair."); - } -#endif + SystemName = sys, + RootPassword = root + }); } } diff --git a/ShiftOS.WinForms/UniteSignupDialog.resx b/ShiftOS.WinForms/UniteSignupDialog.resx index 5fecdcd..1af7de1 100644 --- a/ShiftOS.WinForms/UniteSignupDialog.resx +++ b/ShiftOS.WinForms/UniteSignupDialog.resx @@ -117,15 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Your ShiftOS Account is your gateway to the world of ShiftOS. - -What does this account do for you? - - - It holds all your Codepoints, Shiftorium Upgrades, and other in-game save details in a secure spot. - - It gives you access to the ShiftOS Forums, Wiki, Developer Blog and the bugtracker. - - It gives you your own personal profile that you can shift your own way - just like you can ShiftOS. - -You can customize more information for this account at http://getshiftos.ml/, but first, we must create it. - \ No newline at end of file diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index b9bef47..a4e79a7 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -527,8 +527,10 @@ namespace ShiftOS.Engine { try { - Story.Start(CurrentSave.PickupPoint); - TerminalBackend.PrintPrompt(); + if (Story.Context == null) + { + Story.Start(CurrentSave.PickupPoint); + } } catch { } } diff --git a/ShiftOS_TheReturn/Story.cs b/ShiftOS_TheReturn/Story.cs index c01c055..2b00686 100644 --- a/ShiftOS_TheReturn/Story.cs +++ b/ShiftOS_TheReturn/Story.cs @@ -109,6 +109,7 @@ namespace ShiftOS.Engine { Thread.Sleep(5000); } + Thread.Sleep(500); CurrentObjectives.Remove(obj); obj.Complete(); }); -- cgit v1.2.3 From 388835c96a1ace2fc8f317ecb10981da76aeac05 Mon Sep 17 00:00:00 2001 From: RogueAI42 Date: Mon, 12 Jun 2017 22:38:53 +1000 Subject: fixed ShiftFS save simple --- ShiftOS_TheReturn/SaveSystem.cs | 73 ++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 41 deletions(-) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index a4e79a7..a3a992c 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -163,29 +163,22 @@ namespace ShiftOS.Engine bool guidReceived = false; ServerManager.GUIDReceived += (str) => { - //Connection successful! Stop waiting! - guidReceived = true; + //Connection successful! Stop waiting! + guidReceived = true; Console.WriteLine("[inetd] Connection successful."); }; try { - 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); - } - Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); - FinishBootstrap(); - } - else + + ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort); + //This haults the client until the connection is successful. + while (ServerManager.thisGuid == new Guid()) { - Console.WriteLine("[inetd] No suitable network interface card found, skipping network connection."); - FinishBootstrap(); + Thread.Sleep(10); } + Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); + FinishBootstrap(); } catch (Exception ex) { @@ -527,10 +520,8 @@ namespace ShiftOS.Engine { try { - if (Story.Context == null) - { - Story.Start(CurrentSave.PickupPoint); - } + Story.Start(CurrentSave.PickupPoint); + TerminalBackend.PrintPrompt(); } catch { } } @@ -637,40 +628,40 @@ namespace ShiftOS.Engine /// public static void SaveGame() { - if (IsSandbox == false) - { #if !NOSAVE - if (!Shiftorium.Silent) - Console.WriteLine(""); - if (!Shiftorium.Silent) - Console.Write("{SE_SAVING}... "); - if (SaveSystem.CurrentSave != null) + if (!IsSandbox) { - var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); - new Thread(() => + if (!Shiftorium.Silent) + Console.WriteLine(""); + if (!Shiftorium.Silent) + Console.Write("{SE_SAVING}... "); + if (SaveSystem.CurrentSave != null) { - try + var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); + new Thread(() => { + try + { // please don't do networking on the main thread if you're just going to // discard the response, it's extremely slow ServerManager.SendMessage("mud_save", serialisedSaveFile); + } + catch { } + }) + { IsBackground = false }.Start(); + if (!System.IO.Directory.Exists(Paths.SaveDirectory)) + { + System.IO.Directory.CreateDirectory(Paths.SaveDirectory); + } - catch { } - }) - { 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); } - - System.IO.File.WriteAllText(Path.Combine(Paths.SaveDirectory, "autosave.save"), serialisedSaveFile); + if (!Shiftorium.Silent) + Console.WriteLine(" ...{DONE}."); } - if (!Shiftorium.Silent) - Console.WriteLine(" ...{DONE}."); System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0)); #endif - } } /// -- cgit v1.2.3 From d1538e742bf075c680d7f6a42b0ad5583a18d379 Mon Sep 17 00:00:00 2001 From: Rylan/wowmom98 Date: Mon, 12 Jun 2017 21:52:38 -0400 Subject: Loading joke thing --- ShiftOS_TheReturn/SaveSystem.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index a3a992c..b35277b 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -79,6 +79,7 @@ namespace ShiftOS.Engine /// public static Save CurrentSave { get; set; } + /// /// Start the entire ShiftOS engine. /// @@ -104,6 +105,8 @@ namespace ShiftOS.Engine Localization.SetupTHETRUEDefaultLocals(); SkinEngine.Init(); + Random rnd = new Random(); + int loadingJoke1 = rnd.Next(5); TerminalBackend.OpenTerminal(); @@ -138,7 +141,19 @@ namespace ShiftOS.Engine Console.WriteLine("[sfs] Loading SFS driver v3"); Thread.Sleep(100); Console.WriteLine("[sfs] 4096 blocks read."); + if (loadingJoke1 == 0) + Console.WriteLine("[sos] Getting good and ready..."); + if (loadingJoke1 == 1) + Console.WriteLine("[sos] Shifting the OS..."); + if (loadingJoke1 == 2) + Console.WriteLine("[sos] Placing things everywhere..."); + if (loadingJoke1 == 3) + Console.WriteLine("[sos] Making an an errors..."); + if (loadingJoke1 == 4) + Console.WriteLine("[sos] Testing to see if this OS is indeed on..."); + Thread.Sleep(50); Console.WriteLine("[simpl-conf] Reading configuration files (global-3.conf)"); + Thread.Sleep(20); Console.WriteLine("[termdb] Building command database from filesystem..."); TerminalBackend.PopulateTerminalCommands(); -- cgit v1.2.3 From 428533fec2721d7119e23a5a6b2aaac0e6107982 Mon Sep 17 00:00:00 2001 From: RogueAI42 Date: Tue, 13 Jun 2017 18:27:37 +1000 Subject: Let's try that again........ seems like I somehow got an old copy of SaveSystem.cs and committed that, re-introducing the game's dependency on Unite, which is dead, press F to pay respects. --- ShiftOS_TheReturn/SaveSystem.cs | 88 +++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 47 deletions(-) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index b35277b..a4e79a7 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -79,7 +79,6 @@ namespace ShiftOS.Engine /// public static Save CurrentSave { get; set; } - /// /// Start the entire ShiftOS engine. /// @@ -105,8 +104,6 @@ namespace ShiftOS.Engine Localization.SetupTHETRUEDefaultLocals(); SkinEngine.Init(); - Random rnd = new Random(); - int loadingJoke1 = rnd.Next(5); TerminalBackend.OpenTerminal(); @@ -141,19 +138,7 @@ namespace ShiftOS.Engine Console.WriteLine("[sfs] Loading SFS driver v3"); Thread.Sleep(100); Console.WriteLine("[sfs] 4096 blocks read."); - if (loadingJoke1 == 0) - Console.WriteLine("[sos] Getting good and ready..."); - if (loadingJoke1 == 1) - Console.WriteLine("[sos] Shifting the OS..."); - if (loadingJoke1 == 2) - Console.WriteLine("[sos] Placing things everywhere..."); - if (loadingJoke1 == 3) - Console.WriteLine("[sos] Making an an errors..."); - if (loadingJoke1 == 4) - Console.WriteLine("[sos] Testing to see if this OS is indeed on..."); - Thread.Sleep(50); Console.WriteLine("[simpl-conf] Reading configuration files (global-3.conf)"); - Thread.Sleep(20); Console.WriteLine("[termdb] Building command database from filesystem..."); TerminalBackend.PopulateTerminalCommands(); @@ -178,22 +163,29 @@ namespace ShiftOS.Engine bool guidReceived = false; ServerManager.GUIDReceived += (str) => { - //Connection successful! Stop waiting! - guidReceived = true; + //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()) + if (ServerManager.ServerOnline) { - Thread.Sleep(10); + 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(); + } + else + { + Console.WriteLine("[inetd] No suitable network interface card found, skipping network connection."); + FinishBootstrap(); } - Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); - FinishBootstrap(); } catch (Exception ex) { @@ -535,8 +527,10 @@ namespace ShiftOS.Engine { try { - Story.Start(CurrentSave.PickupPoint); - TerminalBackend.PrintPrompt(); + if (Story.Context == null) + { + Story.Start(CurrentSave.PickupPoint); + } } catch { } } @@ -643,40 +637,40 @@ namespace ShiftOS.Engine /// public static void SaveGame() { + if (IsSandbox == false) + { #if !NOSAVE - if (!IsSandbox) + if (!Shiftorium.Silent) + Console.WriteLine(""); + if (!Shiftorium.Silent) + Console.Write("{SE_SAVING}... "); + if (SaveSystem.CurrentSave != null) { - if (!Shiftorium.Silent) - Console.WriteLine(""); - if (!Shiftorium.Silent) - Console.Write("{SE_SAVING}... "); - if (SaveSystem.CurrentSave != null) + var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); + new Thread(() => { - var serialisedSaveFile = JsonConvert.SerializeObject(CurrentSave, Formatting.Indented); - new Thread(() => + try { - try - { // please don't do networking on the main thread if you're just going to // discard the response, it's extremely slow ServerManager.SendMessage("mud_save", serialisedSaveFile); - } - catch { } - }) - { IsBackground = false }.Start(); - if (!System.IO.Directory.Exists(Paths.SaveDirectory)) - { - System.IO.Directory.CreateDirectory(Paths.SaveDirectory); - } + catch { } + }) + { 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) - Console.WriteLine(" ...{DONE}."); + + System.IO.File.WriteAllText(Path.Combine(Paths.SaveDirectory, "autosave.save"), serialisedSaveFile); } + if (!Shiftorium.Silent) + Console.WriteLine(" ...{DONE}."); System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0)); #endif + } } /// -- cgit v1.2.3 From a2db5d39096cbf4d32412ad40168769ca63d9493 Mon Sep 17 00:00:00 2001 From: RogueAI42 Date: Tue, 13 Jun 2017 18:29:25 +1000 Subject: ... what the hell is going on --- ShiftOS_TheReturn/SaveSystem.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index a4e79a7..14e6dcd 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -79,6 +79,7 @@ namespace ShiftOS.Engine /// public static Save CurrentSave { get; set; } + /// /// Start the entire ShiftOS engine. /// @@ -104,6 +105,8 @@ namespace ShiftOS.Engine Localization.SetupTHETRUEDefaultLocals(); SkinEngine.Init(); + Random rnd = new Random(); + int loadingJoke1 = rnd.Next(5); TerminalBackend.OpenTerminal(); @@ -138,7 +141,19 @@ namespace ShiftOS.Engine Console.WriteLine("[sfs] Loading SFS driver v3"); Thread.Sleep(100); Console.WriteLine("[sfs] 4096 blocks read."); + if (loadingJoke1 == 0) + Console.WriteLine("[sos] Getting good and ready..."); + if (loadingJoke1 == 1) + Console.WriteLine("[sos] Shifting the OS..."); + if (loadingJoke1 == 2) + Console.WriteLine("[sos] Placing things everywhere..."); + if (loadingJoke1 == 3) + Console.WriteLine("[sos] Making an an errors..."); + if (loadingJoke1 == 4) + Console.WriteLine("[sos] Testing to see if this OS is indeed on..."); + Thread.Sleep(50); Console.WriteLine("[simpl-conf] Reading configuration files (global-3.conf)"); + Thread.Sleep(20); Console.WriteLine("[termdb] Building command database from filesystem..."); TerminalBackend.PopulateTerminalCommands(); @@ -637,7 +652,7 @@ namespace ShiftOS.Engine /// public static void SaveGame() { - if (IsSandbox == false) + if (!IsSandbox) { #if !NOSAVE if (!Shiftorium.Silent) @@ -668,9 +683,9 @@ namespace ShiftOS.Engine } if (!Shiftorium.Silent) Console.WriteLine(" ...{DONE}."); - System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0)); #endif } + System.IO.File.WriteAllText(Paths.SaveFile, Utils.ExportMount(0)); } /// -- cgit v1.2.3 From 037a86cd41cacbd6f124c742ba15aaf55dc17c15 Mon Sep 17 00:00:00 2001 From: Rylan/wowmom98 Date: Tue, 13 Jun 2017 15:55:13 -0400 Subject: more loading joke --- ShiftOS_TheReturn/SaveSystem.cs | 42 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 14e6dcd..97cc26e 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -106,7 +106,8 @@ namespace ShiftOS.Engine Localization.SetupTHETRUEDefaultLocals(); SkinEngine.Init(); Random rnd = new Random(); - int loadingJoke1 = rnd.Next(5); + int loadingJoke1 = rnd.Next(10); + int loadingJoke2 = rnd.Next(10); TerminalBackend.OpenTerminal(); @@ -126,6 +127,7 @@ namespace ShiftOS.Engine Thread.Sleep(350); Console.WriteLine("ShiftKernel v0.4.2"); + Thread.Sleep(50); Console.WriteLine("(MIT) DevX 2017, Very Little Rights Reserved"); Console.WriteLine(""); Console.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR"); @@ -139,7 +141,7 @@ namespace ShiftOS.Engine Thread.Sleep(250); Console.WriteLine("[init] Kernel boot complete."); Console.WriteLine("[sfs] Loading SFS driver v3"); - Thread.Sleep(100); + Thread.Sleep(350); Console.WriteLine("[sfs] 4096 blocks read."); if (loadingJoke1 == 0) Console.WriteLine("[sos] Getting good and ready..."); @@ -151,9 +153,19 @@ namespace ShiftOS.Engine Console.WriteLine("[sos] Making an an errors..."); if (loadingJoke1 == 4) Console.WriteLine("[sos] Testing to see if this OS is indeed on..."); - Thread.Sleep(50); + if (loadingJoke1 == 5) + Console.WriteLine("[sos] Calming user..."); + if (loadingJoke1 == 6) + Console.WriteLine("[sos] Cleaning room..."); + if (loadingJoke1 == 7) + Console.WriteLine("[sos] Checking for piracy..."); + if (loadingJoke1 == 8) + Console.WriteLine("[sos] Getting Jim that important office memo..."); + if (loadingJoke1 == 9) + Console.WriteLine("[sos] Using imagination..."); + Thread.Sleep(500); Console.WriteLine("[simpl-conf] Reading configuration files (global-3.conf)"); - Thread.Sleep(20); + Thread.Sleep(30); Console.WriteLine("[termdb] Building command database from filesystem..."); TerminalBackend.PopulateTerminalCommands(); @@ -181,6 +193,28 @@ namespace ShiftOS.Engine //Connection successful! Stop waiting! guidReceived = true; Console.WriteLine("[inetd] Connection successful."); + Thread.Sleep(100); + if (loadingJoke2 == 0) + Console.WriteLine("[sos] Running final checks (gotta be sure!)..."); + if (loadingJoke2 == 1) + Console.WriteLine("[sos] Fixing the time because we think we got it wrong..."); + if (loadingJoke2 == 2) + Console.WriteLine("[sos] Fun Fact: there is a 12% chance you will read this..."); + if (loadingJoke2 == 3) + Console.WriteLine("[sos] Fixing sloppy code..."); + if (loadingJoke2 == 4) + Console.WriteLine("[sos] Welcoming new users..."); + if (loadingJoke2 == 5) + Console.WriteLine("[sos] Taking inspiration from GMod..."); + if (loadingJoke2 == 6) + Console.WriteLine("[sos] Getting help..."); + if (loadingJoke2 == 7) + Console.WriteLine("[sos] I'm very clevery guy..."); + if (loadingJoke2 == 8) + Console.WriteLine("[sos] Waiting a bit..."); + if (loadingJoke2 == 9) + Console.WriteLine("[sos] Do a digital dancing..."); + Thread.Sleep(500); }; try -- cgit v1.2.3 From e3f9a6028b3774f7376617502e7f6016dc50dd0e Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 17 Jun 2017 14:45:42 -0400 Subject: Localize a LOT of the UI --- ShiftOS.WinForms/Applications/MindBlow.cs | 12 +- ShiftOS.WinForms/Applications/Pong.Designer.cs | 74 +++--- ShiftOS.WinForms/Applications/Pong.cs | 34 ++- ShiftOS.WinForms/Applications/Pong.resx | 7 - ShiftOS.WinForms/MainMenu/Loading.Designer.cs | 2 +- ShiftOS.WinForms/MainMenu/Loading.cs | 1 + ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs | 62 ++--- ShiftOS.WinForms/MainMenu/MainMenu.cs | 47 +--- ShiftOS.WinForms/Resources/strings_en.txt | 354 +++++++++---------------- ShiftOS_TheReturn/Commands.cs | 263 ++++++------------ ShiftOS_TheReturn/SaveSystem.cs | 120 +++------ ShiftOS_TheReturn/UserManagementCommands.cs | 54 ++-- 12 files changed, 377 insertions(+), 653 deletions(-) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS.WinForms/Applications/MindBlow.cs b/ShiftOS.WinForms/Applications/MindBlow.cs index 0f0df80..7cd2a8f 100644 --- a/ShiftOS.WinForms/Applications/MindBlow.cs +++ b/ShiftOS.WinForms/Applications/MindBlow.cs @@ -35,7 +35,17 @@ namespace ShiftOS.WinForms.Applications public override long Length => box.Text.Length; - public override long Position { get => Length; set => throw new NotImplementedException(); } + public override long Position + { + get + { + return Length; + } + set + { + //nothing + } + } public override void Flush() { diff --git a/ShiftOS.WinForms/Applications/Pong.Designer.cs b/ShiftOS.WinForms/Applications/Pong.Designer.cs index aee599b..fd82735 100644 --- a/ShiftOS.WinForms/Applications/Pong.Designer.cs +++ b/ShiftOS.WinForms/Applications/Pong.Designer.cs @@ -28,18 +28,17 @@ /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Pong)); this.pnlcanvas = new System.Windows.Forms.Panel(); this.pnllevelwon = new System.Windows.Forms.Panel(); - this.lbltitle = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); - this.btncashout = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); + this.btncashout = new System.Windows.Forms.Button(); + this.lbltitle = new System.Windows.Forms.Label(); this.pnlgamestart = new System.Windows.Forms.Panel(); this.label2 = new System.Windows.Forms.Label(); this.panel3 = new System.Windows.Forms.Panel(); - this.button2 = new System.Windows.Forms.Button(); + this.btnplay = new System.Windows.Forms.Button(); this.label3 = new System.Windows.Forms.Label(); this.pnllevelwon.SuspendLayout(); this.panel1.SuspendLayout(); @@ -68,17 +67,6 @@ this.pnllevelwon.TabIndex = 0; this.pnllevelwon.Visible = false; // - // lbltitle - // - this.lbltitle.Dock = System.Windows.Forms.DockStyle.Top; - this.lbltitle.Location = new System.Drawing.Point(0, 0); - this.lbltitle.Name = "lbltitle"; - this.lbltitle.Size = new System.Drawing.Size(301, 13); - this.lbltitle.TabIndex = 0; - this.lbltitle.Tag = "header2"; - this.lbltitle.Text = "You\'ve reached level 2!"; - this.lbltitle.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // // label1 // this.label1.Dock = System.Windows.Forms.DockStyle.Fill; @@ -86,8 +74,7 @@ this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(301, 139); this.label1.TabIndex = 1; - this.label1.Text = "You have survived this level of Pong. You now have a chance to cash out your Code" + - "points or play on for more."; + this.label1.Text = "{PONG_BEATLEVELDESC}"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // panel1 @@ -100,25 +87,36 @@ this.panel1.Size = new System.Drawing.Size(301, 32); this.panel1.TabIndex = 2; // + // button1 + // + this.button1.Location = new System.Drawing.Point(159, 6); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(93, 23); + this.button1.TabIndex = 1; + this.button1.Text = "{PONG_PLAYON}"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // // btncashout // this.btncashout.Location = new System.Drawing.Point(48, 6); this.btncashout.Name = "btncashout"; this.btncashout.Size = new System.Drawing.Size(93, 23); this.btncashout.TabIndex = 0; - this.btncashout.Text = "Cash out"; + this.btncashout.Text = "{PONG_CASHOUT}"; this.btncashout.UseVisualStyleBackColor = true; this.btncashout.Click += new System.EventHandler(this.btncashout_Click); // - // button1 + // lbltitle // - this.button1.Location = new System.Drawing.Point(159, 6); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(93, 23); - this.button1.TabIndex = 1; - this.button1.Text = "Play on"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); + this.lbltitle.Dock = System.Windows.Forms.DockStyle.Top; + this.lbltitle.Location = new System.Drawing.Point(0, 0); + this.lbltitle.Name = "lbltitle"; + this.lbltitle.Size = new System.Drawing.Size(301, 13); + this.lbltitle.TabIndex = 0; + this.lbltitle.Tag = "header2"; + this.lbltitle.Text = "You\'ve reached level 2!"; + this.lbltitle.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // pnlgamestart // @@ -138,27 +136,27 @@ this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(301, 206); this.label2.TabIndex = 1; - this.label2.Text = resources.GetString("label2.Text"); + this.label2.Text = "{PONG_DESC}"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // panel3 // - this.panel3.Controls.Add(this.button2); + this.panel3.Controls.Add(this.btnplay); this.panel3.Dock = System.Windows.Forms.DockStyle.Bottom; this.panel3.Location = new System.Drawing.Point(0, 248); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(301, 32); this.panel3.TabIndex = 2; // - // button2 + // btnplay // - this.button2.Location = new System.Drawing.Point(100, 6); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(116, 23); - this.button2.TabIndex = 1; - this.button2.Text = "Play some Pong!"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); + this.btnplay.Location = new System.Drawing.Point(100, 6); + this.btnplay.Name = "btnplay"; + this.btnplay.Size = new System.Drawing.Size(116, 23); + this.btnplay.TabIndex = 1; + this.btnplay.Text = "{PONG_PLAY}"; + this.btnplay.UseVisualStyleBackColor = true; + this.btnplay.Click += new System.EventHandler(this.button2_Click); // // label3 // @@ -168,7 +166,7 @@ this.label3.Size = new System.Drawing.Size(301, 42); this.label3.TabIndex = 0; this.label3.Tag = "header2"; - this.label3.Text = "Welcome to Pong."; + this.label3.Text = "{PONG_WELCOME}"; this.label3.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // Pong @@ -200,7 +198,7 @@ private System.Windows.Forms.Panel pnlgamestart; private System.Windows.Forms.Label label2; private System.Windows.Forms.Panel panel3; - private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button btnplay; private System.Windows.Forms.Label label3; } } diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index c260ae3..d8f93f7 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -223,7 +223,7 @@ namespace ShiftOS.WinForms.Applications pnlgamestart.Show(); pnlgamestart.BringToFront(); pnlgamestart.CenterParent(); - Infobox.Show("You lose.", "You lost the game! Guess you should've cashed out..."); + Infobox.Show("{TITLE_PONG_YOULOSE}", "{PROMPT_PONGLOST}"); doAi = false; doBallCalc = false; } @@ -237,7 +237,10 @@ namespace ShiftOS.WinForms.Applications pnllevelwon.CenterParent(); pnllevelwon.Show(); pnllevelwon.BringToFront(); - lbltitle.Text = "You've reached level " + level + "!"; + lbltitle.Text = Localization.Parse("{PONG_LEVELREACHED}", new Dictionary + { + ["%level"] = level.ToString() + }); lbltitle.Height = (int)CreateGraphics().MeasureString(lbltitle.Text, lbltitle.Font).Height; codepointsToEarn += CalculateAIBeatCP() * 2; speedFactor += speedFactor / level; @@ -251,8 +254,12 @@ namespace ShiftOS.WinForms.Applications public void Win() { - header = "You beat the AI! " + CalculateAIBeatCP() + " Codepoints!."; + header = Localization.Parse("{PONG_BEATAI}", new Dictionary + { + ["%amount"] = CalculateAIBeatCP().ToString() + }); InitializeCoordinates(); + counterTimer.Stop(); new System.Threading.Thread(() => { doBallCalc = false; @@ -265,6 +272,10 @@ namespace ShiftOS.WinForms.Applications doBallCalc = true; header = ""; counter = ""; + Desktop.InvokeOnWorkerThread(() => + { + counterTimer.Start(); + }); }).Start(); } @@ -322,7 +333,10 @@ namespace ShiftOS.WinForms.Applications //draw opponent e.Graphics.FillRectangle(new SolidBrush(pnlcanvas.ForeColor), new RectangleF((float)(pnlcanvas.Width - (paddleWidth*2)), (float)(opponentYLocal - (float)(paddleHeight / 2)), (float)paddleWidth, (float)paddleHeight)); - string cp_text = Localization.Parse("{CODEPOINTS}: " + codepointsToEarn); + string cp_text = Localization.Parse("{PONG_STATUSCP}", new Dictionary + { + ["%cp"] = codepointsToEarn.ToString() + }); var tSize = e.Graphics.MeasureString(cp_text, SkinEngine.LoadedSkin.Header3Font); @@ -346,7 +360,11 @@ namespace ShiftOS.WinForms.Applications ); e.Graphics.DrawString(header, SkinEngine.LoadedSkin.Header2Font, new SolidBrush(pnlcanvas.ForeColor), tLoc); - string l = Localization.Parse("{LEVEL}: " + level + " - " + secondsleft + " {SECONDS_LEFT}"); + string l = Localization.Parse("{PONG_STATUSLEVEL}", new Dictionary + { + ["%level"] = level.ToString(), + ["%time"] = secondsleft.ToString() + }); tSize = e.Graphics.MeasureString(l, SkinEngine.LoadedSkin.Header3Font); tLoc = new PointF((pnlcanvas.Width - (int)tSize.Width) / 2, @@ -412,7 +430,11 @@ namespace ShiftOS.WinForms.Applications SaveSystem.CurrentSave.Codepoints += (ulong)codepointsToEarn; level = 1; speedFactor = 0.0125; - Infobox.Show("Codepoints transferred.", "Pong has transferred " + codepointsToEarn + " Codepoints to your system."); + Infobox.Show("{TITLE_CODEPOINTSTRANSFERRED}", Localization.Parse("{PROMPT_CODEPOINTSTRANSFERRED}", new Dictionary + { + ["%transferrer"] = "Pong", + ["%amount"] = codepointsToEarn.ToString() + })); codepointsToEarn = 0; pnlgamestart.Show(); pnlgamestart.BringToFront(); diff --git a/ShiftOS.WinForms/Applications/Pong.resx b/ShiftOS.WinForms/Applications/Pong.resx index 685deff..1af7de1 100644 --- a/ShiftOS.WinForms/Applications/Pong.resx +++ b/ShiftOS.WinForms/Applications/Pong.resx @@ -117,11 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Pong is the modern-day recreation of the classic 70s game called, you guessed it, Pong. - -In Pong, you must try your best to keep the fast-moving ball from going past your side of the screen using your mouse to move your paddle in the way of the ball, while getting the ball to go past the opponent's paddle. - -Once you start Pong, you have 60 seconds to beat the opponent and survive as much as possible. The game will get faster as you play, and the more 60-second levels you play, the more Codepoints you'll earn. If you lose the level, you will start back at Level 1 with 0 Codepoints. At the end of the level, you may choose to cash out or play on. - \ No newline at end of file diff --git a/ShiftOS.WinForms/MainMenu/Loading.Designer.cs b/ShiftOS.WinForms/MainMenu/Loading.Designer.cs index 95619d9..5cf42d6 100644 --- a/ShiftOS.WinForms/MainMenu/Loading.Designer.cs +++ b/ShiftOS.WinForms/MainMenu/Loading.Designer.cs @@ -40,7 +40,7 @@ this.label.Name = "label"; this.label.Size = new System.Drawing.Size(284, 262); this.label.TabIndex = 0; - this.label.Text = "Loading..."; + this.label.Text = "{GEN_LOADING}"; this.label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // Loading diff --git a/ShiftOS.WinForms/MainMenu/Loading.cs b/ShiftOS.WinForms/MainMenu/Loading.cs index 555f1d4..c1c0ba0 100644 --- a/ShiftOS.WinForms/MainMenu/Loading.cs +++ b/ShiftOS.WinForms/MainMenu/Loading.cs @@ -16,6 +16,7 @@ namespace ShiftOS.WinForms.MainMenu public Loading() { InitializeComponent(); + label.Text = Localization.Parse(label.Text); } private void Loading_FormShown(object sender, EventArgs e) diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs index b716b4e..a9291d3 100644 --- a/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs +++ b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs @@ -36,8 +36,6 @@ this.button5 = new System.Windows.Forms.Button(); this.lbticker = new System.Windows.Forms.Label(); this.pnloptions = new System.Windows.Forms.Panel(); - this.txtubase = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); this.txtdsport = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.txtdsaddress = new System.Windows.Forms.TextBox(); @@ -81,7 +79,7 @@ this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(181, 23); this.button1.TabIndex = 0; - this.button1.Text = "Campaign"; + this.button1.Text = "{MAINMENU_CAMPAIGN}"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // @@ -92,7 +90,7 @@ this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(181, 23); this.button2.TabIndex = 1; - this.button2.Text = "Sandbox"; + this.button2.Text = "{MAINMENU_SANDBOX}"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // @@ -103,7 +101,7 @@ this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(181, 23); this.button3.TabIndex = 2; - this.button3.Text = "Settings"; + this.button3.Text = "{GEN_SETTINGS}"; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); // @@ -114,7 +112,7 @@ this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(181, 23); this.button4.TabIndex = 3; - this.button4.Text = "About"; + this.button4.Text = "{GEN_ABOUT}"; this.button4.UseVisualStyleBackColor = true; // // button5 @@ -124,7 +122,7 @@ this.button5.Name = "button5"; this.button5.Size = new System.Drawing.Size(181, 23); this.button5.TabIndex = 4; - this.button5.Text = "Exit"; + this.button5.Text = "{GEN_EXIT}"; this.button5.UseVisualStyleBackColor = true; this.button5.Click += new System.EventHandler(this.button5_Click); // @@ -140,8 +138,6 @@ // // pnloptions // - this.pnloptions.Controls.Add(this.txtubase); - this.pnloptions.Controls.Add(this.label3); this.pnloptions.Controls.Add(this.txtdsport); this.pnloptions.Controls.Add(this.label2); this.pnloptions.Controls.Add(this.txtdsaddress); @@ -149,25 +145,9 @@ this.pnloptions.Controls.Add(this.flowLayoutPanel1); this.pnloptions.Location = new System.Drawing.Point(49, 26); this.pnloptions.Name = "pnloptions"; - this.pnloptions.Size = new System.Drawing.Size(432, 290); + this.pnloptions.Size = new System.Drawing.Size(432, 167); this.pnloptions.TabIndex = 2; // - // txtubase - // - this.txtubase.Location = new System.Drawing.Point(146, 133); - this.txtubase.Name = "txtubase"; - this.txtubase.Size = new System.Drawing.Size(225, 20); - this.txtubase.TabIndex = 6; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(22, 136); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(106, 13); - this.label3.TabIndex = 5; - this.label3.Text = "Unite API base URL:"; - // // txtdsport // this.txtdsport.Location = new System.Drawing.Point(146, 85); @@ -180,9 +160,9 @@ this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(22, 88); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(99, 13); + this.label2.Size = new System.Drawing.Size(125, 13); this.label2.TabIndex = 3; - this.label2.Text = "Digital Society Port:"; + this.label2.Text = "{MAINMENU_DSPORT}"; // // txtdsaddress // @@ -196,9 +176,9 @@ this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(22, 57); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(118, 13); + this.label1.Size = new System.Drawing.Size(147, 13); this.label1.TabIndex = 1; - this.label1.Text = "Digital Society Address:"; + this.label1.Text = "{MAINMENU_DSADDRESS}"; // // flowLayoutPanel1 // @@ -208,7 +188,7 @@ this.flowLayoutPanel1.Controls.Add(this.btnsave); this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 259); + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 136); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Size = new System.Drawing.Size(432, 31); this.flowLayoutPanel1.TabIndex = 0; @@ -218,11 +198,11 @@ this.opt_btncancel.AutoSize = true; this.opt_btncancel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.opt_btncancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.opt_btncancel.Location = new System.Drawing.Point(377, 3); + this.opt_btncancel.Location = new System.Drawing.Point(331, 3); this.opt_btncancel.Name = "opt_btncancel"; - this.opt_btncancel.Size = new System.Drawing.Size(52, 25); + this.opt_btncancel.Size = new System.Drawing.Size(98, 25); this.opt_btncancel.TabIndex = 0; - this.opt_btncancel.Text = "Cancel"; + this.opt_btncancel.Text = "{GEN_CANCEL}"; this.opt_btncancel.UseVisualStyleBackColor = true; this.opt_btncancel.Click += new System.EventHandler(this.opt_btncancel_Click); // @@ -231,11 +211,11 @@ this.btnsave.AutoSize = true; this.btnsave.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.btnsave.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnsave.Location = new System.Drawing.Point(327, 3); + this.btnsave.Location = new System.Drawing.Point(241, 3); this.btnsave.Name = "btnsave"; - this.btnsave.Size = new System.Drawing.Size(44, 25); + this.btnsave.Size = new System.Drawing.Size(84, 25); this.btnsave.TabIndex = 1; - this.btnsave.Text = "Save"; + this.btnsave.Text = "{GEN_SAVE}"; this.btnsave.UseVisualStyleBackColor = true; this.btnsave.Click += new System.EventHandler(this.btnsave_Click); // @@ -259,7 +239,7 @@ this.btnnewgame.Name = "btnnewgame"; this.btnnewgame.Size = new System.Drawing.Size(181, 23); this.btnnewgame.TabIndex = 0; - this.btnnewgame.Text = "New Game"; + this.btnnewgame.Text = "{MAINMENU_NEWGAME}"; this.btnnewgame.UseVisualStyleBackColor = true; this.btnnewgame.Click += new System.EventHandler(this.btnnewgame_Click); // @@ -270,7 +250,7 @@ this.btncontinue.Name = "btncontinue"; this.btncontinue.Size = new System.Drawing.Size(181, 23); this.btncontinue.TabIndex = 1; - this.btncontinue.Text = "Continue"; + this.btncontinue.Text = "{GEN_CONTINUE}"; this.btncontinue.UseVisualStyleBackColor = true; this.btncontinue.Click += new System.EventHandler(this.btncontinue_Click); // @@ -281,7 +261,7 @@ this.button10.Name = "button10"; this.button10.Size = new System.Drawing.Size(181, 23); this.button10.TabIndex = 4; - this.button10.Text = "Back"; + this.button10.Text = "{GEN_BACK}"; this.button10.UseVisualStyleBackColor = true; this.button10.Click += new System.EventHandler(this.button10_Click); // @@ -357,8 +337,6 @@ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.Button opt_btncancel; private System.Windows.Forms.Button btnsave; - private System.Windows.Forms.TextBox txtubase; - private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox txtdsport; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox txtdsaddress; diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.cs b/ShiftOS.WinForms/MainMenu/MainMenu.cs index 1936fec..7ace42a 100644 --- a/ShiftOS.WinForms/MainMenu/MainMenu.cs +++ b/ShiftOS.WinForms/MainMenu/MainMenu.cs @@ -116,29 +116,7 @@ namespace ShiftOS.WinForms.MainMenu 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."; - case 6: - return "There's no bugs in this game... But if you find some, please submit them to http://getshiftos.ml/Bugs."; - case 7: - return "SHIFTOS - PROPERTY OF MICHAEL VANOVERBEEK. FOR INTERNAL USE ONLY. Build number = sos_tr_133764 [Just kidding. ShiftOS is open-source. Find the code at http://github.com/shiftos-game/ShiftOS!]"; - case 8: - return "Hold your Codepoints against the wall... when they take everything away. Hold your Codepoints against the wall..."; - default: - return "Good God. We don't know what to put here."; - } + return Localization.Parse("{MAINMENU_TIPTEXT_" + rnd.Next(10) + "}"); } private void button1_Click(object sender, EventArgs e) @@ -175,7 +153,6 @@ namespace ShiftOS.WinForms.MainMenu { var conf = ShiftOS.Objects.UserConfig.Get(); - txtubase.Text = conf.UniteUrl; txtdsaddress.Text = conf.DigitalSocietyAddress; txtdsport.Text = conf.DigitalSocietyPort.ToString(); @@ -201,32 +178,14 @@ namespace ShiftOS.WinForms.MainMenu int p = 0; - if(int.TryParse(txtdsport.Text, out p) == false) + if(int.TryParse(txtdsport.Text, out p) == false || p < 0 || p > 65535) { - Infobox.Show("Invalid port number", "The Digital Society Port must be a valid whole number between 0 and 65535."); + Infobox.Show("{TITLE_INVALIDPORT}", "{PROMPT_INVALIDPORT}"); return; } - else - { - if(p < 0 || p > 65535) - { - Infobox.Show("Invalid port number", "The Digital Society Port must be a valid whole number between 0 and 65535."); - return; - } - } conf.DigitalSocietyPort = p; - string unite = txtubase.Text; - if (unite.EndsWith("/")) - { - int len = unite.Length; - int index = len - 1; - int end = 1; - unite = unite.Remove(index, end); - } - conf.UniteUrl = unite; - System.IO.File.WriteAllText("servers.json", Newtonsoft.Json.JsonConvert.SerializeObject(conf, Newtonsoft.Json.Formatting.Indented)); HideOptions(); diff --git a/ShiftOS.WinForms/Resources/strings_en.txt b/ShiftOS.WinForms/Resources/strings_en.txt index f63f0e0..a3b407b 100644 --- a/ShiftOS.WinForms/Resources/strings_en.txt +++ b/ShiftOS.WinForms/Resources/strings_en.txt @@ -1,244 +1,134 @@ +/* + * ShiftOS English Language Pack + * + * This is the default language pack distributed within the game. + */ + { - "{SUBMIT}":"Submit", + //General strings + //These strings can be used anywhere in the UI where language context isn't necessary. + "{GEN_PROGRAMS}": "Programs", + "{GEN_COMMANDS}": "Commands", + "{GEN_OBJECTIVES}": "Objectives", + "{GEN_CURRENTPROCESSES}": "Current processes", + "{GEN_WELCOME}": "Welcome to ShiftOS.", + "{GEN_SYSTEMNAME}": "System name", + "{GEN_PASSWORD}": "Password", + "{GEN_LPROMPT}": "%sysname login: ", + "{GEN_SYSTEMSTATUS}": "System status", + "{GEN_USERS}": "Users", + "{GEN_CODEPOINTS}": "Codepoints", + "{GEN_LOADING}": "Loading...", + "{GEN_SAVE}": "Save", + "{GEN_CANCEL}": "Cancel", + "{GEN_CONTINUE}": "Continue", + "{GEN_BACK}": "Back", + "{GEN_YES}": "Yes", + "{GEN_NO}": "No", + "{GEN_OK}": "OK", + "{GEN_SETTINGS}": "Settings", + "{GEN_ABOUT}": "About", + "{GEN_EXIT}": "Exit", -"{TERMINAL_TUTORIAL_1}":"Welcome to the ShiftOS terminal. This is where you will spend the bulk of your time within ShiftOS. - -A brief rundown of how to use the terminal is as follows. You can use the 'sos.help' command to show a list of all commands. Simply type it in and strike to view all commands. - -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:1,op2:2} -set.value{key:\"somekey\", value:true} - -You have been given 50 Codepoints - use your knowledge to use them to buy the MUD Fundamentals Shiftorium Upgrade using the terminal. -To buy MUD Fundamentals, type shiftorium.buy{upgrade:\"mud_fundamentals\"} This is also true for any other thing you want to buy from the shiftorium, just replace mud_fundementals with any other upgrade id. -", + //General errors + //Syntax errors, command errors, you name it.. + "{ERR_BADBOOL}": "The value you entered must be either true or false.", + "{ERR_BADPERCENT}": "The value you entered must be a value from 0 to 100.", + "{ERR_NOLANG}": "The language you entered does not exist!", + "{ERR_NOTENOUGHCODEPOINTS}": "You don't have enough Codepoints to do that.", + "{ERR_NOUPGRADE}": "We couldn't find that upgrade.", + "{ERR_GENERAL}": "An error has occurred performing this operation.", + "{ERR_EMPTYCATEGORY}": "The category you specified either has no items in it, or was not found.", + "{ERR_NOMOREUPGRADES}": "There are no more Shiftorium Upgrades to show!", + "{ERR_BADWINID}": "You must specify a value between 0 and %max.", + "{ERR_USERFOUND}": "That user already exists.", + "{ERR_NOUSER}": "That user was not found.", + "{ERR_REMOVEYOU}": "You can't remove your own user account.", + "{ERR_BADACL}": "You must specify a value between 0 (guest) and 3 (root) for a user permission.", + "{ERR_ACLHIGHERVALUE}": "You can't set a user's permissions to a value higher than your own.", + "{ERR_HIGHERPERMS}": "That user has more rights than you!", + "{ERR_PASSWD_MISMATCH}": "Passwords don't match!", + //Command results + "{RES_ACLUPDATED}": "User permissions updated.", + "{RES_LANGUAGE_CHANGED}": "System language changed successfully.", + "{RES_NOOBJECTIVES}": "No objectives to display! Check back for more.", + "{RES_UPGRADEINSTALLED}": "Upgrade installed!", + "{RES_WINDOWCLOSED}": "The window was closed.", + "{RES_CREATINGUSER}": "Creating new user with username %name.", + "{RES_REMOVINGUSER}": "Removing user with username %name from your system.", + "{RES_DENIED}": "Access denied.", + "{RES_GRANTED}": "Access granted.", + "{RES_PASSWD_SET}": "Password set successfully.", - "{TERMINAL_TUTORIAL_2}":"You successfully passed the test. ShiftOS will now start installing it's base functionality.", - "{ABOUT}":"About", - "{HIGH_SCORES}":"High scores", - "{PONG_VIEW_HIGHSCORES}":"See the high scores", - "{PONG_HIGHSCORE_EXP}":"Want to see what other users have gotten?", - "{START_SYSTEM_SCAN}":"Start system-wide scan", - "{SCAN_HOME}":"Scan 0:/home", - "{SCAN_SYSTEM}":"Scan 0:/system", - "{RESULTS}":"Results", - "{VIRUSSCANNER_ABOUT}":"Welcome to the ShiftOS virus scanner. - -The ShiftOS virus scanner is a utility that allows you to scan any file on your system and see if it is a virus. If a virus is detected, you have the option to delete it after the scan by clicking 'Remove'. + //Shiftorium messages. + "{SHFM_UPGRADE}": "%id - %cost Codepoints", + "{SHFM_CATEGORY}": " - %name: %available upgrades left.", + "{SHFM_QUERYERROR}": "Shiftorium Query Error", + "{SHFM_NOUPGRADES}": "No upgrades!", -If a system file is deleted by the virus scanner, it will be replaced.", - "{PLAY}":"Play", - "{APPLICATIONS}":"Applications", - "{TERMINAL}":"Terminal", - "{PONG}":"Pong", - "{CODEPOINTS}":"Codepoints", - "{SHIFTORIUM}":"Shiftorium", - "{HACK}":"Hack", - "{SHIFTER}":"Shifter", - "{MUD_SHORT}":"MUD", - "{MUD}":"Multi-user domain", - "{DESKTOP}":"Desktop", - "{WINDOW}":"Window", - "{WINDOW_MANAGER}":"Window manager", - "{UPGRADE}":"Upgrade", - "{UPGRADES}":"Upgrades", - "{APPLICATION}":"Application", - "{SCRIPT}":"Script", - "{ERROR}":"Error", - "{SCRIPTS}":"Scripts", - "{NULL}":"null", - "{ID}":"ID Num", - "{SYSTEM_INITIATED}":"System initiated", - "{PASSWORD}":"Password", - "{CRACK}":"Crack", - "{ARTPAD_UNDO_ERROR}":"Artpad - Undo error", - "{ARTPAD_NEXT_STEP_WILL_KILL_CANVAS_JUST_FLIPPING_CLICK_NEW}":"You cannot undo the previous action as it would delete the canvas. If you'd like to clear the canvas, click New.", - "{ARTPAD_REDO_ERROR}":"Artpad - Redo error", - "{ARTPAD_NOTHING_TO_REDO}": "Artpad has nothing to redo! Remember that when you undo and then draw on the canvas, all redo history is wiped.", - "{ARTPAD_MAGNIFIER_ERROR}": "Artpad - Magnifier error", - "{ARTPAD_MAGNIFICATION_ERROR_EXP_2}": "Artpad cannot zoom out any further as the canvas would disappear!", - "{ARTPAD_MAGNIFICATION_ERROR_EXP}": "Artpad cannot zoom any further into the canvas. Well, it can, it just doesn't want to.", - "{SHUTDOWN}":"Shutdown", - "{CONNECTING_TO_MUD}":"Connecting to the multi-user domain...", - "{READING_FS}":"Reading filesystem...", - "{INIT_KERNEL}":"Initiating kernel...", - "{START_DESKTOP}":"Starting desktop session...", - "{DONE}": "done", - "{READING_CONFIG}":"Reading configuration...", - "{ID_TAKEN}":"ID has been taken! Use chat.join to join this chat.", - "{CHAT_NOT_FOUND_OR_TOO_MANY_MEMBERS}":"This chat either doesn't exist or has too many users in it.", - "{CHAT_NOT_FOUND_OR_NOT_IN_CHAT}":"You are not currently in this chat.", - "{CHAT_PLEASE_PROVIDE_VALID_CHANNEL_DATA}":"You did not specify valid chat metadata! Please do chat.create{id:\"your_id\", name:\"Your chat\", topic:\"Your chat's topic\"}.", - "{UPGRADE_PROGRESS}":"Upgrade progress", - "{WIN_PROVIDEID}":"Please provide a valid Window ID from win.list.", - "{WIN_CANTCLOSETERMINAL}":"You cannot close this terminal.", - "{WELCOME_TO_SHIFTORIUM}":"Welcome to the Shiftorium", - "{SUCCESSFULLY_CREATED_CHAT}":"Successfully created chat. Use chat.join{id:\"chat_id_here\"} to join it.", - "{CHAT_HAS_JOINED}":"has joined the chat.", - "{HAS_LEFT_CHAT}":"has left the chat.", - "{SHIFTORIUM_EXP}":"The Shiftorium is your one-stop-shop for ShiftOS system enhancements, upgrades and applications. - - You can buy upgrades in the Shiftorium using a currency called Codepoints, which you can earn by doing various tasks within ShiftOS, such as playing Pong, stealing them from other users, and finding ways to make your own. It's up to you how you get your Codepoints. - - You can then use them to buy new applications, features, enhancements and upgrades for ShiftOS that make the user experience a lot better. Be careful though, buying too many system enhancements without buying new ways of earning Codepoints first can leave you in the dust and unable to upgrade the system. - - Anyways, feel free to browse from our wonderful selection! You can see a list of available upgrades on the left, as well as a progress bar showing how much you've upgraded the system compared to how much you still can.", - "{PONG_WELCOME}":"Welcome to Pong.", - "{PONG_DESC}":"Pong is an arcade game where your goal is to get the ball past the opponent paddle while keeping it from getting past yours. - - In ShiftOS, Pong is modified - you only have one chance, the game is divided into 60 second levels, and you can earn Codepoints by surviving a level, and beating the opponent.", - "{NO_APP_TO_OPEN}":"No app found for this file!", - "{NO_APP_TO_OPEN_EXP}":"File Skimmer could not find an application that can open this file.", - "{CLIENT_DIAGNOSTICS}":"Client diagnostics", - "{GUID}":"GUID", - "{CLIENT_DATA}":"Client data", - "{CLOSE}":"Close", - "{LOAD_DEFAULT}":"Load default", - "{IMPORT}":"Import", - "{EXPORT}":"Export", - "{APPLY}":"Apply", - "{TEMPLATE}":"Template", - "{H_VEL}":"Horizontal velocity", - "{V_VEL}":"Vertical velocity", - "{LEVEL}":"Level", - "{UPGRADE_DEVELOPMENT}":"Development Upgrade", - "{UPGRADE_DEVELOPMENT_DESCRIPTION}":"Development Upgrade Don't Buy", - "{SECONDS_LEFT}":"seconds left", - "{CASH_OUT_WITH_CODEPOINTS}":"Cash out with your codepoints", - "{PONG_PLAY_ON_FOR_MORE}":"Play on for more!", - "{YOU_REACHED_LEVEL}":"You've reached level", - "{PONG_BEAT_AI_REWARD}":"Reward for beating AI (CP)", - "{PONG_BEAT_AI_REWARD_SECONDARY}":"Codepoints for beating AI:", - "{CODEPOINTS_FOR_BEATING_LEVEL}":"Codepoints for beating level", - "{YOU_WON}":"You won", - "{YOU_LOSE}":"You lose", - "{TRY_AGAIN}":"Try again", - "{CODEPOINTS_SHORT}":"CP", - "{TERMINAL_FORMATTING_DRIVE}":"Formatting drive... %percent %", - "{INSTALLING_SHIFTOS}":"Installing ShiftOS on %domain.", - "{YOU_MISSED_OUT_ON}":"You missed out on", - "{BUT_YOU_GAINED}":"But you gained", - "{PONG_PLAYON_DESC}":"Or do you want to try your luck on the next level to increase your reward?", - "{PONG_CASHOUT_DESC}":"Would you like the end the game now and cash out with your reward?", - "{INITIAL_H_VEL}":"Initial H Vel", - "{INITIAL_V_VEL}":"Initial V Vel", - "{INC_H_VEL}":"Increment H Vel", - "{INC_V_VEL}":"Increment V Vel", - "{MULTIPLAYER_ONLY}":"Program not compatible with single-user domain.", - "{MULTIPLAYER_ONLY_EXP}":"This program cannot run within a single-user domain. You must be within a multi-user domain to use this program.", - "{SHIFTER_SKIN_APPLIED}":"Shifter - Settings applied!", - "{YOU_HAVE_EARNED}":"You have earned", - "{CREATING_PATH}":"Creating directory: %path", - "{CREATING_FILE}":"Creating file: %path", - "{SHIFTORIUM_HELP_DESCRIPTION}": "Help Descriptions", - "{CREATING_USER}":"Creating user %username", - "{SEPERATOR}":" - ", - "{NAMESPACE}":"Namespace ", - "{COMMAND}": "| Command ", - "{SHIFTOS_HAS_BEEN_INSTALLED}":"ShiftOS has been installed on %domain.", - "{WARN}": "WARN: ", - "{ERROR}": "!ERROR! ", - "{OBSOLETE_CHEATS_FREECP}": "The %ns.%cmd command is obsolete and has been replaced with %newcommand", - "{REBOOTING_SYSTEM}":"Rebooting system in %i seconds...", - "{ERROR_ARGUMENT_REQUIRED}": "You must supply an %argument value", - "{ERROR_ARGUMENT_REQUIRED_NO_USAGE}": "You are missing some arguments.", - "{GENERATING_PATHS}":"Generating paths...", - "{ERROR_COMMAND_WRONG}": "Check your syntax and try again", - "{LOGIN_EXP}": "Login as the admin of the multi user domain.", - - "{USAGE}": "Usage: ", - - "{NAMESPACE_SOS_DESCRIPTION}":"The ShiftOS Namespace", - "{COMMAND_HELP_USAGE}":"%ns.%cmd{[topic:]}", - "{COMMAND_HELP_DESCRIPTION}":"Lists all commands", - "{COMMAND_SOS_SHUTDOWN_USAGE}":"%ns.%cmd", - "{COMMAND_SOS_SHUTDOWN_DESCRIPTION}":"Saves and shuts down ShiftOS", - "{COMMAND_SOS_STATUS_USAGE}":"%ns.%cmd", - "{COMMAND_SOS_STATUS_DESCRIPTION}":"Displays how many codepoints you have", - "{COMMAND_SOS_LANG_USAGE}":"%ns.%cmd{language:\"deutsch\"}", - "{COMMAND_SOS_LANG_DESCRIPTION}":"Change the language.", - "{COMMAND_DEV_CRASH_USAGE}":"%ns.%cmd", - "{COMMAND_DEV_CRASH_DESCRIPTION}":"Shuts down ShiftOS forcefully", - "{COMMAND_DEV_UNLOCKEVERYTHING_USAGE}":"%ns.%cmd", - "{COMMAND_DEV_UNLOCKEVERYTHING_DESCRIPTION}":"Unlocks all shiftorium upgrades", - "{COMMAND_DEV_FREECP_USAGE}":"%ns.%cmd{amount:1000}", - "{COMMAND_DEV_FREECP_DESCRIPTION}":"Gives [amount] codepoints", - "{COMMAND_TRM_CLEAR_USAGE}":"%ns.%cmd", - "{COMMAND_TRM_CLEAR_DESCRIPTION}":"Clears the terminal", - "{COMMAND_SHIFTORIUM_BUY_USAGE}":"%ns.%cmd{upgrade:}", - "{COMMAND_SHIFTORIUM_BUY_DESCRIPTION}":"Buys [upgrade]", - "{COMMAND_SHIFTORIUM_LIST_USAGE}":"%ns.%cmd", - "{COMMAND_SHIFTORIUM_LIST_DESCRIPTION}":"Lists the upgrades that you can get", - "{COMMAND_SHIFTORIUM_INFO_USAGE}":"%ns.%cmd{upgrade:}", - "{COMMAND_SHIFTORIUM_INFO_DESCRIPTION}":"Gives a description about an upgrade", - "{COMMAND_DEV_MULTARG_USAGE}":"%ns.%cmd{id:,name:,type:}", - "{COMMAND_DEV_MULTARG_DESCRIPTION}":"A command which requiers multiple arguments", + //Command data strings + "{COM_STATUS}": "ShiftOS build %version\r\n\r\nCodepoints: %cp \r\n Upgrades: %installed installed, %available available\r\n\r\n", + "{COM_UPGRADEINFO}": "%category: %name - %cost Codepoints.\r\n\r\n%description\r\n\r\nUpgrade ID: %id", - "{ERR_COMMAND_NOT_FOUND}":"Command not found.", - "{ERROR_EXCEPTION_THROWN_IN_METHOD}":"An error occurred within the command. Error details:", - "{MUD_ERROR}":"MUD error", - - "{PROLOGUE_NO_USER_DETECTED}":"No user detected. Please enter a username.", - "{PROLOGUE_BADUSER}":"Invalid username detected.", - "{PROLOGUE_NOSPACES}":"Usernames must not contain spaces.", - "{PROLOGUE_PLEASE_ENTER_USERNAME}":"Please enter a valid username. Blank usernames are not permitted.", + //Terminal Command Descriptions + //These strings show up when running the "commands" command in your Terminal. + "{DESC_CLEAR}": "Clears the screen of the current Terminal.", + "{DESC_SETSFXENABLED}": "Sets whether or not system sounds are enabled.", + "{DESC_SETMUSICENABLED}": "Sets whether or not music is enabled in ShiftOS.", + "{DESC_SETVOLUME}": "Sets the volume of sounds and music if they're enabled.", + "{DESC_SHUTDOWN}": "Safely shuts down your computer.", + "{DESC_LANG}": "Change the system language of ShiftOS.", + "{DESC_COMMANDS}": "Shows a list of Terminal commands inside ShiftOS.", + "{DESC_HELP}": "Type this command to get general help with using ShiftOS.", + "{DESC_SAVE}": "Saves the in-memory configuration of ShiftOS.", + "{DESC_STATUS}": "Shows basic status information such as how many Codepoints you have and your current objective.", + "{DESC_BUY}": "Buys the specified Shiftorium upgrade.", + "{DESC_BULKBUY}": "Buys the specified Shiftorium upgrades in bulk.", + "{DESC_UPGRADEINFO}": "Shows information about the specified Shiftorium upgrade.", + "{DESC_UPGRADECATEGORIES}": "Shows all the available Shiftorium categories and how many upgrades are available in them.", + "{DESC_UPGRADES}": "Shows a list of available Shiftorium upgrades.", + "{DESC_PROCESSES}": "Shows a list of currently running app processes.", + "{DESC_PROGRAMS}": "Shows a list of programs you can run.", + "{DESC_CLOSE}": "Closes the specified application window.", + "{DESC_ADDUSER}": "Add a user to your system.", + "{DESC_REMOVEUSER}": "Remove a user from your computer.", + "{DESC_SETUSERPERMISSIONS}": "Set the permissions of a user.", + "{DESC_USERS}": "Lists all users on your computer.", + "{DESC_SU}": "Change your identity to another user's.", + "{DESC_PASSWD}": "Change your user account password.", - "{SHIFTORIUM_NOTENOUGHCP}":"Not enough codepoints: ", - "{SHIFTORIUM_TRANSFERRED_FROM}":"Received Codepoints from", - "{SHIFTORIUM_TRANSFERRED_TO}":"Transferred Codepoints to", + //Window titles. + "{TITLE_PONG_YOULOSE}": "You lose", + "{TITLE_CODEPOINTSTRANSFERRED}": "Codepoints transferred.", + "{TITLE_INVALIDPORT}": "Invalid port number.", - "{SE_SAVING}":"Saving game to disk", - "{SE_TIPOFADVICE}":"Tip of advice: ShiftOS will always save your game after big events or when you shut down the operating system. You can also invoke a save yourself using 'sos.save'.", + //Infobox prompt messages + "{PROMPT_PONGLOST}": "You lost this game of Pong. Guess you should've cashed out...", + "{PROMPT_CODEPOINTSTRANSFERRED}": "%transferrer has transferred %amount Codepoints to your system.", + "{PROMPT_INVALIDPORT}": "The Digital Society Port must be a valid whole number between 0 and 65535.", - "{STORY_WELCOME}":"Welcome to ShiftOS", - "{STORY_SENTIENCEUNKNOWN}":"Your sentience is currently unknown. Please strike the Enter key to prove you are alive.", + //Pong + "{PONG_LEVELREACHED}": "You've reached level %level!", + "{PONG_BEATAI}": "You've beaten the opponent! %amount Codepoints!", + "{PONG_STATUSCP}": "Codepoints: %cp", + "{PONG_STATUSLEVEL}": "Level %level. %time seconds to go!", + "{PONG_PLAY}": "Play some Pong!", + "{PONG_DESC}": "Pong is the modern-day recreation of the classic 70s game called, you guessed it, Pong.\r\n\r\nIn Pong, you must try your best to keep the fast-moving ball from going past your side of the screen using your mouse to move your paddle in the way of the ball, while getting the ball to go past the opponent's paddle.\r\n\r\nOnce you start Pong, you have 60 seconds to beat the opponent and survive as much as possible. The game will get faster as you play, and the more 60-second levels you play, the more Codepoints you'll earn. If you lose the level, you will start back at Level 1 with 0 Codepoints. At the end of the level, you may choose to cash out or play on.", + "{PONG_WELCOME}": "Welcome to Pong.", + "{PONG_BEATLEVELDESC}": "You have survived this level of Pong. You now have a chance to cash out your Codepoints or play on for more.", + "{PONG_PLAYON}": "Play on", + "{PONG_CASHOUT}": "Cash out", - "{SENTIENCE_BASIC}":"Sentience: Basic - User can respond to basic instructions.", - "{SENTIENCE_BASICPLUS}":"Sentience: Basic+ - User can invoke commands within the ecosystem.", - "{SENTIENCE_POSSIBLEHUMAN}":"Sentience: Possible human - user can perform actions based on a choice.", - "{SENTIENCE_POSSIBLEHUMANPLUS}":"Sentience: Possible human+ - user can infer, and can pass arguments.", - "{SENTIENCE_HUMAN}":"Sentience: Human. Thanks for your patience.", - "{SENTIENCE_INVALIDPASSWORD}":"The password you entered is invalid.", - - "{ARGS_PASSWORD}":"password", + //Main menu tip messages - "{SHIFTOS_PLUS_MOTTO}":"ShiftOS, Shift it YOUR way.", - "{SHIFTOS_VERSION_INFO}":"ShiftOS Version: ", - "{USER_NAME}":"Username", - "{DISCOURSE_INTEGRATION}":"Discourse Integration", - "{SYSTEM_NAME}":"System Name", - "{USER_INFO}":"User Information", - "{SELECT_LANG}":"Select language", - "{WELCOME_TO_SHIFTOS}":"Welcome to ShiftOS Alpha!", - "{CREATE}":"Create", - "{INSTALL}":"Install", - "{ALIAS}":"Alias:", - "{OBSOLETE_SYS_SHUTDOWN}":"sys.shutdown is obsolete", - "{PY_EXCEPTION}":"There was an error running python code.", - "{LUA_ERROR}":"There was an error running lua code.", - "{LANGUAGE_CHANGED}":"The language has been changed. Please restart ShiftOS for changes to take full effect.", + //Main menu - Settings + "{MAINMENU_DSADDRESS}": "Digital Society address: ", + "{MAINMENU_DSPORT": "Digital Society port: ", - "{TERMINAL_NAME}":"Terminal", - "{ARTPAD_NAME}":"Artpad", - "{PONG_NAME}":"Pong", - "{WAV_PLAYER_NAME}":"WAV Player", - "{SHIFTORIUM_NAME}":"Shiftorium", - "{TEXTPAD_NAME}":"TextPad", - "{VIRUS_SCANNER_NAME}":"Virus Scanner", - "{SKIN_LOADER_NAME}":"Skin Loader", - "{SHIFTER_NAME}":"Shifter", - "{NAME_CHANGER_NAME}":"Name Changer", - "{MUD_PASSWORD_CRACKER_NAME}":"Multi-User Domain Password Cracker v1.0", - "{MUD_CONTROL_CENTRE_NAME}":"MUD Control Centre", - "{MUD_AUTHENTICATOR_NAME}":"Multi-User Domain Admin Panel", - "{GRAPHIC_PICKER_NAME}":"Graphic Picker", - "{FILE_SKIMMER_NAME}":"File Skimmer", - "{FILE_DIALOG_NAME}":"File Dialog", - "{DIALOG_NAME}":"Dialog", - "{COLOR_PICKER_NAME}":"Color Picker", - "{CHAT_NAME}":"Chat", - "{NOTIFICATIONS}":"Notifications", -} + //Main Menu - General text + "{MAINMENU_TITLE}": "Main menu", + "{MAINMENU_CAMPAIGN}": "Campaign", + "{MAINMENU_SANDBOX}": "Sandbox", + "{MAINMENU_NEWGAME}": "New game", +} \ No newline at end of file diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index c2e414d..3a2b79a 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -38,118 +38,26 @@ using Newtonsoft.Json; using System.IO.Compression; using ShiftOS.Objects; -using Discoursistency.Base.Models.Authentication; using ShiftOS.Engine.Scripting; using ShiftOS.Objects.ShiftFS; namespace ShiftOS.Engine { - [RequiresUpgrade("desktop;wm_free_placement")] - public static class InfoboxDebugCommands - { - - [RequiresArgument("title")] - [RequiresArgument("msg")] - [Command("show")] - public static bool ShowInfo(Dictionary args) - { - Desktop.InvokeOnWorkerThread(new Action(() => - { - Infobox.Show(args["title"].ToString(), args["msg"].ToString()); - })); - return true; - } - - [RequiresArgument("title")] - [RequiresArgument("msg")] - [Command("yesno")] - public static bool ShowYesNo(Dictionary args) - { - bool forwarding = TerminalBackend.IsForwardingConsoleWrites; - var fGuid = TerminalBackend.ForwardGUID; - Action callback = (result) => - { - TerminalBackend.IsForwardingConsoleWrites = forwarding; - TerminalBackend.ForwardGUID = (forwarding == true) ? fGuid : null; - string resultFriendly = (result == true) ? "yes" : "no"; - Console.WriteLine($"{SaveSystem.CurrentUser.Username} says {resultFriendly}."); - TerminalBackend.IsForwardingConsoleWrites = false; - }; - Desktop.InvokeOnWorkerThread(new Action(() => - { - Infobox.PromptYesNo(args["title"].ToString(), args["msg"].ToString(), callback); - - })); - return true; - } - - [RequiresArgument("title")] - [RequiresArgument("msg")] - [Command("text")] - public static bool ShowText(Dictionary args) - { - bool forwarding = TerminalBackend.IsForwardingConsoleWrites; - var fGuid = TerminalBackend.ForwardGUID; - Action callback = (result) => - { - TerminalBackend.IsForwardingConsoleWrites = forwarding; - TerminalBackend.ForwardGUID = (forwarding == true) ? fGuid : null; - Console.WriteLine($"{SaveSystem.CurrentUser.Username} says \"{result}\"."); - TerminalBackend.IsForwardingConsoleWrites = false; - }; - Desktop.InvokeOnWorkerThread(new Action(() => - { - Infobox.PromptText(args["title"].ToString(), args["msg"].ToString(), callback); - })); - return true; - } - - } - - public static class AudioCommands - { - [Command("setvol", description = "Set the volume of the system audio to anywhere between 0 and 100.")] - [RequiresArgument("value")] - [RequiresUpgrade("audio_volume")] - public static bool SetVolume(Dictionary args) - { - int val = Convert.ToInt32(args["value"].ToString()); - float volume = (val / 100F); - AudioManager.SetVolume(volume); - return true; - } - [RequiresUpgrade("audio_volume")] - [Command("mute", description = "Sets the volume of the system audio to 0")] - public static bool MuteAudio() - { - AudioManager.SetVolume(0); - return true; - } - } - [TutorialLock] public static class TerminalCommands { - [Command("clear")] + [Command("clear", description = "{DESC_CLEAR}")] public static bool Clear() { AppearanceManager.ConsoleOut.Clear(); return true; } - - [Command("echo")] - [RequiresArgument("text")] - public static bool Echo(Dictionary args) - { - Console.WriteLine(args["text"]); - return true; - } } public static class ShiftOSCommands { - [Command("setsfxenabled", description = "Set whether or not sound effects are enabled in the system.")] + [Command("setsfxenabled", description = "{DESC_SETSFXENABLED}")] [RequiresArgument("value")] public static bool SetSfxEnabled(Dictionary args) { @@ -161,14 +69,14 @@ namespace ShiftOS.Engine } catch { - Console.WriteLine("Error: Value must be either true or false."); + Console.WriteLine("{ERR_BADBOOL}"); } return true; } - [Command("setmusicenabled", description = "Set whether or not music is enabled in the system.")] + [Command("setmusicenabled", description = "{DESC_SETMUSICENABLED}")] [RequiresArgument("value")] public static bool SetMusicEnabled(Dictionary args) { @@ -180,14 +88,14 @@ namespace ShiftOS.Engine } catch { - Console.WriteLine("Error: Value must be either true or false."); + Console.WriteLine("{ERR_BADBOOL}"); } return true; } - [Command("setsfxvolume", description ="Set the system sound volume to a value between 1 and 100.")] + [Command("setvolume", description ="{DESC_SETVOLUME}")] [RequiresArgument("value")] public static bool SetSfxVolume(Dictionary args) { @@ -199,13 +107,13 @@ namespace ShiftOS.Engine } else { - Console.WriteLine("Volume must be between 0 and 100!"); + Console.WriteLine("{ERR_BADPERCENT}"); } return true; } [RemoteLock] - [Command("shutdown")] + [Command("shutdown", description = "{DESC_SHUTDOWN}")] public static bool Shutdown() { TerminalBackend.InvokeCommand("sos.save"); @@ -213,7 +121,7 @@ namespace ShiftOS.Engine return true; } - [Command("lang", "{COMMAND_SOS_LANG_USAGE}", "{COMMAND_SOS_LANG_DESCRIPTION}")] + [Command("lang", description = "{DESC_LANG}")] [RequiresArgument("language")] public static bool SetLanguage(Dictionary userArgs) { @@ -221,20 +129,17 @@ namespace ShiftOS.Engine { string lang = ""; - if (userArgs.ContainsKey("language")) - lang = (string)userArgs["language"]; - else - throw new Exception("You must specify a valid 'language' value."); - + lang = (string)userArgs["language"]; + if (Localization.GetAllLanguages().Contains(lang)) { SaveSystem.CurrentSave.Language = lang; SaveSystem.SaveGame(); - Console.WriteLine("{LANGUAGE_CHANGED}"); + Console.WriteLine("{RES_LANGUAGE_CHANGED}"); return true; } - throw new Exception($"Couldn't find language with ID: {lang}"); + throw new Exception("{ERR_NOLANG}"); } catch { @@ -242,11 +147,11 @@ namespace ShiftOS.Engine } } - [Command("commands", "", "{COMMAND_COMMANDS_DESCRIPTION}")] + [Command("commands", "", "{DESC_COMMANDS}")] public static bool Commands() { var sb = new StringBuilder(); - sb.AppendLine("Commands"); + sb.AppendLine("{GEN_COMMANDS}"); sb.AppendLine("================="); sb.AppendLine(); //print all unique namespaces. @@ -254,7 +159,7 @@ namespace ShiftOS.Engine { sb.Append(n.CommandInfo.name); if (!string.IsNullOrWhiteSpace(n.CommandInfo.description)) - if (Shiftorium.UpgradeInstalled("help_descriptions")) + if (Shiftorium.UpgradeInstalled("help_description")) sb.Append(" - " + n.CommandInfo.description); sb.AppendLine(); } @@ -264,7 +169,7 @@ namespace ShiftOS.Engine return true; } - [Command("help", description = "Type this command to list all the things you can do in ShiftOS.")] + [Command("help", description = "{DESC_HELP}")] public static bool Help() { Commands(); @@ -274,7 +179,7 @@ namespace ShiftOS.Engine [MultiplayerOnly] - [Command("save")] + [Command("save", description = "{DESC_SAVE}")] public static bool Save() { SaveSystem.SaveGame(); @@ -282,19 +187,23 @@ namespace ShiftOS.Engine } [MultiplayerOnly] - [Command("status")] + [Command("status", description = "{DESC_STATUS}")] public static bool Status() { - string status = $@"ShiftOS version {Assembly.GetExecutingAssembly().GetName().Version.ToString()} + string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); -Codepoints: {SaveSystem.CurrentSave.Codepoints} -Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed, - {Shiftorium.GetAvailable().Length} available + string cp = SaveSystem.CurrentSave.Codepoints.ToString(); + string installed = SaveSystem.CurrentSave.CountUpgrades().ToString(); + string available = Shiftorium.GetAvailable().Length.ToString(); -"; - - Console.WriteLine(status); - Console.WriteLine("Objectives:"); + Console.WriteLine(Localization.Parse("{COM_STATUS}", new Dictionary + { + ["%cp"] = cp, + ["%version"] = version, + ["%installed"] = installed, + ["%available"] = available + })); + Console.WriteLine("{GEN_OBJECTIVES}"); try { if (Story.CurrentObjectives.Count > 0) @@ -309,12 +218,12 @@ Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed, } else { - Console.WriteLine(" - No objectives are running. Check back later!"); + Console.WriteLine("{RES_NOOBJECTIVES}"); } } catch { - Console.WriteLine(" - No objectives are running. Check back later!"); + Console.WriteLine("{RES_NOOBJECTIVES}"); } return true; } @@ -323,7 +232,7 @@ Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed, [MultiplayerOnly] public static class ShiftoriumCommands { - [Command("buy")] + [Command("buy", description = "{DESC_BUY}")] [RequiresArgument("upgrade")] public static bool BuyUpgrade(Dictionary userArgs) { @@ -331,30 +240,31 @@ Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed, { string upgrade = ""; - if (userArgs.ContainsKey("upgrade")) - upgrade = (string)userArgs["upgrade"]; - else - throw new Exception("You must specify a valid 'upgrade' value."); + upgrade = (string)userArgs["upgrade"]; - foreach (var upg in Shiftorium.GetAvailable()) + var upg = Shiftorium.GetAvailable().FirstOrDefault(x => x.ID == upgrade); + if(upg != null) { - if (upg.ID == upgrade) - { - Shiftorium.Buy(upgrade, upg.Cost); - return true; - } + if (Shiftorium.Buy(upg.ID, upg.Cost) == true) + Console.WriteLine("{RES_UPGRADEINSTALLED}"); + else + Console.WriteLine("{ERR_NOTENOUGHCODEPOINTS}"); + } + else + { + Console.WriteLine("{ERR_NOUPGRADE}"); } - throw new Exception($"Couldn't find upgrade with ID: {upgrade}"); } catch { - return false; + Console.WriteLine("{ERR_GENERAL}"); } + return true; } [RequiresUpgrade("shiftorium_bulk_buy")] - [Command("bulkbuy")] + [Command("bulkbuy", description = "{DESC_BULKBUY}")] [RequiresArgument("upgrades")] public static bool BuyBulk(Dictionary args) { @@ -368,15 +278,11 @@ Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed, BuyUpgrade(dict); } } - else - { - throw new Exception("Please specify a list of upgrades in the 'upgrades' argument. Each upgrade is separated by a comma."); - } return true; } - [Command("upgradeinfo", description ="Shows information about a specific upgrade.")] + [Command("upgradeinfo", description ="{DESC_UPGRADEINFO}")] [RequiresArgument("upgrade")] public static bool ViewInfo(Dictionary userArgs) { @@ -384,29 +290,26 @@ Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed, { string upgrade = ""; - if (userArgs.ContainsKey("upgrade")) - upgrade = (string)userArgs["upgrade"]; - else - throw new Exception("You must specify a valid 'upgrade' value."); + upgrade = (string)userArgs["upgrade"]; foreach (var upg in Shiftorium.GetDefaults()) { if (upg.ID == upgrade) { - Console.WriteLine($@"Information for {upgrade}: - -{upg.Category}: {upg.Name} - {upg.Cost} Codepoints ------------------------------------------------------- + Console.WriteLine(Localization.Parse("{COM_UPGRADEINFO}", new Dictionary + { + ["%id"] = upg.ID, + ["%category"] = upg.Category, + ["%name"] = upg.Name, + ["%cost"] = upg.Cost.ToString(), + ["%description"] = upg.Description + })); -{upg.Description} - -To buy this upgrade, run: -shiftorium.buy{{upgrade:""{upg.ID}""}}"); return true; } } - throw new Exception($"Couldn't find upgrade with ID: {upgrade}"); + throw new Exception("{ERR_NOUPGRADE}"); } catch { @@ -414,17 +317,21 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}"); } } - [Command("upgradecategories", description = "Shows all available Shiftorium upgrade categories, and how many upgrades are available in them.")] + [Command("upgradecategories", description = "{DESC_UPGRADECATEGORIES}")] public static bool ListCategories() { foreach(var cat in Shiftorium.GetCategories()) { - Console.WriteLine($"{cat} - {Shiftorium.GetAvailable().Where(x=>x.Category==cat).Count()} upgrades"); + Console.WriteLine(Localization.Parse("{SHFM_CATEGORY}", new Dictionary + { + ["%name"] = cat, + ["%available"] = Shiftorium.GetAvailable().Where(x=>x.Category==cat).Count().ToString() + })); } return true; } - [Command("upgrades", description ="Lists all available Shiftorium upgrades.")] + [Command("upgrades", description ="{DESC_UPGRADES}")] public static bool ListAll(Dictionary args) { try @@ -449,11 +356,11 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}"); { ConsoleEx.Bold = true; ConsoleEx.ForegroundColor = ConsoleColor.Red; - Console.WriteLine("Shiftorium Query Error"); + Console.WriteLine("{SHFM_QUERYERROR}"); Console.WriteLine(); ConsoleEx.Bold = false; ConsoleEx.ForegroundColor = ConsoleColor.Gray; - Console.WriteLine("Either there are no upgrades in the category \"" + cat + "\" or the category was not found."); + Console.WriteLine("{ERR_EMPTYCATEGORY}"); return true; } upglist = Shiftorium.GetAvailable().Where(x => x.Category == cat); @@ -464,11 +371,11 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}"); { ConsoleEx.Bold = true; ConsoleEx.ForegroundColor = ConsoleColor.Red; - Console.WriteLine("No upgrades available!"); + Console.WriteLine("{SHFM_NOUPGRADES}"); Console.WriteLine(); ConsoleEx.Bold = false; ConsoleEx.ForegroundColor = ConsoleColor.Gray; - Console.WriteLine("You have installed all available upgrades for your system. Please check back later for more."); + Console.WriteLine("{ERR_NOMOREUPGRADES}"); return true; } @@ -482,11 +389,13 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}"); upgrades.Add(upg.ID, upg.Cost); } - Console.WriteLine("ID".PadRight((maxLength + 5) - 2) + "Cost (Codepoints)"); - foreach (var upg in upgrades) { - Console.WriteLine(upg.Key.PadRight((maxLength + 5) - upg.Key.Length) + " " + upg.Value.ToString()); + Console.WriteLine(Localization.Parse("{SHFM_UPGRADE}", new Dictionary + { + ["%id"] = upg.Key, + ["%cost"] = upg.Value.ToString() + })); } return true; } @@ -500,14 +409,11 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}"); public static class WindowCommands { - - - [RemoteLock] - [Command("processes", description = "Shows all running applications.")] + [Command("processes", description = "{DESC_PROCESSES}")] public static bool List() { - Console.WriteLine("Window ID\tName"); + Console.WriteLine("{GEN_CURRENTPROCESSES}"); foreach (var app in AppearanceManager.OpenForms) { //Windows are displayed the order in which they were opened. @@ -516,17 +422,17 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}"); return true; } - [Command("programs", description = "Lists all the programs installed in ShiftOS.")] + [Command("programs", description = "{DESC_PROGRAMS}")] public static bool Programs() { - Console.WriteLine("Programs:"); + Console.WriteLine("{GEN_PROGRAMS}"); Console.WriteLine("==============="); Console.WriteLine(); foreach(var cmd in TerminalBackend.Commands.Where(x=>x is TerminalBackend.WinOpenCommand && Shiftorium.UpgradeInstalled(x.Dependencies)).OrderBy(x => x.CommandInfo.name)) { Console.Write(" - " + cmd.CommandInfo.name); if (!string.IsNullOrWhiteSpace(cmd.CommandInfo.description)) - if (Shiftorium.UpgradeInstalled("help_descriptions")) + if (Shiftorium.UpgradeInstalled("help_description")) Console.Write(": " + cmd.CommandInfo.description); Console.WriteLine(); } @@ -534,7 +440,7 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}"); } [RemoteLock] - [Command("close", usage = "{win:integer32}", description ="Closes the specified window.")] + [Command("close", usage = "{win:integer32}", description ="{DESC_CLOSE}")] [RequiresArgument("win")] [RequiresUpgrade("close_command")] public static bool CloseWindow(Dictionary args) @@ -545,11 +451,14 @@ shiftorium.buy{{upgrade:""{upg.ID}""}}"); string err = null; if (winNum < 0 || winNum >= AppearanceManager.OpenForms.Count) - err = "The window number must be between 0 and " + (AppearanceManager.OpenForms.Count - 1).ToString() + "."; + err = Localization.Parse("{ERR_BADWINID}", new Dictionary + { + ["%max"] = (AppearanceManager.OpenForms.Count - 1).ToString() + }); if (string.IsNullOrEmpty(err)) { - Console.WriteLine($"Closing {AppearanceManager.OpenForms[winNum].Text}..."); + Console.WriteLine("{RES_WINDOWCLOSED}"); AppearanceManager.Close(AppearanceManager.OpenForms[winNum].ParentWindow); } else diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 97cc26e..306a49b 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -126,9 +126,9 @@ namespace ShiftOS.Engine } Thread.Sleep(350); - Console.WriteLine("ShiftKernel v0.4.2"); + Console.WriteLine("{MISC_KERNELVERSION}"); Thread.Sleep(50); - Console.WriteLine("(MIT) DevX 2017, Very Little Rights Reserved"); + Console.WriteLine("Copyright (c) 2018 DevX. Licensed under MIT."); Console.WriteLine(""); Console.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR"); Console.WriteLine("IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,"); @@ -139,39 +139,20 @@ namespace ShiftOS.Engine Console.WriteLine("SOFTWARE."); Console.WriteLine(""); Thread.Sleep(250); - Console.WriteLine("[init] Kernel boot complete."); - Console.WriteLine("[sfs] Loading SFS driver v3"); + Console.WriteLine("{MISC_KERNELBOOTED}"); + Console.WriteLine("{MISC_SHIFTFSDRV}"); Thread.Sleep(350); - Console.WriteLine("[sfs] 4096 blocks read."); - if (loadingJoke1 == 0) - Console.WriteLine("[sos] Getting good and ready..."); - if (loadingJoke1 == 1) - Console.WriteLine("[sos] Shifting the OS..."); - if (loadingJoke1 == 2) - Console.WriteLine("[sos] Placing things everywhere..."); - if (loadingJoke1 == 3) - Console.WriteLine("[sos] Making an an errors..."); - if (loadingJoke1 == 4) - Console.WriteLine("[sos] Testing to see if this OS is indeed on..."); - if (loadingJoke1 == 5) - Console.WriteLine("[sos] Calming user..."); - if (loadingJoke1 == 6) - Console.WriteLine("[sos] Cleaning room..."); - if (loadingJoke1 == 7) - Console.WriteLine("[sos] Checking for piracy..."); - if (loadingJoke1 == 8) - Console.WriteLine("[sos] Getting Jim that important office memo..."); - if (loadingJoke1 == 9) - Console.WriteLine("[sos] Using imagination..."); + Console.WriteLine("{MISC_SHIFTFSBLOCKSREAD}"); + Console.WriteLine("{MISC_LOADINGMSG1_" + loadingJoke1 + "}"); Thread.Sleep(500); - Console.WriteLine("[simpl-conf] Reading configuration files (global-3.conf)"); + Console.WriteLine("{MISC_LOADINGCONFIG}"); Thread.Sleep(30); - Console.WriteLine("[termdb] Building command database from filesystem..."); + Console.WriteLine("{MISC_BUILDINGCMDS}"); TerminalBackend.PopulateTerminalCommands(); if (IsSandbox == false) { - Console.WriteLine("[inetd] Connecting to network..."); + Console.WriteLine("{MISC_CONNECTINGTONETWORK}"); Ready = false; @@ -192,28 +173,9 @@ namespace ShiftOS.Engine { //Connection successful! Stop waiting! guidReceived = true; - Console.WriteLine("[inetd] Connection successful."); + Console.WriteLine("{INIT_CONNECTIONSUCCESSFUL}"); Thread.Sleep(100); - if (loadingJoke2 == 0) - Console.WriteLine("[sos] Running final checks (gotta be sure!)..."); - if (loadingJoke2 == 1) - Console.WriteLine("[sos] Fixing the time because we think we got it wrong..."); - if (loadingJoke2 == 2) - Console.WriteLine("[sos] Fun Fact: there is a 12% chance you will read this..."); - if (loadingJoke2 == 3) - Console.WriteLine("[sos] Fixing sloppy code..."); - if (loadingJoke2 == 4) - Console.WriteLine("[sos] Welcoming new users..."); - if (loadingJoke2 == 5) - Console.WriteLine("[sos] Taking inspiration from GMod..."); - if (loadingJoke2 == 6) - Console.WriteLine("[sos] Getting help..."); - if (loadingJoke2 == 7) - Console.WriteLine("[sos] I'm very clevery guy..."); - if (loadingJoke2 == 8) - Console.WriteLine("[sos] Waiting a bit..."); - if (loadingJoke2 == 9) - Console.WriteLine("[sos] Do a digital dancing..."); + Console.WriteLine("{MISC_LOADINGMSG2_" + loadingJoke2 + "}"); Thread.Sleep(500); }; @@ -227,12 +189,12 @@ namespace ShiftOS.Engine { Thread.Sleep(10); } - Console.WriteLine("[inetd] DHCP GUID recieved, finished setup"); + Console.WriteLine("{MISC_DHCPHANDSHAKEFINISHED}"); FinishBootstrap(); } else { - Console.WriteLine("[inetd] No suitable network interface card found, skipping network connection."); + Console.WriteLine("{MISC_NONETWORK}"); FinishBootstrap(); } } @@ -259,7 +221,7 @@ namespace ShiftOS.Engine } else { - Console.WriteLine("[inetd] Sandbox mode initiating..."); + Console.WriteLine("{MISC_SANDBOXMODE}"); CurrentSave = new Save { IsSandbox = true, @@ -328,8 +290,6 @@ namespace ShiftOS.Engine /// private static void FinishBootstrap() { - KernelWatchdog.Log("mud_handshake", "handshake successful: kernel watchdog access code is \"" + ServerManager.thisGuid.ToString() + "\""); - ServerMessageReceived savehandshake = null; savehandshake = (msg) => @@ -343,7 +303,7 @@ namespace ShiftOS.Engine } catch { - Console.WriteLine("[system] [SEVERE] Cannot parse configuration file."); + Console.WriteLine("{ENGINE_CANNOTLOADSAVE}"); oobe.PromptForLogin(); } } @@ -373,7 +333,7 @@ namespace ShiftOS.Engine Thread.Sleep(75); Thread.Sleep(50); - Console.WriteLine("[usr-man] Accepting logins on local tty 1."); + Console.WriteLine("{MISC_ACCEPTINGLOGINS}"); Sysname: bool waitingForNewSysName = false; @@ -381,16 +341,16 @@ namespace ShiftOS.Engine if (string.IsNullOrWhiteSpace(CurrentSave.SystemName)) { - Infobox.PromptText("Enter a system name", "Your system does not have a name. All systems within the digital society must have a name. Please enter one.", (name) => + Infobox.PromptText("{TITLE_ENTERSYSNAME}", "{PROMPT_ENTERSYSNAME}", (name) => { if (string.IsNullOrWhiteSpace(name)) - Infobox.Show("Invalid name", "Please enter a valid name.", () => + Infobox.Show("{TITLE_INVALIDNAME}", "{PROMPT_INVALIDNAME}.", () => { gobacktosysname = true; waitingForNewSysName = false; }); else if (name.Length < 5) - Infobox.Show("Value too small.", "Your system name must have at least 5 characters in it.", () => + Infobox.Show("{TITLE_VALUESMALL}", "{PROMPT_SMALLSYSNAME}", () => { gobacktosysname = true; waitingForNewSysName = false; @@ -398,11 +358,6 @@ namespace ShiftOS.Engine else { CurrentSave.SystemName = name; - if (!string.IsNullOrWhiteSpace(CurrentSave.UniteAuthToken)) - { - var unite = new Unite.UniteClient("http://getshiftos.ml", CurrentSave.UniteAuthToken); - unite.SetSysName(name); - } SaveSystem.SaveGame(); gobacktosysname = false; waitingForNewSysName = false; @@ -429,18 +384,18 @@ namespace ShiftOS.Engine `-:/++++::.` .+ydNMMMMMNNMMMMMNhs/. /yNMMmy+:-` `````.-/ohNMMms- - `oNMMh/.`:oydmNMMMMNmhs+- .+dMMm+` Welcome to ShiftOS. + `oNMMh/.`:oydmNMMMMNmhs+- .+dMMm+` {{GEN_WELCOME}} `oMMmo``+dMMMMMMMMMMMMMMMMMNh/`.sNMN+ - :NMN+ -yMMMMMMMNdhyssyyhdmNMMMMNs``sMMd. SYSTEM STATUS: + :NMN+ -yMMMMMMMNdhyssyyhdmNMMMMNs``sMMd. {{GEN_SYSTEMSTATUS}} oMMd.`sMMMMMMd+. `/MMMMN+ -mMN: ---------------------- oMMh .mMMMMMM/ `-::::-.` :MMMMMMh`.mMM: - :MMd .NMMMMMMs .dMMMMMMMMMNddMMMMMMMd`.NMN. Codepoints: {SaveSystem.CurrentSave.Codepoints} - mMM. dMMMMMMMo -mMMMMMMMMMMMMMMMMMMMMs /MMy Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed - :MMh :MMMMMMMMm` .+shmMMMMMMMMMMMMMMMN` NMN` {Shiftorium.GetAvailable().Count()} available - oMM+ sMMMMMMMMMN+` `-/smMMMMMMMMMMM: hMM: Filesystems: {Utils.Mounts.Count} filesystems mounted in memory. + :MMd .NMMMMMMs .dMMMMMMMMMNddMMMMMMMd`.NMN. {{GEN_CODEPOINTS}}: {SaveSystem.CurrentSave.Codepoints} + mMM. dMMMMMMMo -mMMMMMMMMMMMMMMMMMMMMs /MMy + :MMh :MMMMMMMMm` .+shmMMMMMMMMMMMMMMMN` NMN` + oMM+ sMMMMMMMMMN+` `-/smMMMMMMMMMMM: hMM: sMM+ sMMMMMMMMMMMMds/-` .sMMMMMMMMM/ yMM/ - +MMs +MMMMMMMMMMMMMMMMMmhs:` +MMMMMMMM- dMM- System name: {CurrentSave.SystemName.ToUpper()} - .MMm `NMMMMMMMMMMMMMMMMMMMMMo `NMMMMMMd .MMN Users: {Users.Count()} found. + +MMs +MMMMMMMMMMMMMMMMMmhs:` +MMMMMMMM- dMM- {{GEN_SYSTEMNAME}}: {CurrentSave.SystemName.ToUpper()} + .MMm `NMMMMMMMMMMMMMMMMMMMMMo `NMMMMMMd .MMN {{GEN_USERS}}: {Users.Count()}. hMM+ +MMMMMMmsdNMMMMMMMMMMN/ -MMMMMMN- yMM+ `NMN- oMMMMMd `-/+osso+- .mMMMMMN: +MMd -NMN: /NMMMm` :yMMMMMMm- oMMd` @@ -460,7 +415,7 @@ namespace ShiftOS.Engine Password = "", Permissions = UserPermissions.Root }); - Console.WriteLine("[usr-man] WARN: No users found. Creating new user with username \"root\", with no password."); + Console.WriteLine("{MISC_NOUSERS}"); } TerminalBackend.InStory = false; @@ -492,18 +447,21 @@ namespace ShiftOS.Engine int progress = 0; bool goback = false; TextSentEventHandler ev = null; + string loginstr = Localization.Parse("{GEN_LPROMPT}", new Dictionary + { + ["%sysname"] = CurrentSave.SystemName + }); ev = (text) => { if (progress == 0) { - string loginstr = CurrentSave.SystemName + " login: "; string getuser = text.Remove(0, loginstr.Length); if (!string.IsNullOrWhiteSpace(getuser)) { if (CurrentSave.Users.FirstOrDefault(x => x.Username == getuser) == null) { Console.WriteLine(); - Console.WriteLine("User not found."); + Console.WriteLine("{ERR_NOUSER}"); goback = true; progress++; TerminalBackend.TextSent -= ev; @@ -515,7 +473,7 @@ namespace ShiftOS.Engine else { Console.WriteLine(); - Console.WriteLine("Username not provided."); + Console.WriteLine("{ERR_NOUSER}"); TerminalBackend.TextSent -= ev; goback = true; progress++; @@ -523,20 +481,20 @@ namespace ShiftOS.Engine } else if (progress == 1) { - string passwordstr = "password: "; + string passwordstr = Localization.Parse("{GEN_PASSWORD}: "); string getpass = text.Remove(0, passwordstr.Length); var user = CurrentSave.Users.FirstOrDefault(x => x.Username == username); if (user.Password == getpass) { Console.WriteLine(); - Console.WriteLine("Welcome to ShiftOS."); + Console.WriteLine("{GEN_WELCOME}"); CurrentUser = user; progress++; } else { Console.WriteLine(); - Console.WriteLine("Access denied."); + Console.WriteLine("{RES_DENIED}"); goback = true; progress++; } @@ -545,7 +503,7 @@ namespace ShiftOS.Engine }; TerminalBackend.TextSent += ev; Console.WriteLine(); - Console.Write(CurrentSave.SystemName + " login: "); + Console.Write(loginstr); ConsoleEx.Flush(); while (progress == 0) { @@ -554,7 +512,7 @@ namespace ShiftOS.Engine if (goback) goto Login; Console.WriteLine(); - Console.Write("password: "); + Console.Write("{GEN_PASSWORD}: "); ConsoleEx.Flush(); while (progress == 1) Thread.Sleep(10); diff --git a/ShiftOS_TheReturn/UserManagementCommands.cs b/ShiftOS_TheReturn/UserManagementCommands.cs index cac535b..7936820 100644 --- a/ShiftOS_TheReturn/UserManagementCommands.cs +++ b/ShiftOS_TheReturn/UserManagementCommands.cs @@ -19,14 +19,14 @@ namespace ShiftOS.Engine /// /// Command arguments. /// Command result. - [Command("add", description = "Add a user to the system.", usage ="name:")] + [Command("adduser", description = "{DESC_ADDUSER}")] [RequiresArgument("name")] public static bool AddUser(Dictionary args) { string name = args["name"].ToString(); - if(SaveSystem.CurrentSave.Users.FirstOrDefault(x=>x.Username==name) != null) + if (SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == name) != null) { - Console.WriteLine("Error: User already exists."); + Console.WriteLine("{ERR_USERFOUND}"); return true; } @@ -37,7 +37,10 @@ namespace ShiftOS.Engine Permissions = UserPermissions.User }; SaveSystem.CurrentSave.Users.Add(user); - Console.WriteLine($"Creating new user \"{name}\" with no password and User permissions."); + Console.WriteLine(Localization.Parse("{RES_CREATINGUSER}", new Dictionary + { + { "%name", name } + })); SaveSystem.SaveGame(); return true; } @@ -48,25 +51,28 @@ namespace ShiftOS.Engine /// Command arguments. /// Command result. - [Command("remove", description = "Remove a user from the system.", usage = "name:")] + [Command("removeuser", description = "{DESC_REMOVEUSER}")] [RequiresArgument("name")] public static bool RemoveUser(Dictionary args) { string name = args["name"].ToString(); if (SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == name) == null) { - Console.WriteLine("Error: User doesn't exist."); + Console.WriteLine("{ERR_NOUSER}"); return true; } var user = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == name); - if(user.Username != SaveSystem.CurrentUser.Username) + if (user.Username != SaveSystem.CurrentUser.Username) { - Console.WriteLine("Error: Cannot remove yourself."); + Console.WriteLine("{ERR_REMOVEYOU}"); return true; } SaveSystem.CurrentSave.Users.Remove(user); - Console.WriteLine($"Removing user \"{name}\" from system..."); + Console.WriteLine(Localization.Parse("{RES_REMOVINGUSER}", new Dictionary + { + ["%name"] = name + })); SaveSystem.SaveGame(); return true; } @@ -79,7 +85,7 @@ namespace ShiftOS.Engine /// Command arguments. /// Command result. - [Command("set_acl")] + [Command("setuserpermissions", description = "{DESC_SETUSERPERMISSIONS}")] [RequiresArgument("user")] [RequiresArgument("val")] public static bool SetUserPermission(Dictionary args) @@ -92,13 +98,13 @@ namespace ShiftOS.Engine } catch { - Console.WriteLine("Error: Permission value must be an integer."); + Console.WriteLine("{ERR_BADACL}"); return true; } if(SaveSystem.CurrentSave.Users.FirstOrDefault(x=>x.Username==username) == null) { - Console.WriteLine("Error: User not found."); + Console.WriteLine("{ERR_NOUSER}"); return true; } @@ -119,26 +125,26 @@ namespace ShiftOS.Engine uperm = UserPermissions.Root; break; default: - Console.WriteLine("Permission value must be between 0 and 4."); + Console.WriteLine("{ERR_BADACL}"); return true; } //Permissions are backwards... oops... if(uperm < SaveSystem.CurrentUser.Permissions) { - Console.WriteLine("Error: Cannot set user permissions to values greater than your own!"); + Console.WriteLine("{ERR_ACLHIGHERVALUE}"); 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."); + Console.WriteLine("{ERR_HIGHERPERMS}"); return true; } SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == username).Permissions = uperm; - Console.WriteLine("User permissions updated."); + Console.WriteLine("{RES_ACLUPDATED}"); return true; } @@ -148,7 +154,7 @@ namespace ShiftOS.Engine /// Command arguments. /// Command result. - [Command("users", description = "Get a list of all users on the system.")] + [Command("users", description = "{DESC_USERS}")] public static bool GetUsers() { foreach (var u in SaveSystem.CurrentSave.Users) @@ -180,7 +186,7 @@ namespace ShiftOS.Engine /// /// Command arguments. /// Command result. - [Command("login", description = "Log in as another user.")] + [Command("su", description = "{DESC_SU}")] [RequiresArgument("user")] [RequiresArgument("pass")] public static bool Login(Dictionary args) @@ -191,18 +197,18 @@ namespace ShiftOS.Engine var usr = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == user); if(usr==null) { - Console.WriteLine("Error: No such user."); + Console.WriteLine("{ERR_NOUSER}"); return true; } if (usr.Password != pass) { - Console.WriteLine("Access denied."); + Console.WriteLine("{RES_DENIED}"); return true; } SaveSystem.CurrentUser = usr; - Console.WriteLine("Access granted."); + Console.WriteLine("{RES_GRANTED}"); return true; } @@ -211,7 +217,7 @@ namespace ShiftOS.Engine /// /// Command arguments. /// Command result. - [Command("setpass", description ="Allows you to set your password to a new value.", usage ="old:,new:")] + [Command("passwd", description ="{DESC_PASSWD}", usage ="old:,new:")] [RequiresArgument("old")] [RequiresArgument("new")] public static bool SetPassword(Dictionary args) @@ -223,12 +229,12 @@ namespace ShiftOS.Engine { SaveSystem.CurrentUser.Password = newpass; SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == SaveSystem.CurrentUser.Username).Password = newpass; - Console.WriteLine("Password set successfully."); + Console.WriteLine("{RES_PASSWD_SET}"); SaveSystem.SaveGame(); } else { - Console.WriteLine("Passwords do not match."); + Console.WriteLine("{ERR_PASSWD_MISMATCH}"); } return true; } -- cgit v1.2.3 From eb29eaec9840254e0bd7620a0d5e8e6b0bcf8efa Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 18 Jun 2017 08:38:10 -0400 Subject: Obese systemd. --- ShiftOS.WinForms/Resources/strings_en.txt | 49 +++++++++++++++++++++++++++++++ ShiftOS_TheReturn/SaveSystem.cs | 7 +++-- 2 files changed, 53 insertions(+), 3 deletions(-) (limited to 'ShiftOS_TheReturn/SaveSystem.cs') diff --git a/ShiftOS.WinForms/Resources/strings_en.txt b/ShiftOS.WinForms/Resources/strings_en.txt index ca1dfae..cc7e0fe 100644 --- a/ShiftOS.WinForms/Resources/strings_en.txt +++ b/ShiftOS.WinForms/Resources/strings_en.txt @@ -102,11 +102,18 @@ "{TITLE_PONG_YOULOSE}": "You lose", "{TITLE_CODEPOINTSTRANSFERRED}": "Codepoints transferred.", "{TITLE_INVALIDPORT}": "Invalid port number.", + "{TITLE_ENTERSYSNAME}": "Enter system name", + "{TITLE_INVALIDNAME}": "Invalid name", + "{TITLE_VALUETOOSMALL}": "Value too small.", + //Infobox prompt messages "{PROMPT_PONGLOST}": "You lost this game of Pong. Guess you should've cashed out...", "{PROMPT_CODEPOINTSTRANSFERRED}": "%transferrer has transferred %amount Codepoints to your system.", "{PROMPT_INVALIDPORT}": "The Digital Society Port must be a valid whole number between 0 and 65535.", + "{PROMPT_ENTERSYSNAME}": "Please enter a system name for your computer.", + "{PROMPT_INVALIDNAME}": "The name you entered cannot be blank. Please enter another name.", + "{PROMPT_SMALLSYSNAME}": "Your system name must have at least 5 characters in it.", //Pong "{PONG_LEVELREACHED}": "You've reached level %level!", @@ -141,4 +148,46 @@ "{MAINMENU_CAMPAIGN}": "Campaign", "{MAINMENU_SANDBOX}": "Sandbox", "{MAINMENU_NEWGAME}": "New game", + + //Miscelaneous strings + "{MISC_KERNELVERSION}": "ShiftKernel - v0.9.4", + "{MISC_KERNELBOOTED}": "[sys] Kernel startup completed.", + "{MISC_SHIFTFSDRV}": "[sfs] ShiftFS core driver, version 2.7", + "{MISC_SHIFTFSBLOCKSREAD}": "[sfs] Driver initiated. 4096 blocks read.", + "{MISC_LOADINGCONFIG}": "[confd] Loading system configuration... success", + "{MISC_BUILDINGCMDS}": "[termdb] Terminal database is being parsed...", + "{MISC_CONNECTINGTONETWORK}": "[inetd] Connecting to network...", + "{MISC_CONNECTIONSUCCESSFUL}": "[inetd] Connection successful.", + "{MISC_DHCPHANDSHAKEFINISHED}": "[inetd] DHCP handshake finished.", + "{MISC_NONETWORK}": "[inetd] No network access points found.", + "{MISC_SANDBOXMODE}": "[sos] Sandbox Mode initiating...", + "{MISC_ACCEPTINGLOGINS}": "[systemd] Accepting logins on local tty1.", + + //ShiftOS engine strings + "{ENGINE_CANNOTLOADSAVE}": "[sos] Error. Cannot load user save file.", + + //Pre-connection loading messages + "{LOADINGMSG1_0}": "[systemd] The light is so bright...", + "{LOADINGMSG1_1}": "[systemd] Hold your colors...", + "{LOADINGMSG1_2}": "[systemd] Time to shift it my way...", + "{LOADINGMSG1_3}": "[systemd] Does anybody even read this?", + "{LOADINGMSG1_4}": "[systemd] I....just wanna play it right... We're....gonna get there tonight...", + "{LOADINGMSG1_5}": "[systemd] I'm a computer.", + "{LOADINGMSG1_6}": "[systemd] What ya gonna do, what ya gonna do, when DevX comes for you?", + "{LOADINGMSG1_7}": "[systemd] Artificial intelligence do everything now.", + "{LOADINGMSG1_8}": "[systemd] Nobody is really here.", + "{LOADINGMSG1_9}": "[systemd] I so want a giant cake for breakfast.", + + //Post-connection loading messages + "{LOADINGMSG2_0}": "[systemd] It's all yours, Shifter.", + "{LOADINGMSG2_1}": "[systemd] That's a nice network you got there...", + "{LOADINGMSG2_2}": "[systemd] Leave me alone and go earn some Codepoints.", + "{LOADINGMSG2_3}": "[systemd] I'm hungry... Cake would be appreciated.", + "{LOADINGMSG2_4}": "[systemd] SEVERE: CAKE NOT FOUND. PLEASE INSERT CAKE INTO DRIVE 1:/ AND PRESS ANY KEY TO CONTINUE.", + "{LOADINGMSG2_5}": "[systemd] Now SCREAM!", + "{LOADINGMSG2_6}": "[systemd] Yes, I'd like to order a giant 6-mile-long tripple-chocolate ice cream cake?", + "{LOADINGMSG2_7}": "[systemd] There's no antidote...", + "{LOADINGMSG2_8}": "[systemd] Can I at least have a muffin?", + "{LOADINGMSG2_9}": "[systemd] System initiated, but I still want a cake.", + } \ No newline at end of file diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 306a49b..8cd4d9b 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -143,7 +143,7 @@ namespace ShiftOS.Engine Console.WriteLine("{MISC_SHIFTFSDRV}"); Thread.Sleep(350); Console.WriteLine("{MISC_SHIFTFSBLOCKSREAD}"); - Console.WriteLine("{MISC_LOADINGMSG1_" + loadingJoke1 + "}"); + Console.WriteLine("{LOADINGMSG1_" + loadingJoke1 + "}"); Thread.Sleep(500); Console.WriteLine("{MISC_LOADINGCONFIG}"); Thread.Sleep(30); @@ -173,9 +173,9 @@ namespace ShiftOS.Engine { //Connection successful! Stop waiting! guidReceived = true; - Console.WriteLine("{INIT_CONNECTIONSUCCESSFUL}"); + Console.WriteLine("{MISC_CONNECTIONSUCCESSFUL}"); Thread.Sleep(100); - Console.WriteLine("{MISC_LOADINGMSG2_" + loadingJoke2 + "}"); + Console.WriteLine("{LOADINGMSG2_" + loadingJoke2 + "}"); Thread.Sleep(500); }; @@ -195,6 +195,7 @@ namespace ShiftOS.Engine else { Console.WriteLine("{MISC_NONETWORK}"); + Console.WriteLine("{LOADINGMSG2_" + loadingJoke2 + "}"); FinishBootstrap(); } } -- cgit v1.2.3