private static void CheckPersonalityAndOverride(ChaFileControl chaFileControl)
        {
            switch (chaFileControl.parameter.personality)
            {
            case 30:     //0727 Free DLC
                if (!AssetBundleCheck.IsFile("etcetra/list/config/14.unity3d"))
                {
                    chaFileControl.parameter.personality = DefaultPersonality;
                }
                break;

            case 31:     //0727 Paid DLC #1
                if (!AssetBundleCheck.IsFile("etcetra/list/config/15.unity3d"))
                {
                    chaFileControl.parameter.personality = DefaultPersonality;
                }
                break;

            case 32:     //0727 Paid DLC #1
                if (!AssetBundleCheck.IsFile("etcetra/list/config/16.unity3d"))
                {
                    chaFileControl.parameter.personality = DefaultPersonality;
                }
                break;

            case 33:     //0727 Paid DLC #1
                if (!AssetBundleCheck.IsFile("etcetra/list/config/17.unity3d"))
                {
                    chaFileControl.parameter.personality = DefaultPersonality;
                }
                break;

            case 34:
            case 35:
            case 36:
            case 37:     //1221 Paid DLC #2
                if (!AssetBundleCheck.IsFile("etcetra/list/config/20.unity3d"))
                {
                    chaFileControl.parameter.personality = DefaultPersonality;
                }
                break;

            case 38:     //EmotionCreators preorder bonus personality
                if (!AssetBundleCheck.IsFile("etcetra/list/config/50.unity3d"))
                {
                    chaFileControl.parameter.personality = DefaultPersonality;
                }
                break;

            case 80:
            case 81:
            case 82:
            case 83:
            case 84:
            case 85:
            case 86:     //Story character personalities added by a mod
                chaFileControl.parameter.personality = DefaultPersonality;
                break;
            }
        }
Пример #2
0
        public static bool ConvertCharaFilePath(ref ChaFileControl __instance, ref string __result, string path)
        {
            // Should only work during main game
            var gmode = KoikatuAPI.GetCurrentGameMode();

            if (gmode != GameMode.MainGame && gmode != GameMode.Maker)
            {
                return(true);
            }
            if (path == null)
            {
                return(true);
            }

            if (!path.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
            {
                path += ".png";
            }

            if (File.Exists(path))
            {
                __result = path;
                return(false);
            }

            if (File.Exists(UserData.Path + "chara/female/" + path))
            {
                __result = UserData.Path + "chara/female/" + path;
                return(false);
            }

            return(true);
        }
Пример #3
0
        public void ChangeOutfit_Internal(bool reset)
        {
            // Reset all before changing outfits.
            ChaFileControl chaFileCtrl = ChaCtrl.chaFile;
            ChaFileControl charFile    = CharFile;
            string         fullname    = chaFileCtrl.parameter.fullname;

            chaFileCtrl.CopyCoordinate(charFile.coordinate);
            chaFileCtrl.CopyCustom(charFile.custom);

            KKABMXHelper kkabmxHelper = new KKABMXHelper(charFile);
            KCOXHelper   kcoxHelper   = new KCOXHelper(charFile);
            KSOXHelper   ksoxHelper   = new KSOXHelper(charFile);

            // Failing to roll will use original outfit instead.
            if (!reset && Controller.RollForOutfit(out List <Layer> layers, out List <Card> cards, fullname))
            {
                for (int i = 0; i < layers.Count; i++)
                {
                    Layer layer = layers[i];
                    Card  card  = cards[i];
                    layer.checkList.Apply(card.chaFileCtrl, chaFileCtrl);
                    layer.checkList_KKABMX.Apply(card.KKABMX, kkabmxHelper);
                    layer.checkList_KCOX.Apply(card.KCOX, kcoxHelper);
                    layer.checkList_KSOX.Apply(card.KSOX, ksoxHelper);
                }
            }

            ChangeOutfit_Internal_KKABMX(kkabmxHelper);
            ChangeOutfit_Internal_KCOX(kcoxHelper);
            ChangeOutfit_Internal_KSOX(ksoxHelper);

            _reloadPending = 10;
        }
Пример #4
0
        internal static void ChaFileControl_LoadCharaFile_Postfix(ChaFileControl __instance)
        {
            try
            {
                if (!_inMapSelecCursorEnter || __instance == null)
                {
                    return;
                }
                var label = InMapSelecCursorLabels[_inMapSelecCursorEnterIndex];
                InMapSelecCursorLabels[_inMapSelecCursorEnterIndex] = null;
                _inMapSelecCursorEnterIndex++;

                if (label == null || !TranslationHelper.CardNameManager.CardNeedsTranslation(__instance))
                {
                    return;
                }
                __instance.TranslateFullName(r =>
                {
                    if (string.IsNullOrEmpty(r) || label == null)
                    {
                        return;
                    }
                    TranslationHelper.Instance.StartCoroutine(UpdateText(label, r));
                });
            }

            catch (Exception err)
            {
                Logger.LogException(err, nameof(ChaFileControl_LoadCharaFile_Postfix));
            }
        }
        void SetupCharacter(string path, ResultType type)
        {
            var chaFileControl = new ChaFileControl();

            if (chaFileControl.LoadCharaFile(path, 255, false, true))
            {
                var hscene = FindObjectOfType <FreeHScene>();
                var member = Traverse.Create(hscene).Field("member");

                switch (type)
                {
                case ResultType.Heroine:
                    member.Field("resultHeroine").Property("Value").SetValue(new SaveData.Heroine(chaFileControl, false));
                    break;

                case ResultType.Player:
                    member.Field("resultPlayer").Property("Value").SetValue(new SaveData.Player(chaFileControl, false));
                    break;

                case ResultType.Partner:
                    member.Field("resultPartner").Property("Value").SetValue(new SaveData.Heroine(chaFileControl, false));
                    break;
                }
            }
        }
Пример #6
0
        public KKABMXHelper(ChaFileControl chaFileCtrl = null)
        {
            int count = Enum.GetValues(typeof(ChaFileDefine.CoordinateType)).Length;

            KKABMX           = new Dictionary <string, Dictionary <string, Dictionary <string, BoneModifier> > >();
            KKABMXCoordinate = new Dictionary <string, Dictionary <string, Dictionary <string, BoneModifier> > > [count];
            List <BoneModifier> data = chaFileCtrl?.KKABMXData().BoneModifiers();

            for (int i = 0; i < count; i++)
            {
                KKABMXCoordinate[i] =
                    new Dictionary <string, Dictionary <string, Dictionary <string, BoneModifier> > >();
            }

            foreach (BoneMeta meta in InterfaceData.BoneControls)
            {
                if (meta.UniquePerCoordinate)
                {
                    foreach (var dictionary in KKABMXCoordinate)
                    {
                        Set(dictionary, meta, data);
                    }
                }
                else
                {
                    Set(KKABMX, meta, data);
                }
            }
        }
Пример #7
0
        /// <summary>
        /// Get the persisting AgentData (heroine) object that describes this character.
        /// Returns null if the AgentData (heroine) could not be found. Works only in the main game.
        /// </summary>
        public static AgentData GetHeroine(this ChaFileControl chaFile)
        {
            if (chaFile == null)
            {
                throw new ArgumentNullException(nameof(chaFile));
            }

            if (!Manager.Map.IsInstance())
            {
                return(null);
            }

            var agentTable = Manager.Map.Instance.AgentTable;

            if (agentTable == null || agentTable.Count <= 0)
            {
                return(null);
            }

            foreach (int key in agentTable.Keys)
            {
                if (agentTable.TryGetValue(key, out AgentActor agentActor))
                {
                    if (agentActor?.ChaControl?.chaFile == chaFile)
                    {
                        return(agentActor.AgentData);
                    }
                }
            }
            return(null);
        }
        private static void AddPregnancyWeek(ChaFileControl chaFile)
        {
            var data = ExtendedSave.GetExtendedDataById(chaFile, PregnancyPlugin.GUID);

            if (data == null)
            {
                return;
            }

            PregnancyDataUtils.DeserializeData(data, out var week, out var gameplayEnabled, out var fertility, out var schedule);
            // Advance the week of pregnancy. If week is 0 the character is not pregnant
            if (gameplayEnabled && week > 0)
            {
                if (week < PregnancyDataUtils.LeaveSchoolWeek)
                {
                    // Advance through in-school at full configured speed
                    var weekChange = PregnancyPlugin.PregnancyProgressionSpeed.Value;
                    week = Mathf.Min(PregnancyDataUtils.LeaveSchoolWeek, week + weekChange);
                }
                else if (week < PregnancyDataUtils.ReturnToSchoolWeek)
                {
                    // Make sure at least one week is spent out of school
                    var weekChange = Mathf.Min(PregnancyDataUtils.ReturnToSchoolWeek - PregnancyDataUtils.LeaveSchoolWeek - 1, PregnancyPlugin.PregnancyProgressionSpeed.Value);
                    week = week + weekChange;
                }

                if (week >= PregnancyDataUtils.ReturnToSchoolWeek)
                {
                    week = 0;
                }

                //Logger.Log(LogLevel.Debug, $"Preg - pregnancy week for {chaFile.parameter.fullname} is now {week}");
                ExtendedSave.SetExtendedDataById(chaFile, PregnancyPlugin.GUID, PregnancyDataUtils.SerializeData(week, true, fertility, schedule));
            }
        }
Пример #9
0
        internal static void RosterSetCharaInfoPostfix(Component __instance, ChaFileControl chaFileCtrl, object __state)
        {
            try
            {
                if (__state == null || !(bool)__state)
                {
                    return;
                }

                void UpdateDisplayedCard(string name)
                {
                    if (string.IsNullOrEmpty(name))
                    {
                        return;
                    }
                    foreach (var textName in FindChildComponents <Text>(__instance, "textName",
                                                                        "resize/text/name", "resize/image/chara"))
                    {
                        textName.SafeProc(tn => tn.text = name);
                    }
                }

                chaFileCtrl.TranslateFullName(UpdateDisplayedCard);

                FreeHUpdateUI();
            }

            catch (Exception err)
            {
                Logger.LogException(err, __instance, nameof(RosterSetCharaInfoPostfix));
            }
        }
Пример #10
0
            private static void LoadFacePresetPrefix(ChaFileControl __instance, ref HeadPresetInfo __state)
            {
                __state = null;
                int headID = __instance.custom.face.headId;

                if (headID >= BaseSlotID)
                {
                    ChaListControl chaListCtrl = Singleton <Character> .Instance.chaListCtrl;
                    ListInfoBase   listInfo    = chaListCtrl.GetListInfo(__instance.parameter.sex == 0 ? ChaListDefine.CategoryNo.mo_head : ChaListDefine.CategoryNo.fo_head, __instance.custom.face.headId);
                    string         preset      = listInfo.GetInfo(ChaListDefine.KeyType.Preset);

                    var resolveinfo = TryGetResolutionInfo(__instance.parameter.sex == 0 ? ChaListDefine.CategoryNo.mo_head : ChaListDefine.CategoryNo.fo_head, __instance.custom.face.headId);
                    if (resolveinfo == null)
                    {
                        return;
                    }

                    var headPresetInfo = TryGetHeadPresetInfo(resolveinfo.Slot, resolveinfo.GUID, preset);
                    __state = headPresetInfo;
                }
                else
                {
                    ChaListControl chaListCtrl = Singleton <Character> .Instance.chaListCtrl;
                    ListInfoBase   listInfo    = chaListCtrl.GetListInfo(__instance.parameter.sex == 0 ? ChaListDefine.CategoryNo.mo_head : ChaListDefine.CategoryNo.fo_head, __instance.custom.face.headId);
                    string         preset      = listInfo.GetInfo(ChaListDefine.KeyType.Preset);

                    var headPresetInfo = TryGetHeadPresetInfo(headID, null, preset);
                    __state = headPresetInfo;
                }
            }
Пример #11
0
        public KCOXHelper(ChaFileControl chaFileCtrl = null)
        {
            KCOX = new Dictionary <string, Dictionary <string, ClothesTexData> >();

            ChaFileDefine.CoordinateType[] coordinates =
                Enum.GetValues(typeof(ChaFileDefine.CoordinateType)) as ChaFileDefine.CoordinateType[];
            Dictionary <ChaFileDefine.CoordinateType, Dictionary <string, ClothesTexData> > data =
                chaFileCtrl?.KCOXData().KCOXDictionary();

            foreach (ChaFileDefine.CoordinateType type in coordinates)
            {
                Dictionary <string, ClothesTexData> dictionary = KCOX[type.ToString()] =
                    new Dictionary <string, ClothesTexData>();

                foreach (string idx in KoiClothesOverlayMgr.MainClothesNames)
                {
                    dictionary[idx] = null;
                }

                foreach (string idx in KoiClothesOverlayMgr.SubClothesNames)
                {
                    dictionary[idx] = null;
                }

                if (data == null || !data.ContainsKey(type))
                {
                    continue;
                }

                foreach (KeyValuePair <string, ClothesTexData> pair in data[type])
                {
                    dictionary[pair.Key] = pair.Value;
                }
            }
        }
Пример #12
0
        internal static void RosterSetCharaInfoPrefix(Component __instance, ChaFileControl chaFileCtrl,
                                                      ref object __state)
        {
            // ReSharper disable once RedundantAssignment - used in DEBUG
            var start = Time.realtimeSinceStartup;

            try
            {
                __state = false;
                if (!ShouldProcess(__instance, chaFileCtrl) ||
                    !GeBoAPI.Instance.AutoTranslationHelper.IsTranslatable(chaFileCtrl.GetFullName()))
                {
                    return;
                }

                __state = true;
                chaFileCtrl.StartMonitoredCoroutine(TranslationHelper.CardNameManager.TranslateCardNames(chaFileCtrl));
            }
            catch (Exception err)
            {
                Logger.LogException(err, __instance, nameof(RosterSetCharaInfoPrefix));
            }
            finally
            {
                Logger.DebugLogDebug($"RosterSetCharaInfoPrefix: {Time.realtimeSinceStartup - start:000.0000000000}");
            }
        }
Пример #13
0
        private void SetupCharacter(string path, ResultType type)
        {
            var chaFileControl = new ChaFileControl();

            if (chaFileControl.LoadCharaFile(path, 255, false, true))
            {
                var hscene = GameObject.FindObjectOfType <FreeHScene>();
                var member = hscene.member;

                switch (type)
                {
                case ResultType.Heroine:
                    member.resultHeroine.Value = new SaveData.Heroine(chaFileControl, false);
                    break;

                case ResultType.Player:
                    member.resultPlayer.Value = new SaveData.Player(chaFileControl, false);
                    break;

                case ResultType.Partner:
                    member.resultPartner.Value = new SaveData.Heroine(chaFileControl, false);
                    break;
                }
            }
        }
Пример #14
0
        private void SetupCharacter(string path, ResultType type)
        {
            var chaFileControl = new ChaFileControl();

            if (chaFileControl.LoadOrImportCharaFile(path))
            {
                var hscene = GameObject.FindObjectOfType <FreeHScene>();
                var member = hscene.member;

                switch (type)
                {
                case ResultType.Heroine:
                    member.resultHeroine.Value = new SaveData.Heroine(chaFileControl, false);
                    break;

                case ResultType.Player:
                    member.resultPlayer.Value = new SaveData.Player(chaFileControl, false);
                    break;

                case ResultType.Partner:
                    member.resultPartner.Value = new SaveData.Heroine(chaFileControl, false);
                    break;
                }
            }
            else
            {
                DragAndDrop.LogCardLoadError(chaFileControl);
            }
        }
Пример #15
0
        private void RestoreCardNames()
        {
            Logger?.DebugLogDebug($"Controller.RestoreCardNames: {RegistrationID}");
            if (!IsTranslated || TranslationHelper.IsShuttingDown || GeBoAPI.Instance == null)
            {
                return;
            }
            IsTranslated = false;
            for (var i = 0; i < GeBoAPI.Instance.ChaFileNames.Count; i++)
            {
                // only restore value if it hasn't been changed
                if (OriginalNames[i] == null)
                {
                    continue;
                }

                var current = ChaFileControl.GetName(i);
                if (current == TranslatedNames[i])
                {
                    ChaFileControl.SetName(i, OriginalNames[i]);
                }
                else
                {
                    // value has changed, so dump the translation and update original
                    TranslatedNames[i] = null;
                    OriginalNames[i]   = current;
                }
            }
        }
Пример #16
0
        /// <summary>
        /// Load and set the character
        /// </summary>
        private void SetupCharacter(string filePath, CharacterType characterType)
        {
            var chaFileControl = new ChaFileControl();

            if (chaFileControl.LoadCharaFile(filePath, 255, false, true))
            {
                FreeHScene.Member member = (FreeHScene.Member) Singleton <FreeHScene> .Instance.GetType().GetField("member", AccessTools.all).GetValue(Singleton <FreeHScene> .Instance);

                switch (characterType)
                {
                case CharacterType.Heroine:
                    member.resultHeroine.SetValueAndForceNotify(new SaveData.Heroine(chaFileControl, false));
                    break;

                case CharacterType.Partner:
                    member.resultPartner.SetValueAndForceNotify(new SaveData.Heroine(chaFileControl, false));
                    break;

                case CharacterType.Female3P:
                    if (GameObject.Find("FreeHScene/Canvas/Panel/3P/Stage1").activeInHierarchy)
                    {
                        member.resultHeroine.SetValueAndForceNotify(new SaveData.Heroine(chaFileControl, false));
                    }
                    else
                    {
                        member.resultPartner.SetValueAndForceNotify(new SaveData.Heroine(chaFileControl, false));
                    }
                    break;

                case CharacterType.Player:
                    member.resultPlayer.SetValueAndForceNotify(new SaveData.Player(chaFileControl, false));
                    break;
                }
            }
        }
        internal static bool RandomCharaPickOverride(int num, ref ChaFileControl[] __result)
        {
            if (KK_BrowserFolders.RandomCharaSubfolders?.Value != true)
            {
                return(true);
            }

            var path = Path.Combine(UserData.Path, "chara/female");

            if (!Directory.Exists(path))
            {
                __result = new ChaFileControl[0];
                return(false);
            }

            // Grab from all subdirs
            var results = Directory.GetFiles(path, "*.png", SearchOption.AllDirectories);

            // Try to load cards until enough load successfully
            __result = results.Shuffle().Attempt(f =>
            {
                var chaFileControl = new ChaFileControl();
                if (chaFileControl.LoadCharaFile(f, 1, true, true))
                {
                    if (chaFileControl.parameter.sex != 0)
                    {
                        return(chaFileControl);
                    }
                }
                return(null);
            }).Where(x => x != null).Take(num).ToArray();
            return(false);
        }
Пример #18
0
        public KSOXHelper(ChaFileControl chaFileCtrl = null)
        {
            KSOX = new Dictionary <string, OverlayTexture>();

            TexType[] types = Enum.GetValues(typeof(TexType)) as TexType[];
            Dictionary <TexType, OverlayTexture> data = chaFileCtrl?.KSOXData().KSOXDictionary();

            foreach (TexType type in types)
            {
                if (type == TexType.Unknown)
                {
                    continue;
                }

                string key = type.ToString();

                if (data != null && data.ContainsKey(type))
                {
                    KSOX[key] = data[type];
                }
                else
                {
                    KSOX[key] = null;
                }
            }
        }
            internal static void LoadFileLimitedPostfix(ChaFileControl __instance)
            {
                //Find the toggle set
                var cvsEye02 = CustomBase.Instance.gameObject.GetComponentInChildren <CvsEye02>(true);

                if (cvsEye02 == null)
                {
                    return;
                }

                var toggles = (Toggle[])Traverse.Create(cvsEye02).Field("tglEyeSetType")?.GetValue();

                if (toggles == null)
                {
                    return;
                }

                int pupil1    = __instance.custom.face.pupil[0].id;
                int pupil2    = __instance.custom.face.pupil[1].id;
                int gradient1 = __instance.custom.face.pupil[0].gradMaskId;
                int gradient2 = __instance.custom.face.pupil[1].gradMaskId;

                //If edit to both is selected, select edit to left so the character can load properly
                if (toggles[0].isOn && (pupil1 != pupil2 || gradient1 != gradient2))
                {
                    toggles[1].isOn = true;
                }
            }
            internal static bool LoadFromAssetBundle(ChaFileControl __instance, string assetName)
            {
                if (assetName == AssetDefaultF)
                {
                    if (!VerifyCard(ReplacementCardType.DefaultFemale))
                    {
                        return(true);
                    }
                    Logger.LogDebug($"Replacing {CardNameDefaultF} with card: {CardPathDefaultF.Value}");
                    __instance.LoadCharaFile(CardPathDefaultF.Value);
                    return(false);
                }
                else if (assetName == AssetDefaultM)
                {
                    if (!VerifyCard(ReplacementCardType.DefaultMale))
                    {
                        return(true);
                    }
                    Logger.LogDebug($"Replacing {CardNameDefaultM} with card: {CardPathDefaultM.Value}");
                    __instance.LoadCharaFile(CardPathDefaultM.Value);
                    return(false);
                }
                else if (assetName == AssetOther && CardPathOther != null)
                {
                    if (!VerifyCard(ReplacementCardType.Other))
                    {
                        return(true);
                    }
                    Logger.LogDebug($"Replacing {CardNameOther} with card: {CardPathOther.Value}");
                    __instance.LoadCharaFile(CardPathOther.Value);
                    return(false);
                }

                return(true);
            }
Пример #21
0
        public static bool LoadOrImportFileLimited(this ChaFileControl chaFileControl, string filename, byte sex = 255,
                                                   bool face = true, bool body = true, bool hair = true, bool parameter = true, bool coordinate = true, bool extension = true)
        {
            var oldpng = chaFileControl.pngData;

            chaFileControl.LoadFileLimited(filename, sex, face, body, hair, parameter, coordinate, extension);

            // This is the only way to tell if LoadFileLimited failed, pngdata is always replaced if it succeedes
            if (oldpng == chaFileControl.pngData)
            {
                // bug? this seems to lose ext save data of the kk card
                var tempcfc = new ChaFileControl();
                if (tempcfc.LoadCharaFileKoikatsu(filename, sex, false, true))
                {
                    DragAndDropCore.Logger.LogMessage("Attempting to import a Koikatu card.\nIt might not load properly unless you copy it to UserData\\chara and let the game import it.");

                    var tempfile = Path.GetTempFileName();
                    DragAndDropCore.Logger.LogDebug("Saving converted KK card to " + tempfile);
                    tempcfc.SaveCharaFile(tempfile);
                    chaFileControl.LoadFileLimited(tempfile, sex, face, body, hair, parameter, coordinate, extension);
                    return(true);
                }
            }
            else
            {
                return(true);
            }

            return(false);
        }
Пример #22
0
        private static void ChaFileControlLoadCharaFilePostfix(ChaFileControl __instance, string filename,
                                                               bool __result)
        {
            try
            {
                if (!__result || __instance == null || string.IsNullOrEmpty(filename) ||
                    !TranslationHelper.Instance.CurrentCardLoadTranslationEnabled ||
                    (!MakerAPI.CharaListIsLoading && !Configuration.TrackCharaFileControlPaths))
                {
                    return;
                }
#if HS2 || AI
                if (!filename.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
                {
                    return;
                }
#endif
                Configuration.TrackCharaFileControlPath(__instance, filename,
                                                        fullPath => __instance.GetTranslationHelperController().SafeProc(c => c.FullPath = fullPath));
            }

            catch (Exception err)
            {
                Logger.LogException(err, nameof(ChaFileControlLoadCharaFilePostfix));
            }
        }
Пример #23
0
        /// <summary>
        /// Load and set the character
        /// </summary>
        private static void SetupCharacter(string filePath, CharacterType characterType)
        {
            var chaFileControl = new ChaFileControl();

            if (chaFileControl.LoadCharaFile(filePath))
            {
                object member;
                if (Singleton <FreeHScene> .Instance == null)
                {
                    //Use reflection to get the VR version of the character select screen
#if KK
                    Type VRHSceneType = Type.GetType("VRCharaSelectScene, Assembly-CSharp");
#elif KKS
                    Type VRHSceneType = Type.GetType("VRFreeHSelect, Assembly-CSharp");
#endif
                    var HSceneObject = FindObjectOfType(VRHSceneType);
                    member = HSceneObject.GetType().GetField("member", AccessTools.all).GetValue(HSceneObject);
                }
                else
                {
                    member = Singleton <FreeHScene> .Instance.GetType().GetField("member", AccessTools.all).GetValue(Singleton <FreeHScene> .Instance);
                }

                switch (characterType)
                {
                case CharacterType.Heroine:
                    ReactiveProperty <SaveData.Heroine> heroine = (ReactiveProperty <SaveData.Heroine>)Traverse.Create(member).Field("resultHeroine").GetValue();
                    heroine.SetValueAndForceNotify(new SaveData.Heroine(chaFileControl, false));
                    break;

                case CharacterType.Partner:
                    ReactiveProperty <SaveData.Heroine> resultPartner = (ReactiveProperty <SaveData.Heroine>)Traverse.Create(member).Field("resultPartner").GetValue();
                    resultPartner.SetValueAndForceNotify(new SaveData.Heroine(chaFileControl, false));
                    break;

                case CharacterType.Female3P:
#if KK
                    if (GameObject.Find("Panel/3P/Stage1").activeInHierarchy)
#elif KKS
                    if (GameObject.Find("Panel/3P/main/Stage1").activeInHierarchy)
#endif
                    {
                        ReactiveProperty <SaveData.Heroine> heroine3P = (ReactiveProperty <SaveData.Heroine>)Traverse.Create(member).Field("resultHeroine").GetValue();
                        heroine3P.SetValueAndForceNotify(new SaveData.Heroine(chaFileControl, false));
                    }
                    else
                    {
                        ReactiveProperty <SaveData.Heroine> resultPartner3P = (ReactiveProperty <SaveData.Heroine>)Traverse.Create(member).Field("resultPartner").GetValue();
                        resultPartner3P.SetValueAndForceNotify(new SaveData.Heroine(chaFileControl, false));
                    }
                    break;

                case CharacterType.Player:
                    ReactiveProperty <SaveData.Player> resultPlayer = (ReactiveProperty <SaveData.Player>)Traverse.Create(member).Field("resultPlayer").GetValue();
                    resultPlayer.SetValueAndForceNotify(new SaveData.Player(chaFileControl, false));
                    break;
                }
            }
        }
Пример #24
0
 public static void SaveCharaFilePostfix(ChaFileControl __instance, string filename, byte sex)
 {
     if (SaveLoadCompression.EnableOnCharaSaveing.Value)
     {
         //】:為了通過CharacterReplacer
         Save(__instance.ConvertCharaFilePath(filename, sex), Token.CharaToken + "】" + Token.SexToken + sex);
     }
 }
Пример #25
0
 internal static void ChaFileControl_LoadCharaFile_Postfix(ChaFileControl __instance)
 {
     if (!_inMapSelecCursorEnter || __instance == null)
     {
         return;
     }
     InMapSeleChaFileControls[_inMapSelecCursorEnterIndex] = __instance;
     _inMapSelecCursorEnterIndex++;
 }
            internal static bool LoadFromAssetBundle(ChaFileControl __instance, string assetName)
            {
                if (assetName != "ill_Default_Merchant") return true;
                if (!VerifyCard()) return true;

                Logger.LogDebug($"Replacing {CardName} with card: {CardPath.Value}");
                __instance.LoadCharaFile(CardPath.Value);
                return false;
            }
Пример #27
0
        internal static void RosterSetCharaInfoPrefix(Component __instance, ChaFileControl chaFileCtrl)
        {
            if (!ShouldProcess(__instance, chaFileCtrl) ||
                !GeBoAPI.Instance.AutoTranslationHelper.IsTranslatable(chaFileCtrl.GetFullName()))
            {
                return;
            }

            chaFileCtrl.StartMonitoredCoroutine(TranslationHelper.CardNameManager.TranslateCardNames(chaFileCtrl));
        }
Пример #28
0
        /// <summary>
        /// Method to add body bones to favorites list.
        /// </summary>
        /// <param curr>File to add bones from</param>
        /// <param fromSelected>Flag to select bones from CustomCharaList</param>
        /// <param key>Specifies key for KKATData entry</param>
        public static void AddBodyBones(ChaFileControl curr, bool fromSelected = false, string key = null)
        {
            List <BoneModifier> modifiers = fromSelected ?
                                            GetBodyBones(Utilities.GetBoneModifiersFromCard()) :
                                            GetBodyBones(MakerAPI.GetCharacterControl().GetComponent <BoneController>().Modifiers);

            key = key == null?Utilities.CreateNewKey(curr) : key;

            KK_Archetypes.Data.BodyBonesDict.Add(key, modifiers);
        }
Пример #29
0
        /// <summary>
        /// True when OnReload was triggerd by replacing the current character GameObject with another character file
        ///  We want to keep current slider settings when this happens
        /// </summary>
        internal bool IsNewChar(ChaFileControl chaFileControl)
        {
            var isNew = (charaFileName != chaFileControl.parameter.fullname);

            if (PregnancyPlusPlugin.DebugLog.Value)
            {
                PregnancyPlusPlugin.Logger.LogInfo($" IsNewChar {charaFileName} -> {chaFileControl.parameter.fullname}");
            }
            return(isNew);
        }
Пример #30
0
        public static void HScene_SetStartAnimationInfo_HeightPostfix(HScene __instance, HSceneManager ___hSceneManager)
        {
            manager = ___hSceneManager;
            males   = __instance.GetMales();

            HS2_UnlockPlayerHeight.chara    = males[0];
            HS2_UnlockPlayerHeight.chara2nd = males[1];

            HS2_UnlockPlayerHeight.cardHeightValue    = 0.75f;
            HS2_UnlockPlayerHeight.cardHeightValue2nd = 0.75f;

            var png1 = manager.pngMale;

            if (HS2_UnlockPlayerHeight.chara != null && png1 != null)
            {
                if (png1 == "")
                {
                    png1 = HS2_UnlockPlayerHeight.chara.chaFile.charaFileName;

                    if (png1 == "")
                    {
                        png1 = "HS2_ill_M_000";
                    }
                }

                var card = new ChaFileControl();
                if (manager.bFutanari && card.LoadCharaFile(png1, 1, true) || card.LoadCharaFile(png1, 255, true))
                {
                    HS2_UnlockPlayerHeight.cardHeightValue = card.custom.body.shapeValueBody[0];
                    HS2_UnlockPlayerHeight.ApplySettings(false);
                }
            }

            var png2 = manager.pngMaleSecond;

            if (HS2_UnlockPlayerHeight.chara2nd != null && png2 != null)
            {
                if (png2 == "")
                {
                    png2 = HS2_UnlockPlayerHeight.chara2nd.chaFile.charaFileName;

                    if (png2 == "")
                    {
                        png2 = "HS2_ill_M_000";
                    }
                }

                var card = new ChaFileControl();
                if (manager.bFutanariSecond && card.LoadCharaFile(png2, 1, true) || card.LoadCharaFile(png2, 255, true))
                {
                    HS2_UnlockPlayerHeight.cardHeightValue2nd = card.custom.body.shapeValueBody[0];
                    HS2_UnlockPlayerHeight.ApplySettings(true);
                }
            }
        }