void DefaultUI() { _FontSize = (int)(Screen.width * 0.005 + 8); ShowGUI = true; windowRect = new Rect(15f, 100f, 150f, 150f); _DisplayUI = KeyCode.F8; _ReloadUI = KeyCode.F5; _GetCenter = KeyCode.W; _GetLevelInfo = KeyCode.Q; _GetShader = KeyCode.E; Unit = 0; _TimerSwith = false; validBlock = false; isSimulating = false; _Position = new Vector3(0, 0, 0); _V = new Vector3(0, 0, 0); _accstep = 1; _MStartTime = System.DateTime.Now; MTime = _MStartTime.ToShortDateString(); MTimer = "00:00:00"; _timeUI = "Time"; _coordinatesUI = "Coordinates"; _velocityUI = "Velocity"; _distanceUI = "Distance"; _overloadUI = "Overload"; _timerUI = "[Timer]"; _triggerUI = "Trigger"; TriggerIndex = -1; TriggerIndex2 = -1; }
void DefaultUI() { _FontSize = 15; ShowGUI = true; windowRect = new Rect(15f, 100f, 150f, 150f); _DisplayUI = KeyCode.F9; _ReloadUI = KeyCode.F5; Unit = 0; _TimerSwith = false; validBlock = false; isSimulating = false; _Position = new Vector3(0, 0, 0); _V = new Vector3(0, 0, 0); _accstep = 1; _MStartTime = System.DateTime.Now; MTime = _MStartTime.ToShortDateString(); MTimer = "00:00:00"; _timeUI = "Time"; _coordinatesUI = "Coordinates"; _velocityUI = "Velocity"; _distanceUI = "Distance"; _overloadUI = "Overload"; _timerUI = "Timer"; }
void ReadUI() { DefaultUI(); //Debug.Log(Screen.currentResolution.ToString()); try { StreamReader srd; if (File.Exists(GeoTools.UIPath + "CHN.txt")) { srd = File.OpenText(GeoTools.UIPath + "CHN.txt"); } else { srd = File.OpenText(GeoTools.UIPath + "EN.txt"); } //Debug.Log(Ci + " " + Screen.width.ToString() + "*" + Screen.height.ToString()); while (srd.Peek() != -1) { string str = srd.ReadLine(); string[] chara = str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); if (chara.Length > 2) { if (chara[0] == "_Timer") { if (chara[1] == "unit") { if (chara[2] == "kmh") { this.Unit = ModUnit.kmh; } if (chara[2] == "ms") { this.Unit = ModUnit.ms; } if (chara[2] == "mach") { this.Unit = ModUnit.mach; } } else if (chara[1] == "overload") { if (chara[2] == "OFF") { _overloadUI = string.Empty; } else { _overloadUI = chara[2]; } } else if (chara[1] == "time") { if (chara[2] == "OFF") { _timeUI = string.Empty; } else { _timeUI = chara[2]; } } else if (chara[1] == "coordinates") { if (chara[2] == "OFF") { _coordinatesUI = string.Empty; } else { _coordinatesUI = chara[2]; } } else if (chara[1] == "velocity") { if (chara[2] == "OFF") { _velocityUI = string.Empty; } else { _velocityUI = chara[2]; } } else if (chara[1] == "timer") { if (chara[2] == "OFF") { _timerUI = string.Empty; } else { _timerUI = chara[2]; } } else if (chara[1] == "distance") { if (chara[2] == "OFF") { _distanceUI = string.Empty; } else { _distanceUI = chara[2]; } } else if (chara[1] == "trigger") { if (chara[2] == "OFF") { _triggerUI = string.Empty; } else { _triggerUI = chara[2]; } } else if (chara[1] == "display_UI") { KeyCode outputkey; if (GeoTools.StringToKeyCode(chara[2], out outputkey)) { _DisplayUI = outputkey; } } else if (chara[1] == "reload_UI") { KeyCode outputkey; if (GeoTools.StringToKeyCode(chara[2], out outputkey)) { _ReloadUI = outputkey; } } else if (chara[1] == "Get_Center") { KeyCode outputkey; if (GeoTools.StringToKeyCode(chara[2], out outputkey)) { _GetCenter = outputkey; } } else if (chara[1] == "Get_LevelInfo") { KeyCode outputkey; if (GeoTools.StringToKeyCode(chara[2], out outputkey)) { _GetLevelInfo = outputkey; } } else if (chara[1] == "Get_Shader") { KeyCode outputkey; if (GeoTools.StringToKeyCode(chara[2], out outputkey)) { _GetShader = outputkey; } } else if (chara[1] == "show_on_start") { if (chara[2] == "0" || chara[2] == "OFF") { ShowGUI = false; } else { ShowGUI = true; } } } else if (chara[0] == Screen.width.ToString() + "*" + Screen.height.ToString() + "_Timer") { if (chara[1] == "window_poistion") { windowRect.x = Convert.ToSingle(chara[2]); windowRect.y = Convert.ToSingle(chara[3]); } } } } srd.Close(); if (Unit == ModUnit.kmh) { _velocityUI += "(km/h)"; } else if (Unit == ModUnit.ms) { _velocityUI += "(m/s)"; } else if (Unit == ModUnit.mach) { _velocityUI += "(mach)"; } filtUI(); Debug.Log("TimerUISetting Completed!"); } catch (Exception ex) { Debug.Log("Error! TimerUISetting Failed!"); Debug.Log(ex.ToString()); DefaultUI(); return; } }
void ReadUI() { DefaultUI(); //Debug.Log(Screen.currentResolution.ToString()); try { StreamReader srd; string Ci = System.Threading.Thread.CurrentThread.CurrentCulture.Name; string ParentPath = Directory.GetParent(Application.dataPath).FullName; if (Ci == "zh-CN" || File.Exists(ParentPath + "/3DMGAME.ini")) { srd = File.OpenText(Application.dataPath + "/Mods/Blocks/UI/CHN.txt"); } else { srd = File.OpenText(Application.dataPath + "/Mods/Blocks/UI/EN.txt"); } //Debug.Log(Ci + " " + Screen.width.ToString() + "*" + Screen.height.ToString()); while (srd.Peek() != -1) { string str = srd.ReadLine(); string[] chara = str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); if (chara.Length > 2) { if (chara[0] == "_Timer") { if (chara[1] == "unit") { if (chara[2] == "kmh") { this.Unit = ModUnit.kmh; } if (chara[2] == "ms") { this.Unit = ModUnit.ms; } if (chara[2] == "mach") { this.Unit = ModUnit.mach; } } else if (chara[1] == "overload") { if (chara[2] == "OFF") { _overloadUI = string.Empty; } else { _overloadUI = chara[2]; } } else if (chara[1] == "time") { if (chara[2] == "OFF") { _timeUI = string.Empty; } else { _timeUI = chara[2]; } } else if (chara[1] == "coordinates") { if (chara[2] == "OFF") { _coordinatesUI = string.Empty; } else { _coordinatesUI = chara[2]; } } else if (chara[1] == "velocity") { if (chara[2] == "OFF") { _velocityUI = string.Empty; } else { _velocityUI = chara[2]; } } else if (chara[1] == "timer") { if (chara[2] == "OFF") { _timerUI = string.Empty; } else { _timerUI = chara[2]; } } else if (chara[1] == "distance") { if (chara[2] == "OFF") { _distanceUI = string.Empty; } else { _distanceUI = chara[2]; } } else if (chara[1] == "display_UI") { KeyCode outputkey; if (GeoTools.StringToKeyCode(chara[2], out outputkey)) { _DisplayUI = outputkey; } } else if (chara[1] == "reload_UI") { KeyCode outputkey; if (GeoTools.StringToKeyCode(chara[2], out outputkey)) { _ReloadUI = outputkey; } } } else if (chara[0] == Screen.width.ToString() + "*" + Screen.height.ToString() + "_Timer") { if (chara[1] == "fontsize") { _FontSize = Convert.ToInt32(chara[2]); } else if (chara[1] == "window_poistion") { windowRect.x = Convert.ToSingle(chara[2]); windowRect.y = Convert.ToSingle(chara[3]); } else if (chara[1] == "window_scale") { windowRect.width = Convert.ToSingle(chara[2]); windowRect.height = Convert.ToSingle(chara[3]); } else if (chara[1] == "show_on_start") { if (chara[2] == "0") { ShowGUI = false; } else { ShowGUI = true; } } } } } srd.Close(); if (Unit == ModUnit.kmh) { _velocityUI += "(km/h)"; } else if (Unit == ModUnit.ms) { _velocityUI += "(m/s)"; } else if (Unit == ModUnit.mach) { _velocityUI += "(mach)"; } Debug.Log("Besiege_Sky_and_Cloud_Mod==>TimerUISetting Completed!"); } catch (Exception ex) { Debug.Log("Besiege_Sky_and_Cloud_Mod==>TimerUISetting Failed!"); Debug.Log(ex.ToString()); DefaultUI(); return; } }