Ejemplo n.º 1
0
    public void OnClickGold()
    {
        if (imageGoldIcon.fillAmount < 1)
        {
            UIPopupManager.ShowInstantPopup("세금이 충분히 모이지 않았습니다.");
            return;
        }

        if (coroutineScaleImage != null)
        {
            StopCoroutine(coroutineScaleImage);
            coroutineScaleImage = null;
        }
        coroutineScaleImage = StartCoroutine(ScaleImage());

        if (currentGoldAmount > 0)
        {
            if (spawnCoroutine != null)
            {
                return;
            }
            coinAmount        = currentGoldAmount * Probability();
            currentGoldAmount = 0;
            taxCount          = 0;
            OnSave();

            imageBGGoldIcon.gameObject.SetActive(false);

            spawnCoroutine = StartCoroutine(Spawn());

            imageBGGoldIcon.sprite = spriteGoldList[0];
            imageGoldIcon.sprite   = spriteGoldList[0];

            //particleSystem.gameObject.SetActive(true);

            slot = UIMoney.Instance.shopMoneyGoldText.gameObject.AddComponent <UIMoneySlot>();
            //slot.isUserMoney = true;
            //slot.moneyType = MoneyType.gold;
            money = new MoneyManager.Money();
            MoneyManager.Money m = MoneyManager.GetMoney(MoneyType.gold);
            money.id    = m.id;
            money.value = m.value;
            money.type  = m.type;

            slot.textValue = UIMoney.Instance.shopMoneyGoldText;
            slot.Init(money);
            CoinObject coin = CreatCoinObject();
            coin.Init(coinAmount, coinParent);
            coin.gameObject.SetActive(true);

            //사운드 재생
            soundPlayerTakeCoins.Play();
        }
        //AutoGoldGenStart();
    }
Ejemplo n.º 2
0
    /// <summary> 재화 정보 초기화 </summary>
    /// <param name="money"></param>
    public void Init(MoneyManager.Money money)
    {
        this.money = money;

        if (money == null)
        {
            return;
        }

        UpdateValue();

        //Debug.Log (GameDataManager.moneyBaseDataDic.ContainsKey(money.id)) ;

        //Todo: 아이콘 세팅
    }
Ejemplo n.º 3
0
    IEnumerator Spawn()
    {
        int count = Mathf.Clamp((int)(coinAmount / 10), 1, 30);

        spawnCount = count;

        dividedAmount = System.Math.Floor(coinAmount / spawnCount);
        for (int i = 0; i < spawnCount; i++)
        {
            TaxObjectGold objectGold = CreatTaxObjectGold();
            objectGold.gameObject.SetActive(true);
        }

        int enableCount = objectGoldPool.Count;

        while (enableCount > 0)
        {
            enableCount = 0;
            for (int i = 0; i < objectGoldPool.Count; i++)
            {
                if (objectGoldPool[i].gameObject.activeSelf)
                {
                    enableCount++;
                }
            }
            yield return(null);
        }


        User.Tax(coinAmount);

        //MoneyManager.GetMoney(MoneyType.gold).value += coinAmount;
        //실제 서버 통신하는 부분
        //Todo: 일단 막아둠..
        //MoneyManager.SendMoneyToServer("gold", coinAmount.ToString());

        Destroy(slot);
        money          = null;
        spawnCoroutine = null;
    }