// method for injecting MPN's to Maid.AllProcProp and Maid.AllPropcPropSeq
 public static void AllProcSeqExt(Maid maid, ref MaidProp maidProp)
 {
     if (maidProp.type == 3)
     {
         if (MPN_int_string[maidProp.idx] == "head")
         {
             maid.GetProp((MPN)MPN_string_int["eye2"]).boDut     = true;
             maid.GetProp((MPN)MPN_string_int["skintoon"]).boDut = true;
         }
         else if (MPN_int_string[maidProp.idx] == "skin")
         {
             maid.GetProp((MPN)MPN_string_int["skintoon"]).boDut = true;
         }
         else if (MPN_int_string[maidProp.idx] == "eye" || MPN_int_string[maidProp.idx] == "folder_eye")
         {
             maid.GetProp((MPN)MPN_string_int["folder_eye2"]).boDut = true;
             maid.GetProp((MPN)MPN_string_int["eye2"]).boDut        = true;
         }
         else if (MPN_int_string[maidProp.idx] == "body")
         {
             for (int i = maidProp.idx + 1; i <= MPN_string_int["horns"]; i++)
             {
                 maid.GetProp((MPN)i).boDut = true;
             }
         }
     }
 }
示例#2
0
 // Token: 0x06000069 RID: 105 RVA: 0x00007918 File Offset: 0x00005B18
 public void ApplyPresetMPNProp(Maid maid, PresetData preset)
 {
     foreach (CCMPNValue ccmpnvalue in preset.mpnvals)
     {
         MaidProp prop = maid.GetProp(ccmpnvalue.name);
         if (prop != null)
         {
             prop.value = ccmpnvalue.value;
             if (prop.min > ccmpnvalue.min)
             {
                 prop.min = ccmpnvalue.min;
             }
             if (prop.max < ccmpnvalue.max)
             {
                 prop.max = ccmpnvalue.max;
             }
         }
         else
         {
             LogUtil.Debug(new object[]
             {
                 "failed to apply MaidProp. mpn:",
                 ccmpnvalue.name
             });
         }
     }
 }
 void onSelectMPN(int winId)
 {
     GUILayout.BeginVertical(GUI.skin.box);
     GUILayout.Label("MOD Assist", labelStyle);
     mpnScrollPos = GUILayout.BeginScrollView(mpnScrollPos);
     foreach (var mpnkey in Params.WearMPNs.Keys)
     {
         if (GUILayout.Button(Params.WearMPNs[mpnkey], buttonStyle))
         {
             MaidProp prop = maid.GetProp(mpnkey);
             menuFile = new MenuFile();
             if (!menuFile.LoadFile(prop.strFileName))
             {
                 return;
             }
             if (loadMenu())
             {
                 showMainWindow = true;
             }
         }
     }
     GUILayout.EndScrollView();
     GUILayout.EndVertical();
     GUI.DragWindow();
 }
            public static PropSnapShot Clone(PropSnapShot s)
            {
                PropSnapShot newObj = new PropSnapShot();

                foreach (MPN mpn in Enum.GetValues(typeof(MPN)))
                {
                    MaidProp srcMaidProp = s.maidProps[mpn];
                    MaidProp newMaidProp = new MaidProp();

                    using (MemoryStream ms = new MemoryStream())
                    {
                        BinaryWriter bw = new BinaryWriter(ms);
                        srcMaidProp.Serialize(bw);
                        bw.Flush();
                        ms.Position = 0;
                        using (BinaryReader br = new BinaryReader(ms))
                        {
                            newMaidProp.Deserialize(br);
                        }
                    }
                    newObj.maidProps[mpn] = newMaidProp;
                }

                for (int i = 0; i < (int)MaidParts.PARTS_COLOR.MAX; i++)
                {
                    MaidParts.PARTS_COLOR col = (MaidParts.PARTS_COLOR)i;
                    var c = s.GetColor(col);
                    newObj.SetColor(col, c);
                }
                return(newObj);
            }
示例#5
0
        // Token: 0x060003F8 RID: 1016 RVA: 0x0002322C File Offset: 0x0002142C
        public void ChangeMenu(Maid maid, MaidProp prop)
        {
            if (prop.nFileNameRID == 0 || this.NoAnimMenuId.Contains(prop.nFileNameRID))
            {
                return;
            }
            List <MenuFileHandler.ChangeInfo> list = this.menuHandler.Parse(prop.strFileName);

            if (list == null)
            {
                return;
            }
            bool flag = false;

            foreach (MenuFileHandler.ChangeInfo changeInfo in list)
            {
                TBody.SlotID f_nSlotNo;
                if (EnumUtil.TryParse <TBody.SlotID>(changeInfo.slot, true, out f_nSlotNo))
                {
                    TBodySkin slot = maid.body0.GetSlot((int)f_nSlotNo);
                    if (slot != null && !(slot.obj == null))
                    {
                        TexAnimator texAnimator = slot.obj.transform.GetComponentInChildren <TexAnimator>(false);
                        if (texAnimator == null)
                        {
                            Material[]      materials = this.GetMaterials(slot);
                            List <AnimItem> list2     = this.ParseMaidSlot(slot, materials, changeInfo.matInfos);
                            if (list2 != null)
                            {
                                LogUtil.Debug(new object[]
                                {
                                    "AddComponent for ",
                                    slot,
                                    ", from ",
                                    prop.name
                                });
                                texAnimator      = slot.obj.AddComponent <TexAnimator>();
                                texAnimator.name = "TexAnimator";
                                texAnimator.SetTargets(list2);
                                flag = true;
                            }
                        }
                        else if (changeInfo.matInfos == null)
                        {
                            flag |= texAnimator.ParseMaterials();
                        }
                        else
                        {
                            flag |= texAnimator.ParseMaterials(changeInfo.matInfos);
                        }
                    }
                }
            }
            if (!flag)
            {
                this.NoAnimMenuId.Add(prop.nFileNameRID);
            }
        }
示例#6
0
 public static void SetProp(Maid __instance, MaidProp mp, string filename, int f_nFileNameRID, bool f_bTemp, bool f_bNoScale)
 {
     if (configEntryUtill["SetProp"])
     {
         if (__instance.Visible)
         {
             print("SetProp3", mp);
         }
     }
 }
        // add more MPN's to preset set method
        public static void ExtSet(Maid f_maid, CharacterMgr.Preset f_prest)
        {
            global::MaidProp[] array;

            if (f_prest.ePreType == global::CharacterMgr.PresetType.Body)
            {
                array = (from mp in f_prest.listMprop
                         where 88 <= mp.idx && mp.idx <= 96
                         select mp).ToArray <global::MaidProp>();
            }
            else if (f_prest.ePreType == global::CharacterMgr.PresetType.Wear)
            {
                array = (from mp in f_prest.listMprop
                         where 97 <= mp.idx && mp.idx <= 105
                         select mp).ToArray <global::MaidProp>();
            }

            else if (f_prest.ePreType == global::CharacterMgr.PresetType.All)
            {
                array = (from mp in f_prest.listMprop
                         where 88 <= mp.idx && mp.idx <= 105
                         select mp).ToArray <global::MaidProp>();
            }

            else
            {
                array = null;
            }

            if (array != null)
            {
                for (int i = 0; i < array.Length; i++)
                {
                    MaidProp maidProp = array[i];
                    if (maidProp.idx != 23)
                    {
                        f_maid.SetProp((MPN)maidProp.idx, maidProp.value, false);
                        if (string.IsNullOrEmpty(maidProp.strFileName))
                        {
                            string strFileName = maidProp.strFileName;
                            if (CM3.dicDelItem.TryGetValue((MPN)maidProp.idx, out strFileName))
                            {
                                maidProp.strFileName = strFileName;
                            }
                        }
                        f_maid.SetProp((MPN)maidProp.idx, maidProp.strFileName, 0, false, false);
                        if (CharacterMgr.EditModeLookHaveItem && !GameMain.Instance.CharacterMgr.GetPlayerParam().status.IsHaveItem(maidProp.strFileName))
                        {
                            f_maid.DelProp((MPN)maidProp.idx, false);
                        }
                    }
                }
            }
        }
示例#8
0
 private static void SetMaidPropRandom(Maid m_maid, MPN tag)
 {
     try
     {
         MaidProp maidProp = m_maid.GetProp(tag);
         m_maid.SetProp(tag, UnityEngine.Random.Range(maidProp.min, maidProp.max));
     }
     catch (Exception e)
     {
         MyLog.LogError("SetMaidPropRandom", e.ToString());
     }
 }
示例#9
0
 public static void print(string s, MaidProp maidProp)
 {
     if (maidProp == null)
     {
         MyLog.LogMessage(s);
         return;
     }
     if (maidProp.strFileName.Length != 0)
     {
         MyLog.LogMessage(s + ": " + (MPN)maidProp.idx, maidProp.strFileName);
     }
 }
        public string GetCurrentMenuFile()
        {
            if (currentMaid != null)
            {
                MaidProp prop = currentMaid.GetProp(currentSlot.mpn);
                if (prop != null)
                {
                    return(prop.strFileName);
                }

                LogUtil.Log("maid prop is null", currentSlot.mpn);
            }
            return(null);
        }
        public int GetCurrentMenuFileID()
        {
            if (currentMaid != null)
            {
                MaidProp prop = currentMaid.GetProp(currentSlot.mpn);
                if (prop != null)
                {
                    return(prop.nFileNameRID);
                }

                LogUtil.Log("maid prop is null", currentSlot.mpn);
            }
            return(0);
        }
        void StorePropSnapShot(PropSnapShot s)
        {
            int  maidNumber = 0;
            Maid maid       = GameMain.Instance.CharacterMgr.GetMaid(maidNumber);

            if (maid == null)
            {
                return;
            }

            SceneEdit sceneEdit = FindSceneEdit();

            if (sceneEdit == null)
            {
                return;
            }

            foreach (MPN mpn in Enum.GetValues(typeof(MPN)))
            {
                if (mpn == MPN.null_mpn)
                {
                    continue;
                }
                try
                {
                    MaidProp maidProp = s[mpn];
                    if (!string.IsNullOrEmpty(maidProp.strFileName))
                    {
                        maid.SetProp(mpn, maidProp.strFileName, maidProp.nFileNameRID, false);
                    }
                    else
                    {
                        maid.SetProp(mpn, maidProp.value, false);
                    }
                }
                catch (Exception)
                {
                }
            }

            foreach (KeyValuePair <MaidParts.PARTS_COLOR, MaidParts.PartsColor> kv in s.maidPartsColors)
            {
                maid.Parts.SetPartsColor(kv.Key, kv.Value);
            }

            // 値の更新
            maid.AllProcProp();
            sceneEdit.UpdateSliders();
        }
示例#13
0
 // Token: 0x06000282 RID: 642 RVA: 0x00015DA0 File Offset: 0x00013FA0
 private void DetectTarget(Func <int, Maid> GetMaid, int maidCount)
 {
     for (int i = 0; i < maidCount; i++)
     {
         Maid maid = GetMaid(i);
         if (!(maid == null) && !maid.IsAllProcPropBusy && MaidChangeDetector.SLOT_COUNT == maid.body0.goSlot.Count)
         {
             int instanceID = maid.GetInstanceID();
             MaidChangeDetector.MenuCache mc;
             if (!this.IsEnabled(maid))
             {
                 MaidChangeDetector.cache.Remove(instanceID);
             }
             else if (!MaidChangeDetector.cache.TryGetValue(instanceID, out mc))
             {
                 MaidProp[] array = PrivateAccessor.Get <MaidProp[]>(maid, "m_aryMaidProp");
                 if (array != null)
                 {
                     mc = new MaidChangeDetector.MenuCache();
                     mc.SetProps(array);
                     MaidChangeDetector.cache[instanceID] = mc;
                 }
             }
             else
             {
                 for (int j = 43; j < mc.maidProps.Length; j++)
                 {
                     MaidProp maidProp = mc.maidProps[j];
                     if (mc.menuIds[j] != maidProp.nFileNameRID)
                     {
                         int mpn1 = j;
                         LogUtil.Debug(() => string.Concat(new object[]
                         {
                             "Item changed [",
                             (MPN)mpn1,
                             "] ",
                             mc.maidProps[mpn1].strFileName
                         }));
                         mc.menuIds[j] = maidProp.nFileNameRID;
                         foreach (Action <Maid, MaidProp> action in this.notifiers)
                         {
                             action(maid, maidProp);
                         }
                     }
                 }
             }
         }
     }
 }
 public void WriteProps(Maid maid)
 {
     foreach (var kv in Sliders)
     {
         string name   = kv.Key;
         Slider slider = kv.Value;
         MPN    mpn    = Helper.ToEnum <MPN>(name, MPN.null_mpn);
         if (mpn != MPN.null_mpn)
         {
             MaidProp maidProp = maid.GetProp(mpn);
             maidProp.min = (int)slider.min;
             maidProp.max = (int)slider.max;
         }
     }
 }
 // method for injecting MPN's to Maid.AllProcProp
 public static void AllProcExt(Maid maid, ref MaidProp maidProp)
 {
     if (maidProp.idx == 25)
     {
         maid.GetProp(MPN.eye2).boDut = true;
     }
     else if (maidProp.idx == 31)
     {
         maid.GetProp(MPN.makeup1).boDut   = true;
         maid.GetProp(MPN.makeup2).boDut   = true;
         maid.GetProp(MPN.acctatoo2).boDut = true;
         maid.GetProp(MPN.acctatoo3).boDut = true;
         maid.GetProp(MPN.acctatoo2).boDut = true;
         maid.GetProp(MPN.skintoon).boDut  = true;
     }
 }
        PropSnapShot CapturePropSnapShot()
        {
            PropSnapShot s          = new PropSnapShot();
            int          maidNumber = 0;
            Maid         maid       = GameMain.Instance.CharacterMgr.GetMaid(maidNumber);

            if (maid == null)
            {
                return(s);
            }

            foreach (MPN mpn in Enum.GetValues(typeof(MPN)))
            {
                try
                {
                    MaidProp maidProp = maid.GetProp(mpn);
                    if (maidProp != null)
                    {
                        s[mpn] = maidProp;
                    }
                }
                catch (Exception)
                {
                }
            }

            MaidParts maidParts = maid.Parts;

            MaidParts.PartsColor[] newMaidParts = null;
            using (MemoryStream ms = new MemoryStream())
            {
                BinaryWriter bw = new BinaryWriter(ms);
                maidParts.Serialize(bw);
                bw.Flush();
                ms.Position = 0;
                using (BinaryReader br = new BinaryReader(ms))
                {
                    newMaidParts = MaidParts.DeserializePre(br);
                }
            }
            for (int i = 0; i < (int)MaidParts.PARTS_COLOR.MAX; i++)
            {
                MaidParts.PARTS_COLOR col = (MaidParts.PARTS_COLOR)i;
                s.SetColor(col, newMaidParts[i]);
            }
            return(s);
        }
 // method for injecting MPN's to Maid.AllProcProp
 public static void AllProcExt(Maid maid, ref MaidProp maidProp)
 {
     if (MPN_int_string[maidProp.idx] == "head")
     {
         maid.GetProp((MPN)MPN_string_int["eye2"]).boDut     = true;
         maid.GetProp((MPN)MPN_string_int["skintoon"]).boDut = true;
     }
     else if (MPN_int_string[maidProp.idx] == "skin")
     {
         maid.GetProp((MPN)MPN_string_int["skintoon"]).boDut = true;
     }
     else if (MPN_int_string[maidProp.idx] == "eye" || MPN_int_string[maidProp.idx] == "folder_eye")
     {
         maid.GetProp((MPN)MPN_string_int["folder_eye2"]).boDut = true;
         maid.GetProp((MPN)MPN_string_int["eye2"]).boDut        = true;
     }
 }
        // Token: 0x06000296 RID: 662 RVA: 0x00016224 File Offset: 0x00014424
        public string GetCurrentMenuFile()
        {
            if (this.CurrentMaid == null)
            {
                return(null);
            }
            MaidProp prop = this.CurrentMaid.GetProp(this.CurrentSlot.mpn);

            if (prop != null)
            {
                return(prop.strFileName);
            }
            LogUtil.Log(new object[]
            {
                "maid prop is null",
                this.CurrentSlot.mpn
            });
            return(null);
        }
        // Token: 0x06000297 RID: 663 RVA: 0x0001628C File Offset: 0x0001448C
        public int GetCurrentMenuFileID()
        {
            if (this.CurrentMaid == null)
            {
                return(0);
            }
            MaidProp prop = this.CurrentMaid.GetProp(this.CurrentSlot.mpn);

            if (prop != null)
            {
                return(prop.nFileNameRID);
            }
            LogUtil.Log(new object[]
            {
                "maid prop is null",
                this.CurrentSlot.mpn
            });
            return(0);
        }
示例#20
0
 // Token: 0x06000068 RID: 104 RVA: 0x00007774 File Offset: 0x00005974
 public void ApplyPresetMPN(Maid maid, PresetData preset, bool applyBody, bool applyWear, bool castoff)
 {
     foreach (CCMPN ccmpn in preset.mpns)
     {
         if ((applyBody || !TypeUtil.IsBody(ccmpn.name)) && (applyWear || !TypeUtil.IsWear(ccmpn.name)) && this._fileUtil.Exists(ccmpn.filename))
         {
             MaidProp prop = maid.GetProp(ccmpn.name);
             if (ccmpn.filename.Equals(prop.strFileName, StringComparison.OrdinalIgnoreCase))
             {
                 LogUtil.Debug(new object[]
                 {
                     "apply preset skip. mpn:",
                     ccmpn.name,
                     ", file:",
                     ccmpn.filename
                 });
             }
             else if (ccmpn.name == MPN.MayuThick)
             {
                 LogUtil.Log(new object[]
                 {
                     "ACCexプリセットのbodyメニューの適用は現在未対応です。スキップします。",
                     ccmpn.filename
                 });
             }
             else if (ccmpn.filename.EndsWith("_del.menu", StringComparison.OrdinalIgnoreCase))
             {
                 if (castoff && (prop.nFileNameRID != 0 || !CM3.dicDelItem[ccmpn.name].Equals(ccmpn.filename, StringComparison.OrdinalIgnoreCase)) && PresetManager.SetProp != null)
                 {
                     PresetManager.SetProp(maid, ccmpn.name, ccmpn.filename, 0);
                 }
             }
             else if (PresetManager.SetProp != null)
             {
                 PresetManager.SetProp(maid, ccmpn.name, ccmpn.filename, 0);
             }
         }
     }
 }
 // method for injecting MPN's to Maid.AllProcProp and Maid.AllPropcPropSeq
 public static void AllProcSeqExt(Maid maid, ref MaidProp maidProp)
 {
     if (maidProp.type == 3)
     {
         if (maidProp.idx == 25)
         {
             maid.GetProp(MPN.eye2).boDut = true;
         }
         else if (maidProp.idx == 31)
         {
             maid.GetProp(MPN.makeup1).boDut   = true;
             maid.GetProp(MPN.makeup2).boDut   = true;
             maid.GetProp(MPN.acctatoo2).boDut = true;
             maid.GetProp(MPN.acctatoo3).boDut = true;
             maid.GetProp(MPN.acctatoo2).boDut = true;
             maid.GetProp(MPN.skintoon).boDut  = true;
         }
         else if (maidProp.idx == 23)
         {
             maid.GetProp(MPN.head).boDut             = true;
             maid.GetProp(MPN.hairf).boDut            = true;
             maid.GetProp(MPN.hairr).boDut            = true;
             maid.GetProp(MPN.hairt).boDut            = true;
             maid.GetProp(MPN.hairs).boDut            = true;
             maid.GetProp(MPN.wear).boDut             = true;
             maid.GetProp(MPN.skirt).boDut            = true;
             maid.GetProp(MPN.mizugi).boDut           = true;
             maid.GetProp(MPN.bra).boDut              = true;
             maid.GetProp(MPN.panz).boDut             = true;
             maid.GetProp(MPN.stkg).boDut             = true;
             maid.GetProp(MPN.shoes).boDut            = true;
             maid.GetProp(MPN.headset).boDut          = true;
             maid.GetProp(MPN.glove).boDut            = true;
             maid.GetProp(MPN.acchead).boDut          = true;
             maid.GetProp(MPN.hairaho).boDut          = true;
             maid.GetProp(MPN.accha).boDut            = true;
             maid.GetProp(MPN.acchana).boDut          = true;
             maid.GetProp(MPN.acckamisub).boDut       = true;
             maid.GetProp(MPN.acckami).boDut          = true;
             maid.GetProp(MPN.accmimi).boDut          = true;
             maid.GetProp(MPN.accnip).boDut           = true;
             maid.GetProp(MPN.acckubi).boDut          = true;
             maid.GetProp(MPN.acckubiwa).boDut        = true;
             maid.GetProp(MPN.accheso).boDut          = true;
             maid.GetProp(MPN.accude).boDut           = true;
             maid.GetProp(MPN.accashi).boDut          = true;
             maid.GetProp(MPN.accsenaka).boDut        = true;
             maid.GetProp(MPN.accshippo).boDut        = true;
             maid.GetProp(MPN.accanl).boDut           = true;
             maid.GetProp(MPN.accvag).boDut           = true;
             maid.GetProp(MPN.megane).boDut           = true;
             maid.GetProp(MPN.accxxx).boDut           = true;
             maid.GetProp(MPN.acchat).boDut           = true;
             maid.GetProp(MPN.underhair).boDut        = true;
             maid.GetProp(MPN.chikubi).boDut          = true;
             maid.GetProp(MPN.chikubicolor).boDut     = true;
             maid.GetProp(MPN.moza).boDut             = true;
             maid.GetProp(MPN.onepiece).boDut         = true;
             maid.GetProp(MPN.folder_underhair).boDut = true;
             maid.GetProp(MPN.eye2).boDut             = true;
             maid.GetProp(MPN.nails).boDut            = true;
             maid.GetProp(MPN.toenails).boDut         = true;
             maid.GetProp(MPN.skintoon).boDut         = true;
             maid.GetProp(MPN.general1).boDut         = true;
             maid.GetProp(MPN.general2).boDut         = true;
             maid.GetProp(MPN.general3).boDut         = true;
             maid.GetProp(MPN.general4).boDut         = true;
             maid.GetProp(MPN.general5).boDut         = true;
             maid.GetProp(MPN.general6).boDut         = true;
             maid.GetProp(MPN.general7).boDut         = true;
             maid.GetProp(MPN.ears).boDut             = true;
             maid.GetProp(MPN.horns).boDut            = true;
         }
     }
 }
示例#22
0
        public void Save(string fileName, string presetName, Dictionary <string, bool> dDelNodes)
        {
            Maid maid = holder.currentMaid;
            // カレントのメイドデータからプリセットデータを抽出
            var preset = new PresetData();

            preset.name = presetName;
            foreach (SlotInfo slotInfo in ACConstants.SlotNames.Values)
            {
                if (!slotInfo.enable)
                {
                    continue;
                }

                TBodySkin slot = maid.body0.GetSlot((int)slotInfo.Id);
                // マスク情報を抽出
                SlotState maskState;
                if (slot.obj == null)
                {
                    maskState = SlotState.NotLoaded;
                }
                else if (!slot.boVisible)
                {
                    maskState = SlotState.Masked;
                }
                else
                {
                    maskState = SlotState.Displayed;
                }

                Material[] materialList = holder.GetMaterials(slot);
                if (materialList.Length == 0)
                {
                    continue;
                }

                var slotItem = new CCSlot(slotInfo.Id);
                slotItem.mask = maskState;

                foreach (Material material in materialList)
                {
                    var type = ShaderType.Resolve(material.shader.name);
                    if (type == ShaderType.UNKNOWN)
                    {
                        continue;
                    }
                    var cmat = new CCMaterial(material, type);
                    slotItem.Add(cmat);
                    foreach (var texProp in type.texProps)
                    {
                        var tex2d = material.GetTexture(texProp.propId) as Texture2D;
                        if (tex2d == null || string.IsNullOrEmpty(tex2d.name))
                        {
                            continue;
                        }

                        var ti = new TextureInfo();
                        cmat.Add(ti);
                        ti.propName = texProp.keyName;
                        ti.texFile  = tex2d.name;
                        var fp = texModifier.GetFilter(maid, slotInfo.Id.ToString(), material.name, tex2d.name);
                        if (fp != null && !fp.hasNotChanged())
                        {
                            ti.filter = new TexFilter(fp);
                        }
                    }
                }
                preset.slots.Add(slotItem);
            }

            for (int i = TypeUtil.BODY_START; i <= TypeUtil.BODY_END; i++)
            {
                var      mpn = (MPN)Enum.ToObject(typeof(MPN), i);
                MaidProp mp  = maid.GetProp(mpn);
                if (mp != null)
                {
                    if (!String.IsNullOrEmpty(mp.strFileName))
                    {
                        preset.mpns.Add(new CCMPN(mpn, mp.strFileName));
                    }
                    else
                    {
                        preset.mpnvals.Add(new CCMPNValue(mpn, mp.value, mp.min, mp.max));
                    }
                }
            }

            for (int i = TypeUtil.WEAR_START; i <= TypeUtil.WEAR_END; i++)
            {
                var      mpn = (MPN)Enum.ToObject(typeof(MPN), i);
                MaidProp mp  = maid.GetProp(mpn);
                if (mp != null && !String.IsNullOrEmpty(mp.strFileName))
                {
                    preset.mpns.Add(new CCMPN(mpn, mp.strFileName));
                }
            }
//            for (int i = (int)MPN_TYPE_RANGE.FOLDER_BODY_START; i <= (int)MPN_TYPE_RANGE.FOLDER_BODY_END; i++) {
//                var mpn = (MPN)Enum.ToObject(typeof(MPN), i);
//                MaidProp mp = maid.GetProp(mpn);
//                if (mp != null) {
//                    LogUtil.Debug(mpn,":", mp.type, ", value=", mp.value, ", temp=", mp.temp_value, ", file=", mp.strFileName);
//                }
//            }

            // 無限色
            for (int j = TypeUtil.PARTSCOLOR_START; j <= TypeUtil.PARTSCOLOR_END; j++)
            {
                var pcEnum = (MaidParts.PARTS_COLOR)j;
                MaidParts.PartsColor part = maid.Parts.GetPartsColor(pcEnum);
                preset.partsColors[pcEnum.ToString()] = new CCPartsColor(part);
            }

            // 表示ノード
            preset.delNodes = new Dictionary <string, bool>(dDelNodes);

            LogUtil.Debug("create preset...", fileName);
            SavePreset(fileName, preset);
        }
示例#23
0
        // Token: 0x06000066 RID: 102 RVA: 0x00007270 File Offset: 0x00005470
        public void Save(string fileName, string presetName, Dictionary <string, bool> dDelNodes)
        {
            Maid       currentMaid = this._holder.CurrentMaid;
            PresetData presetData  = new PresetData
            {
                name = presetName
            };

            foreach (SlotInfo slotInfo in ACConstants.SlotNames.Values)
            {
                if (slotInfo.enable)
                {
                    TBodySkin slot = currentMaid.body0.GetSlot((int)slotInfo.Id);
                    SlotState mask;
                    if (slot.obj == null)
                    {
                        mask = SlotState.NotLoaded;
                    }
                    else if (!slot.boVisible)
                    {
                        mask = SlotState.Masked;
                    }
                    else
                    {
                        mask = SlotState.Displayed;
                    }
                    Material[] materials = this._holder.GetMaterials(slot);
                    if (materials.Length != 0)
                    {
                        CCSlot ccslot = new CCSlot(slotInfo.Id)
                        {
                            mask = mask
                        };
                        foreach (Material material in materials)
                        {
                            ShaderType shaderType = ShaderType.Resolve(material.shader.name);
                            if (shaderType != ShaderType.UNKNOWN)
                            {
                                CCMaterial ccmaterial = new CCMaterial(material, shaderType);
                                ccslot.Add(ccmaterial);
                                foreach (ShaderPropTex shaderPropTex in shaderType.texProps)
                                {
                                    Texture2D texture2D = material.GetTexture(shaderPropTex.propId) as Texture2D;
                                    if (!(texture2D == null) && !string.IsNullOrEmpty(texture2D.name))
                                    {
                                        TextureInfo textureInfo = new TextureInfo();
                                        ccmaterial.Add(textureInfo);
                                        textureInfo.propName = shaderPropTex.keyName;
                                        textureInfo.texFile  = texture2D.name;
                                        TextureModifier.FilterParam filter = this._texModifier.GetFilter(currentMaid, slotInfo.Id.ToString(), material.name, texture2D.name);
                                        if (filter != null && !filter.HasNotChanged())
                                        {
                                            textureInfo.filter = new TexFilter(filter);
                                        }
                                        Vector2 textureOffset = material.GetTextureOffset(shaderPropTex.propId);
                                        if (Math.Abs(textureOffset.x) > 0.001f)
                                        {
                                            textureInfo.offsetX = new float?(textureOffset.x);
                                        }
                                        if (Math.Abs(textureOffset.y) > 0.001f)
                                        {
                                            textureInfo.offsetY = new float?(textureOffset.y);
                                        }
                                        Vector2 textureScale = material.GetTextureScale(shaderPropTex.propId);
                                        if (Math.Abs(textureScale.x) > 0.001f)
                                        {
                                            textureInfo.scaleX = new float?(textureScale.x);
                                        }
                                        if (Math.Abs(textureScale.y) > 0.001f)
                                        {
                                            textureInfo.scaleY = new float?(textureScale.y);
                                        }
                                    }
                                }
                            }
                        }
                        presetData.slots.Add(ccslot);
                    }
                }
            }
            for (int k = TypeUtil.BODY_START; k <= TypeUtil.BODY_END; k++)
            {
                MPN      mpn  = (MPN)Enum.ToObject(typeof(MPN), k);
                MaidProp prop = currentMaid.GetProp(mpn);
                if (prop != null)
                {
                    if (prop.type == 1 || prop.type == 2)
                    {
                        presetData.mpnvals.Add(new CCMPNValue(mpn, prop.value, prop.min, prop.max));
                    }
                    else if (prop.type == 3 && prop.nFileNameRID != 0)
                    {
                        presetData.mpns.Add(new CCMPN(mpn, prop.strFileName));
                    }
                }
            }
            for (int l = TypeUtil.WEAR_START; l <= TypeUtil.WEAR_END; l++)
            {
                MPN      mpn2  = (MPN)Enum.ToObject(typeof(MPN), l);
                MaidProp prop2 = currentMaid.GetProp(mpn2);
                if (prop2 != null && prop2.nFileNameRID != 0)
                {
                    presetData.mpns.Add(new CCMPN(mpn2, prop2.strFileName));
                }
            }
            for (MaidParts.PARTS_COLOR parts_COLOR = TypeUtil.PARTS_COLOR_START; parts_COLOR <= TypeUtil.PARTS_COLOR_END; parts_COLOR++)
            {
                MaidParts.PartsColor partsColor = currentMaid.Parts.GetPartsColor(parts_COLOR);
                presetData.partsColors[parts_COLOR.ToString()] = new CCPartsColor(partsColor);
            }
            presetData.delNodes = new Dictionary <string, bool>(dDelNodes);
            LogUtil.Debug(new object[]
            {
                "create preset...",
                fileName
            });
            this.SavePreset(fileName, presetData);
        }
        public void ChangeMenu(Maid maid, MaidProp prop)
        {
            if (prop.nFileNameRID == 0 || NoAnimMenuId.Contains(prop.nFileNameRID))
            {
                return;
            }

//            bool isAnimTarget;
//            if (AnimMenu.TryGetValue(prop.nFileNameRID, out isAnimTarget)) {
//                menuHandler.Parse(prop.strFileName);
//            }
            var changeInfos = menuHandler.Parse(prop.strFileName);

            if (changeInfos == null)
            {
                return;
            }
            var hasTarget = false;

            foreach (var changeInfo in changeInfos)
            {
                TBody.SlotID slotID;
                if (!EnumUtil.TryParse(changeInfo.slot, true, out slotID))
                {
                    continue;
                }
                var slot = maid.body0.GetSlot((int)slotID);
                if (slot == null || slot.obj == null)
                {
                    continue;
                }

                var animator = slot.obj.transform.GetComponentInChildren <TexAnimator>(false);
                if (animator == null)
                {
                    var mates     = GetMaterials(slot);
                    var animItems = ParseMaidSlot(slot, mates, changeInfo.matInfos);
                    if (animItems != null)
                    {
                        LogUtil.Debug("AddComponent for ", slot, ", from ", prop.name);
                        animator      = slot.obj.AddComponent <TexAnimator>();
                        animator.name = "TexAnimator";
                        animator.SetTargets(animItems);
                        hasTarget = true;
                    }

                    continue;
                }

                if (changeInfo.matInfos == null)
                {
                    hasTarget |= animator.ParseMaterials();
                }
                else
                {
                    hasTarget |= animator.ParseMaterials(changeInfo.matInfos);
                }
            }

            if (!hasTarget)
            {
                NoAnimMenuId.Add(prop.nFileNameRID);
            }
        }
            public override bool Equals(object obj)
            {
                if (obj == null)
                {
                    return(false);
                }

                var s = obj as PropSnapShot;

                if (s == null)
                {
                    return(false);
                }

                if (maidProps.Count != s.maidProps.Count)
                {
                    return(false);
                }

                foreach (KeyValuePair <MPN, MaidProp> kv in maidProps)
                {
                    MPN      mpn      = kv.Key;
                    MaidProp maidProp = kv.Value;
                    MaidProp p;
                    if (!s.maidProps.TryGetValue(mpn, out p))
                    {
                        return(false);
                    }
                    if (maidProp.strFileName != p.strFileName ||
                        maidProp.strTempFileName != p.strTempFileName ||
                        maidProp.idx != p.idx ||
                        maidProp.name != p.name ||
                        maidProp.type != p.type ||
                        maidProp.value_Default != p.value_Default ||
                        maidProp.value != p.value ||
                        maidProp.temp_value != p.temp_value ||
                        maidProp.value_LinkMAX != p.value_LinkMAX ||
                        maidProp.nFileNameRID != p.nFileNameRID ||
                        maidProp.nTempFileNameRID != p.nTempFileNameRID ||
                        maidProp.max != p.max ||
                        maidProp.min != p.min
                        //  maidProp.boDut              != p.boDut              || // 内部処理用なので無視すること
                        //  maidProp.boTempDut          != p.boTempDut          ||
                        )
                    {
                        return(false);
                    }
                }

                for (int i = 0; i < (int)MaidParts.PARTS_COLOR.MAX; i++)
                {
                    MaidParts.PARTS_COLOR col = (MaidParts.PARTS_COLOR)i;
                    MaidParts.PartsColor  lhs = maidPartsColors[col];
                    MaidParts.PartsColor  rhs = s.maidPartsColors[col];
                    if (
                        lhs.m_bUse != rhs.m_bUse ||
                        lhs.m_nMainHue != rhs.m_nMainHue ||
                        lhs.m_nMainChroma != rhs.m_nMainChroma ||
                        lhs.m_nMainBrightness != rhs.m_nMainBrightness ||
                        lhs.m_nMainContrast != rhs.m_nMainContrast ||
                        lhs.m_nShadowRate != rhs.m_nShadowRate ||
                        lhs.m_nShadowHue != rhs.m_nShadowHue ||
                        lhs.m_nShadowChroma != rhs.m_nShadowChroma ||
                        lhs.m_nShadowBrightness != rhs.m_nShadowBrightness ||
                        lhs.m_nShadowContrast != rhs.m_nShadowContrast
                        )
                    {
                        return(false);
                    }
                }

                return(true);
            }
示例#26
0
 //[HarmonyPatch(typeof(Maid), "SetProp", new Type[] { typeof(MaidProp) })]
 //[HarmonyPostfix]
 // public void SetProp(MaidProp mps)
 public static void SetProp(MaidProp mps)
 {
     print("SetProp1", mps);
 }
示例#27
0
 /**
  * 오류 발생
  */
 public static void SetPropPreCall(Maid that, MaidProp mp, string filename, int f_nFileNameRID, bool f_bTemp, bool f_bNoScale)  // 후킹시 원본 클래스도 같이 받도록 돼있음
 // private void SetProp(MaidProp mp, string filename, int f_nFileNameRID, bool f_bTemp, bool f_bNoScale = false)
 {
     Lilly.Log(name + ".SetPropPreCall:" + filename);
 }
        // Token: 0x06000002 RID: 2 RVA: 0x000020A8 File Offset: 0x000002A8
        public void Update()
        {
            try
            {
                if (UserConfig.Instance.IsAutoShoesHide)
                {
                    List <Maid> visibleMaidList = CommonUtil.GetVisibleMaidList();
                    if (visibleMaidList.Count != 0)
                    {
                        string bgname = GameMain.Instance.BgMgr.GetBGName();
                        if (!(this._lastBGName == bgname) || this._lastMaidCount != visibleMaidList.Count)
                        {
                            if (Config.Instance.TargetBGList.Contains(bgname, StringComparer.OrdinalIgnoreCase))
                            {
                                using (List <Maid> .Enumerator enumerator = visibleMaidList.GetEnumerator())
                                {
                                    while (enumerator.MoveNext())
                                    {
                                        Maid maid = enumerator.Current;
                                        if (maid.IsAllProcPropBusy)
                                        {
                                            return;
                                        }
                                        if (maid.GetProp(MPN.shoes).strTempFileName != "_i_shoes_del.menu")
                                        {
                                            Menu.SetMaidItemTemp(maid, "_i_shoes_del.menu", true);
                                            maid.AllProcProp();
                                        }
                                    }
                                    goto IL_189;
                                }
                            }
                            foreach (Maid maid2 in visibleMaidList)
                            {
                                if (maid2.IsAllProcPropBusy)
                                {
                                    return;
                                }
                                bool flag = true;
                                foreach (MPN mpn in this.checkMPNs)
                                {
                                    MaidProp prop = maid2.GetProp(mpn);
                                    if (prop.strFileName == prop.strTempFileName)
                                    {
                                        flag = false;
                                        break;
                                    }
                                }
                                if (flag && maid2.GetProp(MPN.shoes).strTempFileName == "_i_shoes_del.menu")
                                {
                                    maid2.ResetProp(MPN.shoes, false);
                                    maid2.AllProcProp();
                                }
                            }
IL_189:
                            this._lastBGName    = bgname;
                            this._lastMaidCount = visibleMaidList.Count;
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }