- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
126 lines
3.7 KiB
C#
126 lines
3.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using Public.File;
|
|
using System;
|
|
using UnityEngine.Events;
|
|
|
|
public class AddModelWindowCtrl : MonoBasePanel
|
|
{
|
|
public InputField inputField_Name;
|
|
public Dropdown dropdown_Type;
|
|
public Dropdown dropdown_parentName;
|
|
public Text text_path;
|
|
public Button button_openFile;
|
|
public Button button_sure;
|
|
public Button button_Close;
|
|
//修改现有装备时
|
|
bool revise;
|
|
AssetBundleMsg currentMsg;
|
|
UnityAction<AssetBundleMsg> addedAction;
|
|
|
|
protected override void Start()
|
|
{
|
|
base.Start();
|
|
this.gameObject.SetActive(false);
|
|
}
|
|
|
|
protected override void InitComponent()
|
|
{
|
|
dropdown_Type.onValueChanged.AddListener(ResourcesTypeChanged);
|
|
button_openFile.onClick.AddListener(OpenFile);
|
|
button_sure.onClick.AddListener(SaveABMsg);
|
|
button_Close.onClick.AddListener(()=>this.gameObject.SetActive(false));
|
|
|
|
}
|
|
|
|
//初始化装备列表
|
|
public void InitParentsDropDown(string [] names)
|
|
{
|
|
dropdown_parentName.options.Clear();
|
|
for (int i = 0; i < names.Length; i++)
|
|
{
|
|
dropdown_parentName.options.Add(new Dropdown.OptionData(names[i]));
|
|
}
|
|
}
|
|
|
|
//展示已有数据
|
|
public void ShowAbMsg(AssetBundleMsg asset)
|
|
{
|
|
currentMsg = asset;
|
|
revise = true;
|
|
ActiveThis();
|
|
inputField_Name.text = asset.assetsName;
|
|
dropdown_Type.value = ((int)asset.type-1);
|
|
dropdown_parentName.captionText.text = asset.parentName;
|
|
text_path.text = asset.filePath;
|
|
}
|
|
|
|
|
|
//待增加资源类型变化时 执行
|
|
public void ResourcesTypeChanged(int value)
|
|
{
|
|
if (dropdown_Type.options[value].text == "工具")
|
|
{
|
|
dropdown_parentName.gameObject.SetActive(true);
|
|
dropdown_parentName.value = 0;
|
|
}
|
|
else
|
|
dropdown_parentName.gameObject.SetActive(false);
|
|
}
|
|
|
|
//新增装备时
|
|
public void AddNew(UnityAction<AssetBundleMsg> addedAction)
|
|
{
|
|
this.addedAction = addedAction;
|
|
revise = false;
|
|
currentMsg = new AssetBundleMsg();
|
|
ActiveThis();
|
|
inputField_Name.text = "";
|
|
dropdown_Type.value = 0;
|
|
dropdown_parentName.gameObject.SetActive(false);
|
|
text_path.text = "";
|
|
}
|
|
|
|
void OpenFile()
|
|
{
|
|
string path = OpenWindow.GetFilePath("指定资源文件",Application.streamingAssetsPath + "/OutAssets/AB", "Asset Bundle(*.ab)\0*.ab\0" );
|
|
if (!string.IsNullOrEmpty(path))
|
|
{
|
|
currentMsg.filePath = path;
|
|
text_path.text = path;
|
|
inputField_Name.text = path.Substring(path.LastIndexOf('\\')+1).Split('.')[0];
|
|
}
|
|
}
|
|
|
|
//确定增加记录
|
|
private void SaveABMsg()
|
|
{
|
|
currentMsg.type = (ABType)Enum.Parse(typeof(ABType) ,dropdown_Type.captionText.text);
|
|
currentMsg.filePath = text_path.text;
|
|
currentMsg.assetsName = inputField_Name.text;
|
|
if (currentMsg.type == ABType.工具)
|
|
currentMsg.parentName = dropdown_parentName.captionText.text;
|
|
else
|
|
currentMsg.parentName = null;
|
|
if (!revise)//新增模式 新增名称重复的装备时 覆盖更新数据库中的数据
|
|
{
|
|
DBManager.Instance.InsterABMsg(currentMsg);
|
|
addedAction?.Invoke(currentMsg);
|
|
}
|
|
else//编辑模式不再实现
|
|
{
|
|
// GameMain.Instance.UpdateABMsg(currentMsg);
|
|
}
|
|
this.gameObject.SetActive(false);
|
|
}
|
|
|
|
void ActiveThis()
|
|
{
|
|
this.gameObject.SetActive(true);
|
|
button_openFile.interactable = !revise;
|
|
}
|
|
|
|
}
|