unityzgy/Assets/Scripts/ThisProjectTool/GroupManager/GroupManager.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

96 lines
2.7 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
//学员分组训练控制器 组编号等groupsList index+1
public class GroupManager
{
StudentContentCtrl contentCtrl;// 可获取图标所代表学员的状态和数据
public GroupManager(StudentContentCtrl studentContent)
{
contentCtrl = studentContent;
}
List<GOGroup> groups = new List<GOGroup>();
/// <summary>
/// 将一些学员创建为一个编组 并返回创建结果
/// </summary>
/// <param name="selectStudents"></param>
public string CreatGroup(List<OnlineStudent> selectStudents)
{
for (int i = 0; i < selectStudents.Count; i++)//遍历学员是否满足编组条件
{
if (selectStudents[i].groupNumber != -1)
{
return "无法为已有编组的学员再次编组";
}
if (selectStudents[i].state != LearnState.waiting)
{
return "无法为训练中的学员进行编组";
}
}
int number = groups.Count + 1;
groups.Add(new GOGroup(selectStudents, number, OnGroupDestroy,contentCtrl));//创建一个新的编组
return null;
}
/// <summary>
/// 选择一些学员移除编组
/// </summary>
/// <param name="selectStudents"></param>
public string RemoveGroup(List<OnlineStudent> selectStudents)
{
for (int i = 0; i < selectStudents.Count; i++)
{
if (selectStudents[i].groupNumber != -1)
{
groups[selectStudents[i].groupNumber - 1].Remove(selectStudents[i]);
}
}
return null;
}
/// <summary>
/// 选择一些学员 点击添加编组
/// </summary>
/// <returns></returns>
public string AddGroup()
{
return null;
}
/// <summary>
/// 设置组长
/// </summary>
/// <param name="selectStudents"></param>
/// <returns></returns>
public string SetMaster(List<OnlineStudent> selectStudents)
{
if (selectStudents.Count > 1)
return "组长不能为多人";
if (selectStudents[0].groupNumber==-1)
return "未分组的人员无法设为组长";
groups[selectStudents[0].groupNumber - 1].SetMaster(selectStudents[0]);
return null;
}
/// <summary>
/// 获取组内所有人员
/// </summary>
/// <param name="groupNumber">组编号</param>
/// <returns></returns>
public List<OnlineStudent> GetGroupStudents(int groupNumber)
{
return groups[groupNumber - 1].GetAllStudent();
}
//组销毁执行方法
private void OnGroupDestroy(int number)
{
groups.RemoveAt(number - 1);
}
}