123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440 |
- using System;
- using System.Collections.Generic;
- using MaidStatus;
- using MaidStatus.CsvData;
- using UnityEngine;
- using wf;
- using Yotogis;
- public class ClassChangePanel : MonoBehaviour
- {
- public static void CreateClassText()
- {
- if (ClassChangePanel.job_class_special_skill_list_.Count != 0)
- {
- return;
- }
- foreach (JobClass.Data data in JobClass.GetAllDatas(false))
- {
- ClassChangePanel.job_class_special_skill_list_.Add(data.id, new SortedList<int, List<Skill.Data>>());
- }
- }
- public void Awake()
- {
- if (this.job_class_unit_dic_.Count != 0)
- {
- return;
- }
- this.class_type_tab_panel_ = UTY.GetChildObject(base.gameObject, "ClassViewer/TabButton", false).GetComponent<UIWFTabPanel>();
- this.job_class_button_ = UTY.GetChildObject(base.gameObject, "ClassViewer/TabButton/MaidClass", false).GetComponent<UIWFTabButton>();
- this.info_panel_item_.class_name = UTY.GetChildObject(base.gameObject, "ClassViewer/Common/ClassDescription/ClassName", false).GetComponent<UILabel>();
- this.info_panel_item_.class_level = UTY.GetChildObject(base.gameObject, "ClassViewer/Common/ClassDescription/LevelGroup/Level/Value", false).GetComponent<UILabel>();
- this.info_panel_item_.current_exp = UTY.GetChildObject(base.gameObject, "ClassViewer/Common/ClassDescription/LevelGroup/Exp/Value", false).GetComponent<UILabel>();
- this.info_panel_item_.next_exp = UTY.GetChildObject(base.gameObject, "ClassViewer/Common/ClassDescription/LevelGroup/RequiredExp/Value", false).GetComponent<UILabel>();
- this.info_panel_item_.info_text = UTY.GetChildObject(base.gameObject, "ClassViewer/Common/ClassDescription/Description", false).GetComponent<UILabel>();
- this.info_panel_item_.special_skill = new List<UILabel>();
- GameObject childObject = UTY.GetChildObject(base.gameObject, "ClassViewer/Yotogi/SkillList/Contents/UnitParent", false);
- int childCount = childObject.transform.childCount;
- for (int i = 0; i < childCount; i++)
- {
- this.info_panel_item_.special_skill.Add(childObject.transform.GetChild(i).gameObject.GetComponent<UILabel>());
- }
- this.jobUIs = new ClassChangePanel.UISet();
- this.jobUIs.selectButton = UTY.GetChildObject(this.class_type_tab_panel_.gameObject, "MaidClass", false).GetComponent<UIWFTabButton>();
- this.jobUIs.classListObject = UTY.GetChildObject(base.gameObject, "ClassViewer/Common/ClassListMaid", false);
- this.jobUIs.itemGrid = UTY.GetChildObject(this.jobUIs.classListObject, "Contents/UnitParent", false).GetComponent<UIGrid>();
- this.jobUIs.scrollView = UTY.GetChildObject(this.jobUIs.classListObject, "Contents", false).GetComponent<UIScrollView>();
- this.jobUIs.tabPanel = this.jobUIs.classListObject.GetComponentInChildren<UIWFTabPanel>();
- this.jobUIs.classListObject.SetActive(true);
- List<JobClass.Data> allDatas = JobClass.GetAllDatas(true);
- allDatas.Sort();
- foreach (JobClass.Data data in allDatas)
- {
- ClassUnit component = Utility.CreatePrefab(this.jobUIs.itemGrid.gameObject, "SceneCompetitiveShow/Prefab/ClassUnit", true).GetComponent<ClassUnit>();
- component.SetJobClassType(data.id);
- component.SetClassChangePanel(this);
- component.SetOnSelectEvent(new Action<ClassUnit>(this.OnSelectClassUnitEvent));
- UIEventTrigger[] componentsInChildren = component.GetComponentsInChildren<UIEventTrigger>();
- EventDelegate eventDelegate = new EventDelegate(this, "OnUnitMouseHoverIn");
- eventDelegate.parameters[0].value = component;
- foreach (UIEventTrigger uieventTrigger in componentsInChildren)
- {
- EventDelegate.Add(uieventTrigger.onHoverOver, eventDelegate);
- EventDelegate.Add(uieventTrigger.onHoverOut, new EventDelegate.Callback(this.OnUnitMouseHoverOut));
- }
- this.job_class_unit_dic_.Add(data.id, component);
- }
- this.jobUIs.tabPanel.UpdateChildren();
- this.jobUIs.itemGrid.repositionNow = true;
- EventDelegate.Add(this.jobUIs.selectButton.onSelect, new EventDelegate.Callback(this.OnSelectType));
- this.jobUIs.classListObject.SetActive(false);
- this.yotogiUIs = new ClassChangePanel.UISet();
- this.yotogiUIs.selectButton = UTY.GetChildObject(this.class_type_tab_panel_.gameObject, "YotogiClass", false).GetComponent<UIWFTabButton>();
- this.yotogiUIs.classListObject = UTY.GetChildObject(base.gameObject, "ClassViewer/Common/ClassListYotogi", false);
- this.yotogiUIs.itemGrid = UTY.GetChildObject(this.yotogiUIs.classListObject, "Contents/UnitParent", false).GetComponent<UIGrid>();
- this.yotogiUIs.scrollView = UTY.GetChildObject(this.yotogiUIs.classListObject, "Contents", false).GetComponent<UIScrollView>();
- this.yotogiUIs.tabPanel = this.yotogiUIs.classListObject.GetComponentInChildren<UIWFTabPanel>();
- this.yotogiUIs.classListObject.SetActive(true);
- foreach (YotogiClass.Data data2 in YotogiClass.GetAllDatas(true))
- {
- ClassUnit component2 = Utility.CreatePrefab(this.yotogiUIs.itemGrid.gameObject, "SceneCompetitiveShow/Prefab/ClassUnit", true).GetComponent<ClassUnit>();
- component2.SetYotogiClassType(data2.id);
- component2.SetClassChangePanel(this);
- component2.SetOnSelectEvent(new Action<ClassUnit>(this.OnSelectClassUnitEvent));
- UIEventTrigger[] componentsInChildren2 = component2.GetComponentsInChildren<UIEventTrigger>();
- EventDelegate eventDelegate2 = new EventDelegate(this, "OnUnitMouseHoverIn");
- eventDelegate2.parameters[0].value = component2;
- foreach (UIEventTrigger uieventTrigger2 in componentsInChildren2)
- {
- EventDelegate.Add(uieventTrigger2.onHoverOver, eventDelegate2);
- EventDelegate.Add(uieventTrigger2.onHoverOut, new EventDelegate.Callback(this.OnUnitMouseHoverOut));
- }
- this.yotogi_class_unit_dic_.Add(data2.id, component2);
- }
- this.yotogiUIs.tabPanel.UpdateChildren();
- this.yotogiUIs.itemGrid.repositionNow = true;
- EventDelegate.Add(this.yotogiUIs.selectButton.onSelect, new EventDelegate.Callback(this.OnSelectType));
- this.yotogiUIs.classListObject.SetActive(false);
- ClassChangePanel.CreateClassText();
- this.class_type_tab_panel_.gameObject.SetActive(false);
- }
- public void OnEnable()
- {
- this.jobUIs.Reset();
- this.yotogiUIs.Reset();
- }
- public void SetTargetMaid(Maid maid)
- {
- if (this.job_class_unit_dic_.Count == 0)
- {
- bool activeSelf = base.gameObject.activeSelf;
- base.gameObject.SetActive(true);
- this.Awake();
- base.gameObject.SetActive(activeSelf);
- }
- this.maid_ = maid;
- Status status = this.maid_.status;
- foreach (KeyValuePair<int, ClassUnit> keyValuePair in this.job_class_unit_dic_)
- {
- keyValuePair.Value.UpdateMaidData(this.maid_);
- }
- this.jobUIs.tabPanel.ResetSelect();
- foreach (KeyValuePair<int, ClassUnit> keyValuePair2 in this.job_class_unit_dic_)
- {
- ClassUnit value = keyValuePair2.Value;
- value.button.SetSelect(false);
- value.button.isEnabled = status.jobClass.Contains(value.maid_class_type);
- JobClass.Data data = JobClass.GetData(value.maid_class_type);
- if (MaidManagement.compatibilityMode)
- {
- value.gameObject.SetActive(data.classType != AbstractClassData.ClassType.New);
- }
- else
- {
- value.gameObject.SetActive(data.classType != AbstractClassData.ClassType.Old);
- }
- if (value.gameObject.activeSelf)
- {
- value.gameObject.SetActive(data.learnConditions.isLearnPossiblePersonal(maid.status.personal));
- }
- }
- GameObject gameObject = this.yotogiUIs.itemGrid.gameObject;
- while (gameObject.transform.parent != null && !gameObject.transform.gameObject.activeInHierarchy)
- {
- gameObject = ((!(gameObject.transform.parent != null)) ? null : gameObject.transform.parent.gameObject);
- }
- if (gameObject != null)
- {
- gameObject.SetActive(true);
- }
- this.jobUIs.Reset();
- int num = (status.selectedJobClass == null) ? int.MinValue : status.selectedJobClass.data.id;
- if (num != -2147483648)
- {
- this.jobUIs.tabPanel.Select(this.job_class_unit_dic_[num].button);
- if (this.jobUIs.classListObject.activeSelf)
- {
- this.job_class_unit_dic_[num].UpdateInfo();
- }
- }
- foreach (KeyValuePair<int, ClassUnit> keyValuePair3 in this.yotogi_class_unit_dic_)
- {
- keyValuePair3.Value.UpdateMaidData(this.maid_);
- }
- this.yotogiUIs.tabPanel.ResetSelect();
- foreach (KeyValuePair<int, ClassUnit> keyValuePair4 in this.yotogi_class_unit_dic_)
- {
- ClassUnit value2 = keyValuePair4.Value;
- value2.button.SetSelect(false);
- value2.button.isEnabled = status.yotogiClass.Contains(value2.yotogi_class_type);
- YotogiClass.Data data2 = YotogiClass.GetData(value2.yotogi_class_type);
- value2.gameObject.SetActive(data2.learnConditions.isLearnPossiblePersonal(maid.status.personal));
- }
- gameObject = this.yotogiUIs.itemGrid.gameObject;
- while (gameObject.transform.parent != null && !gameObject.transform.gameObject.activeInHierarchy)
- {
- gameObject = ((!(gameObject.transform.parent != null)) ? null : gameObject.transform.parent.gameObject);
- }
- if (gameObject != null)
- {
- gameObject.SetActive(true);
- }
- this.yotogiUIs.Reset();
- num = ((status.selectedYotogiClass == null) ? int.MinValue : status.selectedYotogiClass.data.id);
- if (num != -2147483648)
- {
- this.yotogiUIs.tabPanel.Select(this.yotogi_class_unit_dic_[num].button);
- if (this.yotogiUIs.classListObject.activeSelf)
- {
- this.yotogi_class_unit_dic_[num].UpdateInfo();
- }
- }
- if (this.class_type_tab_panel_.GetSelectButtonObject() == null)
- {
- this.class_type_tab_panel_.Select(this.job_class_button_);
- }
- }
- private void OnSelectType()
- {
- if (!UIWFSelectButton.current.isSelected)
- {
- return;
- }
- this.jobUIs.classListObject.SetActive(true);
- this.yotogiUIs.classListObject.SetActive(false);
- this.jobUIs.Reset();
- if (this.maid_ != null && this.maid_.status.selectedJobClass != null)
- {
- this.job_class_unit_dic_[this.maid_.status.selectedJobClass.data.id].UpdateInfo();
- }
- }
- public void SetInfoData(int maid_class_type)
- {
- if (this.maid_ == null)
- {
- return;
- }
- JobClass.Data data = JobClass.GetData(maid_class_type);
- ClassData<JobClass.Data> classData = this.maid_.status.jobClass.Get(maid_class_type);
- this.info_panel_item_.class_name.text = data.drawName;
- this.info_panel_item_.info_text.text = data.explanatoryText;
- if (classData != null)
- {
- this.info_panel_item_.class_level.text = classData.level.ToString();
- this.info_panel_item_.current_exp.text = classData.cur_exp.ToString();
- this.info_panel_item_.next_exp.text = classData.next_exp.ToString();
- }
- else
- {
- this.info_panel_item_.class_level.text = "-";
- this.info_panel_item_.current_exp.text = "-";
- this.info_panel_item_.next_exp.text = "-";
- }
- string[] array = new string[this.info_panel_item_.special_skill.Count];
- int num = 0;
- foreach (KeyValuePair<int, List<Skill.Data>> keyValuePair in ClassChangePanel.job_class_special_skill_list_[maid_class_type])
- {
- foreach (Skill.Data data2 in keyValuePair.Value)
- {
- if (num < array.Length)
- {
- array[num++] = data2.name;
- if (array.Length == num)
- {
- array[num - 1] = "etc...";
- }
- }
- if (array.Length == num)
- {
- break;
- }
- }
- if (array.Length == num)
- {
- break;
- }
- }
- for (int i = 0; i < array.Length; i++)
- {
- if (string.IsNullOrEmpty(array[i]))
- {
- this.info_panel_item_.special_skill[i].gameObject.SetActive(false);
- }
- else
- {
- this.info_panel_item_.special_skill[i].gameObject.SetActive(true);
- this.info_panel_item_.special_skill[i].text = array[i];
- }
- }
- }
- public void SetInfoDataYotogi(int yotogi_class_type)
- {
- if (this.maid_ == null)
- {
- return;
- }
- YotogiClass.Data data = YotogiClass.GetData(yotogi_class_type);
- ClassData<YotogiClass.Data> classData = this.maid_.status.yotogiClass.Get(yotogi_class_type);
- this.info_panel_item_.class_name.text = data.drawName;
- this.info_panel_item_.info_text.text = data.explanatoryText;
- if (classData != null)
- {
- this.info_panel_item_.class_level.text = classData.level.ToString();
- this.info_panel_item_.current_exp.text = classData.cur_exp.ToString();
- this.info_panel_item_.next_exp.text = classData.next_exp.ToString();
- }
- else
- {
- this.info_panel_item_.class_level.text = "-";
- this.info_panel_item_.current_exp.text = "-";
- this.info_panel_item_.next_exp.text = "-";
- }
- string[] array = new string[this.info_panel_item_.special_skill.Count];
- int num = 0;
- foreach (KeyValuePair<int, List<Skill.Data>> keyValuePair in YotogiClass.GetLearnSkillList(yotogi_class_type))
- {
- foreach (Skill.Data data2 in keyValuePair.Value)
- {
- if (num < array.Length)
- {
- array[num++] = data2.name;
- if (array.Length == num)
- {
- array[num - 1] = "etc...";
- }
- }
- if (array.Length == num)
- {
- break;
- }
- }
- if (array.Length == num)
- {
- break;
- }
- }
- for (int i = 0; i < array.Length; i++)
- {
- if (string.IsNullOrEmpty(array[i]))
- {
- this.info_panel_item_.special_skill[i].gameObject.SetActive(false);
- }
- else
- {
- this.info_panel_item_.special_skill[i].gameObject.SetActive(true);
- this.info_panel_item_.special_skill[i].text = array[i];
- }
- }
- }
- private void OnSelectClassUnitEvent(ClassUnit unit)
- {
- if (this.maid_ == null)
- {
- return;
- }
- if (unit.maid_class_type != -2147483648)
- {
- if (this.maid_.status.selectedJobClass.data.id != unit.maid_class_type)
- {
- this.maid_.status.ChangeJobClass(unit.maid_class_type);
- }
- }
- else if (unit.yotogi_class_type != -2147483648 && this.maid_.status.selectedYotogiClass.data.id != unit.yotogi_class_type)
- {
- this.maid_.status.ChangeYotogiClass(unit.yotogi_class_type);
- }
- }
- private void OnUnitMouseHoverIn(ClassUnit class_unit)
- {
- class_unit.UpdateInfo();
- }
- private void OnUnitMouseHoverOut()
- {
- if (this.jobUIs.classListObject.activeSelf)
- {
- if (this.maid_ != null && this.maid_.status.selectedJobClass != null && this.job_class_unit_dic_.ContainsKey(this.maid_.status.selectedJobClass.data.id))
- {
- this.job_class_unit_dic_[this.maid_.status.selectedJobClass.data.id].UpdateInfo();
- }
- }
- else if (this.maid_ != null && this.maid_.status.selectedYotogiClass != null && this.yotogi_class_unit_dic_.ContainsKey(this.maid_.status.selectedYotogiClass.data.id))
- {
- this.yotogi_class_unit_dic_[this.maid_.status.selectedYotogiClass.data.id].UpdateInfo();
- }
- }
- public static Dictionary<int, SortedList<int, List<Skill.Data>>> job_class_special_skill_list
- {
- get
- {
- return ClassChangePanel.job_class_special_skill_list_;
- }
- }
- private static Dictionary<int, SortedList<int, List<Skill.Data>>> job_class_special_skill_list_ = new Dictionary<int, SortedList<int, List<Skill.Data>>>();
- private Maid maid_;
- private UIWFTabPanel class_type_tab_panel_;
- private UIWFTabButton job_class_button_;
- private ClassChangePanel.UISet yotogiUIs;
- private ClassChangePanel.UISet jobUIs;
- private Dictionary<int, ClassUnit> job_class_unit_dic_ = new Dictionary<int, ClassUnit>();
- private Dictionary<int, ClassUnit> yotogi_class_unit_dic_ = new Dictionary<int, ClassUnit>();
- private ClassChangePanel.InfoPanelItem info_panel_item_ = default(ClassChangePanel.InfoPanelItem);
- private struct InfoPanelItem
- {
- public UILabel class_name;
- public UILabel class_level;
- public UILabel current_exp;
- public UILabel next_exp;
- public UILabel info_text;
- public List<UILabel> special_skill;
- }
- private class UISet
- {
- public void Reset()
- {
- if (this.itemGrid != null)
- {
- Utility.ResetNGUI(this.itemGrid);
- }
- if (this.scrollView)
- {
- Utility.ResetNGUI(this.scrollView);
- }
- }
- public GameObject classListObject;
- public UIWFTabButton selectButton;
- public UIGrid itemGrid;
- public UIWFTabPanel tabPanel;
- public UIScrollView scrollView;
- }
- }
|