Method, apparatus, storage medium and electronic device for generating user interaction interface

CN115729549BActive Publication Date: 2026-09-22NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211520127.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-30
Publication Date
2026-09-22
Estimated Expiration
2042-11-30

AI Technical Summary

Technical Problem

[0003]针对上述的问题,目前尚未提出有效的解决方案

Benefits of technology

[0009]在本公开至少部分实施例中,在获取待加载的用户交互界面文件后,基于多个控件的控件数据,从多个控件数据中确定第一目标控件数据;通过仅对第一用户交互界面的显示内容包含的第一控件的控件数据进行反序列处理,生成第一用户交互界面,无需对所有控件数据全部进行反序列化,从而达到降低需要进行反序列化处理的数据量的目的,从而实现了减少反序列化的过程中占用的内存的技术效果,进而解决了游戏的用户交互界面的生成过程中进行反序列化,占用大量内存,引起游戏卡顿或闪退的技术问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115729549B_ABST
    Figure CN115729549B_ABST
Patent Text Reader

Abstract

The present disclosure discloses a method, device, storage medium and electronic device for generating a user interaction interface. The method comprises: obtaining a user interaction interface file to be loaded, wherein the user interaction interface file to be loaded comprises control data of a plurality of controls; determining, based on the control data of the plurality of controls, first target control data corresponding to a first target control that needs to be displayed from the control data of the plurality of controls; and performing deserialization processing on the control data of the first target control to generate a first user interaction interface, wherein the display content of the first user interaction interface comprises the first target control. The present application solves the technical problem that a large amount of memory is occupied during deserialization in the generation process of the user interaction interface of the game, causing game lag or crash.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of game development technology, and more specifically, to a method, apparatus, storage medium, and electronic device for generating a user interface. Background Technology

[0002] The process of restoring a byte sequence into an object is called deserialization. Currently, during game operation, it is necessary to deserialize the byte stream data describing UI (User Interface) controls to generate the user interface in the game. However, the above deserialization process usually consumes a lot of memory, causing technical problems such as game lag or crashes.

[0003] There is currently no effective solution to the above problems. Summary of the Invention

[0004] This disclosure provides at least some embodiments of a method, apparatus, storage medium, and electronic device for generating a user interface, in order to at least solve the technical problem that deserialization during the generation of a game's user interface consumes a large amount of memory, causing the game to lag or crash.

[0005] According to one embodiment of this disclosure, a method for generating a user interface is provided, comprising: obtaining a user interface file to be loaded, wherein the user interface file to be loaded includes control data of multiple controls; determining first target control data corresponding to a first target control to be displayed from the control data of the multiple controls; performing deserialization processing on the control data of the first target control to generate a first user interface, wherein the display content of the first user interface includes the first target control.

[0006] According to one embodiment of this disclosure, an apparatus for generating a user interface is also provided, comprising: an acquisition module for acquiring a user interface file to be loaded, wherein the user interface file to be loaded includes control data of multiple controls; a determination module for determining, from the control data of the multiple controls, first target control data corresponding to a first target control to be displayed; and a generation module for deserializing the control data of the first target control to generate a first user interface, wherein the display content of the first user interface includes the first target control.

[0007] According to one embodiment of the present disclosure, a computer-readable storage medium is also provided, which stores a computer program, wherein the computer program is configured to execute the method for generating a user interface as described above when running.

[0008] According to one embodiment of this disclosure, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the method of generating a user interface as described above.

[0009] In at least some embodiments of this disclosure, after obtaining the user interface file to be loaded, a first target control data is determined from the control data of multiple controls. By deserializing only the control data of the first control contained in the display content of the first user interface, the first user interface is generated without deserializing all control data, thereby reducing the amount of data that needs to be deserialized. This achieves the technical effect of reducing the memory occupied during the deserialization process, and solves the technical problem that deserialization during the generation of the game's user interface occupies a lot of memory, causing the game to lag or crash. Attached Figure Description

[0010] The accompanying drawings, which are included to provide a further understanding of this disclosure and form part of this application, illustrate exemplary embodiments of this disclosure and are used to explain this disclosure, but do not constitute an undue limitation of this disclosure. In the drawings:

[0011] Figure 1 This is a hardware structure block diagram of a mobile terminal for a method of generating a user interface according to an embodiment of the present disclosure.

[0012] Figure 2 This is a flowchart of a method for generating a user interface according to one embodiment of the present disclosure;

[0013] Figure 3a This is a flowchart illustrating a method for generating a user interface in a preferred embodiment of this disclosure.

[0014] Figure 3b This is a schematic diagram of the specific process of step S301 in a preferred embodiment of this disclosure;

[0015] Figure 3c This is a schematic flowchart of step S302 in a preferred embodiment of the present disclosure;

[0016] Figure 4 This is a structural block diagram of an apparatus for generating a user interface according to one embodiment of the present disclosure;

[0017] Figure 5 This is a schematic diagram of an electronic device according to an embodiment of the present disclosure. Detailed Implementation

[0018] To enable those skilled in the art to better understand the present disclosure, the technical solutions of the present disclosure will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of the present disclosure, and not all embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present disclosure.

[0019] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0020] In one possible implementation, in the context of game development technology, when loading UI files, the commonly used method is to indiscriminately deserialize all UI controls described in the UI file, regardless of whether they are actually used, to generate game engine nodes. After practical experience and careful research, the inventors found that this approach consumes a significant amount of time and memory during the deserialization process, severely impacting game quality. Therefore, this disclosure proposes a method for generating a user interface. After obtaining the user interface file to be loaded, based on the control data of multiple controls, a first target control data is determined from the control data. By deserializing only the control data of the first control included in the display content of the first user interface, the first user interface is generated without deserializing all control data. This reduces the amount of data requiring deserialization, shortens the processing time for each deserialization, and reduces the memory consumed during deserialization. This solves the technical problem of deserialization during the generation of the game's user interface, which consumes a large amount of memory and causes game lag or crashes.

[0021] The methods and embodiments described above in this disclosure can be executed on mobile terminals, computer terminals, or similar computing devices. Taking a mobile terminal as an example, the mobile terminal can be a smartphone, tablet computer, PDA, mobile internet device, PAD, game console, or other terminal device. Figure 1 This is a hardware structure block diagram of a mobile terminal for a method of generating a user interface according to an embodiment of this disclosure. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. Processor 102 (processor 102 may include, but is not limited to, a central processing unit (CPU), graphics processing unit (GPU), digital signal processing (DSP) chip, microprocessor (MCU), programmable logic device (FPGA), neural network processor (NPU), tensor processor (TPU), artificial intelligence (AI) type processor, etc.) and memory 104 for storing data. In one embodiment of this disclosure, it may also include: input / output device 108 and display device 110.

[0022] In some optional embodiments primarily focused on gaming scenarios, the aforementioned device may also provide a human-computer interaction interface with a touch-sensitive surface. This interface can sense finger contact and / or gestures to interact with a graphical user interface (GUI). The human-computer interaction functions may include the following: creating web pages, drawing, word processing, creating electronic documents, playing games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music, and / or web browsing, etc. Executable instructions for performing the aforementioned human-computer interaction functions are configured / stored in one or more processor-executable computer program products or readable storage media.

[0023] Those skilled in the art will understand that Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0024] According to one embodiment of this disclosure, an embodiment of a method for generating a user interface is provided. It should be noted that the steps shown in the flowcharts in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in a different order than that shown here.

[0025] In one possible implementation, embodiments of this disclosure provide a method for generating a user interface, which provides the user interface through a terminal device. Figure 2This is a flowchart of a method for generating a user interface according to one embodiment of the present disclosure, such as... Figure 2 As shown, the method includes the following steps:

[0026] Step S202: Obtain the user interface file to be loaded, wherein the user interface file to be loaded includes control data of multiple controls.

[0027] Specifically, the aforementioned user interface file to be loaded can be a memory image stored in memory, and can be obtained by parsing the byte stream data to be loaded. This byte stream data can be a byte stream file pre-stored in the game's application package. The aforementioned controls are controls displayed in the user interface for user use, such as sliders and buttons. The aforementioned control data can be the data required to generate the controls, stored in memory.

[0028] It should be noted that the byte stream files in the game package are stored in units of user interfaces. Each user interface has a unique name. The user interface files to be loaded are obtained by parsing the byte stream files. Accordingly, the filename of the user interface file can be the user interface name. For example, if the byte stream file describing interface A is named "A's Name", then the filename of the user interface file for interface A is also "A's Name". Therefore, the user interface file can be found by its name. Furthermore, each user interface file to be loaded includes control data for multiple controls required to load that user interface.

[0029] In one optional embodiment, when the terminal device needs to display the user interface in the game, it first needs to obtain the target file name, i.e. the name of the user interface to be loaded, and confirm whether there is a target memory image corresponding to the target file name in the cache data based on the user interface name. If there is a target memory image in the cache data, the target memory image is determined as the user interface file to be loaded; if there is no target memory image in the cache data, the byte stream data to be loaded corresponding to the target file name can be mapped to obtain the aforementioned user interface file to be loaded, and then the user interface is generated based on the user interface file to be loaded.

[0030] Step S204: Determine the first target control data corresponding to the first target control to be displayed from the control data of multiple controls.

[0031] Specifically, the control data of the aforementioned multiple controls includes multiple control properties, which are used to characterize whether the multiple controls are included in the display content of the first user interface.

[0032] It should be noted that although each user interface file to be loaded includes control data for multiple controls, it may not be necessary to display all controls included in the user interface file when displaying its corresponding first user interface. For example, some controls may have incompatible relationships and cannot be displayed simultaneously. The aforementioned first target control refers to the controls that should be displayed in the first user interface by default when the user first opens the first user interface and has not yet performed any operations.

[0033] In an optional embodiment, when the property of the current control among multiple controls is that the current control is included in the displayed content, the current control is confirmed as the first target control, and the control dataset of the current control is the first target control data.

[0034] Step S206: Deserialize the control data of the first target control to generate a first user interface, wherein the display content of the first user interface includes the first target control.

[0035] In one optional embodiment, a game engine is used to deserialize the control data of the first target control to generate a game engine node corresponding to the first target control; and based on the control data of other controls, a first proxy node corresponding to other controls is generated, wherein the other controls are used to represent controls other than the first target control among multiple controls, that is, controls not included in the display content of the first user interaction interface. Then, a first node tree composed of the first game engine node and the first proxy node is obtained, and the first user interaction interface is generated based on the first node tree.

[0036] Optionally, after generating the first game engine node corresponding to the first target control, the method further includes: deleting the first target control data stored in the cache data.

[0037] In one optional embodiment, after generating the first user interface, if an update instruction is received that acts on the first user interface, for example, an update instruction triggered by a user clicking a control on the first user interface, or an update instruction triggered when the display time of the first user interface reaches a preset duration, then the second target control contained in the display content of the second interface can be determined according to the update instruction. If the node corresponding to the target control is a first proxy node, then the control data corresponding to the second target control is deserialized to generate a second game engine node, and the second game engine node replaces the first proxy node that is the target node in the first node tree to obtain a second node tree; based on the second node tree, the second user interface is generated.

[0038] As an alternative implementation, if the game engine is the Cocos engine, the aforementioned game engine node can be a Cocos node.

[0039] In the above embodiments of this disclosure, after obtaining the user interaction interface file to be loaded, the first target control data is determined from the control data of multiple controls based on the control data of multiple controls; by deserializing only the control data of the first control contained in the display content of the first user interaction interface, the first user interaction interface is generated without deserializing all control data, thereby reducing the amount of data that needs to be deserialized, thus achieving the technical effect of reducing the memory occupied during the deserialization process, and thus solving the technical problem that deserialization during the generation of the game's user interaction interface occupies a lot of memory, causing the game to lag or crash.

[0040] Optionally, the user interface file to be loaded is obtained, wherein the user interface file to be loaded includes control data of multiple controls, including: obtaining the target file name, wherein the target file name is used to represent the name of the user interface to be loaded; in response to the existence of a target memory image in the cached data, determining the target memory image as the user interface file to be loaded, wherein the target memory image is used to represent the memory image corresponding to the target file name; in response to the absence of a target memory image in the cached data, obtaining the byte stream file to be loaded corresponding to the target file name, and mapping the byte stream file to be loaded to obtain the user interface file to be loaded.

[0041] Specifically, the aforementioned cached data can be a deserialization dependency cache, which is essentially a memory image obtained by mapping the byte stream file to be loaded into memory. Upon obtaining the target file name, the cached data can be searched for the existence of a target memory image. If the target memory image exists in the cached data, it is directly confirmed as the user interface file to be loaded. If the target memory image file does not exist in the cached data, the byte stream file corresponding to the target file name can be obtained from the game application package, mapped, and the resulting memory image used as the user interface file to be loaded.

[0042] In the above optional embodiments, the user interface file to be loaded can be directly obtained from the cached data according to the target file name, without having to map the byte stream file to be loaded every time during the loading process, thereby achieving the technical effect of improving the generation efficiency of the user interface.

[0043] Optionally, the user interface file to be loaded further includes: properties of multiple controls, which are used to characterize whether the multiple controls are included in the display content of the first user interface. The first target control data corresponding to the first target control to be displayed is determined from the control data of the multiple controls. This includes: in response to the property of the current control among the multiple controls being included in the display content, confirming that the control data of the current control is the first target control data, wherein the current control is any one of the multiple controls.

[0044] Specifically, the aforementioned attributes can be set by the staff during the development of the game program package based on the actual display requirements of the interface. If the current CNC's attributes are included in the display content of the first user interface, and the current control is confirmed as the first target control, then the control data of the current control is the first target control data.

[0045] Optionally, the method further includes: in response to the current control's property being that the current control is not included in the displayed content, confirming that the control data of the current control is the control data of another control.

[0046] Specifically, if the current control's property is that it is not included in the display content of the first user interface, it means that the current control does not need to be displayed when the first user interface is displayed, and the control data of the current control is confirmed to be the control data of other controls.

[0047] Optionally, the user interface file to be loaded also includes: the relationship between multiple controls, and the control data of the current control that is confirmed to be the control data of other controls in response to the property of the current control being not included in the display content. This includes: the control data of the current control that is confirmed to be the control data of other controls in response to the property of the current control being not included in the display content and the property of the associated control that is associated with the current control being not included in the display content.

[0048] Specifically, the byte stream file within the game's application package already contains the mapping between pages and controls, as well as the mapping relationships between multiple controls on each page. Therefore, when loading the user interface file to be loaded, the structure of the node tree corresponding to each user interface corresponds to the above mapping relationships. Taking the current control as a child control as an example, the associated control can be the parent control of the child control. Correspondingly, in the node tree, the associated control can be the control of the parent node of the node corresponding to the child control. A child control is a control attached to a parent control. For example, if a panel control has a button control on it, then the panel is the parent control, and the button is the child control. A parent control can have multiple child controls, but a child control can only have one parent control. When both the panel control and the button control have the property that they are not included in the displayed content, the button control's control data is confirmed to be other control data.

[0049] In addition, it should be noted that if the current control does not have a corresponding parent control, then if the current control's property is that the current control is not included in the display content of the first user interface, the control data of the current control is determined to be the control data of other controls.

[0050] Optionally, the data of the first target control is deserialized to generate a first user interface, including: deserializing the control data of the first target control to generate a first game engine node corresponding to the first target control; generating a first proxy node corresponding to other controls based on the control data of other controls, wherein the other controls are used to represent controls other than the first target control among multiple controls; generating a first node tree based on the first game engine node and the first proxy node; and generating the first user interface based on the first node tree.

[0051] Specifically, the other controls mentioned above can be controls that are not included in the display content of the first user interface.

[0052] In an optional embodiment, the byte stream file in the game program package already contains the mapping between pages and controls, as well as the mapping relationship between multiple controls on each page. Therefore, when loading the user interface file to be loaded, the control data of the first target control is deserialized to generate a first game engine node, and a first proxy node is generated based on the control data of other controls. It should be noted that during the above loading process, the above mapping relationship can be mapped between the first proxy node and the first game engine node to form a first node tree structure. After the multiple control data in the user interface file to be loaded are converted into nodes, the above first node tree is obtained, and the first user interface is generated based on the first node tree.

[0053] Optionally, after generating the first user interface, the method further includes: responding to an update instruction applied to the first user interface, determining a second target control to be displayed from multiple controls; responding to the first node tree where the target node corresponding to the second target control is a first proxy node, deserializing the control data of the second target control to generate a second game engine node; replacing the target node in the first node tree with the second game engine node to obtain a second node tree; and generating the second user interface based on the second node tree.

[0054] Specifically, the update command can be a user operation command, such as a user clicking the "Next Page" control on the first user interface, or it can be a command triggered by preset display rules, such as an update command triggered when the display time of the first user interface reaches a preset duration. Upon receiving the update command, the target node can be determined from the first node tree based on the key information of the node included in the update command (such as the node name, label, and the corresponding animation label). Furthermore, if the target node is a first game engine node, the first game engine node can be directly returned.

[0055] In addition, after generating the second game engine node, the control data of the second target control in the cache data can be deleted, and the memory space occupied by the first proxy node, which is the target node, can be released.

[0056] Optionally, replacing the target node in the first node tree with a second game engine node to obtain a second node tree includes: deleting the target node in the first node tree; and attaching the second game engine node to the position corresponding to the target node in the first node tree to obtain the second node tree.

[0057] Specifically, during the update of the first node tree, if the target node is the first proxy node, the first proxy node that is the target node can be deleted from the first node tree, and the second game engine node can be attached to the position of the target node in the first proxy node.

[0058] Furthermore, if the target node is the first Cocos node, then no processing is required for this target node.

[0059] In a preferred embodiment of this disclosure, Figure 3a This is a flowchart illustrating a method for generating a user interface according to a preferred embodiment of the present disclosure. The method includes:

[0060] Step S301: Based on the obtained UI file, generate a first UI node tree containing a first Cocos node and a first Proxy node, wherein the UI file is a UI file stored in the game program package.

[0061] In step S302, in response to the use of the first Proxy node, the UI control associated with the first Proxy node is deserialized to generate a second Cocos node, and the second Cocos node is used to replace the first Proxy node.

[0062] Specifically, Figure 3b This is a schematic flowchart of step S301 in a preferred embodiment of this disclosure, as shown below. Figure 3b As shown, step S301 includes the following steps:

[0063] Step S3011: Obtain the loading scheme, as well as the current UI file name and UI file to be loaded corresponding to the loading scheme.

[0064] Step S3012: Based on the UI filename, determine whether the control data corresponding to the UI filename exists in the deserialization dependency cache. It should be noted that the aforementioned deserialization dependency cache is used to represent the memory image (i.e., control data) obtained by parsing the UI file.

[0065] If the deserialization dependency cache contains control data corresponding to the UI file name, then proceed to step S3013; otherwise, if the deserialization dependency cache does not contain control data corresponding to the UI file name, then proceed to step S3014.

[0066] Step S3013: Based on the current iterator's position, read the control data of the current UI control from the control set described in the UI file. It should be noted that the control set described in the UI file is a collection of control data for multiple controls obtained by parsing the UI file. This collection can be understood as a list of control data, and the iterator can read data sequentially from this list.

[0067] Step S3014: Parse the UI file corresponding to the UI file name, generate the control data corresponding to the UI file name, and then execute step S3013.

[0068] Step S3015: Determine whether the control data of the current UI control needs to be deserialized.

[0069] Specifically, the following methods can be used to determine whether UI control data needs deserialization: First, the UI control is not included in the displayed content of the current user interface, meaning its data is not rendered; second, the UI control's parent control is also not included in the displayed content of the current user interface, meaning its parent control is also not rendered. If a UI control meets both of these conditions, then its data does not need deserialization. It should be noted that if the UI control does not have a parent control, then the UI control's data only needs to meet the first condition to determine that its data does not need deserialization.

[0070] If deserialization is required, proceed to step S3016; otherwise, proceed to step S3017.

[0071] Step S3016: Deserialize the control data of the UI control to generate the first Cocos node.

[0072] Specifically, after generating the first Cocos node, you can delete the control data used to generate the first Cocos node from the deserialization dependency cache.

[0073] Step S3017: Generate the first Proxy node corresponding to the control data of the UI control.

[0074] It's important to note that in the original Cocos deserialization scheme, all Cocos nodes are deserialized and generated all at once when the UI file is loaded. However, in this application, the node tree generated by loading the UI file contains Proxy nodes. Due to the existence of Proxy nodes, deserialization is not completed during the loading process. Therefore, it is necessary to modify the lifecycle of some data objects. Simultaneously, to save memory, it is necessary to ensure that only one copy of the data exists in memory. Based on this idea, this scheme designs a caching mechanism with reference counting. The UI file path in the Proxy node is used as the key to store the corresponding file data object. The reference count is incremented by 1 whenever a Proxy node is created, and decremented by 1 when a Proxy node is converted into a Cocos node or destroyed. This ensures that the lifecycle of the cached data is consistent with the entire Cocos node tree.

[0075] Step S3018: Determine whether the collection of controls described in the UI file has been traversed.

[0076] Specifically, Figure 3c This is a schematic flowchart of step S302 in a preferred embodiment of this disclosure, as shown below. Figure 3c As shown, step S302 includes the following steps:

[0077] Step S3021: In response to the update command, determine the target UI node.

[0078] Step S3022: Using the key information of the target UI node, find the corresponding UI node from the first UI node tree composed of the first Cocos node and the first Proxy node. The aforementioned key information includes, but is not limited to, name, tag, and animation tag.

[0079] Step S3023: Determine whether the target node is the first proxy node based on the type of the UI node. The type of the UI node can be assigned when the node is created, and Cocos nodes and Proxy nodes have different node types.

[0080] If the target node is the first proxy node, proceed to step S3024; if the target node is not the first proxy node, proceed to step S3026.

[0081] Step S3024: Obtain the control data associated with the target node, and deserialize the control data associated with the target node to generate the second Cocos node.

[0082] Step S3025: Release the first Proxy node.

[0083] Specifically, the UI control data referenced by the first Proxy node is released, decrementing its reference count by 1; and the memory occupied by the Proxy node itself is released. The first Proxy node is also removed from the first UI node tree, and the second Cocos node generated by S3024 is attached to the position of the first Proxy node in the first UI node tree.

[0084] Step S3026: Return the Cocos node corresponding to the target node.

[0085] The Cocos node mentioned above can be either the first Cocos node or the second Cocos node.

[0086] In the preferred embodiments of this disclosure, UI control nodes that do not need to be displayed can be replaced with Proxy nodes instead of Cocos nodes, generating a new UI node tree structure composed of Cocos nodes and Proxy nodes. The Proxy nodes are deserialized into Cocos nodes only when they are actually needed. This allows for delayed deserialization of some control data, thereby shortening the deserialization time and reducing the memory occupied during deserialization. This solves the technical problem of deserialization during the generation of the game's user interface, which consumes a lot of memory and causes game lag or crashes.

[0087] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this disclosure.

[0088] This embodiment also provides an apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the terms "unit" and "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0089] Figure 4 This is a structural block diagram of an apparatus for generating a user interface according to one embodiment of the present disclosure, such as... Figure 4 As shown, the device includes:

[0090] The acquisition module 42 is used to acquire the user interface file to be loaded, wherein the user interface file to be loaded includes control data of multiple controls.

[0091] The determination module 44 is used to determine the first target control data corresponding to the first target control that needs to be displayed from the control data of multiple controls.

[0092] The generation module 46 is used to deserialize the control data of the first target control to generate a first user interface, wherein the display content of the first user interface includes the first target control.

[0093] Optionally, the acquisition module includes: a name acquisition unit, used to acquire the target file name, wherein the target file name is used to represent the name of the user interface to be loaded; a file determination unit, used to determine the target memory image as the user interface file to be loaded in response to the existence of the target memory image in the cached data, wherein the target memory image is used to represent the memory image corresponding to the target file name; and a mapping unit, used to acquire the byte stream file to be loaded corresponding to the target file name in response to the absence of the target memory image in the cached data, and to map the byte stream file to be loaded to obtain the user interface file to be loaded.

[0094] Optionally, the user interface file to be loaded further includes: properties of multiple controls, which are used to characterize whether the multiple controls are included in the display content of the first user interface. The determining module includes: a first response unit, which is used to respond to the property of the current control among the multiple controls being included in the display content, and to confirm that the control data of the current control is the first target control data, wherein the current control is any one of the multiple controls.

[0095] Optionally, the device further includes a response module, configured to confirm that the control data of the current control is the control data of another control in response to the current control's property being that the current control is not included in the displayed content.

[0096] Optionally, the user interface file to be loaded further includes: the association relationship of multiple controls, and the response module includes: a second response unit, used to respond to the current control's property being that the current control is not included in the display content, and the associated control with which the current control has an association relationship being that the associated control is not included in the display content, and to confirm that the control data of the current control is the control data of other controls.

[0097] Optionally, the generation module includes: a game engine node generation unit, used to deserialize the control data of the first target control and generate a first game engine node corresponding to the first target control; a proxy node generation unit, used to generate a first proxy node corresponding to other controls based on the control data of other controls, wherein the other controls are used to represent controls other than the first target control among multiple controls; a node tree generation unit, used to generate a first node tree based on the first game engine node and the first proxy node; and an interface generation unit, used to generate a first user interaction interface based on the first node tree.

[0098] Optionally, the device includes: an update instruction response module, configured to respond to an update instruction acting on a first user interface and determine a second target control to be displayed from multiple controls; a proxy node deserialization module, configured to deserialize the control data of the second target control in response to a first proxy node in a first node tree corresponding to the second target control, generating a second game engine node; a node replacement module, configured to replace the target node in the first node tree with the second game engine node to obtain a second node tree; and an interface update module, configured to generate a second user interface based on the second node tree.

[0099] Optionally, the node replacement module includes: a node deletion unit for deleting the target node in the first node tree; and a node addition unit for attaching the second game engine node to the position corresponding to the target node in the first node tree to obtain the second node tree.

[0100] Optionally, the device includes a data deletion module for deleting the first target control data stored in the cache data after generating the first game engine node corresponding to the first target control.

[0101] It should be noted that the above-mentioned units and modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but not limited to these: all the above-mentioned units and modules are located in the same processor; or, the above-mentioned units and modules are located in different processors in any combination.

[0102] Embodiments of this disclosure also provide a computer-readable storage medium storing a computer program configured to perform the steps in any of the above method embodiments when executed.

[0103] Optionally, in this embodiment, the computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0104] Optionally, in this embodiment, the computer-readable storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.

[0105] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0106] S1, obtain the user interface file to be loaded, wherein the user interface file to be loaded includes control data of multiple controls;

[0107] S2, determine the first target control data corresponding to the first target control to be displayed from the control data of multiple controls;

[0108] S3, deserialize the control data of the first target control to generate a first user interface, wherein the display content of the first user interface includes the first target control.

[0109] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: obtaining a user interface file to be loaded, wherein the user interface file to be loaded includes control data of multiple controls, including: obtaining a target file name, wherein the target file name is used to represent the name of the user interface to be loaded; in response to the existence of a target memory image in the cached data, determining the target memory image as the user interface file to be loaded, wherein the target memory image is used to represent the memory image corresponding to the target file name; in response to the absence of a target memory image in the cached data, obtaining a byte stream file to be loaded corresponding to the target file name, and mapping the byte stream file to be loaded to obtain the user interface file to be loaded.

[0110] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: the user interface file to be loaded further includes: properties of multiple controls, the properties being used to characterize whether the multiple controls are included in the display content of the first user interface; determining the first target control data corresponding to the first target control to be displayed from the control data of the multiple controls includes: in response to the property of the current control among the multiple controls being included in the display content, confirming that the control data of the current control is the first target control data, wherein the current control is any one of the multiple controls.

[0111] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: in response to the current control's property being that the current control is not included in the displayed content, confirming that the control data of the current control is the control data of another control.

[0112] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: the association relationship of multiple controls, in response to the property of the current control being not included in the display content, confirming that the control data of the current control is the control data of other controls, including: in response to the property of the current control being not included in the display content and the property of an associated control that is associated with the current control being not included in the display content, confirming that the control data of the current control is the control data of other controls.

[0113] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: deserializing the data of a first target control to generate a first user interface, including: deserializing the control data of the first target control to generate a first game engine node corresponding to the first target control; generating a first proxy node corresponding to other controls based on the control data of other controls, wherein the other controls are used to represent controls other than the first target control among multiple controls; generating a first node tree based on the first game engine node and the first proxy node; and generating the first user interface based on the first node tree.

[0114] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: after generating the first user interface, the method further includes: in response to an update instruction acting on the first user interface, determining a second target control to be displayed from a plurality of controls; in response to a target node in the first node tree corresponding to the second target control being a first proxy node, deserializing the control data of the second target control to generate a second game engine node; replacing the target node in the first node tree with the second game engine node to obtain a second node tree; and generating a second user interface based on the second node tree.

[0115] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: replacing the target node in the first node tree with a second game engine node to obtain a second node tree includes: deleting the target node in the first node tree; attaching the second game engine node to the position corresponding to the target node in the first node tree to obtain a second node tree.

[0116] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: after generating the first game engine node corresponding to the first target control, the method further includes: deleting the first target control data stored in the cache data.

[0117] In this embodiment, a computer-readable storage medium provides a technical solution for generating a user interface. After obtaining the user interface file to be loaded, based on the control data of multiple controls, first target control data is determined from the multiple control data. By deserializing only the control data of the first control contained in the display content of the first user interface, the first user interface is generated without deserializing all control data. This achieves the technical effect of reducing the memory occupied during the deserialization process, thereby solving the technical problem that deserialization during the generation of the user interface of a game consumes a lot of memory, causing game lag or crashes.

[0118] From 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 disclosure can be embodied in the form of a software product, which can be stored in a computer-readable 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, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0119] In exemplary embodiments of this application, a computer-readable storage medium stores a program product capable of implementing the methods described above in this embodiment. In some possible implementations, various aspects of the embodiments of this disclosure may also be implemented as a program product including program code, which, when the program product is run on a terminal device, causes the terminal device to perform the steps according to various exemplary embodiments of this disclosure described in the "Exemplary Methods" section above.

[0120] The program product for implementing the above-described method according to embodiments of the present disclosure may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the embodiments of the present disclosure is not limited thereto. In the embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0121] The aforementioned program product may take the form of any combination of one or more computer-readable media. Such computer-readable storage media may be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples (not exhaustive) of computer-readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0122] It should be noted that the program code contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0123] Embodiments of this disclosure also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.

[0124] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0125] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0126] S1, obtain the user interface file to be loaded, wherein the user interface file to be loaded includes control data of multiple controls;

[0127] S2, determine the first target control data corresponding to the first target control to be displayed from the control data of multiple controls;

[0128] S3, deserialize the control data of the first target control to generate a first user interface, wherein the display content of the first user interface includes the first target control.

[0129] Optionally, the processor may also be configured to perform the following steps via a computer program: obtaining a user interface file to be loaded, wherein the user interface file to be loaded includes control data of multiple controls, including: obtaining a target file name, wherein the target file name is used to represent the name of the user interface to be loaded; in response to the existence of a target memory image in the cached data, determining the target memory image as the user interface file to be loaded, wherein the target memory image is used to represent the memory image corresponding to the target file name; in response to the absence of a target memory image in the cached data, obtaining the byte stream file to be loaded corresponding to the target file name, and mapping the byte stream file to be loaded to obtain the user interface file to be loaded.

[0130] Optionally, the processor may also be configured to perform the following steps via a computer program: the user interface file to be loaded further includes: properties of multiple controls, the properties being used to characterize whether the multiple controls are included in the display content of the first user interface; determining the first target control data corresponding to the first target control to be displayed from the control data of the multiple controls includes: in response to the property of the current control among the multiple controls being included in the display content, confirming that the control data of the current control is the first target control data, wherein the current control is any one of the multiple controls.

[0131] Optionally, the processor described above can also be configured to perform the following steps via a computer program: in response to the current control's property indicating that the current control is not included in the displayed content, confirming that the control data of the current control is the control data of another control.

[0132] Optionally, the processor may also be configured to perform the following steps via a computer program: the user interface file to be loaded further includes: the association relationship of multiple controls, and in response to the current control's property being that the current control is not included in the display content, confirming that the control data of the current control is the control data of other controls includes: in response to the current control's property being that the current control is not included in the display content, and the associated control having an association relationship with the current control's property being that the associated control is not included in the display content, confirming that the control data of the current control is the control data of other controls.

[0133] Optionally, the processor may also be configured to perform the following steps via a computer program: deserializing the data of the first target control to generate a first user interface, including: deserializing the control data of the first target control to generate a first game engine node corresponding to the first target control; generating a first proxy node corresponding to other controls based on the control data of other controls, wherein the other controls are used to represent controls other than the first target control among multiple controls; generating a first node tree based on the first game engine node and the first proxy node; and generating the first user interface based on the first node tree.

[0134] Optionally, the processor may also be configured to perform the following steps via a computer program: after generating the first user interface, the method further includes: in response to an update instruction acting on the first user interface, determining a second target control to be displayed from a plurality of controls; in response to the target node in the first node tree corresponding to the second target control being a first proxy node, deserializing the control data of the second target control to generate a second game engine node; replacing the target node in the first node tree with the second game engine node to obtain a second node tree; and generating the second user interface based on the second node tree.

[0135] Optionally, the processor may also be configured to perform the following steps via a computer program: replacing the target node in the first node tree with a second game engine node to obtain a second node tree, including: deleting the target node in the first node tree; attaching the second game engine node to the position corresponding to the target node in the first node tree to obtain the second node tree.

[0136] Optionally, the processor may also be configured to perform the following steps via a computer program: after generating the first game engine node corresponding to the first target control, the method further includes: deleting the first target control data stored in the cache data.

[0137] In the electronic device of this embodiment, a technical solution for generating a user interface is provided. After obtaining the user interface file to be loaded, a first target control data is determined from the control data of multiple controls based on the control data of multiple controls. By deserializing only the control data of the first control contained in the display content of the first user interface, the first user interface is generated without deserializing all control data. This achieves the technical effect of reducing the memory occupied during the deserialization process, thereby solving the technical problem that deserialization during the generation of the user interface of a game consumes a lot of memory, causing the game to lag or crash.

[0138] Figure 5 This is a schematic diagram of an electronic device according to an embodiment of the present disclosure. Figure 5As shown, the electronic device 500 is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.

[0139] like Figure 5 As shown, the electronic device 500 is presented in the form of a general-purpose computing device. The components of the electronic device 500 may include, but are not limited to: at least one processor 510, at least one memory 520, a bus 530 connecting different system components (including memory 520 and processor 510), and a display 540.

[0140] The memory 520 stores program code that can be executed by the processor 510, causing the processor 510 to perform the steps described in the method section of the embodiments of this application according to various exemplary implementations of this disclosure.

[0141] The memory 520 may include a readable medium in the form of volatile memory cells, such as random access memory (RAM) 5201 and / or cache memory 5202, and may further include read-only memory (ROM) 5203, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.

[0142] In some instances, memory 520 may also include programs / utilities 5204 having a set (at least one) of program modules 5205, including but not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Memory 520 may further include memory remotely located relative to processor 510, which can be connected to electronic device 500 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0143] Bus 530 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, peripheral bus, graphics acceleration port, processor 510, or a local bus using any of the various bus structures.

[0144] The display 540 may be, for example, a touchscreen liquid crystal display (LCD) that allows a user to interact with the user interface of the electronic device 500.

[0145] Optionally, the electronic device 500 can also communicate with one or more external devices 600 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 500, and / or any device that enables the electronic device 500 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via the input / output (I / O) interface 550. Furthermore, the electronic device 500 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via a network adapter 560. Figure 5 As shown, network adapter 560 communicates with other modules of electronic device 500 via bus 530. It should be understood that, although... Figure 5 As not shown, other hardware and / or software modules may be used in conjunction with electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0146] The aforementioned electronic device 500 may also include: a keyboard, a cursor control device (such as a mouse), an input / output interface (I / O interface), a network interface, a power supply, and / or a camera.

[0147] Those skilled in the art will understand that Figure 5 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, the electronic device 500 may also include components that are more... Figure 5 The more or fewer components shown, or having the same Figure 1 Different configurations are shown. The memory 520 can be used to store computer programs and corresponding data, such as the computer program and corresponding data corresponding to the method for generating a user interface in this embodiment of the present disclosure. The processor 510 executes various functional applications and data processing by running the computer program stored in the memory 520, thereby implementing the aforementioned method for generating a user interface.

[0148] The sequence numbers of the embodiments disclosed above are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0149] In the above embodiments of this disclosure, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0150] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0151] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0152] Furthermore, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0153] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0154] The above description is only a preferred embodiment of this disclosure. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principles of this disclosure, and these improvements and modifications should also be considered within the scope of protection of this disclosure.

Claims

1. A method for generating a user interface, characterized in that, The method includes: Obtain the user interface file to be loaded, wherein the user interface file to be loaded includes control data of multiple controls and attributes of the multiple controls; Based on the properties of the multiple controls, determine the first target control data corresponding to the first target control that needs to be displayed from the control data of the multiple controls; The data of the first target control is deserialized to generate a first user interface, wherein the content displayed in the first user interface includes the first target control. The process of deserializing the first target control data to generate a first user interface includes: The control data of the first target control is deserialized to generate the first game engine node corresponding to the first target control; Based on the control data of other controls, a first proxy node corresponding to the other controls is generated. The other controls are used to represent controls other than the first target control among the multiple controls. When the other controls are actually used, the first proxy node deserializes the control data of the other controls and replaces it with a second game engine node. A first node tree is generated based on the first game engine node and the first proxy node; The first user interface is generated based on the first node tree.

2. The method according to claim 1, characterized in that, The user interface files to be loaded include: Obtain the target file name, wherein the target file name is used to represent the name of the user interface to be loaded; In response to the presence of a target memory image in the cached data, the target memory image is determined as the user interface file to be loaded, wherein the target memory image is used to represent the memory image corresponding to the target file name; In response to the absence of the target memory image in the cached data, a byte stream file to be loaded corresponding to the target file name is obtained, and the byte stream file to be loaded is mapped to obtain the user interface file to be loaded.

3. The method according to claim 1, characterized in that, The attribute is used to characterize whether the plurality of controls are included in the display content of the first user interface. The first target control data corresponding to the first target control to be displayed is determined from the control data of the plurality of controls, including: In response to the property of the current control among the plurality of controls being included in the display content, the control data of the current control is confirmed to be the first target control data, wherein the current control is any one of the plurality of controls.

4. The method according to claim 3, characterized in that, The method further includes: In response to the current control's property indicating that the current control is not included in the displayed content, the control data of the current control is confirmed to be the control data of other controls.

5. The method according to claim 4, characterized in that, The user interface file to be loaded further includes: the association relationship of the multiple controls; in response to the current control's attribute being that the current control is not included in the display content, confirming that the control data of the current control is the control data of other controls includes: In response to the fact that the property of the current control among the plurality of controls is that the current control is not included in the display content, and the property of the associated control that has the association relationship with the current control is that the associated control is not included in the display content, it is confirmed that the control data of the current control is the control data of the other controls.

6. The method according to claim 1, characterized in that, After generating the first user interface, the method further includes: In response to an update command applied to the first user interface, a second target control to be displayed is determined from the plurality of controls; In response to the first node in the first node tree corresponding to the second target control being the first proxy node, the control data of the second target control is deserialized to generate the second game engine node; The target node in the first node tree is replaced with the second game engine node to obtain the second node tree; Based on the second node tree, a second user interface is generated.

7. The method according to claim 6, characterized in that, The second node tree is obtained by replacing the target node in the first node tree with the second game engine node, and the result includes: Delete the target node from the first node tree; The second game engine node is attached to the position corresponding to the target node in the first node tree to obtain the second node tree.

8. The method according to claim 1, characterized in that, After generating the first game engine node corresponding to the first target control, the method further includes: Delete the data of the first target control stored in the cache data.

9. An apparatus for generating a user interface, characterized in that, The device includes: The acquisition module is used to acquire the user interface file to be loaded, wherein the user interface file to be loaded includes control data of multiple controls and the attributes of the multiple controls; The determining module is used to determine, based on the attributes of the plurality of controls, the first target control data corresponding to the first target control to be displayed from the control data of the plurality of controls; The generation module is used to deserialize the control data of the first target control to generate a first user interface, wherein the display content of the first user interface includes the first target control. The generation module is used to deserialize the control data of the first target control to generate a first game engine node corresponding to the first target control; generate a first proxy node corresponding to the other controls based on the control data of the other controls, wherein the other controls are used to represent controls other than the first target control among the plurality of controls, and the first proxy node deserializes the control data of the other controls and replaces them with a second game engine node when the other controls are actually used; generate a first node tree based on the first game engine node and the first proxy node; and generate the first user interaction interface based on the first node tree.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute, when run by a processor, the method for generating a user interface as described in any one of claims 1 to 8.

11. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method for generating a user interface as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Resource loading method and apparatus, and resource file generation method and apparatus

    CN107122201A