MultiPlayerManager.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class MultiPlayerManager : MonoSingleton<MultiPlayerManager>
  5. {
  6. public delegate void JoinRoom(SyncObject sycObj);
  7. public delegate void QuitRoom(SyncObject sycObj);
  8. public delegate void SynObject(SyncObject sycObj);
  9. public delegate void SynVideo(SyncVideo sycVideo);
  10. public JoinRoom OnJoinRoom;
  11. public QuitRoom OnQuitRoom;
  12. public SynObject OnSynObject;
  13. public SynVideo OnSynVideo;
  14. public Queue<SyncObject> qSyncObject;
  15. public Queue<SyncVideo> qSyncVideo;
  16. public void MessageCallBack(string message)
  17. {
  18. }
  19. public void RoomCallBack()
  20. {
  21. }
  22. public IEnumerator SendMessage()
  23. {
  24. while(true)
  25. {
  26. yield return new WaitForSeconds(0.4f);
  27. // 发送同步信息
  28. if(qSyncObject.Count>0)
  29. {
  30. }
  31. if(qSyncVideo.Count>0)
  32. {
  33. }
  34. }
  35. }
  36. }
  37. public class SyncObject
  38. {
  39. public string id { get; set; }
  40. public bool isSelect { get; set; }
  41. public bool objAction { get; set; }
  42. public Vector3 pos { get; set; }
  43. public Vector3 rot { get; set; }
  44. }
  45. public class SyncVideo
  46. {
  47. public string id { get; set; }
  48. public bool isPlay { get; set; }
  49. public float times { get; set; }
  50. }
  51. public enum SyncObjectType
  52. {
  53. Object,
  54. Video
  55. }