Esempio n. 1
0
        public void LateUpdate()
        {
            if (!modelDirty || base.IsBusy)
            {
                return;
            }
            modelDirty = false;
            startWork();
            cleanup();
            partViews.Clear();
            List <KeyValuePair <TypedAssetContentKey <Texture2D>, Action <Texture2D> > > list = new List <KeyValuePair <TypedAssetContentKey <Texture2D>, Action <Texture2D> > >();
            List <KeyValuePair <TypedAssetContentKey <EquipmentViewDefinition>, Action <EquipmentViewDefinition> > > list2 = new List <KeyValuePair <TypedAssetContentKey <EquipmentViewDefinition>, Action <EquipmentViewDefinition> > >();

            foreach (AvatarModel.Part item in Model.IterateParts())
            {
                ViewPart viewPart = new ViewPart();
                if (item.Equipment != null)
                {
                    EquipmentModelDefinition.Part eqPart = item.Equipment.Parts[item.Index];
                    list2.Add(AvatarView.CreatePartContent(Model, viewPart, item, eqPart));
                    if (item.Decals != null)
                    {
                        AvatarView.CreateDecalContent(viewPart, item, list);
                    }
                }
                else
                {
                    BodyViewDefinition bodyViewDefinition = Model.Definition.Slots[item.Index].LOD[Model.LodLevel];
                    bodyViewDefinition.ApplyToViewPart(viewPart);
                }
                partViews.Add(viewPart);
            }
            partsRequest  = outfitService.Load(list2, outfitService.EquipmentPartCache);
            decalsRequest = outfitService.Load(list, outfitService.DecalCache);
        }
Esempio n. 2
0
 public void LateUpdate()
 {
     if (this.modelDirty && !base.IsBusy)
     {
         this.modelDirty = false;
         base.startWork();
         this.cleanup();
         this.partViews.Clear();
         List <KeyValuePair <TypedAssetContentKey <Texture2D>, Action <Texture2D> > > list = new List <KeyValuePair <TypedAssetContentKey <Texture2D>, Action <Texture2D> > >();
         List <KeyValuePair <TypedAssetContentKey <EquipmentViewDefinition>, Action <EquipmentViewDefinition> > > list2 = new List <KeyValuePair <TypedAssetContentKey <EquipmentViewDefinition>, Action <EquipmentViewDefinition> > >();
         foreach (AvatarModel.Part current in this.Model.IterateParts())
         {
             ViewPart viewPart = new ViewPart();
             if (current.Equipment != null)
             {
                 EquipmentModelDefinition.Part eqPart = current.Equipment.Parts[current.Index];
                 list2.Add(AvatarView.CreatePartContent(this.Model, viewPart, current, eqPart));
                 if (current.Decals != null)
                 {
                     AvatarView.CreateDecalContent(viewPart, current, list);
                 }
             }
             else
             {
                 BodyViewDefinition bodyViewDefinition = this.Model.Definition.Slots[current.Index].LOD[this.Model.LodLevel];
                 bodyViewDefinition.ApplyToViewPart(viewPart);
             }
             this.partViews.Add(viewPart);
         }
         this.partsRequest  = this.outfitService.Load <EquipmentViewDefinition>(list2, this.outfitService.EquipmentPartCache, null);
         this.decalsRequest = this.outfitService.Load <Texture2D>(list, this.outfitService.DecalCache, null);
     }
 }
 public void Apply(AvatarModel.Part newPart)
 {
     base.startWork();
     if (newPart != null)
     {
         if (newPart.Equipment != null)
         {
             this.cleanupLoading();
             EquipmentModelDefinition.Part eqPart = newPart.Equipment.Parts[newPart.Index];
             KeyValuePair <TypedAssetContentKey <EquipmentViewDefinition>, Action <EquipmentViewDefinition> >[] content = new KeyValuePair <TypedAssetContentKey <EquipmentViewDefinition>, Action <EquipmentViewDefinition> >[]
             {
                 AvatarView.CreatePartContent(this.Model, this.partView, newPart, eqPart)
             };
             List <KeyValuePair <TypedAssetContentKey <Texture2D>, Action <Texture2D> > > list = new List <KeyValuePair <TypedAssetContentKey <Texture2D>, Action <Texture2D> > >();
             if (newPart.Decals != null)
             {
                 AvatarView.CreateDecalContent(this.partView, newPart, list);
             }
             this.loadingEquipmentRequest = this.outfitService.Load <EquipmentViewDefinition>(content, this.outfitService.EquipmentPartCache, null);
             this.loadingDecalRequest     = this.outfitService.Load <Texture2D>(list, this.outfitService.DecalCache, null);
         }
         else
         {
             this.cleanupCurrent();
             BodyViewDefinition bodyViewDefinition = this.Model.Definition.Slots[newPart.Index].LOD[this.Model.LodLevel];
             bodyViewDefinition.ApplyToViewPart(this.partView);
             this.setupRenderer();
             base.stopWork();
         }
         base.gameObject.SetActive(true);
     }
     else
     {
         base.gameObject.SetActive(false);
         this.cleanupCurrent();
         base.stopWork();
     }
 }