Пример #1
0
 public static void HarmonyPatch_ChaFileStatus_MemberInit(ChaFileStatus __instance)
 {
     if (_charaData.saved)
     {
         DefaultParamEditor.Logger.LogDebug("Loading defaults for a new character");
         SetCharaValues(__instance);
     }
 }
Пример #2
0
        public static void UpdateState(OCIChar _ociChar, ChaFileStatus _status)
        {
            ChaFileStatus charFileStatus = _ociChar.charFileStatus;

            charFileStatus.Copy(_status);
            for (int _id = 0; _id < charFileStatus.clothesState.Length; ++_id)
            {
                _ociChar.SetClothesState(_id, charFileStatus.clothesState[_id]);
            }
            for (int _id = 0; _id < charFileStatus.showAccessory.Length; ++_id)
            {
                _ociChar.ShowAccessory(_id, charFileStatus.showAccessory[_id]);
            }
            int[] array1 = Singleton <Character> .Instance.chaListCtrl.GetCategoryInfo(_ociChar.sex != 0?ChaListDefine.CategoryNo.custom_eyebrow_f : ChaListDefine.CategoryNo.custom_eyebrow_m).Keys.ToArray <int>();

            _ociChar.charInfo.ChangeEyebrowPtn(!((IEnumerable <int>)array1).Contains <int>(charFileStatus.eyebrowPtn) ? 0 : charFileStatus.eyebrowPtn, true);
            int[] array2 = Singleton <Character> .Instance.chaListCtrl.GetCategoryInfo(_ociChar.sex != 0?ChaListDefine.CategoryNo.custom_eye_f : ChaListDefine.CategoryNo.custom_eye_m).Keys.ToArray <int>();

            _ociChar.charInfo.ChangeEyesPtn(!((IEnumerable <int>)array2).Contains <int>(charFileStatus.eyesPtn) ? 0 : charFileStatus.eyesPtn, true);
            _ociChar.ChangeBlink(charFileStatus.eyesBlink);
            _ociChar.ChangeEyesOpen(charFileStatus.eyesOpenMax);
            _ociChar.charInfo.ChangeMouthPtn(charFileStatus.mouthPtn, true);
            _ociChar.ChangeMouthOpen(_ociChar.oiCharInfo.mouthOpen);
            _ociChar.ChangeHandAnime(0, _ociChar.oiCharInfo.handPtn[0]);
            _ociChar.ChangeHandAnime(1, _ociChar.oiCharInfo.handPtn[1]);
            _ociChar.ChangeLookEyesPtn(charFileStatus.eyesLookPtn, true);
            if (_ociChar.oiCharInfo.eyesByteData != null)
            {
                using (MemoryStream memoryStream = new MemoryStream(_ociChar.oiCharInfo.eyesByteData))
                {
                    using (BinaryReader reader = new BinaryReader((Stream)memoryStream))
                        _ociChar.charInfo.eyeLookCtrl.eyeLookScript.LoadAngle(reader);
                }
                _ociChar.oiCharInfo.eyesByteData = (byte[])null;
            }
            if (_ociChar.oiCharInfo.neckByteData != null)
            {
                using (MemoryStream memoryStream = new MemoryStream(_ociChar.oiCharInfo.neckByteData))
                {
                    using (BinaryReader reader = new BinaryReader((Stream)memoryStream))
                        _ociChar.neckLookCtrl.LoadNeckLookCtrl(reader);
                }
                _ociChar.oiCharInfo.neckByteData = (byte[])null;
            }
            _ociChar.ChangeLookNeckPtn(charFileStatus.neckLookPtn);
            for (int index = 0; index < 5; ++index)
            {
                _ociChar.SetSiruFlags((ChaFileDefine.SiruParts)index, _ociChar.oiCharInfo.siru[index]);
            }
            if (_ociChar.sex == 1)
            {
                _ociChar.charInfo.ChangeHohoAkaRate(charFileStatus.hohoAkaRate);
            }
            _ociChar.SetVisibleSon(charFileStatus.visibleSonAlways);
            _ociChar.SetTears(_ociChar.GetTears());
            _ociChar.SetTuyaRate(_ociChar.charInfo.skinGlossRate);
            _ociChar.SetWetRate(_ociChar.charInfo.wetRate);
        }
Пример #3
0
        public override void Do()
        {
            base.Do();
            int num1 = 0;

            string[]   args1   = this.args;
            int        index1  = num1;
            int        num2    = index1 + 1;
            CharaData  chara   = this.scenario.commandController.GetChara(int.Parse(args1[index1]));
            ChaControl chaCtrl = chara.chaCtrl;

            string[] args2  = this.args;
            int      index2 = num2;
            int      num3   = index2 + 1;
            int      num4   = args2[index2].Check(true, Enum.GetNames(typeof(CharaVisible.Target)));

            string[] args3  = this.args;
            int      index3 = num3;
            int      num5   = index3 + 1;
            bool     flag   = bool.Parse(args3[index3]);

            string[]        args4  = this.args;
            int             index4 = num5;
            int             num6   = index4 + 1;
            Action <string> act    = (Action <string>)(findName =>
            {
                Transform characterStandNull = this.scenario.commandController.characterStandNulls[findName];
                chara.transform.SetPositionAndRotation(characterStandNull.get_position(), characterStandNull.get_rotation());
            });

            args4.SafeProc(index4, act);
            ChaFileStatus fileStatus = chaCtrl.fileStatus;

            switch (num4)
            {
            case 0:
                chaCtrl.visibleAll = flag;
                break;

            case 1:
                fileStatus.visibleHeadAlways = flag;
                break;

            case 2:
                fileStatus.visibleBodyAlways = flag;
                break;

            case 3:
                fileStatus.visibleSonAlways = flag;
                break;

            case 4:
                fileStatus.visibleGomu = flag;
                break;
            }
        }
Пример #4
0
        private static void ChaFileStatus_set_shoesTypeHook(ChaFileStatus __instance)
        {
            var cc = FindObjectsOfType <ChaControl>().Where(x => x?.chaFile?.status == __instance).FirstOrDefault();

            if (cc == null)
            {
                return;
            }
            var ind = cc.fileStatus.shoesType == 0 ? 8 : 7;

            ChangeCustomClothesHook(cc, ref ind);
        }
Пример #5
0
            internal static void ChaFileStatus_ShoesType_Postfix(ChaFileStatus __instance)
            {
                ChaControl _chaCtrl = FindObjectsOfType <ChaControl>().Where(x => x?.chaFile?.status == __instance).FirstOrDefault();

                if (_chaCtrl != null)
                {
                    AccStateSyncController _pluginCtrl = GetController(_chaCtrl);
                    if (_pluginCtrl != null)
                    {
                        int clothesKind = __instance.shoesType == 0 ? 7 : 8;
                        _pluginCtrl.ToggleByRefKind(clothesKind);
                    }
                }
            }
Пример #6
0
        private static void SetCharaValues(ChaFileStatus chaFileStatus)
        {
            chaFileStatus.clothesState = _charaData.clothesState.ToArray();
            chaFileStatus.shoesType    = _charaData.shoesType;
            chaFileStatus.hohoAkaRate  = _charaData.hohoAkaRate;
            chaFileStatus.nipStandRate = _charaData.nipStandRate;
            chaFileStatus.tearsLv      = _charaData.tearsLv;

            chaFileStatus.eyesLookPtn = _charaData.eyesLookPtn;
            chaFileStatus.neckLookPtn = _charaData.neckLookPtn;
            chaFileStatus.eyebrowPtn  = _charaData.eyebrowPtn;
            chaFileStatus.eyesPtn     = _charaData.eyesPtn;
            chaFileStatus.eyesOpenMax = _charaData.eyesOpenMax;
            chaFileStatus.eyesBlink   = _charaData.eyesBlink;
            chaFileStatus.mouthPtn    = _charaData.mouthPtn;
        }
Пример #7
0
        private static void ChaFileStatus_Set_ShoesTypeHook(ChaFileStatus __instance)
        {
            var chaControl = FindObjectsOfType <ChaControl>().Where(x => x?.chaFile?.status == __instance).FirstOrDefault();

            if (chaControl == null)
            {
                return;
            }

            if (chaControl.fileStatus.shoesType == 0)
            {
                HookChaControlClothes(chaControl, (int)ClothesKind.shoes_outer);
            }
            else
            {
                HookChaControlClothes(chaControl, (int)ClothesKind.shoes_inner);
            }
        }
Пример #8
0
 public override void Do()
 {
   base.Do();
   int num1 = 0;
   string[] args1 = this.args;
   int index1 = num1;
   int num2 = index1 + 1;
   ChaFileStatus status = this.scenario.commandController.GetChara(int.Parse(args1[index1])).chaCtrl.fileStatus;
   ChaFileStatus chaFileStatus = status;
   string[] args2 = this.args;
   int index2 = num2;
   int num3 = index2 + 1;
   int num4 = bool.Parse(args2[index2]) ? 1 : 0;
   chaFileStatus.visibleSimple = num4 != 0;
   string[] args3 = this.args;
   int index3 = num3;
   int num5 = index3 + 1;
   Action<string> act = (Action<string>) (colorStr => status.simpleColor = colorStr.GetColorCheck().Value);
   args3.SafeProc(index3, act);
 }
Пример #9
0
        public static void HarmonyPatch_ChaFileStatus_MemberInit(ChaFileStatus __instance)
        {
            if (_charaData.saved)
            {
                Log(LogLevel.Debug, "Loading defaults for a new character");

                __instance.clothesState = _charaData.clothesState.ToArray();
                __instance.shoesType    = _charaData.shoesType;
                __instance.hohoAkaRate  = _charaData.hohoAkaRate;
                __instance.nipStandRate = _charaData.nipStandRate;
                __instance.tearsLv      = _charaData.tearsLv;

                __instance.eyesLookPtn = _charaData.eyesLookPtn;
                __instance.neckLookPtn = _charaData.neckLookPtn;
                __instance.eyebrowPtn  = _charaData.eyebrowPtn;
                __instance.eyesPtn     = _charaData.eyesPtn;
                __instance.eyesOpenMax = _charaData.eyesOpenMax;
                __instance.eyesBlink   = _charaData.eyesBlink;
                __instance.mouthPtn    = _charaData.mouthPtn;
            }
        }
Пример #10
0
        /// <summary>
        /// Returns int index of currently selected coordinate from the character in CharaMaker.
        /// </summary>
        public static int GetCurrentlyAssignedCoordinateType()
        {
            ChaFileStatus chaFileStatus = MakerAPI.GetCharacterControl().fileStatus;

            return(chaFileStatus.coordinateType);
        }
Пример #11
0
 public static void SetExtendedDataById(this ChaFileStatus messagePackObject, string id, PluginData data) => SetExtendedData(messagePackObject, id, data);
Пример #12
0
 public static bool TryGetExtendedDataById(this ChaFileStatus messagePackObject, string id, out PluginData data) => GetExtendedData(messagePackObject, id, out data);
 private static void Copy(ChaFileStatus __instance, ChaFileStatus src) => Traverse.Create(__instance).Property(ExtendedSaveDataPropertyName).SetValue(Traverse.Create(src).Property(ExtendedSaveDataPropertyName).GetValue());
 private static void MemberInit(ChaFileStatus __instance) => Traverse.Create(__instance).Property(ExtendedSaveDataPropertyName).SetValue(null);
Пример #15
0
        private static OCICharFemale Add(
            ChaControl _female,
            OICharInfo _info,
            ObjectCtrlInfo _parent,
            TreeNodeObject _parentNode,
            bool _addInfo,
            int _initialPosition)
        {
            OCICharFemale ociCharFemale = new OCICharFemale();
            ChaFileStatus _status       = new ChaFileStatus();

            _status.Copy(_female.fileStatus);
            _female.ChangeNowCoordinate(false, true);
            _female.Load(true);
            _female.InitializeExpression(1, true);
            ociCharFemale.charInfo         = _female;
            ociCharFemale.charReference    = (ChaReference)_female;
            ociCharFemale.preparation      = (Preparation)_female.objAnim.GetComponent <Preparation>();
            ociCharFemale.finalIK          = _female.fullBodyIK;
            ociCharFemale.charInfo.hideMoz = false;
            for (int index = 0; index < 2; ++index)
            {
                GameObject gameObject = _female.objHair.SafeGet <GameObject>(index);
                if (Object.op_Inequality((Object)gameObject, (Object)null))
                {
                    AddObjectAssist.ArrangeNames(gameObject.get_transform());
                }
            }
            AddObjectAssist.SetupAccessoryDynamicBones((OCIChar)ociCharFemale);
            AddObjectAssist.DisableComponent((OCIChar)ociCharFemale);
            ociCharFemale.objectInfo = (ObjectInfo)_info;
            GuideObject guideObject = Singleton <GuideObjectManager> .Instance.Add(((Component)_female).get_transform(), _info.dicKey);

            guideObject.scaleSelect   = 0.1f;
            guideObject.scaleRot      = 0.05f;
            guideObject.isActiveFunc += new GuideObject.IsActiveFunc(((ObjectCtrlInfo)ociCharFemale).OnSelect);
            guideObject.SetVisibleCenter(true);
            ociCharFemale.guideObject               = guideObject;
            ociCharFemale.optionItemCtrl            = (OptionItemCtrl)((Component)_female).get_gameObject().AddComponent <OptionItemCtrl>();
            ociCharFemale.optionItemCtrl.animator   = _female.animBody;
            ociCharFemale.optionItemCtrl.oiCharInfo = _info;
            _info.changeAmount.onChangeScale       += new Action <Vector3>(ociCharFemale.optionItemCtrl.ChangeScale);
            ociCharFemale.charAnimeCtrl             = ociCharFemale.preparation?.CharAnimeCtrl;
            if (Object.op_Implicit((Object)ociCharFemale.charAnimeCtrl))
            {
                ociCharFemale.charAnimeCtrl.oiCharInfo = _info;
            }
            ociCharFemale.yureCtrl = ociCharFemale.preparation.YureCtrl;
            ociCharFemale.yureCtrl.Init((OCIChar)ociCharFemale);
            if (_info.animeInfo.group == 0 && _info.animeInfo.category == 2 && _info.animeInfo.no == 11)
            {
                int   group               = _info.animeInfo.group;
                int   category            = _info.animeInfo.category;
                int   no                  = _info.animeInfo.no;
                float animeNormalizedTime = _info.animeNormalizedTime;
                ociCharFemale.LoadAnime(0, 1, 0, 0.0f);
                _female.animBody.Update(0.0f);
                _info.animeInfo.group     = group;
                _info.animeInfo.category  = category;
                _info.animeInfo.no        = no;
                _info.animeNormalizedTime = animeNormalizedTime;
            }
            IKSolver ikSolver = ((IK)ociCharFemale.finalIK).GetIKSolver();

            if (!ikSolver.get_initiated())
            {
                ikSolver.Initiate(((Component)ociCharFemale.finalIK).get_transform());
            }
            if (_addInfo)
            {
                Studio.Studio.AddInfo((ObjectInfo)_info, (ObjectCtrlInfo)ociCharFemale);
            }
            else
            {
                Studio.Studio.AddObjectCtrlInfo((ObjectCtrlInfo)ociCharFemale);
            }
            TreeNodeObject _parent1       = !Object.op_Inequality((Object)_parentNode, (Object)null) ? (_parent == null ? (TreeNodeObject)null : _parent.treeNodeObject) : _parentNode;
            TreeNodeObject treeNodeObject = Studio.Studio.AddNode(_info.charFile.parameter.fullname, _parent1);

            treeNodeObject.enableChangeParent      = true;
            treeNodeObject.treeState               = _info.treeState;
            treeNodeObject.onVisible              += new TreeNodeObject.OnVisibleFunc(((ObjectCtrlInfo)ociCharFemale).OnVisible);
            treeNodeObject.enableVisible           = true;
            treeNodeObject.visible                 = _info.visible;
            guideObject.guideSelect.treeNodeObject = treeNodeObject;
            ociCharFemale.treeNodeObject           = treeNodeObject;
            _info.changeAmount.OnChange();
            AddObjectAssist.InitBone((OCIChar)ociCharFemale, _female.objBodyBone.get_transform(), Singleton <Info> .Instance.dicBoneInfo);
            AddObjectAssist.InitIKTarget((OCIChar)ociCharFemale, _addInfo);
            AddObjectAssist.InitLookAt((OCIChar)ociCharFemale);
            AddObjectAssist.InitAccessoryPoint((OCIChar)ociCharFemale);
            ociCharFemale.voiceCtrl.ociChar = (OCIChar)ociCharFemale;
            ociCharFemale.InitKinematic(((Component)_female).get_gameObject(), ociCharFemale.finalIK, _female.neckLookCtrl, (DynamicBone[])null, AddObjectFemale.GetSkirtDynamic(_female.objClothes));
            treeNodeObject.enableAddChild = false;
            Studio.Studio.AddCtrlInfo((ObjectCtrlInfo)ociCharFemale);
            _parent?.OnLoadAttach(!Object.op_Inequality((Object)_parentNode, (Object)null) ? _parent.treeNodeObject : _parentNode, (ObjectCtrlInfo)ociCharFemale);
            if (_initialPosition == 1)
            {
                _info.changeAmount.pos = Singleton <Studio.Studio> .Instance.cameraCtrl.targetPos;
            }
            ociCharFemale.LoadAnime(_info.animeInfo.group, _info.animeInfo.category, _info.animeInfo.no, _info.animeNormalizedTime);
            for (int index = 0; index < 5; ++index)
            {
                ociCharFemale.ActiveIK((OIBoneInfo.BoneGroup)(1 << index), _info.activeIK[index], false);
            }
            ociCharFemale.ActiveKinematicMode(OICharInfo.KinematicMode.IK, _info.enableIK, true);
            // ISSUE: object of a compiler-generated type is created
            foreach (\u003C\u003E__AnonType18 <OIBoneInfo.BoneGroup, int> anonType18 in ((IEnumerable <OIBoneInfo.BoneGroup>)FKCtrl.parts).Select <OIBoneInfo.BoneGroup, \u003C\u003E__AnonType18 <OIBoneInfo.BoneGroup, int> >((Func <OIBoneInfo.BoneGroup, int, \u003C\u003E__AnonType18 <OIBoneInfo.BoneGroup, int> >)((p, i) => new \u003C\u003E__AnonType18 <OIBoneInfo.BoneGroup, int>(p, i))))
            {
                ociCharFemale.ActiveFK(anonType18.p, ociCharFemale.oiCharInfo.activeFK[anonType18.i], false);
            }
            ociCharFemale.ActiveKinematicMode(OICharInfo.KinematicMode.FK, _info.enableFK, true);
            for (int categoryNo = 0; categoryNo < _info.expression.Length; ++categoryNo)
            {
                ociCharFemale.charInfo.EnableExpressionCategory(categoryNo, _info.expression[categoryNo]);
            }
            ociCharFemale.animeSpeed        = ociCharFemale.animeSpeed;
            ociCharFemale.animeOptionParam1 = ociCharFemale.animeOptionParam1;
            ociCharFemale.animeOptionParam2 = ociCharFemale.animeOptionParam2;
            foreach (byte num in _female.fileStatus.siruLv)
            {
                num = (byte)0;
            }
            _status.visibleSonAlways = _info.visibleSon;
            ociCharFemale.SetSonLength(_info.sonLength);
            ociCharFemale.SetVisibleSimple(_info.visibleSimple);
            ociCharFemale.SetSimpleColor(_info.simpleColor);
            AddObjectAssist.UpdateState((OCIChar)ociCharFemale, _status);
            return(ociCharFemale);
        }