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,
}
///
/// 用户信息
///
public struct ServerUserInfoMessage : NetworkMessage
{
public Guid userId;
public string name;
}
///
/// Client Send to server
///
public struct ServerRoomMessage : NetworkMessage
{
public ServerRoomOperation Operation;
public RoleName roleName;
public bool isMan;
}
public enum ServerRoomOperation
{
None = 0,
Join,
RoleQuit,
}
///
/// Server send to client
///
public struct ClientRoomMessage : NetworkMessage
{
public ClientRoomOperation operation;
///
/// 所有已经选择了的角色列表
///
public RoleName roleNameList_Joined;
///
/// 客户端加入的角色
///
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 joinedUsers = new List();
/////
///// 需要由用户扮演的真实角色
/////
//public RoleName realRoleName;
/////
///// 电脑自动控制的角色
/////
//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;
//}
/////
///// 创建的网络物体
/////
//[NonSerialized]
//public readonly List gameObjects = new List();
//public override string ToString()
//{
// return $"roomId:{roomId} \nroomName:{roomName} \nzuoYeConfigID:{zuoyeConfigID} \nmaxPlayerCount:{maxPlayerCount} \njoinedPlayerCount:{joinedPlayerCount}";
//}
}
}