2024-06-26 12:47:43 +08:00
|
|
|
|
# 相关类
|
2024-06-20 10:13:28 +08:00
|
|
|
|
- TsPropActor
|
|
|
|
|
- TsIdolPropActor
|
|
|
|
|
- TsScenePropActor
|
2024-06-26 12:47:43 +08:00
|
|
|
|
- TsPropEffectActor
|
|
|
|
|
|
2024-06-26 14:58:59 +08:00
|
|
|
|
# 相关资产
|
|
|
|
|
ResArt/MountPointConfig/DT_MountPointConfig:用于设置道具挂载时的相对偏移。
|
2024-06-26 12:47:43 +08:00
|
|
|
|
# MountPoint
|
|
|
|
|
GameplayTag中有定义相关Prop的挂载位置标签:
|
|
|
|
|
- Prop
|
|
|
|
|
- MountPoint
|
|
|
|
|
- Back
|
|
|
|
|
- Body
|
|
|
|
|
- Feet
|
|
|
|
|
- Head
|
|
|
|
|
- HeadBottom
|
|
|
|
|
- HeadUp
|
|
|
|
|
- Hips
|
|
|
|
|
- LeftFoot
|
|
|
|
|
- LeftHand
|
|
|
|
|
- RightFoot
|
|
|
|
|
- RightHand
|
|
|
|
|
- Root
|
|
|
|
|
|
|
|
|
|
对应逻辑TsPropAssetManager.ts中的枚举,查找函数为GetMountPointIndexByTagName():
|
|
|
|
|
```ts
|
|
|
|
|
export const enum MountPointEnum {
|
|
|
|
|
HeadUp,
|
|
|
|
|
Head,
|
|
|
|
|
HeadDown,
|
|
|
|
|
LeftHand,
|
|
|
|
|
RightHand,
|
|
|
|
|
Back,
|
|
|
|
|
Feet,
|
|
|
|
|
Hips
|
|
|
|
|
}
|
|
|
|
|
```
|
2024-06-26 13:45:49 +08:00
|
|
|
|
|
|
|
|
|
TsIdolPropManagerComponent.ts
|
|
|
|
|
AttachAllProp() => AttachProp()
|
|
|
|
|
|
|
|
|
|
TsPropAssetManager.ts
|
|
|
|
|
```ts
|
|
|
|
|
static GetMountPointName(Tag: UE.GameplayTag): string {
|
|
|
|
|
if (Tag.TagName.startsWith('Prop.MountPoint')) {
|
|
|
|
|
let res = Tag.TagName.split('.')
|
|
|
|
|
return res[res.length - 1]
|
|
|
|
|
}
|
|
|
|
|
return ''
|
|
|
|
|
}
|
2024-07-16 12:24:55 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 换装代码调用步骤
|
|
|
|
|
PrepareLoadNewModel_Multicast
|
|
|
|
|
ServerDoLoadPropPreset() => ServerStartSwitchPreset() => ServerLoadProp() => DoLoadProp() => LoadDressByConfig()
|
|
|
|
|
|
|
|
|
|
- TsDirectorController.ts CreateIdol()
|
|
|
|
|
- TsIdolControllerActor.ServerCreateIdolControllerAtLiveArea
|
|
|
|
|
- controller.PropComp.ServerLoadPropPreset(0)
|
|
|
|
|
- TsIdolPropManagerComponent
|
|
|
|
|
- ServerLoadPropPreset()
|
|
|
|
|
- ServerLoadProp()
|
|
|
|
|
- DoLoadProp()
|
|
|
|
|
- LoadDressByConfig
|
|
|
|
|
|
|
|
|
|
LocalLoadDressByConfig() 本地加载。
|
|
|
|
|
LoadDressByConfig() 服务器加载。
|
2024-08-19 12:29:02 +08:00
|
|
|
|
|
|
|
|
|
# 角色衣服套装预设切换逻辑
|
|
|
|
|
在WBP_CharacterItem中5个按钮BtnSuit_1、BtnSuit_2、BtnSuit_3、BtnSuit_4、BtnSuit_5会调用EventOnPresetClicked。
|
|
|
|
|
|
|
|
|
|
```ts
|
|
|
|
|
EventOnPresetClicked(PresetIndex: number, IsDoubleClick: boolean):void {
|
|
|
|
|
let curTime = UE.KismetSystemLibrary.GetGameTimeInSeconds(this)
|
|
|
|
|
if (curTime - this.LastLoadPresetTime < 0.5) {
|
|
|
|
|
console.warn('Click too fast , please try again later')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.LastLoadPresetTime = curTime;
|
|
|
|
|
if (IsDoubleClick) {
|
|
|
|
|
this.LoadPreset(PresetIndex)
|
|
|
|
|
} else {
|
|
|
|
|
this.PreviewPreset(PresetIndex)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public LoadPreset(PresetIndex: number): void {
|
|
|
|
|
if (this.Idol == null) {
|
|
|
|
|
console.error(`TsCharacterItem@LoadPreset error: idol is null`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.Idol.PropComp.ServerLoadPropPreset(PresetIndex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PreviewPreset(PresetIndex: number): void {
|
|
|
|
|
if (this.Idol == null) {
|
|
|
|
|
console.error(`TsCharacterItem@PreviewPreset error: idol is null`);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.Idol.PropComp.ClientLoadPropPreset(PresetIndex);
|
|
|
|
|
this.RefreshPresetUIStatus()
|
|
|
|
|
}
|
|
|
|
|
```
|