123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Runtime.CompilerServices;
- using UnityEngine;
- using UnityEngine.UI;
- using wf;
- namespace PrivateMaidMode
- {
- public class PrivateCharaSelectMain : WfScreenChildren
- {
- public override void Awake()
- {
- base.Awake();
- this.charaContent = UTY.GetChildObject(base.root_obj, "CharacterSelect/uGUI Scroll View/Viewport/Content", false);
- this.charaSelectMgr = UTY.GetChildObject(base.root_obj, "CharacterSelect/uGUI Scroll View/Viewport", false).GetComponent<uGUICharacterSelectManager>();
- }
- protected override void OnCall()
- {
- GameMain.Instance.MainLight.Reset();
- GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
- GameMain.Instance.SoundMgr.VoiceStopAll();
- this.m_selectMaid = null;
- this.m_selectBG = null;
- this.m_selectLocation = null;
- this.charaMgr = GameMain.Instance.CharacterMgr;
- this.isDaily = this.charaMgr.status.isDaytime;
- this.charaSelectMgr.SetCallBackOnSelect(new uGUICharacterSelectManager.CallBackOnSelect(this.SelectCharacter));
- uGUICharacterSelectManager uGUICharacterSelectManager = this.charaSelectMgr;
- if (PrivateCharaSelectMain.<>f__mg$cache0 == null)
- {
- PrivateCharaSelectMain.<>f__mg$cache0 = new uGUICharacterSelectManager.CallBackMaidList(uGUICharacterSelectManager.PrivateMaidList);
- }
- uGUICharacterSelectManager.SetCallBackMaidList(PrivateCharaSelectMain.<>f__mg$cache0);
- this.charaSelectMgr.Create(uGUICharacterSelectManager.Type.Private);
- this.buttonList = this.charaSelectMgr.GetButtonList();
- this.maidList = this.charaSelectMgr.GetMaidList();
- this.buttonList[0].onSelectEvent.Add(new EventDelegate(new EventDelegate.Callback(this.OnSelectNoSelect)));
- if (this.maidList.Count > 0)
- {
- this.CreateRandomButton(this.buttonList[1], PrivateCharaSelectMain.SelectType.Maid);
- for (int i = 2; i < this.buttonList.Count; i++)
- {
- this.buttonList[i].onSelectEvent.Add(new EventDelegate(new EventDelegate.Callback(this.OnClickSelectChara)));
- }
- if (PrivateModeMgr.Instance.isRandomMaid)
- {
- this.charaContent.GetComponent<uGUITabPanel>().Select(this.buttonList[1]);
- }
- }
- this.CreateBGPanel();
- this.CreateBGPosPanel();
- GameMain.Instance.CharacterMgr.DeactivateCharaAll();
- GameMain.Instance.CharacterMgr.DeactivateMaid(0);
- if (PrivateModeMgr.Instance.LoadPrivateMaid(this.isDaily))
- {
- this.m_selectMaid = PrivateModeMgr.Instance.PrivateMaid;
- this.m_selectBG = PrivateModeMgr.Instance.SelectBG;
- this.m_selectLocation = PrivateModeMgr.Instance.SelectLocation;
- this.SetSelectAll();
- }
- else
- {
- uGUITabPanel component = this.charaContent.GetComponent<uGUITabPanel>();
- component.Select(this.buttonList[0]);
- }
- uGUITutorialPanel.OpenTutorial("ScenePrivate", null, false);
- }
- public void SetPrivateSettingManager(PrivateSettingManager mgr)
- {
- this.privateManager = mgr;
- }
- private void CreateBGPanel()
- {
- GameObject parentPanel = this.GetParentPanel(PrivateCharaSelectMain.SelectType.BG);
- this.ResetChildren(parentPanel.transform);
- this.bgList = new List<DataBase.BG>();
- using (List<DataBase.Data>.Enumerator enumerator = DataBase.GetAllDatas(true).GetEnumerator())
- {
- while (enumerator.MoveNext())
- {
- DataBase.Data data = enumerator.Current;
- if (!this.bgList.Exists((DataBase.BG bgElm) => bgElm.uniqueName == data.bgData.uniqueName))
- {
- this.bgList.Add(data.bgData);
- }
- }
- }
- this.enabledBGList = new List<DataBase.BG>();
- for (int i = 0; i < this.bgList.Count; i++)
- {
- GameObject f_goParent = Utility.CreatePrefab(parentPanel, "ScenePrivate/SelectButton", true);
- uGUITabButton component = UTY.GetChildObject(f_goParent, "Plate", false).GetComponent<uGUITabButton>();
- component.onSelectEvent.Add(new EventDelegate(new EventDelegate.Callback(this.OnSelectBG)));
- if (!this.bgList[i].enabled)
- {
- component.interactable = false;
- }
- else
- {
- this.enabledBGList.Add(this.bgList[i]);
- }
- Text component2 = UTY.GetChildObject(f_goParent, "Text", false).GetComponent<Text>();
- component2.text = this.bgList[i].drawName;
- }
- GameObject f_goParent2 = Utility.CreatePrefab(parentPanel, "ScenePrivate/RandomButton", true);
- uGUITabButton component3 = UTY.GetChildObject(f_goParent2, "Plate", false).GetComponent<uGUITabButton>();
- this.CreateRandomButton(component3, PrivateCharaSelectMain.SelectType.BG);
- parentPanel.GetComponent<uGUITabPanel>().UpdateChildren();
- if (PrivateModeMgr.Instance.isRandomBG)
- {
- parentPanel.GetComponent<uGUITabPanel>().Select(component3);
- }
- else
- {
- DataBase.BG bgdata = DataBase.GetBGData("執務室");
- int index = this.bgList.IndexOf(bgdata);
- uGUITabButton component4 = UTY.GetChildObject(parentPanel.transform.GetChild(index).gameObject, "Plate", false).GetComponent<uGUITabButton>();
- parentPanel.GetComponent<uGUITabPanel>().Select(component4);
- }
- }
- private void CreateBGPosPanel()
- {
- GameObject parentPanel = this.GetParentPanel(PrivateCharaSelectMain.SelectType.BGPos);
- this.ResetChildren(parentPanel.transform);
- for (int i = 0; i < this.m_selectBG.locations.Length; i++)
- {
- GameObject f_goParent = Utility.CreatePrefab(parentPanel, "ScenePrivate/SelectButton", true);
- uGUITabButton component = UTY.GetChildObject(f_goParent, "Plate", false).GetComponent<uGUITabButton>();
- component.onSelectEvent.Add(new EventDelegate(new EventDelegate.Callback(this.OnSelectBGPos)));
- Text component2 = UTY.GetChildObject(f_goParent, "Text", false).GetComponent<Text>();
- component2.text = this.m_selectBG.locations[i].drawName;
- }
- GameObject f_goParent2 = Utility.CreatePrefab(parentPanel, "ScenePrivate/RandomButton", true);
- uGUITabButton component3 = UTY.GetChildObject(f_goParent2, "Plate", false).GetComponent<uGUITabButton>();
- this.CreateRandomButton(component3, PrivateCharaSelectMain.SelectType.BGPos);
- parentPanel.GetComponent<uGUITabPanel>().UpdateChildren();
- bool flag = false;
- if (PrivateModeMgr.Instance.isRandomBG)
- {
- parentPanel.GetComponent<uGUITabPanel>().Select(component3);
- this.SetCanSelectButton(parentPanel.GetComponent<uGUITabPanel>(), false);
- flag = true;
- }
- else if (PrivateModeMgr.Instance.isRandomLocation)
- {
- parentPanel.GetComponent<uGUITabPanel>().Select(component3);
- flag = true;
- }
- else if (this.m_selectLocation != null)
- {
- foreach (DataBase.BG.Location location in this.m_selectBG.locations)
- {
- if (location == this.m_selectLocation)
- {
- this.SetSelect(PrivateCharaSelectMain.SelectType.BGPos);
- flag = true;
- break;
- }
- }
- }
- if (!flag)
- {
- uGUITabButton component4 = UTY.GetChildObject(parentPanel.transform.GetChild(0).gameObject, "Plate", false).GetComponent<uGUITabButton>();
- parentPanel.GetComponent<uGUITabPanel>().Select(component4);
- }
- }
- private void CreateRandomButton(uGUITabButton button, PrivateCharaSelectMain.SelectType type)
- {
- EventDelegate eventDelegate = new EventDelegate(this, "OnSelectRandom");
- if (type != PrivateCharaSelectMain.SelectType.BG)
- {
- if (type != PrivateCharaSelectMain.SelectType.BGPos)
- {
- if (type == PrivateCharaSelectMain.SelectType.Maid)
- {
- eventDelegate.parameters[0].value = PrivateCharaSelectMain.SelectType.Maid;
- }
- }
- else
- {
- eventDelegate.parameters[0].value = PrivateCharaSelectMain.SelectType.BGPos;
- }
- }
- else
- {
- eventDelegate.parameters[0].value = PrivateCharaSelectMain.SelectType.BG;
- }
- button.onSelectEvent.Add(eventDelegate);
- }
- private void ResetChildren(Transform parentTrans)
- {
- for (int i = 0; i < parentTrans.childCount; i++)
- {
- UnityEngine.Object.Destroy(parentTrans.GetChild(i).gameObject);
- }
- parentTrans.DetachChildren();
- }
- private void ResetSetting()
- {
- GameObject parentPanel = this.GetParentPanel(PrivateCharaSelectMain.SelectType.BG);
- DataBase.BG bgdata = DataBase.GetBGData("執務室");
- int index = this.bgList.IndexOf(bgdata);
- uGUITabButton component = UTY.GetChildObject(parentPanel.transform.GetChild(index).gameObject, "Plate", false).GetComponent<uGUITabButton>();
- parentPanel.GetComponent<uGUITabPanel>().Select(component);
- parentPanel = this.GetParentPanel(PrivateCharaSelectMain.SelectType.BGPos);
- uGUITabButton component2 = UTY.GetChildObject(parentPanel.transform.GetChild(0).gameObject, "Plate", false).GetComponent<uGUITabButton>();
- parentPanel.GetComponent<uGUITabPanel>().Select(component2);
- this.ResetCamera();
- }
- private void OnSelectNoSelect()
- {
- this.charaMgr.DeactivateMaidAll();
- this.m_selectMaid = null;
- PrivateModeMgr.Instance.isRandomMaid = false;
- this.bgPanel.SetActive(false);
- this.bgPositionPanel.SetActive(false);
- this.ResetSetting();
- }
- private void OnClickSelectChara()
- {
- PrivateModeMgr.Instance.isRandomMaid = false;
- }
- private void SelectCharacter(Maid select_maid)
- {
- this.bgPanel.SetActive(true);
- this.bgPositionPanel.SetActive(true);
- if (select_maid != null && this.m_selectMaid != select_maid)
- {
- GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
- this.m_selectMaid = select_maid;
- this.charaMgr.SetActiveMaid(this.m_selectMaid, 0);
- this.m_selectMaid.Visible = true;
- base.StartCoroutine(this.WaitCharaLoad());
- }
- }
- private IEnumerator WaitCharaLoad()
- {
- while (this.charaMgr.IsBusy())
- {
- yield return null;
- }
- yield return null;
- yield return null;
- GameMain.Instance.ScriptMgr.is_motion_blend = false;
- this.m_selectLocation.LoadScript();
- GameMain.Instance.ScriptMgr.is_motion_blend = true;
- GameMain.Instance.MainCamera.FadeIn(0.5f, false, null, true, true, default(Color));
- yield break;
- }
- private void OnSelectBG()
- {
- uGUITabButton selectButton = this.GetParentPanel(PrivateCharaSelectMain.SelectType.BG).GetComponent<uGUITabPanel>().GetSelectButton();
- DataBase.BG bg = this.bgList[selectButton.transform.parent.GetSiblingIndex()];
- if (bg != null && this.m_selectBG != bg)
- {
- this.SelectBG(bg);
- }
- PrivateModeMgr.Instance.isRandomBG = false;
- GameObject parentPanel = this.GetParentPanel(PrivateCharaSelectMain.SelectType.BGPos);
- this.SetCanSelectButton(parentPanel.GetComponent<uGUITabPanel>(), true);
- }
- private void SelectBG(DataBase.BG bg)
- {
- if (bg == null)
- {
- return;
- }
- GameMain.Instance.MainCamera.FadeOut(0.5f, false, null, true, default(Color));
- this.m_selectBG = bg;
- this.m_selectBG.Apply(this.isDaily);
- this.CreateBGPosPanel();
- GameMain.Instance.MainCamera.FadeIn(0.5f, false, null, true, true, default(Color));
- }
- private void OnSelectBGPos()
- {
- uGUITabButton selectButton = this.GetParentPanel(PrivateCharaSelectMain.SelectType.BGPos).GetComponent<uGUITabPanel>().GetSelectButton();
- DataBase.BG.Location location = this.m_selectBG.locations[selectButton.transform.parent.GetSiblingIndex()];
- if (location != null)
- {
- this.SelectBGPos(location);
- }
- PrivateModeMgr.Instance.isRandomLocation = false;
- }
- private void SelectBGPos(DataBase.BG.Location select_location)
- {
- GameMain.Instance.MainCamera.FadeOut(0.5f, false, null, true, default(Color));
- this.m_selectLocation = select_location;
- if (this.m_selectMaid != null)
- {
- GameMain.Instance.ScriptMgr.is_motion_blend = false;
- this.m_selectLocation.LoadScript();
- GameMain.Instance.ScriptMgr.is_motion_blend = true;
- }
- GameMain.Instance.MainCamera.FadeIn(0.5f, false, null, true, true, default(Color));
- }
- private void SetSelectAll()
- {
- this.SetSelect(PrivateCharaSelectMain.SelectType.Maid);
- this.SetSelect(PrivateCharaSelectMain.SelectType.BG);
- this.SetSelect(PrivateCharaSelectMain.SelectType.BGPos);
- }
- private void SetSelect(PrivateCharaSelectMain.SelectType type)
- {
- if (type != PrivateCharaSelectMain.SelectType.Maid)
- {
- if (type != PrivateCharaSelectMain.SelectType.BG)
- {
- if (type == PrivateCharaSelectMain.SelectType.BGPos)
- {
- if (this.m_selectLocation == null)
- {
- return;
- }
- if (PrivateModeMgr.Instance.isRandomLocation)
- {
- return;
- }
- GameObject parentPanel = this.GetParentPanel(PrivateCharaSelectMain.SelectType.BGPos);
- this.Select(type, parentPanel);
- }
- }
- else
- {
- if (this.m_selectBG == null)
- {
- return;
- }
- if (PrivateModeMgr.Instance.isRandomBG)
- {
- this.CreateBGPosPanel();
- return;
- }
- GameObject parentPanel = this.GetParentPanel(PrivateCharaSelectMain.SelectType.BG);
- this.Select(type, parentPanel);
- this.CreateBGPosPanel();
- }
- }
- else
- {
- if (PrivateModeMgr.Instance.isRandomMaid)
- {
- return;
- }
- this.charaSelectMgr.SelectMaid(this.m_selectMaid);
- }
- }
- private void Select(PrivateCharaSelectMain.SelectType type, GameObject parentObj)
- {
- string a = null;
- if (type != PrivateCharaSelectMain.SelectType.BG)
- {
- if (type == PrivateCharaSelectMain.SelectType.BGPos)
- {
- a = this.m_selectLocation.drawName;
- }
- }
- else
- {
- a = this.m_selectBG.drawName;
- }
- uGUITabPanel component = parentObj.GetComponent<uGUITabPanel>();
- Transform transform = parentObj.transform;
- for (int i = 0; i < transform.childCount; i++)
- {
- string text = UTY.GetChildObject(transform.GetChild(i).gameObject, "Text", false).GetComponent<Text>().text;
- if (a == text)
- {
- uGUITabButton component2 = UTY.GetChildObject(transform.GetChild(i).gameObject, "Plate", false).GetComponent<uGUITabButton>();
- component.Select(component2);
- return;
- }
- }
- }
- private void OnSelectRandom(PrivateCharaSelectMain.SelectType type)
- {
- if (type == PrivateCharaSelectMain.SelectType.Maid && this.maidList != null)
- {
- int index = UnityEngine.Random.Range(0, this.maidList.Count);
- this.SelectCharacter(this.maidList[index]);
- PrivateModeMgr.Instance.isRandomMaid = true;
- this.SetButtonTouch(this.GetParentPanel(PrivateCharaSelectMain.SelectType.Maid).GetComponent<uGUITabPanel>().GetSelectButton(), true);
- }
- if (type == PrivateCharaSelectMain.SelectType.BG && this.enabledBGList != null)
- {
- int index2 = UnityEngine.Random.Range(0, this.enabledBGList.Count);
- this.SelectBG(this.enabledBGList[index2]);
- PrivateModeMgr.Instance.isRandomBG = true;
- PrivateModeMgr.Instance.isRandomLocation = true;
- this.SetButtonTouch(this.GetParentPanel(PrivateCharaSelectMain.SelectType.BG).GetComponent<uGUITabPanel>().GetSelectButton(), true);
- GameObject parentPanel = this.GetParentPanel(PrivateCharaSelectMain.SelectType.BGPos);
- uGUITabButton component = UTY.GetChildObject(parentPanel.transform.GetChild(parentPanel.transform.childCount - 1).gameObject, "Plate", false).GetComponent<uGUITabButton>();
- parentPanel.GetComponent<uGUITabPanel>().Select(component);
- }
- if (type == PrivateCharaSelectMain.SelectType.BGPos && this.m_selectBG != null)
- {
- int num = UnityEngine.Random.Range(0, this.m_selectBG.locations.Length);
- this.SelectBGPos(this.m_selectBG.locations[num]);
- PrivateModeMgr.Instance.isRandomLocation = true;
- if (PrivateModeMgr.Instance.isRandomBG)
- {
- this.SetCanSelectButton(this.GetParentPanel(PrivateCharaSelectMain.SelectType.BGPos).GetComponent<uGUITabPanel>(), false);
- }
- this.SetButtonTouch(this.GetParentPanel(PrivateCharaSelectMain.SelectType.BGPos).GetComponent<uGUITabPanel>().GetSelectButton(), true);
- }
- }
- private void ResetCamera()
- {
- GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
- GameMain.Instance.MainCamera.SetTargetPos(new Vector3(0.5609447f, 1.380762f, -1.382336f), true);
- GameMain.Instance.MainCamera.SetDistance(1.6f, true);
- GameMain.Instance.MainCamera.SetAroundAngle(new Vector2(245.5691f, 6.273283f), true);
- GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
- }
- private GameObject GetParentPanel(PrivateCharaSelectMain.SelectType type)
- {
- if (type == PrivateCharaSelectMain.SelectType.Maid)
- {
- if (this.charaContent != null)
- {
- this.charaContent = UTY.GetChildObject(base.root_obj, "CharacterSelect/uGUI Scroll View/Viewport/Content", false);
- }
- return this.charaContent;
- }
- if (type == PrivateCharaSelectMain.SelectType.BG)
- {
- return UTY.GetChildObject(this.bgPanel, "uGUI Scroll View/Viewport/Content", false);
- }
- if (type != PrivateCharaSelectMain.SelectType.BGPos)
- {
- return null;
- }
- return UTY.GetChildObject(this.bgPositionPanel, "uGUI Scroll View/Viewport/Content", false);
- }
- private void SetButtonTouch(uGUITabButton button, bool isActive)
- {
- button.GetComponent<uGUISelectableAnimation>().enabled = isActive;
- button.maskObj.SetActive(!isActive);
- }
- private void SetCanSelectButton(uGUITabPanel parent, bool select)
- {
- for (int i = 0; i < parent.transform.childCount; i++)
- {
- uGUITabButton component = UTY.GetChildObject(parent.transform.GetChild(i).gameObject, "Plate", false).GetComponent<uGUITabButton>();
- if (component.maskObj != null)
- {
- component.maskObj.SetActive(!select);
- }
- }
- }
- public void OnClickOKButton()
- {
- PrivateModeMgr.Instance.SetPrivateMaid(this.m_selectMaid);
- PrivateModeMgr.Instance.SetPrivateBG(this.m_selectBG);
- PrivateModeMgr.Instance.SetPrivateLocation(this.m_selectLocation);
- this.Finish();
- }
- protected override void OnFinish()
- {
- if (this.privateManager.MoveScreen.IsExistNextFile())
- {
- this.privateManager.CallScreen("Move");
- }
- }
- private Maid m_selectMaid;
- private DataBase.BG m_selectBG;
- private DataBase.BG.Location m_selectLocation;
- private PrivateSettingManager privateManager;
- private CharacterMgr charaMgr;
- private uGUICharacterSelectManager charaSelectMgr;
- private List<uGUITabButton> buttonList;
- private List<Maid> maidList;
- private List<DataBase.BG> bgList;
- private List<DataBase.BG> enabledBGList;
- private bool isDaily;
- private GameObject charaContent;
- [SerializeField]
- private GameObject bgPanel;
- [SerializeField]
- private GameObject bgPositionPanel;
- [CompilerGenerated]
- private static uGUICharacterSelectManager.CallBackMaidList <>f__mg$cache0;
- public enum SelectType
- {
- Maid,
- BG,
- BGPos
- }
- }
- }
|