GlobalData.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. /** 全局游戏数据 */
  5. public class GlobalData
  6. {
  7. public static PKMatchType pkMatchType = PKMatchType.None;
  8. //本地双人PK,双方选择的角色ID
  9. public static int[] localPK_playerRoleIDs = new int[] {1, 2};
  10. //双人PK匹配结果
  11. public static int matchRoomType = 0; //Pk匹配房间类型
  12. public static int roomID;
  13. public static int playerIndexInRoom;
  14. public static List<MatchPlayerInfo> matchPlayerInfos;
  15. }
  16. /**接收别人的PK邀请时,会设置GlobalData的数据,如果这时候主页存在层级页面,接收PK邀请但又突然要返回,
  17. 这时候层级页面设置过的GlobalData可能会被好友邀请修改过,因此主页用GlobalDataTemp存储可能会被干涉的数据,
  18. 在最后一步才把GlobalDataTemp数据赋值给GlobalData */
  19. public class GlobalDataTemp
  20. {
  21. public static PKMatchType pkMatchType = PKMatchType.None;
  22. public static int matchRoomType = 0; //Pk匹配房间类型
  23. }
  24. public enum PKMatchType {
  25. None, //不是PK,就是单击单人
  26. LocalPK, //本地PK
  27. OnlinePK //联网PK4444
  28. }
  29. public class MatchPlayerInfo {
  30. public int playerID;
  31. public int avatarID;
  32. public string nickname;
  33. }