SceneADV.cs 2.9 KB

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