Merge branch 'main' of http://10.27.17.121:3000/kawagiri/TH1
This commit is contained in:
commit
639402a3ac
@ -266,13 +266,36 @@ namespace Logic.Audio
|
||||
|
||||
public void Play(float recordTime = 0f)
|
||||
{
|
||||
if (Clip == null)
|
||||
{
|
||||
State = PlayerState.Finished;
|
||||
return;
|
||||
}
|
||||
|
||||
StartTime = Time.time;
|
||||
recordTime = Mathf.Clamp(recordTime, 0, Clip.length);
|
||||
Source.time = recordTime;
|
||||
Source.clip = Clip;
|
||||
|
||||
// 确保 recordTime 在有效范围内,留一点余量避免边界问题
|
||||
float maxSeekTime = Mathf.Max(0, Clip.length - 0.1f);
|
||||
recordTime = Mathf.Clamp(recordTime, 0, maxSeekTime);
|
||||
|
||||
Source.volume = 0;
|
||||
Source.loop = IsLoop;
|
||||
Source.Play();
|
||||
|
||||
// 先播放再设置时间,某些音频格式需要这样
|
||||
if (recordTime > 0 && Clip.loadState == AudioDataLoadState.Loaded)
|
||||
{
|
||||
try
|
||||
{
|
||||
Source.time = recordTime;
|
||||
}
|
||||
catch
|
||||
{
|
||||
Source.time = 0;
|
||||
}
|
||||
}
|
||||
|
||||
State = PlayerState.FadeIn;
|
||||
}
|
||||
|
||||
|
||||
@ -411,7 +411,11 @@ namespace Logic
|
||||
var record = Main.MapData.ExportGameRecord();
|
||||
GameRecordManager.Instance.AddRecord(record);
|
||||
|
||||
#if ENABLE_TRAIN
|
||||
|
||||
TrainingDataRecorder.Instance.SaveEpisode();
|
||||
|
||||
#endif
|
||||
|
||||
// 添加延迟退出,确保数据保存完成
|
||||
_gameLogic.Main.StartCoroutine(QuitGameAfterDelay(10f));
|
||||
|
||||
@ -83,12 +83,10 @@ namespace TH1_Logic.Steam
|
||||
// 关闭所有现有连接
|
||||
DisconnectAll();
|
||||
// 关闭当前监听套接字
|
||||
if (_listenSocket != HSteamListenSocket.Invalid)
|
||||
{
|
||||
SteamNetworkingSockets.CloseListenSocket(_listenSocket);
|
||||
_listenSocket = HSteamListenSocket.Invalid;
|
||||
LogSystem.LogInfo("已关闭现有监听套接字");
|
||||
}
|
||||
SteamNetworkingSockets.CloseListenSocket(_listenSocket);
|
||||
_listenSocket = HSteamListenSocket.Invalid;
|
||||
LogSystem.LogInfo("已关闭现有监听套接字");
|
||||
|
||||
// 强制清理特定端口的所有连接
|
||||
SteamNetworkingSockets.RunCallbacks();
|
||||
}
|
||||
@ -350,7 +348,14 @@ namespace TH1_Logic.Steam
|
||||
LogSystem.LogError("远程超时 - 目标用户网络问题");
|
||||
break;
|
||||
default:
|
||||
LogSystem.LogError($"未知连接失败原因: {endReason}");
|
||||
if (endReason >= 1000 && endReason < 2000)
|
||||
{
|
||||
LogSystem.LogError($"应用层拒绝连接 - 错误码: {endReason},可能原因:1.对方未创建监听套接字 2.对方主动拒绝 3.对方游戏未运行");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogSystem.LogError($"未知连接失败原因: {endReason}");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -505,9 +505,9 @@ namespace Logic
|
||||
public void CalcUnitMoveInfo(MapData mapData, uint uid)
|
||||
{
|
||||
//Step #1 设置好各种初始参数
|
||||
mapData.UnitMap.GetUnitDataByUnitId(uid, out var unitData);
|
||||
mapData.GetPlayerDataByUnitId(uid, out var playerData);
|
||||
mapData.GetGridDataByUnitId(uid, out var gridData);
|
||||
if (!mapData.UnitMap.GetUnitDataByUnitId(uid, out var unitData)) return;
|
||||
if (!mapData.GetPlayerDataByUnitId(uid, out var playerData)) return;
|
||||
if (!mapData.GetGridDataByUnitId(uid, out var gridData)) return;
|
||||
int width = (int)mapData.MapConfig.Width;
|
||||
int height = (int)mapData.MapConfig.Height;
|
||||
|
||||
|
||||
@ -54,8 +54,18 @@ namespace TH1_UI.View.Info
|
||||
|
||||
public void SetContent(CommonActionId actionId,ShowType cantType, CommonActionParams param, Action<CommonActionId,CommonActionParams> actionClickCallback)
|
||||
{
|
||||
|
||||
|
||||
// 添加参数校验
|
||||
if (actionId == null)
|
||||
{
|
||||
Debug.LogError("UIInfoCommonBaseActionCircleMono.SetContent: actionId 为 null");
|
||||
return;
|
||||
}
|
||||
|
||||
if (param == null)
|
||||
{
|
||||
Debug.LogError("UIInfoCommonBaseActionCircleMono.SetContent: param 为 null");
|
||||
return;
|
||||
}
|
||||
|
||||
//Step #0 基础变量设置
|
||||
if (!Table.Instance.ActionDataAssets.GetActionInfo(actionId, out var info)) return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user