aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-05-02 17:11:31 -0400
committerMichael <[email protected]>2017-05-02 17:11:31 -0400
commit99eede4118bc247a9ca2e6f7329bf1b9fea5b52d (patch)
treea77b5d295119eaaf3fb12c7e09aa0e8b1f6db4ee
parent0c2f2329119d8bfe2218912890d55def22965b87 (diff)
downloadshiftos_thereturn-99eede4118bc247a9ca2e6f7329bf1b9fea5b52d.tar.gz
shiftos_thereturn-99eede4118bc247a9ca2e6f7329bf1b9fea5b52d.tar.bz2
shiftos_thereturn-99eede4118bc247a9ca2e6f7329bf1b9fea5b52d.zip
pong highscores are semi-fixed
-rw-r--r--ShiftOS.WinForms/Applications/Pong.cs18
-rw-r--r--ShiftOS_TheReturn/UniteClient.cs20
-rw-r--r--ShiftOS_TheReturn/UniteTestCommands.cs10
3 files changed, 48 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs
index 0ef4da3..6198cad 100644
--- a/ShiftOS.WinForms/Applications/Pong.cs
+++ b/ShiftOS.WinForms/Applications/Pong.cs
@@ -285,6 +285,16 @@ namespace ShiftOS.WinForms.Applications
{
secondsleft = 60;
level = level + 1;
+ if (SaveSystem.CurrentSave.UniteAuthToken != null)
+ {
+ try
+ {
+ var unite = new ShiftOS.Unite.UniteClient("http://getshiftos.ml", SaveSystem.CurrentSave.UniteAuthToken);
+ if (unite.GetPongLevel() < level)
+ unite.SetPongLevel(level);
+ }
+ catch { }
+ }
generatenextlevel();
pnlgamestats.Show();
pnlgamestats.BringToFront();
@@ -544,6 +554,14 @@ namespace ShiftOS.WinForms.Applications
lblfinalcomputerreward.Text = beatairewardtotal.ToString();
lblfinalcodepoints.Text = totalreward + Localization.Parse(" {CODEPOINTS_SHORT}");
SaveSystem.TransferCodepointsFrom("pong", totalreward);
+ if (!string.IsNullOrWhiteSpace(SaveSystem.CurrentSave.UniteAuthToken))
+ {
+ var unite = new ShiftOS.Unite.UniteClient("http://getshiftos.ml", SaveSystem.CurrentSave.UniteAuthToken);
+ if (unite.GetPongCP() < totalreward)
+ {
+ unite.SetPongCP(totalreward);
+ }
+ }
}
private void newgame()
diff --git a/ShiftOS_TheReturn/UniteClient.cs b/ShiftOS_TheReturn/UniteClient.cs
index 88e44af..cb08382 100644
--- a/ShiftOS_TheReturn/UniteClient.cs
+++ b/ShiftOS_TheReturn/UniteClient.cs
@@ -34,6 +34,26 @@ namespace ShiftOS.Unite
}
}
+ public int GetPongCP()
+ {
+ return Convert.ToInt32(MakeCall("/API/GetPongCP"));
+ }
+
+ public int GetPongLevel()
+ {
+ return Convert.ToInt32(MakeCall("/API/GetPongLevel"));
+ }
+
+ public void SetPongLevel(int value)
+ {
+ MakeCall("/API/SetPongLevel/" + value.ToString());
+ }
+
+ public void SetPongCP(int value)
+ {
+ MakeCall("/API/SetPongCP/" + value.ToString());
+ }
+
public string GetEmail()
{
return MakeCall("/API/GetEmail");
diff --git a/ShiftOS_TheReturn/UniteTestCommands.cs b/ShiftOS_TheReturn/UniteTestCommands.cs
index 37ab1ee..7a83e44 100644
--- a/ShiftOS_TheReturn/UniteTestCommands.cs
+++ b/ShiftOS_TheReturn/UniteTestCommands.cs
@@ -10,6 +10,16 @@ namespace ShiftOS.Engine
[Namespace("unite")]
public static class UniteTestCommands
{
+ [Command("setdisplayname")]
+ [RequiresArgument("name")]
+ public static bool SetDisplayName(Dictionary<string, object> args)
+ {
+ string dname = args["name"].ToString();
+ var unite = new ShiftOS.Unite.UniteClient("http://getshiftos.ml", SaveSystem.CurrentSave.UniteAuthToken);
+ unite.SetDisplayName(dname);
+ return true;
+ }
+
[Command("login")]
[RequiresArgument("username")]
[RequiresArgument("password")]