static bool Prefix() { if (Multiplayer.Client == null) { return(true); // Not in multiplayer mode } Player?simulationOwner = Multiplayer.Client.SimulationManager.GetSimulationOwner(); if (simulationOwner == null || simulationOwner.Value != Multiplayer.Client.LocalPlayer) // Player isn't the simulation owner { MessageToast.Show($"Only the simulation owner can control time!", 3f); return(false); } PlanetbaseMultiplayer.Client.Time.TimeManager timeManager = Multiplayer.Client.TimeManager; float timeScale = timeManager.GetCurrentSpeed(); timeScale /= 2f; if (timeScale < 1f) { timeScale = 1f; } MessageToast.Show(StringList.get("speed_set") + " x" + timeScale, 3f); TimeManager.getInstance().decreaseSpeed(); return(false); }
public static List <Line> OpenFile(string fileName) { List <Line> l = new List <Line>(); string fullPath = directory + fileName + fileExtension; l = JsonUtility.FromJson <LineContents>(File.ReadAllText(fullPath)).lines; MessageToast.Show("File loaded"); currentFilename = fileName; return(l); }
public static bool SaveFile(string fileName) { string fullPath = directory + fileName + fileExtension; string str = "{}"; if (LineWorld.main.lines.Count > 0) { LineContents lc = new LineContents(); lc.lines = LineWorld.main.lines; str = JsonUtility.ToJson(lc); } currentFilename = fileName; File.WriteAllText(fullPath, str); MessageToast.Show("Save successful"); return(true); }
public static void ShowMessageToast(string message, List <MyUICommand> commands, int seconds = 15) { MessageToast ms = new MessageToast(message, TimeSpan.FromSeconds(seconds), commands); ms.Show(); }
public static void ShowMessageToast(string message, int seconds = 2) { MessageToast ms = new MessageToast(message, TimeSpan.FromSeconds(seconds)); ms.Show(); }
public static void ShowMessageToast(string message, int time) { MessageToast ms = new MessageToast(message, TimeSpan.FromMilliseconds(time)); ms.Show(); }
public static bool DeleteFile(string str) { File.Delete(str); MessageToast.Show("File Deleted"); return(true); }