load equipment skin

This commit is contained in:
Le Duc Anh
2025-11-11 15:59:26 +07:00
parent 2974373390
commit 9be43da2ae
@@ -1,6 +1,7 @@
using Animancer;
using BrewMonster;
using BrewMonster.Managers;
using BrewMonster.Scripts;
using BrewMonster.Scripts.Managers;
using CSNetwork.GPDataType;
using ModelRenderer.Scripts.GameData;
@@ -8,6 +9,7 @@ using PerfectWorld.Scripts.Managers;
using PerfectWorld.Scripts.Player;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml.Linq;
using TMPro;
using Unity.VisualScripting;
@@ -173,6 +175,28 @@ public abstract class CECPlayer : CECObject
m_MoveConst = aMoveConsts[iIndex];
}
public static async Task<bool> LoadPlayerSkin(GameObject aSkins, int index, string szFile)
{
// these are LOD suffix
string[] suffix1 = {"一级", "二级", "三级"};
string[] suffix2 = {"", "二级", "三级"};
string szSkinFile = "";
if( index == EC_Player_Skin_Const.SKIN_BODY_INDEX || index == EC_Player_Skin_Const.SKIN_HEAD_INDEX )
szSkinFile = $"{szFile}{suffix2[0]}";
else
szSkinFile = $"{szFile}{suffix1[0]}";
aSkins = await AddressableManager.Instance.LoadPrefabAsync(szSkinFile);
if (aSkins == null)
return false;
return true;
}
public static void InitStaticRes()
{
BuildActionList();
@@ -1206,4 +1230,20 @@ public class Move_Mode
MOVE_JUMP = 2,
MOVE_FREEFALL = 3,
MOVE_SLIDE = 4;
}
public class EC_Player_Skin_Const
{
// Skin index
public static byte SKIN_BODY_INDEX = 0;
public static byte SKIN_UPPER_BODY_INDEX = 1;
public static byte SKIN_WRIST_INDEX = 2;
public static byte SKIN_LOWER_INDEX = 3;
public static byte SKIN_FOOT_INDEX = 4;
public static byte SKIN_HEAD_INDEX = 5;
public static byte SKIN_FASHION_UPPER_BODY_INDEX = 6;
public static byte SKIN_FASHION_WRIST_INDEX = 7;
public static byte SKIN_FASHION_LOWER_INDEX = 8;
public static byte SKIN_FASHION_FOOT_INDEX = 9;
public static byte NUM_SKIN_INDEX = 10;
}