Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #17484: 修复tsx文件对象层自定义属性读取错误 #17486

Closed

Conversation

Jerry457
Copy link
Contributor

@Jerry457 Jerry457 commented Aug 2, 2024

Greptile Summary

This pull request addresses issue #17484 by fixing the error in reading custom properties of object layers from TSX files.

  • Added properties field to TMXObject interface in cocos/tiledmap/tiled-types.ts.
  • Updated getPropertyList function in cocos/tiledmap/tmx-xml-parser.ts to use querySelectorAll for better property selection.
  • Modified parseObjectGroup method in cocos/tiledmap/tmx-xml-parser.ts to correctly assign properties to object layers.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

github-actions bot commented Aug 2, 2024

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -19753,9 +19753,9 @@
         export class frustum extends Frustum {
             constructor();
         }
     }
-    export const VERSION = "3.8.4";
+    export const VERSION = "3.8.5";
     /**
      * @en
      * The main namespace of Cocos engine, all engine core classes, functions, properties and constants are defined in this namespace.
      * @zh
@@ -63959,15 +63959,15 @@
              * @en The event type indicates mouse leaves the window or canvas. Only Windows, macOS or web PC can
              * trigger this event.
              * @zh 当鼠标离开窗口或者 canvas 时发出该消息。只有 Windows、macOS 或者 PC web 会触发该事件。
              */
-            MOUSE_LEAVE = "mouse-leave-window",
+            MOUSE_LEAVE = "mouse-leave",
             /**
              * @en The event type indicates mouse enters the window or canvas. Only Windows, macOS or web PC can
              * trigger this event.
              * @zh 当鼠标进入窗口或者 canvas 时发出该消息。只有 Windows、macOS 或者 PC web 会触发该事件。
              */
-            MOUSE_ENTER = "mouse-enter-window",
+            MOUSE_ENTER = "mouse-enter",
             /**
              * @en
              * The event type for mouse wheel events
              *
@@ -69631,8 +69631,9 @@
              */
             TEXT = 5
         }
         export interface _cocos_tiledmap_tiled_types__TMXObject {
+            properties: _cocos_tiledmap_tiled_types__PropertiesInfo;
             id: number | string;
             name: string;
             width: number;
             height: number;

@@ -89,7 +89,7 @@ function strToColor (value: string): Color {

function getPropertyList (node: Element, map?: PropertiesInfo): PropertiesInfo {
const res: any[] = [];
const properties = node.getElementsByTagName('properties');
const properties = node.querySelectorAll(':scope > properties');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WeChat mini-games do not support this interface

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jerry457 Please fix test error.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And modify the branch to 3.8.5

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in new PR: #17641

@Jerry457 Jerry457 changed the base branch from v3.8.4 to v3.8.5 September 14, 2024 02:52
@qiuguohua
Copy link
Contributor

@Jerry457 There is also a ci error

@Jerry457 Jerry457 closed this Sep 14, 2024
@Jerry457 Jerry457 deleted the v3.8.4-tiledmap-object-properties branch September 14, 2024 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants