MenuUI.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. }
  30. public void ShowNavBar()
  31. {
  32. UIUtil.Play (topBarAnim, UIUtil.AnimationName.Show);
  33. UIUtil.Play (leftBtnsAnim, UIUtil.AnimationName.Show);
  34. }
  35. public void OnNavBarShown()
  36. {
  37. }
  38. public void Ready()
  39. {
  40. isReady = true;
  41. startBtnContainer.Show();
  42. clanChatBar.Refresh ();
  43. // missionBar.PrepareData ();
  44. //GetComponent<WoodenDummyManager>().enabled = true;
  45. }
  46. public void ShowMail()
  47. {
  48. MailPanel.Show ();
  49. }
  50. public void ShowLeaderBoard()
  51. {
  52. LeaderBoard.Show ();
  53. }
  54. public void ShowClanPanel()
  55. {
  56. ClanPanel.Show ();
  57. }
  58. public void ShowShopPanel()
  59. {
  60. BuyCoinPanel.Show ();
  61. }
  62. public void StartBattle()
  63. {
  64. DoStartBattle();
  65. }
  66. private void DoStartBattle()
  67. {
  68. BattleSession battleSession = battleController.GetBattleSession ();
  69. battleSession.GetMessageManager ().SearchBattle (battleSession.mode);
  70. GetComponent<WoodenDummyManager> ().enabled = false;
  71. }
  72. }