123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- using System;
- using System.Collections;
- using MaidStatus;
- using UnityEngine;
- using wf;
- public class AdditionalScenario : MonoBehaviour
- {
- public void Init(string label)
- {
- this.m_MyPanel = base.GetComponent<UIPanel>();
- this.m_JumpLabel = label;
- base.StartCoroutine(this.Fade(true));
- ScenarioData[] addedScenario = GameMain.Instance.ScenarioSelectMgr.AddedScenario;
- if (addedScenario.Length <= 0)
- {
- Debug.Log("昨日から追加されたシナリオはもうありません");
- UnityEngine.Object.Destroy(base.gameObject);
- return;
- }
- this.m_FewVer.SetActive(false);
- this.m_ManyVer.SetActive(false);
- int num = 0;
- foreach (ScenarioData scenarioData in addedScenario)
- {
- if (!scenarioData.IsFixedMaid)
- {
- if (scenarioData.EventMaidCount > 0)
- {
- foreach (Maid maid in scenarioData.GetEventMaidList())
- {
- num++;
- }
- }
- else
- {
- num++;
- }
- }
- else if (!string.IsNullOrEmpty(scenarioData.Notification))
- {
- num++;
- }
- else if (scenarioData.EventMaidCount == 1)
- {
- if (scenarioData.GetEventMaid(0).status.heroineType == HeroineType.Sub)
- {
- num++;
- }
- else
- {
- num++;
- }
- }
- else
- {
- num++;
- }
- }
- GameObject gameObject = (num <= this.m_ManyModeCount) ? this.m_FewVer : this.m_ManyVer;
- gameObject.SetActive(true);
- this.m_UIScroll = gameObject.transform.Find("Contents").GetComponent<UIScrollView>();
- this.m_UIGrid = gameObject.transform.Find("Contents/Grid").GetComponent<UIGrid>();
- Action<string, string, string, string> action = delegate(string title, string chara, string titleTerm, string charaTerm)
- {
- GameObject gameObject2 = Utility.CreatePrefab(this.m_UIGrid.gameObject, "SceneScenarioSelect/Prefab/Additional", true);
- UILabel component = gameObject2.transform.Find("Title").GetComponent<UILabel>();
- UILabel component2 = gameObject2.transform.Find("Chara").GetComponent<UILabel>();
- component.text = title;
- component2.text = chara;
- Utility.SetLocalizeTerm(component, titleTerm);
- Utility.SetLocalizeTerm(component2, charaTerm);
- };
- foreach (ScenarioData scenarioData2 in addedScenario)
- {
- string notLineTitle = scenarioData2.NotLineTitle;
- string titleTerm2 = scenarioData2.TitleTerm;
- string notification = scenarioData2.Notification;
- string notificationTerm = scenarioData2.NotificationTerm;
- if (!scenarioData2.IsFixedMaid)
- {
- if (scenarioData2.EventMaidCount > 0)
- {
- foreach (Maid maid2 in scenarioData2.GetEventMaidList())
- {
- if (string.IsNullOrEmpty(notification))
- {
- action(notLineTitle, (!maid2.status.isFirstNameCall) ? maid2.status.lastName : maid2.status.firstName, titleTerm2, string.Empty);
- }
- else
- {
- action(notLineTitle, notification, titleTerm2, notificationTerm);
- }
- }
- }
- else
- {
- action(notLineTitle, notification, titleTerm2, notificationTerm);
- }
- }
- else if (!string.IsNullOrEmpty(notification))
- {
- action(notLineTitle, notification, titleTerm2, notificationTerm);
- }
- else if (scenarioData2.EventMaidCount == 1)
- {
- if (scenarioData2.GetEventMaid(0).status.heroineType == HeroineType.Sub)
- {
- action(notLineTitle, "NPC", titleTerm2, "SceneScenarioSelect/通知時表記/NPC");
- }
- else
- {
- action(notLineTitle, GameMain.Instance.ScenarioSelectMgr.GetConvertPersonal(scenarioData2.GetEventMaid(0)), titleTerm2, GameMain.Instance.ScenarioSelectMgr.GetConvertPersonalTerm(scenarioData2.GetEventMaid(0)));
- }
- }
- else
- {
- action(notLineTitle, this.m_IdolNotice, titleTerm2, "SceneScenarioSelect/通知時表記/" + this.m_IdolNotice);
- }
- }
- if (this.m_UIGrid)
- {
- this.m_UIGrid.repositionNow = true;
- }
- if (this.m_UIScroll)
- {
- this.m_UIScroll.ResetPosition();
- }
- EventDelegate.Add(this.m_MyButton.onClick, new EventDelegate.Callback(this.FadeOut));
- }
- private void FadeOut()
- {
- if (this.m_MyPanel.alpha > 0.9f)
- {
- base.StartCoroutine(this.Fade(false));
- }
- }
- private IEnumerator Fade(bool is_fadein)
- {
- float timer = 0f;
- for (;;)
- {
- float rate = Mathf.Sin(Mathf.Clamp01(timer / this.m_FadeTime) * 90f * 0.0174532924f);
- if (!is_fadein)
- {
- rate = 1f - rate;
- }
- this.m_MyPanel.alpha = rate;
- timer += Time.deltaTime;
- if (timer >= this.m_FadeTime)
- {
- break;
- }
- yield return null;
- }
- if (!is_fadein)
- {
- UnityEngine.Object.Destroy(base.gameObject);
- if (!string.IsNullOrEmpty(this.m_JumpLabel))
- {
- GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_JumpLabel);
- GameMain.Instance.ScriptMgr.adv_kag.Exec();
- }
- }
- yield break;
- yield break;
- }
- [SerializeField]
- private float m_FadeTime = 0.5f;
- [SerializeField]
- private UIButton m_MyButton;
- [SerializeField]
- private GameObject m_FewVer;
- [SerializeField]
- private GameObject m_ManyVer;
- [SerializeField]
- [Header("この数以上で多数表示")]
- private int m_ManyModeCount = 8;
- private UIPanel m_MyPanel;
- private UIScrollView m_UIScroll;
- private UIGrid m_UIGrid;
- [SerializeField]
- [Header("固定3人イベントのときの呼称")]
- private string m_IdolNotice = "アイドルルート";
- private string m_JumpLabel = string.Empty;
- }
|