using System; using System.Collections.Generic; using UnityEngine; using wf; using Yotogis; public class YotogiOldVRSkillSelectManager : WfFadeBehaviour { public void Awake() { this.skillStorageObject = new GameObject(); this.skillStorageObject.name = "skillStorageObject"; this.skillStorageObject.transform.SetParent(base.transform, false); this.skillStorageObject.SetActive(false); if (this.init_pos_dic_.Count == 0) { this.init_pos_dic_.Add(this.cancelBtn, this.cancelBtn.transform.localPosition); } EventDelegate.Add(this.cancelBtn.onClick, new EventDelegate.Callback(this.OnClickCancel)); this.cblConfigBtn.gameObject.SetActive(false); for (int i = 0; i < this.categorySelectTabPanel.transform.childCount; i++) { UIWFTabButton componentInChildren = this.categorySelectTabPanel.transform.GetChild(i).GetComponentInChildren(); EventDelegate eventDelegate = new EventDelegate(this, "OnClickFromCategoryButton"); EventDelegate.Parameter[] parameters = eventDelegate.parameters; parameters[0].value = this.categorySelectTabPanel.transform.GetChild(i).name; componentInChildren.onClick.Add(eventDelegate); } this.categorySelectTabPanel.UpdateChildren(); this.selectCategoryName = YotogiOld.Category.淫欲.ToString(); this.widget.alpha = 0f; this.stageSelectBtn.SetOnSelectEvent(new Action(this.OnClickStageSelect)); } public override void OnStartedFadeIn() { this.uiMask.enabled = true; this.fadeInStartBgAlpha = this.bgSprite.alpha; this.fadeInStartBgSize = new Vector2((float)this.bgSprite.width, (float)this.bgSprite.height); } public override void OnStartedFadeOut() { this.uiMask.enabled = true; } public override void OnUpdateFadeIn(float val) { this.bgSprite.alpha = Mathf.Lerp(this.fadeInStartBgAlpha, 1f, val); this.bgSprite.width = (int)Mathf.Lerp(this.fadeInStartBgSize.x, this.bgSize.x, val); this.bgSprite.height = (int)Mathf.Lerp(this.fadeInStartBgSize.y, this.bgSize.y, val); this.widget.alpha = val; } public override void OnUpdateFadeOut(float val) { this.widget.alpha = val; } public override void OnCompleteFadeIn() { this.uiMask.enabled = false; } public override void OnCompleteFadeOut() { this.OnCompleteFadeIn(); } public void SelectCategory(string category) { for (int i = 0; i < this.categorySelectTabPanel.transform.childCount; i++) { Transform child = this.categorySelectTabPanel.transform.GetChild(i); UIWFTabButton componentInChildren = child.GetComponentInChildren(); if (category == child.name && componentInChildren.isEnabled) { this.categorySelectTabPanel.Select(componentInChildren); return; } } } public void SetCancelButtonText(string text) { this.cancelBtn.GetComponentInChildren().text = text; } public void UpdateData(Maid maid, YotogiOld.Stage stage, int spot_no) { bool isDaytime = GameMain.Instance.CharacterMgr.status.isDaytime; YotogiOld.StageData.SpotData spotData = YotogiOld.vr_stage_data_list[stage].spot_data[spot_no]; this.stageSelectBtn.SetStageSpotData(YotogiOld.vr_stage_data_list[stage], spot_no); List vrskillDataList = YotogiOld.GetVRSkillDataList(stage, spot_no); this.skill_data_ = new Dictionary>(); foreach (YotogiOld.VRSkillData vrskillData in vrskillDataList) { Skill.Old.Data skill = vrskillData.skill; string key = vrskillData.skill.category.ToString(); bool flag = maid.status.yotogiSkill.oldDatas.ContainsKey(skill.id) && skill.IsExecMaid(maid.status); if (flag) { if (!this.skill_data_.ContainsKey(key)) { this.skill_data_.Add(key, new List()); } this.skill_data_[key].Add(vrskillData); } } int num = 0; foreach (KeyValuePair> keyValuePair in this.skill_data_) { if (num < keyValuePair.Value.Count) { num = keyValuePair.Value.Count; } } if (this.skillStorageObject.transform.childCount < num) { int num2 = num - this.skillStorageObject.transform.childCount; for (int i = 0; i < num2; i++) { this.CreateNewSkillUnit(this.skillStorageObject); } } string value = string.Empty; for (int j = 0; j < this.categorySelectTabPanel.transform.childCount; j++) { Transform child = this.categorySelectTabPanel.transform.GetChild(j); UIWFTabButton componentInChildren = child.GetComponentInChildren(); bool flag2 = this.skill_data_.ContainsKey(child.name) && this.skill_data_[child.name].Count > 0; componentInChildren.SetSelect(false); componentInChildren.isEnabled = flag2; if (!flag2 && child.name == this.selectCategoryName) { this.selectCategoryName = string.Empty; } else if (flag2 && string.IsNullOrEmpty(value)) { value = child.name; } } if (string.IsNullOrEmpty(this.selectCategoryName)) { this.selectCategoryName = value; } List list = new List(); for (int k = 0; k < this.skillUnitParent.childCount; k++) { list.Add(this.skillUnitParent.GetChild(k)); } foreach (Transform transform in list) { transform.SetParent(this.skillStorageObject.transform, false); } UIScrollView componentInChildren2 = base.gameObject.GetComponentInChildren(); Utility.ResetNGUI(componentInChildren2); this.SelectCategory(this.selectCategoryName); } private void OnClickFromCategoryButton(string category) { this.selectCategoryName = category; List list = new List(); for (int i = 0; i < this.skillUnitParent.childCount; i++) { list.Add(this.skillUnitParent.GetChild(i)); } foreach (Transform transform in list) { transform.SetParent(this.skillStorageObject.transform, false); } UIScrollView componentInChildren = base.gameObject.GetComponentInChildren(); Utility.ResetNGUI(componentInChildren); if (!this.skill_data_.ContainsKey(category)) { return; } Transform transform2 = this.skillStorageObject.transform; List list2 = this.skill_data_[category]; list.Clear(); for (int j = 0; j < list2.Count; j++) { Transform transform3 = transform2.GetChild(j).transform; YotogiOldSkillUnitVR component = transform3.GetComponent(); component.SetSkillData(list2[j]); component.isSelect = (this.selectedSkill == component.skill_data); list.Add(transform3); } foreach (Transform transform4 in list) { transform4.SetParent(this.skillUnitParent, false); } Utility.ResetNGUI(this.skillUnitParent.GetComponentInChildren()); Utility.ResetNGUI(componentInChildren); } private void OnClickSkillBtn(YotogiOldSkillUnitVR skill_data) { this.selectedSkill = skill_data.skill_data; YotogiOldManager.select_vr_skill_data = this.selectedSkill; EventDelegate.Execute(this.onClickEnterEvent); } private void OnClickStageSelect(StageOldUnitCircle circle) { if (this.uiMask.enabled) { return; } EventDelegate.Execute(this.onClickStageSelect); } private void OnClickCancel() { EventDelegate.Execute(this.onClickCancelEvent); } private YotogiOldSkillUnitVR CreateNewSkillUnit(GameObject root) { GameObject gameObject = Utility.CreatePrefab(root, "SceneYotogi/SkillSelect/Prefab/Old/SkillUnitVR", true); EventDelegate eventDelegate = new EventDelegate(this, "OnClickSkillBtn"); EventDelegate.Parameter parameter = eventDelegate.parameters[0]; parameter.obj = gameObject.GetComponent(); gameObject.GetComponentInChildren().onClick.Add(eventDelegate); return gameObject.GetComponent(); } [SerializeField] private UISprite bgSprite; [SerializeField] private Vector2 bgSize; [SerializeField] private StageOldUnitCircle stageSelectBtn; [SerializeField] private UIButton configBtn; [SerializeField] private UIButton vrConfigBtn; [SerializeField] private UIButton cblConfigBtn; [SerializeField] private UIButton cancelBtn; [SerializeField] private UIWidget widget; [SerializeField] private UIWFHitMasks uiMask; [SerializeField] private UIWFTabPanel categorySelectTabPanel; [SerializeField] private Transform skillUnitParent; [HideInInspector] public YotogiOld.VRSkillData selectedSkill; [HideInInspector] public List onClickEnterEvent = new List(); [HideInInspector] public List onClickStageSelect = new List(); [HideInInspector] public List onClickCancelEvent = new List(); private GameObject skillStorageObject; private string selectCategoryName; private Dictionary init_pos_dic_ = new Dictionary(); private Dictionary> skill_data_ = new Dictionary>(); private float fadeInStartBgAlpha; private Vector2 fadeInStartBgSize; }