Ejemplo n.º 1
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;
                }
            }
Ejemplo n.º 2
0
            private static bool ChaControl_ChangeAccessoryParent_Prefix(ChaControl __instance, int slotNo, string parentStr, ref bool __result)
            {
                if (slotNo >= __instance.objAccessory.Length)
                {
                    __result = false;
                    return(false);
                }

                GameObject gameObject = __instance.objAccessory[slotNo];

                if (gameObject == null)
                {
                    __result = false;
                    return(false);
                }
                if (parentStr == "none")
                {
                    gameObject.transform.SetParent(null, worldPositionStays: false);
                    __result = true;
                    return(false);
                }
                ListInfoBase listInfoBase = __instance.infoAccessory[slotNo];

                if (listInfoBase != null)
                {
                    listInfoBase = gameObject.GetComponent <ListInfoComponent>().data;
                }
                if (listInfoBase.GetInfo(ChaListDefine.KeyType.Parent) == "0")
                {
                    __result = false;
                    return(false);
                }
                try
                {
                    /*
                     * ChaReference.RefObjKey key = (ChaReference.RefObjKey) Enum.Parse(typeof(ChaReference.RefObjKey), parentStr);
                     * GameObject referenceInfo = __instance.GetReferenceInfo(key);
                     */
                    GameObject referenceInfo = __instance.GetComponentsInChildren <Transform>(true).FirstOrDefault(x => x.name == parentStr)?.gameObject;
                    if (referenceInfo == null)
                    {
                        __result = false;
                        return(false);
                    }
                    gameObject.transform.SetParent(referenceInfo.transform, worldPositionStays: false);
                    __instance.nowCoordinate.accessory.parts[slotNo].parentKey   = parentStr;
                    __instance.nowCoordinate.accessory.parts[slotNo].partsOfHead = ChaAccessoryDefine.CheckPartsOfHead(parentStr);
                }
                catch (ArgumentException)
                {
                    __result = false;
                    return(false);
                }
                __result = true;
                return(false);
            }
Ejemplo n.º 3
0
        public void ChangePatternImage()
        {
            ListInfoBase listInfo  = this.chaCtrl.lstCtrl.GetListInfo(ChaListDefine.CategoryNo.st_pattern, this.nowClothes.parts[this.parts].colorInfo[this.idx].pattern);
            Texture2D    texture2D = CommonLib.LoadAsset <Texture2D>(listInfo.GetInfo(ChaListDefine.KeyType.ThumbAB), listInfo.GetInfo(ChaListDefine.KeyType.ThumbTex), false, string.Empty);

            if (!Object.op_Implicit((Object)texture2D))
            {
                return;
            }
            this.imgPattern.set_sprite(Sprite.Create(texture2D, new Rect(0.0f, 0.0f, (float)((Texture)texture2D).get_width(), (float)((Texture)texture2D).get_height()), new Vector2(0.5f, 0.5f)));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Try to get the primary asset by trying various things
        /// </summary>
        /// <param name="listInfoBase"></param>
        /// <returns>Null if the main asset wasn't found</returns>
        private static string TryGetMainAsset(ListInfoBase listInfoBase)
        {
            string asset = listInfoBase.GetInfo(ChaListDefine.KeyType.MainData);

            if (!asset.IsNullOrEmpty() && asset != "0")
            {
                return(asset);
            }
            asset = listInfoBase.GetInfo(ChaListDefine.KeyType.MainTex);
            if (!asset.IsNullOrEmpty() && asset != "0")
            {
                return(asset);
            }
            asset = listInfoBase.GetInfo(ChaListDefine.KeyType.PaintTex);
            if (!asset.IsNullOrEmpty() && asset != "0")
            {
                return(asset);
            }
            asset = listInfoBase.GetInfo(ChaListDefine.KeyType.NipTex);
            if (!asset.IsNullOrEmpty() && asset != "0")
            {
                return(asset);
            }
            asset = listInfoBase.GetInfo(ChaListDefine.KeyType.SunburnTex);
            if (!asset.IsNullOrEmpty() && asset != "0")
            {
                return(asset);
            }
            asset = listInfoBase.GetInfo(ChaListDefine.KeyType.UnderhairTex);
            if (!asset.IsNullOrEmpty() && asset != "0")
            {
                return(asset);
            }
            return(null);
        }
Ejemplo n.º 5
0
        private string GetMakerGrouping(ListInfoBase listInfoBase)
        {
            var fallback = "0";

            foreach (var key in MakerGroupingKeys)
            {
                var result = listInfoBase.GetInfo(key);
                if (!string.IsNullOrEmpty(result) && result != "0")
                {
                    if (result.Contains("/"))
                    {
                        return(result);
                    }
                    if (result.Length > fallback.Length)
                    {
                        fallback = result;
                    }
                }
            }

            return(fallback);
        }
Ejemplo n.º 6
0
        public void PlayVoice()
        {
            if (!this.customBase.playVoiceBackup.playSampleVoice)
            {
                this.customBase.playVoiceBackup.backEyebrowPtn = this.chaCtrl.fileStatus.eyebrowPtn;
                this.customBase.playVoiceBackup.backEyesPtn    = this.chaCtrl.fileStatus.eyesPtn;
                this.customBase.playVoiceBackup.backBlink      = this.chaCtrl.fileStatus.eyesBlink;
                this.customBase.playVoiceBackup.backEyesOpen   = this.chaCtrl.fileStatus.eyesOpenMax;
                this.customBase.playVoiceBackup.backMouthPtn   = this.chaCtrl.fileStatus.mouthPtn;
                this.customBase.playVoiceBackup.backMouthFix   = this.chaCtrl.fileStatus.mouthFixed;
                this.customBase.playVoiceBackup.backMouthOpen  = this.chaCtrl.fileStatus.mouthOpenMax;
            }
            ListInfoBase listInfo = Singleton <Character> .Instance.chaListCtrl.GetListInfo(ChaListDefine.CategoryNo.cha_sample_voice, this.parameter.personality);

            if (listInfo == null)
            {
                return;
            }
            ChaListDefine.KeyType[] keyTypeArray1 = new ChaListDefine.KeyType[3]
            {
                ChaListDefine.KeyType.Eyebrow01,
                ChaListDefine.KeyType.Eyebrow02,
                ChaListDefine.KeyType.Eyebrow03
            };
            ChaListDefine.KeyType[] keyTypeArray2 = new ChaListDefine.KeyType[3]
            {
                ChaListDefine.KeyType.Eye01,
                ChaListDefine.KeyType.Eye02,
                ChaListDefine.KeyType.Eye03
            };
            ChaListDefine.KeyType[] keyTypeArray3 = new ChaListDefine.KeyType[3]
            {
                ChaListDefine.KeyType.EyeMax01,
                ChaListDefine.KeyType.EyeMax02,
                ChaListDefine.KeyType.EyeMax03
            };
            ChaListDefine.KeyType[] keyTypeArray4 = new ChaListDefine.KeyType[3]
            {
                ChaListDefine.KeyType.Mouth01,
                ChaListDefine.KeyType.Mouth02,
                ChaListDefine.KeyType.Mouth03
            };
            ChaListDefine.KeyType[] keyTypeArray5 = new ChaListDefine.KeyType[3]
            {
                ChaListDefine.KeyType.MouthMax01,
                ChaListDefine.KeyType.MouthMax02,
                ChaListDefine.KeyType.MouthMax03
            };
            ChaListDefine.KeyType[] keyTypeArray6 = new ChaListDefine.KeyType[3]
            {
                ChaListDefine.KeyType.EyeHiLight01,
                ChaListDefine.KeyType.EyeHiLight02,
                ChaListDefine.KeyType.EyeHiLight03
            };
            ChaListDefine.KeyType[] keyTypeArray7 = new ChaListDefine.KeyType[3]
            {
                ChaListDefine.KeyType.Data01,
                ChaListDefine.KeyType.Data02,
                ChaListDefine.KeyType.Data03
            };
            int index = this.voiceCnt[this.parameter.personality] = (this.voiceCnt[this.parameter.personality] + 1) % keyTypeArray1.Length;

            this.chaCtrl.ChangeEyebrowPtn(listInfo.GetInfoInt(keyTypeArray1[index]), true);
            this.chaCtrl.ChangeEyesPtn(listInfo.GetInfoInt(keyTypeArray2[index]), true);
            this.chaCtrl.HideEyeHighlight("0" == listInfo.GetInfo(keyTypeArray6[index]));
            this.chaCtrl.ChangeEyesBlinkFlag(false);
            this.chaCtrl.ChangeEyesOpenMax(listInfo.GetInfoFloat(keyTypeArray3[index]));
            this.chaCtrl.ChangeMouthPtn(listInfo.GetInfoInt(keyTypeArray4[index]), true);
            this.chaCtrl.ChangeMouthFixed(false);
            this.chaCtrl.ChangeMouthOpenMax(listInfo.GetInfoFloat(keyTypeArray5[index]));
            this.customBase.playVoiceBackup.playSampleVoice = true;
            Singleton <Manager.Sound> .Instance.Stop(Manager.Sound.Type.SystemSE);

            Transform trfVoice = Illusion.Game.Utils.Sound.Play(new Illusion.Game.Utils.Sound.Setting()
            {
                type            = Manager.Sound.Type.SystemSE,
                assetBundleName = listInfo.GetInfo(ChaListDefine.KeyType.MainAB),
                assetName       = listInfo.GetInfo(keyTypeArray7[index])
            });

            this.audioSource = (AudioSource)((Component)trfVoice).GetComponent <AudioSource>();
            this.audioSource.set_pitch(this.parameter.voicePitch);
            this.chaCtrl.SetVoiceTransform(trfVoice);
        }