public void SetShopItemDesc(Json_ShopItemDesc item)
 {
     this.ItemIcon.SetActive(false);
     this.ArtifactIcon.SetActive(false);
     this.ConceptCard.SetActive(false);
     if (item.IsItem)
     {
         this.ItemIcon.SetActive(true);
     }
     else if (item.IsArtifact)
     {
         this.ArtifactIcon.SetActive(true);
     }
     else if (item.IsConceptCard)
     {
         this.ConceptCard.SetActive(true);
     }
     else
     {
         DebugUtility.LogError(string.Format("不明な商品タイプが設定されています (item.iname({0}) => {1})", (object)item.iname, (object)item.itype));
     }
     if (this.mShopItem == null)
     {
         this.mShopItem = new EventShopItem();
     }
     this.mShopItem.num   = item.num;
     this.mShopItem.iname = item.iname;
 }
Ejemplo n.º 2
0
        private void Refresh()
        {
            if (Object.op_Equality((Object)this.UnitTemplate, (Object)null))
            {
                return;
            }
            List <UnitData> units = MonoSingleton <GameManager> .Instance.Player.Units;

            for (int index = 0; index < this.mUnits.Count; ++index)
            {
                this.mUnits[index].get_gameObject().SetActive(false);
            }
            EventShopItem data1 = MonoSingleton <GameManager> .Instance.Player.GetEventShopData().items[GlobalVars.ShopBuyIndex];

            ItemData itemDataByItemId = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(data1.iname);

            if (Object.op_Inequality((Object)this.EnableEquipUnitWindow, (Object)null))
            {
                this.EnableEquipUnitWindow.get_gameObject().SetActive(false);
                int index1 = 0;
                for (int index2 = 0; index2 < units.Count; ++index2)
                {
                    UnitData data2 = units[index2];
                    bool     flag  = false;
                    for (int index3 = 0; index3 < data2.Jobs.Length; ++index3)
                    {
                        JobData job = data2.Jobs[index3];
                        if (job.IsActivated)
                        {
                            int equipSlotByItemId = job.FindEquipSlotByItemID(data1.iname);
                            if (equipSlotByItemId != -1 && job.CheckEnableEquipSlot(equipSlotByItemId))
                            {
                                flag = true;
                                break;
                            }
                        }
                    }
                    if (flag)
                    {
                        if (index1 >= this.mUnits.Count)
                        {
                            this.UnitTemplate.SetActive(true);
                            GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)this.UnitTemplate);
                            gameObject.get_transform().SetParent((Transform)this.UnitLayoutParent, false);
                            this.mUnits.Add(gameObject);
                            this.UnitTemplate.SetActive(false);
                        }
                        GameObject gameObject1 = this.mUnits[index1].get_gameObject();
                        DataSource.Bind <UnitData>(gameObject1, data2);
                        gameObject1.SetActive(true);
                        this.EnableEquipUnitWindow.get_gameObject().SetActive(true);
                        ++index1;
                    }
                }
            }
            DataSource.Bind <EventShopItem>(((Component)this).get_gameObject(), data1);
            DataSource.Bind <ItemData>(((Component)this).get_gameObject(), itemDataByItemId);
            DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), MonoSingleton <GameManager> .Instance.GetItemParam(data1.iname));
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
Ejemplo n.º 3
0
        private void Refresh()
        {
            MonoSingleton <GameManager> .Instance.Player.UpdateEventCoin();

            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null))
            {
                return;
            }
            this.SetPossessionCoinParam();
            EventShopData eventShopData = MonoSingleton <GameManager> .Instance.Player.GetEventShopData();

            DebugUtility.Assert(eventShopData != null, "ショップ情報が存在しない");
            for (int index = 0; index < this.mBuyItems.Count; ++index)
            {
                this.mBuyItems[index].get_gameObject().SetActive(false);
            }
            int count = eventShopData.items.Count;

            for (int index = 0; index < count; ++index)
            {
                EventShopItem data1 = eventShopData.items[index];
                if (index >= this.mBuyItems.Count)
                {
                    GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemTemplate);
                    gameObject.get_transform().SetParent((Transform)this.ItemLayoutParent, false);
                    this.mBuyItems.Add(gameObject);
                }
                GameObject mBuyItem = this.mBuyItems[index];
                ((EventShopBuyList)mBuyItem.GetComponentInChildren <EventShopBuyList>()).eventShopItem = data1;
                DataSource.Bind <EventShopItem>(mBuyItem, data1);
                if (data1.IsArtifact)
                {
                    ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(data1.iname);

                    DataSource.Bind <ArtifactParam>(mBuyItem, artifactParam);
                }
                else
                {
                    ItemData data2 = new ItemData();
                    data2.Setup(0L, data1.iname, data1.num);
                    DataSource.Bind <ItemData>(mBuyItem, data2);
                    DataSource.Bind <ItemParam>(mBuyItem, MonoSingleton <GameManager> .Instance.GetItemParam(data1.iname));
                }
                ListItemEvents component1 = (ListItemEvents)mBuyItem.GetComponent <ListItemEvents>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component1, (UnityEngine.Object)null))
                {
                    component1.OnSelect = new ListItemEvents.ListItemEvent(this.OnSelect);
                }
                Button component2 = (Button)mBuyItem.GetComponent <Button>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component2, (UnityEngine.Object)null))
                {
                    ((Selectable)component2).set_interactable(!data1.is_soldout);
                }
                mBuyItem.SetActive(true);
            }
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
Ejemplo n.º 4
0
 public void SetShopItemDesc(Json_ShopItemDesc item)
 {
     this.ItemIcon.SetActive(!item.IsArtifact);
     this.ArtifactIcon.SetActive(item.IsArtifact);
     if (this.mShopItem == null)
     {
         this.mShopItem = new EventShopItem();
     }
     this.mShopItem.num   = item.num;
     this.mShopItem.iname = item.iname;
 }
Ejemplo n.º 5
0
        public bool CheckCanBuy(EventShopItem shopitem, int buy, int check, int pin)
        {
            int num = !shopitem.isSetSaleValue ? buy * shopitem.num : shopitem.saleValue;

            if (check >= num)
            {
                return(true);
            }
            this.ActivateOutputLinks(pin);
            return(false);
        }
Ejemplo n.º 6
0
        private void Refresh()
        {
            EventShopItem data = MonoSingleton <GameManager> .Instance.Player.GetEventShopData().items[GlobalVars.ShopBuyIndex];

            ItemData itemDataByItemId = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(data.iname);

            this.event_shop_item_set_list.Clear();
            DataSource.Bind <EventShopItem>(((Component)this).get_gameObject(), data);
            DataSource.Bind <ItemData>(((Component)this).get_gameObject(), itemDataByItemId);
            DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), MonoSingleton <GameManager> .Instance.GetItemParam(data.iname));
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
Ejemplo n.º 7
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.ShopSoldOut:
                case Network.EErrCode.ShopBuyCostShort:
                case Network.EErrCode.ShopBuyLvShort:
                case Network.EErrCode.ShopBuyNotFound:
                case Network.EErrCode.ShopBuyItemNotFound:
                    this.OnBack();
                    break;

                default:
                    this.OnRetry();
                    break;
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_EventShopBuyResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_EventShopBuyResponse> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                if (jsonObject.body == null)
                {
                    this.OnRetry();
                }
                else
                {
                    Network.RemoveAPI();
                    EventShopData shop = MonoSingleton <GameManager> .Instance.Player.GetEventShopData() ?? new EventShopData();

                    if (!shop.Deserialize(jsonObject.body))
                    {
                        this.OnFailed();
                    }
                    else
                    {
                        MonoSingleton <GameManager> .Instance.Player.SetEventShopData(shop);

                        EventShopItem eventShopItem = shop.items[GlobalVars.ShopBuyIndex];
                        if (eventShopItem.saleValue > 0)
                        {
                            PlayerData player = MonoSingleton <GameManager> .Instance.Player;
                            AnalyticsManager.TrackSpendShop(eventShopItem.saleType, this.mShopType, player.GetShopUpdateCost(this.mShopType, true));
                        }
                        this.Success();
                    }
                }
            }
        }
Ejemplo n.º 8
0
 public bool Deserialize(JSON_EventShopItemListSet[] shopitems)
 {
     if (shopitems == null)
     {
         return(true);
     }
     this.items.Clear();
     for (int index = 0; index < shopitems.Length; ++index)
     {
         EventShopItem eventShopItem = new EventShopItem();
         if (!eventShopItem.Deserialize(shopitems[index]))
         {
             return(false);
         }
         this.items.Add(eventShopItem);
     }
     return(true);
 }
Ejemplo n.º 9
0
        public static int GetRemainingCurrency(ShopItem shopitem)
        {
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            switch (shopitem.saleType)
            {
            case ESaleType.Gold:
                return(player.Gold);

            case ESaleType.Coin:
                return(player.Coin);

            case ESaleType.TourCoin:
                return(player.TourCoin);

            case ESaleType.ArenaCoin:
                return(player.ArenaCoin);

            case ESaleType.PiecePoint:
                return(player.PiecePoint);

            case ESaleType.MultiCoin:
                return(player.MultiCoin);

            case ESaleType.EventCoin:
                if (shopitem is EventShopItem)
                {
                    EventShopItem eventShopItem = (EventShopItem)shopitem;
                    return(player.EventCoinNum(eventShopItem.cost_iname));
                }
                break;

            case ESaleType.Coin_P:
                return(player.PaidCoin);
            }
            return(0);
        }
Ejemplo n.º 10
0
        private void Refresh()
        {
            GameUtility.DestroyGameObjects(this.mItems);
            this.mItems.Clear();
            EventShopData eventShopData = MonoSingleton <GameManager> .Instance.Player.GetEventShopData();

            if (eventShopData == null || eventShopData.items.Count <= 0 || Object.op_Equality((Object)this.ItemTemplate, (Object)null))
            {
                return;
            }
            int           shopBuyIndex  = GlobalVars.ShopBuyIndex;
            Transform     parent        = !Object.op_Inequality((Object)this.ItemParent, (Object)null) ? this.ItemTemplate.get_transform().get_parent() : this.ItemParent.get_transform();
            EventShopItem eventShopItem = eventShopData.items[shopBuyIndex];

            if (eventShopItem.IsArtifact)
            {
                eventShopItem.children          = new Json_ShopItemDesc[1];
                eventShopItem.children[0]       = new Json_ShopItemDesc();
                eventShopItem.children[0].iname = eventShopItem.iname;
                eventShopItem.children[0].num   = eventShopItem.num;
            }
            if (eventShopItem.children != null && eventShopItem.children.Length > 0)
            {
                foreach (Json_ShopItemDesc child in eventShopItem.children)
                {
                    string     empty = string.Empty;
                    GameObject gameObject;
                    string     name;
                    if (child.IsArtifact)
                    {
                        ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(child.iname);

                        if (artifactParam != null)
                        {
                            gameObject = this.InstantiateItem <ArtifactParam>(this.ItemTemplate, parent, artifactParam);
                            name       = artifactParam.name;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        ItemData itemData = new ItemData();
                        if (itemData.Setup(0L, child.iname, child.num))
                        {
                            gameObject = this.InstantiateItem <ItemData>(this.ItemTemplate, parent, itemData);
                            name       = itemData.Param.name;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    EventShopGiftItem component = (EventShopGiftItem)gameObject.GetComponent <EventShopGiftItem>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        component.SetShopItemInfo(child, name);
                    }
                }
            }
            GameParameter.UpdateAll(((Component)parent).get_gameObject());
        }
Ejemplo n.º 11
0
        private void Refresh()
        {
            GameUtility.DestroyGameObjects(this.mItems);
            this.mItems.Clear();
            EventShopData eventShopData = MonoSingleton <GameManager> .Instance.Player.GetEventShopData();

            if (eventShopData == null || eventShopData.items.Count <= 0 || UnityEngine.Object.op_Equality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null))
            {
                return;
            }
            int                      shopdata_index       = GlobalVars.ShopBuyIndex;
            Transform                parent               = !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ItemParent, (UnityEngine.Object)null) ? this.ItemTemplate.get_transform().get_parent() : this.ItemParent.get_transform();
            EventShopItem            eventShopItem        = eventShopData.items.FirstOrDefault <EventShopItem>((Func <EventShopItem, bool>)(item => item.id == shopdata_index));
            List <Json_ShopItemDesc> jsonShopItemDescList = new List <Json_ShopItemDesc>();

            if (eventShopItem.IsArtifact)
            {
                jsonShopItemDescList.Add(new Json_ShopItemDesc()
                {
                    iname = eventShopItem.iname,
                    itype = ShopData.ShopItemType2String(eventShopItem.ShopItemType),
                    num   = eventShopItem.num
                });
            }
            else if (eventShopItem.children != null && eventShopItem.children.Length > 0)
            {
                jsonShopItemDescList.AddRange((IEnumerable <Json_ShopItemDesc>)eventShopItem.children);
            }
            if (jsonShopItemDescList.Count > 0)
            {
                for (int index = 0; index < jsonShopItemDescList.Count; ++index)
                {
                    Json_ShopItemDesc shop_item_desc = jsonShopItemDescList[index];
                    string            empty          = string.Empty;
                    GameObject        gameObject;
                    string            name;
                    if (shop_item_desc.IsArtifact)
                    {
                        ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(shop_item_desc.iname);

                        if (artifactParam != null)
                        {
                            gameObject = this.InstantiateItem <ArtifactParam>(this.ItemTemplate, parent, artifactParam);
                            name       = artifactParam.name;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else if (shop_item_desc.IsConceptCard)
                    {
                        ConceptCardData cardDataForDisplay = ConceptCardData.CreateConceptCardDataForDisplay(shop_item_desc.iname);
                        if (cardDataForDisplay != null)
                        {
                            gameObject = this.InstantiateItem <ConceptCardData>(this.ItemTemplate, parent, cardDataForDisplay);
                            ConceptCardIcon componentInChildren = (ConceptCardIcon)gameObject.GetComponentInChildren <ConceptCardIcon>();
                            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)componentInChildren, (UnityEngine.Object)null))
                            {
                                componentInChildren.Setup(cardDataForDisplay);
                            }
                            name = cardDataForDisplay.Param.name;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        ItemData itemData = new ItemData();
                        if (itemData.Setup(0L, shop_item_desc.iname, shop_item_desc.num))
                        {
                            gameObject = this.InstantiateItem <ItemData>(this.ItemTemplate, parent, itemData);
                            name       = itemData.Param.name;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    EventShopGiftItem component = (EventShopGiftItem)gameObject.GetComponent <EventShopGiftItem>();
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                    {
                        component.SetShopItemInfo(shop_item_desc, name, GlobalVars.ShopBuyAmount);
                    }
                }
            }
            GameParameter.UpdateAll(((Component)parent).get_gameObject());
        }
Ejemplo n.º 12
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.ShopSoldOut:
                case Network.EErrCode.ShopBuyCostShort:
                case Network.EErrCode.ShopBuyLvShort:
                case Network.EErrCode.ShopBuyNotFound:
                case Network.EErrCode.ShopBuyItemNotFound:
                    this.OnBack();
                    break;

                case Network.EErrCode.ShopRefreshItemList:
                    UIUtility.SystemMessage((string)null, Network.ErrMsg, (UIUtility.DialogResultEvent)(go => this.ActivateOutputLinks(121)), (GameObject)null, false, -1);
                    ((Behaviour)this).set_enabled(false);
                    Network.RemoveAPI();
                    Network.ResetError();
                    break;

                case Network.EErrCode.ShopBuyOutofItemPeriod:
                    UIUtility.SystemMessage((string)null, Network.ErrMsg, (UIUtility.DialogResultEvent)(go => this.ActivateOutputLinks(120)), (GameObject)null, false, -1);
                    ((Behaviour)this).set_enabled(false);
                    Network.RemoveAPI();
                    Network.ResetError();
                    break;

                case Network.EErrCode.ShopBuyOutofPeriod:
                    UIUtility.SystemMessage((string)null, Network.ErrMsg, (UIUtility.DialogResultEvent)(go => this.ActivateOutputLinks(122)), (GameObject)null, false, -1);
                    ((Behaviour)this).set_enabled(false);
                    Network.RemoveAPI();
                    Network.ResetError();
                    break;

                default:
                    this.OnRetry();
                    break;
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_EventShopBuyResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_EventShopBuyResponse> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                if (jsonObject.body == null)
                {
                    this.OnRetry();
                }
                else
                {
                    Network.RemoveAPI();
                    EventShopData shop = MonoSingleton <GameManager> .Instance.Player.GetEventShopData() ?? new EventShopData();

                    if (!shop.Deserialize(jsonObject.body))
                    {
                        this.OnFailed();
                    }
                    else
                    {
                        MonoSingleton <GameManager> .Instance.Player.SetEventShopData(shop);

                        EventShopItem eventShopItem = shop.items.FirstOrDefault <EventShopItem>((Func <EventShopItem, bool>)(item => item.id == GlobalVars.ShopBuyIndex));
                        if (jsonObject.body.cards != null && jsonObject.body.cards.Length > 0)
                        {
                            GlobalVars.IsDirtyConceptCardData.Set(true);
                            Json_ShopBuyConceptCard[] cards = jsonObject.body.cards;
                            for (int index = 0; index < cards.Length; ++index)
                            {
                                if (cards[index] != null && cards[index].IsGetConceptCardUnit)
                                {
                                    FlowNode_ConceptCardGetUnit.AddConceptCardData(ConceptCardData.CreateConceptCardDataForDisplay(cards[index].iname));
                                }
                            }
                        }
                        if (eventShopItem.saleValue > 0)
                        {
                            MyMetaps.TrackSpendShop(eventShopItem.saleType, this.mShopType, eventShopItem.saleValue);
                        }
                        this.Success();
                    }
                }
            }
        }
        private void Refresh()
        {
            this.mShopitem = MonoSingleton <GameManager> .Instance.Player.GetEventShopData().items.FirstOrDefault <EventShopItem>((Func <EventShopItem, bool>)(item => item.id == GlobalVars.ShopBuyIndex));

            this.ItemWindow.SetActive(!this.mShopitem.IsArtifact);
            this.ArtifactWindow.SetActive(this.mShopitem.IsArtifact);
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AmountNum, (UnityEngine.Object)null))
            {
                this.AmountNum.set_text(this.mShopitem.remaining_num.ToString());
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Sold, (UnityEngine.Object)null))
            {
                this.Sold.SetActive(!this.mShopitem.IsNotLimited);
            }
            if (this.mShopitem.IsArtifact)
            {
                ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(this.mShopitem.iname);

                DataSource.Bind <ArtifactParam>(((Component)this).get_gameObject(), artifactParam);
                this.mArtifactParam = artifactParam;
                ArtifactData artifactData = new ArtifactData();
                artifactData.Deserialize(new Json_Artifact()
                {
                    iname = artifactParam.iname,
                    rare  = artifactParam.rareini
                });
                BaseStatus fixed_status = new BaseStatus();
                BaseStatus scale_status = new BaseStatus();
                artifactData.GetHomePassiveBuffStatus(ref fixed_status, ref scale_status, (UnitData)null, 0, true);
                this.ArtifactStatus.SetValues(fixed_status, scale_status, false);
                if (artifactParam.abil_inames != null && artifactParam.abil_inames.Length > 0)
                {
                    AbilityParam abilityParam = MonoSingleton <GameManager> .Instance.MasterParam.GetAbilityParam(artifactParam.abil_inames[0]);

                    List <AbilityData> learningAbilities = artifactData.LearningAbilities;
                    bool flag = false;
                    if (learningAbilities != null)
                    {
                        for (int index = 0; index < learningAbilities.Count; ++index)
                        {
                            AbilityData abilityData = learningAbilities[index];
                            if (abilityData != null && abilityParam.iname == abilityData.Param.iname)
                            {
                                flag = true;
                                break;
                            }
                        }
                    }
                    DataSource.Bind <AbilityParam>(this.ArtifactAbility, abilityParam);
                    if (flag)
                    {
                        this.ArtifactAbilityAnimation.SetInteger(this.AbilityListItemState, this.AbilityListItem_Unlocked);
                    }
                    else
                    {
                        this.ArtifactAbilityAnimation.SetInteger(this.AbilityListItemState, this.AbilityListItem_Hidden);
                    }
                }
                else
                {
                    this.ArtifactAbilityAnimation.SetInteger(this.AbilityListItemState, this.AbilityListItem_Hidden);
                }
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.m_SetEffectsButton, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.m_SetEffectsButton, (UnityEngine.Object)null) && artifactParam != null)
                {
                    ((Selectable)this.m_SetEffectsButton).set_interactable(MonoSingleton <GameManager> .Instance.MasterParam.ExistSkillAbilityDeriveDataWithArtifact(artifactParam.iname));
                    if (((Selectable)this.m_SetEffectsButton).get_interactable())
                    {
                        ArtifactSetList.SetSelectedArtifactParam(artifactParam);
                    }
                }
            }
            else
            {
                ItemData itemDataByItemId = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(this.mShopitem.iname);

                this.event_shop_item_set_list.Clear();
                if (this.mShopitem.IsSet)
                {
                    for (int index = 0; index < this.mShopitem.children.Length; ++index)
                    {
                        GameObject gameObject = index >= this.event_shop_item_set_list.Count ? (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemTemplate) : ((Component)this.event_shop_item_set_list[index]).get_gameObject();
                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object)gameObject, (UnityEngine.Object)null))
                        {
                            gameObject.SetActive(true);
                            Vector3 localScale = gameObject.get_transform().get_localScale();
                            gameObject.get_transform().SetParent(this.ItemParent.get_transform());
                            gameObject.get_transform().set_localScale(localScale);
                            EventShopSetItemListElement component = (EventShopSetItemListElement)gameObject.GetComponent <EventShopSetItemListElement>();
                            StringBuilder stringBuilder           = GameUtility.GetStringBuilder();
                            if (this.mShopitem.children[index].IsArtifact)
                            {
                                ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(this.mShopitem.children[index].iname);

                                if (artifactParam != null)
                                {
                                    stringBuilder.Append(artifactParam.name);
                                }
                                component.ArtifactParam = artifactParam;
                            }
                            else if (this.mShopitem.children[index].IsConceptCard)
                            {
                                ConceptCardData cardDataForDisplay = ConceptCardData.CreateConceptCardDataForDisplay(this.mShopitem.children[index].iname);
                                if (cardDataForDisplay != null)
                                {
                                    stringBuilder.Append(cardDataForDisplay.Param.name);
                                }
                                component.SetupConceptCard(cardDataForDisplay);
                            }
                            else
                            {
                                ItemData itemData = new ItemData();
                                itemData.Setup(0L, this.mShopitem.children[index].iname, this.mShopitem.children[index].num);
                                if (itemData != null)
                                {
                                    stringBuilder.Append(itemData.Param.name);
                                }
                                component.itemData = itemData;
                            }
                            stringBuilder.Append("×");
                            stringBuilder.Append(this.mShopitem.children[index].num.ToString());
                            component.itemName.set_text(stringBuilder.ToString());
                            component.SetShopItemDesc(this.mShopitem.children[index]);
                            this.event_shop_item_set_list.Add(component);
                        }
                    }
                }
                DataSource.Bind <ItemData>(((Component)this).get_gameObject(), itemDataByItemId);
                DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), MonoSingleton <GameManager> .Instance.GetItemParam(this.mShopitem.iname));
            }
            if (this.mShopitem.IsArtifact)
            {
                this.AmountSliderHolder = this.ArtifactAmountSliderHolder;
                this.AmountSlider       = this.ArtifactAmountSlider;
                this.AmountSliderNum    = this.ArtifactAmountSliderNum;
                this.IncrementButton    = this.ArtifactIncrementButton;
                this.DecrementButton    = this.ArtifactDecrementButton;
            }
            else
            {
                this.AmountSliderHolder = this.ItemAmountSliderHolder;
                this.AmountSlider       = this.ItemAmountSlider;
                this.AmountSliderNum    = this.ItemAmountSliderNum;
                this.IncrementButton    = this.ItemIncrementButton;
                this.DecrementButton    = this.ItemDecrementButton;
            }
            this.mEnabledSlider = false;
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AmountSliderHolder, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AmountSlider, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AmountSliderNum, (UnityEngine.Object)null))
            {
                if (!this.mShopitem.IsNotLimited && this.mShopitem.remaining_num > 1)
                {
                    this.mEnabledSlider = true;
                    GameParameter component = (GameParameter)((Component)this.LimitedItemPriceText).GetComponent <GameParameter>();
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                    {
                        ((Behaviour)component).set_enabled(false);
                    }
                    this.AmountSliderHolder.SetActive(true);
                    int remainingCurrency = ShopData.GetRemainingCurrency((ShopItem)this.mShopitem);
                    int buyPrice          = ShopData.GetBuyPrice((ShopItem)this.mShopitem);
                    int num1 = 1;
                    if (buyPrice > 0)
                    {
                        while (buyPrice * num1 <= remainingCurrency)
                        {
                            ++num1;
                        }
                    }
                    int num2 = Math.Max(Math.Min(num1 - 1, this.mShopitem.remaining_num), 1);
                    this.AmountSlider.set_minValue(1f);
                    this.AmountSlider.set_maxValue((float)num2);
                    this.SetSliderValue(1f);
                    // ISSUE: method pointer
                    ((UnityEvent <float>) this.AmountSlider.get_onValueChanged()).AddListener(new UnityAction <float>((object)this, __methodptr(OnSliderValueChanged)));
                }
                else
                {
                    this.mEnabledSlider = false;
                    this.AmountSliderHolder.SetActive(false);
                }
            }
            DataSource.Bind <EventShopItem>(((Component)this).get_gameObject(), this.mShopitem);
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
Ejemplo n.º 14
0
        private void Refresh()
        {
            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.UnitTemplate, (UnityEngine.Object)null))
            {
                return;
            }
            List <UnitData> units = MonoSingleton <GameManager> .Instance.Player.Units;

            for (int index = 0; index < this.mUnits.Count; ++index)
            {
                this.mUnits[index].get_gameObject().SetActive(false);
            }
            this.mShopitem = MonoSingleton <GameManager> .Instance.Player.GetEventShopData().items.FirstOrDefault <EventShopItem>((Func <EventShopItem, bool>)(item => item.id == GlobalVars.ShopBuyIndex));

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.limited_item, (UnityEngine.Object)null))
            {
                this.limited_item.SetActive(!this.mShopitem.IsNotLimited);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.no_limited_item, (UnityEngine.Object)null))
            {
                this.no_limited_item.SetActive(this.mShopitem.IsNotLimited);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.SoldNum, (UnityEngine.Object)null))
            {
                this.SoldNum.set_text(this.mShopitem.remaining_num.ToString());
            }
            this.mEnabledSlider = false;
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AmountSliderHolder, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AmountSlider, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AmountSliderNum, (UnityEngine.Object)null))
            {
                if (!this.mShopitem.IsNotLimited && this.mShopitem.remaining_num > 1)
                {
                    this.mEnabledSlider = true;
                    GameParameter component = (GameParameter)((Component)this.LimitedItemPriceText).GetComponent <GameParameter>();
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                    {
                        ((Behaviour)component).set_enabled(false);
                    }
                    this.AmountSliderHolder.SetActive(true);
                    int remainingCurrency = ShopData.GetRemainingCurrency((ShopItem)this.mShopitem);
                    int buyPrice          = ShopData.GetBuyPrice((ShopItem)this.mShopitem);
                    int num1 = 1;
                    if (buyPrice > 0)
                    {
                        while (buyPrice * num1 <= remainingCurrency)
                        {
                            ++num1;
                        }
                    }
                    int num2 = Math.Max(Math.Min(num1 - 1, this.mShopitem.remaining_num), 1);
                    this.AmountSlider.set_minValue(1f);
                    this.AmountSlider.set_maxValue((float)num2);
                    this.SetSliderValue(1f);
                    // ISSUE: method pointer
                    ((UnityEvent <float>) this.AmountSlider.get_onValueChanged()).AddListener(new UnityAction <float>((object)this, __methodptr(OnSliderValueChanged)));
                }
                else
                {
                    this.mEnabledSlider = false;
                    this.AmountSliderHolder.SetActive(false);
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.HasJem, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.HasCoin, (UnityEngine.Object)null) && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.HasZenny, (UnityEngine.Object)null))
            {
                switch (this.mShopitem.saleType)
                {
                case ESaleType.Gold:
                    this.HasJem.SetActive(false);
                    this.HasCoin.SetActive(false);
                    this.HasZenny.SetActive(true);
                    break;

                case ESaleType.Coin:
                case ESaleType.Coin_P:
                    this.HasJem.SetActive(true);
                    this.HasCoin.SetActive(false);
                    this.HasZenny.SetActive(false);
                    break;

                default:
                    this.HasJem.SetActive(false);
                    this.HasCoin.SetActive(true);
                    this.HasZenny.SetActive(false);
                    DataSource.Bind <EventCoinData>(this.HasCoin, MonoSingleton <GameManager> .Instance.Player.EventCoinList.Find((Predicate <EventCoinData>)(f => f.iname.Equals(this.mShopitem.cost_iname))));
                    break;
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.EnableEquipUnitWindow, (UnityEngine.Object)null))
            {
                this.EnableEquipUnitWindow.get_gameObject().SetActive(false);
                int index1 = 0;
                for (int index2 = 0; index2 < units.Count; ++index2)
                {
                    UnitData data = units[index2];
                    bool     flag = false;
                    for (int index3 = 0; index3 < data.Jobs.Length; ++index3)
                    {
                        JobData job = data.Jobs[index3];
                        if (job.IsActivated)
                        {
                            int equipSlotByItemId = job.FindEquipSlotByItemID(this.mShopitem.iname);
                            if (equipSlotByItemId != -1 && job.CheckEnableEquipSlot(equipSlotByItemId))
                            {
                                flag = true;
                                break;
                            }
                        }
                    }
                    if (flag)
                    {
                        if (index1 >= this.mUnits.Count)
                        {
                            this.UnitTemplate.SetActive(true);
                            GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.UnitTemplate);
                            gameObject.get_transform().SetParent((Transform)this.UnitLayoutParent, false);
                            this.mUnits.Add(gameObject);
                            this.UnitTemplate.SetActive(false);
                        }
                        GameObject gameObject1 = this.mUnits[index1].get_gameObject();
                        DataSource.Bind <UnitData>(gameObject1, data);
                        gameObject1.SetActive(true);
                        this.EnableEquipUnitWindow.get_gameObject().SetActive(true);
                        GameUtility.SetGameObjectActive(this.LayoutRight, true);
                        ++index1;
                    }
                }
            }
            DataSource.Bind <EventShopItem>(((Component)this).get_gameObject(), this.mShopitem);
            if (this.mShopitem.IsArtifact)
            {
                DataSource.Bind <ArtifactParam>(((Component)this).get_gameObject(), MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(this.mShopitem.iname));
            }
            else if (this.mShopitem.IsConceptCard)
            {
                GameUtility.SetGameObjectActive(this.ItemIconRoot, false);
                GameUtility.SetGameObjectActive(this.ConceptCardIconRoot, true);
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ConceptCardDetail, (UnityEngine.Object)null))
                {
                    ConceptCardData cardDataForDisplay = ConceptCardData.CreateConceptCardDataForDisplay(this.mShopitem.iname);
                    GlobalVars.SelectedConceptCardData.Set(cardDataForDisplay);
                    GameUtility.SetGameObjectActive(this.ConceptCardDetail, true);
                    GameUtility.SetGameObjectActive(this.LayoutRight, true);
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TextDesc, (UnityEngine.Object)null))
                    {
                        this.TextDesc.set_text(cardDataForDisplay.Param.expr);
                    }
                }
            }
            else
            {
                ItemData itemDataByItemId = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(this.mShopitem.iname);

                if (itemDataByItemId != null)
                {
                    DataSource.Bind <ItemData>(((Component)this).get_gameObject(), itemDataByItemId);
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TextDesc, (UnityEngine.Object)null))
                    {
                        this.TextDesc.set_text(itemDataByItemId.Param.Expr);
                    }
                }
                else
                {
                    ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(this.mShopitem.iname);

                    if (itemParam != null && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.TextDesc, (UnityEngine.Object)null))
                    {
                        DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), itemParam);
                        this.TextDesc.set_text(itemParam.Expr);
                    }
                }
            }
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
Ejemplo n.º 15
0
 public bool Deserialize(Json_EventShopBuyResponse response)
 {
     if (response.currencies == null)
     {
         return(false);
     }
     try
     {
         MonoSingleton <GameManager> .Instance.Player.Deserialize(response.currencies);
     }
     catch (Exception ex)
     {
         DebugUtility.LogException(ex);
         return(false);
     }
     if (response.items == null)
     {
         return(false);
     }
     try
     {
         MonoSingleton <GameManager> .Instance.Player.Deserialize(response.items);
     }
     catch (Exception ex)
     {
         DebugUtility.LogException(ex);
         return(false);
     }
     if (response.shopitems == null)
     {
         return(false);
     }
     JSON_EventShopItemListSet[] shopitems = response.shopitems;
     for (int index = 0; index < shopitems.Length; ++index)
     {
         EventShopItem eventShopItem = this.items[index];
         if (eventShopItem == null)
         {
             eventShopItem = new EventShopItem();
             this.items.Add(eventShopItem);
         }
         if (!eventShopItem.Deserialize(shopitems[index]))
         {
             return(false);
         }
     }
     if (response.mail_info == null)
     {
         return(false);
     }
     try
     {
         MonoSingleton <GameManager> .Instance.Player.Deserialize(response.mail_info);
     }
     catch (Exception ex)
     {
         DebugUtility.LogException(ex);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 16
0
 private void ShowAndSaveTimeOutItem(List <EventShopItem> nearbyTimeout)
 {
     GlobalVars.TimeOutShopItems = new List <ShopItem>();
     if (nearbyTimeout.Count <= 0)
     {
         return;
     }
     if (PlayerPrefsUtility.HasKey(PlayerPrefsUtility.WARNED_EVENTSHOP_ITEM_TIMEOUT))
     {
         ShopTimeOutItemInfoArray outItemInfoArray         = (ShopTimeOutItemInfoArray)JsonUtility.FromJson <ShopTimeOutItemInfoArray>(PlayerPrefsUtility.GetString(PlayerPrefsUtility.WARNED_EVENTSHOP_ITEM_TIMEOUT, string.Empty));
         ShopTimeOutItemInfo[]    shopTimeOutItemInfoArray = outItemInfoArray.Infos != null ? ((IEnumerable <ShopTimeOutItemInfo>)outItemInfoArray.Infos).Where <ShopTimeOutItemInfo>((Func <ShopTimeOutItemInfo, bool>)(t => t.ShopId == GlobalVars.EventShopItem.shops.gname)).ToArray <ShopTimeOutItemInfo>() : new ShopTimeOutItemInfo[0];
         List <EventShopItem>     source1 = new List <EventShopItem>();
         List <EventShopItem>     source2 = new List <EventShopItem>();
         bool flag = false;
         using (List <EventShopItem> .Enumerator enumerator = nearbyTimeout.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 EventShopItem       item = enumerator.Current;
                 ShopTimeOutItemInfo shopTimeOutItemInfo = ((IEnumerable <ShopTimeOutItemInfo>)shopTimeOutItemInfoArray).FirstOrDefault <ShopTimeOutItemInfo>((Func <ShopTimeOutItemInfo, bool>)(t => t.ItemId == item.id));
                 if (shopTimeOutItemInfo != null)
                 {
                     if (item.end > shopTimeOutItemInfo.End)
                     {
                         source2.Add(item);
                         shopTimeOutItemInfo.End = item.end;
                         flag = true;
                     }
                 }
                 else
                 {
                     source2.Add(item);
                     source1.Add(item);
                     flag = true;
                 }
             }
         }
         if (flag)
         {
             JSON_ShopListArray.Shops          shop = GlobalVars.EventShopItem.shops;
             IEnumerable <ShopTimeOutItemInfo> shopTimeOutItemInfos = source1.Select <EventShopItem, ShopTimeOutItemInfo>((Func <EventShopItem, ShopTimeOutItemInfo>)(target => new ShopTimeOutItemInfo(shop.gname, target.id, target.end)));
             if (outItemInfoArray.Infos != null)
             {
                 shopTimeOutItemInfos = shopTimeOutItemInfos.Concat <ShopTimeOutItemInfo>((IEnumerable <ShopTimeOutItemInfo>)outItemInfoArray.Infos);
             }
             string json = JsonUtility.ToJson((object)new ShopTimeOutItemInfoArray(shopTimeOutItemInfos.ToArray <ShopTimeOutItemInfo>()));
             PlayerPrefsUtility.SetString(PlayerPrefsUtility.WARNED_EVENTSHOP_ITEM_TIMEOUT, json, false);
         }
         GlobalVars.TimeOutShopItems = source2.Cast <ShopItem>().ToList <ShopItem>();
         if (source2.Count <= 0)
         {
             return;
         }
         FlowNode_GameObject.ActivateOutputLinks((Component)this, 104);
     }
     else
     {
         JSON_ShopListArray.Shops shop = GlobalVars.EventShopItem.shops;
         string json = JsonUtility.ToJson((object)new ShopTimeOutItemInfoArray(nearbyTimeout.Select <EventShopItem, ShopTimeOutItemInfo>((Func <EventShopItem, ShopTimeOutItemInfo>)(item => new ShopTimeOutItemInfo(shop.gname, item.id, item.end))).ToArray <ShopTimeOutItemInfo>()));
         PlayerPrefsUtility.SetString(PlayerPrefsUtility.WARNED_EVENTSHOP_ITEM_TIMEOUT, json, false);
         GlobalVars.TimeOutShopItems = nearbyTimeout.Cast <ShopItem>().ToList <ShopItem>();
         FlowNode_GameObject.ActivateOutputLinks((Component)this, 104);
     }
 }
Ejemplo n.º 17
0
        private void Refresh()
        {
            MonoSingleton <GameManager> .Instance.Player.UpdateEventCoin();

            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null))
            {
                return;
            }
            this.SetPossessionCoinParam();
            EventShopData eventShopData = MonoSingleton <GameManager> .Instance.Player.GetEventShopData();

            DebugUtility.Assert(eventShopData != null, "ショップ情報が存在しない");
            for (int index = 0; index < this.mBuyItems.Count; ++index)
            {
                this.mBuyItems[index].get_gameObject().SetActive(false);
            }
            int                  count         = eventShopData.items.Count;
            DateTime             serverTime    = TimeManager.ServerTime;
            List <EventShopItem> nearbyTimeout = new List <EventShopItem>();

            for (int index = 0; index < count; ++index)
            {
                EventShopItem data1 = eventShopData.items[index];
                if (data1.end != 0L)
                {
                    DateTime dateTime = TimeManager.FromUnixTime(data1.end);
                    if (!(serverTime >= dateTime))
                    {
                        if ((dateTime - serverTime).TotalHours < 1.0)
                        {
                            nearbyTimeout.Add(data1);
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                if (index >= this.mBuyItems.Count)
                {
                    GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemTemplate);
                    gameObject.get_transform().SetParent((Transform)this.ItemLayoutParent, false);
                    this.mBuyItems.Add(gameObject);
                }
                GameObject       mBuyItem            = this.mBuyItems[index];
                EventShopBuyList componentInChildren = (EventShopBuyList)mBuyItem.GetComponentInChildren <EventShopBuyList>();
                componentInChildren.eventShopItem = data1;
                DataSource.Bind <EventShopItem>(mBuyItem, data1);
                if (data1.IsArtifact)
                {
                    ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(data1.iname);

                    DataSource.Bind <ArtifactParam>(mBuyItem, artifactParam);
                }
                else if (data1.IsConceptCard)
                {
                    ConceptCardData cardDataForDisplay = ConceptCardData.CreateConceptCardDataForDisplay(data1.iname);
                    componentInChildren.SetupConceptCard(cardDataForDisplay);
                }
                else if (data1.IsItem || data1.IsSet)
                {
                    ItemData data2 = new ItemData();
                    data2.Setup(0L, data1.iname, data1.num);
                    DataSource.Bind <ItemData>(mBuyItem, data2);
                    DataSource.Bind <ItemParam>(mBuyItem, MonoSingleton <GameManager> .Instance.GetItemParam(data1.iname));
                }
                else
                {
                    DebugUtility.LogError(string.Format("不明な商品タイプが設定されています (shopitem.iname({0}) => {1})", (object)data1.iname, (object)data1.ShopItemType));
                }
                ListItemEvents component1 = (ListItemEvents)mBuyItem.GetComponent <ListItemEvents>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component1, (UnityEngine.Object)null))
                {
                    component1.OnSelect = new ListItemEvents.ListItemEvent(this.OnSelect);
                }
                Button component2 = (Button)mBuyItem.GetComponent <Button>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component2, (UnityEngine.Object)null))
                {
                    ((Selectable)component2).set_interactable(!data1.is_soldout);
                }
                mBuyItem.SetActive(true);
            }
            this.ShowAndSaveTimeOutItem(nearbyTimeout);
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
Ejemplo n.º 18
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 1)
            {
                return;
            }
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            ((Behaviour)this).set_enabled(false);
            EventShopData eventShopData = player.GetEventShopData();

            if (eventShopData == null)
            {
                this.ActivateOutputLinks(104);
            }
            else
            {
                EventShopItem eventShopItem = eventShopData.items[GlobalVars.ShopBuyIndex];
                if (eventShopItem.is_soldout)
                {
                    this.ActivateOutputLinks(105);
                }
                else
                {
                    ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(eventShopItem.iname);

                    if (!eventShopItem.IsSet && !player.CheckItemCapacity(itemParam, eventShopItem.num))
                    {
                        this.ActivateOutputLinks(106);
                    }
                    else
                    {
                        switch (eventShopItem.saleType)
                        {
                        case ESaleType.Gold:
                            int num1 = !eventShopItem.isSetSaleValue ? (int)itemParam.buy * eventShopItem.num : eventShopItem.saleValue;
                            if (player.Gold < num1)
                            {
                                this.ActivateOutputLinks(107);
                                return;
                            }
                            break;

                        case ESaleType.Coin:
                            int num2 = !eventShopItem.isSetSaleValue ? (int)itemParam.coin * eventShopItem.num : eventShopItem.saleValue;
                            if (player.Coin < num2)
                            {
                                this.ActivateOutputLinks(108);
                                return;
                            }
                            break;

                        case ESaleType.TourCoin:
                            int num3 = !eventShopItem.isSetSaleValue ? (int)itemParam.tour_coin * eventShopItem.num : eventShopItem.saleValue;
                            if (player.TourCoin < num3)
                            {
                                this.ActivateOutputLinks(109);
                                return;
                            }
                            break;

                        case ESaleType.ArenaCoin:
                            int num4 = !eventShopItem.isSetSaleValue ? (int)itemParam.arena_coin * eventShopItem.num : eventShopItem.saleValue;
                            if (player.ArenaCoin < num4)
                            {
                                this.ActivateOutputLinks(110);
                                return;
                            }
                            break;

                        case ESaleType.PiecePoint:
                            int num5 = !eventShopItem.isSetSaleValue ? (int)itemParam.piece_point * eventShopItem.num : eventShopItem.saleValue;
                            if (player.PiecePoint < num5)
                            {
                                this.ActivateOutputLinks(111);
                                return;
                            }
                            break;

                        case ESaleType.MultiCoin:
                            int num6 = !eventShopItem.isSetSaleValue ? (int)itemParam.multi_coin * eventShopItem.num : eventShopItem.saleValue;
                            if (player.MultiCoin < num6)
                            {
                                this.ActivateOutputLinks(112);
                                return;
                            }
                            break;

                        case ESaleType.EventCoin:
                            if (eventShopItem.isSetSaleValue)
                            {
                                int saleValue = eventShopItem.saleValue;
                                if (player.EventCoinNum(eventShopItem.cost_iname) < saleValue)
                                {
                                    this.ActivateOutputLinks(114);
                                    return;
                                }
                                break;
                            }
                            break;

                        case ESaleType.Coin_P:
                            int num7 = !eventShopItem.isSetSaleValue ? (int)itemParam.coin * eventShopItem.num : eventShopItem.saleValue;
                            if (player.PaidCoin < num7)
                            {
                                this.ActivateOutputLinks(113);
                                return;
                            }
                            break;
                        }
                        if (Network.Mode == Network.EConnectMode.Offline)
                        {
                            player.DEBUG_BUY_ITEM(GlobalVars.ShopType, GlobalVars.ShopBuyIndex);
                            this.Success();
                        }
                        else
                        {
                            this.mShopType = GlobalVars.ShopType;
                            this.ExecRequest((WebAPI) new ReqItemEventShopBuypaid(GlobalVars.EventShopItem.shops.gname, GlobalVars.ShopBuyIndex, 1, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                            ((Behaviour)this).set_enabled(true);
                        }
                    }
                }
            }
        }
        private void Refresh()
        {
            EventShopItem data = MonoSingleton <GameManager> .Instance.Player.GetEventShopData().items[GlobalVars.ShopBuyIndex];

            this.ItemWindow.SetActive(!data.IsArtifact);
            this.ArtifactWindow.SetActive(data.IsArtifact);
            if (Object.op_Inequality((Object)this.AmountNum, (Object)null))
            {
                this.AmountNum.set_text(data.remaining_num.ToString());
            }
            if (Object.op_Inequality((Object)this.Sold, (Object)null))
            {
                this.Sold.SetActive(!data.IsNotLimited);
            }
            if (data.IsArtifact)
            {
                ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(data.iname);

                DataSource.Bind <ArtifactParam>(((Component)this).get_gameObject(), artifactParam);
                this.mArtifactParam = artifactParam;
                ArtifactData artifactData = new ArtifactData();
                artifactData.Deserialize(new Json_Artifact()
                {
                    iname = artifactParam.iname,
                    rare  = artifactParam.rareini
                });
                BaseStatus fixed_status = new BaseStatus();
                BaseStatus scale_status = new BaseStatus();
                artifactData.GetHomePassiveBuffStatus(ref fixed_status, ref scale_status, (UnitData)null, 0, true);
                this.ArtifactStatus.SetValues(fixed_status, scale_status);
                if (artifactParam.abil_inames != null && artifactParam.abil_inames.Length > 0)
                {
                    AbilityParam abilityParam = MonoSingleton <GameManager> .Instance.MasterParam.GetAbilityParam(artifactParam.abil_inames[0]);

                    List <AbilityData> learningAbilities = artifactData.LearningAbilities;
                    bool flag = false;
                    if (learningAbilities != null)
                    {
                        for (int index = 0; index < learningAbilities.Count; ++index)
                        {
                            AbilityData abilityData = learningAbilities[index];
                            if (abilityData != null && abilityParam.iname == abilityData.Param.iname)
                            {
                                flag = true;
                                break;
                            }
                        }
                    }
                    DataSource.Bind <AbilityParam>(this.ArtifactAbility, abilityParam);
                    if (flag)
                    {
                        this.ArtifactAbilityAnimation.SetInteger(this.AbilityListItemState, this.AbilityListItem_Unlocked);
                    }
                    else
                    {
                        this.ArtifactAbilityAnimation.SetInteger(this.AbilityListItemState, this.AbilityListItem_Hidden);
                    }
                }
                else
                {
                    this.ArtifactAbilityAnimation.SetInteger(this.AbilityListItemState, this.AbilityListItem_Hidden);
                }
            }
            else
            {
                ItemData itemDataByItemId = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID(data.iname);

                this.event_shop_item_set_list.Clear();
                if (data.IsSet)
                {
                    for (int index = 0; index < data.children.Length; ++index)
                    {
                        GameObject gameObject = index >= this.event_shop_item_set_list.Count ? (GameObject)Object.Instantiate <GameObject>((M0)this.ItemTemplate) : ((Component)this.event_shop_item_set_list[index]).get_gameObject();
                        if (Object.op_Inequality((Object)gameObject, (Object)null))
                        {
                            gameObject.SetActive(true);
                            Vector3 localScale = gameObject.get_transform().get_localScale();
                            gameObject.get_transform().SetParent(this.ItemParent.get_transform());
                            gameObject.get_transform().set_localScale(localScale);
                            EventShopSetItemListElement component = (EventShopSetItemListElement)gameObject.GetComponent <EventShopSetItemListElement>();
                            StringBuilder stringBuilder           = GameUtility.GetStringBuilder();
                            if (data.children[index].IsArtifact)
                            {
                                ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(data.children[index].iname);

                                if (artifactParam != null)
                                {
                                    stringBuilder.Append(artifactParam.name);
                                }
                                component.ArtifactParam = artifactParam;
                            }
                            else
                            {
                                ItemData itemData = new ItemData();
                                itemData.Setup(0L, data.children[index].iname, data.children[index].num);
                                if (itemData != null)
                                {
                                    stringBuilder.Append(itemData.Param.name);
                                }
                                component.itemData = itemData;
                            }
                            stringBuilder.Append("×");
                            stringBuilder.Append(data.children[index].num.ToString());
                            component.itemName.set_text(stringBuilder.ToString());
                            component.SetShopItemDesc(data.children[index]);
                            this.event_shop_item_set_list.Add(component);
                        }
                    }
                }
                DataSource.Bind <ItemData>(((Component)this).get_gameObject(), itemDataByItemId);
                DataSource.Bind <ItemParam>(((Component)this).get_gameObject(), MonoSingleton <GameManager> .Instance.GetItemParam(data.iname));
            }
            DataSource.Bind <EventShopItem>(((Component)this).get_gameObject(), data);
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
Ejemplo n.º 20
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 1)
            {
                return;
            }
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            ((Behaviour)this).set_enabled(false);
            EventShopData eventShopData = player.GetEventShopData();

            if (eventShopData == null)
            {
                this.ActivateOutputLinks(104);
            }
            else
            {
                EventShopItem shopitem = eventShopData.items[GlobalVars.ShopBuyIndex];
                if (shopitem.is_soldout)
                {
                    this.ActivateOutputLinks(105);
                }
                else
                {
                    int buy = 0;
                    if (shopitem.IsArtifact)
                    {
                        buy = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(shopitem.iname).GetBuyNum(shopitem.saleType);
                    }
                    else
                    {
                        ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(shopitem.iname);

                        if (!shopitem.IsSet && !player.CheckItemCapacity(itemParam, shopitem.num))
                        {
                            this.ActivateOutputLinks(106);
                            return;
                        }
                    }
                    switch (shopitem.saleType)
                    {
                    case ESaleType.Gold:
                        if (!this.CheckCanBuy(shopitem, buy, player.Gold, 107))
                        {
                            return;
                        }
                        break;

                    case ESaleType.Coin:
                        if (!this.CheckCanBuy(shopitem, buy, player.Coin, 108))
                        {
                            return;
                        }
                        break;

                    case ESaleType.TourCoin:
                        if (!this.CheckCanBuy(shopitem, buy, player.TourCoin, 109))
                        {
                            return;
                        }
                        break;

                    case ESaleType.ArenaCoin:
                        if (!this.CheckCanBuy(shopitem, buy, player.ArenaCoin, 110))
                        {
                            return;
                        }
                        break;

                    case ESaleType.PiecePoint:
                        if (!this.CheckCanBuy(shopitem, buy, player.PiecePoint, 111))
                        {
                            return;
                        }
                        break;

                    case ESaleType.MultiCoin:
                        if (!this.CheckCanBuy(shopitem, buy, player.MultiCoin, 112))
                        {
                            return;
                        }
                        break;

                    case ESaleType.EventCoin:
                        if (shopitem.isSetSaleValue)
                        {
                            int saleValue = shopitem.saleValue;
                            if (player.EventCoinNum(shopitem.cost_iname) < saleValue)
                            {
                                this.ActivateOutputLinks(114);
                                return;
                            }
                            break;
                        }
                        break;

                    case ESaleType.Coin_P:
                        if (!this.CheckCanBuy(shopitem, buy, player.PaidCoin, 113))
                        {
                            return;
                        }
                        break;
                    }
                    if (Network.Mode == Network.EConnectMode.Offline)
                    {
                        player.DEBUG_BUY_ITEM(GlobalVars.ShopType, GlobalVars.ShopBuyIndex);
                        this.Success();
                    }
                    else
                    {
                        this.mShopType = GlobalVars.ShopType;
                        this.ExecRequest((WebAPI) new ReqItemEventShopBuypaid(GlobalVars.EventShopItem.shops.gname, GlobalVars.ShopBuyIndex, 1, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                        ((Behaviour)this).set_enabled(true);
                    }
                }
            }
        }