ScoutProgressInformation.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using System;
  2. using I2.Loc;
  3. using UnityEngine;
  4. using wf;
  5. namespace scoutmode
  6. {
  7. public class ScoutProgressInformation : MonoBehaviour
  8. {
  9. public ScoutProgressInformation.Stage SelectStage { get; private set; }
  10. public void SetStage(ScoutProgressInformation.Stage stage)
  11. {
  12. this.SelectStage = stage;
  13. YotogiStage.Data data = null;
  14. if (this.SelectStage == ScoutProgressInformation.Stage.ShoppingMall)
  15. {
  16. data = YotogiStage.GetData("ショッピングモール");
  17. }
  18. else if (this.SelectStage == ScoutProgressInformation.Stage.Club)
  19. {
  20. data = YotogiStage.GetData("劇場");
  21. }
  22. if (this.stageSprite.sprite2D != null)
  23. {
  24. UnityEngine.Object.Destroy(this.stageSprite.sprite2D.texture);
  25. }
  26. if (data != null)
  27. {
  28. this.stageNameLabel.text = data.drawName;
  29. Utility.SetLocalizeTerm(this.stageNameLabel, data.termName, false);
  30. string f_strFileName = data.thumbnailName[(!GameMain.Instance.CharacterMgr.status.isDaytime) ? 1 : 0];
  31. Texture2D texture2D = ImportCM.CreateTexture(f_strFileName);
  32. this.stageSprite.sprite2D = Sprite.Create(texture2D, new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), default(Vector2));
  33. this.stageSprite.SetDimensions(this.stageSprite.sprite2D.texture.width, this.stageSprite.sprite2D.texture.height);
  34. }
  35. }
  36. public void SetCharacterRandom()
  37. {
  38. this.charaNameLabel1.text = "??????";
  39. this.charaNameLabel2.text = "??????";
  40. this.charaThumbnailSprite.sprite2D = null;
  41. this.charaPanel.SetActive(true);
  42. }
  43. public void SetCharacter(ScoutMaidData scoutMaid, bool isScouting)
  44. {
  45. this.charaPanel.SetActive(scoutMaid != null);
  46. if (!this.charaPanel.activeSelf)
  47. {
  48. return;
  49. }
  50. if (isScouting)
  51. {
  52. Utility.SetLocalizeTerm(this.charaThumbnailLocalize, "SceneScout/スカウト中キャラクター", true);
  53. }
  54. else
  55. {
  56. Utility.SetLocalizeTerm(this.charaThumbnailLocalize, "SceneScout/スカウト予定キャラクター", true);
  57. }
  58. this.charaNameLabel1.text = scoutMaid.status.name1;
  59. this.charaNameLabel2.text = scoutMaid.status.name2;
  60. if (this.charaThumbnailSprite.sprite2D != null)
  61. {
  62. UnityEngine.Object.Destroy(this.charaThumbnailSprite.sprite2D.texture);
  63. }
  64. byte[] iconImageBinary = scoutMaid.GetIconImageBinary();
  65. if (iconImageBinary != null)
  66. {
  67. Texture2D texture2D = new Texture2D(1, 1, TextureFormat.ARGB32, false);
  68. texture2D.LoadImage(iconImageBinary);
  69. this.charaThumbnailSprite.sprite2D = Sprite.Create(texture2D, new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), default(Vector2));
  70. this.charaThumbnailSprite.SetDimensions(this.charaThumbnailSprite.sprite2D.texture.width, this.charaThumbnailSprite.sprite2D.texture.height);
  71. }
  72. }
  73. public void ChangeBg(ScoutProgressInformation.Stage stage)
  74. {
  75. if (this.SelectStage == ScoutProgressInformation.Stage.ShoppingMall)
  76. {
  77. GameMain.Instance.BgMgr.ChangeBg("ShoppingMall");
  78. }
  79. else if (this.SelectStage == ScoutProgressInformation.Stage.Club)
  80. {
  81. GameMain.Instance.BgMgr.ChangeBg("Theater");
  82. }
  83. }
  84. [SerializeField]
  85. private UI2DSprite stageSprite;
  86. [SerializeField]
  87. private UILabel stageNameLabel;
  88. [SerializeField]
  89. private GameObject charaPanel;
  90. [SerializeField]
  91. private Localize charaThumbnailLocalize;
  92. [SerializeField]
  93. private UI2DSprite charaThumbnailSprite;
  94. [SerializeField]
  95. private UILabel charaNameLabel1;
  96. [SerializeField]
  97. private UILabel charaNameLabel2;
  98. public enum Stage
  99. {
  100. ShoppingMall,
  101. Club
  102. }
  103. }
  104. }