4 Commits

6 changed files with 131 additions and 16 deletions
@@ -75,6 +75,7 @@
<Compile Include="RamoSphere.cs" />
<Compile Include="Rocket.cs" />
<Compile Include="SeaData.cs" />
<Compile Include="SemVer.cs" />
<Compile Include="Settings.cs" />
<Compile Include="Skidmarks.cs" />
<Compile Include="SoundEffect.cs" />
+5 -4
View File
@@ -1099,7 +1099,8 @@ public class Game : MonoBehaviour
veh.isBot ? 1 : 0,
veh.isIt,
veh.score,
veh.specialInput ? 1 : 0);
veh.specialInput ? 1 : 0,
veh.zorbBall);
veh.networkView.RPC(
"sC",
player,
@@ -1108,8 +1109,7 @@ public class Game : MonoBehaviour
veh.vehicleColor.b,
veh.vehicleAccent.r,
veh.vehicleAccent.g,
veh.vehicleAccent.b,
veh.zorbBall);
veh.vehicleAccent.b);
}
//Sync Server Prefs
@@ -1876,6 +1876,7 @@ public class Game : MonoBehaviour
plyVeh.zorbBall = zorbBall;
if (viewID.isMine && isBot == 0) Player = plyObj;
if (plyVeh.isIt == 1) QuarryVeh = plyVeh;
}
[RPC]
@@ -2055,7 +2056,7 @@ public class Game : MonoBehaviour
}
[RPC]
public void sSH(string sname, string sworld, string swelcome, string sblacklist, string spassword, float gVersion, bool shidden, NetworkMessageInfo info)
public void sSH(string sname, string sworld, string swelcome, string sblacklist, string spassword, SemVer gVersion, bool shidden, NetworkMessageInfo info)
{
serverName = sname;
Settings.serverWelcome = swelcome;
+2 -1
View File
@@ -4,7 +4,8 @@ using UnityEngine;
[Serializable]
public class GameData : MonoBehaviour
{
public static float gameVersion = 4.0f;
//public static float gameVersion = 4.0f;
public static SemVer gameVersion = new SemVer("4.0.1");
public static float serverVersion = 0.2f;
public static string gameName = "marsxplr";
public static string userName = "";
+7 -10
View File
@@ -136,11 +136,8 @@ public class Lobby : MonoBehaviour
String[] val = tmp.ToArray();
if (
val[0] == "v" &&
float.Parse(
val[1],
CultureInfo.InvariantCulture.NumberFormat
) > (float)GameData.gameVersion)
val[0] == "sv" &&
SemVer.Parse(val[1]) > GameData.gameVersion)
{
outdated = val[1];
}
@@ -907,7 +904,7 @@ public class Lobby : MonoBehaviour
HostData[] data = MasterServer.PollHostList();
String[] serverData;
float gameVersion;
SemVer gameVersion;
float serverVersion;
//Precull Data
@@ -922,13 +919,13 @@ public class Lobby : MonoBehaviour
if (filterNATHosts && element.useNat) continue;
serverData = element.comment.Split(";"[0]);
gameVersion = 0.0f;
gameVersion = new SemVer(0);
serverVersion = 0.0f;
foreach (String dat in serverData)
{
if (dat == "") continue;
vals = dat.Split("="[0]);
if (vals[0] == "v") gameVersion = float.Parse(vals[1]);
if (vals[0] == "v") gameVersion = SemVer.Parse(vals[1]);
if (vals[0] == "d") serverVersion = float.Parse(vals[1]);
}
@@ -961,7 +958,7 @@ public class Lobby : MonoBehaviour
masterServerConFailures = 0;
masterServerMessage = "";
serverData = element.comment.Split(";"[0]);
gameVersion = 0.0f;
gameVersion = new SemVer(0);
serverVersion = 0.0f;
String serverWorld = "";
String serverPlayers = "";
@@ -973,7 +970,7 @@ public class Lobby : MonoBehaviour
{
if (dat == "") continue;
vals = dat.Split("="[0]);
if (vals[0] == "v") gameVersion = float.Parse(vals[1]);
if (vals[0] == "v") gameVersion = SemVer.Parse(vals[1]);
if (vals[0] == "d") serverVersion = float.Parse(vals[1]);
else if (vals[0] == "w") serverWorld = vals[1];
else if (vals[0] == "p") serverPlayers = vals[1];
+115
View File
@@ -0,0 +1,115 @@
using System;
public class SemVer
{
public byte maj;
public byte min;
public byte patch;
public SemVer(byte mj, byte mn, byte pt)
{
maj = mj;
min = mn;
patch = pt;
}
public SemVer(byte mj, byte mn)
{
maj = mj;
min = mn;
patch = 0;
}
public SemVer(byte mj)
{
maj = mj;
min = 0;
patch = 0;
}
public SemVer(String str)
{
SemVer sv = SemVer.Parse(str);
maj = sv.maj;
min = sv.min;
patch = sv.patch;
}
public static bool operator ==(SemVer a, SemVer b)
{
return (
a.maj == b.maj &&
a.min == b.min &&
a.patch == b.patch);
}
public static bool operator !=(SemVer a, SemVer b)
{
return (
a.maj != b.maj ||
a.min != b.min ||
a.patch != b.patch);
}
public static bool operator >(SemVer a, SemVer b)
{
return a.maj > b.maj ? true :
a.min > b.min ? true :
a.patch > b.patch ? true :
false;
}
public static bool operator >=(SemVer a, SemVer b)
{
return a.maj >= b.maj ? true :
a.min >= b.min ? true :
a.patch >= b.patch ? true :
false;
}
public static bool operator <=(SemVer a, SemVer b)
{
return b > a;
}
public static bool operator <(SemVer a, SemVer b)
{
return b >= a;
}
public override string ToString()
{
if (patch == 0) return maj.ToString() + "." + min.ToString();
return maj.ToString() + "." + min.ToString() + "." + patch.ToString();
}
public static SemVer Parse(String str)
{
String[] sv = str.Split("."[0]);
if (sv.Length == 3) return new SemVer(
byte.Parse(sv[0]),
byte.Parse(sv[1]),
byte.Parse(sv[2]));
if (sv.Length == 2) return new SemVer(
byte.Parse(sv[0]),
byte.Parse(sv[1]));
if (sv.Length == 1) return new SemVer(
byte.Parse(sv[0]));
throw new FormatException();
}
public override int GetHashCode()
{
return maj.GetHashCode() ^ (min.GetHashCode() << 2) ^ (patch.GetHashCode() >> 2);
}
public override bool Equals(object other)
{
if (!(other is SeaData)) return false;
SemVer osv = (SemVer)other;
return (
osv.maj == maj &&
osv.min == min &&
osv.patch == patch);
}
}
+1 -1
View File
@@ -43,7 +43,7 @@
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="s"
BuildCommandLine="if exist &quot;$(SolutionDir)\marsxplr_build\Mars Explorer_Data\lib&quot; rd /S /Q &quot;$(SolutionDir)marsxplr_build\Mars Explorer_Data\lib&quot;&#x0D;&#x0A;if exist &quot;$(SolutionDir)marsxplr_build\Mars Explorer_Data&quot; rd /S /Q &quot;$(SolutionDir)marsxplr_build\Mars Explorer_Data&quot;&#x0D;&#x0A;md $(SolutionDir)marsxplr_build&#x0D;&#x0A;md &quot;$(SolutionDir)marsxplr_build\Mars Explorer_Data&quot;&#x0D;&#x0A;md &quot;$(SolutionDir)marsxplr_build\Mars Explorer_Data\lib&quot;"
ReBuildCommandLine=""
CleanCommandLine=""
Output=""