Пример #1
0
    void Start()
    {
        GameObject levelObject = GameObject.Find("Level Handle");

        if (levelObject != null)
        {
            levelHandle = levelObject.GetComponent <level>();
        }
        if (levelHandle == null)
        {
            Debug.Log("Cannot find 'level' script");
        }
        GameObject menuObj = GameObject.Find("Menu");

        menu      = menuObj.GetComponent <IngameMenu>();
        energy    = 100;
        maxEnergy = energy;
        if (Application.loadedLevelName == "Tutorial")
        {
            InvokeRepeating("DecreaseBattery", 18f, 1f);
        }
        else
        {
            InvokeRepeating("DecreaseBattery", 1f, levelHandle.energyDrain);
        }
        Invoke("GetValue", 0f);
        //playerValue = Random.Range (1, levelHandle.batasPlayer);
        ///Test.text = "" + playerValue;
    }
        internal static void Postfix(IngameMenu __instance)
        {
            var devMode = Config.EnableDevMode;

            IngameMenu.main.developerMode = devMode;
            IngameMenu.main.developerButton.gameObject.SetActive(devMode);
        }
Пример #3
0
        private static void Postfix(IngameMenu __instance)
        {
            if (GameModeUtils.IsPermadeath())
            {
                return;
            }

            if (__instance != null && quitButton == null)
            {
                var prefab = __instance.quitToMainMenuButton.transform.parent.GetChild(0).gameObject.GetComponent <Button>();
                quitButton      = GameObject.Instantiate(prefab, __instance.quitToMainMenuButton.transform.parent);
                quitButton.name = "ButtonQuitToDesktop";
                quitButton.onClick.RemoveAllListeners();
                quitButton.onClick.AddListener(() => { __instance.QuitGame(true); });

                IEnumerable <Text> texts = quitButton.GetComponents <Text>().Concat(quitButton.GetComponentsInChildren <Text>());
                foreach (Text text in texts)
                {
                    text.text = "Quit to Desktop";
                }

                texts = __instance.quitToMainMenuButton.GetComponents <Text>().Concat(__instance.quitToMainMenuButton.GetComponentsInChildren <Text>());
                foreach (Text text in texts)
                {
                    text.text = "Quit to Main Menu";
                }
            }
        }
 public static void Postfix(IngameMenu __instance, bool quitToDesktop)
 {
     if (!quitToDesktop)
     {
         Fish_Out_Of_Water.fishOutOfWater = new Dictionary <LiveMixin, float>();
     }
 }
Пример #5
0
 // Use this for initialization
 void Start()
 {
     audiosource  = GetComponent <AudioSource>();
     animator     = GetComponent <Animator>();
     ingameMenu   = GameObject.FindGameObjectWithTag("Canvas").GetComponent <IngameMenu>();
     playerScript = camera.gameObject.GetComponent <Player>();
     isRecoiling  = false;
 }
Пример #6
0
 private static void setupIngameMenu()
 {
     if (ingameMenu == null && !ingameMenu)
     {
         ingameMenu = Instantiate(defaultIngamePrefab);
         ingameMenu.onReturnToGame += closeIngameMenu;
     }
 }
Пример #7
0
 public static void Postfix(IngameMenu __instance, bool quitToDesktop)
 {
     //ErrorMessage.AddDebug("QuitGameAsync " + quitToDesktop);
     if (!quitToDesktop)
     {
         gameLoaded = false;
         Fish_Out_Of_Water.fishOutOfWater = new Dictionary <LiveMixin, float>();
     }
 }
Пример #8
0
 public static void Initialize()
 {
     mainMenu     = new MainMenu();
     LoadGameMenu = new LoadGameMenu();
     ingameMenu   = new IngameMenu();
     newGameMenu  = new NewGameMenu();
     SlotSelector = new SlotSelector();
     OptionMenuManager.Initialize();
 }
        internal static void Postfix(IngameMenu __instance)
        {
            __instance.feedbackButton.interactable = false;
            Transform transform = __instance.transform.Find("Main/ButtonLayout/ButtonFeedback");

            if (transform != null)
            {
                transform.GetComponent <Button>().interactable = false;
            }
        }
Пример #10
0
        public static void Postfix(IngameMenu __instance)
        {
            if (GameModeUtils.IsPermadeath())
            {
                return;
            }

            if (__instance != null && quitButton == null)
            {
                // make a new confirmation Menu
                var quitConfirmationPrefab = __instance.gameObject.FindChild("QuitConfirmation");
                quitConfirmation      = GameObject.Instantiate(quitConfirmationPrefab, __instance.gameObject.FindChild("QuitConfirmation").transform.parent);
                quitConfirmation.name = "QuitToDesktopConfirmation";


                // get the No Button and add the needed listeners to it
                var noButtonPrefab = quitConfirmation.gameObject.transform.Find("ButtonNo").GetComponent <Button>();
                noButtonPrefab.onClick.RemoveAllListeners();
                noButtonPrefab.onClick.AddListener(() => { __instance.Close(); });


                // get the Yes Button and add the needed listeners to it
                var yesButtonPrefab = quitConfirmation.gameObject.transform.Find("ButtonYes").GetComponent <Button>();
                yesButtonPrefab.onClick.RemoveAllListeners();
                yesButtonPrefab.onClick.AddListener(() => { __instance.QuitGame(true); });


                // make the Quit To Desktop Button
                var buttonPrefab = __instance.quitToMainMenuButton;
                quitButton      = GameObject.Instantiate(buttonPrefab, __instance.quitToMainMenuButton.transform.parent);
                quitButton.name = "ButtonQuitToDesktop";
                quitButton.onClick.RemoveAllListeners();
                quitButton.onClick.AddListener(() => { __instance.gameObject.FindChild("QuitConfirmationWithSaveWarning").SetActive(false); });  // set the confirmation with save false so it doesn't conflict
                quitButton.onClick.AddListener(() => { __instance.gameObject.FindChild("QuitConfirmation").SetActive(false); });                 // set the Quit To Main Menu confirmation to false so it doesn't conflict
                if (!QPatch.Config.ShowConfirmationDialog)
                {
                    quitButton.onClick.AddListener(() => { __instance.QuitGame(true); });
                }
                else if (QPatch.Config.ShowConfirmationDialog)
                {
                    quitButton.onClick.AddListener(() => { quitConfirmation.SetActive(true); });                     // set our new confirmation to true
                }
                IEnumerable <Text> texts = quitButton.GetComponents <Text>().Concat(quitButton.GetComponentsInChildren <Text>());
                foreach (Text text in texts)
                {
                    text.text = "Quit to Desktop";
                }

                texts = __instance.quitToMainMenuButton.GetComponents <Text>().Concat(__instance.quitToMainMenuButton.GetComponentsInChildren <Text>());
                foreach (Text text in texts)
                {
                    text.text = "Quit to Main Menu";
                }
            }
        }
Пример #11
0
    void Start()
    {
        instance = this;

        weaponDialog.SetActive(true);

        audioMan = audioManager.GetComponent <AudioManager>();

        GameMaster.PauseGame();
        PauseGame();
    }
Пример #12
0
        public static void Postfix(IngameMenu __instance)
        {
            if (GameModeUtils.IsPermadeath())
            {
                return;
            }

            if (__instance != null && quitButton == null)
            {
                // make a new Confirmation Menu
                var confirmationMenuPrefab = __instance.gameObject.FindChild("QuitConfirmation");
                quitConfirmation      = GameObject.Instantiate(confirmationMenuPrefab, __instance.gameObject.FindChild("QuitConfirmation").transform.parent);
                quitConfirmation.name = "QuitToDesktopConfirmation";

                // get the no button from the confirmation menu and add the needed listener
                var noButtonPrefab = quitConfirmation.gameObject.transform.Find("ButtonNo").GetComponent <Button>();
                noButtonPrefab.onClick.RemoveAllListeners();
                noButtonPrefab.onClick.AddListener(() => { __instance.Close(); });

                // get the yes button from the confirmation menu and add the needed listener
                var yesButtonPrefab = quitConfirmation.gameObject.transform.Find("ButtonYes").GetComponent <Button>();
                yesButtonPrefab.onClick.RemoveAllListeners();
                yesButtonPrefab.onClick.AddListener(() => { __instance.QuitGame(true); });


                // make a new button
                var buttonPrefab = __instance.quitToMainMenuButton.gameObject.GetComponent <Button>();
                quitButton      = GameObject.Instantiate(buttonPrefab, __instance.quitToMainMenuButton.transform.parent);
                quitButton.name = "ButtonQuitToDesktop";
                quitButton.onClick.RemoveAllListeners();
                quitButton.onClick.AddListener(() => { __instance.gameObject.FindChild("QuitConfirmationWithSaveWarning").SetActive(false); });
                quitButton.onClick.AddListener(() => { __instance.gameObject.FindChild("QuitConfirmation").SetActive(false); });
                quitButton.onClick.AddListener(() => { quitConfirmation.SetActive(true); });

                IEnumerable <TextMeshProUGUI> texts = quitButton.GetComponents <TextMeshProUGUI>().Concat(quitButton.GetAllComponentsInChildren <TextMeshProUGUI>());

                foreach (var text in texts)
                {
                    text.text = "Quit to Desktop"; // change our Button text to Quit To Desktop
                }

                texts = __instance.quitToMainMenuButton.GetComponents <TextMeshProUGUI>().Concat(__instance.quitToMainMenuButton.GetAllComponentsInChildren <TextMeshProUGUI>());

                foreach (var text in texts)
                {
                    text.text = "Quit to Main Menu"; // change the Quit button text into Quit to Main Menu
                }
            }
        }
 public static void IGM_Awake_Postfix(IngameMenu __instance)
 {
     if (__instance != null && MainPatcher.recenterVRButton == null)
     {
         MainPatcher.recenterVRButton = UnityEngine.Object.Instantiate <Button>(__instance.quitToMainMenuButton.transform.parent.GetChild(0).gameObject.GetComponent <Button>(), __instance.quitToMainMenuButton.transform.parent);
         MainPatcher.recenterVRButton.transform.SetSiblingIndex(1);
         MainPatcher.recenterVRButton.name = "RecenterVR";
         MainPatcher.recenterVRButton.onClick.RemoveAllListeners();
         MainPatcher.recenterVRButton.onClick.AddListener(delegate()
         {
             VRUtil.Recenter();
         });
         foreach (Text text in MainPatcher.recenterVRButton.GetComponents <Text>().Concat(MainPatcher.recenterVRButton.GetComponentsInChildren <Text>()))
         {
             text.text = "Recenter VR";
         }
     }
 }
Пример #14
0
    // Use this for initialization
    void Start()
    {
        character = Instantiate(character_prefab,new Vector3(0,1,0),Quaternion.identity) as GameObject;
        character.transform.parent = this.transform;
        control = character.GetComponent<Control>();
        control.main = this;
        ingameMenu = GetComponent<IngameMenu>();
        ingameMenu.main = this;
        stats = character.GetComponent<Stats>();
        stats.statsOwner = this.transform;
        stats.level = 1;
        stats.updateStats(true);
        saveLoader = GetComponent<SaveLoader>();
        saveLoader.main = this;

        if(GameObject.Find("load") != null)
        {
            saveLoader.loadGame();
            Destroy(GameObject.Find("load"));
        }
    }
Пример #15
0
 //code copied from the quit to desktop mod and modified
 static void Postfix(IngameMenu __instance)
 {
     if (__instance != null && recenterVRButton == null)
     {
         //Clone the quitToMainMenuButton and update it
         Button menuButton = __instance.quitToMainMenuButton.transform.parent.GetChild(0).gameObject.GetComponent <Button>();
         recenterVRButton = UnityEngine.Object.Instantiate <Button>(menuButton, __instance.quitToMainMenuButton.transform.parent);
         recenterVRButton.transform.SetSiblingIndex(1); //put the button in the second position in the menu
         recenterVRButton.name = "RecenterVR";
         recenterVRButton.onClick.RemoveAllListeners(); //remove cloned listeners
         //add new listener
         recenterVRButton.onClick.AddListener(delegate()
         {
             VRUtil.Recenter();
         });
         //might be a better way to replace the text of the copied button
         IEnumerable <Text> enumerable = recenterVRButton.GetComponents <Text>().Concat(recenterVRButton.GetComponentsInChildren <Text>());
         foreach (Text text in enumerable)
         {
             text.text = "Recenter VR";
         }
     }
 }
 public static void Postfix(IngameMenu __instance)
 {
     if (__instance != null && recenterVRButton == null)
     {
         //I think this is copying an existing button
         Button menuButton = __instance.quitToMainMenuButton.transform.parent.GetChild(0).gameObject.GetComponent <Button>();
         recenterVRButton = UnityEngine.Object.Instantiate <Button>(menuButton, __instance.quitToMainMenuButton.transform.parent);
         recenterVRButton.transform.SetSiblingIndex(1); //put the button in the second position in the menu
         recenterVRButton.name = "RecenterVR";
         recenterVRButton.onClick.RemoveAllListeners(); //this seems to be removing listeners that would have been copied from the original button
                                                        //add new listener
         recenterVRButton.onClick.AddListener(delegate()
         {
             VRUtil.Recenter();
         });
         //might be a better way to replace the text of the copied button
         var enumerable = recenterVRButton.GetComponents <TextMeshProUGUI>().Concat(recenterVRButton.GetComponentsInChildren <TextMeshProUGUI>());
         foreach (var text in enumerable)
         {
             text.text = "Recenter VR";
         }
     }
 }
Пример #17
0
    // Use this for initialization
    void Start()
    {
        GameObject menuObj = GameObject.Find("Menu");

        menu           = menuObj.GetComponent <IngameMenu>();
        Time.timeScale = 1;
        animator       = this.GetComponent <Animator> ();
        animator.SetInteger("State", 0);
        triggered      = false;
        triggeredTime  = 0;
        teleTime       = 0;
        jump           = false;
        trueTriggered  = false;
        falseTriggered = false;
        curHeight      = prevHeight = 0.0f;
        score          = tmpScore = 0;
        textScore.text = "0000";
        tmpVelocity    = velocity;
        GameObject levelObject = GameObject.Find("Level Handle");

        levelHandle = levelObject.GetComponent <level>();
        died        = false;
        finished    = false;
    }
Пример #18
0
 public static bool Prefix(ref uGUI_GraphicRaycaster raycaster, IngameMenu __instance)
 {
     RaycastFixer.Fix(ref raycaster, __instance);
     return(false);
 }
Пример #19
0
 public Menu()
 {
     _mainMenu   = new MainMenu();
     _ingameMenu = new IngameMenu();
 }