コード例 #1
0
        public static void Prefix(Menuu __instance, ref Ray ___ray, ref RaycastHit ___hit)
        {
            if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
            {
                ___ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                if (Physics.Raycast(___ray, out ___hit, 10f))
                {
                    switch (___hit.transform.gameObject.name)
                    {
                    case "bModMenu":
                        __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/confirm"), Menuu.soundLevel / 10f);
                        __instance.StartCoroutine(ModMenu(__instance));
                        break;

                    case "bQuit":
                        foreach (System.Diagnostics.Process process in ModMenuController.ConfigHandles)
                        {
                            if (process != null && !process.HasExited)
                            {
                                process.Kill();
                            }
                        }
                        break;

                    case "bSelectorPageBack":
                        __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/confirm"), Menuu.soundLevel / 10f);
                        {
                            if (PatchMethods.characterFeatureRegistries.TryGetValue(__instance.GetFieldValue <int>("stuffSelecting"), out ICharacterFeatureRegistry characterFeatureRegistry))
                            {
                                int currentPage = characterFeatureRegistry.GetCurrentPage();
                                characterFeatureRegistry.SetCurrentPage(--currentPage);
                            }
                        }
                        break;

                    case "bSelectorPageForward":
                        __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/confirm"), Menuu.soundLevel / 10f);
                        {
                            if (PatchMethods.characterFeatureRegistries.TryGetValue(__instance.GetFieldValue <int>("stuffSelecting"), out ICharacterFeatureRegistry characterFeatureRegistry))
                            {
                                int currentPage = characterFeatureRegistry.GetCurrentPage();
                                characterFeatureRegistry.SetCurrentPage(++currentPage);
                            }
                        }
                        break;
                    }
                }
            }
        }
コード例 #2
0
 public static bool Prefix(Menuu __instance, ref Ray ___ray, ref RaycastHit ___hit)
 {
     if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
     {
         ___ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         if (Physics.Raycast(___ray, out ___hit, 10f))
         {
             if (___hit.transform.gameObject.name.Equals("bModMenu"))
             {
                 __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/confirm"), Menuu.soundLevel / 10f);
                 __instance.StartCoroutine(ModMenu(__instance));
                 return(false);
             }
             else if (___hit.transform.gameObject.name.Equals("bQuit"))
             {
                 foreach (System.Diagnostics.Process process in ModMenuController.ConfigHandles)
                 {
                     if (process != null && !process.HasExited)
                     {
                         process.Kill();
                     }
                 }
             }
         }
     }
     return(true);
 }
コード例 #3
0
 public static bool Prefix(Menuu __instance, int a, ref int ___stuffSelecting)
 {
     if (PatchMethods.characterFeatureRegistries.TryGetValue(___stuffSelecting, out ICharacterFeatureRegistry characterFeatureRegistry))
     {
         int featureIndex = (characterFeatureRegistry.GetCurrentPage() - 1) * characterFeatureRegistry.GetPageSize() + a;
         if (characterFeatureRegistry.IsFeatureUnlocked(featureIndex))
         {
             __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/CLICK1"), Menuu.soundLevel / 10f);
             characterFeatureRegistry.SelectFeature(featureIndex);
             InstanceTracker.Menuu.stuffChosen.SetActive((characterFeatureRegistry.GetSelectedFeature() / characterFeatureRegistry.GetPageSize()) + 1 == characterFeatureRegistry.GetCurrentPage());
             __instance.stuffChosen.transform.position = new Vector3(__instance.box[a].transform.position.x, __instance.box[a].transform.position.y, -3f);
             __instance.RefreshPlayer();
         }
         return(false);
     }
     else
     {
         return(true);
     }
 }
コード例 #4
0
 public static bool Prefix(Menuu __instance, ref Ray ___ray, ref RaycastHit ___hit)
 {
     if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
     {
         ___ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         if (Physics.Raycast(___ray, out ___hit, 10f))
         {
             if (___hit.transform.gameObject.name.Equals("bModMenu"))
             {
                 __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/confirm"), Menuu.soundLevel / 10f);
                 if (GadgetCore.IsUnpacked)
                 {
                     __instance.StartCoroutine(ModMenu(__instance));
                 }
                 else
                 {
                     __instance.StartCoroutine(UnpackGadgetCore());
                 }
                 return(false);
             }
             else if (___hit.transform.gameObject.name.Equals("bQuit"))
             {
                 foreach (System.Diagnostics.Process process in ModDescPanelController.ConfigHandles)
                 {
                     if (process != null && !process.HasExited)
                     {
                         process.Kill();
                     }
                 }
             }
             else if (___hit.transform.gameObject.name.Equals("bPlay") && !GadgetCore.IsUnpacked)
             {
                 GadgetCore.Log(GadgetCoreAPI.GetCursorPos().ToString());
                 GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("txtError"), GadgetCoreAPI.GetCursorPos() + new Vector3(0, 0, 9), Quaternion.identity);
                 gameObject.SendMessage("InitError", "You must unpack Gadget Core before playing!");
                 return(false);
             }
         }
     }
     return(true);
 }