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 +------------------------------------------------ 1 file changed, 1 insertion(+), 77 deletions(-) (limited to 'ShiftOS.Objects') 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; } -- cgit v1.2.3