Merge branch 'develop' of ssh://git.pthub.vn:3222/Unity/perfect-world-unity into feature/review-npc

This commit is contained in:
DESKTOP-244GPOT\Admin
2026-05-31 18:22:18 +07:00
20 changed files with 525 additions and 214 deletions
@@ -58,7 +58,7 @@ MonoBehaviour:
m_ContentStateBuildPathProfileVariableName: <default settings path>
m_CustomContentStateBuildPath:
m_ContentStateBuildPath:
m_BuildAddressablesWithPlayerBuild: 0
m_BuildAddressablesWithPlayerBuild: 2
m_overridePlayerVersion: '[UnityEditor.PlayerSettings.bundleVersion]'
m_GroupAssets:
- {fileID: 11400000, guid: c99cbfd356e4d487b8da3554688ea241, type: 2}
@@ -1241,12 +1241,6 @@ MonoBehaviour:
m_SerializedLabels:
- RemoteContent
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 96405357221afa34990f1c8b0ad64755
m_Address: "gfx/\u7B56\u5212\u8054\u5165/\u4EBA\u7269\u6280\u80FD/\u51FB\u4E2D/\u517D\u738B\u9524\u51FB\u4E2D.gfx"
m_ReadOnly: 0
m_SerializedLabels:
- RemoteContent
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 97bb43aeae9345e4ea58bd33e8257cb0
m_Address: "gfx/\u7B56\u5212\u8054\u5165/\u4EBA\u7269\u6280\u80FD/\u98DE\u884C/\u9F99\u73B0\u98DE\u884C.gfx"
m_ReadOnly: 0
@@ -2082,7 +2082,6 @@ GameObject:
- component: {fileID: 3165494068242929401}
- component: {fileID: 5334810740042598332}
- component: {fileID: 7700292349787736273}
- component: {fileID: 3017834984568792303}
m_Layer: 7
m_Name: Object3377
m_TagString: Untagged
@@ -2158,28 +2157,6 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!64 &3017834984568792303
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 189128314675701766}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 5
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 4300000, guid: e1fd0f7fe1695472f9549089cb896347, type: 2}
--- !u!1 &213712246934505364
GameObject:
m_ObjectHideFlags: 0
@@ -1,59 +1,118 @@
#if UNITY_EDITOR || DEVELOPMENT_BUILD
using System;
using System.IO;
using System.Text;
using UnityEngine;
namespace BrewMonster
{
/// <summary>NDJSON debug session logger (agent instrumentation).</summary>
public static class DebugSessionLog
{
const string LogPath = @"c:\Hoang\PW\debug-a9c674.log";
const string SessionId = "a9c674";
public static void Write(string location, string message, string hypothesisId, object data, string runId = "pre-fix")
public static void Write(string location, string message, string hypothesisId, DebugSessionPayload data, string runId = "pre-fix")
{
try
{
var ts = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
var dataJson = data != null ? JsonUtility.ToJson(data) : "{}";
var line = $"{{\"sessionId\":\"{SessionId}\",\"runId\":\"{runId}\",\"hypothesisId\":\"{hypothesisId}\",\"location\":\"{Escape(location)}\",\"message\":\"{Escape(message)}\",\"data\":{dataJson},\"timestamp\":{ts}}}\n";
File.AppendAllText(LogPath, line, Encoding.UTF8);
}
catch { /* ignore */ }
}
static string Escape(string s) => (s ?? "").Replace("\\", "\\\\").Replace("\"", "\\\"");
}
[Serializable]
public class DebugSessionPayload
{
public int skillId;
public int hostId;
public int castTargetId;
public int targetId;
public int targetCount;
public bool castInTargets;
public bool alreadyFired;
public int flyClusterCount;
public int flyDelayMs;
public int eventId;
public string flyGfx;
public string prevState;
public string newState;
public int frame;
public float spawnX;
public float spawnY;
public float spawnZ;
public float targetX;
public float targetY;
public float targetZ;
public float radius;
public float offsetMag;
public bool isCluster;
public bool isArea;
}
}
#endif
@@ -401,7 +401,6 @@ namespace BrewMonster
200, // timeToBeFired
1000 // timeToDoDamage
);
BMLogger.LogError("HoangDev: idTarget:" + idTarget);
m_targets.AddLast(newEvent);
#if UNITY_EDITOR
if (m_AttackList.Count == 0)
@@ -116,7 +116,6 @@ namespace BrewMonster.Scripts
m_pHost.PlayAction((int)PLAYER_ACTION_TYPE.ACT_TAKEOFF);
else
{
Debug.LogError("(int)PLAYER_ACTION_TYPE.ACT_TAKEOFF_SWORD");
m_pHost.PlayAction((int)PLAYER_ACTION_TYPE.ACT_TAKEOFF_SWORD);
}
}
@@ -821,6 +821,7 @@ namespace BrewMonster.Scripts
}
vCurPos = m_pHost.m_MoveCtrl.GroundMove(EC_Utility.ToA3DVECTOR3(vMoveDir), fSpeed, fDeltaTime, m_pHost.m_fVertSpeed);
//BoxCastDrawer.DrawCenterAxis(EC_Utility.ToVector3(vCurPos), Quaternion.identity, 1f, 3f);
m_pHost.SetPos(EC_Utility.ToVector3(vCurPos));
}
else
@@ -139,7 +139,6 @@ namespace BrewMonster.Scripts
public override bool Tick(float dwDeltaTime)
{
base.Tick(dwDeltaTime);
int iMoveReason = ShouldMove();
if (iMoveReason != 0)
{
@@ -219,7 +219,7 @@ namespace BrewMonster
Vector3 vDelta = vDest - vStart;
const int allLayers = -1;
if (Physics.RaycastNonAlloc(ray, hits, Mathf.Infinity, allLayers) > 0)
if (Physics.RaycastNonAlloc(ray, hits, maxDistance: 1000f, allLayers) > 0)
{
int hostCid = GetCharacterID();
CECObject clickedObject = null;
@@ -957,7 +957,6 @@ namespace BrewMonster
continue;
string strGFXFile = szBasePath + strEffect;
BMLogger.LogError("HoangDevGFXSTATE: strGFXFile: " +strGFXFile);
// [中文] TestProcessPetCureGFX — 宠愈 GFX 系统尚未移植,跳过(等价于始终返回 false)
// [English] TestProcessPetCureGFX — pet-cure GFX system not ported yet; skip (equivalent to always false)
// if (TestProcessPetCureGFX(strGFXFile, dwFlag2 != 0, i + idState * bitSize)) continue;
@@ -2607,9 +2606,7 @@ namespace BrewMonster
if (GetMoveEnv() == (int)MoveEnvironment.MOVEENV_GROUND)
{
riseName = EC_Utility.BuildActionName(data, weapon_type, "_施放起_");
Debug.Log("HoangDev: riseName: " + riseName);
fallName = EC_Utility.BuildActionName(data, weapon_type, "_施放落_");
Debug.Log("HoangDev: fallName: " + fallName);
}
else
{
+257 -75
View File
@@ -1,13 +1,9 @@
using BrewMonster.Network;
using BrewMonster.Scripts;
using BrewMonster.Scripts.Ornament;
using BrewMonster.Scripts.World;
using CSNetwork.GPDataType;
using System;
using UnityEngine;
using UnityEngine.UI;
using static BrewMonster.CECHostMove;
using static System.Net.Mime.MediaTypeNames;
using WORD = System.UInt16;
namespace BrewMonster
@@ -124,17 +120,26 @@ namespace BrewMonster
if ((pEnvTrc.dwCheckFlag & CDR_EVN.CDR_BRUSH) == CDR_EVN.CDR_BRUSH)
{
float fFractionBrush = 100f;
Vector3 v3Normal = Vector3.zero;
dir = vDelta;
//hits = new RaycastHit[5];
countHits = Physics.BoxCastNonAlloc(vStart, vExt, dir.normalized, hits, Quaternion.identity, vDelta.magnitude, BrushMask);
if (countHits > 0)
for(int i = 0; i < countHits; i++)
{
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
pEnvTrc.fFraction = (hits[0].distance) / vDelta.magnitude;
pEnvTrc.vHitNormal = EC_Utility.ToA3DVECTOR3(hits[0].normal);
pEnvTrc.dwClsFlag = CDR_EVN.CDR_BRUSH;
if (hits[i].distance > 0f)
{
float fFraction = (hits[i].distance) / vDelta.magnitude;
if(fFraction < fFractionBrush)
{
fFractionBrush = fFraction;
v3Normal = hits[i].normal;
}
}
}
pEnvTrc.fFraction = fFractionBrush;
pEnvTrc.vHitNormal = EC_Utility.ToA3DVECTOR3(v3Normal);
pEnvTrc.dwClsFlag = CDR_EVN.CDR_BRUSH;
}
if ((pEnvTrc.dwCheckFlag & CDR_EVN.CDR_TERRAIN) == CDR_EVN.CDR_TERRAIN)
{
float fFractionTerrain = 100f;
@@ -149,7 +154,7 @@ namespace BrewMonster
vTerStart.y = fHitsTerrain[0].point.y;
}
}
fHitsTerrain = new RaycastHit[5];
countHits = Physics.RaycastNonAlloc(vTerStart, dir.normalized, fHitsTerrain, vDelta.magnitude, TerrainMask);
if ((countHits > 0 && Vector3.Distance(vTerStart, fHitsTerrain[0].point) > 0.0009f))
{
@@ -184,13 +189,13 @@ namespace BrewMonster
else
{
float h0 = 0f;
int countHits0 = Physics.RaycastNonAlloc(vWatStart + Vector3.up * 500f, Vector3.down, fHitsWater, 1000f, WaterMask);
int countHits0 = Physics.RaycastNonAlloc(vWatStart + Vector3.up * 500f, Vector3.down, fHitsWater, maxDistance: 1000f, WaterMask);
if (countHits0 > 0)
{
h0 = fHitsWater[0].point.y;
}
float h1 = 0f;
countHits0 = Physics.RaycastNonAlloc((vWatStart + vDelta) + Vector3.up * 500f, Vector3.down, fHitsWater, 1000f, WaterMask);
countHits0 = Physics.RaycastNonAlloc((vWatStart + vDelta) + Vector3.up * 500f, Vector3.down, fHitsWater, maxDistance: 1000f, WaterMask);
if(countHits0 > 0)
{
h1 = fHitsWater[0].point.y;
@@ -241,8 +246,21 @@ namespace BrewMonster
int countHits = Physics.RaycastNonAlloc(origin, Vector3.down, hits, dist, mask);
if (countHits > 0)
{
vHitNormal = hits[0].normal;
vEnd = new Vector3(vStart.x, hits[0].point.y + vExt.y, vStart.z);
float minDistance = 100f;
int idx = 0;
for (int i = 0; i < countHits; i++)
{
if (hits[i].collider != null && hits[i].distance > 0f)
{
if(hits[i].distance < minDistance)
{
minDistance = hits[i].distance;
idx = i;
}
}
}
vHitNormal = hits[idx].normal;
vEnd = new Vector3(vStart.x, hits[idx].point.y + vExt.y, vStart.z);
bSupport = (vHitNormal.y >= 0f);
return true;
}
@@ -521,6 +539,7 @@ namespace BrewMonster
while (nTry < MAX_TRY)
{
//hits = new RaycastHit[5];
vDelta = vVelocity * fTime;
vFinalPos = vStart;
float fDeltaDist = vDelta.Magnitude();
@@ -564,13 +583,25 @@ namespace BrewMonster
env_trace_t tmpInfo = new env_trace_t();
tmpInfo.vStart = vStart;
tmpInfo.vDelta = new A3DVECTOR3(0.0f, CDRInfo.fStepHeight, 0.0f);
tmpInfo.vExt = vExt;
tmpInfo.vExt = new A3DVECTOR3(vExt.x, 0.01f, vExt.z);
//@note : need check terrain?? By Kuiwu[8/10/2005]
tmpInfo.dwCheckFlag = CDR_EVN.CDR_BRUSH | CDR_EVN.CDR_TERRAIN;
tmpInfo.vTerStart = vStart;
tmpInfo.vTerStart.y -= vExt.y;
//bPull = !CollideWithEnv(ref tmpInfo);
bPull = !CheckFootStepUp(tmpInfo);
bPull = !CollideWithEnv(ref tmpInfo);
//int count1 = Physics.RaycastNonAlloc(EC_Utility.ToVector3(tmpInfo.vStart), EC_Utility.ToVector3(tmpInfo.vDelta).normalized, hits, EC_Utility.ToVector3(tmpInfo.vDelta).magnitude, BrushMask | TerrainMask);
//bPull = !(count1 < 0);
//if(count1 > 0)
//{
// Debug.DrawLine(EC_Utility.ToVector3(tmpInfo.vStart), hits[0].point, Color.yellow, 10f);
//}
//if(bPull == false)
//{
// BoxCastDrawer.Draw(EC_Utility.ToVector3(tmpInfo.vStart), EC_Utility.ToVector3(tmpInfo.vExt), EC_Utility.ToVector3(tmpInfo.vDelta).normalized,
// Quaternion.identity, EC_Utility.ToVector3(tmpInfo.vDelta).magnitude, hits, 1, nTry == 0 ? Color.red : Color.green, 10f);
//}
if (bPull)
{
vStart.y += CDRInfo.fStepHeight;
@@ -585,8 +616,8 @@ namespace BrewMonster
{
vDelta *= tmpInfo.fFraction;
}
if (vDelta.SquaredMagnitude() < vExt.x * vExt.x * 4)
float value = vDelta.SquaredMagnitude();
if (value < (vExt.x * vExt.x * 4))
{
vStart.y -= CDRInfo.fStepHeight;
bPull = false;
@@ -661,7 +692,7 @@ namespace BrewMonster
groundTrc.fDeltaY = 0.0f;
}
if (!RetrieveSupportPlane(ref groundTrc))
if (!RetrieveSupportPlane(ref groundTrc, true))
{//@note : do NOT change position. By Kuiwu[14/9/2005]
CDRInfo.fMoveDist = 0.0f;
// if (groundTrc.bSupport)
@@ -692,6 +723,27 @@ namespace BrewMonster
CDRInfo.vTPNormal = vTPNormal;
}
private static bool CheckFootStepUp(env_trace_t pEnvTrc)
{
Vector3 vExt = EC_Utility.ToVector3(pEnvTrc.vExt);
Vector3 vStart = EC_Utility.ToVector3(pEnvTrc.vStart);
Vector3 vDelta = EC_Utility.ToVector3(pEnvTrc.vDelta);
Vector3 dir = vDelta;
int countHits = 0;
countHits = Physics.BoxCastNonAlloc(vStart, vExt, dir.normalized, hits, Quaternion.identity, vDelta.magnitude, BrushMask);
if (countHits > 0)
{
for(int i = 0; i < countHits; i++)
{
if (hits[i].collider != null && hits[i].point.y > (vStart.y + vExt.y))
{
return true;
}
}
}
return false;
}
//@desc : used to retrieve support plane (ground or brush), By Kuiwu[12/9/2005]
public struct ground_trace_t
{
@@ -704,7 +756,7 @@ namespace BrewMonster
public bool bSupport; //false if ground missed
};
public static bool RetrieveSupportPlane(ref ground_trace_t pTrc)
public static bool RetrieveSupportPlane(ref ground_trace_t pTrc, bool check = false)
{
A3DVECTOR3 vTerrainPos = new A3DVECTOR3(), vTerrainNormal = new A3DVECTOR3();
@@ -715,7 +767,7 @@ namespace BrewMonster
BrushTraceInfo trcInfo = new BrushTraceInfo();
trcInfo.Init(pTrc.vStart, new A3DVECTOR3(0.0f, -pTrc.fDeltaY, 0.0f), pTrc.vExt);
Vector3 hitPoint = new Vector3();
if (AABBCollideWithBrush(ref trcInfo, ref hitPoint))
if (AABBCollideWithBrush(ref trcInfo, ref hitPoint, check))
{
if (trcInfo.bStartSolid)
{
@@ -752,7 +804,7 @@ namespace BrewMonster
trcInfo.Init(pTrc.vStart, vDelta, pTrc.vExt);
pTrc.vHitNormal = vTerrainNormal;
pTrc.bSupport = true;
return !AABBCollideWithBrush(ref trcInfo);
return !AABBCollideWithBrush(ref trcInfo, ref hitPoint, check);
}
return true;
@@ -763,21 +815,28 @@ namespace BrewMonster
{
vPosOnSurface = vPos;
int countHits = 0;
countHits = Physics.RaycastNonAlloc(EC_Utility.ToVector3(vPosOnSurface), Vector3.down, fHitsTerrain,maxDistance: 1000f, TerrainMask);
countHits = Physics.RaycastNonAlloc(EC_Utility.ToVector3(vPosOnSurface), Vector3.down, fHitsTerrain, maxDistance: 1000f, TerrainMask);
if (countHits > 0)
{
System.Array.Sort(fHitsTerrain, 0, fHitsTerrain.Length, raycastHitDistanceComparer);
for(int i = 0; i < fHitsTerrain.Length; i++)
int idx = 0;
float maxDistance = 100f;
//System.Array.Sort(fHitsTerrain, 0, fHitsTerrain.Length, raycastHitDistanceComparer);
for (int i = 0; i < countHits; i++)
{
if (fHitsTerrain[i].distance > 0.0009f)
if (fHitsTerrain[i].collider != null && fHitsTerrain[i].distance > 0f)
{
vPosOnSurface.y = fHitsTerrain[i].point.y;
vNormal = EC_Utility.ToA3DVECTOR3(fHitsTerrain[i].normal);
if(fHitsTerrain[i].distance < maxDistance)
{
maxDistance = fHitsTerrain[i].distance;
idx = i;
}
}
}
vPosOnSurface.y = fHitsTerrain[idx].point.y;
vNormal = EC_Utility.ToA3DVECTOR3(fHitsTerrain[idx].normal);
return;
}
}
}
}
// Get normalize
static float Normalize(A3DVECTOR3 vIn, ref A3DVECTOR3 vOut)
@@ -977,70 +1036,82 @@ namespace BrewMonster
Vector3 vDelta = EC_Utility.ToVector3(brushTraceInfo.vDelta);
Vector3 dir = vDelta;
int countHits = 0;
float num = 10f;
//Quaternion quaternion = EC_Game.GetGameRun().GetWorld().GetPlayerMan().GetHostPlayer().transform.rotation;
Vector3[] arrVExt = new Vector3[5] {
vExt
,new Vector3(vExt.x / num, vExt.y, vExt.z),
new Vector3(vExt.x, vExt.y / num, vExt.z),
new Vector3(vExt.x, vExt.y, vExt.z / num),
vExt / num
};
for (int i = 0; i < arrVExt.Length; i++)
float fFraction = 100f;
Vector3 normal = Vector3.zero;
Vector3 hitP = Vector3.zero;
countHits = Physics.BoxCastNonAlloc(vStart, vExt, dir.normalized, hits, Quaternion.identity, vDelta.magnitude, BrushMask);
for (int i = 0; i < countHits; i++)
{
countHits = Physics.BoxCastNonAlloc(vStart, arrVExt[i], dir.normalized, hits, Quaternion.identity, vDelta.magnitude, BrushMask);
if (countHits > 0)
if (hits[i].collider != null && hits[i].distance > 0f)
{
if(hits[0].distance > 0.0009f)
float value = (hits[i].distance) / vDelta.magnitude;
if (value < fFraction)
{
brushTraceInfo.fFraction = (hits[0].distance) / vDelta.magnitude;
brushTraceInfo.normal = EC_Utility.ToA3DVECTOR3(hits[0].normal);
fFraction = value;
normal = hits[i].normal;
hitP = hits[i].point;
}
}
}
if (fFraction < 100f)
{
if (fFraction > 0f && fFraction <= 1f)
{
brushTraceInfo.fFraction = fFraction;
brushTraceInfo.normal = EC_Utility.ToA3DVECTOR3(normal);
}
if (Math.Abs(fFraction - 0f) < float.Epsilon)
{
brushTraceInfo.bStartSolid = true;
}
return true;
}
}
}
brushTraceInfo.normal = new A3DVECTOR3(0f);
brushTraceInfo.fFraction = 100f;
return false;
}
public static bool AABBCollideWithBrush(ref BrushTraceInfo brushTraceInfo, ref Vector3 hitPoint)
public static bool AABBCollideWithBrush(ref BrushTraceInfo brushTraceInfo, ref Vector3 hitPoint, bool check)
{
Vector3 vExt = EC_Utility.ToVector3(brushTraceInfo.vExtents);
Vector3 vStart = EC_Utility.ToVector3(brushTraceInfo.vStart);
Vector3 vDelta = EC_Utility.ToVector3(brushTraceInfo.vDelta);
Vector3 dir = vDelta;
int countHits = 0;
float num = 10f;
//Quaternion quaternion = EC_Game.GetGameRun().GetWorld().GetPlayerMan().GetHostPlayer().transform.rotation;
Vector3[] arrVExt = new Vector3[5] {
vExt
,new Vector3(vExt.x / num, vExt.y, vExt.z),
new Vector3(vExt.x, vExt.y / num, vExt.z),
new Vector3(vExt.x, vExt.y, vExt.z / num),
vExt / num
};
for (int i = 0; i < arrVExt.Length; i++)
float fFraction = 100f;
Vector3 normal = Vector3.zero;
Vector3 hitP = Vector3.zero;
countHits = Physics.BoxCastNonAlloc(vStart, vExt, dir.normalized, hits, Quaternion.identity, vDelta.magnitude, BrushMask);
for (int i = 0; i < countHits; i++)
{
countHits = Physics.BoxCastNonAlloc(vStart, arrVExt[i], dir.normalized, hits, Quaternion.identity, vDelta.magnitude, BrushMask);
if (countHits > 0)
if (hits[i].collider != null && hits[i].distance > 0f)
{
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
if (Math.Abs(hits[0].distance - 0f) < float.Epsilon)
float value = (hits[i].distance) / vDelta.magnitude;
if(value < fFraction)
{
fFraction = value;
normal = hits[i].normal;
hitP = hits[i].point;
}
}
}
if(fFraction < 100f)
{
if(fFraction > 0f && fFraction <= 1f)
{
brushTraceInfo.fFraction = fFraction;
brushTraceInfo.normal = EC_Utility.ToA3DVECTOR3(normal);
hitPoint = hitP;
}
if (Math.Abs(fFraction - 0f) < float.Epsilon)
{
brushTraceInfo.bStartSolid = true;
}
else
{
brushTraceInfo.fFraction = (hits[0].distance) / vDelta.magnitude;
brushTraceInfo.normal = EC_Utility.ToA3DVECTOR3(hits[0].normal);
hitPoint = hits[0].point;
return true;
}
}
}
brushTraceInfo.normal = new A3DVECTOR3(0f);
brushTraceInfo.fFraction = 100f;
hitPoint = Vector3.zero;
return false;
}
@@ -1153,7 +1224,7 @@ namespace BrewMonster
awmInfo.bMeetHeightThresh = true;
float fHWater = 0f;
int countHits0 = Physics.RaycastNonAlloc(EC_Utility.ToVector3(vFinalPos) + Vector3.up * 500f, Vector3.down, fHitsWater, 1000f, 1 << 8);
int countHits0 = Physics.RaycastNonAlloc(EC_Utility.ToVector3(vFinalPos) + Vector3.up * 500f, Vector3.down, fHitsWater, maxDistance: 1000f, WaterMask);
if (countHits0 > 0)
{
fHWater = fHitsWater[0].point.y;
@@ -1265,7 +1336,7 @@ namespace BrewMonster
{//rescue from solid
//@note : it may cause some problems. By Kuiwu[11/10/2005]
float fHWater = 0f;
int countHits0 = Physics.RaycastNonAlloc(EC_Utility.ToVector3(vStart) + Vector3.up * 500f, Vector3.down, fHitsWater, 1000f, 1 << 8);
int countHits0 = Physics.RaycastNonAlloc(EC_Utility.ToVector3(vStart) + Vector3.up * 500f, Vector3.down, fHitsWater, maxDistance: 1000f, WaterMask);
if(countHits0 > 0)
{
fHWater = fHitsWater[0].point.y;
@@ -1318,7 +1389,7 @@ namespace BrewMonster
if (bAdjust && (vOverTp.y + awmInfo.fHeightThresh > vFinalPos.y))
{
float fHWater = 0f;
int countHits = Physics.RaycastNonAlloc(EC_Utility.ToVector3(vFinalPos), Vector3.down, fHitsWater, 1000f, 1 << 8);
int countHits = Physics.RaycastNonAlloc(EC_Utility.ToVector3(vFinalPos), Vector3.down, fHitsWater, maxDistance: 1000f, WaterMask);
if (countHits > 0)
{
fHWater = fHitsWater[0].point.y;
@@ -1423,9 +1494,11 @@ namespace BrewMonster
return true;
}
static float DotProduct(A3DVECTOR3 v1, A3DVECTOR3 v2) { return v1.x* v2.x + v1.y* v2.y + v1.z* v2.z;
static float DotProduct(A3DVECTOR3 v1, A3DVECTOR3 v2) { return v1.x* v2.x + v1.y* v2.y + v1.z* v2.z;}
}
}
public struct OtherPlayer_Move_Info
{
// Bounding sphere of avator
@@ -1489,4 +1562,113 @@ namespace BrewMonster
// still be satisfied, bMeetHeightThresh is set to true.
public bool bMeetHeightThresh;
};
public static class BoxCastDrawer
{
/// <summary>
/// Vẽ BoxCast để Debug
/// </summary>
/// <param name="duration">Thời gian tồn tại của đường kẻ (giây). Mặc định là 0 (1 frame)</param>
public static void Draw(
Vector3 center,
Vector3 halfExtents,
Vector3 direction,
Quaternion orientation,
float distance,
RaycastHit[] hits,
int hitCount,
Color color,
float duration = 0f) // Thêm tham số duration ở đây
{
// 1. Tính toán các góc
Vector3[] startCorners = GetBoxCorners(center, halfExtents, orientation);
float drawDistance = distance;
if (hitCount > 0)
{
float minDistance = distance;
for (int i = 0; i < hitCount; i++)
{
if (hits[i].distance < minDistance && hits[i].distance > 0)
minDistance = hits[i].distance;
}
drawDistance = minDistance;
}
Vector3 endCenter = center + direction.normalized * drawDistance;
Vector3[] endCorners = GetBoxCorners(endCenter, halfExtents, orientation);
// 2. Thiết lập màu sắc
//Color color = hitCount > 0 ? Color.red : Color.green;
//Color sweepColor = new Color(0.5f, 0.5f, 0.5f, 0.5f); // Màu xám mờ
Color sweepColor = color; // Màu xám mờ
// 3. VẼ TÂM (CENTER) - Hiển thị trục tọa độ Local của hộp
DrawCenterAxis(center, orientation, 0.3f, duration); // Tâm bắt đầu
DrawCenterAxis(endCenter, orientation, 0.3f, duration); // Tâm kết thúc
// 3. Vẽ các đường Line với Duration
for (int i = 0; i < 4; i++)
{
// Vẽ hộp bắt đầu
Debug.DrawLine(startCorners[i], startCorners[(i + 1) % 4], color, duration);
Debug.DrawLine(startCorners[i + 4], startCorners[((i + 1) % 4) + 4], color, duration);
Debug.DrawLine(startCorners[i], startCorners[i + 4], color, duration);
// Vẽ hộp kết thúc/va chạm
Debug.DrawLine(endCorners[i], endCorners[(i + 1) % 4], color, duration);
Debug.DrawLine(endCorners[i + 4], endCorners[((i + 1) % 4) + 4], color, duration);
Debug.DrawLine(endCorners[i], endCorners[i + 4], color, duration);
// Vẽ các đường nối (Sweep lines)
Debug.DrawLine(startCorners[i], endCorners[i], sweepColor, duration);
Debug.DrawLine(startCorners[i + 4], endCorners[i + 4], sweepColor, duration);
}
// 4. Vẽ chi tiết va chạm
for (int i = 0; i < hitCount; i++)
{
// Vẽ pháp tuyến (Normal) tại điểm chạm
Debug.DrawRay(hits[i].point, hits[i].normal * 0.5f, Color.yellow, duration);
// Vẽ một dấu X nhỏ tại điểm va chạm chính xác
DrawCross(hits[i].point, 0.1f, Color.cyan, duration);
}
}
private static void DrawCross(Vector3 point, float size, Color color, float duration)
{
Debug.DrawLine(point + Vector3.up * size, point - Vector3.up * size, color, duration);
Debug.DrawLine(point + Vector3.right * size, point - Vector3.right * size, color, duration);
Debug.DrawLine(point + Vector3.forward * size, point - Vector3.forward * size, color, duration);
}
private static Vector3[] GetBoxCorners(Vector3 center, Vector3 halfExtents, Quaternion orientation)
{
Vector3[] corners = new Vector3[8];
Vector3 h = halfExtents;
corners[0] = center + orientation * new Vector3(-h.x, -h.y, h.z);
corners[1] = center + orientation * new Vector3(h.x, -h.y, h.z);
corners[2] = center + orientation * new Vector3(h.x, h.y, h.z);
corners[3] = center + orientation * new Vector3(-h.x, h.y, h.z);
corners[4] = center + orientation * new Vector3(-h.x, -h.y, -h.z);
corners[5] = center + orientation * new Vector3(h.x, -h.y, -h.z);
corners[6] = center + orientation * new Vector3(h.x, h.y, -h.z);
corners[7] = center + orientation * new Vector3(-h.x, h.y, -h.z);
return corners;
}
public static void DrawCenterAxis(Vector3 pos, Quaternion rot, float size, float duration)
{
Debug.DrawRay(pos, rot * Vector3.right * size, Color.red, duration);
Debug.DrawRay(pos, rot * Vector3.up * size, Color.green, duration);
Debug.DrawRay(pos, rot * Vector3.forward * size, Color.blue, duration);
// Vẽ thêm một khối diamond nhỏ màu trắng tại tâm để dễ nhận diện
float s = size * 0.2f;
Debug.DrawLine(pos + rot * Vector3.up * s, pos + rot * Vector3.right * s, Color.white, duration);
Debug.DrawLine(pos + rot * Vector3.right * s, pos - rot * Vector3.up * s, Color.white, duration);
Debug.DrawLine(pos - rot * Vector3.up * s, pos - rot * Vector3.left * s, Color.white, duration);
Debug.DrawLine(pos - rot * Vector3.left * s, pos + rot * Vector3.up * s, Color.white, duration);
}
}
}
@@ -115,7 +115,6 @@ namespace BrewMonster
public bool PlaySkillAttackActionWithName(int idSkill, string szActName, bool bNoFX = false, CECAttackEvent attackEvent = null, uint dwFlagMode = 0)
{
BMLogger.LogError("HoangDev PlaySkillAttackActionWithName:"+szActName);
bool? pActFlag = null;
if (m_actionPlayPolicy != null
&& m_actionPlayPolicy.PlaySkillAttackActionWithName(idSkill, szActName, bNoFX, attackEvent, dwFlagMode))
@@ -98,6 +98,7 @@ namespace BrewMonster.Scripts.Skills
public CECHostSkillModel()
{
m_allProfSkills = new Dictionary<int, ElementSkill>();
m_skillLearnNPCNID = 0;
m_bReceivedNPCGreeting = false;
m_bInitialized = false;
@@ -146,9 +147,19 @@ namespace BrewMonster.Scripts.Skills
return enumEvilGod.SKILL_BASE;
}
}
static CECHostPlayer TryGetHostPlayer() => CECGameRun.Instance?.GetHostPlayer();
public enumSkillLearnedState GetSkillLearnedState(int skillID)
{
CECSkill pSkill = CECGameRun.Instance.GetHostPlayer().GetNormalSkill(skillID);
CECHostPlayer host = TryGetHostPlayer();
if (host == null)
{
return ElementSkill.IsOverridden((uint)skillID)
? enumSkillLearnedState.SKILL_OVERRIDDEN
: enumSkillLearnedState.SKILL_NOT_LEARNED;
}
CECSkill pSkill = host.GetNormalSkill(skillID);
if (pSkill != null)
{
if (pSkill.GetSkillLevel() < pSkill.GetMaxLevel())
@@ -309,9 +320,15 @@ namespace BrewMonster.Scripts.Skills
BMLogger.LogError("skillID not exist in m_allProfSkills");
return default;
}
int maxLevel = CECGameRun.Instance.GetHostPlayer().GetMaxLevelSofar();
int rank = CECGameRun.Instance.GetHostPlayer().GetBasicProps().iLevel2;
int realmLevel = CECGameRun.Instance.GetHostPlayer().GetRealmLevel();
CECHostPlayer host = TryGetHostPlayer();
if (host == null)
{
return enumSkillFitLevelState.SKILL_NOT_FIT_LEVEL;
}
int maxLevel = host.GetMaxLevelSofar();
int rank = host.GetBasicProps().iLevel2;
int realmLevel = host.GetRealmLevel();
return GetSkillFitLevel(skillID, maxLevel, rank, realmLevel);
}
@@ -324,7 +341,7 @@ namespace BrewMonster.Scripts.Skills
}
int skillLevel = 1; //½«ÒªÑ§Ï°µÄ¼¼Äܼ¶±ð
CECSkill pSkill = CECGameRun.Instance.GetHostPlayer().GetNormalSkill(skillID);
CECSkill pSkill = TryGetHostPlayer()?.GetNormalSkill(skillID);
if (pSkill != null)
{
skillLevel = pSkill.GetSkillLevel() + 1;
@@ -359,7 +376,8 @@ namespace BrewMonster.Scripts.Skills
}
public int CheckLearnCondition(int skillID)
{
return CECGameRun.Instance.GetHostPlayer().CheckSkillLearnCondition(skillID, true);
CECHostPlayer host = TryGetHostPlayer();
return host != null ? host.CheckSkillLearnCondition(skillID, true) : 0;
}
public StringBuilder GetSkillDescription(int skillID, int level)
{
@@ -396,16 +414,14 @@ namespace BrewMonster.Scripts.Skills
return 0;
}
CECSkill pSkill = CECGameRun.Instance.GetHostPlayer().GetNormalSkill(skillID);
CECSkill pSkill = TryGetHostPlayer()?.GetNormalSkill(skillID);
if (pSkill != null)
{
return pSkill.GetSkillLevel();
}
else
{
return 0;
}
}
private void InitializeRootOfSkillTree(int rootSkillID)
{
var skillRootMap = GetSkillRootMap(rootSkillID);
@@ -520,7 +536,8 @@ namespace BrewMonster.Scripts.Skills
}
if (pSkill.GetCls() == CECGameRun.Instance.GetHostPlayer().GetProfession())
CECHostPlayer host = TryGetHostPlayer();
if (host != null && pSkill.GetCls() == host.GetProfession())
{
// NPCǰְҵܣҪ¼NPCID
profCorrect = true;
@@ -574,14 +591,16 @@ namespace BrewMonster.Scripts.Skills
}
}
var hostPlayer = TryGetHostPlayer();
int playerProfession = professionOverride ?? (hostPlayer != null ? hostPlayer.GetProfession() : -1);
// --- B2: Duyệt tất cả skill, lọc skill theo class hiện tại của người chơi ---
uint curID = 0;
while ((curID = ElementSkill.NextSkill(curID)) != 0)
{
ElementSkill pSkill = ElementSkill.Create(curID, 1);
int cls = pSkill.GetCls();
int playerCls = professionOverride ??
CECGameRun.Instance.GetHostPlayer().GetProfession();
int playerCls = playerProfession;
bool isSameClass = (cls == playerCls || cls == 255);
bool isProvidedByNPC = npcSkills.Contains(curID);
@@ -650,7 +669,8 @@ namespace BrewMonster.Scripts.Skills
}
public bool CheckPreItem(int itemID)
{
return CECGameRun.Instance.GetHostPlayer().GetPack().FindItem(itemID) != -1;
CECHostPlayer host = TryGetHostPlayer();
return host != null && host.GetPack().FindItem(itemID) != -1;
}
public bool IsSkillServedByNPC(int skillID)
{
@@ -283,9 +283,6 @@ namespace BrewMonster.UI
{
try
{
// Wait for GameContentBootstrap gate + URL rewrite, then single shared init.
AddressablesInitService.EnsureInitializedBlocking();
// Load using Addressables directly with WaitForCompletion (Unity-safe, won't deadlock)
// This matches the pattern used in EC_Game.cs
var handle = Addressables.LoadAssetAsync<TextAsset>(key);
@@ -1,6 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using BrewMonster;
using BrewMonster.Scripts.Skills;
using TMPro;
@@ -26,9 +26,9 @@ namespace BrewMonster.UI
[Header("State")]
[SerializeField] private bool m_isEvil;
private readonly Dictionary<int, AUISubDialog> m_rankSubDialogs = new();
private readonly List<CDlgSkillSubListItem> m_skillSubDialogs = new();
private readonly Dictionary<int, CDlgSkillSubListItem> m_skillSubDialogsMap = new();
private Dictionary<int, AUISubDialog> m_rankSubDialogs ;
private List<CDlgSkillSubListItem> m_skillSubDialogs ;
private Dictionary<int, CDlgSkillSubListItem> m_skillSubDialogsMap ;
private int m_skillSubCount; // 当前显示的技能数量 / Current shown skill count
private float m_curBottom; // 当前底部位置 / Current bottom position
@@ -40,6 +40,7 @@ namespace BrewMonster.UI
private bool m_bAllocRankDlgs; // 是否已创建阶位子对话 / Whether rank sub dialogs are allocated
private int m_selectedSkillId;
private Coroutine m_resetDialogCoroutine;
private void Awake()
{
@@ -47,6 +48,9 @@ namespace BrewMonster.UI
{
m_contentRoot = transform as RectTransform;
}
m_skillSubDialogsMap = new Dictionary<int, CDlgSkillSubListItem>();
m_skillSubDialogs = new List<CDlgSkillSubListItem>();
m_rankSubDialogs = new Dictionary<int, AUISubDialog>();
EventBus.Subscribe<CECSkillPanelChange>(OnModelChange);
CacheTemplateInfo();
HideTemplates();
@@ -61,7 +65,11 @@ namespace BrewMonster.UI
private void OnShowDialog()
{
InitRankDlgs();
ResetDialog();
if (m_resetDialogCoroutine != null)
{
StopCoroutine(m_resetDialogCoroutine);
}
m_resetDialogCoroutine = StartCoroutine(ResetDialogWhenReady());
// 保留原始隐藏新图标逻辑 / Keep original "hide new" logic (pending port)
// GetGameUIMan()->m_pDlgSystem->ShowNewImg(false);
@@ -70,6 +78,30 @@ namespace BrewMonster.UI
// GetGameUIMan()->m_pDlgSystem5b->ShowNewImg(false);
}
private IEnumerator ResetDialogWhenReady()
{
const float timeoutSecs = 15f;
float elapsed = 0f;
while (GetHostPlayer() == null && elapsed < timeoutSecs)
{
elapsed += Time.unscaledDeltaTime;
yield return null;
}
if (GetHostPlayer() == null)
{
yield break;
}
if (CECUIManager.Instance?.GetInGameUIMan() == null)
{
yield break;
}
ResetDialog();
m_resetDialogCoroutine = null;
}
// 初始化模板尺寸 / Cache template sizing info
private void CacheTemplateInfo()
{
@@ -145,6 +177,7 @@ namespace BrewMonster.UI
// Իв / Reset dialog with all rank/skill sub dialogs
public void ResetDialog()
{
m_skillSubDialogs.RemoveAll(item => item == null);
m_skillSubDialogsMap.Clear();
m_skillSubCount = 0;
m_curBottom = m_originBottom;
@@ -159,8 +192,6 @@ namespace BrewMonster.UI
skill.Show(false);
}
IReadOnlyDictionary<int, List<int>> allRankProfSkills = CECHostSkillModel.Instance?.GetAllRankProfSkills();
for (CECTaoistRank taoistRank = CECTaoistRank.GetBaseRankBegin();
taoistRank != CECTaoistRank.GetBaseRankEnd();
taoistRank = taoistRank.GetNext())
@@ -213,17 +244,17 @@ namespace BrewMonster.UI
// ޸ijһ״̬ / Refresh a single skill sub dialog
private void UpdateOneSubDlg(int skillID)
{
//BMLogger.LogError("UpdateOneSubDlg");
if (!m_skillSubDialogsMap.TryGetValue(skillID, out var pSub))
{
return;
}
CDlgSkillSubListItem subListItem = pSub;
if(subListItem == null )
if (subListItem == null)
{
return;
}
subListItem.UpdateSkill(skillID);
subListItem.Show(true);
if (GetSelectedSkillID() == skillID)
@@ -256,20 +287,54 @@ namespace BrewMonster.UI
return;
}
if (m_skillSubCount >= m_skillSubDialogs.Count)
CDlgSkillSubListItem curSubSkill = AcquireSkillSubDialog(skillID, rankID);
if (curSubSkill == null)
{
CDlgSkillSubListItem pSubSkill = Instantiate(m_pSubSkill, m_rankSubDialogs[rankID].transform);
m_skillSubDialogs.Add(pSubSkill);
return;
}
CDlgSkillSubListItem curSubSkill = m_skillSubDialogs[m_skillSubCount];
curSubSkill?.SetHighlight(false);
curSubSkill.SetHighlight(false);
m_skillSubDialogsMap[skillID] = curSubSkill;
m_skillSubCount++;
UpdateOneSubDlg(skillID);
}
private CDlgSkillSubListItem AcquireSkillSubDialog(int skillID, int rankID)
{
while (m_skillSubCount < m_skillSubDialogs.Count)
{
CDlgSkillSubListItem pooled = m_skillSubDialogs[m_skillSubCount];
if (pooled != null)
{
return pooled;
}
m_skillSubDialogs.RemoveAt(m_skillSubCount);
}
if (!m_rankSubDialogs.TryGetValue(rankID, out AUISubDialog rankSub) || rankSub == null)
{
if (!m_bAllocRankDlgs)
{
InitRankDlgs();
}
if (!m_rankSubDialogs.TryGetValue(rankID, out rankSub) || rankSub == null)
{
return null;
}
}
CDlgSkillSubListItem created = Instantiate(m_pSubSkill, rankSub.transform);
if (created == null)
{
return null;
}
m_skillSubDialogs.Add(created);
return created;
}
// ijһӦмԻ / Add dialogs for one rank
private void AddDlgsOfOneRank(CECTaoistRank taoistRank)
{
@@ -291,7 +356,6 @@ namespace BrewMonster.UI
return;
}
if (!allRankProfSkills.TryGetValue(rankID, out var rankItr) || rankItr == null || rankItr.Count == 0)
{
return;
@@ -302,7 +366,6 @@ namespace BrewMonster.UI
{
if (ElementSkill.IsOverridden((uint)skillID))
{
BMLogger.LogError("HoangDev: AddDlgsOfOneRank ElementSkill.IsOverridden for skillID " + skillID);
continue;
}
/* bool bOnlyShowSkillCanLearn = GetGameUIMan()->m_pDlgSkillAction->IsOnlyShowSkillCanLearn();
@@ -323,7 +386,6 @@ namespace BrewMonster.UI
}
if (rankSkills.Count == 0)
{
BMLogger.LogError("HoangDev: AddDlgsOfOneRank rankSkills.Count == 0");
return;
}
@@ -364,11 +426,15 @@ namespace BrewMonster.UI
Destroy(kv.Value.gameObject);
}
m_rankSubDialogs.Clear();
m_bAllocRankDlgs = false;
foreach (var dlg in m_skillSubDialogs)
{
if (dlg != null)
{
Destroy(dlg.gameObject);
}
}
m_skillSubDialogs.Clear();
m_skillSubDialogsMap.Clear();
@@ -384,8 +450,7 @@ namespace BrewMonster.UI
if (isActiveAndEnabled)
{
InitRankDlgs();
FitSize();
ShowLastSelectedSkill();
ResetDialog();
}
}
@@ -167,31 +167,34 @@ namespace BrewMonster
public void UpdateSkill(int skillID)
{
if (m_skillIconImgPic == null || m_skillNameLbl == null || skillLevel == null)
{
return;
}
var uiMan = CECUIManager.Instance?.GetInGameUIMan();
if (uiMan == null)
{
return;
}
if (GetHostPlayer() == null)
{
return;
}
CECHostSkillModel model = CECHostSkillModel.Instance;
m_skillID = skillID;
m_curLevel = model.GetSkillCurrentLevel(m_skillID);
enumSkillLearnedState learnedState = model.GetSkillLearnedState(m_skillID);
var spriteName = model.GetSkillIcon(skillID);
var slot = CECUIManager.Instance.GetInGameUIMan().SetCover(m_skillIconImgPic, spriteName, EC_GAMEUI_ICONS.ICONS_SKILL);
var slot = uiMan.SetCover(m_skillIconImgPic, spriteName, EC_GAMEUI_ICONS.ICONS_SKILL);
if (slot is AUIImagePicture picture)
{
picture.SetSkillId(skillID);
}
/* var sprites = Resources.LoadAll<Sprite>("iconlist_skill_multisprite");
if (sprites == null || sprites.Length == 0)
return;
for (int i = 0; i < sprites.Length; i++)
{
if (sprites[i].name == spriteName)
{
skillIcon.sprite = sprites[i];
break;
}
}*/
StringBuilder skillDsc;
int reqLevel;
int reqRealmLevel;
@@ -209,37 +212,31 @@ namespace BrewMonster
reqLevel = ElementSkill.GetRequiredLevel((uint)m_skillID, m_curLevel);
reqRealmLevel = ElementSkill.GetRequiredRealmLevel((uint)m_skillID, m_curLevel);
}
if (skillDsc == null)
{
return;
}
if (reqLevel == 0)
{
reqLevel = 1;
}
skillDsc.AppendLine(GPDataTypeHelper.ReplacePercentD(GetStringFromTable(11328), reqLevel));
skillDsc.AppendLine(GPDataTypeHelper.ReplacePercentD(GetTableString(uiMan, 11328), reqLevel));
if (reqRealmLevel != 0)
{
skillDsc.AppendLine(GetStringFromTable(11401));
skillDsc.AppendLine(GetGameUIMan().GetRealmName(reqRealmLevel));
skillDsc.AppendLine(GetTableString(uiMan, 11401));
skillDsc.AppendLine(uiMan.GetRealmName(reqRealmLevel));
}
var str = EC_Utility.FormatForTextMeshPro(skillDsc.ToString());
// Store hint for tooltip display when clicking skill icon
m_skillIconImgPic.SetHint(str);
string skillName = model.GetSkillName(m_skillID);
/* if (model.IsPassiveSkill(m_skillID))
{
skillName += ACString(GetStringFromTable(11322));
}*/
if (m_skillNameLbl == null)
{
BMLogger.LogError("HoangDev: CDlgSkillSubListItem m_skillNameLbl is null for skillID " + skillID);
}
else
{
this.name = "Item_"+m_skillID;
}
m_skillNameLbl.text = skillName;
name = "Item_" + m_skillID;
m_skillNameLbl.text = skillName ?? string.Empty;
UpdateUpgradeBtn();
UpdateUpgradeBtn(uiMan);
if (enumSkillLearnedState.SKILL_NOT_LEARNED == learnedState)
{
@@ -248,12 +245,28 @@ namespace BrewMonster
else
{
skillLevel.gameObject.SetActive(true);
skillLevel.text = GetStringFromTable(11323).Replace("%d", m_curLevel.ToString());
skillLevel.text = GetTableString(uiMan, 11323).Replace("%d", m_curLevel.ToString());
}
}
private void UpdateUpgradeBtn()
static string GetTableString(CECGameUIMan uiMan, int id)
{
if (uiMan == null)
{
return string.Empty;
}
return uiMan.GetStringFromAuiDialogTable(id) ?? uiMan.GetStringFromTable(id) ?? string.Empty;
}
private void UpdateUpgradeBtn(CECGameUIMan uiMan = null)
{
uiMan ??= CECUIManager.Instance?.GetInGameUIMan();
if (m_upgradeBtn == null)
{
return;
}
CECHostSkillModel model = CECHostSkillModel.Instance;
enumSkillFitLevelState fitLevel = model.GetSkillFitLevel(m_skillID);
enumSkillLearnedState learnedState = model.GetSkillLearnedState(m_skillID);
@@ -264,14 +277,20 @@ namespace BrewMonster
(requiredItem == 0 || model.CheckPreItem(requiredItem)))
{
m_upgradeBtn.gameObject.SetActive(true);
string str;
if (model.IsSkillServedByNPC(m_skillID))
{
int needSp = model.GetSkillSp(m_skillID, m_curLevel + 1);
int needMoney = model.GetSkillMoney(m_skillID, m_curLevel + 1);
int curSp = GetHostPlayer().GetBasicProps().iSP;
uint curMoney = GetHostPlayer().GetMoneyAmount();
CECHostPlayer host = GetHostPlayer();
if (host == null)
{
m_upgradeBtn.gameObject.SetActive(false);
return;
}
int curSp = host.GetBasicProps().iSP;
uint curMoney = host.GetMoneyAmount();
bool spOK = curSp >= needSp;
bool moneyOK = curMoney >= needMoney;
@@ -289,7 +308,7 @@ namespace BrewMonster
}
}
}
//if (m_skillID == 234)
if (spOK && moneyOK && preSkillOK)
{
m_upgradeDisabledReason = null;
@@ -300,25 +319,27 @@ namespace BrewMonster
if (!spOK)
{
string strSp = GPDataTypeHelper.ReplacePercentD(GetStringFromTable(11402), needSp);
string strSp = GPDataTypeHelper.ReplacePercentD(GetTableString(uiMan, 11402), needSp);
sb.AppendLine(l_colorRed + strSp + l_colorClose);
}
if (!moneyOK)
{
string strMoney = GPDataTypeHelper.ReplacePercentD(GetStringFromTable(11403), needMoney);
string strMoney = GPDataTypeHelper.ReplacePercentD(GetTableString(uiMan, 11403), needMoney);
sb.AppendLine(l_colorRed + strMoney + l_colorClose);
}
if (!preSkillOK)
sb.AppendLine(GetStringFromTable(11404));
{
sb.AppendLine(GetTableString(uiMan, 11404));
}
m_upgradeDisabledReason = sb.ToString().TrimEnd();
}
}
else
{
m_upgradeDisabledReason = GetStringFromTable(11321);
m_upgradeDisabledReason = GetTableString(uiMan, 11321);
}
}
else
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4998c3fd4977cc180a6b20f03502e6e6d150dfa206d77d4e4c30a83700377c8d
size 5918457
oid sha256:22d2dd330d4c89637e26553582e52c7587f88277f0593ba28a6206bcb69394d4
size 5919058
+2 -1
View File
@@ -21,6 +21,7 @@ namespace BrewMonster
handle.AddrOfPinnedObject(), typeof(cmd_host_correct_pos));
handle.Free();
//cmd_host_correct_pos pCmd = GPDataTypeHelper.FromBytes<cmd_host_correct_pos>((byte[])Msg.dwParam1);
Debug.LogError("OnMsgHstCorrectPos = " + pCmd.pos);
SetPos(pCmd.pos);
m_vVelocity.Clear();
m_CDRInfo.vAbsVelocity.Clear();
@@ -212,7 +213,7 @@ namespace BrewMonster
// 注意:暂时跳过地形高度检查,因为它需要世界访问
A3DVECTOR3 vNormal = new A3DVECTOR3();
float vTerrainHeight = vPos.y;
if (Physics.RaycastNonAlloc(vPos, (Vector3.down), hits, 1000f, 1 << 6) > 0)
if (Physics.RaycastNonAlloc(vPos, (Vector3.down), hits, maxDistance: 1000f, EC_CDR.TerrainMask) > 0)
{
vTerrainHeight = hits[0].point.y;
vNormal = EC_Utility.ToA3DVECTOR3(hits[0].normal);
+10 -9
View File
@@ -1390,9 +1390,9 @@ namespace BrewMonster
m_CDRInfo.vExtent = m_aabbServer.Extents;
Vector3 pStart = pos;
pos.y += m_CDRInfo.vExtent.y;
if (Physics.RaycastNonAlloc(pos, Vector3.down, hits, m_CDRInfo.vExtent.y, 1 << 6) > 0)
if (Physics.RaycastNonAlloc(pos, Vector3.down, hits, m_CDRInfo.vExtent.y, EC_CDR.TerrainMask) > 0)
{
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
//System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
m_CDRInfo.vTPNormal = EC_Utility.ToA3DVECTOR3(hits[0].normal);
}
else
@@ -1799,14 +1799,14 @@ namespace BrewMonster
float fTerrainHeight = 0f;
if (Physics.RaycastNonAlloc(startPoint, dir, hits, layerGround) > 0)
{
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
//System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
fTerrainHeight = Vector3.Distance(hits[0].point, startPoint);
}
float fWaterHeight = 0f;
if (Physics.RaycastNonAlloc(startPoint, dir, hits, layerWater) > 0)
{
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
//System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
fWaterHeight = Vector3.Distance(hits[0].point, startPoint);
}
@@ -2459,10 +2459,10 @@ namespace BrewMonster
A3DVECTOR3 vPos = GetPos();
float h0 = 0f;
int countHits0 = Physics.RaycastNonAlloc(EC_Utility.ToVector3(vPos) + Vector3.up * 500f, Vector3.down, hits, 1000f, 1 << 8);
int countHits0 = Physics.RaycastNonAlloc(EC_Utility.ToVector3(vPos) + Vector3.up * 500f, Vector3.down, hits, maxDistance: 1000f, EC_CDR.WaterMask);
if (countHits0 > 0)
{
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
//System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
h0 = hits[0].point.y;
}
if (vPos.y < h0 - m_MoveConst.fShoreDepth)
@@ -3184,7 +3184,7 @@ namespace BrewMonster
VertRayTrace(EC_Utility.ToVector3(vTestPos), ref vGndPos, ref m_GndInfo.vGndNormal, 1000f);
m_GndInfo.fGndHei = vGndPos.y;
if (Physics.RaycastNonAlloc(EC_Utility.ToVector3(vTestPos) + Vector3.up * 500f, Vector3.down, hits, 1000f, 1 << 8) > 0)
if (Physics.RaycastNonAlloc(EC_Utility.ToVector3(vTestPos) + Vector3.up * 500f, Vector3.down, hits, maxDistance: 1000f, EC_CDR.WaterMask) > 0)
{
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
m_GndInfo.fWaterHei = hits[0].point.y;
@@ -3286,9 +3286,10 @@ namespace BrewMonster
LayerMask layerMaskTerrain = 1 << 6;
LayerMask layerMaskBush = 1 << 7;
if (Physics.RaycastNonAlloc(vPos, (Vector3.down), hits, 1000f, layerMaskTerrain) > 0 /*&& hits[0].distance > 0.0009f*/)
if (Physics.RaycastNonAlloc(vPos, (Vector3.down), hits, maxDistance: 1000f, layerMaskTerrain) > 0 /*&& hits[0].distance > 0.0009f*/)
{
System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
//System.Array.Sort(hits, 0, hits.Length, raycastHitDistanceComparer);
vTerrainPos = hits[0].point;
vTerrainNormal = hits[0].normal;
}
+1 -1
View File
@@ -5,7 +5,7 @@
"threadedArchiving": true,
"logCacheMiss": false,
"logAssetWarnings": true,
"slimWriteResults": true,
"slimWriteResults": false,
"maximumCacheSize": 20,
"useDetailedBuildLog": false,
"useV2Hasher": true,