using System; using System.Collections; using System.Collections.Generic; using I2.Loc; using MaidStatus; using UnityEngine; using wf; using Yotogis; public class YotogiSkillSelectManager : WfScreenChildren { public override void Awake() { base.Awake(); this.yotogi_mgr_ = base.GetComponentInParent(); this.common_buttons_ = UTY.GetChildObject(base.root_obj, "CommonPanel", false).GetComponent(); string path = "SceneYotogi/Common/Prefab/ParameterViewer"; if (Product.supportMultiLanguage) { path = "SceneYotogi/Common/Prefab/ParameterViewerWidth"; } GameObject gameObject = Utility.CreatePrefab(base.root_obj, path, true); gameObject.transform.localPosition = new Vector3(782f, 449f, 0f); this.paramenter_viewer_ = gameObject.GetComponent(); this.paramenter_viewer_.SetAttributeViewer(UTY.GetChildObject(base.root_obj.transform.parent.gameObject, "AttributeViewer", false).GetComponent()); EventDelegate.Add(this.paramenter_viewer_.costume_button.onClick, new EventDelegate.Callback(this.OnClickEdit)); this.skill_container_mgr_ = new YotogiSkillContainerViewer(base.root_obj, this); this.skill_container_mgr_.SetOnSkillChangeEvent(new Action(this.OnSkillChangeEvent)); this.arrow_obj_ = UTY.GetChildObject(base.root_obj, "CategoryViewer/Arrow", false); GameObject childObject = UTY.GetChildObject(base.root_obj, "CategoryViewer/Content", false); GameObject childObject2 = UTY.GetChildObject(childObject, "CategoryUnitParent", false); bool lockNTRPlay = GameMain.Instance.CharacterMgr.status.lockNTRPlay; this.category_data_array_ = new YotogiSkillSelectManager.CategoryData[8]; for (int i = 0; i < this.category_data_array_.Length; i++) { this.category_data_array_[i].skill_list = new List(); this.category_data_array_[i].category = (Yotogi.Category)i; this.category_data_array_[i].obj = Utility.CreatePrefab(childObject2, "SceneYotogi/SkillSelect/Prefab/CategoryBtn", true); this.category_data_array_[i].obj.name = this.category_data_array_[i].category.ToString(); this.category_data_array_[i].obj.GetComponentInChildren().text = this.category_data_array_[i].obj.name; string term = "SceneYotogi/スキルカテゴリー/" + this.category_data_array_[i].obj.name; this.category_data_array_[i].obj.GetComponentInChildren().SetTerm(term); UIWFTabButton component = UTY.GetChildObject(this.category_data_array_[i].obj, "Button", false).GetComponent(); EventDelegate eventDelegate = new EventDelegate(this, "OnClickFromCategoryButton"); EventDelegate.Parameter[] parameters = eventDelegate.parameters; parameters[0].value = this.category_data_array_[i].obj; parameters[1].value = (Yotogi.Category)i; if (lockNTRPlay && (this.category_data_array_[i].category == Yotogi.Category.交換 || this.category_data_array_[i].category == Yotogi.Category.乱交)) { this.category_data_array_[i].obj.SetActive(false); } component.onClick.Add(eventDelegate); } this.tab_panel_ = childObject2.GetComponent(); this.tab_panel_.UpdateChildren(); Utility.ResetNGUI(childObject2.GetComponent()); Utility.ResetNGUI(childObject.GetComponent()); childObject.GetComponent().UpdateAnchors(); this.conditionSetting.onChangeSelectedTypeEvent = new Action(this.CreateSkillButtons); } protected override bool IsCallFadeIn() { CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; Maid man = characterMgr.GetMan(0); bool result = false; if (!man.IsBusy && !this.maid_.IsBusy) { man.Visible = false; this.maid_.SetPosOffset(Vector3.zero); if (YotogiSkillSelectWaitMotion.ApplyMaidGesture(this.maid_, this.setting_stage_data_)) { result = true; } } return result; } protected override void OnCall() { this.maid_ = this.yotogi_mgr_.maid; this.paramenter_viewer_.SetMaid(this.maid_); this.possible_maid_num_ = this.yotogi_mgr_.GetPlayPossibleMaidCount(); CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; for (int i = 0; i < characterMgr.GetMaidCount(); i++) { Maid maid = characterMgr.GetMaid(i); if (maid != null && maid != this.maid_ && maid.Visible) { maid.Visible = false; } } if (!this.yotogi_mgr_.is_new_yotogi_mode) { uGUITutorialPanel.OpenTutorial("YotogiSkill", null, false); GameMain.Instance.SysShortcut.strSceneHelpName = "YotogiSkill"; } GameMain.Instance.MainLight.Reset(); GameMain.Instance.CharacterMgr.ResetCharaPosAll(); GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true); GameMain.Instance.SoundMgr.VoiceStopAll(); if (YotogiStageSelectManager.SelectedStage != null) { this.setting_stage_data_ = YotogiStageSelectManager.SelectedStage; } else { this.setting_stage_data_ = YotogiStage.GetAllDatas(true)[0]; } GameMain.Instance.SoundMgr.PlayBGM(this.setting_stage_data_.bgmFileName, 1.5f, true); this.yotogi_mgr_.CreateBackUpSkillID(); this.yotogi_mgr_.CreateBackUpYotogiClass(); this.yotogi_mgr_.fix_skill_level = 0; int num = (!GameMain.Instance.CharacterMgr.status.isDaytime) ? 1 : 0; GameMain.Instance.BgMgr.ChangeBg(this.setting_stage_data_.prefabName[num]); foreach (Skill.Data.SpecialConditionType type in this.conditionSetting.checkBoxTypes) { bool enabled = false; Dictionary dictionary = YotogiSkillListManager.CreateDatas(this.maid_.status, true, type); foreach (KeyValuePair keyValuePair in dictionary) { YotogiSkillListManager.Data value = keyValuePair.Value; if (value.skillData.IsExecStage(this.setting_stage_data_)) { enabled = true; break; } } this.conditionSetting.SetTypeCheckBoxEnabled(type, enabled); } this.maid_.status.currentHp = this.maid_.status.maxHp; this.maid_.status.currentMind = this.maid_.status.maxMind; this.maid_.status.currentSensual = 0; Maid man = characterMgr.GetMan(0); man.Visible = true; this.maid_.Visible = true; man.AllProcPropSeqStart(); this.maid_.AllProcPropSeqStart(); this.common_buttons_.next_btn.onClick.Clear(); EventDelegate.Add(this.common_buttons_.next_btn.onClick, new EventDelegate.Callback(this.OnClickNext)); this.common_buttons_.viwe_reset_btn.gameObject.SetActive(false); this.paramenter_viewer_.SetMaid(this.maid_); this.paramenter_viewer_.UpdateTextCommon(); this.paramenter_viewer_.UpdateTextParam(); this.skill_container_mgr_.Init(this.maid_); this.skill_container_mgr_.SetMaxHp(this.maid_.status.maxHp); this.skill_container_mgr_.SetCurrentHp(this.maid_.status.currentHp); this.checkBoxStatusLock.check = this.maid_.status.enabledYotogiStatusLock; this.checkBoxStatusLock.onClick.Clear(); this.checkBoxStatusLock.onClick.Add(delegate(WFCheckBox check_box) { this.maid_.status.enabledYotogiStatusLock = check_box.check; }); GameMain.Instance.TutorialPanel.SetImage(TutorialPanel.ImageSet.Yotogi, false); this.conditionSetting.selectedType = Skill.Data.SpecialConditionType.Null; } public void CreateSkillButtons(Skill.Data.SpecialConditionType type) { this.OnClickAllReset(); for (int i = 0; i < this.category_data_array_.Length; i++) { this.category_data_array_[i].skill_list.Clear(); } Dictionary dictionary = YotogiSkillListManager.CreateDatas(this.maid_.status, true, type); foreach (KeyValuePair keyValuePair in dictionary) { YotogiSkillListManager.Data value = keyValuePair.Value; if (value.skillData.IsExecStage(this.setting_stage_data_)) { this.category_data_array_[(int)value.skillData.category].skill_list.Add(value); } } for (int j = 0; j < this.category_data_array_.Length; j++) { this.category_data_array_[j].skill_list.Sort((YotogiSkillListManager.Data a, YotogiSkillListManager.Data b) => a.skillData.sortId - b.skillData.sortId); if (this.category_data_array_[j].obj != null) { UIWFTabButton component = UTY.GetChildObject(this.category_data_array_[j].obj, "Button", false).GetComponent(); component.SetSelect(false); component.isEnabled = (0 < this.category_data_array_[j].skill_list.Count); } } for (int k = 0; k < this.category_data_array_.Length; k++) { if (0 < this.category_data_array_[k].skill_list.Count && this.category_data_array_[k].obj != null) { this.tab_panel_.Select(UTY.GetChildObject(this.category_data_array_[k].obj, "Button", false).GetComponent()); break; } } } private void SetCategorySkill(Yotogi.Category category) { GameObject childObject = UTY.GetChildObject(base.root_obj, "SkillViewer/Contents", false); GameObject childObject2 = UTY.GetChildObject(childObject, "SkillUnitParent", false); Transform transform = childObject2.transform; this.skill_unit_list_.Clear(); for (int i = 0; i < transform.childCount; i++) { UnityEngine.Object.Destroy(transform.GetChild(i).gameObject); } transform.DetachChildren(); GameObject childObject3 = UTY.GetChildObject(base.root_obj, "YotogiSkillConditionsPanel", false); List skill_list = this.category_data_array_[(int)category].skill_list; for (int j = 0; j < skill_list.Count; j++) { GameObject gameObject = this.CreateNewSkillUnit(childObject2); YotogiSkillLockUnit componentInChildren = gameObject.GetComponentInChildren(); YotogiSkillUnit componentInChildren2 = gameObject.GetComponentInChildren(); componentInChildren2.SetSkillData(this.maid_, skill_list[j].skillData, skill_list[j].maidStatusSkillData, componentInChildren, skill_list[j].conditionDatas); componentInChildren2.SetConditionsPanel(childObject3); this.skill_unit_list_.Add(componentInChildren2.gameObject); } Utility.ResetNGUI(childObject2.GetComponent()); Utility.ResetNGUI(childObject.GetComponent()); this.OnSkillChangeEvent(this.skill_container_mgr_); } private void OnClickFromSkillUnit(GameObject game_obj) { YotogiSkillUnit component = game_obj.GetComponent(); this.skill_container_mgr_.AddSkill(component.skill_data, component.skill_param_data.lockSkillExp); } private void OnClickFromCategoryButton(GameObject obj, Yotogi.Category category) { for (int i = 0; i < this.category_data_array_.Length; i++) { if (this.category_data_array_[i].category == category) { this.SetCategorySkill(this.category_data_array_[i].category); Vector3 position = this.category_data_array_[i].obj.transform.TransformPoint(new Vector3(0f, 0f, 0f)); Vector3 local_pos = this.arrow_obj_.transform.parent.InverseTransformPoint(position); local_pos.x = this.arrow_obj_.transform.localPosition.x; local_pos.y += 18f; Hashtable args = TweenHash.EaseOutQuint(TweenHash.Type.Position, local_pos, 0.3f); iTween.MoveTo(this.arrow_obj_, args); } } } private void OnSkillChangeEvent(YotogiSkillContainerViewer obj) { Skill.Data[] settingSkillArray = obj.GetSettingSkillArray(); int num = this.yotogi_mgr_.skill_select_max_hp; for (int i = 0; i < settingSkillArray.Length; i++) { num -= settingSkillArray[i].exec_need_hp; } bool flag = settingSkillArray.Length != 7 && 0 < num; for (int j = 0; j < this.skill_unit_list_.Count; j++) { YotogiSkillUnit component = this.skill_unit_list_[j].GetComponent(); Skill.Data skill_data = component.skill_data; bool flag2 = flag; if ((flag2 && this.possible_maid_num_ < skill_data.player_num) || component.skill_param_data == null) { flag2 = false; } if (flag2 && skill_data.ban_id_array != null && 0 < skill_data.ban_id_array.Length) { for (int k = 0; k < skill_data.ban_id_array.Length; k++) { for (int l = 0; l < settingSkillArray.Length; l++) { if (skill_data.ban_id_array[k] == settingSkillArray[l].id) { flag2 = false; break; } } if (!flag2) { break; } } } component.isEnabled = flag2; } this.skill_container_mgr_.SetCurrentHp(num); this.maid_.status.currentHp = num; this.paramenter_viewer_.UpdateTextParam(); this.common_buttons_.next_btn.isEnabled = (0 < settingSkillArray.Length); } public void SetEditNextLabel(string label) { this.edit_next_label_ = label; } public void OnClickAllReset() { this.skill_container_mgr_.ResetAllSkill(); } public void OnClickAllLockSkillExp() { foreach (YotogiSkillData yotogiSkillData in this.maid_.status.yotogiSkill.datas.GetValueArray()) { yotogiSkillData.lockSkillExp = true; } foreach (GameObject gameObject in this.skill_unit_list_) { YotogiSkillLockUnit componentInChildren = gameObject.transform.parent.GetComponentInChildren(); if (componentInChildren.enabled) { componentInChildren.checkBox.check = componentInChildren.skillData.lockSkillExp; } } } public void OnClickAllUnLockExp() { foreach (YotogiSkillData yotogiSkillData in this.maid_.status.yotogiSkill.datas.GetValueArray()) { yotogiSkillData.lockSkillExp = false; } foreach (GameObject gameObject in this.skill_unit_list_) { YotogiSkillLockUnit componentInChildren = gameObject.transform.parent.GetComponentInChildren(); if (componentInChildren.enabled) { componentInChildren.checkBox.check = componentInChildren.skillData.lockSkillExp; } } } private GameObject CreateNewSkillUnit(GameObject root) { GameObject gameObject = new GameObject(); gameObject.transform.SetParent(root.transform, false); gameObject.name = "SkillUnit:" + (root.transform.childCount - 1).ToString(); GameObject gameObject2 = Utility.CreatePrefab(gameObject, "SceneYotogi/SkillSelect/Prefab/YotogiSkillUnit", true); EventDelegate eventDelegate = new EventDelegate(this, "OnClickFromSkillUnit"); EventDelegate.Parameter parameter = eventDelegate.parameters[0]; parameter.obj = gameObject2; GameObject childObject = UTY.GetChildObject(gameObject2, "Button", false); childObject.GetComponent().onClick.Add(eventDelegate); GameObject gameObject3 = Utility.CreatePrefab(gameObject, "SceneYotogi/SkillSelect/Prefab/YotogiSkillLockUnit", true); Vector3 localPosition = gameObject3.transform.localPosition; gameObject3.transform.localPosition = new Vector3(230f, localPosition.y, localPosition.z); return gameObject; } private void OnClickEdit() { if (string.IsNullOrEmpty(this.edit_next_label_)) { return; } this.yotogi_mgr_.null_mgr.SetNextLabel(this.edit_next_label_); this.Finish(); } private void OnClickNext() { Skill.Data[] settingSkillArray = this.skill_container_mgr_.GetSettingSkillArray(); bool[] settingSkillLockArray = this.skill_container_mgr_.GetSettingSkillLockArray(); KeyValuePair[] array = new KeyValuePair[settingSkillArray.Length]; for (int i = 0; i < settingSkillArray.Length; i++) { array[i] = new KeyValuePair(settingSkillArray[i], settingSkillLockArray[i]); } this.yotogi_mgr_.SetPlaySkillArray(array); if (this.maid_.status.currentHp <= 0) { GameMain.Instance.SysDlg.ShowFromLanguageTerm("Dialog/気絶注意", null, SystemDialog.TYPE.OK_CANCEL, delegate { GameMain.Instance.SysDlg.Close(); if (this.yotogi_mgr_.null_mgr.IsExistNextLabel()) { this.Finish(); } }, null); } else if (this.yotogi_mgr_.null_mgr.IsExistNextLabel()) { this.Finish(); } } protected override void OnFinish() { UIWFTabButton selectButtonObject = this.tab_panel_.GetSelectButtonObject(); if (selectButtonObject != null) { selectButtonObject.SetSelect(false); } GameMain.Instance.CharacterMgr.SetCharaAllPos(Vector3.zero); GameMain.Instance.CharacterMgr.SetCharaAllRot(Vector3.zero); GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false); GameMain.Instance.ScriptMgr.StopMotionScript(); if (this.yotogi_mgr_.null_mgr.IsExistNextLabel()) { this.yotogi_mgr_.CallScreen(YotogiManager.CallScreenType.Null.ToString()); } } [SerializeField] public WFCheckBox checkBoxStatusLock; [SerializeField] public YotogiSkillSelectSpecialCondition conditionSetting; private Maid maid_; private YotogiManager yotogi_mgr_; private YotogiStage.Data setting_stage_data_; private YotogiCommonButtons common_buttons_; private UIWFTabPanel tab_panel_; private GameObject arrow_obj_; private YotogiParameterViewer paramenter_viewer_; private YotogiSkillSelectManager.CategoryData[] category_data_array_; private List skill_unit_list_ = new List(); private YotogiSkillContainerViewer skill_container_mgr_; private string edit_next_label_ = string.Empty; private int possible_maid_num_; private struct CategoryData { public GameObject obj; public Yotogi.Category category; public List skill_list; } }