Interface display method and device, electronic equipment and computer readable storage medium
By storing static data of the upper-level script interface instance in the engine layer node tree and displaying the target upper-level script interface instance, the problem of low efficiency of the node tree preview tool is solved, and efficient interface development and debugging are achieved.
Patent Information
- Application Number
- CN202211584589.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-09
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2042-12-09
AI Technical Summary
In existing technologies, the node tree preview tool of the interface development engine only supports displaying engine layer nodes and editing engine layer nodes, resulting in low interface development efficiency.
By storing static data of upper-level script interface instances in the engine layer node tree, and displaying the target upper-level script interface instance based on the mapping relationship when a node is triggered, access and editing of the upper-level script interface instance can be achieved.
It improves interface development efficiency, simplifies the testing and debugging process of upper-level script interface instances, reduces access paths, and enhances the user experience for developers.
Smart Images

Figure CN115827137B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to an interface display method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] Interface development is a crucial part of the game development process. Providing developers with a WYSIWYG node tree preview tool can effectively improve interface development efficiency. In actual interface development, it may be necessary to use scripts to encapsulate another layer of interface types on top of the interface development engine's engine layer to maintain the interface's information storage and logic operation. This means that the encapsulated upper-level script interface instance manages one or more engine-layer nodes. However, in related technologies, the node tree preview tools provided by the interface development engine only support displaying and editing engine-layer nodes. This reduces the efficiency of interface development for developers. Summary of the Invention
[0003] In view of the above problems, this application proposes an interface display method, apparatus, electronic device and computer-readable storage medium to solve the problem of low interface development efficiency caused by the node tree preview tool only supporting display engine layer nodes in the related art.
[0004] According to one aspect of the embodiments of this application, a method for displaying an interface is provided, comprising: displaying an engine layer node tree, the engine layer node tree including at least one first node, the first node being a node associated with an upper-level script interface instance; in response to a triggering operation on a target first node in the engine layer node tree, determining and displaying a target upper-level script interface instance based on a mapping relationship between the first node and the upper-level script interface instance, the target upper-level script interface instance being the upper-level script interface instance associated with the triggered target first node.
[0005] According to one aspect of the embodiments of this application, an interface display device is provided, comprising: a first display module for displaying an engine layer node tree, the engine layer node tree including at least one first node, the first node being a node associated with an upper-level script interface instance; and a second display module for determining and displaying a target upper-level script interface instance based on a mapping relationship between the first node and the upper-level script interface instance in response to a triggering operation on a target first node in the engine layer node tree, the target upper-level script interface instance being an upper-level script interface instance associated with the triggered target first node.
[0006] According to one aspect of the embodiments of this application, an electronic device is provided, including: a processor; a memory, the memory storing computer-readable instructions, which, when executed by the processor, implement the interface display method as described above.
[0007] According to one aspect of the embodiments of this application, a computer-readable storage medium is provided, on which computer-readable instructions are stored, which, when executed by a processor, implement the interface display method as described above.
[0008] According to one aspect of the embodiments of this application, a computer program product is provided, which includes computer instructions that, when executed by a processor, implement the interface display method described above.
[0009] In the solution of this application, based on the display of the engine layer node tree, there is a first node in the engine layer node tree that is associated with the upper-level script interface instance. If the target first node in the engine layer node tree is triggered, the upper-level script interface instance associated with the target first node is determined and displayed based on the mapping relationship between the first node and the upper-level script interface instance. This enables access to the upper-level script interface instance associated with a node through the node in the engine layer node tree, thereby facilitating the editing, testing and debugging of the upper-level script interface instance and effectively improving the efficiency of interface development. Attached Figure Description
[0010] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0011] Figure 1 This is a flowchart illustrating an interface display method according to an embodiment of this application.
[0012] Figure 2A This is a flowchart illustrating step 120 in one embodiment according to an embodiment of the present application.
[0013] Figure 2B This is a schematic diagram of a first control in a first interactive window according to an embodiment of this application.
[0014] Figure 2C An exemplary diagram of a target upper-level script interface instance is shown.
[0015] Figure 3 This is illustrated according to an embodiment of the present application. Figure 2AThe flowchart of step 122 in one embodiment is shown in the corresponding example.
[0016] Figure 4 This is a schematic diagram of an engine layer node tree according to an embodiment of this application.
[0017] Figure 5 This is a schematic diagram illustrating the display of a second control in a first interactive window according to an embodiment of this application.
[0018] Figure 6 This is a flowchart illustrating, according to an embodiment of the present application, the automatic location of script code defining the encapsulation type in a script file.
[0019] Figure 7 This is a schematic diagram illustrating the display of a third control in a first interactive window according to an embodiment of this application.
[0020] Figure 8 This is a schematic diagram of the node tree of a target upper-level script interface instance according to an embodiment of this application.
[0021] Figure 9 This is a schematic diagram of a property window according to an embodiment of this application.
[0022] Figure 10A This is a schematic diagram of the node tree of a target upper-level script interface instance according to another embodiment of this application.
[0023] Figure 10B This is a schematic diagram of an animation editing window according to an embodiment of this application.
[0024] Figure 11 This is a block diagram of an interface display device according to an embodiment of this application.
[0025] Figure 12 A schematic diagram of the structure of an electronic device suitable for implementing embodiments of this application is shown. Detailed Implementation
[0026] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.
[0027] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.
[0028] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0029] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0030] It should be noted that "multiple" in this article refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0031] Before providing a detailed description of the solution in this application, the terms used in this application are explained as follows:
[0032] Cocos: In this article, Cocos-2dx is used to refer to the game engine, which includes concepts such as director, scene, control, and action. It is mainly developed in C++, with Lua as a secondary language.
[0033] Upper-level script encapsulated interface: refers to the interface type implemented through scripts. For example, in the Cocos-2dx game engine, an additional layer of interface type is encapsulated on top of Cocos through scripts to maintain the information storage and logic operation of the game interface. That is, the upper-level script interface instance manages a group of Cocos nodes (one or more canvas controls), and the Cocos node is the engine layer node in the engine layer node tree.
[0034] Upper-level script interface instance: The script object obtained by instantiating the upper-level script encapsulated interface.
[0035] In actual UI development, it may be necessary to use scripts to encapsulate another layer of UI type on top of the engine layer to maintain UI information storage and logic operation. This involves the encapsulated upper-level script UI instance managing one or more engine-level nodes (e.g., Cocos nodes). However, in related technologies, the node tree preview tools provided by UI development engines only support displaying and editing engine-level nodes. This results in a significant time commitment for UI developers when accessing the upper-level script UI instance associated with a node, reducing UI development efficiency. Based on this, the solution proposed in this application is presented.
[0036] The implementation details of the technical solutions in the embodiments of this application are described in detail below:
[0037] Figure 1 This is a flowchart illustrating an interface display method according to an embodiment of this application. The method can be executed by an electronic device with processing capabilities. The electronic device can be a terminal with a display screen, such as a desktop computer, laptop computer, etc., without specific limitation herein. The terminal can run a client program of an interface development engine, thereby displaying the user interface of the interface development engine. (Refer to...) Figure 1 As shown, the method includes at least steps 110 to 120, which are described in detail below:
[0038] Step 110: Display the engine layer node tree. The engine layer node tree includes at least one first node, which is a node associated with the upper-level script interface instance.
[0039] The engine layer node tree refers to the node tree structure of the interface obtained through interface development using the interface development engine. In other words, the nodes in the engine layer node tree are implemented based on the core components of the driving engine provided by the interface development engine, without relying on the functions of other external systems. Engine layer nodes in the engine layer node tree refer to interface elements in the interface developed using the interface development engine, such as controls (e.g., controls for releasing skills, attacking, returning, etc.), menu options, etc. In this application, the engine layer node tree is displayed on the client-side display interface of the interface development engine.
[0040] Interfaces developed using an interface development engine can be game interfaces for game applications, instant messaging applications, shopping applications, video applications, live streaming applications, etc., without specific limitations.
[0041] In one specific embodiment, the interface developed by the interface development engine can be the game interface of a game application. The interface development engine can be the Cocos-2dx game engine. The node tree preview tool integrated by the Cocos-2dx game engine can display the nodes in the engine layer node tree, where the nodes in the engine layer node tree are Cocos nodes.
[0042] The upper-level script interface instance refers to the script object obtained by instantiating the interface type written in a scripting language. Scripting languages include JavaScript, Python, VBScript, etc., and are not specifically limited here. In a specific embodiment, if the interface development engine is the Cocos-2dx game engine, the upper-level script interface instance can be an interface instance implemented in Python.
[0043] In a specific embodiment, the node tree preview tool integrated into the interface development engine provides a node tree window and an attribute window. The node tree window is used to display the node tree, so that in step 110, the engine layer node tree can be displayed in the node tree window of the node tree preview tool. The attribute window is used to display the attribute information of each node.
[0044] The first node can also be understood as an engine layer node managed by the upper-level script interface instance in the engine layer node tree. In a specific embodiment, during the creation of the upper-level script interface instance, the instance information of the upper-level script node instance can be associated and cached in the engine layer node tree with the node identifier of the specified engine layer node managed by that upper-level script interface instance (i.e., the first node). Thus, during the display of the engine layer node tree, it can be determined whether an engine layer node is the first node based on whether the engine layer node in the engine layer node tree is associated with and stores the instance information of the upper-level script interface instance. The instance information of the upper-level script interface instance is, for example, the static data of the upper-level script interface instance as described below.
[0045] Step 120: In response to the triggering operation of the target first node in the engine layer node tree, determine and display the target upper-level script interface instance based on the mapping relationship between the first node and the upper-level script interface instance. The target upper-level script interface instance refers to the upper-level script interface instance associated with the triggered target first node.
[0046] The target first node refers to the first node in the engine layer node tree that is selected by the user. Based on the display of the engine layer node tree, the nodes in the engine layer node tree can be expanded in a tree structure. Thus, the user can select nodes as needed and then edit the information of the nodes (such as the node's attribute information). If the selected node is the first node, the upper-level script interface instance associated with the first node can be displayed in accordance with the method of this application.
[0047] As described above, the engine layer node tree stores the instance information of the upper-level script node instance and the node identifier of the engine layer node (i.e., the first node) managed by the specified upper-level script interface instance. That is, the engine layer node tree stores the mapping relationship between the upper-level script interface instance and the first node. Therefore, based on the mapping relationship between the first node and the upper-level script interface instance, the upper-level script interface instance (i.e., the target upper-level script interface instance) associated with the selected target first node can be determined.
[0048] The triggering operation for the first node of the target can be a click operation (such as left mouse click, right mouse click, left mouse double click, right mouse double click), touch operation, swipe operation, long press operation, etc., or an operation triggered by a triggerable control provided for the first node of the target, without specific limitations.
[0049] In some embodiments, after triggering the first target node in the engine layer node tree, the upper-level script interface instance of the target can be displayed directly; in other embodiments, after triggering the first target node in the engine layer node tree, an intermediate option can be provided, and then clicking the option in the intermediate option to enter the upper-level script interface instance associated with the first target node will display the upper-level script interface instance of the target.
[0050] Figure 2A This is a flowchart of step 120 in one embodiment according to an embodiment of this application, as shown below. Figure 2A As shown, step 120 includes steps 121-122, which are detailed below:
[0051] Step 121: In response to the triggering operation on the target first node in the engine layer node tree, display the first interactive window, which includes the first control.
[0052] In this application, the first control is the entry point for accessing the parent script interface instance associated with the first node. It can also be understood as a page element in the first interactive window that is used to access the parent script interface instance associated with the first node and can be triggered. The first control can be presented in the form of a button, a virtual icon, an option in a menu, etc.
[0053] The triggering operation for the first node can be a click operation (left mouse click, right mouse click), mouse hover operation, double click operation, touch operation, long press operation, etc., without specific limitations. The first interaction window can be displayed as a floating window in the node tree window. It can be understood that the first interaction window can also include other triggerable controls besides the first control, which can be set according to actual needs. The triggerable controls in the displayed first interaction window are the middle options mentioned above.
[0054] Figure 2B This is a schematic diagram of a first control in a first interactive window according to an embodiment of this application. For example... Figure 2B As shown, the node tree window 210 displays the engine layer node tree for the developed display interface. If the "PanelBGBG" node in the engine layer node tree is triggered, a first interactive window 220 can be displayed in the node tree window 210. The "Record Interface Instance" control 221 in the first interactive window 220 is the first control in this application. Furthermore, in Figure 2B In the first interactive window 220, there are other controls besides the first control, such as the "Copy Name" control, the "Copy ID" control, the "Copy Class Name" control, and the "Copy CSB Path" control.
[0055] In some embodiments, since the engine layer node tree also includes nodes that are not associated with the upper-level script interface instance, if a node in the engine layer node tree that is not associated with the upper-level script interface instance is triggered, the first control may not be displayed in the first interactive window, or the first control in the first interactive window may be made to be in an untriggerable state, thereby avoiding misleading the user.
[0056] Step 122: In response to the trigger operation of the first control, display the target upper-level script interface instance based on the mapping relationship between the first node and the upper-level script interface instance.
[0057] The triggering operation for the first control can be a click operation (left mouse click operation, right mouse click operation), mouse hover operation, double click operation, touch operation, long press operation, etc., without specific limitations. Figure 2C The illustration shows a schematic diagram of an instance of the target upper-level script interface, that is, if the user clicks... Figure 2B The "Record the instance of the interface" control 221 can display... Figure 2C The target upper-level script interface example shown is shown. Figure 2C The GlobalData.uiAssistSelectedGUIComponent in the target is the upper-level script interface instance.
[0058] In one specific embodiment, the mapping relationship between the first node and the upper-level script interface instance indicates the correspondence between the node identifier of the first node and the static data, whereby the static data indicates the script file path of the script file of the corresponding upper-level script interface instance. In this embodiment, as... Figure 3 As shown, step 122 may include steps 310-340, which are detailed below:
[0059] Step 310: In response to the trigger operation of the first control, obtain static data associated with the node identifier of the target first node.
[0060] In this application, during the process of creating an upper-level script interface instance through a script, the static data of the created upper-level script interface instance is cached. Then, based on the node managed by the upper-level script interface instance (which is the first node), the node identifier of the managed lower-level node (i.e., the first node) is associated and stored with the static data of the upper-level script interface instance corresponding to that node.
[0061] Based on this, for the first node, if it is necessary to obtain the static data of the upper-level script interface instance associated with the first node, the node data associated with the node identifier of the first node is used as the static data of the upper-level script interface instance associated with the first node based on the mapping relationship between the node and the static data.
[0062] Correspondingly, for the first node, before step 310, the method further includes: caching the static data of the target upper-level script interface instance during the creation of the target upper-level script interface instance; and establishing a mapping relationship between the node identifier corresponding to the target first node and the static data of the target upper-level script interface instance based on the target first node managed by the target upper-level script interface instance.
[0063] The static data of the target upper-level script interface instance includes information such as encapsulation type, canvas name, module path, and click callback method name.
[0064] In a specific embodiment, if the engine layer node tree includes a first node, the encapsulation type and canvas name of the upper-level script interface instance to which the first node belongs can be displayed in the engine layer node tree. Figure 4 This is a schematic diagram of an engine layer node tree according to an embodiment of this application. Figure 4 The engine layer node tree shown includes the first node, which is associated with the upper-level script interface instance. Figure 4 The middle node tree window 210 shows the encapsulation type of the upper-level script interface instance associated with the three first nodes, namely... Figure 4 The portion selected by the first dashed box 410 in the middle. Figure 4 The document further shows the canvas name corresponding to the upper-level script interface instance associated with the first node, namely... Figure 4 The content within the second dashed box 420. Furthermore, during interface development, the interface can be marked to indicate specific information about it; for example, if a node is marked... Figure 4 The "Note" marker in the third dashed box 430 indicates that the developer has written a note in the canvas of this node, and this marker is used to remind the corresponding developer to check the note.
[0065] In some embodiments, before establishing the mapping relationship between the node identifier corresponding to the target first node and the static data of the target upper-level script interface instance based on the target first node managed by the target upper-level script interface instance, the method further includes: concatenating the control name of the control to which the target first node belongs, the class name of the class to which the target first node belongs, and the count of the target first node in the same level of nodes to obtain the node identifier corresponding to the target first node.
[0066] It is understandable that the engine layer tree includes multiple nodes arranged in a tree structure. Different nodes may have the same node name. For example, if multiple nodes represent controls, and the control name of the control represented by the node is used as the node identifier, then if there are nodes with the same control name, the corresponding node identifier will be duplicated. Therefore, in this embodiment, the control name of the control to which the first node belongs, the class name of the class to which the first node belongs, and the count of the first node in the same level of nodes are concatenated, and the concatenation result is used as the node identifier corresponding to the first node. This is equivalent to combining the information of the parent node to which the first node belongs and the information of the first node itself to determine the node identifier of the first node. This ensures that the node identifier determined for the first node can uniquely identify the first node in the engine layer node tree, avoiding the situation of duplicate node identifiers caused by duplicate control names of nodes.
[0067] Since the generated node identifier can uniquely identify the corresponding first node, the mapping relationship established based on the node identifier of the first node and the static data of its parent script interface instance is equivalent to constructing a one-to-one mapping from the first node to the parent script interface instance. This facilitates the first node in the engine layer nodes to obtain the corresponding parent script interface instance. After obtaining the parent script interface instance, its attributes and methods can be viewed, making it easier to debug the parent script interface instance.
[0068] Step 320: Determine the script file path of the script file corresponding to the upper-level script interface instance of the target based on the static data associated with the node identifier of the first node of the target.
[0069] Specifically, step 320 includes: obtaining the encapsulation type and module path from the static data associated with the node identifier of the target first node; concatenating the encapsulation type and module path to obtain the script file path of the script file corresponding to the target upper-level script interface instance.
[0070] Step 330: Obtain the script file corresponding to the target upper-level script interface instance based on the script file path.
[0071] It is understandable that the script file path indicates the storage location of the script file corresponding to the target upper-level script interface instance. Therefore, by accessing the file according to the script file path, the script file corresponding to the target upper-level script interface instance can be obtained.
[0072] Step 340: Display the target upper-level script interface instance based on the script file corresponding to the target upper-level script interface instance.
[0073] Specifically, in step 340, the script file corresponding to the target upper-level script interface instance is executed, that is, the instantiation of the encapsulated type is realized, which can be used to obtain the target upper-level script interface instance. For example, if the script file corresponding to the target upper-level script interface instance is written in Python, then the target upper-level script interface instance is mapped to the instantiated Python object.
[0074] In the above embodiment, when creating the upper-level script interface instance, the static data of the upper-level script interface instance is cached, and a mapping relationship is established between the static data of the upper-level script interface instance and the node identifier of the managed first node. Subsequently, if the upper-level script interface instance is edited (e.g., destroyed, moved, modified), the mapping relationship is updated synchronously. That is, if the upper-level script interface instance is destroyed, the mapping relationship can be deleted; if the upper-level script interface instance is modified, the static data in the mapping relationship is modified accordingly; if the node managed by the upper-level script interface instance is moved, the node identifier in the mapping relationship is updated accordingly. This is equivalent to realizing the dynamic management of weak references to the upper-level script interface instance, thereby ensuring the implementation of finding the upper-level script interface instance corresponding to the first node from the engine layer node tree.
[0075] In some embodiments, after obtaining the target upper-level script interface instance, the properties of the instance and its instance methods can be printed, thereby executing various functional logics of the game interface. This can not only effectively improve the development and iteration efficiency of the interface, but also help locate, debug and fix related exceptions (bugs) in the developed interface.
[0076] In the solution of this application, based on the display engine layer node tree, for the first node associated with the upper-level script interface instance, if the first node is triggered, the first interactive window displayed includes a first control for entering the upper-level script interface instance associated with the triggered first node. Then, by triggering the first control, the upper-level script interface instance associated with the first node can be displayed. This enables access to the upper-level script interface instance associated with a node through the node in the engine layer node tree, thereby facilitating the testing and debugging of the upper-level script interface instance and effectively improving the efficiency of interface development.
[0077] The solution proposed in this application can cache static data of upper-level script interface instances in the nodes of the engine layer node tree, and supports dynamic management of upper-level script interface instances, maintaining a one-to-one mapping relationship between engine layer nodes and upper-level script interface instances. Thus, the corresponding upper-level script interface instance can be obtained through the engine layer nodes displayed in the node tree preview tool. Furthermore, it can support the display of information of upper-level script interface instances and the debugging of the functional logic of upper-level script interface instances.
[0078] In related technologies, the first node (e.g., a Cocos node) managed by the encapsulated upper-level script interface instance can be obtained at any time, but it does not support finding the upper-level script interface instance to which the Cocos node belongs. In related technologies, if debugging of an upper-level script interface instance is required, the top-level script interface instance must first be obtained according to the UI framework within the project team, and then the upper-level interface instance to be debugged must be found step by step through class properties. For example, interface A (assigned to a) nests interface B (recorded in property b), and interface B nests interface C (recorded in property c). If interface C needs to be retrieved, a series of calls like a, b, and c are required, lacking a one-step operation to directly obtain interface C. However, the solution of this application, through the engine layer node tree, can directly access the upper-level script interface instance of the triggered first node based on the first control in the first interactive window. This effectively solves the problem of not supporting finding the upper-level script interface instance to which the Cocos node belongs in related technologies. Moreover, the access path is shorter, and it does not require spending a lot of time accessing the upper-level script interface instance, facilitating debugging and functional logic verification of the upper-level script interface instance.
[0079] In some embodiments, in the engine layer node tree, the encapsulation type and canvas name of the upper-level script interface instance associated with the first node can also be displayed for the first node, for example, according to... Figure 4 The display is done in the manner shown. This makes the hierarchical display of the engine layer node tree clearer, and allows for a more intuitive understanding of the organizational relationships between interfaces. For example, it shows which Cocos node interface A is attached to interface B; which encapsulated items are attached to the ScrollView (scrollbar), etc., thus improving the user experience for developers.
[0080] In some embodiments, the first interactive window further includes a second control; after step 121, the method further includes: in response to the triggering operation of the second control, opening the script file of the target upper-level script interface instance in the code editor, and locating the script code that defines the encapsulation type in the script file.
[0081] The second control is the entry point for script code of a defined encapsulated type within the target's upper-level basic interface instance corresponding to the first node. It can also be understood as a page element that can be triggered and accesses script code of a defined encapsulated type within the target's upper-level script interface instance. The second control can be presented as a button, a virtual icon, or an option in a menu.
[0082] Figure 5 This is a schematic diagram illustrating the display of a second control in a first interactive window according to an embodiment of this application, such as... Figure 5 As shown, the "Jump to Type" control 222 in the first interactive window 220 can be regarded as the second control in this application. Figure 2B The "Jump to Type" control 222 in the first interactive window 220 is also the second control in this application.
[0083] Specifically, such as Figure 6 As shown, this step includes the following steps 610-640:
[0084] Step 610: In response to the trigger operation on the second control, obtain the script file of the target upper-level script interface instance.
[0085] The process of obtaining the script file of the target upper-level script interface instance can be found in steps 310-330, and will not be repeated here.
[0086] Step 620: Generate an abstract syntax tree for the target upper-level script interface instance based on the script file of the target upper-level script interface instance.
[0087] An abstract syntax tree (AST) is a tree-like representation of the abstract syntactic structure of source code. Each node in the tree represents a structure in the source code. The AST does not represent every detail of the actual source code syntax. For example, nested parentheses are implicit in the tree structure and are not presented as nodes.
[0088] In a specific embodiment, the script file of the target upper-level script interface instance can be parsed to generate an abstract syntax tree (AST) for the target upper-level script interface instance. Furthermore, if the interface development engine is the Cocos-2dx game engine, the built-in `complie()` function can be used to generate the AST for the target upper-level script interface instance. Specifically, `ast.PyCF_ONLY_AST` is passed as a flag to the `complie()` function, which then generates the corresponding AST.
[0089] Step 630: Traverse the nodes of the abstract syntax tree to count the starting line number of the class node.
[0090] A class node is a node in the abstract syntax tree that defines a wrapper type, specifically the `ast.ClassDef` node. The start line number of the class node indicates the start and end line numbers of the script code defining the wrapper type in the script file, thus indicating the location of the script code defining the wrapper type within the script file.
[0091] Step 640: Open the script file of the target upper-level script interface instance in the code editor, and locate the script code that defines the encapsulation type in the script file according to the starting line number of the class node.
[0092] The code editor can be embedded within the UI development engine, allowing the code editor to be invoked within the UI development engine's display interface to open the script file of the target upper-level script UI instance. Based on the starting line number of the class node, it is possible to control the jump to the line containing the starting and ending line numbers of the class node in the code file, thereby locating the script code defining the encapsulated type in the script file.
[0093] In a specific implementation, automatic navigation to the script file defining the encapsulation type can be controlled using code jump commands in the code editor. For example, if the code editor is PyCharm, the code jump command is "start / b pycharm64.exe --line line number file path"; if the code editor is VSCode, the code jump command is "code --goto file path:line number". Here, the file path in the code jump command is the path to the script file, and the line number is the line number between the start and end of the class node.
[0094] In this embodiment, by triggering the second control in the first interactive window, the script file of the target upper-level script interface instance associated with the triggered first node can be automatically opened in the code editor, and the script code defining the encapsulation type in the script file can be automatically located. Thus, developers do not need to manually search for and locate the script code defining the encapsulation type in the script file.
[0095] In some embodiments, the first interactive window further includes a third control; after step 121, the method further includes: in response to the triggering operation of the third control, opening the script text of the target upper-level script interface instance in the code editor, and locating the script code in the script text that defines the click callback method.
[0096] The third control is the entry point for the script code that defines the click callback method in the target's upper-level basic interface instance corresponding to the first node. It can also be understood as a page element that can be triggered and used to enter the script code that defines the click callback method in the target's upper-level script interface instance. The third control can be presented as a button, a virtual icon, an option in a menu, etc.
[0097] Figure 7 This is a schematic diagram illustrating the display of a third control in a first interactive window according to an embodiment of this application, such as... Figure 7 As shown, the "Jump to Click Callback" control 223 in the first interactive window 220 can be regarded as the second control in this application.
[0098] Specifically, in response to a trigger operation on a third control, the script text of the target upper-level script interface instance is opened in the code editor, and the script code defining the click callback method is located in the script text. This may include the following steps A1-A4, which are detailed below:
[0099] Step A1: In response to the triggering operation of the third control, obtain the script file of the target upper-level script interface instance.
[0100] For details on how to obtain the script file of the target upper-level script interface instance, please refer to steps 310-330, which will not be repeated here.
[0101] Step A2: Generate an abstract syntax tree for the target upper-level script interface instance based on the script file of the target upper-level script interface instance.
[0102] Step A3: Traverse the nodes of the abstract syntax tree to count the starting line number of the method node.
[0103] A method node is a node in the abstract syntax tree that defines a click callback method, specifically the `ast.FunctionDef` node. Similarly, the start and end line numbers of the method node indicate the start and end line numbers of the script code defining the click callback method within the script file; in other words, they indicate the location of the script code defining the click callback method within the script file.
[0104] Step A4: Open the script file of the target upper-level script interface instance in the code editor, and locate the script code that defines the click callback method in the script file according to the starting line number of the method node.
[0105] Similarly, you can use code jump commands in your code editor to control automatic jumps to the script file that defines the encapsulation type. For example, if the code editor is PyCharm, the code jump command is "start / bpycharm64.exe --line line number file path"; if the code editor is VSCode, the code jump command is "code --goto file path:line number". Here, the file path in the code jump command is the path to the script file, and the line number is the line number between the start and end of the method node.
[0106] In this embodiment, by triggering the second control in the first interactive window, the script file of the target upper-level script interface instance associated with the triggered first node can be automatically opened in the code editor, and the script code defining the encapsulation type in the script file can be automatically located. Thus, developers do not need to manually search for and locate the script code defining the encapsulation type in the script file.
[0107] In some embodiments, the method further includes: in response to a triggering operation on the first control, displaying a node tree of the target upper-level script interface instance; in response to a triggering operation on a node in the node tree of the target upper-level script interface instance, displaying attribute information of the triggered node in an attribute window for attribute editing in the attribute window.
[0108] In this embodiment, common attributes or methods in the upper-level script interface instance can be encapsulated, so that the encapsulated common attributes or methods can be regarded as nodes in the node tree of the target upper-level script interface instance. In this way, the attributes of the triggered node can be edited by triggering a node in the node tree of the target upper-level script interface instance.
[0109] Figure 8 This is a schematic diagram of the node tree of a target upper-level script interface instance according to an embodiment of this application. If triggered... Figure 8 The node “PanelBtnl_1” displayed in the node tree window 210 can be viewed in the properties window. Figure 9 The information shown is the attribute information of the triggered node.
[0110] Based on the property information displayed in the property window, various script-level functional debugging can be completed through custom property reading and writing of the upper-level script interface instance, instead of being limited to modifying properties at the Cocos engine level.
[0111] In other embodiments, the method further includes: displaying a node tree of the target upper-level script interface instance in response to a triggering operation on the first control; and displaying the animation object corresponding to the triggered animation object node in the animation editing window in response to a triggering operation on an animation object node in the node tree of the target upper-level script interface instance.
[0112] An animation object node is a node that defines an animation object. Based on the animation object corresponding to the triggered animation object node displayed in the animation editing window, the animation object can be edited. Animation objects include, for example, sound effects. Specifically, after obtaining the target parent script interface instance, the ActionTimeline object (i.e., the animation object) of the current node can be managed through provided properties, the animation object can be obtained through the getAction method, and then the animation editing window can be accessed.
[0113] Figure 10A This is a schematic diagram of the node tree of the target upper-level script interface instance according to another embodiment of this application. If triggered... Figure 10A The animation object node "Node (GActionTimeLine)" displayed in the node tree window 210 can be accessed. Figure 10B The animation editing window shown is in Figure 10B The animation editing window shown allows you to edit the UI animation timeline and adjust animation playback and other functions.
[0114] The following describes an apparatus embodiment of this application, which can be used to perform the methods described in the above embodiments of this application. For details not disclosed in the apparatus embodiments of this application, please refer to the method embodiments described in the above embodiments of this application.
[0115] Figure 11 This is a block diagram of an interface display device according to an embodiment of this application, such as... Figure 11 As shown, the interface display device includes: a first display module 1110, used to display an engine layer node tree, the engine layer node tree including at least one first node, the first node being a node associated with an upper-level script interface instance; and a second display module 1120, used to determine and display a target upper-level script interface instance based on the mapping relationship between the first node and the upper-level script interface instance in response to a triggering operation on a target first node in the engine layer node tree, the target upper-level script interface instance being the upper-level script interface instance associated with the triggered target first node.
[0116] In some embodiments, the second display module 1120 includes: a first display unit, configured to display a first interactive window in response to a trigger operation on a target first node in the engine layer node tree, the first interactive window including a first control; and a second display unit, configured to display a target upper-level script interface instance in response to a trigger operation on the first control, based on the mapping relationship between the first node and the upper-level script interface instance.
[0117] In some embodiments, the mapping relationship between the first node and the upper-level script interface instance indicates the correspondence between the node identifier of the first node and static data, and the static data indicates the script file path of the script file of the corresponding upper-level script interface instance; the second display unit includes: a static data acquisition unit, used to acquire static data associated with the node identifier of the target first node in response to a trigger operation of the first control; a script file path determination unit, used to determine the script file path of the script file corresponding to the target upper-level script interface instance based on the static data associated with the node identifier of the target first node; a script file acquisition unit, used to acquire the script file corresponding to the target upper-level script interface instance based on the script file path; and a display unit, used to display the target upper-level script interface instance based on the script file corresponding to the target upper-level script interface instance.
[0118] In some embodiments, the script file path determination unit includes: a first acquisition unit, configured to acquire the encapsulation type and module path from static data associated with the node identifier of the target first node; and a splicing unit, configured to splice the encapsulation type and module path to obtain the script file path of the script file corresponding to the target upper-level script interface instance.
[0119] In some embodiments, the first interactive window further includes a second control; the interface display device further includes: a first code display module, configured to, in response to a trigger operation on the second control, open the script file of the target upper-level script interface instance in the code editor and locate the script code defining the encapsulation type in the script file.
[0120] In some embodiments, the first code display module includes: a second acquisition unit, configured to acquire the script file of the target upper-level script interface instance in response to a trigger operation on the second control; an abstract syntax tree generation unit, configured to generate an abstract syntax tree of the target upper-level script interface instance based on the script file of the target upper-level script interface instance; a first traversal unit, configured to traverse the nodes of the abstract syntax tree to count the starting line number of the class node; and a first positioning unit, configured to open the script file of the target upper-level script interface instance in the code editor and locate the script code defining the encapsulated type in the script file based on the starting line number of the class node.
[0121] In some embodiments, the first interactive window further includes a third control; the interface display device further includes: a second code display module, configured to, in response to a trigger operation on the third control, open the script text of the target upper-level script interface instance in the code editor, and locate the script code in the script text that defines the click callback method.
[0122] In some embodiments, the second code display module includes: a third acquisition unit, configured to acquire the script file of the target upper-level script interface instance in response to a trigger operation on a third control; an abstract syntax tree generation unit, configured to generate an abstract syntax tree of the target upper-level script interface instance based on the script file of the target upper-level script interface instance; a second traversal unit, configured to traverse the nodes of the abstract syntax tree to count the starting line number of the method node; and a second positioning unit, configured to open the script file of the target upper-level script interface instance in a code editor and locate the script code that defines the click callback method in the script file based on the starting line number of the method node.
[0123] In some embodiments, the interface display device further includes: a third display module, configured to display a node tree of the target upper-level script interface instance in response to a trigger operation on the first control; and an attribute window display module, configured to display attribute information of the triggered node in the attribute window in response to a trigger operation on a node in the node tree of the target upper-level script interface instance, so as to perform attribute editing in the attribute window.
[0124] In other embodiments, the interface display device further includes: a fourth display module, configured to display the node tree of the target upper-level script interface instance in response to a trigger operation on the first control; and an animation object display module, configured to display the animation object corresponding to the triggered animation object node in the animation editing window in response to a trigger operation on the animation object node in the node tree of the target upper-level script interface instance.
[0125] In some embodiments, the interface display device further includes: a caching module, used to cache the static data of the target upper-level script interface instance during the creation of the target upper-level script interface instance; and a mapping relationship establishment module, used to establish a mapping relationship between the node identifier corresponding to the target first node and the static data of the target upper-level script interface instance based on the target first node managed by the target upper-level script interface instance.
[0126] In some embodiments, the interface display device further includes: a node identifier generation module, used to concatenate the control name of the control to which the target first node belongs, the class name of the class to which the target first node belongs, and the count of the target first node in the same level of nodes to obtain the node identifier corresponding to the target first node.
[0127] Figure 12This is a schematic diagram of an electronic device according to an embodiment of this application. The electronic device can be a desktop computer, laptop computer, or other terminal, used to execute the interface display method provided in this application.
[0128] like Figure 12 As shown, the electronic device may include: a processor 1201, such as a CPU; a network interface 1204; a user interface 1203; a memory 1205; and a communication bus 1202. The communication bus 1202 is used to enable communication between these components. The user interface 1203 may include a display screen and an input unit such as a keyboard. Optionally, the user interface 1203 may also include a standard wired interface or a wireless interface. The network interface 1204 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1205 may be high-speed RAM or non-volatile memory, such as a disk drive. Optionally, the memory 1205 may also be a storage device independent of the aforementioned processor 1201.
[0129] Those skilled in the art will understand that Figure 12 The structure of the electronic device shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0130] like Figure 12 As shown, the memory 1205, which is a computer-readable storage medium, may include an operating system, a network communication module, a user interface module, and a program for implementing the interface display method.
[0131] exist Figure 12 In the illustrated electronic device, the network interface 1204 is mainly used for communication connections with other devices, such as the server of the interface development engine. The user interface 1203 is mainly used for connecting to the client (user end) and communicating data with the client; while the processor 1201 can be used to call the program storing the interface display method in the memory 1205 and execute the steps of the interface display method as in any of the above method embodiments.
[0132] According to one aspect of the embodiments of this application, a computer-readable storage medium is provided, on which computer-readable instructions are stored, which, when executed by a processor, implement the interface display method as described in any of the above method embodiments.
[0133] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0134] According to one aspect of the embodiments of this application, a computer program product is provided, which includes computer instructions that, when executed by a processor, implement the interface display method as described in any of the above method embodiments.
[0135] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0136] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0137] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the method according to the embodiments of this application.
[0138] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0139] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. An interface display method characterized by, The method comprises the following steps: displaying an engine layer node tree, the engine layer node tree comprising at least one first node, the first node being a node associated with an upper layer script interface instance; the upper layer script interface instance being a script object obtained by instantiating an upper layer script encapsulation interface; the engine layer node tree being a node tree of a structure of a presentation interface obtained by interface development through an interface development engine, and storing a mapping relationship between the first node and the upper layer script interface instance, the mapping relationship indicating a corresponding relationship between a node identifier of the first node and static data, the static data indicating a script file path of a script file corresponding to the upper layer script interface instance; in response to a triggering operation on a target first node in the engine layer node tree, displaying a first interaction window, the first interaction window comprising a first control; in response to a triggering operation on the first control, obtaining the static data associated with the node identifier of the target first node, and determining a script file path of a target upper layer script interface instance corresponding script file according to the static data associated with the node identifier of the target first node, obtaining the script file corresponding to the target upper layer script interface instance according to the script file path, and displaying the target upper layer script interface instance based on the script file corresponding to the target upper layer script interface instance, the target upper layer script interface instance being the upper layer script interface instance associated with the target first node that is triggered.
2. The method of claim 1, wherein, The method comprises the following steps: obtaining an encapsulation type and a module path from the static data associated with the node identifier of the first node; splicing the encapsulation type and the module path to obtain the script file path of the target upper layer script interface instance corresponding script file.
3. The method of any one of claims 1-2, wherein, The first interaction window further comprises a second control; after displaying the first interaction window in response to the triggering operation on the target first node in the engine layer node tree, the method further comprises the following steps: in response to a triggering operation on the second control, opening the script file of the target upper layer script interface instance in a code editor, and positioning to script code defining the encapsulation type in the script file.
4. The method of claim 3, wherein, The method comprises the following steps: in response to a triggering operation on the second control, obtaining the script file of the target upper layer script interface instance; generating an abstract syntax tree of the target upper layer script interface instance according to the script file of the target upper layer script interface instance; traversing nodes of the abstract syntax tree to count a starting line number of a class node; opening the script file of the target upper layer script interface instance in the code editor, and positioning to the script code defining the encapsulation type in the script file according to the starting line number of the class node.
5. The method of any one of claims 1 to 2, wherein, The first interaction window further comprises a third control; After displaying the first interactive window in response to a trigger operation on the target first node in the engine layer node tree, the method further includes: In response to the triggering operation of the third control, the script text of the target upper-level script interface instance is opened in the code editor, and the script code defining the click callback method in the script text is located.
6. The method of claim 5, wherein, In response to the triggering operation of the third control, the script text of the target upper-level script interface instance is opened in the code editor, and the script code defining the click callback method in the script text is located, including: In response to a trigger operation on the third control, the script file of the target upper-level script interface instance is obtained; Based on the script file of the target upper-level script interface instance, generate the abstract syntax tree of the target upper-level script interface instance; Traverse the nodes of the abstract syntax tree to count the starting line number of the method node; Open the script file of the target upper-level script interface instance in the code editor, and locate the script code that defines the click callback method in the script file according to the starting line number of the method node.
7. The method of claim 1, wherein, The method further includes: In response to the trigger operation on the first control, the node tree of the target upper-level script interface instance is displayed; In response to a trigger operation of a node in the node tree of the target upper-level script interface instance, the attribute information of the triggered node is displayed in the attribute window for attribute editing.
8. The method of claim 1, wherein, The method further includes: In response to the trigger operation on the first control, the node tree of the target upper-level script interface instance is displayed; In response to the triggering operation of the animation object node in the node tree of the target upper-level script interface instance, the animation object corresponding to the triggered animation object node is displayed in the animation editing window.
9. The method of claim 1, wherein, The method further includes: During the creation of the target upper-level script interface instance, the static data of the target upper-level script interface instance is cached; Based on the target first node managed by the target upper-level script interface instance, establish a mapping relationship between the node identifier corresponding to the target first node and the static data of the target upper-level script interface instance.
10. The method of claim 9, wherein, Before establishing the mapping relationship between the node identifier corresponding to the target first node and the static data of the target upper-level script interface instance based on the target first node managed by the target upper-level script interface instance, the method further includes: The node identifier corresponding to the first target node is obtained by concatenating the control name of the control to which the first target node belongs, the class name of the class to which the first target node belongs, and the count of the first target node in the same level of nodes.
11. An interface display device, characterized by include: The first display module is used to display the engine layer node tree, which includes at least one first node, which is a node associated with an upper-level script interface instance; the upper-level script interface instance is a script object obtained by instantiating the upper-level script encapsulation interface; the engine layer node tree is a node tree of the structure of the presented interface obtained by developing the interface through the interface development engine, and stores the mapping relationship between the first node and the upper-level script interface instance, the mapping relationship indicating the correspondence between the node identifier of the first node and static data, and the static data indicating the script file path of the script file of the corresponding upper-level script interface instance; The second display module is configured to, in response to a trigger operation on a target first node in the engine layer node tree, display a first interactive window, the first interactive window including a first control; in response to a trigger operation on the first control, acquire static data associated with the node identifier of the target first node, and determine the script file path of the script file corresponding to the target upper-level script interface instance based on the static data associated with the node identifier of the target first node, acquire the script file corresponding to the target upper-level script interface instance based on the script file path, and display the target upper-level script interface instance based on the script file corresponding to the target upper-level script interface instance, wherein the target upper-level script interface instance refers to the upper-level script interface instance associated with the triggered target first node.
12. An electronic device, comprising: include: processor; A memory storing computer-readable instructions that, when executed by the processor, implement the method as described in any one of claims 1 to 10.
13. A computer-readable storage medium having stored thereon computer-readable instructions, wherein, When the computer-readable instructions are executed by a processor, the method as described in any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Interface view display method, terminal equipment and computer readable storage medium
CN114489619A
