public static GameProgress FromString(string s) { GameProgress gp = new GameProgress(); string[] p = s.Split(new char[] { ':' }); if (!p[0].StartsWith("GPv")) { Debug.LogError("Failed to parse game progress from: " + s); return(gp); } gp.mPilotExp = System.Convert.ToInt32(p[1]); int i; for (i = 2; i < p.Length && i - 2 < LevelCount; i++) { gp.GetLevelProgress(i - 2).SetFromString(p[i]); } if (p[0].Equals("GPv3")) { double val = Double.Parse(p[p.Length - 1]); gp.mPlayingTime = TimeSpan.FromMilliseconds(val > 0f?val:0f); } else { gp.mPlayingTime = new TimeSpan(); } gp.mLoadedTime = DateTime.Now; return(gp); }
public static GameProgress FromString(string s) { GameProgress gp = new GameProgress(); string[] p = s.Split(new char[] { ':' }); if (!p[0].Equals("GPv2")) { Debug.LogError("Failed to parse game progress from: " + s); return(gp); } gp.mPilotExp = System.Convert.ToInt32(p[1]); int i; for (i = 2; i < p.Length && i - 2 < LevelCount; i++) { gp.GetLevelProgress(i - 2).SetFromString(p[i]); } return(gp); }
public static GameProgress FromString(string s) { GameProgress gp = new GameProgress(); string[] p = s.Split(new char[] { ':' }); if (!p[0].StartsWith("GPv")) { Debug.LogError("Failed to parse game progress from: " + s); return gp; } gp.mPilotExp = System.Convert.ToInt32(p[1]); int i; for (i = 2; i < p.Length && i - 2 < LevelCount; i++) { gp.GetLevelProgress(i - 2).SetFromString(p[i]); } if(p[0].Equals("GPv3")) { double val = Double.Parse(p[p.Length -1]); gp.mPlayingTime = TimeSpan.FromMilliseconds(val>0f?val:0f); } else { gp.mPlayingTime = new TimeSpan(); } gp.mLoadedTime = DateTime.Now; return gp; }
public static GameProgress FromString(string s) { GameProgress gp = new GameProgress(); string[] p = s.Split(new char[] { ':' }); if (!p[0].Equals("GPv2")) { Debug.LogError("Failed to parse game progress from: " + s); return gp; } gp.mPilotExp = System.Convert.ToInt32(p[1]); int i; for (i = 2; i < p.Length && i - 2 < LevelCount; i++) { gp.GetLevelProgress(i - 2).SetFromString(p[i]); } return gp; }