using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class StaffRollScroll : MonoBehaviour { public bool Finish { get { return this.finish; } } private void Awake() { if (Product.type == Product.Type.JpAdult) { GameObject childObject = UTY.GetChildObject(this.prefabLabelLogoScort, "Sprite_public", false); if (childObject != null) { childObject.SetActive(false); } } this.ReadCSVFile_Data(); this.ReadCSVFile_StaffName(); } private void Start() { this.CreateLabels(); this.mode = StaffRollScroll.Mode.Scroll; GameMain.Instance.SoundMgr.PlayBGM(this.soundFileName + ".ogg", 0f, false); } private void Update() { StaffRollScroll.Mode mode = this.mode; if (mode != StaffRollScroll.Mode.Scroll) { if (mode == StaffRollScroll.Mode.EndReady) { this.imgCtrl.Finish(); this.mode = StaffRollScroll.Mode.End; base.StartCoroutine(this.End()); } } else { this.Scroll(); } } private IEnumerator End() { yield return new WaitForSeconds(9f); this.finish = true; yield break; } private void Scroll() { float num = this.progressTime / this.scrollTime; float y = Mathf.Lerp(0f, Mathf.Abs(this.endPosY), num); Vector3 localPosition = base.gameObject.transform.localPosition; localPosition.y = y; base.gameObject.transform.localPosition = localPosition; float deltaTime = Time.deltaTime; this.progressTime += deltaTime; this.imgCtrl.CheckChange(num); if (num >= 1f) { this.mode = StaffRollScroll.Mode.EndReady; } } private void ReadCSVFile_Data() { NDebug.Assert(GameUty.FileSystem.IsExistentFile("staffroll_data.nei"), "staffroll_data.nei\nopen failed."); using (AFileBase afileBase = GameUty.FileSystem.FileOpen("staffroll_data.nei")) { using (CsvParser csvParser = new CsvParser()) { bool condition = csvParser.Open(afileBase); NDebug.Assert(condition, "staffroll_data.nei\nopen failed."); this.soundFileName = csvParser.GetCellAsString(1, 1); this.scrollTime = (float)csvParser.GetCellAsInteger(1, 2); } } } private void ReadCSVFile_StaffName() { if (StaffRollScroll.dataList != null) { return; } StaffRollScroll.dataList = new List(); string text = "staffroll_stafflist"; if (!string.IsNullOrEmpty(Product.gameDataPath) && GameUty.FileSystem.IsExistentFile(text + Product.gameDataPath + ".nei")) { text += Product.gameDataPath; } text += ".nei"; NDebug.Assert(GameUty.FileSystem.IsExistentFile(text), text + "\nopen failed."); using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text)) { using (CsvParser csvParser = new CsvParser()) { bool condition = csvParser.Open(afileBase); NDebug.Assert(condition, text + "\nopen failed."); for (int i = 1; i < csvParser.max_cell_y; i++) { StaffRollScroll.Data data = new StaffRollScroll.Data(); data.name = csvParser.GetCellAsString(1, i); string cellAsString = csvParser.GetCellAsString(0, i); string[] array = cellAsString.Split(new char[] { ',' }); bool flag = true; foreach (string a in array) { if (a == "読み込み終了") { return; } if (a == "停止位置") { data.stopPoint = true; } else if (a == "文字_小") { data.type = StaffRollScroll.Data.Type.Small1; } else if (a == "文字_小2") { data.type = StaffRollScroll.Data.Type.Small2; } else if (a == "ご主人様") { data.userName = true; } else if (a == "コピーライト") { data.name = "©" + data.name; } else if (a == "ロゴ") { data.type = StaffRollScroll.Data.Type.Logo; } else if (a == "ロゴエスコート") { data.type = StaffRollScroll.Data.Type.LogoScort; } } if (flag) { StaffRollScroll.dataList.Add(data); } } } } } private void CreateLabels() { GameObject gameObject = null; for (int i = 0; i < StaffRollScroll.dataList.Count; i++) { StaffRollScroll.Data data = StaffRollScroll.dataList[i]; if (!GameMain.Instance.CharacterMgr.status.lockUserDraftMaid || !data.userName) { GameObject original; if (data.type == StaffRollScroll.Data.Type.Logo) { original = this.prefabLabelLogo; } else if (data.type == StaffRollScroll.Data.Type.LogoScort) { original = this.prefabLabelLogoScort; } else if (data.name == string.Empty || data.type == StaffRollScroll.Data.Type.Small1) { original = this.prefabLabelSmall1; } else if (data.type == StaffRollScroll.Data.Type.Small2) { original = this.prefabLabelSmall2; } else { original = this.prefabLabel; } GameObject gameObject2 = UnityEngine.Object.Instantiate(original); gameObject2.transform.parent = base.gameObject.transform; gameObject2.transform.localScale = new Vector3(1f, 1f, 1f); if (data.type != StaffRollScroll.Data.Type.Logo && data.type != StaffRollScroll.Data.Type.LogoScort) { UILabel component = gameObject2.GetComponent(); component.text = data.name; } gameObject2.SetActive(true); if (data.stopPoint) { gameObject = gameObject2; } if (i >= StaffRollScroll.dataList.Count - 1 && gameObject == null) { gameObject = gameObject2; } } } this.prefabLabel.SetActive(false); this.prefabLabelSmall1.SetActive(false); this.prefabLabelSmall2.SetActive(false); this.prefabLabelLogo.SetActive(false); this.prefabLabelLogoScort.SetActive(false); this.table.Reposition(); if (gameObject != null) { this.endPosY = (float)((int)gameObject.transform.localPosition.y); } } [SerializeField] private StaffRollImageCtrl imgCtrl; [SerializeField] private GameObject prefabLabel; [SerializeField] private GameObject prefabLabelSmall1; [SerializeField] private GameObject prefabLabelSmall2; [SerializeField] private GameObject prefabLabelLogo; [SerializeField] private GameObject prefabLabelLogoScort; [SerializeField] private UITable table; [SerializeField] private float scrollTime = 15f; private float progressTime; private float endPosY; private StaffRollScroll.Mode mode; private string soundFileName; private bool finish; private static List dataList; public enum Mode { Wait, Scroll, EndReady, End } public class Data { public string name; public StaffRollScroll.Data.Type type; public bool userName; public bool stopPoint; public enum Type { Normal, Small1, Small2, Logo, LogoScort } } }