void ReleaseDesignerOutlets()
        {
            if (SellButton != null)
            {
                SellButton.Dispose();
                SellButton = null;
            }

            if (BuyPriceLabel != null)
            {
                BuyPriceLabel.Dispose();
                BuyPriceLabel = null;
            }

            if (SellPriceLabel != null)
            {
                SellPriceLabel.Dispose();
                SellPriceLabel = null;
            }

            if (BuyButton != null)
            {
                BuyButton.Dispose();
                BuyButton = null;
            }

            if (PriceLabel != null)
            {
                PriceLabel.Dispose();
                PriceLabel = null;
            }
        }
    void Start()
    {
        _towerExist        = false;
        _confirmed         = false;
        _towerIndex        = -1;
        _clearBeforeBattle = false;
        _currentTowerType  = -1;

        _levelManager    = GameManager.Instance.CurrentLevelManager;
        _gameBoard       = _levelManager.GameBoardSystem;
        _towerController = TowerController.Instance;

        _towerBuildPanel     = TowerBuildPanel.Instance;
        _towerOperationPanel = TowerOperationPanel.Instance;
        _towerInfoPanel      = TowerInfoPanel.Instance;
        _buildCheckPanel     = BuildCheckPanel.Instance;
        _notificationPanel   = NotificationPanel.Instance;

        _tankTowerButton  = TankTowerButton.Instance;
        _rangeTowerButton = RangeTowerButton.Instance;
        _slowTowerButton  = SlowTowerButton.Instance;
        _healTowerButton  = HealTowerButton.Instance;
        _goldTowerButton  = GoldTowerButton.Instance;

        _upgradeButton = UpgradeButton.Instance;
        _repairButton  = RepairButton.Instance;
        _sellButton    = SellButton.Instance;
        _yesButton     = BCP_Yes.Instance;

        TowerOperation = Operation.Nop;
    }
Esempio n. 3
0
    public void TransferItems()
    {
        Debug.Log("went through");
        if (amount != 0)
        {
            //money transfer
            currInv.money  += amount * selectedItem.cost;
            otherInv.money -= amount * selectedItem.cost;

            //item transfer
            currInv.RemoveItems(selectedItem, amount); //should never return false
            otherInv.AddItems(selectedItem, amount);

            //update item lists
            itemList  = new List <Item>(currInv.itemDict.Keys);
            itemIndex = 0;
            UpdateItemList(itemList, currInv, itemIndex);
        }

        //exit back to item scrolling
        if (itemList.Count == 0)
        {
            //inventory has no more items to display
            Debug.Log("No more items to buy/sell");

            int lastType = menuType;
            menuType = 0;
            ItemButton.GetComponent <Button>().interactable = false;
            switch (lastType)
            {
            case -1:
                BuyButton.SetActive(true);
                SellButton.GetComponent <Button>().enabled = true;
                ES.SetSelectedGameObject(SellButton);
                StartCoroutine("MoveLeft");
                break;

            case 1:
                SellButton.SetActive(true);
                BuyButton.GetComponent <Button>().enabled = true;
                ES.SetSelectedGameObject(BuyButton);
                StartCoroutine("MoveRight");
                break;
            }
        }
        else
        {
            Button button = ItemList.GetComponentInChildren <Button>();
            button.interactable = true;
            ES.SetSelectedGameObject(button.gameObject);
            itemScrolling = true;
        }

        AmountSelection.SetActive(false);
        selectedItem = null;
    }
Esempio n. 4
0
    protected void Start()
    {
        position           = new Vector2Int((int)Mathf.Floor(transform.position.x), (int)Mathf.Floor(transform.position.y));
        transform.position = new Vector2(position.x + .5f, position.y + .5f);

        monsterManager  = FindObjectOfType <MonsterManager>();
        turretManager   = FindObjectOfType <TurretManager>();
        cameraManager   = FindObjectOfType <CameraManager>();
        upgradeButton   = turretMenu.transform.Find("UpgradeButton").GetComponent <UpgradeButton>();
        upgradeCostText = upgradeButton.transform.Find("UpgradeCost").GetComponent <Text>();
        sellButton      = turretMenu.transform.Find("SellButton").GetComponent <SellButton>();
        sellPriceText   = sellButton.transform.Find("SellPrice").GetComponent <Text>();
        UpdateButtons();
    }
    public void ShowMsg()
    {
        if (now == ResultOnOff.on)
        {
            return;
        }
        if (GameObject.Find("IngredientStack") != null)
        {
            StartCoroutine(SellButton.Destroy_Menus(null, GameObject.Find("IngredientStack")));
        }
        Destroy(GameManager.instance.customer1.obj);
        Destroy(GameManager.instance.customer2.obj);
        Destroy(GameManager.instance.customer3.obj);
        main.SetActive(false);
        Time.timeScale = 0.0f;
        bgs.effectSounds[14].source.Play();
        backgroundChange.SetActive(false);
        if (!(9 <= date && date <= 15 || date == 26))
        {
            bgmSource.Stop();
            bgsSource.Stop();
        }
        if (date == 1)
        {
            OnClickContinueButton();
            return;
        }
        resultMsg.SetActive(true);

        TipText.text = Tips[(int)Random.Range(0.0f, Tips.Count)];

        moneyText.text = (StatManager.instance.money.GetData() - preMoney) + "원";
        preMoney       = StatManager.instance.money.GetData();

        customerText.text = metCustomer + "명";
        metCustomer       = 0;

        GameManager.instance.customer1.timer = GameManager.instance.customer2.timer = GameManager.instance.customer3.timer = 0.0f;
        now = ResultOnOff.on;
    }
Esempio n. 6
0
    public void OpenBuy()
    {
        menuType = 1;
        menu.transform.localPosition            = new Vector3(180, 0, 0);
        AmountSelection.transform.localPosition = new Vector3(-95, -55, 0);
        SellButton.SetActive(false);
        BuyButton.GetComponent <Button>().enabled       = false;
        ItemButton.GetComponent <Button>().interactable = true;
        ES.SetSelectedGameObject(ItemButton);

        itemList = new List <Item>(npcInv.itemDict.Keys);
        currInv  = npcInv;
        otherInv = playerInv;
        UpdateItemList(itemList, currInv, 0);
        if (itemList.Count == 0)
        {
            //the button throws exceptions when there are no items selected, this prevents that
            ItemButton.GetComponent <Button>().interactable = false;
        }

        StartCoroutine("MoveLeft");
    }
 public void OnClickUndoButton()
 {
     StartCoroutine(SellButton.Destroy_Menus(null, GameObject.Find("IngredientStack")));
     effect.effectSounds[11].source.Play();
 }
Esempio n. 8
0
 void Awake()
 {
     Instance      = this;
     SellOptButton = GetComponent <Button>();
 }
Esempio n. 9
0
    // Update is called once per frame
    void Update()
    {
        int lastType = menuType;

        if (Input.GetButtonDown("Cancel"))
        {
            if (!itemScrolling)
            {
                //exit back to buy/sell menus
                AmountSelection.SetActive(false);
                Button button = ItemList.GetComponentInChildren <Button>();
                button.interactable = true;
                ES.SetSelectedGameObject(button.gameObject);
                selectedItem  = null;
                itemScrolling = true;
            }
            else if (menuType != 0)
            {
                menuType = 0;
                ItemButton.GetComponent <Button>().interactable = false;
                switch (lastType)
                {
                case -1:
                    BuyButton.SetActive(true);
                    SellButton.GetComponent <Button>().enabled = true;
                    ES.SetSelectedGameObject(SellButton);
                    StartCoroutine("MoveLeft");
                    break;

                case 1:
                    SellButton.SetActive(true);
                    BuyButton.GetComponent <Button>().enabled = true;
                    ES.SetSelectedGameObject(BuyButton);
                    StartCoroutine("MoveRight");
                    break;
                }
            }
            else
            {
                //exit out of the shop altogether
                ReturnToLast();
            }
        }

        if (Input.GetButtonDown("Vertical"))
        {
            if (menuType != 0 && itemScrolling && itemList.Count != 0)
            {
                if (Input.GetAxisRaw("Vertical") > 0)
                {
                    //scroll items up
                    itemIndex--;
                }
                else
                {
                    //scroll items down
                    itemIndex++;
                }
                //loop around
                itemIndex += itemList.Count;
                itemIndex %= itemList.Count;
                UpdateItemList(itemList, currInv, itemIndex);
            }
            else if (menuType != 0 && !itemScrolling)
            {
                //amount select
                if (Input.GetAxisRaw("Vertical") > 0)
                {
                    //increase amount
                    changeItemAmount(1);
                }
                else
                {
                    //decrease amount
                    changeItemAmount(-1);
                }
            }
        }
    }