Exemplo n.º 1
0
 public static Renderer[][] GetRendererArrays(CmpClothes clothesCtrl)
 {
     return(new[] {
         clothesCtrl.rendNormal01,
         clothesCtrl.rendNormal02,
         clothesCtrl.rendNormal03,
     });
 }
Exemplo n.º 2
0
        public void RestrictClothesMenu()
        {
            CmpClothes cmpClothe = this.chaCtrl.cmpClothes[this.SNo];

            if (Object.op_Equality((Object)null, (Object)cmpClothe))
            {
                this.ShowOrHideTab(false, 1, 2, 3, 4);
            }
            else
            {
                this.ShowOrHideTab(true, 1, 2, 3, 4);
                List <int> intList = new List <int>();
                if (!cmpClothe.useColorN01 && !cmpClothe.useColorA01)
                {
                    intList.Add(1);
                }
                this.ccsColorSet[0].EnableColorAlpha(cmpClothe.useColorA01);
                if (!cmpClothe.useColorN02 && !cmpClothe.useColorA02)
                {
                    intList.Add(2);
                }
                this.ccsColorSet[1].EnableColorAlpha(cmpClothe.useColorA02);
                if (!cmpClothe.useColorN03 && !cmpClothe.useColorA03)
                {
                    intList.Add(3);
                }
                this.ccsColorSet[2].EnableColorAlpha(cmpClothe.useColorA03);
                this.ShowOrHideTab(false, intList.ToArray());
                bool active1 = false;
                bool active2 = false;
                bool active3 = false;
                if (Object.op_Implicit((Object)this.ssBreak))
                {
                    active1 = cmpClothe.useBreak;
                    ((Component)this.ssBreak).get_gameObject().SetActiveIfDifferent(active1);
                }
                if (Object.op_Implicit((Object)this.tglOption01))
                {
                    active2 = cmpClothe.objOpt01 != null && 0 != cmpClothe.objOpt01.Length;
                    ((Component)this.tglOption01).get_gameObject().SetActiveIfDifferent(active2);
                }
                if (Object.op_Implicit((Object)this.tglOption02))
                {
                    active3 = cmpClothe.objOpt02 != null && 0 != cmpClothe.objOpt02.Length;
                    ((Component)this.tglOption02).get_gameObject().SetActiveIfDifferent(active3);
                }
                this.ShowOrHideTab((active1 || active2 ? 1 : (active3 ? 1 : 0)) != 0, 4);
            }
        }
Exemplo n.º 3
0
        private void ApplyOverlays(CmpClothes clothesCtrl)
        {
            if (CurrentOverlayTextures == null)
            {
                return;
            }

            var clothesName  = clothesCtrl.name;
            var rendererArrs = GetRendererArrays(clothesCtrl);

            if (_dumpCallback != null && _dumpClothesId == clothesName)
            {
                DumpBaseTextureImpl(rendererArrs);
            }

            if (CurrentOverlayTextures.Count == 0)
            {
                return;
            }

            if (!CurrentOverlayTextures.TryGetValue(clothesName, out var overlay))
            {
                return;
            }
            if (overlay == null || overlay.IsEmpty())
            {
                return;
            }

            var applicableRenderers = GetApplicableRenderers(rendererArrs).ToList();

            if (applicableRenderers.Count == 0)
            {
                if (MakerAPI.InsideMaker)
                {
                    KoiSkinOverlayMgr.Logger.LogMessage($"Removing unused overlay for {clothesName}");
                }
                else
                {
                    KoiSkinOverlayMgr.Logger.LogDebug($"Removing unused overlay for {clothesName}");
                }

                overlay.Dispose();
                CurrentOverlayTextures.Remove(clothesName);
                return;
            }

            foreach (var renderer in applicableRenderers)
            {
                var mat = renderer.material;

                var mainTexture = mat.mainTexture as RenderTexture;
                if (mainTexture == null)
                {
                    return;
                }

                if (overlay.Override)
                {
                    var rta = RenderTexture.active;
                    RenderTexture.active = mainTexture;
                    GL.Clear(false, true, Color.clear);
                    RenderTexture.active = rta;
                }

                if (overlay.Texture != null)
                {
                    KoiSkinOverlayController.ApplyOverlay(mainTexture, overlay.Texture);
                }
            }
        }