SceneADV.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using System;
  2. using I2.Loc;
  3. using UnityEngine;
  4. public class SceneADV : MonoBehaviour
  5. {
  6. public void Awake()
  7. {
  8. if (GameMain.Instance.VRMode)
  9. {
  10. GameObject gameObject = Resources.Load("OVR/DummyNGUICamera") as GameObject;
  11. NDebug.Assert(gameObject != null, "DummyNGUICameraが読み込めません。");
  12. GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(gameObject);
  13. gameObject2.transform.SetParent(base.transform, false);
  14. }
  15. this.panel = this.titleBar.transform.parent.GetComponent<UIPanel>();
  16. this.panel.alpha = 0f;
  17. }
  18. public void Start()
  19. {
  20. GameMain.Instance.ScriptMgr.adv_kag.enabled = true;
  21. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  22. }
  23. public void CallTitleBar(string title)
  24. {
  25. int num = (1920 >= Screen.width) ? 1920 : Screen.width;
  26. int num2 = num / 2 * -1;
  27. int num3 = 456;
  28. UILabel componentInChildren = this.titleBar.GetComponentInChildren<UILabel>();
  29. componentInChildren.text = title;
  30. Localize componentInChildren2 = this.titleBar.GetComponentInChildren<Localize>();
  31. componentInChildren2.SetTerm("Scenario/スクリプト/タイトルバー/" + title);
  32. componentInChildren.width = 0;
  33. componentInChildren.MakePixelPerfect();
  34. GameObject childObject = UTY.GetChildObject(this.titleBar, "BG", false);
  35. UIWidget component = childObject.gameObject.GetComponent<UIWidget>();
  36. component.width = (int)componentInChildren.transform.localPosition.x + componentInChildren.width + 100;
  37. this.titleBarEffectStartPosX = num2 - component.width;
  38. this.titleBarAddPosX = component.width - 50;
  39. this.titleBar.transform.localPosition = new Vector3((float)this.titleBarEffectStartPosX, (float)num3, 0f);
  40. iTween.Stop(base.gameObject);
  41. iTween.ValueTo(base.gameObject, iTween.Hash(new object[]
  42. {
  43. "easetype",
  44. iTween.EaseType.easeOutCubic,
  45. "from",
  46. 0,
  47. "to",
  48. 1,
  49. "time",
  50. 0.5f,
  51. "onupdate",
  52. "UpdateFadeIn",
  53. "oncomplete",
  54. "OnEndFadeIn"
  55. }));
  56. this.panel.alpha = 1f;
  57. }
  58. private void UpdateFadeIn(float value)
  59. {
  60. int num = (int)((float)this.titleBarAddPosX * value);
  61. Vector3 localPosition = this.titleBar.transform.localPosition;
  62. this.titleBar.transform.localPosition = new Vector3((float)(this.titleBarEffectStartPosX + num), localPosition.y, 0f);
  63. }
  64. private void OnEndFadeIn()
  65. {
  66. Vector3 localPosition = this.titleBar.transform.localPosition;
  67. this.titleBar.transform.localPosition = new Vector3((float)(this.titleBarEffectStartPosX + this.titleBarAddPosX), localPosition.y, 0f);
  68. iTween.ValueTo(base.gameObject, iTween.Hash(new object[]
  69. {
  70. "easetype",
  71. iTween.EaseType.easeOutCubic,
  72. "delay",
  73. this.titleBarDisplayTime,
  74. "from",
  75. 1,
  76. "to",
  77. 0,
  78. "time",
  79. 0.5f,
  80. "onupdate",
  81. "UpdateFadeOut",
  82. "oncomplete",
  83. "OnEndFadeOut"
  84. }));
  85. }
  86. private void UpdateFadeOut(float value)
  87. {
  88. this.panel.alpha = value;
  89. }
  90. private void OnEndFadeOut()
  91. {
  92. this.panel.alpha = 0f;
  93. }
  94. [SerializeField]
  95. public GameObject titleBar;
  96. [SerializeField]
  97. public float titleBarDisplayTime;
  98. private UIPanel panel;
  99. private int titleBarEffectStartPosX;
  100. private int titleBarAddPosX;
  101. }