Esempio n. 1
0
        private void OnSelect(ArtifactData artifact, ArtifactTypes type = ArtifactTypes.None)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            ArtifactSlots.\u003COnSelect\u003Ec__AnonStorey2FC selectCAnonStorey2Fc = new ArtifactSlots.\u003COnSelect\u003Ec__AnonStorey2FC();
            if (artifact != null)
            {
                PlayerData player = MonoSingleton <GameManager> .GetInstanceDirect().Player;

                UnitData unit = (UnitData)null;
                JobData  job  = (JobData)null;
                if (player.FindOwner(artifact, out unit, out job))
                {
                    for (int slot = 0; slot < job.Artifacts.Length; ++slot)
                    {
                        if (job.Artifacts[slot] == (long)artifact.UniqueID)
                        {
                            job.SetEquipArtifact(slot, (ArtifactData)null);
                            break;
                        }
                    }
                }
            }
            // ISSUE: reference to a compiler-generated field
            selectCAnonStorey2Fc.view_artifact_datas = new List <ArtifactData>()
            {
                DataSource.FindDataOfClass <ArtifactData>(((Component)this.ArtifactSlot).get_gameObject(), (ArtifactData)null),
                DataSource.FindDataOfClass <ArtifactData>(((Component)this.ArtifactSlot2).get_gameObject(), (ArtifactData)null),
                DataSource.FindDataOfClass <ArtifactData>(((Component)this.ArtifactSlot3).get_gameObject(), (ArtifactData)null)
            }.ToArray();
            int artifactSlotIndex = JobData.GetArtifactSlotIndex(type);
            List <ArtifactData> artifactDataList1 = new List <ArtifactData>((IEnumerable <ArtifactData>) this.mCurrentUnit.CurrentJob.ArtifactDatas);

            // ISSUE: reference to a compiler-generated field
            if (artifactDataList1.Count != selectCAnonStorey2Fc.view_artifact_datas.Length)
            {
                return;
            }
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            ArtifactSlots.\u003COnSelect\u003Ec__AnonStorey2FD selectCAnonStorey2Fd = new ArtifactSlots.\u003COnSelect\u003Ec__AnonStorey2FD();
            // ISSUE: reference to a compiler-generated field
            selectCAnonStorey2Fd.\u003C\u003Ef__ref\u0024764 = selectCAnonStorey2Fc;
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            for (selectCAnonStorey2Fd.i = 0; selectCAnonStorey2Fd.i < selectCAnonStorey2Fc.view_artifact_datas.Length; ++selectCAnonStorey2Fd.i)
            {
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated method
                if (selectCAnonStorey2Fc.view_artifact_datas[selectCAnonStorey2Fd.i] != null && artifactDataList1.Find(new Predicate <ArtifactData>(selectCAnonStorey2Fd.\u003C\u003Em__30A)) == null)
                {
                    return;
                }
            }
            // ISSUE: reference to a compiler-generated field
            selectCAnonStorey2Fc.view_artifact_datas[artifactSlotIndex] = artifact;
            List <ArtifactData> artifactDataList2 = new List <ArtifactData>();

            for (int slot = 0; slot < this.mCurrentUnit.CurrentJob.ArtifactDatas.Length; ++slot)
            {
                this.mCurrentUnit.CurrentJob.SetEquipArtifact(slot, (ArtifactData)null);
            }
            // ISSUE: reference to a compiler-generated field
            for (int index = 0; index < selectCAnonStorey2Fc.view_artifact_datas.Length; ++index)
            {
                // ISSUE: reference to a compiler-generated field
                if (selectCAnonStorey2Fc.view_artifact_datas[index] != null)
                {
                    // ISSUE: reference to a compiler-generated field
                    if (selectCAnonStorey2Fc.view_artifact_datas[index].ArtifactParam.type == ArtifactTypes.Accessory)
                    {
                        // ISSUE: reference to a compiler-generated field
                        artifactDataList2.Add(selectCAnonStorey2Fc.view_artifact_datas[index]);
                    }
                    else
                    {
                        // ISSUE: reference to a compiler-generated field
                        // ISSUE: reference to a compiler-generated field
                        this.mCurrentUnit.CurrentJob.SetEquipArtifact(JobData.GetArtifactSlotIndex(selectCAnonStorey2Fc.view_artifact_datas[index].ArtifactParam.type), selectCAnonStorey2Fc.view_artifact_datas[index]);
                    }
                }
            }
            for (int index = 0; index < artifactDataList2.Count; ++index)
            {
                for (int slot = 0; slot < this.mCurrentUnit.CurrentJob.ArtifactDatas.Length; ++slot)
                {
                    if (this.mCurrentUnit.CurrentJob.ArtifactDatas[slot] == null)
                    {
                        this.mCurrentUnit.CurrentJob.SetEquipArtifact(slot, artifactDataList2[index]);
                        break;
                    }
                }
            }
            this.mCurrentUnit.UpdateArtifact(this.mCurrentUnit.JobIndex, true);
            Network.RequestAPI((WebAPI) new ReqArtifactSet(this.mCurrentUnit.UniqueID, this.mCurrentUnit.CurrentJob.UniqueID, this.mCurrentUnit.CurrentJob.Artifacts, new Network.ResponseCallback(this.OnArtifactSetResult)), false);
        }
Esempio n. 2
0
        private void OnSelect(ArtifactData artifact, ArtifactTypes type = ArtifactTypes.None)
        {
            if (artifact != null)
            {
                PlayerData player = MonoSingleton <GameManager> .GetInstanceDirect().Player;

                UnitData unit = (UnitData)null;
                JobData  job1 = (JobData)null;
                if (player.FindOwner(artifact, out unit, out job1))
                {
                    for (int slot = 0; slot < job1.Artifacts.Length; ++slot)
                    {
                        if (job1.Artifacts[slot] == (long)artifact.UniqueID)
                        {
                            job1.SetEquipArtifact(slot, (ArtifactData)null);
                            break;
                        }
                    }
                    if (this.mCurrentUnit.UniqueID == unit.UniqueID)
                    {
                        JobData jobData = (JobData)null;
                        foreach (JobData job2 in this.mCurrentUnit.Jobs)
                        {
                            if (job2.UniqueID == job1.UniqueID)
                            {
                                jobData = job2;
                            }
                        }
                        if (jobData != null)
                        {
                            for (int slot = 0; slot < jobData.Artifacts.Length; ++slot)
                            {
                                if (jobData.Artifacts[slot] == (long)artifact.UniqueID)
                                {
                                    jobData.SetEquipArtifact(slot, (ArtifactData)null);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            ArtifactData[] view_artifact_datas = new List <ArtifactData>()
            {
                DataSource.FindDataOfClass <ArtifactData>(((Component)this.ArtifactSlot).get_gameObject(), (ArtifactData)null),
                DataSource.FindDataOfClass <ArtifactData>(((Component)this.ArtifactSlot2).get_gameObject(), (ArtifactData)null),
                DataSource.FindDataOfClass <ArtifactData>(((Component)this.ArtifactSlot3).get_gameObject(), (ArtifactData)null)
            }.ToArray();
            int artifactSlotIndex = JobData.GetArtifactSlotIndex(type);
            List <ArtifactData> artifactDataList1 = new List <ArtifactData>((IEnumerable <ArtifactData>) this.mCurrentUnit.CurrentJob.ArtifactDatas);

            if (artifactDataList1.Count != view_artifact_datas.Length)
            {
                return;
            }
            for (int i = 0; i < view_artifact_datas.Length; ++i)
            {
                if (view_artifact_datas[i] != null && artifactDataList1.Find((Predicate <ArtifactData>)(x =>
                {
                    if (x != null)
                    {
                        return((long)x.UniqueID == (long)view_artifact_datas[i].UniqueID);
                    }
                    return(false);
                })) == null)
                {
                    return;
                }
            }
            view_artifact_datas[artifactSlotIndex] = artifact;
            List <ArtifactData> artifactDataList2 = new List <ArtifactData>();

            for (int slot = 0; slot < this.mCurrentUnit.CurrentJob.ArtifactDatas.Length; ++slot)
            {
                this.mCurrentUnit.CurrentJob.SetEquipArtifact(slot, (ArtifactData)null);
            }
            for (int index = 0; index < view_artifact_datas.Length; ++index)
            {
                if (view_artifact_datas[index] != null)
                {
                    if (view_artifact_datas[index].ArtifactParam.type == ArtifactTypes.Accessory)
                    {
                        artifactDataList2.Add(view_artifact_datas[index]);
                    }
                    else
                    {
                        this.mCurrentUnit.CurrentJob.SetEquipArtifact(JobData.GetArtifactSlotIndex(view_artifact_datas[index].ArtifactParam.type), view_artifact_datas[index]);
                    }
                }
            }
            for (int index = 0; index < artifactDataList2.Count; ++index)
            {
                for (int slot = 0; slot < this.mCurrentUnit.CurrentJob.ArtifactDatas.Length; ++slot)
                {
                    if (this.mCurrentUnit.CurrentJob.ArtifactDatas[slot] == null)
                    {
                        this.mCurrentUnit.CurrentJob.SetEquipArtifact(slot, artifactDataList2[index]);
                        break;
                    }
                }
            }
            this.mCurrentUnit.UpdateArtifact(this.mCurrentUnit.JobIndex, true, true);
            Network.RequestAPI((WebAPI) new ReqArtifactSet(this.mCurrentUnit.UniqueID, this.mCurrentUnit.CurrentJob.UniqueID, this.mCurrentUnit.CurrentJob.Artifacts, new Network.ResponseCallback(this.OnArtifactSetResult)), false);
        }