// Update is called once per frame void Update() { GetTimeAndDate(); Shader.SetGlobalFloat("_Azure_FogDistance", fogDistance.value); //postProcess.enabled = postProcessToggle.isOn; Azure.AzureSetTime(timeSlider.value, 0.0f); }
protected override void Update() { Vector3 position = this.playerNetwork.transform.position; if (position.y <= -100f) { AchievementHandler.UnlockAchievement(AchievementType.ach_diveDeep); } if ((UnityEngine.Object) this.soundManager != (UnityEngine.Object)null) { SoundManager obj = this.soundManager; Vector3 position2 = this.playerNetwork.transform.position; obj.SetOceanPlayerHeight(position2.y); } bool key = UnityEngine.Input.GetKey(KeyCode.LeftShift); bool key2 = UnityEngine.Input.GetKey(KeyCode.LeftControl); if (ModAPI.Input.GetButtonDown("Paint")) { this.playerInventory.AddItem("PaintBrush", 1); this.playerInventory.AddItem("Color_Red", 10000); this.playerInventory.AddItem("Color_Yellow", 10000); this.playerInventory.AddItem("Color_Blue", 10000); this.playerInventory.AddItem("Color_Black", 10000); this.playerInventory.AddItem("Color_White", 10000); this.playerInventory.AddItem("Scrap", 10000); this.playerInventory.AddItem("Rope", 10000); this.playerInventory.AddItem("Thatch", 10000); this.playerInventory.AddItem("SeaVine", 10000); this.playerInventory.AddItem("Stone", 10000); this.playerInventory.AddItem("Plastic", 10000); this.playerInventory.AddItem("Plank", 10000); this.playerInventory.AddItem("MetalIngot", 10000); this.playerInventory.AddItem("Nail", 10000); } if (ModAPI.Input.GetButtonDown("Items")) { this.playerInventory.AddItem("Hammer", 1); this.playerInventory.AddItem("Axe", 1); this.playerInventory.AddItem("Hook_Plastic", 1); this.playerInventory.AddItem("Seed_Flower_Black", 500); this.playerInventory.AddItem("Seed_Flower_White", 500); this.playerInventory.AddItem("Seed_Flower_Yellow", 500); this.playerInventory.AddItem("Seed_Flower_Blue", 500); this.playerInventory.AddItem("Seed_Flower_Red", 500); this.playerInventory.AddItem("Raw_Beet", 500); this.playerInventory.AddItem("Raw_Potato", 500); this.playerInventory.AddItem("Raw_Mackerel", 500); this.playerInventory.AddItem("Raw_Shark", 500); this.playerInventory.AddItem("Seed_Palm", 500); } if (ModAPI.Input.GetButtonDown("StatFull")) { this.playerNetwork.Stats.stat_health.Value += 100f; this.playerNetwork.Stats.stat_thirst.Value += 100f; this.playerNetwork.Stats.stat_hunger.Value += 100f; this.playerNetwork.Stats.stat_oxygen.Value += 100f; } else if (UnityEngine.Input.GetKeyDown(KeyCode.Delete)) { this.playerInventory.Clear(); } //AzureSkyController AzureSkyController skyController = SingletonGeneric <GameManager> .Singleton.skyController; if (ModAPI.Input.GetButtonDown("TimeScale")) { this.targetTimeScale += 10f; } else if (ModAPI.Input.GetButtonDown("TimeClear")) { this.targetTimeScale -= 10f; } else if (ModAPI.Input.GetButtonDown("CameraPause")) { if (Time.timeScale > 0f) { Time.timeScale = 0f; } else { this.targetTimeScale = 1f; Time.timeScale = 1f; } } else if (UnityEngine.Input.GetKeyDown(KeyCode.B)) { float azure_Timeline = skyController.Azure_Timeline; azure_Timeline = ((!key) ? (azure_Timeline + 0.1f) : (azure_Timeline + 0.2f)); if (azure_Timeline >= 24f) { azure_Timeline -= 24f; } skyController.AzureSetTime(azure_Timeline, skyController.Azure_DayCycle); } else if (UnityEngine.Input.GetKeyDown(KeyCode.V)) { float azure_Timeline2 = skyController.Azure_Timeline; azure_Timeline2 = ((!key) ? (azure_Timeline2 - 0.1f) : (azure_Timeline2 - 0.2f)); if (azure_Timeline2 <= 0f) { azure_Timeline2 += 24f; } skyController.AzureSetTime(azure_Timeline2, skyController.Azure_DayCycle); } this.targetTimeScale = Mathf.Clamp(this.targetTimeScale, 1f, 100f); if (Time.timeScale != 0f) { Time.timeScale = Helper.Damp(Time.timeScale, this.targetTimeScale, 0.5f, Time.deltaTime); } if (ModAPI.Input.GetButtonDown("CursorLock")) { this.SetMouseLookScripts(!this.mouseLookXScript.enabled); Helper.SetCursorVisibleAndLockState(!Cursor.visible, (CursorLockMode)((Cursor.lockState == CursorLockMode.None) ? 1 : 0)); } base.Update(); }
private void OnGUI() { if (visible) { GUI.skin = Gui.Skin; Width = Mathf.Clamp(Camera.main.pixelWidth / 2, 700, Camera.main.pixelWidth); MenuRect = new Rect(10, 10, Mathf.Clamp(Camera.main.pixelWidth / 2, 700, Camera.main.pixelWidth), Height); // apply label style if not existing if (labelStyle == null) { labelStyle = new GUIStyle(GUI.skin.label); labelStyle.fontSize = 12; } GUI.Box(MenuRect, "", GUI.skin.window); CurrentTab = GUI.Toolbar(new Rect(MenuRect.xMin, MenuRect.yMin, MenuRect.width, ToolbarHeight), CurrentTab, new GUIContent[] { new GUIContent("Cheats"), new GUIContent("Environment"), new GUIContent("Player"), new GUIContent("Spawn"), new GUIContent("Inventory"), new GUIContent("Coop"), new GUIContent("Dev"), new GUIContent("Game") }, GUI.skin.GetStyle("Tabs")); Y = MenuRect.yMin + ToolbarHeight; //+ Padding switch (CurrentTab) { case 0: // Cheats { ScrollPosition = GUI.BeginScrollView(new Rect(MenuRect.xMin, Y, Width, Height - ToolbarHeight - 5), ScrollPosition, new Rect(0, 0, Width - 24, this.scroller)); Y = Padding; UI.AddCheckBox(ref Cheat.GodMode, "God Mode"); if (UI.AddButton("Set Anchor")) { _Raft.AddAnchor(_Raft.transform, false, null); } IncreaseY(-30); if (UI.AddButton("Remove Anchor", 220)) { _Raft.RemoveAnchor(_Raft.transform); } this.scroller = Y + 15; GUI.EndScrollView(); break; } case 1: //Environment { ScrollPosition = GUI.BeginScrollView(new Rect(MenuRect.xMin, Y, Width, Height - ToolbarHeight - 5), ScrollPosition, new Rect(0, 0, Width - 24, this.scroller)); Y = Padding; UI.AddLabel("Time"); UI.AddCheckBox(ref Cheat.fixTimeScale, "Pause"); if (_AzureSkyController) { if (UI.AddButton("+1h")) { float at = _AzureSkyController.Azure_Timeline; at += 1f; if (at >= 24f) { at -= 24f; } _AzureSkyController.AzureSetTime(at, _AzureSkyController.Azure_DayCycle); } IncreaseY(-30); if (UI.AddButton("-1h", 220)) { float at = _AzureSkyController.Azure_Timeline; at -= 1f; if (at <= 0f) { at += 24f; } _AzureSkyController.AzureSetTime(at, _AzureSkyController.Azure_DayCycle); } UI.AddSlider(ref _AzureSkyController.Azure_FogDistance, 50, 5000, "Fog Distance"); } UI.AddLabel("Weather"); foreach (var weather in Cheat._WeatherConnection) { if (UI.AddButton(weather.weatherObject.name)) { _WeatherManager.SetWeather(weather.weatherObject.name, true); } } this.scroller = Y + 15; GUI.EndScrollView(); break; } case 2: //Player { ScrollPosition = GUI.BeginScrollView(new Rect(MenuRect.xMin, Y, Width, Height - ToolbarHeight - 5), ScrollPosition, new Rect(0, 0, Width - 24, this.scroller)); Y = Padding; UI.AddSlider(ref Cheat.SpeedMultiplier, 1, 20, "Player Speed"); if (UI.AddButton("Add Durability to HotSlot", 20, 300)) { _Network_Player.Inventory.RemoveDurabillityFromHotSlot(-100); } this.scroller = Y + 15; GUI.EndScrollView(); break; } case 3: //Spawn { break; } case 4: //Inventory { ScrollPosition = GUI.BeginScrollView(new Rect(MenuRect.xMin, Y, Width, Height - ToolbarHeight - 5), ScrollPosition, new Rect(0, 0, Width - 24, this.scroller)); Y = Padding; var items = ItemManager.GetAllItems(); foreach (Item_Base current in items) { UnityEngine.GUI.Label(new Rect(20f, Y, 270f, 20f), current.UniqueName + " [" + current.UniqueIndex + "]", labelStyle); if (UnityEngine.GUI.Button(new Rect(290f, Y, 40f, 20f), "+1")) { _Network_Player.Inventory.AddItem(current.UniqueName, 1); } if (UnityEngine.GUI.Button(new Rect(340f, Y, 40f, 20f), "+20")) { _Network_Player.Inventory.AddItem(current.UniqueName, 20); } Y += 30f; } this.scroller = Y + 15; GUI.EndScrollView(); break; } case 5: //Coop { break; } case 6: //Dev { break; } case 7: //Game { ScrollPosition = GUI.BeginScrollView(new Rect(MenuRect.xMin, Y, Width, Height - ToolbarHeight - 5), ScrollPosition, new Rect(0, 0, Width - 24, this.scroller)); Y = Padding; if (UI.AddButton("Go to Raft", 20, 300)) { _Player.transform.position = _Raft.transform.position + (Vector3.up * 2); } this.scroller = Y + 15; GUI.EndScrollView(); break; } } } }