Пример #1
0
    public void Sell(long count, long value, CurrencyType currencyType)
    {
        if (save.itemsCostMoney)
        {
            value = value * count;
            save[currencyType] += value;

            switch (currencyType)
            {
            case CurrencyType.Money:
                moneyChanged.Invoke();
                break;

            case CurrencyType.Xp:
                xpChanged.Invoke();
                break;

            case CurrencyType.Level:
                levelChanged.Invoke();
                break;
            }

            CurrencyEvent currencyEvent = new CurrencyEvent(GAResourceFlowType.Source, currencyType, CurrencyEventType.ItemSold, "Item");
            Analytics.instance.NewCurrencyEvent(currencyEvent, value);
        }
    }
Пример #2
0
 private void _OnSpend(object sender, CurrencyEvent e)
 {
     if (e.currency != currency)
     {
         return;
     }
     if (e.to >= e.from)
     {
         return;
     }
     StartCoroutine(_Lob(e.currency, (ulong)(e.from - e.to), true));
 }
Пример #3
0
    public void SellMachine(MachineInfo machineInfo)
    {
        if (save.itemsCostMoney)
        {
            long value = machineInfo.cost;
            save.money += value;

            moneyChanged.Invoke();

            CurrencyEvent currencyEvent = new CurrencyEvent(GAResourceFlowType.Source, CurrencyType.Money, CurrencyEventType.MachineSold, machineInfo);
            Analytics.instance.NewCurrencyEvent(currencyEvent, value);
        }
    }
Пример #4
0
    public void RefundItem(ItemInfo itemInfo, int count)
    {
        if (save.itemsCostMoney)
        {
            long value = itemInfo.value * count;
            save.money += value;

            CurrencyEvent currencyEvent = new CurrencyEvent(GAResourceFlowType.Source, CurrencyType.Money, CurrencyEventType.ItemRefunded, itemInfo);
            Analytics.instance.NewCurrencyEvent(currencyEvent, value);

            moneyChanged.Invoke();
        }
    }
Пример #5
0
    public void MachinePurchaserBuyItem(ItemInfo itemInfo, int count)
    {
        if (save.itemsCostMoney)
        {
            long value = itemInfo.value * count;
            save.money -= value;

            moneyChanged.Invoke();

            CurrencyEvent currencyEvent = new CurrencyEvent(GAResourceFlowType.Sink, CurrencyType.Money, CurrencyEventType.MachinePurchaserFees, itemInfo);
            Analytics.instance.NewCurrencyEvent(currencyEvent, value);
        }
    }
Пример #6
0
    public void Buy(long count, long value, CurrencyType currencyType)
    {
        if (save.itemsCostMoney)
        {
            value = value * count;
            save[currencyType] -= value;

            moneyChanged.Invoke();

            CurrencyEvent currencyEvent = new CurrencyEvent(GAResourceFlowType.Sink, currencyType, CurrencyEventType.ItemPurchased, "Item");
            Analytics.instance.NewCurrencyEvent(currencyEvent, value);
        }
    }
Пример #7
0
    public void SellConveyor()
    {
        if (save.itemsCostMoney)
        {
            long value = conveyorCost;
            save.money += value;

            moneyChanged.Invoke();

            CurrencyEvent currencyEvent = new CurrencyEvent(GAResourceFlowType.Source, CurrencyType.Money, CurrencyEventType.ConveyorSold, "Conveyor");
            Analytics.instance.NewCurrencyEvent(currencyEvent, value);
        }
    }
Пример #8
0
    public void BuyConveyors(int count)
    {
        if (save.itemsCostMoney)
        {
            long value = conveyorCost * count;
            save.money -= value;

            moneyChanged.Invoke();

            CurrencyEvent currencyEvent = new CurrencyEvent(GAResourceFlowType.Sink, CurrencyType.Money, CurrencyEventType.ConveyorPurchased, "Conveyor");
            Analytics.instance.NewCurrencyEvent(currencyEvent, value);
        }
    }
Пример #9
0
    public void MachineSellerSellItem(ItemInfo itemInfo, int count, Vector3 position)
    {
        if (save.itemsCostMoney)
        {
            long value = itemInfo.value * count;
            save.money += value;

            moneyChanged.Invoke();

            CurrencyMoney currency = ObjectPooler.instance.Get <CurrencyMoney>();
            currency.Initialize(position);

            CurrencyEvent currencyEvent = new CurrencyEvent(GAResourceFlowType.Source, CurrencyType.Money, CurrencyEventType.MachineSellerRevenue, itemInfo);
            Analytics.instance.NewCurrencyEvent(currencyEvent, value);
        }
    }
Пример #10
0
    public void RefundInventory(Inventory inventory)
    {
        if (save.itemsCostMoney)
        {
            long valueSum = 0;
            for (int i = 0, len = inventory.slots.Length; i < len; ++i)
            {
                InventorySlot slot = inventory.slots[i];
                if (slot.count > 0)
                {
                    long value = slot.itemInfo.value * slot.count;
                    valueSum += value;

                    CurrencyEvent currencyEvent = new CurrencyEvent(GAResourceFlowType.Source, CurrencyType.Money, CurrencyEventType.ItemRefunded, slot.itemInfo);
                    Analytics.instance.NewCurrencyEvent(currencyEvent, value);
                }
            }

            save.money += valueSum;
            moneyChanged.Invoke();
        }
    }
Пример #11
0
    public void ProgressionReward(ProgressionInfo progressionInfo)
    {
        if (progressionInfo.moneyReward > 0)
        {
            long value = progressionInfo.moneyReward;
            save.money += value;

            CurrencyEvent currencyEvent = new CurrencyEvent(GAResourceFlowType.Source, CurrencyType.Money, CurrencyEventType.ProgressionReward, progressionInfo);
            Analytics.instance.NewCurrencyEvent(currencyEvent, value);

            moneyChanged.Invoke();
        }

        if (progressionInfo.xpReward > 0)
        {
            long value = progressionInfo.xpReward;
            save.xp += value;

            CurrencyEvent currencyEvent = new CurrencyEvent(GAResourceFlowType.Source, CurrencyType.Xp, CurrencyEventType.ProgressionReward, progressionInfo);
            Analytics.instance.NewCurrencyEvent(currencyEvent, value);

            xpChanged.Invoke();
        }
    }
Пример #12
0
 private void OnChange(object sender, CurrencyEvent currencyEvent)
 {
     ActiveManager.Check();
 }
Пример #13
0
 private void OnChange(object sender, CurrencyEvent currencyEvent)
 {
     MyUpdate();
 }
Пример #14
0
 private void OnChange(object sender, CurrencyEvent currencyEvent)
 {
     _text.Lerp(currencyEvent.to);
 }