diff options
| author | Michael <[email protected]> | 2017-06-10 22:02:10 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-06-10 22:02:10 -0400 |
| commit | c3deaa23fffb7011efb2b5b0f7fc3e754d21f600 (patch) | |
| tree | 4e1cb7c846de1dd454c813eb8e49119a6ef54c70 /ShiftOS.Objects/Save.cs | |
| parent | 920e33a2fd329ccbdfeb38ddedd0b4d87e97ed86 (diff) | |
| download | shiftos_thereturn-c3deaa23fffb7011efb2b5b0f7fc3e754d21f600.tar.gz shiftos_thereturn-c3deaa23fffb7011efb2b5b0f7fc3e754d21f600.tar.bz2 shiftos_thereturn-c3deaa23fffb7011efb2b5b0f7fc3e754d21f600.zip | |
Even more menu work.
Diffstat (limited to 'ShiftOS.Objects/Save.cs')
| -rw-r--r-- | ShiftOS.Objects/Save.cs | 78 |
1 files changed, 1 insertions, 77 deletions
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<Action> _setCpCallbacks = new List<Action>(); // 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<string, bool> Upgrades { get; set; } public int StoryPosition { get; set; } |
