CourseBarView.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class CourseBarView : MonoBehaviour
  5. {
  6. [SerializeField]
  7. private Tab3DButtonList MTabBtnList;
  8. [SerializeField]
  9. private TextMesh TitileText;
  10. [SerializeField]
  11. private TextMesh RoomNameText;
  12. [SerializeField]
  13. private TextMesh ChatRoomNameText;
  14. [SerializeField]
  15. private TextMesh UserNameText;
  16. void Start()
  17. {
  18. MTabBtnList.ClickAction = TabClick;
  19. }
  20. private string title_str = "{0}-{1}";
  21. private string user_name_str = "用户名: {0}";
  22. private string room_str = "房间名字: {0}";
  23. public void Show()
  24. {
  25. CourseConfigData course_config = GameConfigData.Instance.course_data.GetCourseConfigById(GamePlayerData.Instance.room_data.CurOnlineData.course_id);
  26. TitileText.text = string.Format(title_str, GameConfigData.Instance.course_data.GetSubjectNameById(short.Parse(course_config.subject_id)), course_config.course_name, GamePlayerData.Instance.room_data.CurOnlineData.course_name);
  27. RoomNameText.text = string.Format(room_str, GamePlayerData.Instance.room_data.CurOnlineData.course_name);
  28. UserNameText.text = string.Format(user_name_str, GamePlayerData.Instance.user_name);
  29. this.gameObject.SetActive(true);
  30. MTabBtnList.Show();
  31. MTabBtnList.ResetBtns();
  32. MTabBtnList.SetBtnVisiable(4, GamePlayerData.Instance.room_data.CurOnlineData.course_id == 12 || GamePlayerData.Instance.room_data.CurOnlineData.course_id == 78);
  33. }
  34. public void Hide()
  35. {
  36. this.gameObject.SetActive(false);
  37. }
  38. private void TabClick()
  39. {
  40. //屏蔽掉非房主的操作
  41. if (!GamePlayerData.Instance.IsFangzhu())
  42. {
  43. return;
  44. }
  45. PannelType pType = PannelType.Default;
  46. switch (MTabBtnList.Index)
  47. {
  48. case 0:
  49. pType = PannelType.Goal;
  50. break;
  51. case 1:
  52. pType = PannelType.Procedure;
  53. break;
  54. case 2:
  55. pType = PannelType.Question;
  56. break;
  57. case 3:
  58. pType = PannelType.Conclusion;
  59. break;
  60. case 4:
  61. pType = PannelType.MR;
  62. break;
  63. }
  64. MessageCenterController.Instance.Broadcast(GameEnum.MESSAGE_SHOW_PANNEL_BY_TYPE, pType);
  65. }
  66. private void OnDestroy()
  67. {
  68. }
  69. }