Beispiel #1
0
 private void Update()
 {
     if (!lab.ableToExperiment)
     {
         if (!TrainingProgressBar.isActive)
         {
             TrainingProgressBar.OpenBar(buttonID);
         }
         TrainingProgressBar.ChangeProgress(lab.GetCoolDownProgress());
     }
     else if (TrainingProgressBar.isActive)
     {
         TrainingProgressBar.CloseBar();
     }
     if (!lab.ableToExperiment && button.interactable)
     {
         button.interactable = false;
         button.image.color  = button.colors.disabledColor;
     }
     else if (lab.ableToExperiment && !button.interactable)
     {
         button.interactable = true;
         button.image.color  = button.colors.normalColor;
     }
     if (labCost != (int)lab.uniqueStatsArray[2])
     {
         labCost       = (int)lab.uniqueStatsArray[2];
         costText.text = labCost.ToString();
     }
 }
Beispiel #2
0
 private void Update()
 {
     if (selectedBuilding.isUpgrading)
     {
         if (!cancelButton.activeSelf)
         {
             cancelButton.SetActive(true);
         }
         if (!TrainingProgressBar.isActive)
         {
             TrainingProgressBar.OpenBar(PanelButtonType.LocalUpgradesButton);
         }
         TrainingProgressBar.ChangeProgress(selectedBuilding.GetUpgradeProgress());
     }
     else
     {
         if (cancelButton.activeSelf)
         {
             cancelButton.SetActive(false);
         }
         if (TrainingProgressBar.isActive)
         {
             TrainingProgressBar.CloseBar();
         }
     }
 }
Beispiel #3
0
 protected override void OnDisable()
 {
     costSprite.gameObject.SetActive(false);
     costText.gameObject.SetActive(false);
     TrainingProgressBar.CloseBar();
     selected            = false;
     button.image.color  = button.colors.normalColor;
     button.interactable = true;
 }
Beispiel #4
0
 private void OnDisable()
 {
     if (isActive)
     {
         isActive = false;
         TrainingProgressBar.CloseBar();
         GameManager.Hud.Infotext.SetPopInfoActive(true);
         GameManager.Hud.Infotext.healthText.gameObject.SetActive(true);
     }
 }
Beispiel #5
0
 protected override void OnDisable()
 {
     foreach (GameObject go in addMinusButtons)
     {
         go.SetActive(false);
     }
     secondaryText.gameObject.SetActive(false);
     TrainingProgressBar.CloseBar();
     cancelButton.gameObject.SetActive(false);
     checkButton.gameObject.SetActive(false);
 }
Beispiel #6
0
    public void CancelUpgrade()
    {
        selectedBuilding.isUpgrading = false;
        LocalUpgrade activeUpgrade = selectedBuilding.localUpgradesList [selectedBuilding.GetActiveUpgradeIndex()][0];

        selectedBuilding.GetPlayer().CancelPurchase(activeUpgrade.costArray);
        TrainingProgressBar.CloseBar();
        cancelButton.SetActive(false);
        SetRemainingCount();
        foreach (LocalUpgradesMenuButton mB in menuButtons)
        {
            mB.gameObject.SetActive(true);
        }
    }
Beispiel #7
0
 protected override void OnDisable()
 {
     GameManager.Hud.Infotext.SetPopInfoActive(true);
     TrainingProgressBar.CloseBar();
     unitsText.gameObject.SetActive(false);
     foreach (Image thingy in resImages)
     {
         thingy.gameObject.SetActive(false);
     }
     foreach (Text thingy in resTexts)
     {
         thingy.gameObject.SetActive(false);
     }
     plusButton.gameObject.SetActive(false);
     minusButton.gameObject.SetActive(false);
 }
Beispiel #8
0
 private void CheckTrainer()
 {
     unitsText.text = mobTrainer.GetTrainingText();
     if (mobTrainer.training)
     {
         if (!TrainingProgressBar.isActive)
         {
             TrainingProgressBar.OpenBar(buttonID);
         }
         TrainingProgressBar.ChangeProgress(mobTrainer.GetTrainingProgress());
     }
     else if (TrainingProgressBar.isActive)
     {
         TrainingProgressBar.CloseBar();
     }
 }
Beispiel #9
0
 public void SetPopCount()
 {
     settingPopCount     = true;
     button.interactable = false;
     button.image.color  = Color.clear;
     foreach (GameObject go in addMinusButtons)
     {
         go.SetActive(true);
     }
     cancelButton.gameObject.SetActive(true);
     checkButton.gameObject.SetActive(true);
     secondaryText.gameObject.SetActive(true);
     secondaryText.alignment = TextAnchor.MiddleCenter;
     TrainingProgressBar.CloseBar();
     secondaryText.text = popCount + " / " + stratpt.GetMaxCarPopCount();
     cancelButton.onClick.SetPersistentListenerState(1, UnityEngine.Events.UnityEventCallState.Off);
     cancelButton.onClick.SetPersistentListenerState(0, UnityEngine.Events.UnityEventCallState.RuntimeOnly);
 }
Beispiel #10
0
    public static void FinishUpgrade(Building finishedBuilding, int locUpIndex)
    {
        LocalUpgrade firstLU = finishedBuilding.localUpgradesList[locUpIndex][0];

        for (int i = 0; i < firstLU.costArray.Length; i++)
        {
            finishedBuilding.localUpgradesList[locUpIndex][0].costArray[i] *= firstLU.costIncrease;
        }
        finishedBuilding.localUpgradesList[locUpIndex][0].rank++;
        if (isActive && finishedBuilding == selectedBuilding)
        {
            SetRemainingCount();
            TrainingProgressBar.CloseBar();
            foreach (LocalUpgradesMenuButton lUButton in menuButtons)
            {
                lUButton.gameObject.SetActive(true);
            }
        }
        for (int i = 0; i < finishedBuilding.localUpgradesList[locUpIndex].Length; i++)
        {
            LocalUpgrade lU            = finishedBuilding.localUpgradesList[locUpIndex][i];
            float        upgradeAmount = GetUpgradeAmount(finishedBuilding, lU);
            if (!lU.isUnitUpgrade)
            {
                UpgradeStat(finishedBuilding as WorldObject, lU, upgradeAmount);
            }
            else
            {
                MobTrainer mT = finishedBuilding as MobTrainer;
                for (int j = 0; j < mT.mobTrainerStatsArray[0]; j++)
                {
                    UpgradeStat(mT.GetMob(j) as WorldObject, lU, upgradeAmount);
                }
                mT.locUpUnitStatsDick[lU.statsType][lU.statsIndex] += upgradeAmount;
            }
            if (lU.messageArray != null)
            {
                foreach (string message in lU.messageArray)
                {
                    finishedBuilding.SendMessage(message, SendMessageOptions.RequireReceiver);
                }
            }
        }
    }
Beispiel #11
0
    private void Update()
    {
        if (settingPopCount)
        {
            if (currMaxCarPopCount != stratpt.GetMaxCarPopCount())
            {
                if (popCount >= stratpt.GetMaxCarPopCount())
                {
                    popCount = stratpt.GetMaxCarPopCount();
                    if (addMinusButtons[0].activeSelf)
                    {
                        addMinusButtons[0].SetActive(false);
                    }
                }
                secondaryText.text = popCount + " / " + stratpt.GetMaxCarPopCount();
                currMaxCarPopCount = stratpt.GetMaxCarPopCount();
            }
            if (popCount > stratpt.GetMaxCarPopCount())
            {
                popCount           = stratpt.GetMaxCarPopCount();
                secondaryText.text = popCount + " / " + stratpt.GetMaxCarPopCount();
                if (addMinusButtons[0].activeSelf)
                {
                    addMinusButtons[0].SetActive(false);
                }
            }
            else if (popCount == stratpt.GetMaxCarPopCount() && addMinusButtons[0].activeSelf)
            {
                addMinusButtons[0].SetActive(false);
            }
            else if (popCount < stratpt.GetMaxCarPopCount() && !addMinusButtons[0].activeSelf)
            {
                addMinusButtons[0].gameObject.SetActive(true);
            }
            else if (popCount > 0 && !addMinusButtons[1].activeSelf)
            {
                addMinusButtons[1].gameObject.SetActive(true);
            }
            else if (popCount <= 0 && addMinusButtons[1].activeSelf)
            {
                popCount           = 0;
                secondaryText.text = popCount + " / " + stratpt.GetMaxCarPopCount();
                addMinusButtons[1].SetActive(false);
            }
        }
        else if (stratpt.trainingCaravan)
        {
            if (!TrainingProgressBar.isActive)
            {
                TrainingProgressBar.OpenBar(buttonID);
            }
//			if (secondaryText.alignment != TextAnchor.MiddleRight) secondaryText.alignment = TextAnchor.MiddleRight;
            TrainingProgressBar.ChangeProgress(stratpt.GetCarTrainingProgress());
            TrainingProgressBar.countText.text = stratpt.CaravanTrainingCount();
        }
        // Just stopped training
        else if (cancelButton.gameObject.activeSelf)
        {
            cancelButton.onClick.SetPersistentListenerState(0, UnityEngine.Events.UnityEventCallState.RuntimeOnly);
            cancelButton.onClick.SetPersistentListenerState(1, UnityEngine.Events.UnityEventCallState.Off);
            TrainingProgressBar.CloseBar();
            cancelButton.gameObject.SetActive(false);
            secondaryText.gameObject.SetActive(false);
        }
    }