123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- using System;
- using System.Collections.Generic;
- using PrivateMaidMode;
- using UnityEngine;
- public class PrivateEventSelectPanel : MonoBehaviour
- {
- private bool isNoon
- {
- get
- {
- return GameMain.Instance.CharacterMgr.status.isDaytime;
- }
- }
- private Maid maid
- {
- get
- {
- return (!(PrivateModeMgr.Instance.PrivateMaid != null)) ? GameMain.Instance.CharacterMgr.GetMaid(0) : PrivateModeMgr.Instance.PrivateMaid;
- }
- }
- public void Setup(Maid overRideMaid = null, DataBase.BG overRideBg = null)
- {
- foreach (GameObject obj in this.unitList)
- {
- UnityEngine.Object.Destroy(obj);
- }
- this.unitList.Clear();
- this.conditionParent.gameObject.SetActive(false);
- DataBase.BG bg = (overRideBg != null) ? overRideBg : PrivateModeMgr.Instance.SelectBG;
- Maid maid = (!(overRideMaid == null)) ? overRideMaid : this.maid;
- if (bg == null || maid == null)
- {
- return;
- }
- DataBase.BG.Event @event = bg.GetEvent(this.isNoon);
- foreach (DataBase.BG.Event.PointData pointData in @event.eventPointList)
- {
- bool flag = pointData.IsExec(maid) && @event.isNoon == GameMain.Instance.CharacterMgr.status.isDaytime;
- int nextScenarioIndex = @event.GetNextScenarioIndex(maid, pointData);
- int no = pointData.no;
- for (int j = 0; j < pointData.information.Count; j++)
- {
- bool isAlreadyReaded = @event.IsFinishedReadingFile(maid, pointData, j);
- DataBase.BG.Event.PointData.Information information = pointData.information[j];
- if (information.iconType != DataBase.BG.Event.PointData.Information.IconType.NTR || !GameMain.Instance.CharacterMgr.status.lockNTRPlay)
- {
- bool isExec = flag && nextScenarioIndex == j;
- PrivateEventListUnit privateEventListUnit = this.InstantiateUnitOBject(information, no, isExec, isAlreadyReaded);
- this.unitGrid.AddChild(privateEventListUnit.transform);
- this.unitGrid.repositionNow = true;
- this.unitList.Add(privateEventListUnit.gameObject);
- }
- }
- }
- if (this.unitList.Count <= 0)
- {
- PrivateEventListUnit privateEventListUnit2 = this.InstantiateEmptyUnitOBject();
- this.unitGrid.AddChild(privateEventListUnit2.transform);
- this.unitGrid.repositionNow = true;
- this.unitList.Add(privateEventListUnit2.gameObject);
- }
- }
- private PrivateEventListUnit InstantiateUnitOBject(DataBase.BG.Event.PointData.Information info, int eventNo, bool isExec, bool isAlreadyReaded)
- {
- Maid maid = this.maid;
- GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.eventUnit.gameObject, this.eventUnit.transform);
- gameObject.SetActive(true);
- gameObject.name = info.title;
- PrivateEventListUnit component = gameObject.GetComponent<PrivateEventListUnit>();
- component.SetInformation(info, this.conditionParent, this.conditionList);
- component.isViewMode = this.isViewMode;
- component.isEnabled = isExec;
- component.isAlreadyReaded = isAlreadyReaded;
- if (component.isEnabled && !component.isViewMode)
- {
- PrivateEventListUnit privateEventListUnit = component;
- privateEventListUnit.onClickEvent = (Action)Delegate.Combine(privateEventListUnit.onClickEvent, new Action(delegate()
- {
- PrivateModeMgr instance = PrivateModeMgr.Instance;
- if (instance == null)
- {
- return;
- }
- if (maid == null)
- {
- return;
- }
- DataBase.BG.Event @event = instance.SelectBG.GetEvent(this.isNoon);
- @event.LoadScript(maid, eventNo);
- }));
- }
- return component;
- }
- private PrivateEventListUnit InstantiateEmptyUnitOBject()
- {
- GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(this.eventUnit.gameObject, this.eventUnit.transform);
- gameObject.SetActive(true);
- PrivateEventListUnit component = gameObject.GetComponent<PrivateEventListUnit>();
- component.SetEmptyInformation("イベントはありません");
- component.isViewMode = true;
- component.isEnabled = false;
- component.isAlreadyReaded = true;
- return component;
- }
- [SerializeField]
- private PrivateEventListUnit eventUnit;
- [SerializeField]
- private UIGrid unitGrid;
- [SerializeField]
- private Transform conditionParent;
- [SerializeField]
- private UIWFConditionList conditionList;
- [SerializeField]
- private bool isViewMode;
- private readonly List<GameObject> unitList = new List<GameObject>();
- }
|