| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- using Mirror;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- namespace DTYJ
- {
- [Flags]
- public enum RoleName
- {
- 值班站长 = 1 << 1,
- 车站值班员 = 1 << 2,
- 站务员_站台 = 1 << 3,
- 站务员_站厅 = 1 << 4,
- }
- /// <summary>
- /// 用户信息
- /// </summary>
- public struct ServerUserInfoMessage : NetworkMessage
- {
- public Guid userId;
- public string name;
- }
- /// <summary>
- /// Client Send to server
- /// </summary>
- public struct ServerRoomMessage : NetworkMessage
- {
- public ServerRoomOperation Operation;
- public RoleName roleName;
- public bool isMan;
- }
- public enum ServerRoomOperation
- {
- None = 0,
- Join,
- RoleQuit,
- }
- /// <summary>
- /// Server send to client
- /// </summary>
- public struct ClientRoomMessage : NetworkMessage
- {
- public ClientRoomOperation operation;
- /// <summary>
- /// 所有已经选择了的角色列表
- /// </summary>
- public RoleName roleNameList_Joined;
- /// <summary>
- /// 客户端加入的角色
- /// </summary>
- public RoleName roleName_Joined;
- }
- public enum ClientRoomOperation
- {
- None = 0,
- Joined,
- JoinedList,
- }
- public class RoomInfo
- {
- RoleName roleJoined;
- //public Guid roomId;
- //public string roomName;
- //public uint zuoyeConfigID;//作业配置文件ID
- //public List<User> joinedUsers = new List<User>();
- ///// <summary>
- ///// 需要由用户扮演的真实角色
- ///// </summary>
- //public RoleName realRoleName;
- ///// <summary>
- ///// 电脑自动控制的角色
- ///// </summary>
- //public RoleName aiRoleName { get { return zuoYeConfig.RoleNames ^ realRoleName; } }
- //public ZuoYeConfig zuoYeConfig { get { return OnlineCtrl.Instance.GetZuoYeConfig(zuoyeConfigID); } }
- //public int maxPlayerCount { get { return Utility.GetFlagEnumCount((int)realRoleName); } }
- //public int joinedPlayerCount { get { return joinedUsers.Count; } }
- //public bool isFull { get { return joinedPlayerCount >= maxPlayerCount; } }
- //public bool isAI(RoleName roleName)
- //{
- // return (aiRoleName & roleName) == roleName;
- //}
- //public string GetPrettyName(RoleName roleName)
- //{
- // string prettyName = $"{roleName}({(isAI(roleName) ? "电脑" : joinedUsers.Where(u => u.roleName == roleName).First()?.name)})";
- // return prettyName;
- //}
- ///// <summary>
- ///// 创建的网络物体
- ///// </summary>
- //[NonSerialized]
- //public readonly List<GameObject> gameObjects = new List<GameObject>();
- //public override string ToString()
- //{
- // return $"roomId:{roomId} \nroomName:{roomName} \nzuoYeConfigID:{zuoyeConfigID} \nmaxPlayerCount:{maxPlayerCount} \njoinedPlayerCount:{joinedPlayerCount}";
- //}
- }
- }
|