123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- using MaidStatus;
- using UnityEngine;
- public class ProfileMgr : BaseMgr<ProfileMgr>
- {
- public bool m_enabledInput { get; private set; }
- public bool m_enabledPersonalityInput { get; private set; }
- public Status m_maidStatus { get; set; }
- private void Start()
- {
- this.Init();
- }
- private void Init()
- {
- UIRoot componentInParent = base.GetComponentInParent<UIRoot>();
- this.m_goProfilePanel = componentInParent.transform.Find("ProfilePanel").gameObject;
- if (this.m_goProfilePanel == null)
- {
- Debug.LogError(string.Format("{0}が見つかりませんでした", "ProfilePanel"));
- return;
- }
- this.m_profileCtrl = this.m_goProfilePanel.GetComponent<ProfileCtrl>();
- Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);
- this.m_maidStatus = maid.status;
- this.m_enabledInput = (this.sceneEdit.modeType == SceneEdit.ModeType.OriginalChara || this.sceneEdit.modeType == SceneEdit.ModeType.MainChara);
- this.m_enabledPersonalityInput = (this.sceneEdit.modeType == SceneEdit.ModeType.OriginalChara);
- this.m_profileCtrl.Init(this.m_goProfilePanel, this.m_maidStatus);
- this.m_profileCtrl.SetActiveViewerAndButton(ProfileMgr.UpperButtonType.None);
- this.m_dicDividedPoint = this.InitDicDividedPoint();
- this.m_goProfilePanel.SetActive(false);
- this.m_bInited = true;
- }
- private Dictionary<string, int> InitDicDividedPoint()
- {
- this.m_dicDividedPoint = new Dictionary<string, int>();
- this.m_dicDividedPoint.Add("Lovely", 0);
- this.m_dicDividedPoint.Add("Elegance", 0);
- this.m_dicDividedPoint.Add("Charm", 0);
- this.m_dicDividedPoint.Add("Hentai", 0);
- this.m_dicDividedPoint.Add("MValue", 0);
- this.m_dicDividedPoint.Add("Inran", 0);
- this.m_dicDividedPoint.Add("Housi", 0);
- this.m_dicDividedPoint.Add("Cooking", 0);
- this.m_dicDividedPoint.Add("Dance", 0);
- this.m_dicDividedPoint.Add("Vocal", 0);
- return this.m_dicDividedPoint;
- }
- public void OpenProfilePanel()
- {
- if (BaseMgr<PresetButtonMgr>.Instance != null)
- {
- BaseMgr<PresetButtonMgr>.Instance.CloseItemPresetsViewer();
- }
- this.LoadMaidParamData();
- this.m_goProfilePanel.SetActive(true);
- }
- public void CloseProfilePanel()
- {
- this.m_goProfilePanel.SetActive(false);
- }
- public void ClickUpperButton()
- {
- this.MakeSubWindowData();
- string name = UIButton.current.name;
- ProfileMgr.UpperButtonType upperButtonType = (ProfileMgr.UpperButtonType)Enum.Parse(typeof(ProfileMgr.UpperButtonType), name);
- if (upperButtonType == ProfileMgr.currentActiveBtn)
- {
- this.m_profileCtrl.SetActiveViewerAndButton(ProfileMgr.UpperButtonType.None);
- return;
- }
- if (upperButtonType != ProfileMgr.UpperButtonType.Character)
- {
- if (upperButtonType != ProfileMgr.UpperButtonType.Propensity)
- {
- Debug.LogError(string.Format("不適切なボタンが押されました。 ボタン名={0}", name));
- }
- else
- {
- this.m_profileCtrl.CreatePropensityViewer(this.m_dicPropensity);
- }
- }
- else
- {
- this.m_profileCtrl.CreateCharacterViewer(this.m_dicCharacter);
- }
- }
- public void ChangeCommentTab()
- {
- string name = UIButton.current.name;
- if (name == this.m_currentTab.ToString())
- {
- return;
- }
- if (name == ProfileMgr.CommentTab.ProfileTab.ToString() || name == ProfileMgr.CommentTab.FreeTab.ToString())
- {
- this.m_profileCtrl.ChangeCommentTab(name);
- this.m_currentTab = (ProfileMgr.CommentTab)Enum.Parse(typeof(ProfileMgr.CommentTab), name);
- }
- else
- {
- Debug.LogError(string.Format("不適切なタブが選択されました。タブ名={0}", name));
- }
- }
- public void OnValueChangePopupList(string popupListName)
- {
- if (!this.m_bInited || string.IsNullOrEmpty(popupListName))
- {
- return;
- }
- string text = this.DelNewlineOfSentenceEnd(UIPopupList.current.value);
- if (popupListName == ProfileMgr.PopUpList.Personal.ToString())
- {
- if (text != this.m_currentPersonal)
- {
- this.m_profileCtrl.SetPersonal(text);
- this.m_currentPersonal = text;
- this.CloseSubWindowIfOpen();
- this.LoadMaidParamData();
- }
- }
- else if (popupListName == ProfileMgr.PopUpList.SexualExperience.ToString())
- {
- if (text != this.m_currentSexualExperience)
- {
- this.m_profileCtrl.SetSexualExperience(text);
- this.m_currentSexualExperience = text;
- this.CloseSubWindowIfOpen();
- this.LoadMaidParamData();
- }
- }
- else
- {
- Debug.LogError("不適切なポップアップリストが選択されました");
- }
- }
- public void OnChangeLastName()
- {
- string value = UIInput.current.value;
- this.m_profileCtrl.SetLastName(value);
- }
- public void OnChangeFirstName()
- {
- string value = UIInput.current.value;
- this.m_profileCtrl.SetFirstName(value);
- }
- public void OnChangeFreeComment()
- {
- string value = UIInput.current.value;
- this.m_profileCtrl.SetFreeCommnet(value);
- }
- public void CloseSubWindowIfOpen()
- {
- if (ProfileMgr.currentActiveBtn == ProfileMgr.UpperButtonType.Character || ProfileMgr.currentActiveBtn == ProfileMgr.UpperButtonType.Propensity)
- {
- this.m_profileCtrl.SetActiveViewerAndButton(ProfileMgr.UpperButtonType.None);
- return;
- }
- }
- public void LoadMaidParamData()
- {
- this.m_profileCtrl.LoadMaidParamData();
- }
- public void UpdateProfileData(bool updateYotogiSkill)
- {
- this.m_profileCtrl.UpdateProfileData(updateYotogiSkill);
- }
- private string DelNewlineOfSentenceEnd(string str)
- {
- return Regex.Replace(str, "[\\r\\n]+$", string.Empty);
- }
- private void MakeSubWindowData()
- {
- this.m_dicCharacter = new Dictionary<string, ProfileCtrl.ProfileLabelUnit>();
- HashSet<string> hashSet = new HashSet<string>();
- hashSet.Add("過去の秘密");
- hashSet.Add("過去の過ち");
- hashSet.Add("疲労");
- foreach (int num in this.m_maidStatus.features.GetKeyArray())
- {
- ProfileCtrl.ProfileLabelUnit profileLabelUnit = new ProfileCtrl.ProfileLabelUnit();
- profileLabelUnit.m_parameter = this.m_maidStatus.features.Get(num).drawName;
- profileLabelUnit.m_id = num.ToString();
- string uniqueName = this.m_maidStatus.features.Get(num).uniqueName;
- if (hashSet.Contains(uniqueName))
- {
- profileLabelUnit.m_id = (num * 1000).ToString();
- }
- this.m_dicCharacter.Add(profileLabelUnit.m_id, profileLabelUnit);
- }
- this.m_dicPropensity = new Dictionary<string, ProfileCtrl.ProfileLabelUnit>();
- foreach (int key in this.m_maidStatus.propensitys.GetKeyArray())
- {
- ProfileCtrl.ProfileLabelUnit profileLabelUnit2 = new ProfileCtrl.ProfileLabelUnit();
- profileLabelUnit2.m_parameter = this.m_maidStatus.propensitys.Get(key).drawName;
- profileLabelUnit2.m_id = key.ToString();
- this.m_dicPropensity.Add(profileLabelUnit2.m_id, profileLabelUnit2);
- }
- this.m_dicMaidSkill = new Dictionary<string, ProfileCtrl.ProfileLabelUnit>();
- this.m_dicYotogiSkill = new Dictionary<string, ProfileCtrl.ProfileYotogiSkillUnit>();
- }
- private T Random<T>()
- {
- System.Random random = new System.Random();
- return (from T c in Enum.GetValues(typeof(T))
- orderby random.Next()
- select c).FirstOrDefault<T>();
- }
- [SerializeField]
- private SceneEdit sceneEdit;
- public Dictionary<string, ProfileCtrl.ProfileLabelUnit> m_dicMaidSkill;
- public Dictionary<string, ProfileCtrl.ProfileLabelUnit> m_dicCharacter;
- public Dictionary<string, ProfileCtrl.ProfileYotogiSkillUnit> m_dicYotogiSkill;
- public Dictionary<string, ProfileCtrl.ProfileLabelUnit> m_dicPropensity;
- public ProfileCtrl.ProfileAttribute m_profileAttribute;
- public Dictionary<string, int> m_dicDividedPoint;
- public static ProfileMgr.UpperButtonType currentActiveBtn = ProfileMgr.UpperButtonType.None;
- private bool m_bInited;
- private GameObject m_goProfilePanel;
- private ProfileCtrl m_profileCtrl;
- private ProfileMgr.CommentTab m_currentTab;
- private string m_currentPersonal;
- private string m_currentSexualExperience;
- public enum CommentTab
- {
- ProfileTab,
- FreeTab
- }
- private enum PopUpList
- {
- None = -1,
- Personal,
- SexualExperience
- }
- public enum UpperButtonType
- {
- None = -1,
- MaidSkill,
- YotogiSkill,
- Character,
- Propensity
- }
- }
|