Пример #1
0
    // Use this for initialization
    void Start()
    {
        //Cursor.visible = false;
        List <Button> button    = new List <Button>(GameObject.FindObjectsOfType <Button>());
        Button        newGameb  = button.FirstOrDefault(b => b.name == "New Game");
        Button        cntinueb  = button.FirstOrDefault(b => b.name == "Continue");
        Button        settingsb = button.FirstOrDefault(b => b.name == "Settings");
        Button        controlsb = button.FirstOrDefault(b => b.name == "Controls");
        Button        quitb     = button.FirstOrDefault(b => b.name == "Quit");

        cntinueb.GetComponentInChildren <Text> ().color = new Color(0, 0, 0, 0.3f);

        buttons = new List <Button> ()
        {
            newGameb, cntinueb, settingsb, controlsb, quitb
        };

        GameObject canvas = GameObject.Find("Canvas");

        settings = canvas.GetComponentInChildren <SettingsMenu> ();
        ctrls    = canvas.GetComponentInChildren <ControlsMenu> ();

        List <GameObject> r = GameObject.FindGameObjectsWithTag("Submenu").ToList();

        main = GameObject.FindGameObjectsWithTag("Submenu").First(s => s.name == "Main");

        SettingsManager m = SettingsManager.Instance;

        StartCoroutine(WriteTitle());

        settings.gameObject.SetActive(false);
        ctrls.gameObject.SetActive(false);
    }
Пример #2
0
 static void Postfix(ControlsMenu __instance)
 {
     ModuleManager.OnResetAll += () =>
     {
         __instance.UpdateCurrentSchemeNameLabel();
     };
 }
 public void BackToMainMenu()
 {
     MainMenu.SetActive(true);
     HowToPlayMenu.SetActive(false);
     BasicInfoMenu.SetActive(false);
     PowerUpInfoMenu.SetActive(false);
     ControlsMenu.SetActive(false);
 }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     mainmenu     = FindObjectOfType <MainMenu>();
     soundmenu    = FindObjectOfType <SoundMenu>();
     videomenu    = FindObjectOfType <VideoMenu>();
     controlsmenu = FindObjectOfType <ControlsMenu>();
     menus        = new GameObject[] { mainmenu.gameObject, videomenu.gameObject, soundmenu.gameObject, controlsmenu.gameObject };
     openMenu(0);
 }
 static bool Prefix(ControlsMenu __instance)
 {
     if (!__instance.selectedControlScheme_)
     {
         return(false);
     }
     __instance.currentSchemeNameLabel_.text = string.Format(Language.GetLine(__instance.inSchemeEditingMode_ ? "settings.controls.info.editing" : "settings.controls.info.viewing"), __instance.selectedControlScheme_.name_);
     return(false);
 }
Пример #6
0
 public void getScripts()
 {
     main       = GameObject.Find("MainMenu").GetComponent <MainMenu>();
     selectMenu = GameObject.Find("SelectStageMenu").GetComponent <StageSelectMenu>();
     controls   = GameObject.Find("ControlsMenu").GetComponent <ControlsMenu>();
     settings   = GameObject.Find("SettingsMenu").GetComponent <SettingsMenu>();
     stage      = GameObject.Find("StageMenu").GetComponent <StageMenu>();
     play       = GameObject.Find("GameManager").GetComponent <PlayMenu>();
     end        = GameObject.Find("EndGame").GetComponent <EndGameMenu>();
 }
Пример #7
0
    public void HandleControls()
    {
        G4.LogEvent("PressButton", "ControlButton", "HasPressed", 1);

        // Builder Hit with all Event parameters.
        G4.LogEvent(new EventHitBuilder()
                    .SetEventCategory("PressButton")
                    .SetEventAction("ControlButton")
                    .SetEventLabel("HasPressed")
                    .SetEventValue(1));

        Debug.Log("Sent");
        ControlsMenu.SetActive(true);
        StartMenu.SetActive(false);
    }
Пример #8
0
    void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);
    }
Пример #9
0
    // Use this for initialization
    void Start()
    {
        settings   = GetComponentInChildren <SettingsMenu> ();
        compendium = GetComponentInChildren <CompendiumMenu> ();
        controls   = GetComponentInChildren <ControlsMenu> ();
        settings.gameObject.SetActive(false);
        compendium.gameObject.SetActive(false);
        controls.gameObject.SetActive(false);

        GameObject[] optionlist = GameObject.FindGameObjectsWithTag("Option");
        foreach (GameObject option in optionlist)
        {
            options.Add(option.GetComponent <Button> ());
        }
        options = options.OrderBy(y => y.transform.position.y).Reverse().ToList();

        main = GameObject.Find("Main");

        PlayerController player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController> ();

        player.PowerupChange += this.c_ItemChangeEvent;

        gameObject.SetActive(false);
    }
Пример #10
0
 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 //                                                                                                                        CreateControlsMenu()
 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 public void CreateControlsMenu()
 {
     _controlsmenu = new ControlsMenu();
     AddChild(_controlsmenu);
 }
Пример #11
0
 private void Awake()
 {
     Instance = this;
 }
 public void Controls()
 {
     HowToPlayMenu.SetActive(false);
     ControlsMenu.SetActive(true);
 }
Пример #13
0
    /*private void PrintFrameRate()
     * {
     *      float temp = 1.0f/Time.deltaTime;
     *      if(temp < 90 && temp != 50)
     *              Debug.Log(Time.time + ": Frame Rate below 90, its " + temp);
     * }*/

    //  INIT LEVEL
    private void InitLevel()
    {
        // Components
        controllerLayout = GameObject.Find("ControllerLayout").GetComponent <ControllerLayout>();
        player           = GameObject.Find("VRCameraRig").GetComponent <Player>();
        controllerInput  = player.gameObject.GetComponent <ControllerInput>();
        L_controller_GO  = GameObject.Find("VRCameraRig/OVRCameraRig/TrackingSpace/LeftHandAnchor");
        R_controller_GO  = GameObject.Find("VRCameraRig/OVRCameraRig/TrackingSpace/RightHandAnchor");
        L_mask           = GameObject.Find("VRCameraRig/OVRCameraRig/TrackingSpace/LeftEyeAnchor/Mask");
        R_mask           = GameObject.Find("VRCameraRig/OVRCameraRig/TrackingSpace/RightEyeAnchor/Mask");

        /*L_controller_GO = GameObject.Find("Player/TrackingSpace/LeftHandAnchor");
         * R_controller_GO = GameObject.Find("Player/TrackingSpace/RightHandAnchor");
         * L_mask = GameObject.Find("Player/TrackingSpace/LeftEyeAnchor/Mask");
         * R_mask = GameObject.Find("Player/TrackingSpace/RightEyeAnchor/Mask");*/
        L_maskRend = L_mask.GetComponent <Renderer>();
        R_maskRend = R_mask.GetComponent <Renderer>();
        GameObject temp2 = GameObject.Find("ControlsMenu_UI");

        if (temp2 != null)
        {
            controllerInfo = temp2.GetComponent <ControlsMenu>();
        }
        playerSpeaker = GameObject.Find("VRCameraRig/OVRCameraRig/TrackingSpace/CenterEyeAnchor").GetComponent <AudioSource>();
        ///playerSpeaker = GameObject.Find("Player/TrackingSpace/CenterEyeAnchor").GetComponent<AudioSource>();

        L_haptics = L_controller_GO.GetComponent <OculusHaptics>();
        R_haptics = R_controller_GO.GetComponent <OculusHaptics>();

        GameObject[] temp = GameObject.FindGameObjectsWithTag("Button");
        button = new VRButton[temp.Length];
        for (int i = 0; i < button.Length; i++)
        {
            button[i] = temp[i].GetComponent <VRButton>();            // Stores all objeccts which are buttons
        }
        message_GO = GameObject.Find("VRCameraRig/OVRCameraRig/TrackingSpace/CenterEyeAnchor/Message_UI");
        ///message_GO = GameObject.Find("Player/TrackingSpace/CenterEyeAnchor/Message_UI");
        message_Text = message_GO.GetComponentInChildren <Text>();
        message_GO.transform.LookAt(centerCamTransform);

        // Controller Layout
        if (controllerLayout.layout == ControllerLayout.layoutEnum.reversed)
        {
            SwitchControllers();             // if controllers are reveresed previously, then switch now.
        }
        // Player
        player.Init();
        for (int i = 0; i < objSpawner.Length; i++)
        {
            objSpawner[i].Init();
        }
        controllerInput.Init();

        // Scene Transition
        InitSceneTransition(SceneTransition.starting);
        ResetAllButtons();

        if (currentLevel != 0)          // all except main menu level - level 0
        {
            ball = GameObject.Find("Ball").GetComponent <Ball>();

            centerCamTransform = GameObject.Find("VRCameraRig/OVRCameraRig/TrackingSpace/CenterEyeAnchor").transform;
            ///centerCamTransform = GameObject.Find("Player/TrackingSpace/CenterEyeAnchor").transform;


            /*gameOverMenu_GO = GameObject.Find("GameOverMenu_Pivot");
             * levelFinished_text
             *      = GameObject.Find("GameOverMenu_UI/GameOverMenu_Canvas/Heading_Text").GetComponent<Text>();
             * nextLevelText_GO = GameObject.Find("GameOverMenu_UI/GameOverMenu_Canvas/NextLevel_Text");
             * gameOverText_GO  = GameObject.Find("GameOverMenu_UI/GameOverMenu_Canvas/GameOver_Text");
             * levelFinished_text.text = "Level " + currentLevel + " - Finished!";
             * nextLevelText_GO.SetActive(true);
             * gameOverMenu_GO.SetActive(false);*/

            star = GameObject.FindGameObjectsWithTag("Star");
            AllStars_SetActive(true);

            starsCollected = 0;
            ///levelFinished = false;
            isGameStarted = false;
        }
    }
Пример #14
0
 public void Start()
 {
     instance = this;
     gameObject.SetActive(false);
 }
        public void Initialize(ScreenManager screenManager)
        {
            this.screenManager = screenManager;
            GraphicsDevice     = screenManager.GraphicsDevice;
            _content           = new ContentManager(screenManager.ServiceProvider, "Content");

            //Background
            settingsMenu = new Sprite2D(_content.Load <Texture2D>("Sprites/SettingsMenu"), new Rectangle(100, 50, 1080, 620));

            audioSettings    = Settings.Instance.Audio.Clone() as AudioSettings;
            controlsSettings = Settings.Instance.Controls.Clone() as ControlsSettings;
            graphicsSettings = Settings.Instance.Graphics.Clone() as GraphicsSettings;
            rubiksSettings   = Settings.Instance.RubiksCube.Clone() as RubiksCubeSettings;


            SpriteFont font       = _content.Load <SpriteFont>("Fonts/Arial24");
            Texture2D  boxTexture = _content.Load <Texture2D>("Sprites/Transparent");

            ButtonAnimation hover         = new ButtonAnimation(null, null, new Color(0, 255, 255, 150));
            ButtonAnimation unHoverUnMark = new ButtonAnimation(null, null, Color.Transparent);
            ButtonAnimation mark          = new ButtonAnimation(null, null, new Color(0, 180, 255, 250));


            //
            //Buttons
            //

            //
            //Controls
            //
            controlsBtn                  = new OptionsButton(new Sprite2D(boxTexture, new Rectangle(115, 120, 225, 75)));
            controlsBtn.Color            = Color.Transparent;
            controlsBtn.HoverAnimation   = hover;
            controlsBtn.UnHoverAnimation = unHoverUnMark;
            controlsBtn.UnMarkAnimation  = unHoverUnMark;
            controlsBtn.MarkAnimation    = mark;
            controlsBtn.TextMessege      = new Text(categoriesName[0], font);
            controlsBtn.TextMessege.Center(controlsBtn.Bounds);


            //
            //Audio
            //
            audioBtn                  = new OptionsButton(new Sprite2D(boxTexture, new Rectangle(115, 195, 225, 75)));
            audioBtn.Color            = Color.Transparent;
            audioBtn.HoverAnimation   = hover;
            audioBtn.UnHoverAnimation = unHoverUnMark;
            audioBtn.UnMarkAnimation  = unHoverUnMark;
            audioBtn.MarkAnimation    = mark;
            audioBtn.TextMessege      = new Text(categoriesName[1], font);
            audioBtn.TextMessege.Center(audioBtn.Bounds);



            //
            //Window
            //
            windowBtn                  = new OptionsButton(new Sprite2D(boxTexture, new Rectangle(115, 270, 225, 75)));
            windowBtn.Color            = Color.Transparent;
            windowBtn.HoverAnimation   = hover;
            windowBtn.UnHoverAnimation = unHoverUnMark;
            windowBtn.UnMarkAnimation  = unHoverUnMark;
            windowBtn.MarkAnimation    = mark;
            windowBtn.TextMessege      = new Text(categoriesName[2], font);
            windowBtn.TextMessege.Center(windowBtn.Bounds);


            //
            //Rubiks
            //
            rubiksBtn                  = new OptionsButton(new Sprite2D(boxTexture, new Rectangle(115, 345, 225, 75)));
            rubiksBtn.Color            = Color.Transparent;
            rubiksBtn.HoverAnimation   = hover;
            rubiksBtn.UnHoverAnimation = unHoverUnMark;
            rubiksBtn.UnMarkAnimation  = unHoverUnMark;
            rubiksBtn.MarkAnimation    = mark;
            rubiksBtn.TextMessege      = new Text(categoriesName[3], font);
            rubiksBtn.TextMessege.Center(rubiksBtn.Bounds);


            //
            //Menus
            //
            audioMenu = new AudioMenu(audioSettings);
            audioMenu.Initialize(_content, GraphicsDevice);
            audioMenu.Location = new Vector2(375, 65);
            audioMenu.Show     = false;

            rubiksMenu = new RubiksCubeMenu(rubiksSettings);
            rubiksMenu.Initialize(_content, GraphicsDevice);
            rubiksMenu.Location = new Vector2(375, 65);
            rubiksMenu.Show     = false;

            controlsMenu = new ControlsMenu(controlsSettings);
            controlsMenu.Initialize(_content, GraphicsDevice);
            controlsMenu.Location = new Vector2(375, 65);
            controlsMenu.Show     = false;

            graphicsMenu = new GraphicsMenu(graphicsSettings);
            graphicsMenu.Initialize(_content, GraphicsDevice);
            graphicsMenu.Location = new Vector2(375, 65);
            graphicsMenu.Show     = false;


            //
            //Panel
            //
            categories = new MarkableButtonPanel();
            categories.Add(controlsBtn);
            categories.Add(audioBtn);
            categories.Add(windowBtn);
            categories.Add(rubiksBtn);
            categories.SetMarked(0);

            audioBtn.Click    += new EventHandler((s, e) => { audioMenu.Show = true; rubiksMenu.Show = false; controlsMenu.Show = false; graphicsMenu.Show = false; });
            windowBtn.Click   += new EventHandler((s, e) => { audioMenu.Show = false; rubiksMenu.Show = false; controlsMenu.Show = false; graphicsMenu.Show = true; });
            rubiksBtn.Click   += new EventHandler((s, e) => { audioMenu.Show = false; rubiksMenu.Show = true; controlsMenu.Show = false; graphicsMenu.Show = false; });
            controlsBtn.Click += new EventHandler((s, e) => { audioMenu.Show = false; rubiksMenu.Show = false; controlsMenu.Show = true; graphicsMenu.Show = false; });

            //
            //Btns
            //
            backBtn        = new Button(new Sprite2D(_content.Load <Texture2D>("Sprites/BackBtn"), new Rectangle(85, 630, 100, 75)));
            backBtn.Click += On_ExitButtonClick;

            applyBtn        = new Button(new Sprite2D(_content.Load <Texture2D>("Sprites/ApplyBtn"), new Rectangle(1050, 630, 150, 75)));
            applyBtn.Click += On_ApplySettings;

            resetBtn        = new Button(new Sprite2D(_content.Load <Texture2D>("Sprites/ResetBtn"), new Rectangle(825, 630, 150, 75)));
            resetBtn.Click += On_ResetSettings;
        }