- LocalizationManager: 新增翻译表(SetFormatted/SetDuration/LocalizeOperateMsg) - LoginPanel: InputField placeholder本地化、字体颜色保持 - HistoryPanel: 用时数据本地化、placeholder本地化 - RecordDetailPanel: 操作详情消息本地化(LanguageChanged重建) - AppraiseWindowBase: 评价等级本地化、操作消息重建 - EditorAppraiser: 所有评估消息改用InjectOperateMsgLocalized - StudentOperateRecorder: 新增InjectOperateMsgLocalized方法 - LocalizationLanguageTestBar: 单例模式、ScreenSpaceOverlay筛选 - 字体切换时保留颜色和verticalOverflow
84 lines
2.1 KiB
C#
84 lines
2.1 KiB
C#
using DevelopEngine;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
namespace XFramework.NetOuter
|
|
{
|
|
public class NetUDPManager : MonoSingleton<NetUDPManager>, IUDPHander
|
|
{
|
|
private UdpOuter udpOuter;//UDP通讯类
|
|
|
|
void Awake()
|
|
{
|
|
//DontDestroyOnLoad(this.gameObject);//
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化UDP通讯类
|
|
/// </summary>
|
|
/// <param name="ip"> 目标IP</param>
|
|
/// <param name="otherPort">目标端口</param>
|
|
/// <param name="localport">自身监听端口</param>
|
|
/// <param name="type">组播/点播 </param>
|
|
public void InitUdp(string ip, int otherPort, int localport, UDPType type)
|
|
{
|
|
udpOuter = new UdpOuter(ip, otherPort, localport, type);
|
|
}
|
|
|
|
private void FixedUpdate()
|
|
{
|
|
udpOuter.ExtractingMsg();
|
|
}
|
|
|
|
public void AddListener(string eventName, INetExcute MsgExcute, bool isOnce = false)
|
|
{
|
|
udpOuter.AddListener(eventName, MsgExcute, isOnce);
|
|
}
|
|
|
|
//主动关闭
|
|
public void Close()
|
|
{
|
|
udpOuter.Close();
|
|
Destroy(this.gameObject);
|
|
}
|
|
|
|
|
|
public void ExtractingMsg()
|
|
{
|
|
udpOuter.ExtractingMsg();
|
|
}
|
|
|
|
public void RemovListener(string eventName)
|
|
{
|
|
udpOuter.RemovListener(eventName);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 发送消息到指定地址
|
|
/// </summary>
|
|
/// <param name="ip"></param>
|
|
/// <param name="port"></param>
|
|
/// <param name="protocol"></param>
|
|
public void SendNetMess(string ip, int port, ProtocolBase protocol)
|
|
{
|
|
udpOuter?.SendNetMess(ip, port, protocol);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 发送消息到默认地址
|
|
/// </summary>
|
|
/// <param name="proto"></param>
|
|
public void SendNetMess(ProtocolBase proto)
|
|
{
|
|
udpOuter?.SendNetMess(proto);
|
|
}
|
|
|
|
//程序结束自动关闭
|
|
void OnDestroy()
|
|
{
|
|
udpOuter?.Close();
|
|
}
|
|
|
|
}
|
|
}
|