Exemplo n.º 1
0
        private static void ShowAvailableUpgrade(UpgradeRecord upgrade)
        {
            GameObject prefab           = (GameObject)Resources.Load("Prefabs/SquadBuilder/UpgradePanel", typeof(GameObject));
            Transform  contentTransform = GameObject.Find("UI/Panels/SelectUpgradePanel/Panel/Scroll View/Viewport/Content").transform;
            GameObject newUpgradePanel  = MonoBehaviour.Instantiate(prefab, contentTransform);

            string         upgradeType = AllUpgrades.Find(n => n.UpgradeName == upgrade.UpgradeName).UpgradeTypeName;
            GenericUpgrade newUpgrade  = (GenericUpgrade)System.Activator.CreateInstance(Type.GetType(upgradeType));

            Edition.Current.AdaptUpgradeToRules(newUpgrade);
            if (newUpgrade is IVariableCost && Edition.Current is SecondEdition)
            {
                (newUpgrade as IVariableCost).UpdateCost(CurrentSquadBuilderShip.Instance);
            }

            UpgradePanelSquadBuilder script = newUpgradePanel.GetComponent <UpgradePanelSquadBuilder>();

            script.Initialize(upgrade.UpgradeName, CurrentUpgradeSlot, newUpgrade, SelectUpgradeClicked, true);

            int column = availableUpgradesCounter;

            newUpgradePanel.transform.localPosition = new Vector3(DISTANCE_MEDIUM + (Edition.Current.UpgradeCardSize.x + DISTANCE_MEDIUM) * column, Edition.Current.UpgradeCardSize.y / 2, 0);

            availableUpgradesCounter++;
        }
Exemplo n.º 2
0
    private static string GetUpgradeTooltipImage(GameObject panel)
    {
        string upgradeKey = panel.GetComponent <Dropdown>().captionText.text;

        if (AllUpgrades.Find(n => n.UpgradeNameWithCost == upgradeKey) == null)
        {
            return(null);
        }

        if (AllUpgrades.Find(n => n.UpgradeNameWithCost == upgradeKey).UpgradeTypeName != null)
        {
            GenericUpgrade upgrade = (GenericUpgrade)Activator.CreateInstance(Type.GetType(AllUpgrades.Find(n => n.UpgradeNameWithCost == upgradeKey).UpgradeTypeName));
            return(upgrade.ImageUrl);
        }
        return(null);
    }
Exemplo n.º 3
0
        private static void ShowAvailableUpgrade(UpgradeRecord upgrade)
        {
            GameObject prefab           = (GameObject)Resources.Load("Prefabs/SquadBuilder/UpgradePanel", typeof(GameObject));
            Transform  contentTransform = GameObject.Find("UI/Panels/SelectUpgradePanel/Panel/Scroll View/Viewport/Content").transform;
            GameObject newUpgradePanel  = MonoBehaviour.Instantiate(prefab, contentTransform);

            string         upgradeType = AllUpgrades.Find(n => n.UpgradeName == upgrade.UpgradeName).UpgradeTypeName;
            GenericUpgrade newUpgrade  = (GenericUpgrade)System.Activator.CreateInstance(Type.GetType(upgradeType));

            UpgradePanelSquadBuilder script = newUpgradePanel.GetComponent <UpgradePanelSquadBuilder>();

            script.Initialize(upgrade.UpgradeName, CurrentUpgradeSlot, newUpgrade, SelectUpgradeClicked, true);

            int column = availableUpgradesCounter;

            newUpgradePanel.transform.localPosition = new Vector3(DISTANCE_MEDIUM + (UPGRADE_CARD_WIDTH + DISTANCE_MEDIUM) * column, UPGRADE_CARD_HEIGHT / 2, 0);

            availableUpgradesCounter++;
        }