コード例 #1
0
        private void RegisterHoldEvent(GameObject obj)
        {
            UnitAbilityListItemEvents componentInChildren = (UnitAbilityListItemEvents)obj.GetComponentInChildren <UnitAbilityListItemEvents>();

            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)componentInChildren, (UnityEngine.Object)null))
            {
                return;
            }
            UnitAbilityListItemEvents abilityListItemEvents1 = componentInChildren;

            abilityListItemEvents1.OnOpenDetail = abilityListItemEvents1.OnOpenDetail - new ListItemEvents.ListItemEvent(this.OpenAbilityDetail);
            UnitAbilityListItemEvents abilityListItemEvents2 = componentInChildren;

            abilityListItemEvents2.OnOpenDetail = abilityListItemEvents2.OnOpenDetail + new ListItemEvents.ListItemEvent(this.OpenAbilityDetail);
            UnitAbilityListItemEvents abilityListItemEvents3 = componentInChildren;

            abilityListItemEvents3.OnSelect = abilityListItemEvents3.OnSelect - new ListItemEvents.ListItemEvent(this.OnSelect);
            UnitAbilityListItemEvents abilityListItemEvents4 = componentInChildren;

            abilityListItemEvents4.OnSelect       = abilityListItemEvents4.OnSelect + new ListItemEvents.ListItemEvent(this.OnSelect);
            componentInChildren.OnRankUp         -= new ListItemEvents.ListItemEvent(this.OnRankUp);
            componentInChildren.OnRankUp         += new ListItemEvents.ListItemEvent(this.OnRankUp);
            componentInChildren.OnRankUpBtnPress -= new ListItemEvents.ListItemEvent(this.OnRankUpBtnPress);
            componentInChildren.OnRankUpBtnPress += new ListItemEvents.ListItemEvent(this.OnRankUpBtnPress);
            componentInChildren.OnRankUpBtnUp    -= new ListItemEvents.ListItemEvent(this.OnRankUpBtnUp);
            componentInChildren.OnRankUpBtnUp    += new ListItemEvents.ListItemEvent(this.OnRankUpBtnUp);
        }
コード例 #2
0
        public void DisplaySlotType(EAbilitySlot slotType, bool hideEquipped = false, bool showDerivedAbility = false)
        {
            this.mLastDisplayMode = UnitAbilityList.RefreshTypes.DisplayAll;
            this.mLastDisplaySlot = slotType;
            for (int index = 0; index < this.mItems.Count; ++index)
            {
                UnityEngine.Object.Destroy((UnityEngine.Object)((Component)this.mItems[index]).get_gameObject());
            }
            this.mItems.Clear();
            if (this.Unit == null)
            {
                this.Unit = DataSource.FindDataOfClass <UnitData>(((Component)this).get_gameObject(), (UnitData)null);
            }
            if (this.Unit == null)
            {
                return;
            }
            List <AbilityData> abilityDataList = !showDerivedAbility?this.Unit.GetAllLearnedAbilities(false) : this.Unit.GetAllLearnedAbilities(true);

            Transform transform = ((Component)this).get_transform();

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Item_Normal, (UnityEngine.Object)null))
            {
                for (int index1 = 0; index1 < abilityDataList.Count; ++index1)
                {
                    AbilityData abilityData = abilityDataList[index1];
                    if ((slotType == ~EAbilitySlot.Action || slotType == abilityData.SlotType) && (this.ShowFixedAbilities || !abilityData.Param.is_fixed) && (this.ShowMasterAbilities || !(this.Unit.UnitParam.ability == abilityData.AbilityID) && !this.Unit.IsQuestClearUnlocked(abilityData.Param.iname, QuestClearUnlockUnitDataParam.EUnlockTypes.MasterAbility)) && (this.Unit.MapEffectAbility != abilityData && (this.ShowMasterAbilities || !this.Unit.TobiraMasterAbilitys.Contains(abilityData))) && (!abilityData.IsDerivedAbility || (this.ShowFixedAbilities || !abilityData.DeriveBaseAbility.Param.is_fixed) && (this.ShowMasterAbilities || !(this.Unit.UnitParam.ability == abilityData.DeriveBaseAbility.AbilityID) && !this.Unit.IsQuestClearUnlocked(abilityData.DeriveBaseAbility.Param.iname, QuestClearUnlockUnitDataParam.EUnlockTypes.MasterAbility)) && (this.Unit.MapEffectAbility != abilityData.DeriveBaseAbility && (this.ShowMasterAbilities || !this.Unit.TobiraMasterAbilitys.Contains(abilityData.DeriveBaseAbility)))))
                    {
                        if (hideEquipped)
                        {
                            bool flag = false;
                            for (int index2 = 0; index2 < this.Unit.CurrentJob.AbilitySlots.Length; ++index2)
                            {
                                if (this.Unit.CurrentJob.AbilitySlots[index2] == abilityData.UniqueID)
                                {
                                    flag = true;
                                    break;
                                }
                            }
                            if (flag)
                            {
                                continue;
                            }
                        }
                        UnitAbilityListItemEvents abilityListItemEvents = (UnitAbilityListItemEvents)UnityEngine.Object.Instantiate <UnitAbilityListItemEvents>((M0)this.Item_Normal);
                        this.mItems.Add(abilityListItemEvents);
                        ((Component)abilityListItemEvents).get_transform().SetParent(transform, false);
                        ((Component)abilityListItemEvents).get_gameObject().SetActive(true);
                        AbilityDeriveList component = (AbilityDeriveList)((Component)abilityListItemEvents).get_gameObject().GetComponent <AbilityDeriveList>();
                        if (UnityEngine.Object.op_Equality((UnityEngine.Object)component, (UnityEngine.Object)null))
                        {
                            DataSource.Bind <AbilityData>(((Component)abilityListItemEvents).get_gameObject(), abilityData);
                            abilityListItemEvents.OnSelect         = new ListItemEvents.ListItemEvent(this._OnAbilitySelect);
                            abilityListItemEvents.OnRankUp         = new ListItemEvents.ListItemEvent(this._OnAbilityRankUp);
                            abilityListItemEvents.OnOpenDetail     = new ListItemEvents.ListItemEvent(this._OnAbilityDetail);
                            abilityListItemEvents.OnRankUpBtnPress = new ListItemEvents.ListItemEvent(this._OnRankUpBtnPress);
                            abilityListItemEvents.OnRankUpBtnUp    = new ListItemEvents.ListItemEvent(this._OnRankUpBtnUp);
                            JobData job;
                            int     rank;
                            if (this.GetAbilitySource(abilityData.AbilityID, out job, out rank))
                            {
                                DataSource.Bind <AbilityUnlockInfo>(((Component)abilityListItemEvents).get_gameObject(), new AbilityUnlockInfo()
                                {
                                    JobName = job.Name,
                                    Rank    = rank
                                });
                            }
                        }
                        else if (abilityData.IsDerivedAbility)
                        {
                            component.SetupWithAbilityData(abilityData.DeriveBaseAbility, new List <AbilityData>()
                            {
                                abilityData
                            });
                            // ISSUE: method pointer
                            component.AddDetailOpenEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnAbilityDetail)));
                            // ISSUE: method pointer
                            component.AddSelectEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnAbilitySelect)));
                            // ISSUE: method pointer
                            component.AddRankUpEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnAbilityRankUp)));
                            // ISSUE: method pointer
                            component.AddRankUpBtnPressEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnRankUpBtnPress)));
                            // ISSUE: method pointer
                            component.AddRankUpBtnUpEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnRankUpBtnUp)));
                        }
                        else
                        {
                            component.SetupWithAbilityData(abilityData, (List <AbilityData>)null);
                            // ISSUE: method pointer
                            component.AddDetailOpenEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnAbilityDetail)));
                            // ISSUE: method pointer
                            component.AddSelectEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnAbilitySelect)));
                            // ISSUE: method pointer
                            component.AddRankUpEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnAbilityRankUp)));
                            // ISSUE: method pointer
                            component.AddRankUpBtnPressEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnRankUpBtnPress)));
                            // ISSUE: method pointer
                            component.AddRankUpBtnUpEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnRankUpBtnUp)));
                        }
                    }
                }
            }
            if (slotType != ~EAbilitySlot.Action && UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Item_SlotMismatch, (UnityEngine.Object)null))
            {
                for (int index = 0; index < abilityDataList.Count; ++index)
                {
                    AbilityData data = abilityDataList[index];
                    if (slotType != data.SlotType && (this.ShowFixedAbilities || !data.Param.is_fixed) && (this.ShowMasterAbilities || !(this.Unit.UnitParam.ability == data.AbilityID) && !this.Unit.IsQuestClearUnlocked(data.Param.iname, QuestClearUnlockUnitDataParam.EUnlockTypes.MasterAbility)) && (this.Unit.MapEffectAbility != data && (this.ShowMasterAbilities || !this.Unit.TobiraMasterAbilitys.Contains(data))))
                    {
                        UnitAbilityListItemEvents abilityListItemEvents = (UnitAbilityListItemEvents)UnityEngine.Object.Instantiate <UnitAbilityListItemEvents>((M0)this.Item_SlotMismatch);
                        this.mItems.Add(abilityListItemEvents);
                        DataSource.Bind <AbilityData>(((Component)abilityListItemEvents).get_gameObject(), data);
                        abilityListItemEvents.OnRankUp         = new ListItemEvents.ListItemEvent(this._OnAbilityRankUp);
                        abilityListItemEvents.OnOpenDetail     = new ListItemEvents.ListItemEvent(this._OnAbilityDetail);
                        abilityListItemEvents.OnRankUpBtnPress = new ListItemEvents.ListItemEvent(this._OnRankUpBtnPress);
                        abilityListItemEvents.OnRankUpBtnUp    = new ListItemEvents.ListItemEvent(this._OnRankUpBtnUp);
                        ((Component)abilityListItemEvents).get_transform().SetParent(transform, false);
                        ((Component)abilityListItemEvents).get_gameObject().SetActive(true);
                        JobData job;
                        int     rank;
                        if (this.GetAbilitySource(data.AbilityID, out job, out rank))
                        {
                            DataSource.Bind <AbilityUnlockInfo>(((Component)abilityListItemEvents).get_gameObject(), new AbilityUnlockInfo()
                            {
                                JobName = job.Name,
                                Rank    = rank
                            });
                        }
                    }
                }
            }
            List <string> overwrittenAbilitys = TobiraUtility.GetOverwrittenAbilitys(this.Unit);

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Item_Locked, (UnityEngine.Object)null))
            {
                GameManager instanceDirect = MonoSingleton <GameManager> .GetInstanceDirect();

                for (int index1 = 0; index1 < this.Unit.Jobs.Length; ++index1)
                {
                    if (this.ShowLockedJobAbilities || this.Unit.Jobs[index1].Rank > 0)
                    {
                        RarityParam rarityParam = instanceDirect.GetRarityParam((int)this.Unit.UnitParam.raremax);
                        for (int lv = this.Unit.Jobs[index1].Rank + 1; lv <= JobParam.MAX_JOB_RANK; ++lv)
                        {
                            OString[] learningAbilitys = this.Unit.Jobs[index1].Param.GetLearningAbilitys(lv);
                            if (learningAbilitys != null && (int)rarityParam.UnitJobLvCap >= lv)
                            {
                                for (int index2 = 0; index2 < learningAbilitys.Length; ++index2)
                                {
                                    string key = (string)learningAbilitys[index2];
                                    if (!string.IsNullOrEmpty(key))
                                    {
                                        AbilityParam abilityParam = instanceDirect.GetAbilityParam(key);
                                        if ((this.ShowFixedAbilities || !abilityParam.is_fixed) && !overwrittenAbilitys.Contains(abilityParam.iname))
                                        {
                                            UnitAbilityListItemEvents abilityListItemEvents = (UnitAbilityListItemEvents)UnityEngine.Object.Instantiate <UnitAbilityListItemEvents>((M0)this.Item_Locked);
                                            this.mItems.Add(abilityListItemEvents);
                                            DataSource.Bind <AbilityParam>(((Component)abilityListItemEvents).get_gameObject(), abilityParam);
                                            abilityListItemEvents.OnSelect         = new ListItemEvents.ListItemEvent(this._OnAbilitySelect);
                                            abilityListItemEvents.OnRankUp         = new ListItemEvents.ListItemEvent(this._OnAbilityRankUp);
                                            abilityListItemEvents.OnOpenDetail     = new ListItemEvents.ListItemEvent(this._OnAbilityDetail);
                                            abilityListItemEvents.OnRankUpBtnPress = new ListItemEvents.ListItemEvent(this._OnRankUpBtnPress);
                                            abilityListItemEvents.OnRankUpBtnUp    = new ListItemEvents.ListItemEvent(this._OnRankUpBtnUp);
                                            ((Component)abilityListItemEvents).get_transform().SetParent(transform, false);
                                            ((Component)abilityListItemEvents).get_gameObject().SetActive(true);
                                            DataSource.Bind <AbilityUnlockInfo>(((Component)abilityListItemEvents).get_gameObject(), new AbilityUnlockInfo()
                                            {
                                                JobName = this.Unit.Jobs[index1].Name,
                                                Rank    = lv
                                            });
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (this.ShowMasterAbilities && !string.IsNullOrEmpty(this.Unit.UnitParam.ability) && (this.Unit.LearnAbilitys.Find((Predicate <AbilityData>)(p => p.AbilityID == this.Unit.UnitParam.ability)) == null && !overwrittenAbilitys.Exists((Predicate <string>)(abil => abil == this.Unit.UnitParam.ability))))
                {
                    AbilityParam abilityParam = instanceDirect.GetAbilityParam(this.Unit.UnitParam.ability);
                    UnitAbilityListItemEvents abilityListItemEvents = (UnitAbilityListItemEvents)UnityEngine.Object.Instantiate <UnitAbilityListItemEvents>((M0)this.Item_Locked);
                    this.mItems.Add(abilityListItemEvents);
                    DataSource.Bind <AbilityParam>(((Component)abilityListItemEvents).get_gameObject(), abilityParam);
                    abilityListItemEvents.OnSelect         = new ListItemEvents.ListItemEvent(this._OnAbilitySelect);
                    abilityListItemEvents.OnRankUp         = new ListItemEvents.ListItemEvent(this._OnAbilityRankUp);
                    abilityListItemEvents.OnOpenDetail     = new ListItemEvents.ListItemEvent(this._OnAbilityDetail);
                    abilityListItemEvents.OnRankUpBtnPress = new ListItemEvents.ListItemEvent(this._OnRankUpBtnPress);
                    abilityListItemEvents.OnRankUpBtnUp    = new ListItemEvents.ListItemEvent(this._OnRankUpBtnUp);
                    ((Component)abilityListItemEvents).get_transform().SetParent(transform, false);
                    ((Component)abilityListItemEvents).get_gameObject().SetActive(true);
                }
            }
            this.ResetScrollPos();
        }
コード例 #3
0
        public void DisplaySlotType(EAbilitySlot slotType, bool hideEquipped = false)
        {
            this.mLastDisplayMode = UnitAbilityList.RefreshTypes.DisplayAll;
            this.mLastDisplaySlot = slotType;
            for (int index = 0; index < this.mItems.Count; ++index)
            {
                Object.Destroy((Object)((Component)this.mItems[index]).get_gameObject());
            }
            this.mItems.Clear();
            if (this.Unit == null)
            {
                this.Unit = DataSource.FindDataOfClass <UnitData>(((Component)this).get_gameObject(), (UnitData)null);
            }
            if (this.Unit == null)
            {
                return;
            }
            List <AbilityData> learnedAbilities = this.Unit.GetAllLearnedAbilities();
            Transform          transform1       = ((Component)this).get_transform();
            bool        flag1    = false;
            GameManager instance = MonoSingleton <GameManager> .Instance;

            if ((instance.Player.TutorialFlags & 1L) == 0L && instance.GetNextTutorialStep() == "ShowAbilityTab")
            {
                instance.CompleteTutorialStep();
                if (instance.GetNextTutorialStep() == "ShowAbilityLvUp")
                {
                    flag1 = true;
                }
            }
            if (Object.op_Inequality((Object)this.Item_Normal, (Object)null))
            {
                for (int index1 = 0; index1 < learnedAbilities.Count; ++index1)
                {
                    AbilityData data = learnedAbilities[index1];
                    if ((slotType == ~EAbilitySlot.Action || slotType == data.SlotType) && (this.ShowFixedAbilities || !data.Param.is_fixed) && (this.ShowMasterAbilities || !((string)this.Unit.UnitParam.ability == data.AbilityID) && !this.Unit.IsQuestClearUnlocked(data.Param.iname, QuestClearUnlockUnitDataParam.EUnlockTypes.MasterAbility)))
                    {
                        if (hideEquipped)
                        {
                            bool flag2 = false;
                            for (int index2 = 0; index2 < this.Unit.CurrentJob.AbilitySlots.Length; ++index2)
                            {
                                if (this.Unit.CurrentJob.AbilitySlots[index2] == data.UniqueID)
                                {
                                    flag2 = true;
                                    break;
                                }
                            }
                            if (flag2)
                            {
                                continue;
                            }
                        }
                        UnitAbilityListItemEvents abilityListItemEvents = (UnitAbilityListItemEvents)Object.Instantiate <UnitAbilityListItemEvents>((M0)this.Item_Normal);
                        this.mItems.Add(abilityListItemEvents);
                        DataSource.Bind <AbilityData>(((Component)abilityListItemEvents).get_gameObject(), data);
                        abilityListItemEvents.OnSelect         = new ListItemEvents.ListItemEvent(this._OnAbilitySelect);
                        abilityListItemEvents.OnRankUp         = new ListItemEvents.ListItemEvent(this._OnAbilityRankUp);
                        abilityListItemEvents.OnOpenDetail     = new ListItemEvents.ListItemEvent(this._OnAbilityDetail);
                        abilityListItemEvents.OnRankUpBtnPress = new ListItemEvents.ListItemEvent(this._OnRankUpBtnPress);
                        abilityListItemEvents.OnRankUpBtnUp    = new ListItemEvents.ListItemEvent(this._OnRankUpBtnUp);
                        ((Component)abilityListItemEvents).get_transform().SetParent(transform1, false);
                        ((Component)abilityListItemEvents).get_gameObject().SetActive(true);
                        JobData job;
                        int     rank;
                        if (this.GetAbilitySource(data.AbilityID, out job, out rank))
                        {
                            DataSource.Bind <AbilityUnlockInfo>(((Component)abilityListItemEvents).get_gameObject(), new AbilityUnlockInfo()
                            {
                                JobName = job.Name,
                                Rank    = rank
                            });
                        }
                        if (flag1 && index1 == 0)
                        {
                            SGHighlightObject.Instance().highlightedObject = ((Component)abilityListItemEvents.RankupButton).get_gameObject();
                            SGHighlightObject.Instance().Highlight(string.Empty, "sg_tut_1.023", (SGHighlightObject.OnActivateCallback)null, EventDialogBubble.Anchors.TopLeft, true, false, false);
                        }
                    }
                }
            }
            if (slotType != ~EAbilitySlot.Action && Object.op_Inequality((Object)this.Item_SlotMismatch, (Object)null))
            {
                for (int index = 0; index < learnedAbilities.Count; ++index)
                {
                    AbilityData data = learnedAbilities[index];
                    if (slotType != data.SlotType && (this.ShowFixedAbilities || !data.Param.is_fixed) && (this.ShowMasterAbilities || !((string)this.Unit.UnitParam.ability == data.AbilityID) && !this.Unit.IsQuestClearUnlocked(data.Param.iname, QuestClearUnlockUnitDataParam.EUnlockTypes.MasterAbility)))
                    {
                        UnitAbilityListItemEvents abilityListItemEvents = (UnitAbilityListItemEvents)Object.Instantiate <UnitAbilityListItemEvents>((M0)this.Item_SlotMismatch);
                        this.mItems.Add(abilityListItemEvents);
                        DataSource.Bind <AbilityData>(((Component)abilityListItemEvents).get_gameObject(), data);
                        abilityListItemEvents.OnRankUp         = new ListItemEvents.ListItemEvent(this._OnAbilityRankUp);
                        abilityListItemEvents.OnOpenDetail     = new ListItemEvents.ListItemEvent(this._OnAbilityDetail);
                        abilityListItemEvents.OnRankUpBtnPress = new ListItemEvents.ListItemEvent(this._OnRankUpBtnPress);
                        abilityListItemEvents.OnRankUpBtnUp    = new ListItemEvents.ListItemEvent(this._OnRankUpBtnUp);
                        ((Component)abilityListItemEvents).get_transform().SetParent(transform1, false);
                        ((Component)abilityListItemEvents).get_gameObject().SetActive(true);
                        JobData job;
                        int     rank;
                        if (this.GetAbilitySource(data.AbilityID, out job, out rank))
                        {
                            DataSource.Bind <AbilityUnlockInfo>(((Component)abilityListItemEvents).get_gameObject(), new AbilityUnlockInfo()
                            {
                                JobName = job.Name,
                                Rank    = rank
                            });
                        }
                    }
                }
            }
            if (Object.op_Inequality((Object)this.Item_Locked, (Object)null))
            {
                GameManager instanceDirect = MonoSingleton <GameManager> .GetInstanceDirect();

                for (int index1 = 0; index1 < this.Unit.Jobs.Length; ++index1)
                {
                    if (this.ShowLockedJobAbilities || this.Unit.Jobs[index1].Rank > 0)
                    {
                        RarityParam rarityParam = instanceDirect.GetRarityParam((int)this.Unit.UnitParam.raremax);
                        for (int lv = this.Unit.Jobs[index1].Rank + 1; lv < JobParam.MAX_JOB_RANK; ++lv)
                        {
                            OString[] learningAbilitys = this.Unit.Jobs[index1].Param.GetLearningAbilitys(lv);
                            if (learningAbilitys != null && (int)rarityParam.UnitJobLvCap >= lv)
                            {
                                for (int index2 = 0; index2 < learningAbilitys.Length; ++index2)
                                {
                                    string key = (string)learningAbilitys[index2];
                                    if (!string.IsNullOrEmpty(key))
                                    {
                                        AbilityParam abilityParam = instanceDirect.GetAbilityParam(key);
                                        if (this.ShowFixedAbilities || !abilityParam.is_fixed)
                                        {
                                            UnitAbilityListItemEvents abilityListItemEvents = (UnitAbilityListItemEvents)Object.Instantiate <UnitAbilityListItemEvents>((M0)this.Item_Locked);
                                            this.mItems.Add(abilityListItemEvents);
                                            DataSource.Bind <AbilityParam>(((Component)abilityListItemEvents).get_gameObject(), abilityParam);
                                            abilityListItemEvents.OnSelect         = new ListItemEvents.ListItemEvent(this._OnAbilitySelect);
                                            abilityListItemEvents.OnRankUp         = new ListItemEvents.ListItemEvent(this._OnAbilityRankUp);
                                            abilityListItemEvents.OnOpenDetail     = new ListItemEvents.ListItemEvent(this._OnAbilityDetail);
                                            abilityListItemEvents.OnRankUpBtnPress = new ListItemEvents.ListItemEvent(this._OnRankUpBtnPress);
                                            abilityListItemEvents.OnRankUpBtnUp    = new ListItemEvents.ListItemEvent(this._OnRankUpBtnUp);
                                            ((Component)abilityListItemEvents).get_transform().SetParent(transform1, false);
                                            ((Component)abilityListItemEvents).get_gameObject().SetActive(true);
                                            DataSource.Bind <AbilityUnlockInfo>(((Component)abilityListItemEvents).get_gameObject(), new AbilityUnlockInfo()
                                            {
                                                JobName = this.Unit.Jobs[index1].Name,
                                                Rank    = lv
                                            });
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (this.ShowMasterAbilities && !string.IsNullOrEmpty((string)this.Unit.UnitParam.ability) && this.Unit.LearnAbilitys.Find((Predicate <AbilityData>)(p => p.AbilityID == (string)this.Unit.UnitParam.ability)) == null)
                {
                    AbilityParam abilityParam = instanceDirect.GetAbilityParam((string)this.Unit.UnitParam.ability);
                    UnitAbilityListItemEvents abilityListItemEvents = (UnitAbilityListItemEvents)Object.Instantiate <UnitAbilityListItemEvents>((M0)this.Item_Locked);
                    this.mItems.Add(abilityListItemEvents);
                    DataSource.Bind <AbilityParam>(((Component)abilityListItemEvents).get_gameObject(), abilityParam);
                    abilityListItemEvents.OnSelect         = new ListItemEvents.ListItemEvent(this._OnAbilitySelect);
                    abilityListItemEvents.OnRankUp         = new ListItemEvents.ListItemEvent(this._OnAbilityRankUp);
                    abilityListItemEvents.OnOpenDetail     = new ListItemEvents.ListItemEvent(this._OnAbilityDetail);
                    abilityListItemEvents.OnRankUpBtnPress = new ListItemEvents.ListItemEvent(this._OnRankUpBtnPress);
                    abilityListItemEvents.OnRankUpBtnUp    = new ListItemEvents.ListItemEvent(this._OnRankUpBtnUp);
                    ((Component)abilityListItemEvents).get_transform().SetParent(transform1, false);
                    ((Component)abilityListItemEvents).get_gameObject().SetActive(true);
                }
            }
            if (Object.op_Inequality((Object)this.ScrollParent, (Object)null))
            {
                this.mDecelerationRate = this.ScrollParent.get_decelerationRate();
                this.ScrollParent.set_decelerationRate(0.0f);
            }
            RectTransform transform2 = ((Component)this).get_transform() as RectTransform;

            transform2.set_anchoredPosition(new Vector2((float)transform2.get_anchoredPosition().x, 0.0f));
            this.StartCoroutine(this.RefreshScrollRect());
        }
コード例 #4
0
        public void DisplaySlots()
        {
            this.mLastDisplayMode = UnitAbilityList.RefreshTypes.DisplaySlots;
            for (int index = 0; index < this.mItems.Count; ++index)
            {
                UnityEngine.Object.Destroy((UnityEngine.Object)((Component)this.mItems[index]).get_gameObject());
            }
            this.mItems.Clear();
            UnitData dataOfClass = DataSource.FindDataOfClass <UnitData>(((Component)this).get_gameObject(), (UnitData)null);

            if (dataOfClass != null)
            {
                this.Unit = dataOfClass;
            }
            if (this.Unit == null)
            {
                return;
            }
            GlobalVars.SelectedUnitUniqueID.Set(this.Unit.UniqueID);
            List <AbilityData> abilityDataList = new List <AbilityData>((IEnumerable <AbilityData>) this.Unit.CreateEquipAbilitys());

            if (this.Unit.MasterAbility != null)
            {
                abilityDataList.Add(this.Unit.MasterAbility);
            }
            Transform transform = ((Component)this).get_transform();

            for (int index = 0; index < abilityDataList.Count; ++index)
            {
                AbilityData derivedAbility = abilityDataList[index];
                bool        flag           = false;
                if (derivedAbility != null && derivedAbility.Param != null && derivedAbility.IsDeriveBaseAbility)
                {
                    derivedAbility = derivedAbility.DerivedAbility;
                }
                UnitAbilityListItemEvents abilityListItemEvents1;
                if (derivedAbility != null && derivedAbility.Param != null)
                {
                    flag = derivedAbility.Param.is_fixed;
                    UnitAbilityListItemEvents abilityListItemEvents2 = this.Unit.MasterAbility == null || this.Unit.MasterAbility != derivedAbility ? (!flag ? this.Item_Normal : this.Item_Fixed) : this.Item_Fixed;
                    if (derivedAbility.IsDerivedAbility && derivedAbility.DeriveBaseAbility == this.Unit.MasterAbility)
                    {
                        abilityListItemEvents2 = this.Item_Fixed;
                    }
                    if (UnityEngine.Object.op_Equality((UnityEngine.Object)abilityListItemEvents2, (UnityEngine.Object)null))
                    {
                        abilityListItemEvents2 = this.Item_Normal;
                    }
                    abilityListItemEvents1 = (UnitAbilityListItemEvents)UnityEngine.Object.Instantiate <UnitAbilityListItemEvents>((M0)abilityListItemEvents2);
                    AbilityDeriveList component = (AbilityDeriveList)((Component)abilityListItemEvents1).get_gameObject().GetComponent <AbilityDeriveList>();
                    if (UnityEngine.Object.op_Equality((UnityEngine.Object)component, (UnityEngine.Object)null))
                    {
                        DataSource.Bind <AbilityData>(((Component)abilityListItemEvents1).get_gameObject(), derivedAbility);
                        string key = this.Unit.SearchAbilityReplacementSkill(derivedAbility.Param.iname);
                        if (!string.IsNullOrEmpty(key))
                        {
                            DataSource.Bind <AbilityParam>(((Component)abilityListItemEvents1).get_gameObject(), MonoSingleton <GameManager> .Instance.GetAbilityParam(key));
                        }
                        abilityListItemEvents1.IsEnableSkillChange = true;
                        JobData job;
                        int     rank;
                        if (this.GetAbilitySource(derivedAbility.AbilityID, out job, out rank))
                        {
                            DataSource.Bind <AbilityUnlockInfo>(((Component)abilityListItemEvents1).get_gameObject(), new AbilityUnlockInfo()
                            {
                                JobName = job.Name,
                                Rank    = rank
                            });
                        }
                        abilityListItemEvents1.OnOpenDetail     = new ListItemEvents.ListItemEvent(this._OnAbilityDetail);
                        abilityListItemEvents1.OnRankUp         = new ListItemEvents.ListItemEvent(this._OnAbilityRankUp);
                        abilityListItemEvents1.OnRankUpBtnPress = new ListItemEvents.ListItemEvent(this._OnRankUpBtnPress);
                        abilityListItemEvents1.OnRankUpBtnUp    = new ListItemEvents.ListItemEvent(this._OnRankUpBtnUp);
                    }
                    else if (derivedAbility.IsDerivedAbility)
                    {
                        component.SetupWithAbilityParam(derivedAbility.Param, new List <AbilityDeriveParam>()
                        {
                            derivedAbility.DeriveParam
                        });
                        // ISSUE: method pointer
                        component.AddDetailOpenEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnAbilityDetail)));
                    }
                    else
                    {
                        component.SetupWithAbilityParam(derivedAbility.Param, (List <AbilityDeriveParam>)null);
                        // ISSUE: method pointer
                        component.AddDetailOpenEventListener(new UnityAction <GameObject>((object)this, __methodptr(_OnAbilityDetail)));
                    }
                }
                else
                {
                    AbilityParam data = new AbilityParam();
                    data.slot = JobData.ABILITY_SLOT_TYPES[index];
                    abilityListItemEvents1 = (UnitAbilityListItemEvents)UnityEngine.Object.Instantiate <UnitAbilityListItemEvents>((M0)this.Item_Empty);
                    DataSource.Bind <AbilityParam>(((Component)abilityListItemEvents1).get_gameObject(), data);
                }
                ((Component)abilityListItemEvents1).get_transform().SetParent(transform, false);
                ((Component)abilityListItemEvents1).get_gameObject().SetActive(true);
                GameParameter.UpdateAll(((Component)abilityListItemEvents1).get_gameObject());
                if (!flag)
                {
                    abilityListItemEvents1.OnSelect = new ListItemEvents.ListItemEvent(this._OnSlotSelect);
                }
                this.mItems.Add(abilityListItemEvents1);
            }
        }
コード例 #5
0
        public void DisplaySlots()
        {
            this.mLastDisplayMode = UnitAbilityList.RefreshTypes.DisplaySlots;
            for (int index = 0; index < this.mItems.Count; ++index)
            {
                Object.Destroy((Object)((Component)this.mItems[index]).get_gameObject());
            }
            this.mItems.Clear();
            if (this.Unit == null)
            {
                this.Unit = DataSource.FindDataOfClass <UnitData>(((Component)this).get_gameObject(), (UnitData)null);
            }
            if (this.Unit == null)
            {
                return;
            }
            AbilityData[] equipAbilitys = this.Unit.CreateEquipAbilitys();
            Transform     transform     = ((Component)this).get_transform();

            for (int index = 0; index < this.Unit.CurrentJob.AbilitySlots.Length; ++index)
            {
                AbilityData data1 = equipAbilitys[index];
                bool        flag  = false;
                UnitAbilityListItemEvents abilityListItemEvents1;
                if (data1 != null && data1.Param != null)
                {
                    flag = data1.Param.is_fixed;
                    UnitAbilityListItemEvents abilityListItemEvents2 = !flag ? this.Item_Normal : this.Item_Fixed;
                    if (Object.op_Equality((Object)abilityListItemEvents2, (Object)null))
                    {
                        abilityListItemEvents2 = this.Item_Normal;
                    }
                    abilityListItemEvents1 = (UnitAbilityListItemEvents)Object.Instantiate <UnitAbilityListItemEvents>((M0)abilityListItemEvents2);
                    DataSource.Bind <AbilityData>(((Component)abilityListItemEvents1).get_gameObject(), data1);
                    string key = this.Unit.SearchAbilityReplacementSkill(data1.Param.iname);
                    if (!string.IsNullOrEmpty(key))
                    {
                        DataSource.Bind <AbilityParam>(((Component)abilityListItemEvents1).get_gameObject(), MonoSingleton <GameManager> .Instance.GetAbilityParam(key));
                    }
                    abilityListItemEvents1.IsEnableSkillChange = true;
                    JobData job;
                    int     rank;
                    if (this.GetAbilitySource(data1.AbilityID, out job, out rank))
                    {
                        DataSource.Bind <AbilityUnlockInfo>(((Component)abilityListItemEvents1).get_gameObject(), new AbilityUnlockInfo()
                        {
                            JobName = job.Name,
                            Rank    = rank
                        });
                    }
                    abilityListItemEvents1.OnOpenDetail     = new ListItemEvents.ListItemEvent(this._OnAbilityDetail);
                    abilityListItemEvents1.OnRankUp         = new ListItemEvents.ListItemEvent(this._OnAbilityRankUp);
                    abilityListItemEvents1.OnRankUpBtnPress = new ListItemEvents.ListItemEvent(this._OnRankUpBtnPress);
                    abilityListItemEvents1.OnRankUpBtnUp    = new ListItemEvents.ListItemEvent(this._OnRankUpBtnUp);
                }
                else
                {
                    AbilityParam data2 = new AbilityParam();
                    data2.slot             = JobData.ABILITY_SLOT_TYPES[index];
                    abilityListItemEvents1 = (UnitAbilityListItemEvents)Object.Instantiate <UnitAbilityListItemEvents>((M0)this.Item_Empty);
                    DataSource.Bind <AbilityParam>(((Component)abilityListItemEvents1).get_gameObject(), data2);
                }
                ((Component)abilityListItemEvents1).get_transform().SetParent(transform, false);
                ((Component)abilityListItemEvents1).get_gameObject().SetActive(true);
                if (!flag)
                {
                    abilityListItemEvents1.OnSelect = new ListItemEvents.ListItemEvent(this._OnSlotSelect);
                }
                this.mItems.Add(abilityListItemEvents1);
            }
        }