unityzgy/Assets/Scripts/ThisProjectTool/GroupManager/GOGroup.cs
ayuan9957 bf12e02276 feat: 多语言本地化系统 - 支持中/英/法/俄实时切换
- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg)
- LoginPanel: InputField placeholder本地化、字体颜色保持
- HistoryPanel: 用时数据本地化、placeholder本地化
- RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建)
- AppraiseWindowBase: 评价等级本地化、操作消息重建
- EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized
- StudentOperateRecorder: 新增InjectOperateMsgLocalized方法
- LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选
- 字体切换时保留颜色和verticalOverflow
2026-07-16 10:05:59 +08:00

81 lines
2.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
/// <summary>
/// 学员组类
/// </summary>
public class GOGroup
{
List<OnlineStudent> onlineStudents;//组内所有成员数据
OnlineStudent master;//组长
StudentContentCtrl contentCtrl;
int groupNumber;
UnityAction<int> onDestory;//组销毁时 人员等于0时触发
public int GroupNumber
{
get
{
return groupNumber;
}
}
/// <summary>
/// 创建分组时 注入组员 设置分组 注册组销毁信息 自动指定队长
/// </summary>
/// <param name="selectStudent"></param>
public GOGroup(List<OnlineStudent> selectStudent,int groupNumber,UnityAction<int> onDestory, StudentContentCtrl contentCtrl)
{
this.contentCtrl = contentCtrl;
this.onlineStudents = selectStudent;
this.groupNumber = groupNumber;
for (int i = 0; i < onlineStudents.Count; i++)
{
contentCtrl.SetStudentGroupNumber(onlineStudents[i].ip, groupNumber);
}
this.onDestory = onDestory;
master = selectStudent[0];
contentCtrl.SetGroupMaster(master.ip, true);
}
//设置新队长
public void SetMaster(OnlineStudent selectStudent)
{
if (selectStudent == master) return;
else
{
contentCtrl.SetGroupMaster(master.ip, false); ;//移除此前的队长
master = selectStudent;
contentCtrl.SetGroupMaster(master.ip, true);//新的队长显示标记
}
}
//移除组成员
public void Remove(OnlineStudent selectStudent)
{
contentCtrl.SetStudentGroupNumber(selectStudent.ip,-1);//
onlineStudents.Remove(selectStudent);
if (onlineStudents.Count == 0) //组人员清空
{
onDestory?.Invoke(groupNumber);
}
else if (selectStudent == master)//移除组长时 自动分配给下一个人
{
contentCtrl.SetGroupMaster(onlineStudents[0].ip, true);
master = onlineStudents[0];
}
}
/// <summary>
/// 获取组内所有成员数据
/// </summary>
/// <returns></returns>
public List<OnlineStudent> GetAllStudent()
{
return onlineStudents;
}
}