- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
124 lines
3.5 KiB
C#
124 lines
3.5 KiB
C#
using System;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using UnityEngine.Events;
|
||
using XFramework.Objects;
|
||
|
||
public class StudentContentCtrl : MonoBasePanel
|
||
{
|
||
public GameObject studentOnlinePrefab;//学生登陆预制件
|
||
Dictionary<string, OnlineStudentPrefabCtrl> onlineStudents = new Dictionary<string, OnlineStudentPrefabCtrl>();//key ip value goctrl
|
||
UnityAction<Vector3Int> studentCountEvent;
|
||
// Start is called before the first frame update
|
||
|
||
|
||
protected override void Start()
|
||
{
|
||
base.Start();
|
||
}
|
||
|
||
protected override void InitComponent()
|
||
{
|
||
base.InitComponent();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 学员数量发生变化时传回各类学员的数量
|
||
/// </summary>
|
||
/// <param name="countChange"> x 等待学员数量,y训练学员数量 z考核学员数量</param>
|
||
public void AddListener(UnityAction<Vector3Int> countChange)
|
||
{
|
||
studentCountEvent += countChange;
|
||
}
|
||
|
||
//新上线一名学生
|
||
public void AddStudent(OnlineStudent onlineStudent)
|
||
{
|
||
//Debug.Log("上线新增一名学生");
|
||
GameObject newPre = ObjectPool.Instance.Instantiate(studentOnlinePrefab, this.transform);
|
||
newPre.transform.localScale = Vector3.one;
|
||
OnlineStudentPrefabCtrl ctrl= newPre.GetComponent<OnlineStudentPrefabCtrl>();
|
||
ctrl.SetMsg(onlineStudent);
|
||
onlineStudents.Add(onlineStudent.ip, ctrl);
|
||
CardingStudentCount();
|
||
}
|
||
|
||
//设置一名学生是否为组长
|
||
public void SetGroupMaster(string ip, bool isMaster)
|
||
{
|
||
onlineStudents[ip].IsMaster = isMaster;
|
||
}
|
||
|
||
//设置一名学生分组状态
|
||
public void SetStudentGroupNumber(string ip, int groupNumber)
|
||
{
|
||
onlineStudents[ip].GroupNumber = groupNumber;
|
||
}
|
||
|
||
//离线一名学生
|
||
public void RemoveStudent(string ip)
|
||
{
|
||
if (onlineStudents.ContainsKey(ip))
|
||
{
|
||
//Debug.Log("离线减少一名学生");
|
||
ObjectPool.Instance.Destroy(onlineStudents[ip].gameObject);
|
||
onlineStudents.Remove(ip);
|
||
}
|
||
CardingStudentCount();
|
||
}
|
||
|
||
//改变学员当前训练状态
|
||
public void ChangeStudentState(string ip,string subName,LearnState state)
|
||
{
|
||
onlineStudents[ip].ChangeState(subName, state);
|
||
CardingStudentCount();
|
||
}
|
||
|
||
//改变学员当前训练状态
|
||
public void ChangeStudentStage(string ip, NetSubStage stage)
|
||
{
|
||
onlineStudents[ip].ChangeStage(stage);
|
||
}
|
||
|
||
//梳理各类学员数量并调用注册的事件
|
||
public void CardingStudentCount()
|
||
{
|
||
if (studentCountEvent == null) return;
|
||
Vector3Int vector3Int= Vector3Int.zero;
|
||
foreach (var item in onlineStudents)
|
||
{
|
||
switch (item.Value.GetStudentMsg().state)
|
||
{
|
||
case LearnState.waiting:
|
||
vector3Int.x++;
|
||
break;
|
||
case LearnState.learning:
|
||
vector3Int.y++;
|
||
break;
|
||
case LearnState.examing:
|
||
vector3Int.z++;
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
studentCountEvent.Invoke(vector3Int);
|
||
}
|
||
|
||
//获取学员的数据 用于显示成绩面板
|
||
public OnlineStudent GetStudentMsg(string ip)
|
||
{
|
||
return onlineStudents[ip].GetStudentMsg();
|
||
}
|
||
|
||
//获取学员的Icon 用于分组
|
||
public OnlineStudentPrefabCtrl GetStudentIcon(string ip)
|
||
{
|
||
return onlineStudents[ip];
|
||
}
|
||
|
||
|
||
|
||
}
|