コード例 #1
0
    public void SetupCharacterSelectMenu(Item.HackerRunner newHackerOrRunner)
    {
        hackerOrRunner = newHackerOrRunner;
        PlayerData playerData = FindObjectOfType <PlayerData>();

        switch (hackerOrRunner)
        {
        case Item.HackerRunner.Runner:
            headingTextImage.sprite = selectRunnerSprite;
            currentRunner           = playerData.GetCurrentRunner();
            shownRunner             = currentRunner;
            runners = playerData.GetRunnerList();
            for (int i = 0; i < runners.Count; i++)
            {
                if (runners[i] == currentRunner)
                {
                    currentIndex = i;
                    break;
                }
            }
            break;

        case Item.HackerRunner.Hacker:
            headingTextImage.sprite = selectHackerSprite;
            currentHacker           = playerData.GetCurrentHacker();
            shownHacker             = currentHacker;
            hackers = playerData.GetHackerList();
            for (int i = 0; i < hackers.Count; i++)
            {
                if (hackers[i] == currentHacker)
                {
                    currentIndex = i;
                    break;
                }
            }
            break;
        }
        UpdateDisplayedCharacter();
    }
コード例 #2
0
 public void SetupLoadoutEquipmentMenu(HackerData newHacker)
 {
     hacker         = newHacker;
     hackerOrRunner = Item.HackerRunner.Hacker;
     DoSetup();
 }
コード例 #3
0
 public void SetupLoadoutEquipmentMenu(CharacterData newRunner)
 {
     runner         = newRunner;
     hackerOrRunner = Item.HackerRunner.Runner;
     DoSetup();
 }
コード例 #4
0
 public void SetHackerOrRunner(Item.HackerRunner newHackerOrRunner)
 {
     hackerOrRunner = newHackerOrRunner;
 }
コード例 #5
0
 private void OpenCharacterSelectMenu(Item.HackerRunner hackerRunner)
 {
     hubWorldSFX.PlayHubSoundEffect(HubWorldSFX.HubSoundeffect.ButtonPress);
     characterSelectMenu.gameObject.SetActive(true);
     characterSelectMenu.SetupCharacterSelectMenu(hackerRunner);
 }
コード例 #6
0
    private void SetupShopDetails(Item.HackerRunner hackerOrRunner, bool isInstall = false)
    {
        switch (shopMenu.GetOpenShopTab())
        {
        case "buy":
            GameObject      activeBuyButton            = runnerShopContextBuyBtn;
            TextMeshProUGUI currentBuyPriceAmountField = runnerShopPriceAmountField;
            TextMeshProUGUI currentBuyPriceLabel       = runnerShopPriceLabel;
            if (hackerOrRunner == Item.HackerRunner.Runner)
            {
                runnerShopContextBuyBtn.SetActive(true);
                runnerShopContextSellBtn.SetActive(false);
                runnerShopContextUpgradeBtn.SetActive(false);
                runnerShopPriceAmountField.text = item.GetItemPrice().ToString();
                activeBuyButton            = runnerShopContextBuyBtn;
                currentBuyPriceAmountField = runnerShopPriceAmountField;
                currentBuyPriceLabel       = runnerShopPriceLabel;
            }
            else if (hackerOrRunner == Item.HackerRunner.Hacker && !isInstall)
            {
                hackerModShopContextBuyBtn.SetActive(true);
                hackerModShopContextSellBtn.SetActive(false);
                hackerModShopContextUpgradeBtn.SetActive(false);
                hackerModShopPriceAmountField.text = item.GetItemPrice().ToString();
                activeBuyButton            = hackerModShopContextBuyBtn;
                currentBuyPriceAmountField = hackerModShopPriceAmountField;
                currentBuyPriceLabel       = hackerModPriceLabel;
            }
            else if (hackerOrRunner == Item.HackerRunner.Hacker && isInstall)
            {
                hackerInstallShopContextBuyBtn.SetActive(true);
                hackerInstallShopContextSellBtn.SetActive(false);
                hackerInstallShopContextUpgradeBtn.SetActive(false);
                hackerInstallShopPriceAmountField.text = item.GetItemPrice().ToString();
                activeBuyButton            = hackerInstallShopContextBuyBtn;
                currentBuyPriceAmountField = hackerInstallShopPriceAmountField;
                currentBuyPriceLabel       = hackerInstallPriceLabel;
            }

            PlayerData playerData1 = FindObjectOfType <PlayerData>();
            if (item.GetItemPrice() > playerData1.GetCreditsAmount())
            {
                // If the item is unaffordable, disable the buy button but show the price fields
                activeBuyButton.GetComponent <Button>().interactable = false;
                currentBuyPriceAmountField.gameObject.SetActive(true);
                currentBuyPriceLabel.gameObject.SetActive(true);
            }
            break;

        case "sell":
            break;

        case "upgrade":
            GameObject      activeUpgradeButton            = runnerShopContextUpgradeBtn;
            TextMeshProUGUI currentUpgradePriceAmountField = runnerShopPriceAmountField;
            TextMeshProUGUI currentUpgradePriceLabel       = runnerShopPriceLabel;
            if (hackerOrRunner == Item.HackerRunner.Runner)
            {
                runnerShopContextBuyBtn.SetActive(false);
                runnerShopContextSellBtn.SetActive(false);
                runnerShopContextUpgradeBtn.SetActive(true);
                runnerShopPriceAmountField.text = shopMenu.GetPrice(item).ToString();
                activeUpgradeButton             = runnerShopContextUpgradeBtn;
                currentUpgradePriceAmountField  = runnerShopPriceAmountField;
                currentUpgradePriceLabel        = runnerShopPriceLabel;
            }
            else if (hackerOrRunner == Item.HackerRunner.Hacker && !isInstall)
            {
                hackerModShopContextBuyBtn.SetActive(false);
                hackerModShopContextSellBtn.SetActive(false);
                hackerModShopContextUpgradeBtn.SetActive(true);
                hackerModShopPriceAmountField.text = shopMenu.GetPrice(item).ToString();
                activeUpgradeButton            = hackerModShopContextUpgradeBtn;
                currentUpgradePriceAmountField = hackerModShopPriceAmountField;
                currentUpgradePriceLabel       = hackerModPriceLabel;
            }
            else if (hackerOrRunner == Item.HackerRunner.Hacker && isInstall)
            {
                hackerInstallShopContextBuyBtn.SetActive(false);
                hackerInstallShopContextSellBtn.SetActive(false);
                hackerInstallShopContextUpgradeBtn.SetActive(true);
                hackerInstallShopPriceAmountField.text = shopMenu.GetPrice(item).ToString();
                activeUpgradeButton            = hackerInstallShopContextUpgradeBtn;
                currentUpgradePriceAmountField = hackerInstallShopPriceAmountField;
                currentUpgradePriceLabel       = hackerInstallPriceLabel;
            }

            PlayerData playerData = FindObjectOfType <PlayerData>();
            if (item.GetCurrentItemLevel() >= item.GetItemMaxLevel())
            {
                // If the item is max level: Disable the button and hide the price fields
                activeUpgradeButton.GetComponent <Button>().interactable = false;
                currentUpgradePriceAmountField.gameObject.SetActive(false);
                currentUpgradePriceLabel.gameObject.SetActive(false);
            }
            else if (shopMenu.GetPrice(item) > playerData.GetCreditsAmount())
            {
                // If the item just is unaffordable, disable the button but display the price
                activeUpgradeButton.GetComponent <Button>().interactable = false;
                currentUpgradePriceAmountField.gameObject.SetActive(true);
                currentUpgradePriceLabel.gameObject.SetActive(true);
            }
            else
            {
                // if the item is affordable and not max level, enable the button and show the price
                activeUpgradeButton.GetComponent <Button>().interactable = true;
                currentUpgradePriceAmountField.gameObject.SetActive(true);
                currentUpgradePriceLabel.gameObject.SetActive(true);
            }
            break;
        }
    }