コード例 #1
0
 private void switchLoadingRequestsToCurrent()
 {
     this.currentEquipmentRequest = this.loadingEquipmentRequest;
     this.currentDecalRequest     = this.loadingDecalRequest;
     this.loadingEquipmentRequest = null;
     this.loadingDecalRequest     = null;
 }
コード例 #2
0
 private void switchLoadingRequestsToCurrent()
 {
     currentEquipmentRequest = loadingEquipmentRequest;
     currentDecalRequest     = loadingDecalRequest;
     loadingEquipmentRequest = null;
     loadingDecalRequest     = null;
 }
コード例 #3
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);
        }
コード例 #4
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);
     }
 }
コード例 #5
0
 private void cleanupLoading()
 {
     if (this.loadingEquipmentRequest != null)
     {
         this.outfitService.Unload <EquipmentViewDefinition>(this.loadingEquipmentRequest);
         this.loadingEquipmentRequest = null;
     }
     if (this.loadingDecalRequest != null)
     {
         this.outfitService.Unload <Texture2D>(this.loadingDecalRequest);
         this.loadingDecalRequest = null;
     }
 }
コード例 #6
0
 private void cleanupLoading()
 {
     if (loadingEquipmentRequest != null)
     {
         outfitService.Unload(loadingEquipmentRequest);
         loadingEquipmentRequest = null;
     }
     if (loadingDecalRequest != null)
     {
         outfitService.Unload(loadingDecalRequest);
         loadingDecalRequest = null;
     }
 }
コード例 #7
0
 private void cleanupCurrent()
 {
     this.partView.CleanUp(base.gameObject);
     if (this.currentEquipmentRequest != null)
     {
         this.outfitService.Unload <EquipmentViewDefinition>(this.currentEquipmentRequest);
         this.currentEquipmentRequest = null;
     }
     if (this.currentDecalRequest != null)
     {
         this.outfitService.Unload <Texture2D>(this.currentDecalRequest);
         this.currentDecalRequest = null;
     }
 }
コード例 #8
0
 private void cleanupCurrent()
 {
     partView.CleanUp(base.gameObject);
     if (currentEquipmentRequest != null)
     {
         outfitService.Unload(currentEquipmentRequest);
         currentEquipmentRequest = null;
     }
     if (currentDecalRequest != null)
     {
         outfitService.Unload(currentDecalRequest);
         currentDecalRequest = null;
     }
 }
コード例 #9
0
 protected override void cleanup()
 {
     meshDef.CleanUp(base.gameObject);
     ComponentExtensions.DestroyIfInstance(rend.sharedMaterial);
     rend.enabled = false;
     if (partsRequest != null)
     {
         outfitService.Unload(partsRequest);
         partsRequest = null;
     }
     if (decalsRequest != null)
     {
         outfitService.Unload(decalsRequest);
         decalsRequest = null;
     }
     combineRequest = null;
 }
コード例 #10
0
 protected override void cleanup()
 {
     this.meshDef.CleanUp(base.gameObject);
     ComponentExtensions.DestroyIfInstance(this.rend.sharedMaterial);
     this.rend.enabled = false;
     if (this.partsRequest != null)
     {
         this.outfitService.Unload <EquipmentViewDefinition>(this.partsRequest);
         this.partsRequest = null;
     }
     if (this.decalsRequest != null)
     {
         this.outfitService.Unload <Texture2D>(this.decalsRequest);
         this.decalsRequest = null;
     }
     this.combineRequest = null;
 }
コード例 #11
0
 public void Update()
 {
     if (combineRequest == null)
     {
         if (partsRequest != null && partsRequest.Finished && decalsRequest != null && decalsRequest.Finished)
         {
             BodyColorMaterialProperties bodycolor = new BodyColorMaterialProperties(Model.BeakColor, Model.BellyColor, Model.BodyColor);
             combineRequest = avatarService.CombineParts(Model.Definition, bodycolor, partViews, MaxAtlasDimension);
         }
     }
     else if (combineRequest.Finished)
     {
         setupRenderer();
         outfitService.Unload(partsRequest);
         partsRequest = null;
         outfitService.Unload(decalsRequest);
         decalsRequest  = null;
         combineRequest = null;
         stopWork();
     }
 }
コード例 #12
0
 public void Update()
 {
     if (this.combineRequest == null)
     {
         if (this.partsRequest != null && this.partsRequest.Finished && this.decalsRequest != null && this.decalsRequest.Finished)
         {
             BodyColorMaterialProperties bodycolor = new BodyColorMaterialProperties(this.Model.BeakColor, this.Model.BellyColor, this.Model.BodyColor);
             this.combineRequest = this.avatarService.CombineParts(this.Model.Definition, bodycolor, this.partViews, this.MaxAtlasDimension);
         }
     }
     else if (this.combineRequest.Finished)
     {
         this.setupRenderer();
         this.outfitService.Unload <EquipmentViewDefinition>(this.partsRequest);
         this.partsRequest = null;
         this.outfitService.Unload <Texture2D>(this.decalsRequest);
         this.decalsRequest  = null;
         this.combineRequest = null;
         base.stopWork();
     }
 }
コード例 #13
0
 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();
     }
 }