using System; using System.Collections; using System.Collections.Generic; using MaidStatus; using UnityEngine; using wf; using Yotogis; public class YotogiOldSkillSelectManager : WfScreenChildren { public override void Awake() { base.Awake(); this.yotogi_mgr_ = base.GetComponentInParent(); this.common_buttons_ = UTY.GetChildObject(base.root_obj, "CommonPanel", false).GetComponent(); GameObject gameObject = Utility.CreatePrefab(base.root_obj, "SceneYotogi/Common/Prefab/Old/ParameterViewer", 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)); EventDelegate.Add(this.paramenter_viewer_.costume_button.onClick, new EventDelegate.Callback(this.OnClickEdit)); this.skill_container_mgr_ = new YotogiOldSkillContainerViewer(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 YotogiOldSkillSelectManager.CategoryData[9]; 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 = (YotogiOld.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(); UTY.GetChildObject(this.category_data_array_[i].obj, "Label", false).GetComponent().text = this.category_data_array_[i].obj.name; 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 = (YotogiOld.Category)i; if (lockNTRPlay && (this.category_data_array_[i].category == YotogiOld.Category.交換 || this.category_data_array_[i].category == YotogiOld.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(); } 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 (YotogiOldSkillSelectWaitMotion.ApplyMaidGesture(this.maid_, this.setting_stage_data_.stage)) { result = true; } } return result; } protected override void OnCall() { GameMain.Instance.ScriptMgr.compatibilityMode = true; 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; } } GameMain.Instance.MainLight.Reset(); GameMain.Instance.CharacterMgr.ResetCharaPosAll(); GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true); GameMain.Instance.SoundMgr.VoiceStopAll(); YotogiOld.Stage key = YotogiOld.Stage.プレイル\u30FCム; if (!string.IsNullOrEmpty(YotogiOldStageSelectManager.StageName)) { try { key = (YotogiOld.Stage)Enum.Parse(typeof(YotogiOld.Stage), YotogiOldStageSelectManager.StageName); } catch { NDebug.Assert("Yotogi.Stage enum convert error.\n" + YotogiOldStageSelectManager.StageName, false); } } this.setting_stage_data_ = YotogiOld.stage_data_list[key]; GameMain.Instance.SoundMgr.PlayBGM(this.setting_stage_data_.bgm_file, 1.5f, true); this.yotogi_mgr_.CreateBackUpSkillID(); this.yotogi_mgr_.fix_skill_level = 0; if (!string.IsNullOrEmpty(YotogiOldStageSelectManager.StagePrefab)) { GameMain.Instance.BgMgr.ChangeBg(YotogiOldStageSelectManager.StagePrefab); } this.maid_.status.currentHp = this.maid_.status.maxHp; this.maid_.status.currentMind = this.maid_.status.maxMind; this.maid_.status.currentReason = this.maid_.status.maxReason; 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); for (int j = 0; j < this.category_data_array_.Length; j++) { this.category_data_array_[j].skill_list.Clear(); } ReadOnlySortedDictionary oldDatas = this.maid_.status.yotogiSkill.oldDatas; foreach (YotogiSkillData yotogiSkillData in oldDatas.GetValueArray()) { Skill.Old.Data oldData = yotogiSkillData.oldData; if (oldData.IsExecStage(this.setting_stage_data_.stage) && oldData.IsExecMaid(this.maid_.status)) { this.category_data_array_[(int)oldData.category].skill_list.Add(YotogiOld.SkillDataPair.Create(this.maid_, oldData)); } } for (int l = 0; l < this.category_data_array_.Length; l++) { this.category_data_array_[l].skill_list.Sort((YotogiOld.SkillDataPair a, YotogiOld.SkillDataPair b) => a.base_data.id - b.base_data.id); if (this.category_data_array_[l].obj != null) { UIButton component = UTY.GetChildObject(this.category_data_array_[l].obj, "Button", false).GetComponent(); component.isEnabled = (0 < this.category_data_array_[l].skill_list.Count); } } for (int m = 0; m < this.category_data_array_.Length; m++) { if (0 < this.category_data_array_[m].skill_list.Count && this.category_data_array_[m].obj != null) { this.tab_panel_.Select(UTY.GetChildObject(this.category_data_array_[m].obj, "Button", false).GetComponent()); break; } } GameMain.Instance.TutorialPanel.SetImage(TutorialPanel.ImageSet.Yotogi, false); } private void SetCategorySkill(YotogiOld.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(); 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); YotogiOldSkillUnit component = gameObject.GetComponent(); component.SetSkillData(this.maid_, skill_list[j].base_data, skill_list[j].param); this.skill_unit_list_.Add(gameObject); } Utility.ResetNGUI(childObject2.GetComponent()); Utility.ResetNGUI(childObject.GetComponent()); this.OnSkillChangeEvent(this.skill_container_mgr_); } private void OnClickFromSkillUnit(GameObject game_obj) { YotogiOldSkillUnit component = game_obj.GetComponent(); this.skill_container_mgr_.AddSkill(component.skill_data); } private void OnClickFromCategoryButton(GameObject obj, YotogiOld.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(YotogiOldSkillContainerViewer obj) { Skill.Old.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++) { Skill.Old.Data skill_data = this.skill_unit_list_[j].GetComponent().skill_data; bool flag2 = flag; if (flag2 && this.possible_maid_num_ < skill_data.player_num) { 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; } } } UTY.GetChildObject(this.skill_unit_list_[j], "Button", false).GetComponent().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; } private void OnClickAllReset() { this.skill_container_mgr_.ResetAllSkill(); } private GameObject CreateNewSkillUnit(GameObject root) { GameObject gameObject = Utility.CreatePrefab(root, "SceneYotogi/SkillSelect/Prefab/Old/SkillUnit", true); EventDelegate eventDelegate = new EventDelegate(this, "OnClickFromSkillUnit"); EventDelegate.Parameter parameter = eventDelegate.parameters[0]; parameter.obj = gameObject; GameObject childObject = UTY.GetChildObject(gameObject, "Button", false); childObject.GetComponent().onClick.Add(eventDelegate); 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() { this.yotogi_mgr_.SetPlaySkillArray(this.skill_container_mgr_.GetSettingSkillArray()); if (this.maid_.status.currentHp <= 0) { GameMain.Instance.SysDlg.Show("体力が0以下のため気絶します。\n本当に実行しますか?", 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(YotogiOldManager.CallScreenType.Null.ToString()); } } private Maid maid_; private YotogiOldManager yotogi_mgr_; private YotogiOld.StageData setting_stage_data_; private YotogiCommonButtons common_buttons_; private UIWFTabPanel tab_panel_; private GameObject arrow_obj_; private YotogiOldParameterViewer paramenter_viewer_; private YotogiOldSkillSelectManager.CategoryData[] category_data_array_; private List skill_unit_list_ = new List(); private YotogiOldSkillContainerViewer skill_container_mgr_; private string edit_next_label_ = string.Empty; private int possible_maid_num_; private struct CategoryData { public GameObject obj; public YotogiOld.Category category; public List skill_list; } }