123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using UnityEngine;
- using wf;
- public class Product_Mgr : PartsMgrBase
- {
- protected override void Start()
- {
- base.Start();
- switch (RhythmAction_Mgr.NowDance)
- {
- case RhythmAction_Mgr.DanceType.Free:
- case RhythmAction_Mgr.DanceType.View:
- this.m_nAudience = DanceSetting.Settings.Audience;
- this.m_nProduct = DanceSetting.Settings.Product;
- break;
- case RhythmAction_Mgr.DanceType.Challenge:
- this.m_nAudience = Product_Mgr.AudienceState.Few;
- this.m_nProduct = Product_Mgr.ProductRank.Normal;
- break;
- case RhythmAction_Mgr.DanceType.VS:
- this.m_nAudience = Product_Mgr.AudienceState.Normal;
- this.m_nProduct = Product_Mgr.ProductRank.Normal;
- break;
- case RhythmAction_Mgr.DanceType.Encore:
- this.m_nAudience = Product_Mgr.AudienceState.Many;
- this.m_nProduct = Product_Mgr.ProductRank.Special;
- break;
- case RhythmAction_Mgr.DanceType.BenchMark:
- this.m_nAudience = Product_Mgr.AudienceState.Normal;
- this.m_nProduct = Product_Mgr.ProductRank.Special;
- break;
- }
- if (RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.Encore)
- {
- this.m_nAudience = Product_Mgr.AudienceState.Many;
- this.m_nProduct = Product_Mgr.ProductRank.Special;
- }
- this.CheckProductAndAudience();
- int voltage = this.m_AllAudience.Single((Product_Mgr.Audience e) => e.State == this.m_nAudience).Voltage;
- foreach (Product_Mgr.Audience audience in this.m_AllAudience)
- {
- bool active = audience.Voltage <= voltage;
- foreach (GameObject gameObject in audience.AudienceObj)
- {
- gameObject.SetActive(active);
- }
- }
- foreach (GameObject gameObject2 in this.m_SpecialProduct)
- {
- this.CheckSpecialObj(gameObject2.transform);
- }
- if (this.m_SpecialEffect)
- {
- this.m_SpecialEffect.gameObject.SetActive(this.m_nProduct == Product_Mgr.ProductRank.Special);
- if (this.m_SpecialEffect.gameObject.activeSelf || RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.VS)
- {
- IEnumerator enumerator3 = this.m_SpecialEffect.GetEnumerator();
- try
- {
- while (enumerator3.MoveNext())
- {
- object obj = enumerator3.Current;
- Transform transform = (Transform)obj;
- ParticleSystem component = transform.GetComponent<ParticleSystem>();
- ParticleSystem particleSystem = null;
- if (transform.childCount > 0)
- {
- particleSystem = transform.GetChild(0).GetComponent<ParticleSystem>();
- }
- if (component)
- {
- RhythmAction_Mgr.Instance.AddParticleSystem(component);
- }
- if (particleSystem)
- {
- RhythmAction_Mgr.Instance.AddParticleSystem(particleSystem);
- }
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator3 as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- }
- if (!base.IsActive)
- {
- base.gameObject.SetActive(false);
- return;
- }
- this.ReadTimeData();
- }
- private void CheckProductAndAudience()
- {
- if (this.m_SpecialProduct.Count == 0)
- {
- this.m_SpecialProduct.Add(GameObject.Find("LiveStage_Laser_use_dance"));
- this.m_SpecialProduct.Add(GameObject.Find("MovingLight"));
- this.m_SpecialProduct.Add(GameObject.Find("SpotLightL"));
- this.m_SpecialProduct.Add(GameObject.Find("SpotLightL"));
- this.m_SpecialProduct.Add(GameObject.Find("SpotFloorLight"));
- if (this.m_SpecialProduct.Contains(null))
- {
- this.m_SpecialProduct.Clear();
- return;
- }
- }
- for (int i = 0; i < this.m_AllAudience.Length; i++)
- {
- Product_Mgr.Audience audience = this.m_AllAudience[i];
- if (audience.AudienceObj.Count == 0)
- {
- audience.AudienceObj.Add(GameObject.Find(string.Format("psyllium_A00{0}_alpha", i + 1)));
- audience.AudienceObj.Add(GameObject.Find(string.Format("psyllium_B00{0}_alpha", i + 1)));
- audience.AudienceObj.Add(GameObject.Find(string.Format("psyllium_C00{0}_alpha", i + 1)));
- }
- }
- }
- private void CheckSpecialObj(Transform parent)
- {
- if (parent.childCount > 0)
- {
- IEnumerator enumerator = parent.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform parent2 = (Transform)obj;
- this.CheckSpecialObj(parent2);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- else
- {
- Animator component = parent.GetComponent<Animator>();
- MeshRenderer component2 = parent.GetComponent<MeshRenderer>();
- bool flag = this.m_nProduct == Product_Mgr.ProductRank.Special || this.m_nProduct == Product_Mgr.ProductRank.Normal;
- bool flag2 = RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.VS;
- if (!component || !flag2)
- {
- if (!this.m_ProductSpecialObj.Contains(parent.gameObject) && flag2)
- {
- this.m_ProductSpecialObj.Add(parent.gameObject);
- }
- parent.gameObject.SetActive(flag);
- }
- else if (component2 && !this.m_ProductSpecialRender.Contains(component2))
- {
- this.m_ProductSpecialRender.Add(component2);
- component2.enabled = flag;
- }
- }
- }
- private void ReadTimeData()
- {
- string text = RhythmAction_Mgr.Instance.MusicCSV_Path + "time_data.nei";
- if (!GameUty.FileSystem.IsExistentFile(text))
- {
- NDebug.Assert("表がありません。" + text, false);
- }
- 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++)
- {
- if (csvParser.IsCellToExistData(0, i))
- {
- this.m_All_BranchPoint.Add(csvParser.GetCellAsReal(1, i));
- }
- }
- }
- }
- }
- private Product_Mgr.AudienceState GetNowAudience()
- {
- Product_Mgr.AudienceState result = Product_Mgr.AudienceState.Few;
- foreach (Product_Mgr.Audience audience in this.m_AllAudience)
- {
- if (audience.Voltage > Voltage_Mgr.Instance.VoltageStage)
- {
- break;
- }
- result = audience.State;
- }
- return result;
- }
- private IEnumerator ProductCheck()
- {
- float timer = 0f;
- for (;;)
- {
- if (!RhythmAction_Mgr.Instance.IsPause)
- {
- timer += RhythmAction_Mgr.Instance.DanceDeltaTime;
- this.m_ProgressGauge.transform.localPosition = Vector3.right * timer / RhythmAction_Mgr.Instance.TakeTime * (float)this.m_ProgressGauge.width;
- if (timer / 60f < 10f)
- {
- this.m_MinuteTimeText.text = "0" + Mathf.FloorToInt(timer / 60f).ToString();
- }
- else
- {
- this.m_MinuteTimeText.text = Mathf.FloorToInt(timer / 60f).ToString();
- }
- if ((int)timer % 60 < 10)
- {
- this.m_SecondsTimeText.text = "0" + ((int)timer % 60).ToString();
- }
- else
- {
- this.m_SecondsTimeText.text = ((int)timer % 60).ToString();
- }
- if (this.m_All_BranchPoint.Count > 0 && timer >= this.m_All_BranchPoint.First<float>())
- {
- base.StartCoroutine(this.GaugeFlash());
- Voltage_Mgr.Instance.DecideVoltageValue();
- if (RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.VS || RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.BenchMark)
- {
- Product_Mgr.AudienceState nAudience = this.m_nAudience;
- this.m_nAudience = this.GetNowAudience();
- if (nAudience != this.m_nAudience)
- {
- foreach (Product_Mgr.Audience audience in this.m_AllAudience)
- {
- bool active = audience.Voltage <= Voltage_Mgr.Instance.VoltageStage;
- foreach (GameObject gameObject in audience.AudienceObj)
- {
- gameObject.SetActive(active);
- }
- }
- }
- if (RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.VS)
- {
- Product_Mgr.ProductRank nProduct = this.m_nProduct;
- if (DanceBattle_Mgr.Instance.IsEven())
- {
- this.m_nProduct = Product_Mgr.ProductRank.Normal;
- }
- else if (DanceBattle_Mgr.Instance.IsWin())
- {
- this.m_nProduct = Product_Mgr.ProductRank.Special;
- }
- else
- {
- this.m_nProduct = Product_Mgr.ProductRank.Low;
- }
- if (nProduct != this.m_nProduct)
- {
- bool flag = this.m_nProduct == Product_Mgr.ProductRank.Special || this.m_nProduct == Product_Mgr.ProductRank.Normal;
- foreach (MeshRenderer meshRenderer in this.m_ProductSpecialRender)
- {
- meshRenderer.enabled = flag;
- }
- foreach (GameObject gameObject2 in this.m_ProductSpecialObj)
- {
- gameObject2.SetActive(flag);
- }
- if (this.m_SpecialEffect)
- {
- this.m_SpecialEffect.gameObject.SetActive(this.m_nProduct == Product_Mgr.ProductRank.Special);
- }
- }
- }
- }
- this.m_All_BranchPoint.RemoveAt(0);
- }
- }
- yield return null;
- }
- yield break;
- }
- private IEnumerator GaugeFlash()
- {
- this.m_FlashGauge.gameObject.SetActive(true);
- Color col = this.m_FlashGauge.color;
- float timer = 0f;
- for (;;)
- {
- if (!RhythmAction_Mgr.Instance.IsPause)
- {
- timer += RhythmAction_Mgr.Instance.DanceDeltaTime;
- float alpha = this.m_MaxFlashAlpha * Mathf.Sin(Mathf.Clamp01(timer / this.m_MaxFlashAlpha) * 180f * 0.0174532924f);
- this.m_FlashGauge.alpha = alpha;
- if (timer > this.m_MaxFlashAlpha)
- {
- break;
- }
- }
- yield return null;
- }
- this.m_FlashGauge.gameObject.SetActive(false);
- yield break;
- yield break;
- }
- public override void StartAction()
- {
- foreach (float num in this.m_All_BranchPoint)
- {
- GameObject gameObject = Utility.CreatePrefab(this.m_MarkParent, "SceneDance/Rhythm_Action/Prefab/" + this.m_ProgressMarkName, true);
- float d = Mathf.Clamp01(num / RhythmAction_Mgr.Instance.TakeTime) * (float)this.m_ProgressGauge.width;
- gameObject.transform.localPosition = Vector3.right * d;
- UISprite component = gameObject.GetComponent<UISprite>();
- this.m_ProgressMarkList.Add(component);
- }
- base.StartCoroutine(this.ProductCheck());
- }
- private Product_Mgr.AudienceState m_nAudience;
- [SerializeField]
- [Header("通過マークオブジェクト名")]
- private string m_ProgressMarkName = "ProgressMark";
- private List<UISprite> m_ProgressMarkList = new List<UISprite>();
- [SerializeField]
- [Header("通過マークの親")]
- private GameObject m_MarkParent;
- [SerializeField]
- [Header("プログレスゲージ")]
- private UISprite m_ProgressGauge;
- [SerializeField]
- [Header("経過時間UI(1分以上)")]
- private UILabel m_MinuteTimeText;
- [SerializeField]
- [Header("経過時間UI(1分以下)")]
- private UILabel m_SecondsTimeText;
- [SerializeField]
- [Header("通常・上位演出用のオブジェクトグループ")]
- private List<GameObject> m_SpecialProduct = new List<GameObject>();
- [SerializeField]
- private Product_Mgr.Audience[] m_AllAudience = new Product_Mgr.Audience[]
- {
- new Product_Mgr.Audience(Product_Mgr.AudienceState.Few, 1),
- new Product_Mgr.Audience(Product_Mgr.AudienceState.Normal, 3),
- new Product_Mgr.Audience(Product_Mgr.AudienceState.Many, 5)
- };
- [SerializeField]
- [Header("上位演出エフェクト")]
- private Transform m_SpecialEffect;
- [SerializeField]
- [Header("ゲージ光らせる時間")]
- private float m_GaugeFlashTime;
- [SerializeField]
- [Range(0f, 1f)]
- private float m_MaxFlashAlpha = 1f;
- [SerializeField]
- private UISprite m_FlashGauge;
- private Product_Mgr.ProductRank m_nProduct;
- private List<float> m_All_BranchPoint = new List<float>();
- private List<MeshRenderer> m_ProductSpecialRender = new List<MeshRenderer>();
- private List<GameObject> m_ProductSpecialObj = new List<GameObject>();
- public enum ProductRank
- {
- Low,
- Special,
- Normal
- }
- public enum AudienceState
- {
- Few,
- Normal,
- Many
- }
- [Serializable]
- private class Audience
- {
- public Audience(Product_Mgr.AudienceState state, int voltage)
- {
- this.State = state;
- this.Voltage = voltage;
- }
- [Header("表示する時の客数状態")]
- public Product_Mgr.AudienceState State;
- [Header("このボルテージ以上の時表示")]
- public int Voltage;
- [Header("客オブジェクト")]
- public List<GameObject> AudienceObj = new List<GameObject>();
- }
- }
|