コード例 #1
0
        protected override void OnCoordinateBeingLoaded(ChaFileCoordinate coordinate, bool maintainState)
        {
            var loadFlags = MakerAPI.GetCoordinateLoadFlags();

            if (loadFlags == null || loadFlags.Accessories)
            {
                AccessoryDynamicBoneData.RemoveAll(x => x.CoordinateIndex == CurrentCoordinateIndex);

                var data = GetCoordinateExtendedData(coordinate);
                if (data?.data != null)
                {
                    if (data.data.TryGetValue(nameof(AccessoryDynamicBoneData), out var loadedAccessoryDynamicBoneData) && loadedAccessoryDynamicBoneData != null)
                    {
                        var loadedAccessoryDynamicBoneDataList = MessagePackSerializer.Deserialize <List <DynamicBoneData> >((byte[])loadedAccessoryDynamicBoneData);
                        foreach (var dbData in loadedAccessoryDynamicBoneDataList)
                        {
                            dbData.CoordinateIndex = CurrentCoordinateIndex;
                            AccessoryDynamicBoneData.Add(dbData);
                        }
                    }
                }
            }
            StartCoroutine(ApplyData());

            base.OnCoordinateBeingLoaded(coordinate, maintainState);
        }
コード例 #2
0
            protected override void OnCoordinateBeingLoaded(ChaFileCoordinate coordinate)
            {
                Logger.Log(DebugLogLevel, $"[OnCoordinateBeingLoaded][{ChaControl.chaFile.parameter?.fullname}] Fired!!");
                CurOutfitTriggerInfo = null;
                PluginData ExtendedData = GetCoordinateExtendedData(coordinate);

                if (ExtendedData != null && ExtendedData.data.TryGetValue("OutfitTriggerInfo", out var loadedOutfitTriggerInfo) && loadedOutfitTriggerInfo != null)
                {
                    bool LoadFlag = true;
                    if (MakerAPI.InsideMaker)
                    {
                        CoordinateLoadFlags LoadFlags = MakerAPI.GetCoordinateLoadFlags();
                        if ((!(bool)LoadFlags?.Accessories) && (LoadFlags != null))
                        {
                            LoadFlag = false;
                        }
                    }
                    if (LoadFlag)
                    {
                        CharaTriggerInfo[CurrentCoordinateIndex] = MessagePackSerializer.Deserialize <OutfitTriggerInfo>((byte[])loadedOutfitTriggerInfo);
                        Logger.Log(DebugLogLevel, $"[OnCoordinateBeingLoaded][{ChaControl.chaFile.parameter?.fullname}] CharaTriggerInfo[{CurrentCoordinateIndex}] loaded from extdata");
                    }

                    CurOutfitTriggerInfo = CharaTriggerInfo[CurrentCoordinateIndex];
                    Logger.Log(DebugLogLevel, $"[OnCoordinateBeingLoaded] CurOutfitTriggerInfo.Parts count: {CurOutfitTriggerInfo.Parts.Count()}");
                }
                InitCurOutfitTriggerInfo();

                base.OnCoordinateBeingLoaded(coordinate);
            }
コード例 #3
0
            protected override void OnCoordinateBeingLoaded(ChaFileCoordinate coordinate)
            {
                if (MakerAPI.GetCoordinateLoadFlags()?.Clothes == false)
                {
                    return;
                }

                ClothData newBraData = new ClothData(CurrentBraData);
                ClothData newTopData = new ClothData(CurrentTopData);

                var data = GetCoordinateExtendedData(coordinate);

                if (data != null && data.data.TryGetValue(PushupConstants.PushupCoordinate_BraData, out var loadedBraData) && loadedBraData != null)
                {
                    try
                    {
                        newBraData = MessagePackSerializer.Deserialize <ClothData>((byte[])loadedBraData);
                    }
                    catch
                    {
                        Logger.LogError("Error loading coordinate");
                    }
                }

                if (data != null && data.data.TryGetValue(PushupConstants.PushupCoordinate_TopData, out var loadedTopData) && loadedTopData != null)
                {
                    try
                    {
                        newTopData = MessagePackSerializer.Deserialize <ClothData>((byte[])loadedTopData);
                    }
                    catch
                    {
                        Logger.LogError("Error loading coordinate");
                    }
                }
                else
                {
                    CurrentTopData = null;
                }

                //Copy the cloth data but not body data
                newBraData.CopyTo(CurrentBraData);
                newTopData.CopyTo(CurrentTopData);

                //Advanced mode data is too character specific and is not loaded from coordinates
                CurrentBraData.UseAdvanced = false;
                if (CurrentTopData != null)
                {
                    CurrentTopData.UseAdvanced = false;
                }

                RecalculateBody();
            }
コード例 #4
0
        protected override void OnCoordinateBeingLoaded(ChaFileCoordinate coordinate, bool maintainState)
        {
            SetClothingUnlocked(false);

            var loadFlags = MakerAPI.GetCoordinateLoadFlags();

            if (loadFlags == null || loadFlags.Clothes)
            {
                var data = GetCoordinateExtendedData(coordinate);
                if (data != null)
                {
                    if (data.data.TryGetValue(nameof(ClothingUnlocked) + "Coordinate", out var loadedClothingUnlocked))
                    {
                        SetClothingUnlocked((bool)loadedClothingUnlocked);
                    }
                }
            }

            base.OnCoordinateBeingLoaded(coordinate, maintainState);
        }
コード例 #5
0
            protected override void OnCoordinateBeingLoaded(ChaFileCoordinate _coordinate)
            {
                TaskUnlock();
                bool go = true;

                DebugMsg(LogLevel.Warning, $"[OnCoordinateBeingLoaded][{ChaControl.GetFullname()}][FunctionEnable: {FunctionEnable}][ReferralIndex: {ReferralIndex}][PartsInfo.Count: {PartsInfo.Count}]");

                if (!FunctionEnable)
                {
                    go = false;
                }
                if (ReferralIndex == 7 && PartsInfo.Count == 0)
                {
                    go = false;
                }
                if (MakerAPI.InsideAndLoaded && !CfgMakerMasterSwitch.Value)
                {
                    go = false;
                }

                CoordinateLoadFlags _loadFlags = MakerAPI.GetCoordinateLoadFlags();

                if (MakerAPI.InsideAndLoaded && _loadFlags != null && !_loadFlags.Accessories)
                {
                    go = false;
                }

                if (go)
                {
                    TaskLock();
                    ChaControl.StartCoroutine(OnCoordinateBeingLoadedCoroutine());
                }
                else
                {
                    if (MakerAPI.InsideAndLoaded)
                    {
                        CustomBase.Instance.updateCustomUI = true;
                    }
                }
                base.OnCoordinateBeingLoaded(_coordinate);
            }
コード例 #6
0
            /// <summary>
            /// Wait one frame for accessories to load and then load the data.
            /// </summary>
            private IEnumerator LoadCoordinateData(ChaFileCoordinate coordinate)
            {
                ReloadingChara = true;
                yield return(null);

                var loadFlags = MakerAPI.GetCoordinateLoadFlags();

                if (loadFlags == null || loadFlags.Accessories)
                {
                    var data = GetCoordinateExtendedData(coordinate);
                    if (data != null && data.data.TryGetValue("CoordinateHairAccessories", out var loadedHairAccessories) && loadedHairAccessories != null)
                    {
                        if (HairAccessories.ContainsKey(CurrentCoordinateIndex))
                        {
                            HairAccessories[CurrentCoordinateIndex].Clear();
                        }
                        else
                        {
                            HairAccessories[CurrentCoordinateIndex] = new Dictionary <int, HairAccessoryInfo>();
                        }

                        HairAccessories[CurrentCoordinateIndex] = MessagePackSerializer.Deserialize <Dictionary <int, HairAccessoryInfo> >((byte[])loadedHairAccessories);
                    }

                    if (MakerAPI.InsideAndLoaded)
                    {
                        if (InitHairAccessoryInfo(AccessoriesApi.SelectedMakerAccSlot))
                        {
                            //switching to a hair accessory that previously had no data. Meaning this card was made before this plugin. ColorMatch and HairGloss should be off.
                            SetColorMatch(false);
                            SetHairGloss(false);
                        }

                        InitCurrentSlot(this);
                    }
                }

                UpdateAccessories();
                ReloadingChara = false;
            }