unityzgy/Assets/Scripts/UIScripts/Teacher/ModelManagerPanel.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

104 lines
3.4 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XFramework;
using UnityEngine.UI;
using System;
using Public.File;
public class ModelManagerPanel : BasePanel
{
const string panelName= "Panel_ModelManagement";
Button button_Close;
Button button_addModel;
//Dictionary<string,AssetBundleMsg> allMsgs = new Dictionary<string,AssetBundleMsg>();//记录从数据库中或
EditorContentCtrl contentCtrl_equip;
EditorContentCtrl contentCtrl_tool;
EditorContentCtrl contentCtrl_terrain;
EditorContentCtrl contentCtrl_weather;
AddModelWindowCtrl addModel;
//List<string> equipList = new List<string>();
//List<string> toolList = new List<string>();
//List<string> terrainList = new List<string>();
//List<string> weatherList = new List<string>();
public ModelManagerPanel() : base(new UIType(panelName))
{
}
protected override void InitEvent()
{
button_Close = ActivePanel.Find("Button_return").GetComponent<Button>();
button_addModel = ActivePanel.Find("Button_addModel").GetComponent<Button>();
button_Close.onClick.AddListener(ClosePanel);
button_addModel.onClick.AddListener(StartAddModel);
contentCtrl_equip = ActivePanel.FindChildTrans("Content_equip").GetComponent<EditorContentCtrl>();
contentCtrl_tool = ActivePanel.FindChildTrans("Content_tool").GetComponent<EditorContentCtrl>();
contentCtrl_terrain = ActivePanel.FindChildTrans("Content_terrain").GetComponent<EditorContentCtrl>();
contentCtrl_weather = ActivePanel.FindChildTrans("Content_weather").GetComponent<EditorContentCtrl>();
addModel = ActivePanel.Find("Panel_operateUser").GetComponent<AddModelWindowCtrl>();
AssetBundleMsg[] assetBundleMsgs = DBManager.Instance.GetABMsg();
EventCenter.Instance.AddEventListener<AssetBundleMsg>("ShowModelMsg", ShowModel);
for (int i = 0; i < assetBundleMsgs.Length; i++)
{
AddIcon(assetBundleMsgs[i]);
}
}
private void AddIcon(AssetBundleMsg bundleMsg)
{
switch (bundleMsg.type)
{
case ABType.:
contentCtrl_equip.AddChild(bundleMsg.assetsName, bundleMsg);
break;
case ABType.:
contentCtrl_tool.AddChild(bundleMsg.assetsName, bundleMsg);
break;
case ABType.:
contentCtrl_terrain.AddChild(bundleMsg.assetsName, bundleMsg);
break;
case ABType.:
contentCtrl_weather.AddChild(bundleMsg.assetsName, bundleMsg);
break;
default:
break;
}
}
//弹出面板 增加数据
void StartAddModel()
{
addModel.AddNew(ModelAdded);
List<string> equipName = new List<string>();
foreach (var item in contentCtrl_equip.children)
{
equipName.Add(item.Value.text_IconName.text);
}
addModel.InitParentsDropDown(equipName.ToArray());
}
//展示一个已有模型数据
void ShowModel(AssetBundleMsg assetBundleMsg)
{
addModel.ShowAbMsg(assetBundleMsg);
}
//添加完成后更新界面
void ModelAdded(AssetBundleMsg assetBundleMsg)
{
AddIcon(assetBundleMsg);
}
private void ClosePanel()
{
Pop();
Push(new DaoHangPanel()).Change((float)UserType.manager);
}
}