-
Notifications
You must be signed in to change notification settings - Fork 0
/
Helper.cs
79 lines (72 loc) · 2.21 KB
/
Helper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using System;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace D86_CE
{
public class Helper : MonoBehaviour
{
public static bool IsMultiplayer()
{
if (FindObjectOfType<SI_PersistantUserList>()) return true;
return false;
}
public static bool IsOfficial()
{
if (SceneManager.GetActiveScene().name.Contains("Persistant")) return true;
return false;
}
public static bool InGame()
{
if (!SceneManager.GetActiveScene().name.ToLowerInvariant().Contains("mainmenu")
&& !SceneManager.GetActiveScene().name.ToLowerInvariant().Contains("empty")
&& !SceneManager.GetActiveScene().name.ToLowerInvariant().Contains("load"))
{
return true;
}
else
{
return false;
}
}
public static string GetCar()
{
if (FindObjectOfType<UserControl>())
{
string carName = FindObjectOfType<UserControl>().GetComponent<SI_ApplySkin>().PrefabCarName;
carName = carName.Replace("_", " ");
return carName;
}
else
{
return "unknown";
}
}
public static int GetScore()
{
if (FindObjectOfType<DriftPanelUI>())
{
float score = FindObjectOfType<DriftPanelUI>().DriftRaceEntity.PlayerDriftStatistics.TotalScore;
int intscore = (int)Math.Round(score);
return intscore;
}
else
{
return 0;
}
}
public static String GetRaceTime()
{
if (FindObjectOfType<DriftPanelUI>())
{
float raceTimeF = FindObjectOfType<DriftPanelUI>().DriftRaceEntity.PlayerDriftStatistics.TotalRaceTime;
TimeSpan ts = TimeSpan.FromSeconds(raceTimeF);
String raceTime = ts.ToString("m\\:ss\\:fff");
return raceTime;
}
else
{
return "00:00:00";
}
}
}
}