public void Ready()
 {
     ready = !ready;
     Client.Instance.Lobby.SetMemberData("Ready", ready.ToString());
     readyButton.GetComponent <UnityEngine.UI.Image>().color         = ready ? new UnityEngine.Color(0, 0.25f, 0) : new UnityEngine.Color(0.25f, 0, 0);
     readyButton.GetComponentInChildren <UnityEngine.UI.Text>().text = ready ? "Ready" : "Click to Ready up";
 }
Esempio n. 2
0
        public virtual void Assign(string quest, ToggleChangedDelegate trackToggleDelegate)
        {
            if (UITextField.IsNull(label))
            {
                label.uiText = button.GetComponentInChildren <UnityEngine.UI.Text>();
            }
            label.text = quest;
            var canTrack = QuestLog.IsQuestActive(quest) && QuestLog.IsQuestTrackingAvailable(quest);

            trackToggleTemplate.Assign(canTrack, QuestLog.IsQuestTrackingEnabled(quest), quest, trackToggleDelegate);
        }
Esempio n. 3
0
 /// <summary> Set the text of an existing button text </summary>
 /// <param name="button"></param>
 /// <param name="addedText"></param>
 public static void SetButtonText(UnityEngine.UI.Button button, string text)
 {
     if (button != null)
     {
         UnityEngine.UI.Text btnTxt = button.GetComponentInChildren <UnityEngine.UI.Text>();
         if (btnTxt != null)
         {
             btnTxt.text = text;
         }
     }
 }
Esempio n. 4
0
        void Start()
        {
            bool newGame = SaveLoad.instance.data.lastScene.Length == 0;

            restartButton.gameObject.SetActive(!newGame);
            startButton.GetComponentInChildren <UnityEngine.UI.Text>().text = newGame ? "Begin" : "Continue";

            Game.instance.pauseMenu.FadeOut(true);

            UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(startButton.gameObject);
        }
Esempio n. 5
0
 public void OnHitRestart()
 {
     UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(null);
     if (!_confirmRestart)
     {
         restartButton.GetComponentInChildren <UnityEngine.UI.Text>().text = "Lose your progress and restart?";
         _confirmRestart = true;
     }
     else
     {
         SaveLoad.instance.data.lastScene = firstScene;
         SaveLoad.instance.Save();
         TransitionManager.instance.TransitionTo(firstScene);
     }
 }
Esempio n. 6
0
        private void UpdateBottomPanel(bool animated, float delay, Ease easing, float bottomMargin = 0, float animDuration = 0.6f)
        {
            float botPanelYPos = 0;
            float bgYScale     = 1.05f;
            float moreBTNAlpha = botPanelState == Visibility.Fullscreen ? 0 : 1f;

            if (botPanelState == Visibility.Mini)
            {
                botPanelYPos = botPanelDefaultHeight - bottomMargin;
                bgYScale     = 1f;
            }
            else if (botPanelState == Visibility.Hidden)
            {
                botPanelYPos = -botPanelRect.sizeDelta.y;
                bgYScale     = 1f;
            }

            if (botPanelState == Visibility.Fullscreen)
            {
                setScrollRectToTop();
            }

            UnityEngine.CanvasGroup moreBTNCanvasGroup = moreButton.GetComponentInChildren <UnityEngine.CanvasGroup>();
            moreButton.interactable = botPanelState == Visibility.Mini;
            if (!animated)
            {
                Vector3 pos = botPanelRect.anchoredPosition3D;
                pos.y = botPanelYPos;
                botPanelRect.anchoredPosition3D = pos;
                whiteBGRect.localScale          = new Vector3(1f, bgYScale, 1f);
                moreBTNCanvasGroup.alpha        = moreBTNAlpha;
            }
            else
            {
                if (delay > 0)
                {
                    moreBTNCanvasGroup.DOFade(moreBTNAlpha, animDuration).SetDelay(delay);
                    botPanelRect.DOAnchorPos3DY(botPanelYPos, animDuration).SetEase(easing).SetDelay(delay);
                    whiteBGRect.DOScaleY(bgYScale, animDuration).SetEase(easing).SetDelay(delay);
                }
                else
                {
                    moreBTNCanvasGroup.DOFade(moreBTNAlpha, animDuration);
                    botPanelRect.DOAnchorPos3DY(botPanelYPos, animDuration).SetEase(easing);
                    whiteBGRect.DOScaleY(bgYScale, animDuration).SetEase(easing);
                }
            }
        }
Esempio n. 7
0
        public void HandlePlayerChoice(
            IDictionary <string, string> userVars, string choiceText, IList <BaseConnection> conns,
            Action <BaseConnection> onChoiceCompleteCallback)
        {
            mContinueButton.gameObject.SetActive(false);
            foreach (BaseConnection c in conns)
            {
                UnityEngine.UI.Button button = Instantiate(mChoicePrefabButton, mChoiceGroup.transform, false)
                                               .GetComponent <UnityEngine.UI.Button>();

                button.GetComponentInChildren <UnityEngine.UI.Text>().text = c.connectionText;

                BaseConnection connection = c;
                button.onClick.AddListener(() => HandleChoice(connection, onChoiceCompleteCallback));
            }

            mStatementText.text   = choiceText;
            mCurrentUserVariables = userVars;
        }
Esempio n. 8
0
        public void LoadWorldHelper()
        {
            WorldMaybeLoad[] worlds = GetWorlds(World.ROOT_SAVE_DIR);


            // Destroy previous elements in the list
            List <RectTransform> children = new List <RectTransform>();

            foreach (RectTransform child in loadWorldList)
            {
                children.Add(child);
            }

            for (int i = 0; i < children.Count; i++)
            {
                GameObject.Destroy(children[i].gameObject);
            }

            // Add one button for each world in our save folder
            foreach (WorldMaybeLoad world in worlds)
            {
                UnityEngine.UI.Button loadWorldButton = GameObject.Instantiate(loadWorldButtonPrefab).GetComponent <UnityEngine.UI.Button>();
                loadWorldButton.GetComponentInChildren <UnityEngine.UI.Text>().text = world.worldName;
                loadWorldButton.onClick.AddListener(() =>
                {
                    LoadSpecificWorld(world);
                });
                loadWorldButton.GetComponent <RectTransform>().SetParent(loadWorldList);
            }
            // force reload layout so they get pushed accordingly
            UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(loadWorldList);

            HideAllMenus();
            loadWorldMenu.enabled = true;

            curMenu = MenuStatus.LoadWorld;
        }