Ejemplo n.º 1
0
        private GenericSlot CreateSlotObject(PartySlotData slotData, GenericSlot template, Transform parent)
        {
            GenericSlot component = (GenericSlot)((GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)((Component)template).get_gameObject())).GetComponent <GenericSlot>();

            ((Component)component).get_transform().SetParent(parent, false);
            ((Component)component).get_gameObject().SetActive(true);
            component.SetSlotData <PartySlotData>(slotData);
            return(component);
        }
Ejemplo n.º 2
0
        private void CreateSlots()
        {
            this.DestroyPartySlotObjects();
            List <PartySlotData> mainSlotData    = new List <PartySlotData>();
            List <PartySlotData> subSlotData     = new List <PartySlotData>();
            PartySlotData        supportSlotData = (PartySlotData)null;

            PartyUtility.CreatePartySlotData(this.mCurrentQuest, out mainSlotData, out subSlotData, out supportSlotData);
            List <GenericSlot> genericSlotList = new List <GenericSlot>();

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.MainMemberHolder, (UnityEngine.Object)null) && mainSlotData.Count > 0)
            {
                using (List <PartySlotData> .Enumerator enumerator = mainSlotData.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        PartySlotData current     = enumerator.Current;
                        GenericSlot   genericSlot = current.Type == PartySlotType.Npc || current.Type == PartySlotType.NpcHero ? this.CreateSlotObject(current, this.NpcSlotTemplate, this.MainMemberHolder) : this.CreateSlotObject(current, this.UnitSlotTemplate, this.MainMemberHolder);
                        genericSlotList.Add(genericSlot);
                    }
                }
                if (supportSlotData != null)
                {
                    this.FriendSlot = this.CreateSlotObject(supportSlotData, this.UnitSlotTemplate, this.MainMemberHolder);
                }
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.SubMemberHolder, (UnityEngine.Object)null) && subSlotData.Count > 0)
            {
                using (List <PartySlotData> .Enumerator enumerator = subSlotData.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        PartySlotData current     = enumerator.Current;
                        GenericSlot   genericSlot = current.Type == PartySlotType.Npc || current.Type == PartySlotType.NpcHero ? this.CreateSlotObject(current, this.NpcSlotTemplate, this.SubMemberHolder) : this.CreateSlotObject(current, this.UnitSlotTemplate, this.SubMemberHolder);
                        genericSlotList.Add(genericSlot);
                    }
                }
            }
            this.mSlotData.AddRange((IEnumerable <PartySlotData>)mainSlotData);
            this.mSlotData.AddRange((IEnumerable <PartySlotData>)subSlotData);
            this.UnitSlots = genericSlotList.ToArray();
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.FriendSlot, (UnityEngine.Object)null) && this.mCurrentQuest != null && this.mCurrentQuest.type == QuestTypes.Tower)
            {
                TowerFloorParam towerFloor = MonoSingleton <GameManager> .Instance.FindTowerFloor(this.mCurrentQuest.iname);

                if (towerFloor != null)
                {
                    ((Component)this.FriendSlot).get_gameObject().SetActive(towerFloor.can_help);
                    ((Component)this.SupportSkill).get_gameObject().SetActive(towerFloor.can_help);
                }
            }
            this.mGuestUnits = new List <UnitData>();
            PartyUtility.MergePartySlotWithPartyUnits(this.mCurrentQuest, this.mSlotData, this.mCurrentParty, this.mGuestUnits, this.mIsUserOwnUnits);
            this.ReflectionUnitSlot();
        }
Ejemplo n.º 3
0
        private void RefreshSlots(GenericSlot slot, ConceptCardIcon icon, ConceptCardData card, bool is_locked, bool enable)
        {
            if (Object.op_Equality((Object)slot, (Object)null) || Object.op_Equality((Object)icon, (Object)null))
            {
                return;
            }
            slot.SetLocked(is_locked);
            slot.SetSlotData <ConceptCardData>(card);
            icon.Setup(card);
            SRPG_Button componentInChildren = (SRPG_Button)((Component)slot).get_gameObject().GetComponentInChildren <SRPG_Button>();

            if (!Object.op_Inequality((Object)componentInChildren, (Object)null))
            {
                return;
            }
            ((Behaviour)componentInChildren).set_enabled(enable);
            ((UnityEventBase)componentInChildren.get_onClick()).RemoveAllListeners();
            // ISSUE: method pointer
            ((UnityEvent)componentInChildren.get_onClick()).AddListener(new UnityAction((object)this, __methodptr(OnEquipCardSlot)));
        }
Ejemplo n.º 4
0
        private void RefreshSlots(GenericSlot slot, ArtifactData[] list, int index, int job_rank, bool is_locked = false, bool enable = true)
        {
            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)slot, (UnityEngine.Object)null))
            {
                return;
            }
            ArtifactData data = (ArtifactData)null;

            if (job_rank > 0 && list.Length > index)
            {
                data = list[index];
            }
            slot.SetLocked(!is_locked);
            slot.SetSlotData <ArtifactData>(data);
            SRPG_Button componentInChildren = (SRPG_Button)((Component)slot).get_gameObject().GetComponentInChildren <SRPG_Button>();

            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)componentInChildren, (UnityEngine.Object)null))
            {
                return;
            }
            ((Behaviour)componentInChildren).set_enabled(enable);
        }
Ejemplo n.º 5
0
        private void OnClick(GenericSlot slot, bool interactable)
        {
            if (!interactable)
            {
                return;
            }
            GameObject gameObject1 = AssetManager.Load <GameObject>(ArtifactSlots.ArtiSelectPath);

            if (UnityEngine.Object.op_Equality((UnityEngine.Object)gameObject1, (UnityEngine.Object)null))
            {
                return;
            }
            GameObject gameObject2 = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)gameObject1);

            if (UnityEngine.Object.op_Equality((UnityEngine.Object)gameObject2, (UnityEngine.Object)null))
            {
                return;
            }
            ArtifactWindow component = (ArtifactWindow)gameObject2.GetComponent <ArtifactWindow>();

            if (UnityEngine.Object.op_Equality((UnityEngine.Object)component, (UnityEngine.Object)null))
            {
                return;
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)slot, (UnityEngine.Object)null))
            {
                if (UnityEngine.Object.op_Equality((UnityEngine.Object)slot, (UnityEngine.Object) this.ArtifactSlot))
                {
                    component.SelectArtifactSlot = ArtifactTypes.Arms;
                }
                else if (UnityEngine.Object.op_Equality((UnityEngine.Object)slot, (UnityEngine.Object) this.ArtifactSlot2))
                {
                    component.SelectArtifactSlot = ArtifactTypes.Armor;
                }
                else if (UnityEngine.Object.op_Equality((UnityEngine.Object)slot, (UnityEngine.Object) this.ArtifactSlot3))
                {
                    component.SelectArtifactSlot = ArtifactTypes.Accessory;
                }
            }
            component.OnEquip = new ArtifactWindow.EquipEvent(this.OnSelect);
            component.SetOwnerUnit(this.mCurrentUnit, this.mCurrentUnit.JobIndex);
            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object)component.ArtifactList, (UnityEngine.Object)null))
            {
                return;
            }
            if (component.ArtifactList.TestOwner != this.mCurrentUnit)
            {
                component.ArtifactList.TestOwner = this.mCurrentUnit;
            }
            ArtifactData dataOfClass = DataSource.FindDataOfClass <ArtifactData>(((Component)slot).get_gameObject(), (ArtifactData)null);
            long         iid         = 0;

            if (this.mCurrentUnit.CurrentJob.Artifacts != null)
            {
                long num = (long)(dataOfClass == null ? (OLong)0L : dataOfClass.UniqueID);
                for (int index = 0; index < this.mCurrentUnit.CurrentJob.Artifacts.Length; ++index)
                {
                    if (this.mCurrentUnit.CurrentJob.Artifacts[index] != 0L & this.mCurrentUnit.CurrentJob.Artifacts[index] == num)
                    {
                        iid = this.mCurrentUnit.CurrentJob.Artifacts[index];
                        break;
                    }
                }
            }
            ArtifactData artifactData = (ArtifactData)null;

            if (iid != 0L)
            {
                artifactData = MonoSingleton <GameManager> .Instance.Player.FindArtifactByUniqueID(iid);
            }
            if (artifactData != null)
            {
                component.ArtifactList.SetSelection((object[])new ArtifactData[1]
                {
                    artifactData
                }, true, true);
            }
            else
            {
                component.ArtifactList.SetSelection((object[])new ArtifactData[0], true, true);
            }
            ArtifactTypes type = dataOfClass == null ? ArtifactTypes.None : dataOfClass.ArtifactParam.type;

            component.ArtifactList.FiltersPriority = this.SetEquipArtifactFilters(dataOfClass, type);
        }