vault backup: 2024-11-26 18:16:19

This commit is contained in:
2024-11-26 18:16:19 +08:00
parent b0061ba795
commit c7e0a80a36
36 changed files with 149 additions and 39 deletions

View File

@@ -0,0 +1,106 @@
# 相关类
- TsPropActor
- TsIdolPropActor
- TsScenePropActor
- TsPropEffectActor
# 相关资产
ResArt/MountPointConfig/DT_MountPointConfig用于设置道具挂载时的相对偏移。
# 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
}
```
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 ''
}
```
# 换装代码调用步骤
PrepareLoadNewModel_Multicast
ServerDoLoadPropPreset() => ServerStartSwitchPreset() => ServerLoadProp() => DoLoadProp() => LoadDressByConfig()
- TsDirectorController.ts CreateIdol()
- TsIdolControllerActor.ServerCreateIdolControllerAtLiveArea
- controller.PropComp.ServerLoadPropPreset(0)
- TsIdolPropManagerComponent
- ServerLoadPropPreset()
- ServerLoadProp()
- DoLoadProp()
- LoadDressByConfig
LocalLoadDressByConfig() 本地加载。
LoadDressByConfig() 服务器加载。
# 角色衣服套装预设切换逻辑
在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()
}
```