Ejemplo n.º 1
0
 /// <summary>
 /// Unloads <see cref="CursorMaker"/>, <see cref="ResourceGetter"/> and <see cref="CursorTools"/>.
 /// </summary>
 public static void Unload()
 {
     if (!m_initialized)
     {
         return;
     }
     if (addedCursorLabelTexts != null)
     {
         BraveOptionsMenuItem menu = UIRootPrefab.transform.Find("OptionsMenuPanelDave").Find("CentralOptionsPanel").Find("GameplayOptionsScrollablePanel").Find("CursorSelectorPanel").GetComponent <BraveOptionsMenuItem>();
         foreach (string str in addedCursorLabelTexts)
         {
             CursorTools.Remove(ref menu.labelOptions, str);
         }
         if (GameUIRoot.Instance != null)
         {
             BraveOptionsMenuItem instanceMenu = GameUIRoot.Instance.transform.Find("OptionsMenuPanelDave").Find("CentralOptionsPanel").Find("GameplayOptionsScrollablePanel").Find("CursorSelectorPanel").GetComponent <BraveOptionsMenuItem>();
             foreach (string str in addedCursorLabelTexts)
             {
                 CursorTools.Remove(ref instanceMenu.labelOptions, str);
             }
         }
         addedCursorLabelTexts.Clear();
         addedCursorLabelTexts = null;
     }
     if (addedCursorTextures != null)
     {
         foreach (Texture2D texture in addedCursorTextures)
         {
             CursorTools.Remove(ref UIRootPrefab.GetComponentInChildren <GameCursorController>().cursors, texture);
         }
         if (GameUIRoot.Instance != null)
         {
             foreach (Texture2D texture in addedCursorTextures)
             {
                 CursorTools.Remove(ref GameUIRoot.Instance.GetComponentInChildren <GameCursorController>().cursors, texture);
             }
         }
         addedCursorTextures.Clear();
         addedCursorTextures = null;
     }
     if (GameUIRoot.Instance != null && GameUIRoot.Instance.GetComponent <UIRootProcessedFlag>() != null)
     {
         UnityEngine.Object.Destroy(GameUIRoot.Instance.GetComponent <UIRootProcessedFlag>());
     }
     CursorTools.Unload();
     ResourceGetter.Unload();
     dfManagerStartHook?.Dispose();
     UIRootPrefab  = null;
     m_initialized = false;
 }
Ejemplo n.º 2
0
        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>();
            }
        }