예제 #1
0
 private void Awake()
 {
     _energyText   = EnergyUI.GetComponentInChildren <TextMeshProUGUI>();
     _moneyText    = MoneyUI.GetComponentInChildren <TextMeshProUGUI>();
     _personalText = PersonalHappinessUI.GetComponentInChildren <TextMeshProUGUI>();
     _familyText   = FamilyHappinessUI.GetComponentInChildren <TextMeshProUGUI>();
     _careerText   = CareerUI.GetComponentInChildren <TextMeshProUGUI>();
     _dayText      = DayUI.GetComponentInChildren <TextMeshProUGUI>();
 }
예제 #2
0
 public Overlay()
 {
     // @todo #1 update toggle button colors
     Branch     = new ClickUIBranch("Overlay", (int)ClickUIPriorities.Overlay);
     _clockUi   = new ClockUI();
     _togglePad = new TogglePad();
     _moneyUI   = new MoneyUI();
     _energyUI  = new EnergyUI();
     _hungerUI  = new HungerUI();
     Branch.Add(_togglePad.Branch);
 }
예제 #3
0
        //---------------------------------------------------------------------
        // Create the restart battle button
        //---------------------------------------------------------------------

        /// <summary>
        /// Copy the "end turn" button and modify it to be the "restart battle" button.
        /// </summary>
        public static void Create(BattleHud battleHud)
        {
            // Don't create button if we're doing a hell rush
            if (Traverse.Create(Traverse.Create(battleHud).Field("combatManager").GetValue <CombatManager>()).Field("saveManager").GetValue <SaveManager>().IsBattleMode())
            {
                return;
            }

            // Get BattleHud private fields
            EndTurnUI       endTurnButton = Traverse.Create(battleHud).Field("endTurnButton").GetValue <EndTurnUI>();
            EnergyUI        energyUI      = Traverse.Create(battleHud).Field("energyUI").GetValue <EnergyUI>();
            CardPileCountUI deckUI        = Traverse.Create(battleHud).Field("deckUI").GetValue <CardPileCountUI>();

            // Copy end turn game object
            GameObject buttonRoot = GameObject.Instantiate(endTurnButton.gameObject, energyUI.transform.parent) as GameObject;

            buttonRoot.name = "RestartBattleButton";

            // Delete unwanted game objects and components
            DeleteUnwanted(buttonRoot);

            // Set position to in the corner next to the ember
            RectTransform transRoot  = buttonRoot.transform as RectTransform;
            RectTransform transEmber = energyUI.transform as RectTransform;

            transRoot.anchorMin           = transEmber.anchorMin;
            transRoot.anchorMax           = transEmber.anchorMax;
            transRoot.anchoredPosition    = transEmber.anchoredPosition;
            transRoot.sizeDelta           = transEmber.sizeDelta;
            buttonRoot.transform.position = new Vector3(
                Mathf.LerpUnclamped(deckUI.transform.position.x, energyUI.transform.position.x, 1.75f),
                Mathf.LerpUnclamped(deckUI.transform.position.y, energyUI.transform.position.y, -0.1f),
                buttonRoot.transform.position.z);

            // Make it a bit smaller than the "End Turn" button
            buttonRoot.transform.localScale = new Vector3(.6f, .6f, buttonRoot.transform.localScale.z);

            // Clear shortcut key so "End Turn" keyboard shortcut doesn't trigger restart battle
            GameUISelectableButton restartBattleButton = buttonRoot.GetComponent <GameUISelectableButton>();

            Traverse.Create(restartBattleButton).Field("inputType").SetValue((int)InputManager.Controls.NONE);

            // Set button text to "Restart Battle"
            TextMeshProUGUI textMeshPro = buttonRoot.GetComponentInChildren <TextMeshProUGUI>();

            textMeshPro.text = "Restart Battle";

            // Add RestartBattleButton to handle the button click
            restartBattleButton.gameObject.AddComponent <RestartBattleButton>();
        }
예제 #4
0
파일: UILogic.cs 프로젝트: ittimGame1/G8Mao
    private void Awake()
    {
        if (Instance != null)
        {
            Debug.LogError("Duplicate UILogic instance");
            return;
        }

        if (GameUI != null)
        {
            Confertable = GameUI.GetComponentInChildren <ConfertableUI>();
            Energy      = GameUI.GetComponentInChildren <EnergyUI>();
            countdown   = GameUI.GetComponentInChildren <CountDown>();
            gameover    = GameUI.GetComponentInChildren <GameOver>();
        }

        Instance = this;
    }