Add networked Fighter3D minigame

This commit is contained in:
ud18010
2026-08-10 16:47:16 +08:00
parent bff617091d
commit ef7f24738e
53 changed files with 5458 additions and 19 deletions
@@ -14,6 +14,7 @@ namespace XGame.ActorBehavior
public static string GetControllerPath(string catalogType)
{
return string.Equals(catalogType, LobbyActorBehaviorRuntime.DefaultCatalogType, StringComparison.OrdinalIgnoreCase)
|| string.Equals(catalogType, "fighter3d", StringComparison.OrdinalIgnoreCase)
? "Assets/Game/Art/Actor/Controller/fighter.controller"
: null;
}
@@ -16,18 +16,23 @@ namespace XGame.ActorBehavior
public const string ConfigRoot = "Assets/Game/Config/ActorBehavior";
public static IEnumerator LoadCatalog(string type, Action<BehaviorConfigCatalog> onLoaded)
{
yield return LoadCatalogFromRoot(type, ConfigRoot, onLoaded);
}
public static IEnumerator LoadCatalogFromRoot(string type, string configRoot, Action<BehaviorConfigCatalog> onLoaded)
{
string skillJson = null;
string flyObjectJson = null;
string buffJson = null;
yield return LoadText(GetSkillPath(type), text => skillJson = text);
yield return LoadText(GetFlyObjectPath(type), text => flyObjectJson = text);
yield return LoadText(GetBuffPath(type), text => buffJson = text);
yield return LoadText(GetSkillPath(type, configRoot), text => skillJson = text);
yield return LoadText(GetFlyObjectPath(type, configRoot), text => flyObjectJson = text);
yield return LoadText(GetBuffPath(type, configRoot), text => buffJson = text);
if (string.IsNullOrEmpty(skillJson) || string.IsNullOrEmpty(flyObjectJson) || string.IsNullOrEmpty(buffJson))
{
Debug.LogError("[ActorBehaviorConfigLoader] missing behavior config for type=" + type);
Debug.LogError("[ActorBehaviorConfigLoader] missing behavior config for type=" + type + ", root=" + configRoot);
onLoaded?.Invoke(null);
yield break;
}
@@ -48,16 +53,38 @@ namespace XGame.ActorBehavior
return ConfigRoot + "/" + type + "_skill.json";
}
public static string GetSkillPath(string type, string configRoot)
{
return NormalizeRoot(configRoot) + "/" + type + "_skill.json";
}
public static string GetFlyObjectPath(string type)
{
return ConfigRoot + "/" + type + "_flyobj.json";
}
public static string GetFlyObjectPath(string type, string configRoot)
{
return NormalizeRoot(configRoot) + "/" + type + "_flyobj.json";
}
public static string GetBuffPath(string type)
{
return ConfigRoot + "/" + type + "_buff.json";
}
public static string GetBuffPath(string type, string configRoot)
{
return NormalizeRoot(configRoot) + "/" + type + "_buff.json";
}
private static string NormalizeRoot(string configRoot)
{
return string.IsNullOrEmpty(configRoot)
? ConfigRoot
: configRoot.TrimEnd('/', '\\');
}
private static IEnumerator LoadText(string assetPath, Action<string> onLoaded)
{
#if UNITY_EDITOR