Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        // Helper Messages Definieren
        HelperMsgs h1 = new HelperMsgs();

        h1.MsgInfo = "First Scan the floor and click on it in order to make a floor reference.";
        h1.MsgName = "Floor reference";
        HelperMsgsList.Add(h1);
        HelperMsgs h2 = new HelperMsgs();

        h2.MsgInfo = "Now Scan your reference image in order to auto-create the CAD machine";
        h2.MsgName = "Image reference";
        HelperMsgsList.Add(h2);
        HelperMsgs h3 = new HelperMsgs();

        h3.MsgInfo = "Select your machine via the FAPS menu in order to:\nRotate and translate the object by 2-/3 finger swiping\nGet machine data by clicking on e.g. the motors\nCheck out the FAPS menu for further possibilities.";
        h3.MsgName = "Interact reference";
        HelperMsgsList.Add(h3);

        SelectedMotorInfo.VisibleWindows   = new List <InfoVisible>();
        SelectedMotorInfo.Canvas_Parameter = new List <string>();
        Set_HelperMsg(h1.MsgInfo);

        SelectableMachines = new List <GameObject>();
        displayTextDebug   = new List <string>();
        ChangeSensitivityButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "\n \n \nSense: 3";


        MotorWindowButtons = new List <GameObject>();
        UnityEngine.UI.Button [] b = LowInfoField.GetComponentsInChildren <UnityEngine.UI.Button>();
        foreach (UnityEngine.UI.Button b1 in b)
        {
            MotorWindowButtons.Add(b1.gameObject);
        }
    }
    public void TogglePause()
    {
        if (gameManager.localGameState == LocalGameState.Paused)
        {
            if (pauseButton != null)
            {
                pauseButton.GetComponentInChildren<TextMeshProUGUI>().text = "Pause";
            }
            gameManager.ResumeGame();
        }
        else
        {
            if (pauseButton != null)
            {
                pauseButton.GetComponentInChildren<TextMeshProUGUI>().text = "Resume";
            }
            gameManager.PauseGame();
        }

        if (audioManager != null)
        {
            if (gameManager.localGameState == LocalGameState.Paused)
            {
                audioManager.audioSource.Stop();
            }
            else
            {
                audioManager.audioSource.Play();
            }
        }
    }
Exemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     // use this to reset furniture
     // PlayerPrefs.DeleteAll();
     addButton.onClick.AddListener(AttemptPurchase);
     removeButton.onClick.AddListener(RemoveFromHouse);
     canReAdd   = false;
     placing    = false;
     initialAdd = true;
     // these colors will be used to control clickability (also see inventory behavior)
     SetButtonColors(Color.green, Color.red);
     // if it hasn't been stored or if the count of how many we have is zero
     // (note that we could one day implement the ability to purchase multiple of the same thing)
     if (!PlayerPrefs.HasKey(this.name) || (PlayerPrefs.HasKey(this.name) && PlayerPrefs.GetInt(this.name) == 0))
     {
         DeterminePrice();
         addButton.GetComponentInChildren <UnityEngine.UI.Text>().text = priceAmt + " " + priceType;
     }
     else if (PlayerPrefs.HasKey(this.name) && PlayerPrefs.GetInt(this.name) > 0)
     {
         initialAdd = false;
         MarkAsPurchased();
         // if the item was purchased and also placed in the house, put it back
         if (PlayerPrefs.HasKey(this.name + "_POSITION"))
         {
             ReturnToPosition();
         }
         else
         {
             canReAdd = true;
         }
     }
 }
Exemplo n.º 4
0
    private void LockObjectInteractionAxes()
    {
        moveAxesLockMode++;
        if (moveAxesLockMode == 4)
        {
            moveAxesLockMode = 0;
        }

        switch (moveAxesLockMode)
        {
        case 0:
            ChangeLockMovementButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "\n \n \nLock: /";
            Interactor.LockX_Axes = false;
            Interactor.LockZ_Axes = false;
            break;

        case 1:
            ChangeLockMovementButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "\n \n \nLock: Z";
            Interactor.LockX_Axes = false;
            Interactor.LockZ_Axes = true;
            break;

        case 2:
            ChangeLockMovementButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "\n \n \nLock: X";
            Interactor.LockX_Axes = true;
            Interactor.LockZ_Axes = false;
            break;

        case 3:
            ChangeLockMovementButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "\n \n \nLock: X&Z";
            Interactor.LockX_Axes = true;
            Interactor.LockZ_Axes = true;
            break;
        }
    }
Exemplo n.º 5
0
#pragma warning disable 0618
	void Awake() {
		button = gameObject.GetComponent<UnityEngine.UI.Button>() as UnityEngine.UI.Button;
		buttonRenderer = button.GetComponentInChildren<CanvasRenderer>() as CanvasRenderer;
		text = button.GetComponentInChildren<Text>() as Text;

		// Hide the button		
		button.enabled = false;
		buttonRenderer.SetAlpha(0);
		text.color = Color.clear;
	}
Exemplo n.º 6
0
 public void TogglePath()
 {
     if (m_grid.m_drawPath)
     {
         m_grid.m_drawPath = false;
         m_pathButton.GetComponentInChildren<UnityEngine.UI.Text>().color = Color.red;
     }
     else
     {
         m_grid.m_drawPath = true;
         m_pathButton.GetComponentInChildren<UnityEngine.UI.Text>().color = Color.green;
     }
 }
Exemplo n.º 7
0
 public void ToggleVisited()
 {
     if (m_grid.m_drawVisited)
     {
         m_grid.m_drawVisited = false;
         m_visitedButton.GetComponentInChildren<UnityEngine.UI.Text>().color = Color.red;
     }
     else
     {
         m_grid.m_drawVisited = true;
         m_visitedButton.GetComponentInChildren<UnityEngine.UI.Text>().color = Color.green;
     }
 }
Exemplo n.º 8
0
 // Callbackfunktion für Movement Mode
 private void SetMovementMode()
 {
     if (movementMode == 0)
     {
         movementMode = 1;
         ChangeMovementModeButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "\n \n \nMotor";
     }
     else if (movementMode == 1)
     {
         movementMode = 0;
         ChangeMovementModeButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "\n \n \nMachine";
     }
 }
Exemplo n.º 9
0
 public void onClick()
 {
     if (Editor.play)
     {
         Editor.play = false;
         self.GetComponentInChildren <UnityEngine.UI.Text>().text = "플레이";
     }
     else
     {
         Editor.play = true;
         self.GetComponentInChildren <UnityEngine.UI.Text>().text = "플레이 중지";
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// Function called when play/pause button is pressed
 /// </summary>
 public void TogglePlay()
 {
     if (isPlaying)
     {
         videoPlayer.Pause();
         playBtn.GetComponentInChildren <UnityEngine.UI.Text>().text = "Play";
     }
     else
     {
         videoPlayer.Play();
         playBtn.GetComponentInChildren <UnityEngine.UI.Text>().text = "Pause";
     }
     isPlaying = !isPlaying;
 }
Exemplo n.º 11
0
    public void handleKeyboardButton()
    {
        isRGBKeyboard = !isRGBKeyboard;


        if (isRGBKeyboard)
        {
            keyboardButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "KEYBOARD: RGB";
        }
        else
        {
            keyboardButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "KEYBOARD: STANDARD";
        }
    }
Exemplo n.º 12
0
 public void ToggleMusic()
 {
     if(musicOn)
     {
         musicOn = false;
         m_musicButton.GetComponentInChildren<UnityEngine.UI.Text>().color = Color.red;
         bgMusic.GetComponent<AudioSource>().volume = 0.0f;
     }
     else
     {
         musicOn = true;
         m_musicButton.GetComponentInChildren<UnityEngine.UI.Text>().color = Color.green;
         bgMusic.GetComponent<AudioSource>().volume = 1.0f;
     }
 }
Exemplo n.º 13
0
    public void ToggleMode()
    {
        rotation_mode = !rotation_mode;

        UnityEngine.UI.Button button = GameObject.Find("Mode_mvt").GetComponent <UnityEngine.UI.Button>();

        if (rotation_mode)
        {
            button.GetComponentInChildren <UnityEngine.UI.Text>().text = "R";               // Rotation
        }
        else
        {
            button.GetComponentInChildren <UnityEngine.UI.Text>().text = "T";               // Transition
        }
    }
Exemplo n.º 14
0
    void showConsoleButtonUI(bool show = true)
    {
        if (app == null)
        {
            return;
        }

        app.infoButton1.SetActive(true);

        UnityEngine.UI.Button button1 = app.infoButton1.GetComponentInChildren <UnityEngine.UI.Button> ();
        UnityEngine.UI.Text   text1   = button1.GetComponentInChildren <UnityEngine.UI.Text> ();

        UnityEngine.UI.Text infoText = app.informationUIPane.GetComponentInChildren <UnityEngine.UI.Text> ();

        if (show)
        {
            text1.text    = buttonText;
            infoText.text = text;

            button1.onClick.AddListener(() => showConsole());
        }
        else
        {
            text1.text    = "";
            infoText.text = "";
            button1.onClick.RemoveAllListeners();
        }

        app.infoButton1.SetActive(show);
    }
Exemplo n.º 15
0
    void displaySong(int num)
    {
        songTitleButton.GetComponentInChildren <UnityEngine.UI.Text>().text = songlist[curSong][0];
        easyTopScore.text = songlist[curSong][1];
        hardTopScore.text = songlist[curSong][11];
        easyScore1.text   = songlist[curSong][1];
        easyScore2.text   = songlist[curSong][2];
        easyScore3.text   = songlist[curSong][3];
        easyScore4.text   = songlist[curSong][4];
        easyScore5.text   = songlist[curSong][5];
        easyScore6.text   = songlist[curSong][6];
        easyScore7.text   = songlist[curSong][7];
        easyScore8.text   = songlist[curSong][8];
        easyScore9.text   = songlist[curSong][9];
        easyScore10.text  = songlist[curSong][10];
        hardScore1.text   = songlist[curSong][11];
        hardScore2.text   = songlist[curSong][12];
        hardScore3.text   = songlist[curSong][13];
        hardScore4.text   = songlist[curSong][14];
        hardScore5.text   = songlist[curSong][15];
        hardScore6.text   = songlist[curSong][16];
        hardScore7.text   = songlist[curSong][17];
        hardScore8.text   = songlist[curSong][18];
        hardScore9.text   = songlist[curSong][19];
        hardScore10.text  = songlist[curSong][20];

        Debug.Log("Song changed, the current song is " + (curSong + 1));
    }
Exemplo n.º 16
0
    private IEnumerator CheckActions()
    {
        yield return(new WaitForFixedUpdate());

        if (InputHandler.keyPresed(KEY.INTERACT) && System.DateTime.Now > nextAction)
        {
            int current_index = dialogs.IndexOf(textLabel.text);
            if (current_index == dialogs.Count() - 1)
            {
                this.Destroy();
            }
            else
            {
                textLabel.SetText(dialogs[current_index + 1]);

                // Button string.
                if (textLabel.text.Contains(":") && textLabel.text.Contains("_"))
                {
                    List <string> buttonConfigurations = textLabel.text.Split('_').ToList();
                    foreach (string buttonConfig in buttonConfigurations)
                    {
                        int button_index = buttonConfigurations.IndexOf(buttonConfig);
                        int buttonAction;
                        if (int.TryParse(buttonConfig.Split(':').First(), out buttonAction))
                        {
                            UnityEngine.UI.Button target = this.chatButtons[button_index];

                            target.gameObject.SetActive(true);
                            target.GetComponentInChildren <TMPro.TextMeshProUGUI>().SetText($"[{button_index+1}]: {buttonConfig.Split(':').Last()}");

                            if (buttonAction != -1)
                            {
                                target.onClick.AddListener(delegate()
                                {
                                    PacketHandler.SendPacket(ClientPacket.ACTION_REQUEST, new Dictionary <string, object>()
                                    {
                                        { "action_id", buttonAction }
                                    });

                                    this.Destroy();
                                });
                            }
                            else
                            {
                                target.onClick.AddListener(delegate() { this.Destroy(); });
                            }
                        }
                    }

                    textLabel.gameObject.SetActive(false);
                }
            }

            nextAction = System.DateTime.Now.AddMilliseconds(Constants.INTERACTION_DELAY_IN_MS);
        }
        else if (InputHandler.keyPresed(KEY.MAINMENU))
        {
            this.Destroy();
        }
    }
Exemplo n.º 17
0
 public void badPress()
 {
     bad++;
     combo      = 0;
     lastRating = "Bad";
     badButton.GetComponentInChildren <UnityEngine.UI.Text>().text = bad.ToString();
     updateScore();
 }
Exemplo n.º 18
0
 public void missPress()
 {
     miss++;
     combo      = 0;
     lastRating = "Miss";
     missButton.GetComponentInChildren <UnityEngine.UI.Text>().text = miss.ToString();
     updateScore();
 }
Exemplo n.º 19
0
 public void perfectPress()
 {
     score += 100;
     perfect++;
     combo++;
     lastRating = "Perfect";
     perfectButton.GetComponentInChildren <UnityEngine.UI.Text>().text = perfect.ToString();
     updateScore();
 }
Exemplo n.º 20
0
 public void goodPress()
 {
     score += 50;
     good++;
     combo++;
     lastRating = "Good";
     goodButton.GetComponentInChildren <UnityEngine.UI.Text>().text = good.ToString();
     updateScore();
 }
Exemplo n.º 21
0
        public void ButtonClick(Button button)
        {
            Text buttonText = button.GetComponentInChildren<Text>();
            int currentNumber = int.Parse(buttonText.text);

            if(currentNumber < buttonOrders.Length) buttonText.text = (currentNumber + 1).ToString();
            else buttonText.text = "1";
            UpdateTryButton();
        }
    // Use this for initialization
    void Start()
    {
        if (generationButton != null)
        {
            generationButton.onClick.AddListener(generationScene);
        }
        if (solutionButton != null)
        {
            solutionButton.onClick.AddListener(solutionScene);
        }
        if (backButton != null)
        {
            backButton.onClick.AddListener(backScene);
        }
        if (nextButton != null)
        {
            nextButton.onClick.AddListener(next);
            if (!showSolution)
            {
                nextButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "Next Generation";
            }
            else
            {
                nextButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "New Solution";
            }
        }
        if (replayButton != null)
        {
            replayButton.onClick.AddListener(replay);
            if (!showSolution)
            {
                replayButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "Replay Generation";
            }
            else
            {
                replayButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "Replay Solution";
            }
        }

        if (gController != null)
        {
            gController.selectShowSolutionMode(this.showSolution);
        }
    }
Exemplo n.º 23
0
 /// <summary> Append texts to existing button text (used to add hotkey info to buttons) </summary>
 /// <param name="button"></param>
 /// <param name="addedText"></param>
 public static void AppendButtonText(UnityEngine.UI.Button button, string addedText)
 {
     if (button != null)
     {
         UnityEngine.UI.Text btnTxt = button.GetComponentInChildren <UnityEngine.UI.Text>();
         if (btnTxt != null)
         {
             btnTxt.text = btnTxt.text + addedText;
         }
     }
 }
    void Awake()
    {
        _targetCubes     = new List <Cube>();
        _attractionCubes = new List <Cube>();
        _repulsionCubes  = new List <Cube>();
        _fieldOrigin     = this.transform.position;

        _startStopButtonText          = _startStopButton.GetComponentInChildren <UnityEngine.UI.Text>();
        _startStopButtonText.text     = "Connecting..";
        _startStopButton.interactable = false;
    }
Exemplo n.º 25
0
 void dictationToggleUI_(bool bOn)
 {
     if (bOn)
     {
         btnVoiceTest.GetComponent <RectTransform>().localScale = Vector3.one * 1.2f;
         var text = btnVoiceTest.GetComponentInChildren <UnityEngine.UI.Text>();
         if (text != null)
         {
             text.text = "現在 音声入力ON";
         }
     }
     else
     {
         btnVoiceTest.GetComponent <RectTransform>().localScale = Vector3.one;
         var text = btnVoiceTest.GetComponentInChildren <UnityEngine.UI.Text>();
         if (text != null)
         {
             text.text = "現在 音声入力OFF";
         }
     }
 }
Exemplo n.º 26
0
    private void Update()
    {
        if (DriverStationInterface)
        {
            var colors = EnabledButton.colors;
            UnityEngine.UI.Text textComponent = EnabledButton.GetComponentInChildren <UnityEngine.UI.Text>();
            if (DriverStationInterface.Enabled())
            {
                colors.normalColor = Color.red;
                textComponent.text = "Disable";
            }
            else
            {
                colors.normalColor = Color.green;
                textComponent.text = "Enable";
            }
            EnabledButton.colors = colors;

            colors = TeleopButton.colors;
            if (DriverStationInterface.Teleop())
            {
                colors.normalColor = Color.green;
            }
            else
            {
                colors.normalColor = Color.gray;
            }
            TeleopButton.colors = colors;

            colors = AutonomousButton.colors;
            if (DriverStationInterface.Autonomous())
            {
                colors.normalColor = Color.green;
            }
            else
            {
                colors.normalColor = Color.gray;
            }
            AutonomousButton.colors = colors;

            colors = TestingButton.colors;
            if (DriverStationInterface.Testing())
            {
                colors.normalColor = Color.green;
            }
            else
            {
                colors.normalColor = Color.gray;
            }
            TestingButton.colors = colors;
        }
    }
Exemplo n.º 27
0
    // Use this for initialization
    void Start()
    {
        //gameObject.AddComponent<Rollover3D> ();
        app = AppController.instance;

        anim = scanner.GetComponent <Animator> ();

        button1 = app.actionButton1.GetComponent <UnityEngine.UI.Button> ();
        button2 = app.actionButton2.GetComponent <UnityEngine.UI.Button> ();
        butText = button1.GetComponentInChildren <UnityEngine.UI.Text> ();

        trayStartPos = new Vector3(transform.position.x, transform.position.y, transform.position.z);
    }
Exemplo n.º 28
0
        /**
         * <summary>Initialises the linked Unity UI GameObject.</summary>
         * <param name = "_menu">The element's parent Menu</param>
         */
        public override void LoadUnityUI(AC.Menu _menu, Canvas canvas)
        {
            if (_menu.menuSource != MenuSource.AdventureCreator)
            {
                if (cycleUIBasis == CycleUIBasis.Button)
                {
                    uiButton = LinkUIElement <UnityEngine.UI.Button> (canvas);
                    if (uiButton)
                    {
                                                #if TextMeshProIsPresent
                        uiText = uiButton.GetComponentInChildren <TMPro.TextMeshProUGUI>();
                                                #else
                        uiText = uiButton.GetComponentInChildren <Text>();
                                                #endif

                        uiButton.onClick.AddListener(() => {
                            ProcessClickUI(_menu, 0, KickStarter.playerInput.GetMouseState());
                        });
                    }
                }
                else if (cycleUIBasis == CycleUIBasis.Dropdown)
                {
                                        #if UNITY_5_3_OR_NEWER
                    if (uiDropdown != null)
                    {
                        parentMenu       = _menu;
                        uiDropdown       = LinkUIElement <Dropdown> (canvas);
                        uiDropdown.value = selected;
                        uiDropdown.onValueChanged.AddListener(delegate {
                            uiDropdownValueChangedHandler(uiDropdown);
                        });
                    }
                                #endif
                }
            }
        }
Exemplo n.º 29
0
    private void Awake()
    {
        if (!button)
        {
            Debug.LogError("Button UI of Inspector is empty");
            return;
        }

        Text buttonText = button.GetComponentInChildren <Text>();

        if (buttonText)
        {
            buttonText.text = "RE-PLAY";
        }
    }
#pragma warning restore 649
    private void Awake()
    {
        if (ZPlayerPrefs.GetString("Was" + itemName + "sold in" + levelApplied) == "Bought")
        {
            isBought = true;
            if (buttonForBuying != null)
            {
                if (isBought)
                {
                    buttonForBuying.enabled = false;
                    buttonForBuying.GetComponentInChildren <UnityEngine.UI.Text>().text = "Sold";
                }
            }
        }
    }
Exemplo n.º 31
0
    void OnGameStateChanged(object sender, GameOfLife.GameState oldState, GameOfLife.GameState newState)
    {
        if (PlayPauseButton == null)
        {
            return;
        }

        if ((GameOfLife)sender == m_GameOfLife)
        {
            switch (newState)
            {
            case GameOfLife.GameState.PLAY:
                PlayPauseButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "Pause";
                break;

            case GameOfLife.GameState.PAUSE:
                PlayPauseButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "Play";
                break;

            default:
                break;
            }
        }
    }
Exemplo n.º 32
0
    public IEnumerator ShowContinue(UnityEngine.UI.Button contButton)
    {
        while (true)
        {
            var btnText = contButton.GetComponentInChildren <Text>();

            //Check if we havent reached the the cooldown period if needed
            if (UnityAdController.nextRewardTime.HasValue && (DateTime.Now < UnityAdController.nextRewardTime.Value))
            {
                //Unable to click on the button
                contButton.interactable = false;

                // Get the time remaining until we get to the next reward
                TimeSpan remaining = UnityAdController.nextRewardTime.Value - DateTime.Now;

                //Get the text in the following formart 99:99
                var countdownText = string.Format("{0:D2} : {1:D2}", remaining.Minutes,
                                                  remaining.Seconds);

                // Set our buttons text toreflect the new time
                btnText.text = countdownText;

                //Come back after 1 second and check again
                yield return(new WaitForSeconds(1f));
            }
            else if (!UnityAdController.showAds)
            {
                // Its valid to click the button now
                contButton.interactable = true;

                // If player clicks on button we want to play ad and then continue
                contButton.onClick.AddListener(Continue);

                UnityAdController.obstacle = this;

                //Change the tex to Allow continue
                btnText.text = "Free Continue";

                //We can now leave this coroutine, shuunn;
                break;
            }
            else
            {
                // Its valid to click the buton
                contButton.interactable = true;
            }
        }
    }
Exemplo n.º 33
0
		/// <summary>
		/// Sets the name of the button.
		/// </summary>
		/// <param name="button">Button.</param>
		/// <param name="index">Index.</param>
		void SetButtonName(Button button, int index)
		{
			button.gameObject.SetActive(true);
			var text = button.GetComponentInChildren<Text>();
			if (text)
			{
				text.text = tabObjects[index].Name;
			}
		}
 void GetClassByName(Button cBtn)
 {
     string[] response = db.GetModsByName("classesbyname", cBtn.GetComponentInChildren<Text>().text);
     for (int i = 0; i < 30; i++)
     {
     classMods[i] = Convert.ToInt32(response[i+2]);
     }
     CalculateMods();
 }
        void GetRaceByName(Button cBtn)
        {
            string[] response = db.GetModsByName("racesbyname", cBtn.GetComponentInChildren<Text>().text);
            for (int i = 0; i < 30; i++)
            {
            raceMods[i] = Convert.ToInt32(response[i + 2]);
            }
            attributeLevel[0].text = response[32];
            attributeLevel[1].text = response[33];
            attributeLevel[2].text = response[34];
            attributeLevel[3].text = response[35];

            CalculateMods();
        }
 void SelectRace(Button chosen)
 {
     chosenRace.GetComponentInChildren<Text>().text = chosen.GetComponentInChildren<Text>().text;
     chosen.transform.parent.gameObject.SetActive(false);
     if (chosenClass.GetComponentInChildren<Text>().text != "Choose a Class") {
     for (int i = 0; i < 30; i++) {
         plusButtons[i].enabled = true;
         minusButtons[i].enabled = true;
         if(i < 4) {
             attributeMinus[i].enabled = true;
             attributePlus[i].enabled = true;
         }
     }
     }
 }
Exemplo n.º 37
0
        /**
         * Links the UI GameObjects to the class, based on the supplied uiButtonID.
         */
        public void LinkUIElements()
        {
            uiButton = Serializer.returnComponent <UnityEngine.UI.Button> (uiButtonID);
            if (uiButton)
            {
                if (uiButton.GetComponentInChildren <Text>())
                {
                    uiText = uiButton.GetComponentInChildren <Text>();
                }
                if (uiButton.GetComponentInChildren <Image>())
                {
                    uiImage = uiButton.GetComponentInChildren <Image>();
                }

                originalColour = uiButton.colors.normalColor;
            }
        }
Exemplo n.º 38
0
 /**
  * <summary>Initialises the linked Unity UI GameObject.</summary>
  * <param name = "_menu">The element's parent Menu<param>
  */
 public override void LoadUnityUI(AC.Menu _menu)
 {
     uiButton = LinkUIElement <UnityEngine.UI.Button>();
     if (uiButton)
     {
         if (uiButton.GetComponentInChildren <Text>())
         {
             uiText = uiButton.GetComponentInChildren <Text>();
         }
         uiButton.onClick.AddListener (() => {
             ProcessClick (_menu, 0, KickStarter.playerInput.GetMouseState ());
         });
     }
 }
Exemplo n.º 39
0
 public void LoadLevel(Button button)
 {
     var buttonText = button.GetComponentInChildren<Text>();
     Debug.Log(buttonText.text);
     button.GetComponentInChildren<Text>().text = "locked";
 }