public static bool AttemptActiveReloadOnlyMultireload(this GameUIRoot self, PlayerController targetPlayer) { int index = (!targetPlayer.IsPrimaryPlayer) ? 1 : 0; bool flag = ((List <GameUIReloadBarController>)info3.GetValue(self))[index].AttemptActiveReloadOnlyMultireload(); return(flag); }
//局部世界转换到屏幕坐标 public Vector3 LocalToWorldUIPosition(RectTransform localRtTrans, RectTransform worldRtTrans) { Vector3 p = localRtTrans.position - worldRtTrans.position; p = GameUIRoot.Instance().WorldToScreenPoint(p); p = GameUIRoot.Instance().ScreenToUIPosition(p); return(p); }
public static void DFManagerStartHook(Action <dfGUIManager> orig, dfGUIManager manager) { orig(manager); GameUIRoot root = manager.GetComponent <GameUIRoot>(); if (root != null && GameUIRoot.Instance != null && root == GameUIRoot.Instance && UIRootPrefab != null && root.name == UIRootPrefab.name && root.GetComponent <UIRootProcessedFlag>() == null) { BraveOptionsMenuItem menu = root.transform.Find("OptionsMenuPanelDave").Find("CentralOptionsPanel").Find("GameplayOptionsScrollablePanel").Find("CursorSelectorPanel").GetComponent <BraveOptionsMenuItem>(); BraveOptionsMenuItem prefabMenu = root.transform.Find("OptionsMenuPanelDave").Find("CentralOptionsPanel").Find("GameplayOptionsScrollablePanel").Find("CursorSelectorPanel").GetComponent <BraveOptionsMenuItem>(); List <string> strings = new List <string>(); foreach (string str in prefabMenu.labelOptions) { strings.Add(str); } menu.labelOptions = strings.ToArray(); List <Texture2D> textures = new List <Texture2D>(); foreach (Texture2D texture in UIRootPrefab.GetComponentInChildren <GameCursorController>().cursors) { textures.Add(texture); } root.GetComponentInChildren <GameCursorController>().cursors = textures.ToArray(); root.gameObject.AddComponent <UIRootProcessedFlag>(); } }
private void Awake() { sLayer = this; DontDestroyOnLoad(gameObject); }
/// <summary> /// Update hook for item tracking /// Hooked onto TimeInvariantMonoBehaviour.Update, but targeted at GameUIRoot /// </summary> /// <param name="orig"></param> /// <param name="timeBehaviour"></param> public static void UpdateHook(Action <TimeInvariantMonoBehaviour> orig, TimeInvariantMonoBehaviour timeBehaviour) { //call the original method on TimeInvariantMonoBehaviour orig(timeBehaviour); //Check if this is the GameUIRoot if (timeBehaviour is GameUIRoot) { //Run update loop GameUIRoot uiRoot = timeBehaviour as GameUIRoot; //Dynamically initialize the label, if it's null if (label == null) { //get the label used to list the number of keys the player has dfLabel keyLabel = uiRoot.p_playerKeyLabel; if (keyLabel != null) { //create a new label, to display under key label GameObject newLabelGO = new GameObject("Label"); newLabelGO.transform.parent = keyLabel.transform; label = newLabelGO.AddComponent <dfLabel>(); //initialize the new label with the data needed. label.Font = keyLabel.Font; label.Position = keyLabel.Position + Vector3.down * 100; label.AutoSize = true; label.Text = "An error has occured. Plase contact the ItemCard mod developer"; label.IsVisible = true; //Disable is localized to disable text translating label.IsLocalized = false; label.ProcessMarkup = true; label.TextScale = (int)(keyLabel.TextScale * 2f / 3f); } } //test case if the label is null if (label == null) { return; } //update the label to display item cards try { PlayerController player = Gungeon.Game.PrimaryPlayer; bool draw = false; if (player != null) { if (!player.IsInCombat) { draw = true; } } if (draw) { label.Text = GetItemCard(); } else { label.Text = ""; } } catch (System.Exception e) { //catch and display errors label.Text = e.ToString() + "\nAn error has occured. Plase contact the ItemCard mod developer";; } } }