static void Prefix(MessageHud __instance) { if (!modEnabled.Value) { return; } __instance.m_messageText.alignment = TextAnchor.LowerLeft; }
static void Prefix(MessageHud __instance, ref float dt) { if (!modEnabled.Value) { return; } __instance.m_messageText.fontSize = smallNotificationSize.Value; __instance.m_messageCenterText.fontSize = largeNotificationSize.Value; __instance.m_messageText.color = smallColor.Value; __instance.m_messageCenterText.color = largeColor.Value; __instance.m_messageText.transform.parent.GetComponent <RectTransform>().anchoredPosition = new Vector2(smallNotificationPosition.Value.x, -smallNotificationPosition.Value.y); }
private static void Postfix(ref Player __instance, ref Vector3 ___m_moveDir, ref Vector3 ___m_lookDir, ref GameObject ___m_placementGhost, Transform ___m_eye) { if ((Configuration.Current.Player.IsEnabled && Configuration.Current.Player.queueWeaponChanges) && (ZInput.GetButtonDown("Hide") || ZInput.GetButtonDown("JoyHide"))) { if (__instance.InAttack() && (__instance.GetRightItem() != null || __instance.GetLeftItem() != null)) { // The game ignores this keypress, so queue it and take care of it when able (Player_FixedUpdate_Patch). EquipPatchState.shouldHideItemsAfterAttack = true; } } if (!__instance.m_nview.IsValid() || !__instance.m_nview.IsOwner()) { return; } if (Configuration.Current.AdvancedEditingMode.IsEnabled) { AEM.PlayerInstance = __instance; AEM.run(); } if (Configuration.Current.AdvancedBuildingMode.IsEnabled) { ABM.Run(ref __instance); } if (Configuration.Current.Hotkeys.IsEnabled) { ApplyDodgeHotkeys(ref __instance, ref ___m_moveDir, ref ___m_lookDir); } if (Configuration.Current.GameClock.IsEnabled) { String hours_str = ""; String minutes_str = ""; String amPM_str = ""; Hud hud = Hud.instance; Text timeText; if (timeObj == null) { MessageHud msgHud = MessageHud.instance; timeObj = new GameObject(); timeObj.transform.SetParent(hud.m_statusEffectListRoot.transform.parent); timeObj.AddComponent <RectTransform>(); timeText = timeObj.AddComponent <Text>(); float rRatio = Mathf.Clamp01((float)Configuration.Current.GameClock.textRedChannel / 255f); float gRatio = Mathf.Clamp01((float)Configuration.Current.GameClock.textGreenChannel / 255f); float bRatio = Mathf.Clamp01((float)Configuration.Current.GameClock.textBlueChannel / 255f); float aRatio = Mathf.Clamp01((float)Configuration.Current.GameClock.textTransparencyChannel / 255f); timeText.color = new Color(rRatio, gRatio, bRatio, aRatio); timeText.font = msgHud.m_messageCenterText.font; timeText.fontSize = Configuration.Current.GameClock.textFontSize; timeText.enabled = true; timeText.alignment = TextAnchor.MiddleCenter; timeText.horizontalOverflow = HorizontalWrapMode.Overflow; } else { timeText = timeObj.GetComponent <Text>(); } EnvMan env = EnvMan.instance; if (savedEnvSeconds != env.m_totalSeconds) { float minuteFrac = Mathf.Lerp(0, 24, env.GetDayFraction()); float hr24 = Mathf.Floor(minuteFrac); minuteFrac = minuteFrac - hr24; float minutes = Mathf.Lerp(0, 60, minuteFrac); int hours_int = Mathf.FloorToInt(hr24); int minutes_int = Mathf.FloorToInt(minutes); if (Configuration.Current.GameClock.useAMPM) { amPM_str = (hours_int < 12) ? " AM" : " PM"; if (hours_int > 12) { hours_int -= 12; } } if (hours_int < 10) { hours_str = "0" + hours_int; } if (minutes_int < 10) { minutes_str = "0" + minutes_int; } if (hours_int >= 10) { hours_str = hours_int.ToString(); } if (minutes_int >= 10) { minutes_str = minutes_int.ToString(); } timeText.text = hours_str + ":" + minutes_str + amPM_str; var staminaBarRec = hud.m_staminaBar2Root.transform as RectTransform; var statusEffictBarRec = hud.m_statusEffectListRoot.transform as RectTransform; timeObj.GetComponent <RectTransform>().position = new Vector2(staminaBarRec.position.x, statusEffictBarRec.position.y); timeObj.SetActive(true); savedEnvSeconds = env.m_totalSeconds; } } }
public static void Postfix(MessageHud __instance) { var biomeMessageTextRect = __instance.m_biomeFoundPrefab.transform.Find("UnlockMessage/Title").GetComponent <Text>().rectTransform; biomeMessageTextRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 800); }
public void close(GuiControl gui) { EditorGui EditorGui = "EditorGui"; GuiCanvas Canvas = "Canvas"; GuiEditorGui GuiEditorGui = "GuiEditorGui"; EWTreeWindow EWTreeWindow = "EWTreeWindow"; TerrainPainter TerrainPainter = "TerrainPainter"; GuiWindowCollapseCtrl TerrainPainterPreview = "TerrainPainterPreview"; EWInspectorWindow EWInspectorWindow = "EWInspectorWindow"; MaterialEditorPreviewWindow MaterialEditorPreviewWindow = "MaterialEditorPreviewWindow"; MaterialEditorPropertiesWindow MaterialEditorPropertiesWindow = "MaterialEditorPropertiesWindow"; DatablockEditorTreeWindow DatablockEditorTreeWindow = "DatablockEditorTreeWindow"; DatablockEditorInspectorWindow DatablockEditorInspectorWindow = "DatablockEditorInspectorWindow"; DecalEditorGui.DecalEditorWindow DecalEditorWindow = "DecalEditorWindow"; DecalEditorGui.DecalPreviewWindow DecalPreviewWindow = "DecalPreviewWindow"; ForestEditorGui.ForestEditorPalleteWindow ForestEditorPalleteWindow = "ForestEditorPalleteWindow"; ForestEditorGui.ForestEditorPropertiesWindow ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow"; MeshRoadEditorGui.MeshRoadEditorTreeWindow MeshRoadEditorTreeWindow = "MeshRoadEditorTreeWindow"; MeshRoadEditorGui.MeshRoadEditorOptionsWindow MeshRoadEditorOptionsWindow = "MeshRoadEditorOptionsWindow"; GuiWindowCollapseCtrl MissionAreaEditorTerrainWindow = "MissionAreaEditorTerrainWindow"; GuiWindowCollapseCtrl MissionAreaEditorPropertiesWindow = "MissionAreaEditorPropertiesWindow"; ParticleEditor.gui.ParticleEditor.PE_Window PE_Window = "PE_Window"; RiverEditorGui.RiverEditorTreeWindow RiverEditorTreeWindow = "RiverEditorTreeWindow"; RiverEditorGui.RiverEditorOptionsWindow RiverEditorOptionsWindow = "RiverEditorOptionsWindow"; RoadEditorGui.RoadEditorTreeWindow RoadEditorTreeWindow = "RoadEditorTreeWindow"; RoadEditorGui.RoadEditorOptionsWindow RoadEditorOptionsWindow = "RoadEditorOptionsWindow"; ShapeEdAdvancedWindow ShapeEdAdvancedWindow = "ShapeEdAdvancedWindow"; ShapeEdSelectWindow ShapeEdSelectWindow = "ShapeEdSelectWindow"; ShapeEdPropWindow ShapeEdPropWindow = "ShapeEdPropWindow"; MessageHud MessageHud = "MessageHud"; EWTreeWindow["wasOpen"] = EWTreeWindow["isInPopup"]; EWInspectorWindow["wasOpen"] = EWInspectorWindow["isInPopup"]; TerrainPainter["wasOpen"] = TerrainPainter["isInPopup"]; TerrainPainterPreview["wasOpen"] = TerrainPainterPreview["isInPopup"]; MaterialEditorPreviewWindow["wasOpen"] = MaterialEditorPreviewWindow["isInPopup"]; MaterialEditorPropertiesWindow["wasOpen"] = MaterialEditorPropertiesWindow["isInPopup"]; DatablockEditorTreeWindow["wasOpen"] = DatablockEditorTreeWindow["isInPopup"]; DatablockEditorInspectorWindow["wasOpen"] = DatablockEditorInspectorWindow["isInPopup"]; DecalEditorWindow["wasOpen"] = DecalEditorWindow["isInPopup"]; DecalPreviewWindow["wasOpen"] = DecalPreviewWindow["isInPopup"]; ForestEditorPalleteWindow["wasOpen"] = ForestEditorPalleteWindow["isInPopup"]; ForestEditorPropertiesWindow["wasOpen"] = ForestEditorPropertiesWindow["isInPopup"]; MeshRoadEditorTreeWindow["wasOpen"] = MeshRoadEditorTreeWindow["isInPopup"]; MeshRoadEditorOptionsWindow["wasOpen"] = MeshRoadEditorOptionsWindow["isInPopup"]; MissionAreaEditorTerrainWindow["wasOpen"] = MissionAreaEditorTerrainWindow["isInPopup"]; MissionAreaEditorPropertiesWindow["wasOpen"] = MissionAreaEditorPropertiesWindow["isInPopup"]; PE_Window["wasOpen"] = PE_Window["isInPopup"]; RiverEditorTreeWindow["wasOpen"] = RiverEditorTreeWindow["isInPopup"]; RiverEditorOptionsWindow["wasOpen"] = RiverEditorOptionsWindow["isInPopup"]; RoadEditorTreeWindow["wasOpen"] = RoadEditorTreeWindow["isInPopup"]; RoadEditorOptionsWindow["wasOpen"] = RoadEditorOptionsWindow["isInPopup"]; ShapeEdAdvancedWindow["wasOpen"] = ShapeEdAdvancedWindow["isInPopup"]; ShapeEdSelectWindow["wasOpen"] = ShapeEdSelectWindow["isInPopup"]; ShapeEdPropWindow["wasOpen"] = ShapeEdPropWindow["isInPopup"]; EWTreeWindow.ClosePopOut(); EWInspectorWindow.ClosePopOut(); TerrainPainter.ClosePopOut(); TerrainPainterPreview.ClosePopOut(); MaterialEditorPreviewWindow.ClosePopOut(); MaterialEditorPropertiesWindow.ClosePopOut(); DatablockEditorTreeWindow.ClosePopOut(); DatablockEditorInspectorWindow.ClosePopOut(); DecalEditorWindow.ClosePopOut(); DecalPreviewWindow.ClosePopOut(); ForestEditorPalleteWindow.ClosePopOut(); ForestEditorPropertiesWindow.ClosePopOut(); MeshRoadEditorTreeWindow.ClosePopOut(); MeshRoadEditorOptionsWindow.ClosePopOut(); MissionAreaEditorTerrainWindow.ClosePopOut(); MissionAreaEditorPropertiesWindow.ClosePopOut(); PE_Window.ClosePopOut(); RiverEditorTreeWindow.ClosePopOut(); RiverEditorOptionsWindow.ClosePopOut(); RoadEditorTreeWindow.ClosePopOut(); RoadEditorOptionsWindow.ClosePopOut(); ShapeEdAdvancedWindow.ClosePopOut(); ShapeEdSelectWindow.ClosePopOut(); ShapeEdPropWindow.ClosePopOut(); this.editorDisabled(); Canvas.setContent(gui); if (MessageHud.isObject()) { MessageHud.close(); } EditorGui.writeCameraSettings(); Util._schedule("1000", "0", "checkCursor"); checkCursor(); }
static void Postfix(MessageHud __instance, float ___m_msgQueueTimer, float dt) { if (!modEnabled.Value) { return; } object obj = typeof(MessageHud).GetField("m_msgQeue", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); IEnumerable <object> msgQueue = obj as IEnumerable <object>; if (msgQueue.Count() == 0) { return; } __instance.m_messageText.CrossFadeAlpha(1, 0, true); object currentObj = typeof(MessageHud).GetField("currentMsg", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance); FieldInfo amountfi = currentObj.GetType().GetField("m_amount", BindingFlags.Public | BindingFlags.Instance); FieldInfo textfi = currentObj.GetType().GetField("m_text", BindingFlags.Public | BindingFlags.Instance); string ctext = (string)textfi.GetValue(currentObj); Dictionary <string, object> amounts = new Dictionary <string, object>(); string[] ignore = ignoreKeywords.Value.Split(','); foreach (object msg in msgQueue) { int amount = (int)amountfi.GetValue(msg); string text = (string)textfi.GetValue(msg); foreach (string str in ignore) { if (text.Contains(str)) { continue; } } //if (amount > 1) // text = text.Replace(" x" + amount, ""); if (ctext == text) { amountfi.SetValue(currentObj, (int)amountfi.GetValue(currentObj) + amount); } else if (amounts.ContainsKey(text)) { amountfi.SetValue(amounts[text], (int)amountfi.GetValue(amounts[text]) + amount); } else { amounts[text] = msg; } } int camount = (int)amountfi.GetValue(currentObj); __instance.m_messageText.text = ctext + (camount > 1 ? " x" + camount : ""); typeof(MessageHud).GetField("currentMsg", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(__instance, currentObj); obj.GetType().GetMethod("Clear", BindingFlags.Public | BindingFlags.Instance).Invoke(obj, null); int count = 0; foreach (var kvp in amounts) { if (count < (maxNotifications.Value < 0 ? msgQueue.Count() : maxNotifications.Value)) { int amount = (int)amountfi.GetValue(kvp.Value); string text = (string)textfi.GetValue(kvp.Value); __instance.m_messageText.text = text + (amount > 1 ? " x" + amount : "") + "\n" + __instance.m_messageText.text; } count++; obj.GetType().GetMethod("Enqueue", BindingFlags.Public | BindingFlags.Instance).Invoke(obj, new object[] { kvp.Value }); } }
public static void initClient() { omni.console.print("\n--------- Initializing " + omni.sGlobal["$appName"] + ": Client Scripts ---------"); // Make sure this variable reflects the correct state. omni.bGlobal["$Server::Dedicated"] = false; // Game information used to query the master server omni.sGlobal["$Client::GameTypeQuery"] = omni.sGlobal["$appName"]; omni.sGlobal["$Client::MissionTypeQuery"] = "Any"; // These should be game specific GuiProfiles. Custom profiles are saved out // from the Gui Editor. Either of these may override any that already exist. defaultGameProfiles.Initialize(); customProfiles.Initialize(); // The common module provides basic client functionality client.initBaseClient(); // Use our prefs to configure our Canvas/Window canvas.configureCanvas(); // Load up the Game GUIs //omni.Util.exec("art/gui/PlayGui.gui", false, false); playGui.initialize(); //omni.Util.exec("art/gui/ChatHud.gui", false, false); MessageHud.initialize(); //omni.Util.exec("art/gui/playerList.gui", false, false); PlayerListGui.initializeGui(); //omni.Util.exec("art/gui/hudlessGui.gui", false, false); hudlessGui.initialize(); // Load up the shell GUIs //omni.Util.exec("art/gui/mainMenuGui.gui", false, false); mainMenuGui.initialize(); //omni.Util.exec("art/gui/joinServerDlg.gui", false, false); JoinServerDlg.initialize(); //omni.Util.exec("art/gui/endGameGui.gui", false, false); endGameGui.initialize(); //omni.Util.exec("art/gui/StartupGui.gui", false, false); startupGui.initialize(); //omni.Util.exec("art/gui/chooseLevelDlg.gui", false, false); //chooseLevelDlg.Initialize(); //omni.Util.exec("art/gui/loadingGui.gui", false, false); loadingGui.initialize(); //omni.Util.exec("art/gui/optionsDlg.gui", false, false); OptionsDlg.initialize(); ToolsDlg.initialize(); CBObjectRenameCtrl.initialize(); ContentBrowserGui.initialize(); //omni.Util.exec("art/gui/remapDlg.gui", false, false); RemapDlg.initialize(); // Gui scripts PlayerListGui.initialize(); chatHud.initialize(); //omni.Util.exec("scripts/gui/optionsDlg.cs", false, false); Misc.initialize(); // Client scripts missionDownload.initialize(); // Load useful Materials shaders.initialize_CustomShaders(); // Default player key bindings defaultBind.initialize(); if (omni.Util.isFile("scripts/client/config.cs")) { omni.Util.exec("scripts/client/config.cs", false, false); } //string[] files = Directory.GetFiles( System.IO.Path.Combine( AppDomain.CurrentDomain.BaseDirectory,@"art\gui"), "*.png", SearchOption.AllDirectories); //foreach (string file in files) // { // ObjectCreator oc_Newobject1 = new ObjectCreator("GuiBitMapCtrl", ""); // oc_Newobject1["Enabled"] = "1"; // oc_Newobject1["isContainer"] = "0"; // oc_Newobject1["Profile"] = "GuiDefaultProfile"; // oc_Newobject1["HorizSizing"] = "right"; // oc_Newobject1["VertSizing"] = "bottom"; // oc_Newobject1["position"] = "10 31"; // oc_Newobject1["Extent"] = "400 300"; // oc_Newobject1["MinExtent"] = "8 2"; // oc_Newobject1["canSave"] = "1"; // oc_Newobject1["Visible"] = "1"; // oc_Newobject1["tooltipprofile"] = "GuiToolTipProfile"; // oc_Newobject1["hovertime"] = "1000"; // oc_Newobject1["bitmap"] = file; // oc_Newobject1["wrap"] = "0"; // oc_Newobject1.Create(); // } core.loadMaterials(); // Really shouldn't be starting the networking unless we are // going to connect to a remote server, or host a multi-player // game. omni.Util.setNetPort(0, false); omni.console.Call("setDefaultFov", new[] { omni.sGlobal["$pref::Player::defaultFov"] }); omni.console.Call("setZoomSpeed", new[] { omni.sGlobal["$pref::Player::zoomSpeed"] }); audioData.initialize(); // Start up the main menu... this is separated out into a // method for easier mod override if (omni.bGlobal["$startWorldEditor"] || omni.bGlobal["$startGUIEditor"]) { // Editor GUI's will start up in the primary main.cs once // engine is initialized. return; } if (omni.sGlobal["$JoinGameAddress"] != "") { loadLoadingGui("loadLoadingGui"); missionDownload.connect(omni.sGlobal["$JoinGameAddress"]); } else { // Otherwise go to the splash screen. ((GuiCanvas)"canvas").setCursor("DefaultCursor"); startupGui.loadStartup(); //omni.console.Call("loadStartup"); } }