Files
Main/Assets/Code/Logic/_Required/FGameObject/FSkin/FPlayerAnimRelation.cs
2025-01-25 04:38:09 +08:00

136 lines
3.7 KiB
C#

using Thousandto.Core.Asset;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Thousandto.Cfg.Data;
namespace Thousandto.Code.Logic
{
/// <summary>
/// 玩家与动作的关联信息
/// </summary>
public static class FPlayerAnimRelation
{
#region//函数
public static int GetLogicType(string name)
{
var cfg = DeclareAnimClipName.Get(name);
if (cfg != null)
{
return cfg.LogicType;
}
return FAnimLogicType.None;
}
public static string SkillIdleToMove(string name)
{
var cfg = DeclareAnimClipName.Get(name);
if (cfg != null)
{
return cfg.IdleMoveAnim;
}
return string.Empty;
}
public static string SkillMoveToIdle(string name)
{
var cfg = DeclareAnimClipName.Get(name);
if (cfg != null)
{
return cfg.MoveIdleAnim;
}
return string.Empty;
}
#endregion
#region//私有的静态变量
private static Dictionary<string, bool> _uiSimpleAnims = null;
private static Dictionary<string, bool> _uiMountAnims = null;
private static Dictionary<string, bool> _sceneAnims = null;
private static Dictionary<string, bool> _loginAnims = null;
private static bool _isLoaded = false;
#endregion
#region//公共静态变量
//登录界面动作
public static Dictionary<string, bool> LoginAnims
{
get
{
CheckAnims();
return _loginAnims;
}
}
//UI上简单动作
public static Dictionary<string, bool> UISimpleAnims
{
get
{
CheckAnims();
return _uiSimpleAnims;
}
}
//UI上带有坐骑的动作
public static Dictionary<string, bool> UIMountAnims
{
get
{
CheckAnims();
return _uiMountAnims;
}
}
//场景上的动作
public static Dictionary<string, bool> SceneAnims
{
get
{
CheckAnims();
return _sceneAnims;
}
}
#endregion
#region//公有函数
public static void CheckAnims()
{
if (_isLoaded)
return;
_isLoaded = true;
_loginAnims = new Dictionary<string, bool>();
_uiSimpleAnims = new Dictionary<string, bool>();
_uiMountAnims = new Dictionary<string, bool>();
_sceneAnims = new Dictionary<string, bool>();
DeclareAnimClipName.Foreach(cfg =>
{
if (cfg.IsLoginAnim != 0)
{
_loginAnims.Add(cfg.Name, cfg.UseHalfBody != 0);
}
if (cfg.IsUiSimpleAnim != 0)
{
_uiSimpleAnims.Add(cfg.Name, cfg.UseHalfBody != 0);
}
if (cfg.IsUiMountleAnim != 0)
{
_uiMountAnims.Add(cfg.Name, cfg.UseHalfBody != 0);
}
if (cfg.IsSceneAnim != 0)
{
_sceneAnims.Add(cfg.Name, cfg.UseHalfBody != 0);
}
return true;
});
}
public static void ClearAnims()
{
_isLoaded = false;
_loginAnims = null;
_uiSimpleAnims = null;
_uiMountAnims = null;
_sceneAnims = null;
}
#endregion
}
}