MenuUI.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using LitJson;
  6. public class MenuUI : MonoBehaviour {
  7. public enum UIState
  8. {
  9. Hidden,
  10. Hide,
  11. Show,
  12. Shown
  13. }
  14. public BattleController battleController;
  15. public Animator topBarAnim;
  16. public Animator leftBtnsAnim;
  17. public StartBtnContainer startBtnContainer;
  18. public MissionBar missionBar;
  19. public ChatBar chatBar;
  20. public InviteBar inviteBar;
  21. public ClanChatBar clanChatBar;
  22. private bool isReady;
  23. public void Start()
  24. {
  25. if(Session.GetInstance().GetBattleSession() == null)
  26. Session.GetInstance().NewBattleSession ();
  27. SoundManager.GetInstatnce().bgSound.Play(SoundManager.GetInstatnce().bgSound.menu);
  28. Screen.sleepTimeout = SleepTimeout.NeverSleep;
  29. PaymentManager.GetIntance ();
  30. }
  31. public void ShowNavBar()
  32. {
  33. UIUtil.Play (topBarAnim, UIUtil.AnimationName.Show);
  34. UIUtil.Play (leftBtnsAnim, UIUtil.AnimationName.Show);
  35. }
  36. public void OnNavBarShown()
  37. {
  38. }
  39. public void Ready()
  40. {
  41. isReady = true;
  42. startBtnContainer.Show();
  43. clanChatBar.Refresh ();
  44. // missionBar.PrepareData ();
  45. //GetComponent<WoodenDummyManager>().enabled = true;
  46. }
  47. public void ShowMail()
  48. {
  49. MailPanel.Show ();
  50. }
  51. public void ShowLeaderBoard()
  52. {
  53. LeaderBoard.Show ();
  54. }
  55. public void ShowClanPanel()
  56. {
  57. ClanPanel.Show ();
  58. }
  59. public void ShowShopPanel()
  60. {
  61. BuyCoinPanel.Show ();
  62. }
  63. public void StartBattle()
  64. {
  65. DoStartBattle();
  66. }
  67. private void DoStartBattle()
  68. {
  69. BattleSession battleSession = battleController.GetBattleSession ();
  70. battleSession.GetMessageManager ().SearchBattle (battleSession.mode);
  71. GetComponent<WoodenDummyManager> ().enabled = false;
  72. }
  73. }