DanceSelectMusicInfo.cs 2.3 KB

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