DanceSelectMusicInfo.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System;
  2. using I2.Loc;
  3. using UnityEngine;
  4. public class DanceSelectMusicInfo
  5. {
  6. public DanceSelectMusicInfo(GameObject root_obj)
  7. {
  8. this.root_obj_ = root_obj;
  9. this.title_label_ = UTY.GetChildObject(this.root_obj_, "BG/TitleFrame/Value", false).GetComponent<UILabel>();
  10. Transform transform = this.root_obj_.transform.Find("BG/InfoFrame/Value");
  11. if (transform)
  12. {
  13. this.info_label_ = transform.GetComponent<UILabel>();
  14. }
  15. this.dance_num_label_ = UTY.GetChildObject(this.root_obj_, "BG/InfoFrame/Value2", false).GetComponent<UILabel>();
  16. this.image_sprite_ = UTY.GetChildObject(this.root_obj_, "BG/Image", false).GetComponent<UI2DSprite>();
  17. }
  18. public void Release()
  19. {
  20. this.image_sprite_.sprite2D = null;
  21. }
  22. public void SetDanceData(DanceData data)
  23. {
  24. this.title_label_.text = data.title.Replace("\n", string.Empty);
  25. Localize component = this.title_label_.GetComponent<Localize>();
  26. if (component != null)
  27. {
  28. component.SetTerm(data.titleTerm);
  29. }
  30. if (this.info_label_)
  31. {
  32. this.info_label_.text = data.commentary_text;
  33. }
  34. this.dance_num_label_.text = "ダンス人数 : " + data.select_chara_num + "人";
  35. component = this.dance_num_label_.GetComponent<Localize>();
  36. if (component != null)
  37. {
  38. component.TermArgs = new Localize.ArgsPair[]
  39. {
  40. Localize.ArgsPair.Create(data.select_chara_num.ToString())
  41. };
  42. component.OnLocalize(true);
  43. }
  44. this.Release();
  45. string text = (RhythmAction_Mgr.NowDance != RhythmAction_Mgr.DanceType.Challenge) ? data.sample_image_name : data.danceshow_image;
  46. Texture2D texture2D = Resources.Load<Texture2D>("SceneDanceSelect/Atlas/" + text);
  47. Sprite sprite = Sprite.Create(texture2D, new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), default(Vector2));
  48. sprite.name = text;
  49. this.image_sprite_.sprite2D = sprite;
  50. GameMain.Instance.CharacterMgr.status.SetFlag("_ライブ背景", (data.bgType != DanceData.BgType.LiveStage) ? 0 : 1);
  51. }
  52. public GameObject InfoUI
  53. {
  54. get
  55. {
  56. return this.root_obj_;
  57. }
  58. }
  59. private GameObject root_obj_;
  60. private UILabel title_label_;
  61. private UILabel info_label_;
  62. private UILabel dance_num_label_;
  63. private UI2DSprite image_sprite_;
  64. }