using System; using System.Collections.Generic; using I2.Loc; using MaidStatus; using UnityEngine; using wf; using Yotogis; public class YotogiSkillListManager : MonoBehaviour { public static Dictionary CreateDatas(Status status, bool specialConditionCheck, Skill.Data.SpecialConditionType type = Skill.Data.SpecialConditionType.Null) { Dictionary dictionary = new Dictionary(); List> list = new List>(); foreach (SortedDictionary sortedDictionary in Skill.skill_data_list) { foreach (KeyValuePair keyValuePair in sortedDictionary) { list.Clear(); Skill.Data value = keyValuePair.Value; if (!specialConditionCheck || value.specialConditionType == type) { if (value.IsExecSeikeiken(status.seikeiken) && value.IsExecRelation(status.relation) && value.IsExecContract(status.contract) && value.IsExecPersonal(status.personal)) { YotogiSkillData yotogiSkillData = status.yotogiSkill.Get(value.id); if (yotogiSkillData == null) { if (value.getcondition_data.yotogi_class != null && !value.getcondition_data.yotogi_class.learnConditions.isFutureLearnPossible(status)) { continue; } list = value.getcondition_data.CreateConditionTextAndStaturResults(status); } if (list.Count == 0) { list.Add(new KeyValuePair(new string[] { "MaidStatus/条件文/なし" }, true)); } YotogiSkillListManager.Data data = new YotogiSkillListManager.Data(); data.skillData = value; data.conditionDatas = list.ToArray(); data.maidStatusSkillData = yotogiSkillData; dictionary.Add(data.skillData.id, data); } } } } return dictionary; } public static Dictionary CreateDatasOld(Status status) { Dictionary dictionary = new Dictionary(); List> list = new List>(); foreach (SortedDictionary sortedDictionary in Skill.Old.skill_data_list) { foreach (KeyValuePair keyValuePair in sortedDictionary) { list.Clear(); Skill.Old.Data value = keyValuePair.Value; if (value.IsExecSeikeiken(status.seikeiken) && value.IsExecRelation(status.relation)) { YotogiSkillData yotogiSkillData = status.yotogiSkill.Get(value.id); if (yotogiSkillData == null) { list = value.getcondition_data.CreateConditionTextAndStaturResults(status); } if (list.Count == 0) { list.Add(new KeyValuePair(new string[] { "MaidStatus/条件文/なし" }, true)); } YotogiSkillListManager.Data data = new YotogiSkillListManager.Data(); data.skillDataOld = value; data.conditionDatas = list.ToArray(); data.maidStatusSkillData = yotogiSkillData; dictionary.Add(value.id, data); } } } return dictionary; } private void Awake() { if (this.conditionDatas != null) { return; } this.itemGrid = this.contentObject.GetComponent(); NDebug.AssertNull(this.itemGrid != null); this.conditionList = this.conditionsObject.GetComponentInChildren(); NDebug.AssertNull(this.conditionList != null); this.conditionBG = UTY.GetChildObject(this.conditionsObject, "BG", false).GetComponent(); for (int i = 0; i < 50; i++) { this.InstantiateSkillItem(this.storageObject); } this.conditionDatas = new Dictionary[]>(); this.instansToSkillDatas = new Dictionary>(); this.conditionsObject.SetActive(false); } public void CreateData(Maid maid) { if (this.conditionDatas == null) { this.Awake(); } this.DeleteItemAllObject(); this.conditionDatas.Clear(); this.instansToSkillDatas.Clear(); Utility.ResetNGUI(this.itemGrid); Utility.ResetNGUI(this.scrollView); List> list = new List>(); int num = 0; Dictionary dictionary; if (MaidManagement.compatibilityMode) { dictionary = YotogiSkillListManager.CreateDatasOld(maid.status); } else { dictionary = YotogiSkillListManager.CreateDatas(maid.status, false, Skill.Data.SpecialConditionType.Null); } List list2 = new List(); bool lockNTRPlay = GameMain.Instance.CharacterMgr.status.lockNTRPlay; foreach (KeyValuePair keyValuePair in dictionary) { YotogiSkillListManager.Data value = keyValuePair.Value; if (value.skillData != null) { if (!value.skillData.IsSkillListDisplay(lockNTRPlay)) { continue; } } else if (value.skillDataOld != null && lockNTRPlay && (value.skillDataOld.category == YotogiOld.Category.交換 || value.skillDataOld.category == YotogiOld.Category.乱交)) { continue; } if (value.skillData != null && value.skillData.getcondition_data.requestPersonals.Length != 0) { list2.Add(value); } else { string skillName = (value.skillData == null) ? value.skillDataOld.name : value.skillData.name; string skillNameTerm = (value.skillData == null) ? value.skillDataOld.name : value.skillData.termName; int skillId = (value.skillData == null) ? value.skillDataOld.id : value.skillData.id; GameObject gameObject = this.CreateItemObject(maid, ++num, skillName, skillNameTerm, skillId); if (0 < value.conditionDatas.Length) { List> list3 = new List>(); foreach (KeyValuePair keyValuePair2 in value.conditionDatas) { list3.Add(new KeyValuePair(keyValuePair2.Key, (!keyValuePair2.Value) ? Color.gray : Color.white)); } this.conditionDatas.Add(gameObject.GetInstanceID(), list3.ToArray()); this.instansToSkillDatas.Add(gameObject.GetInstanceID(), new KeyValuePair(value.skillData, value.skillDataOld)); } } } foreach (YotogiSkillListManager.Data data in list2) { string skillName2 = (data.skillData == null) ? data.skillDataOld.name : data.skillData.name; string skillNameTerm2 = (data.skillData == null) ? data.skillDataOld.name : data.skillData.termName; int skillId2 = (data.skillData == null) ? data.skillDataOld.id : data.skillData.id; GameObject gameObject2 = this.CreateItemObject(maid, -1, skillName2, skillNameTerm2, skillId2); if (0 < data.conditionDatas.Length) { List> list4 = new List>(); if (data.skillData != null) { foreach (Personal.Data data2 in data.skillData.getcondition_data.requestPersonals) { if (maid.status.personal.id == data2.id) { string text = Product.supportMultiLanguage ? maid.status.personal.termName : maid.status.personal.drawName; list4.Add(new KeyValuePair(new string[] { "MaidStatus/条件文/ヒロインタイプ {0}", text }, Color.white)); break; } } } foreach (KeyValuePair keyValuePair3 in data.conditionDatas) { list4.Add(new KeyValuePair(keyValuePair3.Key, (!keyValuePair3.Value) ? Color.gray : Color.white)); } this.conditionDatas.Add(gameObject2.GetInstanceID(), list4.ToArray()); this.instansToSkillDatas.Add(gameObject2.GetInstanceID(), new KeyValuePair(data.skillData, data.skillDataOld)); } } Utility.ResetNGUI(this.itemGrid); Utility.ResetNGUI(this.scrollView); } private void OnEnable() { Utility.ResetNGUI(this.itemGrid); Utility.ResetNGUI(this.scrollView); this.OnHoverOutItem(); } private GameObject InstantiateSkillItem(GameObject parent) { GameObject gameObject = Utility.CreatePrefab(parent, "SceneEdit/Profile/Prefab/ProfileYotogiSkillItem", true); UIEventTrigger component = gameObject.GetComponent(); EventDelegate eventDelegate = new EventDelegate(this, "OnHoverOverItem"); eventDelegate.parameters[0].value = gameObject.GetInstanceID(); EventDelegate.Add(component.onHoverOver, eventDelegate); EventDelegate.Add(component.onHoverOut, new EventDelegate.Callback(this.OnHoverOutItem)); return gameObject; } private void OnHoverOverItem(int instanceId) { if (this.conditionDatas.ContainsKey(instanceId)) { KeyValuePair keyValuePair = this.instansToSkillDatas[instanceId]; this.conditionTitleLabel.text = ((keyValuePair.Key == null) ? keyValuePair.Value.name : keyValuePair.Key.name) + " 取得条件"; if (Product.supportMultiLanguage) { Localize component = this.conditionTitleLabel.GetComponent(); if (component != null) { string term = (keyValuePair.Key == null) ? keyValuePair.Value.name : keyValuePair.Key.termName; Localize.ArgsPair[] termArgs = new Localize.ArgsPair[] { Localize.ArgsPair.Create(" {0}", false), Localize.ArgsPair.Create("System/取得条件", true) }; component.TermArgs = termArgs; component.SetTerm(term); } } this.conditionList.SetTexts(this.conditionDatas[instanceId], 500); this.conditionBG.height = 90 + this.conditionList.height; this.conditionsObject.SetActive(true); } else { this.OnHoverOutItem(); } } private void OnHoverOutItem() { this.conditionsObject.SetActive(false); } private GameObject CreateItemObject(Maid maid, int no, string skillName, string skillNameTerm, int skillId) { GameObject gameObject; if (this.storageObject.transform.childCount == 0) { gameObject = this.InstantiateSkillItem(this.storageObject); } else { gameObject = this.storageObject.transform.GetChild(0).gameObject; } gameObject.transform.SetParent(this.contentObject.transform, false); if (0 <= no) { gameObject.name = no.ToString("D4"); } else { gameObject.name = "EX"; } UILabel component = UTY.GetChildObject(gameObject, "Number/Value", false).GetComponent(); if (0 <= no) { component.text = no.ToString(); } else { component.text = "EX"; } UILabel component2 = UTY.GetChildObject(gameObject, "SkillName/Value", false).GetComponent(); component2.text = skillName; Localize component3 = component2.GetComponent(); if (component3 != null) { component3.SetTerm(skillNameTerm); } UISprite component4 = UTY.GetChildObject(gameObject, "LevelOfAchievement/Icon", false).GetComponent(); int num = (!maid.status.yotogiSkill.Contains(skillId)) ? 0 : maid.status.yotogiSkill.Get(skillId).level; string spriteName = "profile_yotogiskill_sign_minus"; if (num != 1) { if (num != 2) { if (num == 3) { spriteName = "cm3d2_edit_profile_yotogiskill_sign_nijumaru"; } } else { spriteName = "cm3d2_edit_profile_yotogiskill_sign_maru"; } } else { spriteName = "cm3d2_edit_profile_yotogiskill_sign_sankaku"; } if (maid.status.yotogiSkill.Contains(skillId) && maid.status.yotogiSkill.Get(skillId).playCount == 0u) { spriteName = "cm3d2_edit_profile_yotogiskill_sign_batu"; } component4.spriteName = spriteName; component2.color = ((num != 0) ? Color.white : Color.gray); gameObject.GetComponent().enabled = (num == 0); return gameObject; } private void DeleteItemAllObject() { List list = new List(); for (int i = 0; i < this.contentObject.transform.childCount; i++) { list.Add(this.contentObject.transform.GetChild(i).gameObject); } foreach (GameObject obj in list) { this.DeleteItemObject(obj); } } private void DeleteItemObject(GameObject obj) { if (obj.transform.parent != this.storageObject.transform) { obj.transform.SetParent(this.storageObject.transform, false); } } [SerializeField] private GameObject storageObject; [SerializeField] private GameObject contentObject; [SerializeField] private UIScrollView scrollView; [SerializeField] private GameObject conditionsObject; [SerializeField] private UILabel conditionTitleLabel; private UIGrid itemGrid; private UIWFConditionList conditionList; private UIWidget conditionBG; private Dictionary[]> conditionDatas; private Dictionary> instansToSkillDatas; public class Data { public bool enabled { get { return this.maidStatusSkillData != null; } } public Skill.Data skillData; public Skill.Old.Data skillDataOld; public KeyValuePair[] conditionDatas; public YotogiSkillData maidStatusSkillData; } }