diff --git a/02-Note/DAWA/ASoul/流程笔记/道具流程.md b/02-Note/DAWA/ASoul/流程笔记/道具流程.md index 7c03383..55d4821 100644 --- a/02-Note/DAWA/ASoul/流程笔记/道具流程.md +++ b/02-Note/DAWA/ASoul/流程笔记/道具流程.md @@ -67,3 +67,40 @@ ServerDoLoadPropPreset() => ServerStartSwitchPreset() => ServerLoadProp() => DoL 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() +} +```