Exemplo n.º 1
0
 public void Request(GachaRequestParam _param)
 {
     if (!_param.IsRedrawConfirm)
     {
         if (_param.IsPaid && MonoSingleton <GameManager> .Instance.Player.PaidCoin < _param.Cost)
         {
             this.ActivateOutputLinks(8);
             ((Behaviour)this).set_enabled(false);
             return;
         }
         if (!_param.IsTicketGacha && !_param.IsFree)
         {
             if (_param.CostType == GachaCostType.GOLD)
             {
                 if (MonoSingleton <GameManager> .Instance.Player.Gold < _param.Cost)
                 {
                     this.ActivateOutputLinks(6);
                     ((Behaviour)this).set_enabled(false);
                     return;
                 }
             }
             else if (_param.CostType == GachaCostType.COIN && MonoSingleton <GameManager> .Instance.Player.Coin < _param.Cost)
             {
                 this.ActivateOutputLinks(7);
                 ((Behaviour)this).set_enabled(false);
                 return;
             }
         }
         this.mCurrentGachaType = !_param.IsGold ? GachaTypes.Rare : GachaTypes.Normal;
     }
     this.ExecGacha(_param.Iname, !_param.IsFree ? 0 : 1, !_param.IsTicketGacha ? 0 : _param.Num, 0);
 }
Exemplo n.º 2
0
        public void OnExecGacha(string iname, string input, int cost, string type, int is_free = 0, string ticket = "", int num = 0, bool isPaid = false)
        {
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            this.mCurrentCostType = FlowNode_ExecGacha2.GachaCostType.none;
            if (type == "coin")
            {
                this.mCurrentCostType = FlowNode_ExecGacha2.GachaCostType.coin;
            }
            else if (type == "gold")
            {
                this.mCurrentCostType = FlowNode_ExecGacha2.GachaCostType.gold;
            }
            else if (type == nameof(ticket))
            {
                this.mCurrentCostType = FlowNode_ExecGacha2.GachaCostType.ticket;
            }
            bool flag = false;

            if (type != "gold")
            {
                this.mCurrentGachaType = GachaTypes.Rare;
            }
            this.mCurrentNum = num;
            if (isPaid && player.PaidCoin < cost)
            {
                this.ActivateOutputLinks(8);
                ((Behaviour)this).set_enabled(false);
            }
            else if (input == "single")
            {
                if (is_free == 0)
                {
                    if (this.mCurrentCostType == FlowNode_ExecGacha2.GachaCostType.gold)
                    {
                        if (player.Gold < cost)
                        {
                            this.ActivateOutputLinks(6);
                            ((Behaviour)this).set_enabled(false);
                        }
                        else
                        {
                            flag = true;
                        }
                    }
                    else if (this.mCurrentCostType == FlowNode_ExecGacha2.GachaCostType.coin || this.mCurrentCostType == FlowNode_ExecGacha2.GachaCostType.none)
                    {
                        if (player.Coin < cost)
                        {
                            this.ActivateOutputLinks(7);
                            ((Behaviour)this).set_enabled(false);
                        }
                        else
                        {
                            flag = true;
                        }
                    }
                }
                else
                {
                    flag = true;
                }
                if (!flag)
                {
                    return;
                }
                this.ExecGacha(iname, is_free, 0);
                if (type == "coin")
                {
                    AnalyticsManager.TrackCurrencyUse(AnalyticsManager.CurrencyType.Gem, !isPaid ? AnalyticsManager.CurrencySubType.FREE : AnalyticsManager.CurrencySubType.PAID, (long)cost, "Summons", (Dictionary <string, object>)null);
                }
                else
                {
                    if (!(type == "gold"))
                    {
                        return;
                    }
                    AnalyticsManager.TrackCurrencyUse(AnalyticsManager.CurrencyType.Zeni, AnalyticsManager.CurrencySubType.FREE, (long)cost, "Summons", (Dictionary <string, object>)null);
                }
            }
            else if (input == "multiple")
            {
                if (is_free == 0)
                {
                    if (this.mCurrentCostType == FlowNode_ExecGacha2.GachaCostType.gold)
                    {
                        if (player.Gold < cost)
                        {
                            this.ActivateOutputLinks(6);
                            ((Behaviour)this).set_enabled(false);
                        }
                        else
                        {
                            flag = true;
                        }
                    }
                    else if (this.mCurrentCostType == FlowNode_ExecGacha2.GachaCostType.coin || this.mCurrentCostType == FlowNode_ExecGacha2.GachaCostType.none)
                    {
                        if (player.Coin < cost)
                        {
                            this.ActivateOutputLinks(7);
                            ((Behaviour)this).set_enabled(false);
                        }
                        else
                        {
                            flag = true;
                        }
                    }
                }
                else
                {
                    flag = true;
                }
                if (!flag)
                {
                    return;
                }
                this.ExecGacha(iname, is_free, 0);
                if (type == "coin")
                {
                    AnalyticsManager.TrackCurrencyUse(AnalyticsManager.CurrencyType.Gem, !isPaid ? AnalyticsManager.CurrencySubType.FREE : AnalyticsManager.CurrencySubType.PAID, (long)cost, "Summons", (Dictionary <string, object>)null);
                }
                else
                {
                    if (!(type == "gold"))
                    {
                        return;
                    }
                    AnalyticsManager.TrackCurrencyUse(AnalyticsManager.CurrencyType.Zeni, AnalyticsManager.CurrencySubType.FREE, (long)cost, "Summons", (Dictionary <string, object>)null);
                }
            }
            else if (input == "charge")
            {
                if (player.PaidCoin < cost)
                {
                    this.ActivateOutputLinks(8);
                    ((Behaviour)this).set_enabled(false);
                }
                else
                {
                    flag = true;
                }
                if (!flag)
                {
                    return;
                }
                this.ExecGacha(iname, is_free, 0);
            }
            else if (input == nameof(ticket))
            {
                if (!true)
                {
                    return;
                }
                AnalyticsManager.TrackCurrencyUse(AnalyticsManager.CurrencyType.SummonTicket, AnalyticsManager.CurrencySubType.FREE, (long)num, "Summon Gate", new Dictionary <string, object>()
                {
                    {
                        "ticket_id",
                        (object)ticket
                    }
                });
                this.ExecGacha(iname, is_free, num);
            }
            else
            {
                this.Failure();
            }
        }