2.4 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			2.4 KiB
		
	
	
	
	
	
	
	
相关类
- 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
 
 
 - MountPoint
 
对应逻辑TsPropAssetManager.ts中的枚举,查找函数为GetMountPointIndexByTagName():
export const enum MountPointEnum {
    HeadUp,
    Head,
    HeadDown,
    LeftHand,
    RightHand,
    Back,
    Feet,
    Hips
}
TsIdolPropManagerComponent.ts AttachAllProp() => AttachProp()
TsPropAssetManager.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。
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()
}