DanceSelectMusicInfo.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. Sprite sprite = Sprite.Create(texture2D, new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), default(Vector2));
  50. sprite.name = text;
  51. this.image_sprite_.sprite2D = sprite;
  52. GameMain.Instance.CharacterMgr.status.SetFlag("_ライブ背景", (data.bgType != DanceData.BgType.LiveStage) ? 0 : 1);
  53. }
  54. public GameObject InfoUI
  55. {
  56. get
  57. {
  58. return this.root_obj_;
  59. }
  60. }
  61. private GameObject root_obj_;
  62. private UILabel title_label_;
  63. private UILabel info_label_;
  64. private UILabel dance_num_label_;
  65. private UI2DSprite image_sprite_;
  66. }