using System; using System.Collections; using System.Collections.Generic; using Edit; using I2.Loc; using MaidStatus; using MaidStatus.CsvData; using UnityEngine; using Yotogis; public class ProfileCtrl : MonoBehaviour { private bool m_enabledInput { get { return BaseMgr.Instance.m_enabledInput; } } private bool m_enabledPersonalityInput { get { return BaseMgr.Instance.m_enabledPersonalityInput; } } public void Init(GameObject goProfilePanel, Status status) { this.m_goProfilePanel = goProfilePanel; this.m_maidStatus = status; this.m_lContractType = UTY.GetChildObject(this.m_goProfilePanel, "ContractType/OutputField", false).GetComponent(); GameObject childObject = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/Name/FirstName", false); this.m_inFirstName = childObject.GetComponent(); this.m_clFirstName = childObject.GetComponent(); EventDelegate.Add(this.m_inFirstName.onChange, new EventDelegate.Callback(BaseMgr.Instance.OnChangeFirstName)); GameObject childObject2 = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/Name/LastName", false); this.m_inLastName = childObject2.GetComponent(); this.m_clLastName = childObject2.GetComponent(); EventDelegate.Add(this.m_inLastName.onChange, new EventDelegate.Callback(BaseMgr.Instance.OnChangeLastName)); this.m_buFirstName = UTY.GetChildObject(childObject, "Random", false).GetComponent(); EventDelegate.Add(this.m_buFirstName.onClick, delegate() { this.m_inFirstName.RemoveFocus(); this.m_inFirstName.value = MaidRandomName.GetFirstName(); }); this.m_buLastName = UTY.GetChildObject(childObject2, "Random", false).GetComponent(); EventDelegate.Add(this.m_buLastName.onClick, delegate() { this.m_inLastName.RemoveFocus(); this.m_inLastName.value = MaidRandomName.GetLastName(); }); this.m_lMaidClassName = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/MaidClass/Type", false).GetComponent(); this.m_lMaidClassLevel = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/MaidClass/Level", false).GetComponent(); this.m_lMaidClassExp = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/MaidClass/Exp", false).GetComponent(); this.m_lMaidClassRequiredExp = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/MaidClass/RequiredExp", false).GetComponent(); this.m_lYotogiClassName = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/YotogiClass/Type", false).GetComponent(); this.m_lYotogiClassLevel = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/YotogiClass/Level", false).GetComponent(); this.m_lYotogiClassExp = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/YotogiClass/Exp", false).GetComponent(); this.m_lYotogiClassRequiredExp = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/YotogiClass/RequiredExp", false).GetComponent(); this.m_lRelation = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/Relation", false).GetComponent(); this.m_lConditionText = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/ConditionText", false).GetComponent(); this.m_lYotogiPlayCount = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/OthersPlayCount", false).GetComponent(); this.m_lOthersPlayCount = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/YotogiPlayCount", false).GetComponent(); this.m_lHp = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/Hp", false).GetComponent(); this.m_lLikability = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/Likability", false).GetComponent(); this.m_lMind = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/Mind", false).GetComponent(); this.m_lReception = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/Reception", false).GetComponent(); this.m_lCare = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/Care", false).GetComponent(); this.m_lStudyRate = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/StudyRate", false).GetComponent(); this.m_lTeachRate = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/TeachRate", false).GetComponent(); GameObject childObject3 = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/Personal/PopupList", false); this.m_pPersonal = childObject3.GetComponent(); this.m_lPersonal = UTY.GetChildObject(childObject3, "LabelParent/Label", false).GetComponent(); bool flag = GameMain.Instance.CharacterMgr.status.GetFlag("オープニング終了") == 1; List allDatas = Personal.GetAllDatas(true); List list = new List(); foreach (Personal.Data data in allDatas) { string a = data.uniqueName.ToLower(); if (data.oldPersonal) { if (a == "pure" || a == "cool" || a == "pride") { if (GameMain.Instance.CharacterMgr.status.isAvailableTransfer) { list.Add(data); } } else if (flag) { if (data.single) { list.Add(data); } else if (!string.IsNullOrEmpty(GameMain.Instance.CMSystem.CM3D2Path) && data.compatible) { list.Add(data); } } } else { list.Add(data); } } this.m_pPersonal.items.Clear(); this.m_pPersonal.isLocalized = true; ProfileCtrl.m_dicPersonal = new Dictionary(); foreach (Personal.Data data2 in list) { string termName = data2.termName; this.m_pPersonal.items.Add(termName); ProfileCtrl.m_dicPersonal.Add(termName, data2); } EventDelegate.Add(this.m_pPersonal.onChange, delegate() { }); this.m_clPersonal = childObject3.GetComponent(); this.m_goPersonalSelectorIcon = UTY.GetChildObject(childObject3, "Symbol", false); GameObject childObject4 = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/SexualExperience/PopupList", false); this.m_pSexualExperience = childObject4.GetComponent(); ProfileCtrl.m_dicSexualExperience = new Dictionary(); for (int i = 0; i < Enum.GetValues(typeof(Seikeiken)).Length; i++) { Seikeiken seikeiken = (Seikeiken)i; ProfileCtrl.m_dicSexualExperience.Add(EnumConvert.GetString(seikeiken), seikeiken); } this.m_clSexualExperience = childObject4.GetComponent(); this.m_goSexualExperienceSelectorIcon = UTY.GetChildObject(childObject4, "Symbol", false); this.m_lHeight = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/Body/Height", false).GetComponent(); this.m_lWeight = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/Body/Weight", false).GetComponent(); this.m_lBust = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/Body/Bust/Bust", false).GetComponent(); this.m_lCup = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/Body/Bust/Cup", false).GetComponent(); this.m_lWaist = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/Body/Waist", false).GetComponent(); this.m_lHip = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/Body/Hip", false).GetComponent(); this.m_lCooking = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/StatusPoints/Cooking/Box", false).GetComponent(); this.m_lDance = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/StatusPoints/Dance/Box", false).GetComponent(); this.m_lVocal = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/StatusPoints/Vocal/Box", false).GetComponent(); this.m_lLovely = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/StatusPoints/Lovely/Box", false).GetComponent(); this.m_lElegance = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/StatusPoints/Elegance/Box", false).GetComponent(); this.m_lCharm = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/StatusPoints/Charm/Box", false).GetComponent(); this.m_lInran = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/StatusPoints/Inran/Box", false).GetComponent(); this.m_lMValue = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/StatusPoints/MValue/Box", false).GetComponent(); this.m_lHentai = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/StatusPoints/Hentai/Box", false).GetComponent(); this.m_lHousi = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/StatusPoints/Housi/Box", false).GetComponent(); this.m_lMaidPoint = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/StatusPoints/MaidPoint", false).GetComponent(); this.m_goMaidPointTitleAndFrame = UTY.GetChildObject(this.m_goProfilePanel, "CharacterInfo/ProfileBase/StatusPoints/MaidPoint/MaidPointTitleAndFrame", false); this.initMaidPointUIPosX = this.m_goMaidPointTitleAndFrame.transform.parent.localPosition.x; this.m_inFreeComment = UTY.GetChildObject(this.m_goProfilePanel, "Comment/FreeCommentWindow/FreeComment", false).GetComponent(); EventDelegate.Add(this.m_inFreeComment.onChange, new EventDelegate.Callback(BaseMgr.Instance.OnChangeFreeComment)); this.m_lProfileComment = UTY.GetChildObject(this.m_goProfilePanel, "Comment/ProfileCommentWindow/ProfileComment", false).GetComponent(); this.m_goProfileComment = UTY.GetChildObject(this.m_goProfilePanel, "Comment/ProfileCommentWindow/ProfileComment", false); this.m_goFreeComment = UTY.GetChildObject(this.m_goProfilePanel, "Comment/FreeCommentWindow/FreeComment", false); GameObject childObject5 = UTY.GetChildObject(this.m_goProfilePanel, "Comment/ProfileCommentWindow/ProfileTab", false); this.m_bProfileTab = childObject5.GetComponent(); this.m_goProfileTabSelector = UTY.GetChildObject(childObject5, "SelectCursor", false); GameObject childObject6 = UTY.GetChildObject(this.m_goProfilePanel, "Comment/FreeCommentWindow/FreeTab", false); this.m_bFreeTab = childObject6.GetComponent(); this.m_goFreeTabSelector = UTY.GetChildObject(childObject6, "SelectCursor", false); this.activeColor = new Color(this.m_bProfileTab.defaultColor.r, this.m_bProfileTab.defaultColor.g, this.m_bProfileTab.defaultColor.b, 1f); this.inActiveColor = this.m_bProfileTab.defaultColor; this.m_goMaidSkillParent = UTY.GetChildObject(this.m_goProfilePanel, "SubWindows/MaidSkillViewer/Contents/MaidSkillUnitParent", false); this.m_goMaidSkillViewer = UTY.GetChildObject(this.m_goProfilePanel, "SubWindows/MaidSkillViewer", false); this.m_maidSkillScrollView = UTY.GetChildObject(this.m_goMaidSkillViewer, "Contents", false).GetComponent(); this.m_goCharacterParent = UTY.GetChildObject(this.m_goProfilePanel, "SubWindows/CharacterViewer/Contents/CharacterUnitParent", false); this.m_goCharacterViewer = UTY.GetChildObject(this.m_goProfilePanel, "SubWindows/CharacterViewer", false); this.m_characterScrollView = UTY.GetChildObject(this.m_goCharacterViewer, "Contents", false).GetComponent(); this.m_goPropensityParent = UTY.GetChildObject(this.m_goProfilePanel, "SubWindows/PropensityViewer/Contents/CharacterUnitParent", false); this.m_goPropensityViewer = UTY.GetChildObject(this.m_goProfilePanel, "SubWindows/PropensityViewer", false); this.m_propensityScrollView = UTY.GetChildObject(this.m_goPropensityViewer, "Contents", false).GetComponent(); this.m_goYotogiSkillParent = UTY.GetChildObject(this.m_goProfilePanel, "SubWindows/YotogiSkillViewer/Contents/YotogiSkillUnitParent", false); this.m_goYotogiSkillViewer = UTY.GetChildObject(this.m_goProfilePanel, "SubWindows/YotogiSkillViewer", false); this.m_yotogiSkillScrollView = UTY.GetChildObject(this.m_goYotogiSkillViewer, "Contents", false).GetComponent(); this.m_dicSpriteName = new Dictionary { { ProfileCtrl.LevelOfAchievement.level_1, "cm3d2_edit_profile_yotogiskill_sign_batu" }, { ProfileCtrl.LevelOfAchievement.level_2, "cm3d2_edit_profile_yotogiskill_sign_sankaku" }, { ProfileCtrl.LevelOfAchievement.level_3, "cm3d2_edit_profile_yotogiskill_sign_maru" }, { ProfileCtrl.LevelOfAchievement.level_4, "cm3d2_edit_profile_yotogiskill_sign_nijumaru" } }; this.m_dicUpperBtn = new Dictionary(); IEnumerator enumerator3 = Enum.GetValues(typeof(ProfileMgr.UpperButtonType)).GetEnumerator(); try { while (enumerator3.MoveNext()) { object obj = enumerator3.Current; ProfileMgr.UpperButtonType upperButtonType = (ProfileMgr.UpperButtonType)obj; if (upperButtonType != ProfileMgr.UpperButtonType.None) { GameObject childObject7 = UTY.GetChildObject(this.m_goProfilePanel, "UpperButton/" + upperButtonType.ToString(), false); UIButton component = childObject7.GetComponent(); GameObject childObject8 = UTY.GetChildObject(childObject7, "SelectCursor", false); childObject8.SetActive(false); ProfileCtrl.UpperButton upperButton = new ProfileCtrl.UpperButton(); upperButton.m_btnButton = component; upperButton.m_name = upperButtonType; upperButton.m_goSelectCursor = childObject8; this.m_dicUpperBtn.Add(upperButton.m_name, upperButton); } } } finally { IDisposable disposable; if ((disposable = (enumerator3 as IDisposable)) != null) { disposable.Dispose(); } } this.m_dicSubViewer = new Dictionary { { ProfileMgr.UpperButtonType.MaidSkill, this.m_goMaidSkillViewer }, { ProfileMgr.UpperButtonType.YotogiSkill, this.m_goYotogiSkillViewer }, { ProfileMgr.UpperButtonType.Character, this.m_goCharacterViewer }, { ProfileMgr.UpperButtonType.Propensity, this.m_goPropensityViewer } }; this.initCommentWindow(); this.LoadMaidParamData(); this.SetEnableInput(this.m_enabledInput, this.m_enabledPersonalityInput); this.m_bInited = true; } private void SetEnableInput(bool enabledInput, bool enabledPersonalityInput) { this.m_inFirstName.enabled = enabledInput; this.m_inLastName.enabled = enabledInput; this.m_clFirstName.enabled = enabledInput; this.m_clLastName.enabled = enabledInput; this.m_buFirstName.gameObject.SetActive(enabledInput); this.m_buLastName.gameObject.SetActive(enabledInput); this.m_pPersonal.enabled = enabledPersonalityInput; this.m_clPersonal.enabled = enabledPersonalityInput; this.m_goPersonalSelectorIcon.SetActive(enabledPersonalityInput); this.m_pSexualExperience.enabled = enabledInput; this.m_clSexualExperience.enabled = enabledInput; this.m_goSexualExperienceSelectorIcon.SetActive(enabledInput); if (enabledInput) { this.m_lMaidPoint.alpha = 1f; this.m_goMaidPointTitleAndFrame.SetActive(true); } else { this.m_lMaidPoint.alpha = 0f; this.m_goMaidPointTitleAndFrame.SetActive(false); } } public void SetActiveViewerAndButton(ProfileMgr.UpperButtonType btn) { this.SetActiveViewer(btn); this.SetActiveButton(btn); } public void SetActiveViewer(ProfileMgr.UpperButtonType btn) { Vector3 localPosition = this.m_goMaidPointTitleAndFrame.transform.parent.localPosition; this.m_goMaidPointTitleAndFrame.transform.parent.localPosition = new Vector3(this.initMaidPointUIPosX, localPosition.y, localPosition.z); foreach (ProfileMgr.UpperButtonType upperButtonType in this.m_dicSubViewer.Keys) { if (btn == upperButtonType) { GameObject gameObject = this.m_dicSubViewer[upperButtonType]; gameObject.SetActive(true); localPosition = this.m_goMaidPointTitleAndFrame.transform.parent.localPosition; this.m_goMaidPointTitleAndFrame.transform.parent.localPosition = new Vector3(-270f, localPosition.y, localPosition.z); } else { GameObject gameObject2 = this.m_dicSubViewer[upperButtonType]; gameObject2.SetActive(false); } } } private void SetActiveButton(ProfileMgr.UpperButtonType btn) { foreach (ProfileMgr.UpperButtonType upperButtonType in this.m_dicUpperBtn.Keys) { ProfileCtrl.UpperButton upperButton; if (this.m_dicUpperBtn.TryGetValue(upperButtonType, out upperButton)) { if (btn == upperButtonType) { upperButton.m_btnButton.defaultColor = this.activeColor; upperButton.m_goSelectCursor.SetActive(true); } else { upperButton.m_btnButton.defaultColor = this.inActiveColor; upperButton.m_goSelectCursor.SetActive(false); } } } ProfileMgr.currentActiveBtn = btn; } private void initCommentWindow() { this.m_goProfileComment.SetActive(true); this.m_goFreeComment.SetActive(false); this.m_goProfileTabSelector.SetActive(true); this.m_goFreeTabSelector.SetActive(false); this.m_bProfileTab.defaultColor = this.activeColor; this.m_bFreeTab.defaultColor = this.inActiveColor; } public void LoadMaidParamData() { this.UpdateProfileData(false); this.m_lContractType.GetComponent().SetTerm(this.GetContractType(this.m_maidStatus.contract)); this.m_inLastName.value = this.m_maidStatus.lastName; this.m_inFirstName.value = this.m_maidStatus.firstName; ClassData selectedJobClass = this.m_maidStatus.selectedJobClass; if (selectedJobClass != null) { this.m_lMaidClassName.gameObject.GetComponent().SetTerm(selectedJobClass.data.termName); this.m_lMaidClassLevel.text = selectedJobClass.level.ToString(); this.m_lMaidClassExp.text = selectedJobClass.cur_exp.ToString(); this.m_lMaidClassRequiredExp.text = selectedJobClass.next_exp.ToString(); } ClassData selectedYotogiClass = this.m_maidStatus.selectedYotogiClass; if (selectedYotogiClass != null) { this.m_lYotogiClassName.text = selectedYotogiClass.data.drawName; this.m_lYotogiClassLevel.text = selectedYotogiClass.level.ToString(); this.m_lYotogiClassExp.text = selectedYotogiClass.cur_exp.ToString(); this.m_lYotogiClassRequiredExp.text = selectedYotogiClass.next_exp.ToString(); } this.m_lHeight.text = this.m_maidStatus.body.height.ToString(); this.m_lWeight.text = this.m_maidStatus.body.weight.ToString(); this.m_lBust.text = this.m_maidStatus.body.bust.ToString(); this.m_lWaist.text = this.m_maidStatus.body.waist.ToString(); this.m_lHip.text = this.m_maidStatus.body.hip.ToString(); this.m_lCup.text = this.m_maidStatus.body.cup; this.m_lRelation.GetComponent().SetTerm(this.GetCondition(this.m_maidStatus.relation)); this.m_lConditionText.GetComponent().SetTerm(this.m_maidStatus.conditionTermText); this.m_lYotogiPlayCount.text = this.m_maidStatus.playCountYotogi.ToString(); this.m_lOthersPlayCount.text = this.m_maidStatus.playCountNightWork.ToString(); this.m_lHp.text = this.m_maidStatus.maxHp.ToString(); this.m_lLikability.text = this.m_maidStatus.likability.ToString(); this.m_lMind.text = this.m_maidStatus.maxMind.ToString(); this.m_lReception.text = this.m_maidStatus.reception.ToString(); this.m_lCare.text = this.m_maidStatus.care.ToString(); this.m_lStudyRate.text = this.ToPercent(this.m_maidStatus.studyRate).ToString(); this.m_lTeachRate.text = this.ToPercent(this.m_maidStatus.teachRate).ToString(); this.m_lCooking.text = this.m_maidStatus.cooking.ToString(); this.m_lDance.text = this.m_maidStatus.dance.ToString(); this.m_lVocal.text = this.m_maidStatus.vocal.ToString(); this.m_lLovely.text = this.m_maidStatus.lovely.ToString(); this.m_lElegance.text = this.m_maidStatus.elegance.ToString(); this.m_lCharm.text = this.m_maidStatus.charm.ToString(); this.m_lInran.text = this.m_maidStatus.inyoku.ToString(); this.m_lMValue.text = this.m_maidStatus.mvalue.ToString(); this.m_lHentai.text = this.m_maidStatus.hentai.ToString(); this.m_lHousi.text = this.m_maidStatus.housi.ToString(); this.m_lMaidPoint.text = SceneEdit.Instance.maidPoint.ToString(); foreach (KeyValuePair keyValuePair in ProfileCtrl.m_dicPersonal) { if (this.m_maidStatus.personal.uniqueName == keyValuePair.Value.uniqueName) { this.m_pPersonal.value = keyValuePair.Key; break; } } this.m_pSexualExperience.value = this.GetSelectOptionNameFromSexualExpe(this.m_maidStatus.seikeiken); this.m_lProfileComment.text = string.Empty; this.m_inFreeComment.value = this.m_maidStatus.freeComment; } public void SetLastName(string inputText) { this.m_maidStatus.lastName = this.AdjustStrLengthIfOver(inputText, 8); } public void SetFirstName(string inputText) { this.m_maidStatus.firstName = this.AdjustStrLengthIfOver(inputText, 8); } public void SetFreeCommnet(string inputText) { this.m_maidStatus.freeComment = this.AdjustStrLengthIfOver(inputText, 304); } public void SetPersonal(string selectValue) { Personal.Data personal; if (ProfileCtrl.m_dicPersonal.TryGetValue(selectValue, out personal)) { this.m_maidStatus.SetPersonal(personal); Debug.Log(string.Concat(new object[] { "保存された性格:", this.m_maidStatus.personal, " = ", selectValue })); } } public void SetSexualExperience(string selectValue) { Seikeiken[] array = new Seikeiken[] { Seikeiken.No_No, Seikeiken.Yes_No, Seikeiken.No_Yes, Seikeiken.Yes_Yes }; foreach (Seikeiken seikeiken in array) { if (EnumConvert.GetTerm(seikeiken) == selectValue) { Seikeiken initSeikeiken = Seikeiken.No_No; if (ProfileCtrl.m_dicSexualExperience.TryGetValue(EnumConvert.GetString(seikeiken), out initSeikeiken)) { this.m_maidStatus.seikeiken = (this.m_maidStatus.initSeikeiken = initSeikeiken); } break; } } } private string GetSelectOptionNameFromSexualExpe(Seikeiken sexualExperience) { foreach (KeyValuePair keyValuePair in ProfileCtrl.m_dicSexualExperience) { if (keyValuePair.Value == sexualExperience) { return EnumConvert.GetTerm(keyValuePair.Value); } } return null; } private string GetContractType(Contract contractType) { return EnumConvert.GetTerm(contractType); } private string GetCondition(Relation relation) { return EnumConvert.GetTerm(relation); } private string AdjustStrLengthIfOver(string str, int length) { if (str.Length > length) { str = str.Substring(length); Debug.LogError(string.Format("入力された文字数が最大文字数を超えています。入力文字={0}, 最大文字数={1}", str, length)); } return str; } private int AdjustIntIfOverRange(int value, int minNumber, int maxNumber) { if (value < minNumber) { value = minNumber; Debug.LogError(string.Format("入力された値が許容される最小値より小さいです。入力値={0}, 許容される値の範囲[{1}-{2}]", value, minNumber, maxNumber)); } else if (value > maxNumber) { value = maxNumber; Debug.LogError(string.Format("入力された値が許容される最大値より大きいです。入力値={0}, 許容される値の範囲[{1}-{2}]", value, minNumber, maxNumber)); } return value; } private void CheckValueRange(int value, int minNumber, int maxNumber) { if (value < minNumber || value > maxNumber) { Debug.LogError(string.Format("値が不適切です。値={0}, 許容される値の範囲[{1}-{2}]", value, minNumber, maxNumber)); } } private bool CheckValueLength(string value, int length) { if (value.Length <= length) { return true; } Debug.LogError(string.Format("値の桁数が不適切です。値={0}, 許容される値の最大桁数={1}", value, length)); return false; } public void ChangeCommentTab(string clickTab) { if (clickTab == ProfileMgr.CommentTab.ProfileTab.ToString()) { this.m_bProfileTab.defaultColor = this.activeColor; this.m_bFreeTab.defaultColor = this.inActiveColor; this.m_goProfileComment.SetActive(true); this.m_goFreeComment.SetActive(false); this.m_goProfileTabSelector.SetActive(true); this.m_goFreeTabSelector.SetActive(false); } else if (clickTab == ProfileMgr.CommentTab.FreeTab.ToString()) { this.m_bProfileTab.defaultColor = this.inActiveColor; this.m_bFreeTab.defaultColor = this.activeColor; this.m_goProfileComment.SetActive(false); this.m_goFreeComment.SetActive(true); this.m_goProfileTabSelector.SetActive(false); this.m_goFreeTabSelector.SetActive(true); } } private bool NotExist(Dictionary dic) { return dic == null || dic.Count == 0; } public void CreateMaidSkillViewer(Dictionary dicProfileLabel) { this.m_dicProfileLabel = dicProfileLabel; this.CreateProfileItemInViewer(ProfileMgr.UpperButtonType.MaidSkill, this.m_goMaidSkillParent); this.SetActiveViewerAndButton(ProfileMgr.UpperButtonType.MaidSkill); this.AdjustTargetPosition(this.m_goMaidSkillParent, this.m_maidSkillScrollView); } public void CreateCharacterViewer(Dictionary dicProfileLabel) { this.m_dicProfileLabel = dicProfileLabel; this.CreateProfileItemInViewer(ProfileMgr.UpperButtonType.Character, this.m_goCharacterParent); this.SetActiveViewerAndButton(ProfileMgr.UpperButtonType.Character); this.AdjustTargetPosition(this.m_goCharacterParent, this.m_characterScrollView); } public void CreatePropensityViewer(Dictionary dicProfileLabel) { this.m_dicProfileLabel = dicProfileLabel; this.CreateProfileItemInViewer(ProfileMgr.UpperButtonType.Propensity, this.m_goPropensityParent); this.SetActiveViewerAndButton(ProfileMgr.UpperButtonType.Propensity); this.AdjustTargetPosition(this.m_goPropensityParent, this.m_propensityScrollView); } public void CreateYotogiSkill(Dictionary dicYotogiSkill) { this.m_dicYotogiSkill = dicYotogiSkill; this.CreateProfileItemInViewer(ProfileMgr.UpperButtonType.YotogiSkill, this.m_goYotogiSkillParent); this.SetActiveViewerAndButton(ProfileMgr.UpperButtonType.YotogiSkill); this.AdjustTargetPosition(this.m_goYotogiSkillParent, this.m_yotogiSkillScrollView); } private void CreateProfileItemInViewer(ProfileMgr.UpperButtonType btnType, GameObject goParent) { this.ClearExistChildGameObject(goParent); GameObject gameObject = null; switch (btnType) { case ProfileMgr.UpperButtonType.MaidSkill: case ProfileMgr.UpperButtonType.Character: case ProfileMgr.UpperButtonType.Propensity: { gameObject = this.GetPrefabs(this.m_goProfileLabelUnitPrefab, "SceneEdit/Profile/Prefab/ProfileLabelUnit"); List list = new List(); foreach (KeyValuePair keyValuePair in this.m_dicProfileLabel) { list.Add(keyValuePair.Value); } list.Sort((ProfileCtrl.ProfileLabelUnit a, ProfileCtrl.ProfileLabelUnit b) => int.Parse(a.m_id) - int.Parse(b.m_id)); for (int i = 0; i < list.Count; i++) { GameObject gameObject2 = UnityEngine.Object.Instantiate(gameObject); this.SetTransformInfo(gameObject2, goParent); UILabel component = UTY.GetChildObject(gameObject2, "Parameter", false).GetComponent(); component.text = list[i].m_parameter; Localize localize = component.gameObject.AddComponent(); if (btnType == ProfileMgr.UpperButtonType.Character) { localize.SetTerm("MaidStatus/性癖タイプ/" + list[i].m_parameter); } else if (btnType == ProfileMgr.UpperButtonType.Propensity) { localize.SetTerm("MaidStatus/性癖タイプ/" + list[i].m_parameter); } } this.m_goProfileLabelUnitPrefab = gameObject; break; } case ProfileMgr.UpperButtonType.YotogiSkill: gameObject = this.GetPrefabs(this.m_goYotogiSkillUnitPrefab, "SceneEdit/Profile/Prefab/YotogiSkillUnit"); foreach (KeyValuePair keyValuePair2 in this.m_dicYotogiSkill) { GameObject gameObject3 = UnityEngine.Object.Instantiate(gameObject); this.SetTransformInfo(gameObject3, goParent); UILabel component2 = UTY.GetChildObject(gameObject3, "Number/Value", false).GetComponent(); component2.text = keyValuePair2.Value.m_number; UILabel component3 = UTY.GetChildObject(gameObject3, "SkillName/Value", false).GetComponent(); component3.text = keyValuePair2.Value.m_skillName; UISprite component4 = UTY.GetChildObject(gameObject3, "LevelOfAchievement/Icon", false).GetComponent(); component4.spriteName = this.m_dicSpriteName[keyValuePair2.Value.m_levelOfAchievement]; } this.m_goYotogiSkillUnitPrefab = gameObject; break; } } private void SetTransformInfo(GameObject copyPrefabs, GameObject goParent) { copyPrefabs.transform.parent = goParent.transform; copyPrefabs.transform.localScale = Vector3.one; copyPrefabs.transform.localPosition = Vector3.zero; copyPrefabs.transform.rotation = Quaternion.identity; } private GameObject GetPrefabs(GameObject prefabs, string prefabsPath) { if (prefabs == null) { prefabs = (Resources.Load(prefabsPath) as GameObject); if (prefabs == null) { Debug.LogError(string.Format("ロードされるプレハブが見つかりませんでした。パス={0}", prefabsPath)); } } return prefabs; } private void AdjustTargetPosition(GameObject go, UIScrollView scrollView) { go.GetComponent().Reposition(); scrollView.ResetPosition(); } private void AdjustTargetPositionGridAndTable(GameObject goGrid, GameObject goTable, UIScrollView scrollView) { goGrid.GetComponent().Reposition(); goTable.GetComponent().Reposition(); scrollView.ResetPosition(); } private void ClearExistChildGameObject(GameObject parent) { IEnumerator enumerator = parent.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; UnityEngine.Object.Destroy(transform.gameObject); } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } parent.transform.DetachChildren(); } private int ToPercent(int number) { return (int)Math.Floor((double)(number / 10)); } public void OnDisable() { if (!this.m_bInited) { return; } this.SetFirstName(this.m_inFirstName.value); this.SetLastName(this.m_inLastName.value); this.SetFreeCommnet(this.m_inFreeComment.value); } public void UpdateProfileData(bool updateYotogiSkill) { if (this.m_enabledInput) { this.m_maidStatus.mainChara = !this.m_enabledPersonalityInput; foreach (int featureId in this.m_maidStatus.features.GetKeyArray()) { this.m_maidStatus.RemoveFeature(featureId); } List allDatas = Feature.GetAllDatas(true); foreach (Personal.Data.LearnFeature learnFeature in this.m_maidStatus.personal.acquisitionFeatureList) { if (learnFeature.isLearnPossible(this.m_maidStatus)) { this.m_maidStatus.AddFeature(learnFeature.feature); } } AbstractClassData.ClassType classTypeFlags = AbstractClassData.ClassType.Share | AbstractClassData.ClassType.New | AbstractClassData.ClassType.Old; this.m_maidStatus.yotogiClass.Clear(); foreach (YotogiClass.Data data in this.m_maidStatus.yotogiClass.GetLearnPossibleClassDatas(false, classTypeFlags)) { if (GameMain.Instance.CharacterMgr.status.IsYotogiClassOpenFlag(data.id)) { this.m_maidStatus.yotogiClass.Add(data.id, false, true); } } int id = this.m_maidStatus.selectedJobClass.data.id; HashSet hashSet = new HashSet(); foreach (KeyValuePair> keyValuePair in this.m_maidStatus.jobClass.GetAllDatas()) { hashSet.Add(keyValuePair.Key); } HashSet hashSet2 = new HashSet(); foreach (JobClass.Data data2 in this.m_maidStatus.jobClass.GetLearnPossibleClassDatas(false, classTypeFlags)) { if (GameMain.Instance.CharacterMgr.status.IsJobClassOpenFlag(data2.id)) { hashSet2.Add(data2.id); } } HashSet hashSet3 = new HashSet(); foreach (int item in hashSet) { if (!hashSet2.Contains(item)) { hashSet3.Add(item); } } HashSet hashSet4 = new HashSet(); foreach (int item2 in hashSet2) { if (!hashSet.Contains(item2)) { hashSet4.Add(item2); } } foreach (int id2 in hashSet3) { this.m_maidStatus.jobClass.Remove(id2, true); } int num = -1; foreach (int num2 in hashSet4) { this.m_maidStatus.jobClass.Add(num2, false, true); num = ((num >= num2) ? num : num2); } if (num != -1) { this.m_maidStatus.ChangeJobClass(num); } if (updateYotogiSkill) { this.m_maidStatus.yotogiSkill.Clear(); List learnPossibleSkills = Skill.GetLearnPossibleSkills(this.m_maidStatus); foreach (Skill.Data data3 in learnPossibleSkills) { this.m_maidStatus.yotogiSkill.Add(data3.id); } } this.m_maidStatus.UpdateClassBonusStatus(); this.m_maidStatus.sexPlayNumberOfPeople = MaidProfile.UpdateInitPlayNumber(this.m_maidStatus.maid); } this.m_maidStatus.UpdateBodyParam(); this.m_maidStatus.profileComment = MaidProfile.Create(this.m_maidStatus.maid, !this.m_enabledInput); } private Status m_maidStatus; private ProfileCtrl.ProfileAttribute m_profileAttribute; private GameObject m_goProfilePanel; private GameObject m_goProfileComment; private GameObject m_goFreeComment; private GameObject m_goProfileTabSelector; private GameObject m_goFreeTabSelector; private GameObject m_goProfileLabelUnitPrefab; private GameObject m_goYotogiSkillUnitPrefab; private GameObject m_goMaidPointTitleAndFrame; private GameObject m_goMaidSkillParent; private GameObject m_goCharacterParent; private GameObject m_goPropensityParent; private GameObject m_goYotogiSkillParent; private GameObject m_goErogenousZoneParent; private GameObject m_goMaidSkillViewer; private GameObject m_goCharacterViewer; private GameObject m_goPropensityViewer; private GameObject m_goYotogiSkillViewer; private GameObject m_goPersonalSelectorIcon; private GameObject m_goSexualExperienceSelectorIcon; private UIScrollView m_maidSkillScrollView; private UIScrollView m_characterScrollView; private UIScrollView m_propensityScrollView; private UIScrollView m_yotogiSkillScrollView; private UIScrollView m_attributeScrollView; private UILabel m_lContractType; private UILabel m_lMaidClassName; private UILabel m_lMaidClassLevel; private UILabel m_lMaidClassExp; private UILabel m_lMaidClassRequiredExp; private UILabel m_lYotogiClassName; private UILabel m_lYotogiClassLevel; private UILabel m_lYotogiClassExp; private UILabel m_lYotogiClassRequiredExp; private UILabel m_lHeight; private UILabel m_lWeight; private UILabel m_lBust; private UILabel m_lCup; private UILabel m_lWaist; private UILabel m_lHip; private UILabel m_lRelation; private UILabel m_lConditionText; private UILabel m_lYotogiPlayCount; private UILabel m_lOthersPlayCount; private UILabel m_lHp; private UILabel m_lLikability; private UILabel m_lMind; private UILabel m_lReception; private UILabel m_lCare; private UILabel m_lStudyRate; private UILabel m_lTeachRate; private UILabel m_lCooking; private UILabel m_lDance; private UILabel m_lVocal; private UILabel m_lLovely; private UILabel m_lElegance; private UILabel m_lCharm; private UILabel m_lInran; private UILabel m_lMValue; private UILabel m_lHentai; private UILabel m_lHousi; private UILabel m_lMaidPoint; private UILabel m_lProfileComment; private UIInput m_inFreeComment; private UIInput m_inFirstName; private UIInput m_inLastName; private UIButton m_buFirstName; private UIButton m_buLastName; private UIPopupList m_pPersonal; private UILabel m_lPersonal; private UIPopupList m_pSexualExperience; private UIButton m_bProfileTab; private UIButton m_bFreeTab; private BoxCollider m_clFirstName; private BoxCollider m_clLastName; private BoxCollider m_clPersonal; private BoxCollider m_clSexualExperience; private static Dictionary m_dicPersonal; private static Dictionary m_dicSexualExperience; private Dictionary m_dicSubViewer; private Dictionary m_dicUpperBtn; private Dictionary m_dicProfileLabel; private Dictionary m_dicYotogiSkill; private Dictionary m_dicSpriteName; private bool m_bInited; private Color activeColor; private Color inActiveColor; private const int MAX_NAME_LENGTH = 8; private const int MAX_FREE_COMMENT_LENGTH = 304; private const int MAX_EROGENOUSZONE_UNIT = 7; private const int MAX_ATTRIBUTE_UNIT = 10; private const int DENOMINATOR = 10; private const string MAID_SKILL_UNIT_PARENT_PATH = "SubWindows/MaidSkillViewer/Contents/MaidSkillUnitParent"; private const string CHARACTER_UNIT_PARENT_PATH = "SubWindows/CharacterViewer/Contents/CharacterUnitParent"; private const string PROPENSITY_UNIT_PARENT_PATH = "SubWindows/PropensityViewer/Contents/CharacterUnitParent"; private const string YOTOGI_SKILL_UNIT_PARENT_PATH = "SubWindows/YotogiSkillViewer/Contents/YotogiSkillUnitParent"; private const string ATTRIBUTE_UNIT_PARENT_PATH = "SubWindows/AttributeViewer/Contents/Attribute/AttributeUnitParent"; private const string EROGENOUS_ZONE_UNIT_PARENT_PATH = "SubWindows/AttributeViewer/Contents/ErogenousZone/ErogenousZoneParent"; private const string PROFILE_LABEL_UNIT_PREFAB_PATH = "SceneEdit/Profile/Prefab/ProfileLabelUnit"; private const string PROFILE_YOTOGI_SKILL_UNIT_PREFAB_PATH = "SceneEdit/Profile/Prefab/YotogiSkillUnit"; private const string PROFILE_ATTRIBUTE_UNIT_PREFAB_PATH = "SceneEdit/Profile/Prefab/AttributeUnit"; private const string PROFILE_EROGENOUS_ZONE_UNIT_PREFAB_PATH = "SceneEdit/Profile/Prefab/ErogenousZoneUnit"; private float initMaidPointUIPosX; public enum LevelOfAchievement { level_1, level_2, level_3, level_4 } private class UpperButton { public ProfileMgr.UpperButtonType m_name; public GameObject m_goSelectCursor; public UIButton m_btnButton; } public class ProfileLabelUnit { public string m_id; public string m_parameter; } public class ProfileYotogiSkillUnit { public string m_id; public string m_number; public string m_skillName; public ProfileCtrl.LevelOfAchievement m_levelOfAchievement; } public class ProfileAttribute { public ProfileAttribute() { this.m_listAttributeUnitName = new List(); } public List m_listAttributeUnitName; } public class ErogenousZoneUnit { public string m_category; public int m_PercentNumber; } }