fix bug "dance" quest not working(workaround). Trigger action via action skill table. fix bug some matter object dont have collider(workaround)

This commit is contained in:
Chomper9981
2026-02-26 17:28:53 +07:00
parent abde960893
commit 10e4cfa1d3
9 changed files with 217 additions and 21 deletions
@@ -36,9 +36,9 @@ RectTransform:
m_Father: {fileID: 8222630393730529017}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -10, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 272, y: 0}
m_SizeDelta: {x: 544, y: 0}
m_Pivot: {x: 0.5, y: 1}
--- !u!222 &9154858122360570458
CanvasRenderer:
@@ -68,7 +68,21 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text:
m_text: 'asfasf
asfasf
asfasf
asfasf
asfasf
asfasf
asfasf
'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
@@ -180,7 +194,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: 370
m_MinHeight: 300
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: -1
@@ -1261,6 +1275,7 @@ GameObject:
m_Component:
- component: {fileID: 8222630393730529017}
- component: {fileID: 2639351263650743997}
- component: {fileID: 4142611820152313966}
m_Layer: 5
m_Name: Content
m_TagString: Untagged
@@ -1302,6 +1317,32 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_HorizontalFit: 0
m_VerticalFit: 1
--- !u!114 &4142611820152313966
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5003895622590170670}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 1
m_ChildControlHeight: 0
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!1 &6318768709065201913
GameObject:
m_ObjectHideFlags: 0
@@ -1394,7 +1435,7 @@ MonoBehaviour:
m_Content: {fileID: 8222630393730529017}
m_Horizontal: 0
m_Vertical: 1
m_MovementType: 2
m_MovementType: 1
m_Elasticity: 0.1
m_Inertia: 1
m_DecelerationRate: 0.135
@@ -166,14 +166,18 @@ namespace PerfectWorld.Scripts
// use same rotation as Prefab
// matterObject.transform.localRotation = Quaternion.identity;
matterObject.SetActive(true);
// Add a collider if it doesn't have one
if (matterObject.GetComponent<Collider>() == null)
{
var collider = matterObject.AddComponent<BoxCollider>();
collider.size = matterObject.GetComponentInChildren<Renderer>().bounds.size;
//this is a workaround to fix the collider size issue when load prefab go wrong at some point
//TODO: remove this workaround after the prefab load issue is fixed
Vector3 size = matterObject.GetComponentInChildren<Renderer>().bounds.size;
if (size.x == 0) size.x = 0.5f;
if (size.y == 0) size.y = 0.5f;
if (size.z == 0) size.z = 0.5f;
collider.size = size;
}
// Create text object to display item name above the cube
// CreateItemNameText(matterObject, info.tid);
@@ -924,8 +924,8 @@ namespace BrewMonster
m_dwParam = src.m_dwParam;
}
public override CECShortcut Clone() => new CECSCCommand(this);
public int GetCommandID() => 0;
public int GetParam() => 0;
public int GetCommandID() => m_iCommand;
public int GetParam() => (int)m_dwParam;
// Set / Get command parameter
public void SetParam(uint dwParam) { m_dwParam = dwParam; }
@@ -1848,7 +1848,7 @@ namespace BrewMonster.Scripts.Task
List<ActiveTaskEntry> aEntries = new List<ActiveTaskEntry>(pList.m_TaskEntries);
ATaskTempl pTempl;
if (emotion < (int)TaskInterface.CommandTaskAction.CMD_EMOTION_BINDBUDDY)// pTempl->m_uiEmotion ֵΪ0±íʾ²»¼ì²é£¬ËùÒÔËùÓбíÇéÐòºÅ¶¼ºóÒÆ1
if (emotion < (int)TaskInterface.CommandTaskAction.CMD_EMOTION_BINDBUDDY)// pTempl->m_uiEmotion ֵΪ0±íʾ²»¼ì²é£¬ËùÒÔËùÓбíÇéÐòºÅ¶¼ºóÒÆ1 // pTempl->m_uiEmotion value of 0 means don't check, so all emote sequence numbers are shifted by 1
emotion += 1;
for (int i = 0; i < pList.m_uTaskCount; i++)
@@ -1865,7 +1865,16 @@ namespace BrewMonster.Scripts.Task
// Check if map does not contain OR value == false
if (!m_emotionTask.TryGetValue(id, out bool exists) || !exists)
{
m_emotionTask[id] = (pTempl.m_FixedData.m_uiEmotion == (uint)emotion);
bool matches = (pTempl.m_FixedData.m_uiEmotion == (uint)emotion);
m_emotionTask[id] = matches;
// WORKAROUND: Trigger quest check immediately when emotion matches
// TODO: Remove this workaround after animation completion is properly handled
// This ensures the server is notified right away instead of waiting for the next periodic check
if (matches)
{
TaskClient.OnTaskCheckStatus(this);
}
}
}
}
@@ -361,8 +361,10 @@ namespace BrewMonster.Scripts.Task
{
if (!needServerCheck || pTask == null || pTempl == null || entry == null) return;
// Only auto-check for wait-time tasks (the reported broken case).
if ((TaskCompletionMethod)pTempl.m_FixedData.m_enumMethod != TaskCompletionMethod.enumTMWaitTime)
// Auto-check for wait-time tasks and simple client tasks (emote/action tasks)
TaskCompletionMethod method = (TaskCompletionMethod)pTempl.m_FixedData.m_enumMethod;
if (method != TaskCompletionMethod.enumTMWaitTime &&
method != TaskCompletionMethod.enumTMSimpleClientTask)
return;
if (entry.IsFinished()) return;
@@ -1,4 +1,5 @@
using BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay;
using BrewMonster.Network;
using BrewMonster.UI;
using System;
using System.Collections.Generic;
@@ -56,6 +57,10 @@ namespace BrewMonster
{
var actionTP = Instantiate(actionTemplate, actionContain);
actionTP.gameObject.SetActive(true);
// Set up click handler for action items / 为动作项设置点击处理程序
SetupActionClickHandler(actionTP);
m_aActionInfo.Add(new ActionInfo
{
image = actionTP,
@@ -109,6 +114,35 @@ namespace BrewMonster
}
}
}
/// <summary>
/// Set up click handler for action items, similar to wave hand logic / 为动作项设置点击处理程序,类似于挥手逻辑
/// </summary>
private void SetupActionClickHandler(AUIImagePicture actionImage)
{
if (actionImage == null) return;
Debug.Log($"CDlgSkillSubAction::SetupActionClickHandler():: Setting up click handler for action item: {actionImage.name}");
// Get the button component / 获取按钮组件
var button = actionImage.GetComponentInChildren<UnityEngine.UI.Button>();
if (button == null)
return;
// Remove existing listeners and add our custom handler / 移除现有监听器并添加我们的自定义处理程序
button.onClick.RemoveAllListeners();
button.onClick.AddListener(() => OnActionClicked(actionImage));
}
/// <summary>
/// Handle action icon click, similar to wave hand logic / 处理动作图标点击,类似于挥手逻辑
/// </summary>
private void OnActionClicked(AUIImagePicture actionImage)
{
if (actionImage == null) return;
// Get the shortcut from the action image / 从动作图像获取快捷方式
actionImage.Execute();
}
[Serializable]
public struct ActionInfo
{
@@ -64,9 +64,17 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
{
if (pSC != null)
{
pSC.Execute();
SetInteract(false);
// Execute the shortcut - this will trigger CmdStartPose which sends network message
// The quest completion happens when OnMsgPlayerDoEmote receives the server response
// and calls SetEmotion, similar to how OnClickedWaveHand works
bool executed = pSC.Execute();
// Only disable interaction if execution succeeded
// This ensures the network message is sent before we disable the button
if (executed)
{
SetInteract(false);
}
}
else
{
+2
View File
@@ -368,6 +368,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: e8681072225697243a08644ceda976a3, type: 3}
m_Name:
m_EditorClassIdentifier:
skillNameText: {fileID: 0}
imageProgress: {fileID: 0}
panelRoot: {fileID: 6830833846243993097}
descriptionText:
legacy: {fileID: 0}
+99 -3
View File
@@ -2713,6 +2713,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4d2e79da3ae98154c98516f50b73a81b, type: 3}
m_Name:
m_EditorClassIdentifier:
skillNameText: {fileID: 0}
imageProgress: {fileID: 0}
ptSkillContainer: {fileID: 5209698742198332103}
psSkillContainer: {fileID: 6640795756162075713}
psSkillSlotList: []
@@ -3815,7 +3817,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 149.24545, y: 0.00000023857865}
m_AnchoredPosition: {x: 149.24545, y: 0}
m_SizeDelta: {x: 154.1473, y: 37}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5506685427520632045
@@ -5138,6 +5140,7 @@ GameObject:
- component: {fileID: 6710103663631289946}
- component: {fileID: 523329600507644709}
- component: {fileID: 912173140299320127}
- component: {fileID: 6034688251073174200}
m_Layer: 5
m_Name: icon
m_TagString: Untagged
@@ -5178,7 +5181,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 67fd391520cbfd44f84a1c6bb57673c0, type: 3}
m_Name:
m_EditorClassIdentifier:
skillbutton: {fileID: 0}
skillbutton: {fileID: 6034688251073174200}
skillImage: {fileID: 79341390793448853}
borderImage: {fileID: 5124956242307597890}
cooldownTime: 0
@@ -5221,6 +5224,50 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &6034688251073174200
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3331107676278791390}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 0
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 0}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &3406708742645219522
GameObject:
m_ObjectHideFlags: 0
@@ -13021,6 +13068,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7304a7aa2183ad34babf66894ed22f7e, type: 3}
m_Name:
m_EditorClassIdentifier:
skillNameText: {fileID: 0}
imageProgress: {fileID: 0}
m_pSubRank: {fileID: 1851903413579782982}
m_pSubSkill: {fileID: 7688900625148083785}
m_contentRoot: {fileID: 8302858527499935758}
@@ -13213,6 +13262,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 05377af3dd0a3a84fbff62d8e0a572f9, type: 3}
m_Name:
m_EditorClassIdentifier:
skillNameText: {fileID: 0}
imageProgress: {fileID: 0}
m_skillNameLbl: {fileID: 7381636566794381957}
skillLevel: {fileID: 1095789015156331712}
m_highlight: {fileID: 0}
@@ -13380,6 +13431,7 @@ GameObject:
- component: {fileID: 6897593266829550523}
- component: {fileID: 6263047871981887699}
- component: {fileID: 8452392559284459496}
- component: {fileID: 5320015828055191291}
m_Layer: 5
m_Name: icon
m_TagString: Untagged
@@ -13420,7 +13472,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 67fd391520cbfd44f84a1c6bb57673c0, type: 3}
m_Name:
m_EditorClassIdentifier:
skillbutton: {fileID: 0}
skillbutton: {fileID: 5320015828055191291}
skillImage: {fileID: 4930055916587000086}
borderImage: {fileID: 3406708742645219522}
cooldownTime: 0
@@ -13463,6 +13515,50 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &5320015828055191291
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8033079540058746360}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 8452392559284459496}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!1 &8090171231683763887
GameObject:
m_ObjectHideFlags: 0