- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
67 lines
1.6 KiB
C#
67 lines
1.6 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Text3DCtrl : MonoBehaviour
|
|
{
|
|
public TextMesh textMesh;
|
|
public LookAtState LookAtState = LookAtState.LookAt;
|
|
Transform targetTrans;
|
|
float angleX;
|
|
|
|
public void SetLayer(string LayerName)
|
|
{
|
|
this.gameObject.layer = LayerMask.NameToLayer(LayerName);
|
|
}
|
|
|
|
public void SetLookTarget(Transform transform)
|
|
{
|
|
targetTrans = transform;
|
|
angleX = this.transform.localEulerAngles.x;
|
|
}
|
|
|
|
public void SetTextSize(float size)
|
|
{
|
|
if (size != 0)
|
|
textMesh.characterSize = size;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if (targetTrans&&transform.gameObject.activeSelf)
|
|
{
|
|
transform.LookAt(transform.position + targetTrans.rotation * Vector3.forward,
|
|
targetTrans.rotation * Vector3.up);
|
|
if (LookAtState == LookAtState.LookAtKeepX)//保持X轴 只旋转Y轴
|
|
{
|
|
Vector3 eulerAngles = this.transform.localEulerAngles;
|
|
eulerAngles.x = 0;
|
|
eulerAngles.z = 0;
|
|
this.transform.localEulerAngles = eulerAngles;
|
|
}
|
|
}
|
|
//this.transform.eulerAngles += new Vector3(0,180,0);
|
|
}
|
|
|
|
public void SetName(string text)
|
|
{
|
|
textMesh.text = text;
|
|
}
|
|
|
|
//选选取的时候 改变文字颜色
|
|
public void ChangeTextColor(Color newColor)
|
|
{
|
|
textMesh.color = newColor;
|
|
}
|
|
}
|
|
|
|
public enum LookAtState
|
|
{
|
|
//看向目标
|
|
LookAt,
|
|
|
|
//看向目标 同时保持X轴
|
|
LookAtKeepX,
|
|
}
|