Exemplo n.º 1
0
 private void Start()
 {
     this.mCurrentArtifactParam = DataSource.FindDataOfClass <ArtifactParam>(((Component)this).get_gameObject(), (ArtifactParam)null);
     this.mCurrentArtifactData  = DataSource.FindDataOfClass <ArtifactData>(((Component)this).get_gameObject(), (ArtifactData)null);
     this.mCurrentUnit          = DataSource.FindDataOfClass <UnitData>(((Component)this).get_gameObject(), (UnitData)null);
     this.mCurrentEquipSlot     = DataSource.FindDataOfClass <ArtifactTypes>(((Component)this).get_gameObject(), ArtifactTypes.None);
     this.mCurrentJob           = DataSource.FindDataOfClass <JobData>(((Component)this).get_gameObject(), (JobData)null);
     if (this.mCurrentArtifactParam == null)
     {
         this.mCurrentArtifactParam           = ArtifactDetailWindow.s_ArtifactParam;
         ArtifactDetailWindow.s_ArtifactParam = (ArtifactParam)null;
         if (this.mCurrentArtifactParam != null)
         {
             DataSource.Bind <ArtifactParam>(((Component)this).get_gameObject(), this.mCurrentArtifactParam);
         }
     }
     if (this.mCurrentArtifactParam == null && this.mCurrentArtifactData != null)
     {
         this.mCurrentArtifactParam = this.mCurrentArtifactData.ArtifactParam;
     }
     if (this.mCurrentArtifactParam == null)
     {
         return;
     }
     ArtifactSetList.SetSelectedArtifactParam(this.mCurrentArtifactParam);
     this.RefreshView();
 }
Exemplo n.º 2
0
        private void Refresh()
        {
            ArtifactData artifactData = new ArtifactData();

            artifactData.Deserialize(new Json_Artifact()
            {
                iname = GlobalVars.ArtifactListItem.param.iname,
                rare  = GlobalVars.ArtifactListItem.param.rareini
            });
            this.UnlockArtifact = artifactData;
            DataSource.Bind <ArtifactData>(((Component)this).get_gameObject(), this.UnlockArtifact);
            DataSource.Bind <ArtifactParam>(((Component)this).get_gameObject(), this.UnlockArtifact.ArtifactParam);
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.AbilityListItem, (UnityEngine.Object)null))
            {
                MasterParam        masterParam       = MonoSingleton <GameManager> .Instance.MasterParam;
                GameObject         abilityListItem   = this.AbilityListItem;
                CanvasGroup        component         = (CanvasGroup)abilityListItem.GetComponent <CanvasGroup>();
                bool               flag              = false;
                ArtifactParam      artifactParam     = artifactData.ArtifactParam;
                List <AbilityData> learningAbilities = artifactData.LearningAbilities;
                if (artifactParam.abil_inames != null)
                {
                    AbilityParam data1      = (AbilityParam)null;
                    string       abil_iname = (string)null;
                    for (int index = 0; index < artifactParam.abil_inames.Length; ++index)
                    {
                        if (!string.IsNullOrEmpty(artifactParam.abil_inames[index]) && artifactParam.abil_shows[index] != 0)
                        {
                            abil_iname = artifactParam.abil_inames[index];
                            data1      = masterParam.GetAbilityParam(artifactParam.abil_inames[index]);
                            if (data1 != null)
                            {
                                break;
                            }
                        }
                    }
                    if (data1 == null)
                    {
                        component.set_alpha(this.ability_hidden_alpha);
                        DataSource.Bind <AbilityParam>(this.AbilityListItem, (AbilityParam)null);
                        DataSource.Bind <AbilityData>(this.AbilityListItem, (AbilityData)null);
                        return;
                    }
                    DataSource.Bind <AbilityParam>(this.AbilityListItem, data1);
                    DataSource.Bind <AbilityData>(abilityListItem, (AbilityData)null);
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null) && learningAbilities != null && learningAbilities != null)
                    {
                        AbilityData data2 = learningAbilities.Find((Predicate <AbilityData>)(x => x.Param.iname == abil_iname));
                        if (data2 != null)
                        {
                            DataSource.Bind <AbilityData>(abilityListItem, data2);
                            flag = true;
                        }
                    }
                }
                if (flag)
                {
                    component.set_alpha(this.ability_unlock_alpha);
                }
                else
                {
                    component.set_alpha(this.ability_hidden_alpha);
                }
            }
            BaseStatus fixed_status = new BaseStatus();
            BaseStatus scale_status = new BaseStatus();

            this.UnlockArtifact.GetHomePassiveBuffStatus(ref fixed_status, ref scale_status, (UnitData)null, 0, true);
            this.ArtifactStatus.SetValues(fixed_status, scale_status, false);
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.m_SetEffectsButton, (UnityEngine.Object)null) && this.UnlockArtifact.ArtifactParam != null)
            {
                ((Selectable)this.m_SetEffectsButton).set_interactable(MonoSingleton <GameManager> .Instance.MasterParam.ExistSkillAbilityDeriveDataWithArtifact(this.UnlockArtifact.ArtifactParam.iname));
                if (((Selectable)this.m_SetEffectsButton).get_interactable())
                {
                    ArtifactSetList.SetSelectedArtifactParam(this.UnlockArtifact.ArtifactParam);
                }
            }
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
        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());
        }