CN116302146A - Interface resource loading method and device and electronic equipment - Google Patents

Interface resource loading method and device and electronic equipment Download PDF

Info

Publication number
CN116302146A
CN116302146A CN202211083162.7A CN202211083162A CN116302146A CN 116302146 A CN116302146 A CN 116302146A CN 202211083162 A CN202211083162 A CN 202211083162A CN 116302146 A CN116302146 A CN 116302146A
Authority
CN
China
Prior art keywords
loading
content
nodes
interface
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211083162.7A
Other languages
Chinese (zh)
Inventor
石华杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202211083162.7A priority Critical patent/CN116302146A/en
Publication of CN116302146A publication Critical patent/CN116302146A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention provides an interface resource loading method, a device and electronic equipment, when loading a target interface, firstly acquiring a node tree corresponding to the target interface, wherein the node tree comprises a plurality of nodes, the nodes correspond to part of contents in the target interface, and the nodes have a hierarchical relationship and a connection relationship; determining a content loading order in a target interface according to the hierarchical relationship among the nodes; and according to the content loading order, carrying out framing loading on the content resources required to be loaded by the nodes to obtain the interface content of the target interface. In the mode, according to the hierarchical relation among a plurality of nodes in the node tree corresponding to the interface, the loading order of the content resources needed to be loaded by the nodes can be rearranged, so that the display order of the content resources in the interface accords with the browsing habit of human eyes; meanwhile, the method carries out frame loading on the content resources to be loaded in the interface, so that the phenomenon of interface jamming can be avoided, and the interface loading is smoother.

Description

Interface resource loading method and device and electronic equipment
Technical Field
The present invention relates to the field of data loading technologies, and in particular, to an interface resource loading method and apparatus, and an electronic device.
Background
The graphic user interface is an indispensable element in the game, can improve the interactivity of the player, and is a necessary medium for information transfer between the game and the player. However, if the amount of interface resources is large, a large amount of resources need to be loaded when the interface is loaded, so that a large amount of IO devices and IO interfaces need to be used, interface loading and clamping are easy to cause, the interface loading and clamping can influence the game smoothness, and when the game smoothness is poor, the player is easy to wait for annoyance and visual fatigue.
In the related art, when the interface is loaded, a resource preloading or resource asynchronous loading mode can be adopted, so that the interface clamping phenomenon is avoided. However, the resource preloading needs to load all the resources needed by the loading interface into the memory in advance, so that the memory overhead is high; the asynchronous loading of the resources requires that different resources are placed in the additional thread for loading, so that the loading time and sequence are difficult to ensure, and the situation that the loading of a large-volume image is slower often occurs, for example, a foreground image appears first and a background image appears later, so that the loading of an interface does not accord with the visual habit of human eyes for browsing pages.
Disclosure of Invention
The invention aims to provide an interface resource loading method, an interface resource loading device and electronic equipment, so that the interface loading speed is improved on the basis that the interface loading accords with the visual habit of browsing pages by human eyes.
In a first aspect, the present invention provides a method for loading interface resources, where the method includes: responding to loading operation of a target interface, and acquiring a node tree corresponding to the target interface; the node tree includes a plurality of nodes; the nodes correspond to part of the content in the target interface; the nodes have a hierarchical relationship and a connection relationship; the hierarchy between the interconnected nodes is different; determining a content loading order in a target interface according to the hierarchical relationship among the nodes; and according to the content loading order, carrying out framing loading on the content resources required to be loaded by the nodes to obtain the interface content of the target interface.
In an alternative embodiment, the step of determining the loading order of the content in the target interface according to the hierarchical relationship between the plurality of nodes includes: the method comprises the steps that the sequence of sequentially traversing a plurality of nodes from the highest hierarchy layer by layer from left to right is determined to be the content loading sequence in a target interface; the content loading order comprises the loading order of the content resources which need to be loaded by each node in the plurality of nodes.
In an optional embodiment, the step of framing and loading the content resource to be loaded by the node according to the content loading order to obtain the interface content of the target interface includes: generating an object corresponding to each node based on the plurality of nodes; and carrying out framing loading on the content resources which need to be loaded by the nodes corresponding to the objects according to the content loading order so as to obtain a target interface containing the objects and the content resources corresponding to the objects.
In an optional embodiment, the step of framing and loading the content resource to be loaded by the node corresponding to the object according to the content loading order includes: placing objects which need to load content resources in the objects corresponding to the nodes into a queue to be loaded; the arrangement order of the objects in the queue to be loaded is matched with the content loading order; sequentially taking out target objects from the queues to be loaded according to the content loading order; and loading the content resources which are required to be loaded and correspond to the target object by adopting a framing loader.
In an alternative embodiment, each object in the queue to be loaded stores a resource loading path, where the resource loading path is used to indicate a storage location of a content resource that needs to be loaded by the object; the step of loading the content resource to be loaded corresponding to the target object by adopting the framing loader comprises the following steps: and loading the content resources to be loaded of the target object from the resource loading path stored by the target object by adopting a framing loader.
In an alternative embodiment, the target objects are sequentially fetched from the queue to be loaded according to the content loading order; before the step of loading the content resource to be loaded corresponding to the target object by adopting the framing loader, the method further comprises the following steps: setting loading parameters in a split frame loader; wherein the loading parameters include: single frame maximum load time and/or single frame maximum load.
In an alternative embodiment, each node in the plurality of nodes stores node configuration information; the step of generating the object corresponding to each node based on the plurality of nodes includes: sequentially analyzing each node in the plurality of nodes based on the sequence of performing the preamble traversal by each node in the plurality of nodes; in the parsing process, for each node, generating an object corresponding to the current node based on node configuration information of the current node.
In a second aspect, the present invention provides an interface resource loading device, which includes: the node tree acquisition module is used for responding to the loading operation of the target interface and acquiring a node tree corresponding to the target interface; the node tree includes a plurality of nodes; the nodes correspond to part of the content in the target interface; the nodes have a hierarchical relationship and a connection relationship; the hierarchy between the interconnected nodes is different; the content loading order determining module is used for determining the content loading order in the target interface according to the hierarchical relationship among the plurality of nodes; and the resource loading module is used for carrying out framing loading on the content resources required to be loaded by the nodes according to the content loading sequence to obtain the interface content of the target interface.
In a third aspect, the present invention provides an electronic device comprising a processor and a memory storing machine executable instructions executable by the processor to implement the above-described interface resource loading method.
In a fourth aspect, the present invention provides a computer-readable storage medium storing computer-executable instructions that, when invoked and executed by a processor, cause the processor to implement the above-described interface resource loading method.
The embodiment of the invention has the following beneficial effects:
according to the interface resource loading method, the interface resource loading device and the electronic equipment, when a target interface is loaded, a node tree corresponding to the target interface is obtained; the node tree comprises a plurality of nodes, the nodes correspond to part of the content in the target interface, the nodes have a hierarchical relationship and a connection relationship, and the hierarchy of the interconnected nodes is different; then determining the content loading order in the target interface according to the hierarchical relationship among the nodes; and then according to the content loading order, carrying out framing loading on the content resources which need to be loaded by the nodes to obtain the interface content of the target interface. In the mode, according to the hierarchical relation among a plurality of nodes in the node tree corresponding to the interface, the loading order of the content resources needed to be loaded by the nodes can be rearranged, so that the display order of the content resources in the interface accords with the browsing habit of human eyes; meanwhile, the method carries out frame loading on the content resources to be loaded in the interface, so that the phenomenon of interface jamming can be avoided, and the interface loading is smoother.
Additional features and advantages of the invention will be set forth in the description which follows, or in part will be obvious from the description, or may be learned by practice of the invention.
In order to make the above objects, features and advantages of the present invention more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of an interface resource loading method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an interface made using an editor according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a node tree corresponding to an interface provided in an embodiment of the present invention;
FIG. 4 is a flowchart of another method for loading interface resources according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a node tree layer sequence traversal according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a node tree preamble traversal provided by an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of an interface resource loading device according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The graphical user interface (Graphical User Interface, abbreviated as GUI) is an indispensable element in the game, can improve the interactivity of the player, is a necessary medium for information transmission between the game and the player, and when the player opens the interface, the response sensitivity is particularly important, the interface is stuck to bring great negative influence on the smoothness of the game, and a better smoothness can bring comfortable experience to the player, otherwise, the player waits for the annoyance and is easy to cause visual fatigue. In practical applications, the reason for causing interface blocking is various, and is mainly divided into the following two types:
1. the logic bulkiness causes an increase in the computation amount of the CPU (Central Processing Unit ), and a higher delay occurs.
2. The interface resource amount is large, and a large amount of resources are needed to be loaded when the interface is loaded, so that a large amount of IO devices and IO interfaces are needed to be used, and interface loading and clamping are easy to cause.
The first class of blocking phenomenon can be solved through the optimization logic, however, the business logic and the game playing method are closely connected, and the optimization modes are difficult to unify due to different playing scenes of different games, and are not repeated here, and the second class of blocking phenomenon, namely blocking caused by resource loading, is mainly aimed at.
In the related art, aiming at interface blocking caused by resource loading, the following two solutions are mainly provided:
in the first mode, the resource is preloaded, namely the resource needed to be loaded in advance is placed in a resource cache pool, when the resource is needed to be used later, the resource is obtained from the resource cache pool first without reloading, and thus interface Loading jamming can be avoided, for example, a common combat Loading interface can preload all the resources used in combat. However, resource preloading often requires a large amount of memory, and since the GUI interface that the player wants to open next cannot be predicted, the material that needs to be loaded cannot be prepared in advance, and only all the resources that may be used can be preloaded. Although some predictive algorithms or methods such as least recently used algorithms exist, it is ultimately difficult to avoid overhead in terms of memory.
In the second mode, the resources are asynchronously loaded, and the asynchronous loading uses a single loading thread, namely, the task corresponding to the resource loading is put into an additional thread, so that the main thread is prevented from being blocked when the resources are loaded, and the main thread can still continue to do other tasks at the moment, and the smoothness of the logic of the main thread is ensured. However, asynchronous loading places different resources on additional threads for loading, so that the loading time and sequence are difficult to ensure, the situation that the loading of a large-volume image is slower often occurs, for example, the background image is smaller in volume, the foreground image is larger in volume, if asynchronous loading is used, the situation that the foreground image appears first and then the background image appears later is likely to appear, and the visual habit of human eyes for browsing pages is not met.
Based on the above problems, the embodiment of the invention provides an interface resource loading method, an interface resource loading device and electronic equipment, and the technology can be applied to any loading scene of an interface, particularly a loading scene of a graphical user interface of a game. In order to facilitate understanding of the embodiments of the present invention, first, a detailed description is provided of an interface resource loading method disclosed in the present invention, as shown in fig. 1, where the method includes the following specific steps:
step S102, responding to loading operation of a target interface, and acquiring a node tree corresponding to the target interface; the node tree includes a plurality of nodes; the nodes correspond to part of the content in the target interface; the nodes have a hierarchical relationship and a connection relationship; the hierarchy between the interconnected nodes is different.
The target interfaces can be any graphical user interfaces which are needed to be loaded by players, each interface corresponds to a respective node organization structure when being manufactured, the node organization structure is generally represented by a node tree, each node tree corresponds to a plurality of nodes, part of nodes in the nodes are connected with each other, the connected nodes are father and son nodes, the father node and the son node are located at different levels, and the level of the father node is higher than that of the son node. And simultaneously, each node corresponds to part of the content in the target interface, and the content corresponding to all the nodes is loaded, so that all the content in the interface can be displayed. Specifically, the loading operation of the target interface may be an operation of clicking a button in the graphical user interface by the player, or an operation of completing a task in the game scene, or other operations, which are not limited herein.
The interface that the player sees in the game is generally made by using some special editors, and the structure of the interface is generally in a tree structure, and fig. 2 is a schematic diagram of an interface made by using the editors according to an embodiment of the invention. The left part of fig. 2 is a node organization structure made by an interface, the right part of fig. 2 is a display effect schematic diagram of the interface, and ABCDEFGHIJK in the right part of fig. 2 each represents an object (also referred to as a control) displayed in the interface, where one object corresponds to one node.
Specifically, for the node organization structure shown in fig. 2, a multi-tree (may also be referred to as a node tree) is commonly used in the computer data structure to represent, as shown in fig. 3, a schematic diagram of a node tree corresponding to an interface, where node a is a parent node of node B and node C, node B is a parent node of node D and node E, node C is a parent node of node F and node G, node D is a parent node of node H and node I, node E is a parent node of node J, and node F is a parent node of node K.
Step S104, determining the loading order of the contents in the target interface according to the hierarchical relationship among the nodes.
In order to make the display sequence of the content resources in the interface accord with the browsing habit of human eyes, the sequence according with the browsing habit of human eyes is that the content resources corresponding to the nodes with the level are displayed first, and the sequence of the content resources corresponding to the nodes with the low level are displayed later. Based on this, the loading order of the content resources corresponding to each node may be determined according to the hierarchical relationship between the nodes in the node tree, where the loading order of the content resources corresponding to all the nodes in the node tree is the content loading order. Specifically, the content resources may include a map resource, an audio resource, a video resource, or the like.
And step S106, carrying out framing loading on the content resources required to be loaded by the nodes according to the content loading sequence to obtain interface contents of the target interface.
According to the loading order of the content resources corresponding to each node in the content loading order, the content resources corresponding to the nodes are sequentially loaded in frames, so that the task of processing a part of content loading in each frame is achieved, the overhead of executing the task in a single frame can be reduced, and interface jamming caused by too long time consumption of a certain frame is avoided. In specific implementation, the framing loader can be used for realizing framing loading of the content resource, the LoadingTextureQueue method can be called in the game Tick logic for realizing framing loading, and the framing loading can be realized in other modes, so that the method is not particularly limited. The LoadingTextureQueue is a program method, which refers to the implementation of a framing loader, and is used for executing a specific number of loading tasks at each time of a game, and dynamically calculating the number of current loading tasks with reference to the idle time remaining when a frame is used.
When a complex GUI interface is loaded, the interface node tree is loaded, the layering display strategy enables the display sequence of the resources in the interface to accord with the browsing habit of human eyes, the framing loading scheme enables the opening of the interface to be smooth, and under the combined action of the two, a player can effectively ensure the smoothness of the interface and more accord with the visual effect when opening a new interface.
According to the interface resource loading method provided by the embodiment of the invention, when a target interface is loaded, a node tree corresponding to the target interface is firstly obtained; the node tree comprises a plurality of nodes, the nodes correspond to part of the content in the target interface, and the nodes have a hierarchical relationship and a connection relationship; then determining the content loading order in the target interface according to the hierarchical relationship among the nodes; and then according to the content loading order, carrying out framing loading on the content resources which need to be loaded by the nodes to obtain the interface content of the target interface. In the mode, according to the hierarchical relation among a plurality of nodes in the node tree corresponding to the interface, the loading order of the content resources needed to be loaded by the nodes can be rearranged, so that the display order of the content resources in the interface accords with the browsing habit of human eyes; meanwhile, the method carries out frame loading on the content resources to be loaded in the interface, so that the phenomenon of interface jamming can be avoided, and the interface loading is smoother.
The embodiment of the invention also provides another interface resource loading method, which is realized on the basis of the embodiment, and the method mainly describes a specific process of determining the content loading order in the target interface according to the hierarchical relation among a plurality of nodes (realized by the following step S404), and a specific process of framing and loading the content resources required to be loaded by the nodes according to the content loading order to obtain the interface content of the target interface (realized by the following steps S406-S408); as shown in fig. 4, the method comprises the following specific steps:
Step S402, responding to loading operation of a target interface, and acquiring a node tree corresponding to the target interface; the node tree includes a plurality of nodes; the nodes correspond to part of the content in the target interface; the nodes have a hierarchical relationship and a connection relationship; the hierarchy between the interconnected nodes is different.
Step S404, determining the sequence of traversing the nodes from the highest hierarchy layer by layer from left to right as the content loading sequence in the target interface; the content loading order comprises the loading order of the content resources which need to be loaded by each node in the plurality of nodes.
In specific implementation, the loading order of the content resources required to be loaded by the nodes can be determined according to the order in which the nodes in each hierarchy are traversed from left to right from the highest hierarchy to the next hierarchy, and the loading order is the layer sequence traversing order. The layer sequence traversing order enables the display order of the content resources in the interface to accord with the browsing habit of human eyes. Fig. 5 is a schematic view of a node tree layer sequence traversal provided by the present invention, and the direction of the arrow in fig. 5 indicates the traversal sequence of each layer, so the layer sequence traversal sequence of the node tree shown in fig. 5, that is, the content loading sequence in the target interface, is: a- > B- > C- > D- > E- > F- > G- > H- > I- > J- > K.
In step S406, based on the plurality of nodes, an object corresponding to each node is generated.
When the loading node tree is created, an object corresponding to the node needs to be created first, and the object can be understood as a control in the game, namely, a control (namely, a display entity in an interface) is generated by analyzing configuration information of the node in the node tree, and specifically, the node in the node tree stores the configuration information of the node. In concrete implementation, each node in a plurality of nodes contained in the node tree stores node configuration information; then, sequentially analyzing each node in the plurality of nodes based on the sequence of performing preamble traversal on each node in the plurality of nodes; in the parsing process, for each node, generating an object corresponding to the current node based on node configuration information of the current node.
When the object is created according to the node configuration information contained in the node tree, the loading and object generating sequence of the node adopts a preamble traversing sequence, but the node is marked with an order (the mark is matched with the content loading sequence), and the loading sequence of the content resource which needs to be loaded by the node is modified by the order. Fig. 6 is a schematic diagram of node tree preamble traversal according to an embodiment of the present invention, where the preamble traversal order of the node tree is the same as the order of generating objects by nodes in the node tree, and the traversal order of the nodes in the node tree in fig. 6 is: a- > B- > D- > H- > I- > E- > J- > C- > F- > K- > G.
In the related art, GUI designers often adopt a node tree structure to facilitate organization and display of interfaces, when the interfaces are opened, a game analyzes a resource to load the node tree into a memory, corresponding objects are created in the loading process, the loading sequence of the node tree is traversing in the preamble, and the sequence is selected because child nodes can be created or connected after parent nodes are created, but the mode does not conform to the visual habit of players when the mode is displayed. The invention creates the object corresponding to the node according to the preamble traversal order, loads the content resource needed to be loaded of the object according to the layer sequence traversal order, and thus, the resource display order in the interface accords with the human eye browsing habit.
Step S408, according to the content loading order, the content resources which need to be loaded by the nodes corresponding to the objects are loaded in frames, so as to obtain a target interface containing the objects and the content resources corresponding to the objects.
The object and the content resource corresponding to the object are usually displayed in the target interface, and the content resource can be a map, audio or video, etc. The layout of each object in the target interface is created when the object corresponding to the node is generated, and the layout includes the position, zoom, rotation, transparency, and the like of the object.
In specific implementation, the step S408 may be implemented by the following steps 10-11:
step 10, placing objects which need to load content resources in the objects corresponding to a plurality of nodes into a queue to be loaded; the order of arrangement of the objects in the to-be-loaded queue matches the content loading order.
When creating the object corresponding to the node, for the node containing the content resource, the content resource is not immediately loaded, but the object of the content resource to be loaded is put into a queue to be loaded, and then the sequence of the object in the content loading sequence is transmitted, so that the loading sequence of the content resource is conveniently controlled. The queue to be loaded is used for storing the objects needing to load the content resources, the objects record the resource information and set as the state of the resources to be loaded, the added objects are in the sequence of the content loading as keys, and in the process of adding and deleting the objects in the subsequent queues, the queue to be loaded always arranges the objects of the resources to be loaded according to the sequence of the increment of the content loading sequence.
The resource information recorded by the object includes the size of the resource, the loading path of the resource, and the like. The attribute of the mapping state to be loaded is recorded on the object, and represents the loading state of the content resource referenced by the object, if the loading is completed, the loading is not repeated, and if the loading is not completed, the subsequent loading processing is performed.
Step 11, sequentially taking out target objects from the queues to be loaded according to the content loading order; and loading the content resources which are required to be loaded and correspond to the target object by adopting a framing loader.
Specifically, each object in the queue to be loaded stores a resource loading path, so that a framing loader can be adopted to load the content resource to be loaded of the target object from the resource loading path stored by the target object. In practical application, when all objects generated by nodes needing to load content resources in a node tree are placed in a queue to be loaded, the loading of the content resources needs to be started.
In some embodiments, before a framing loader is adopted to load a content resource to be loaded corresponding to a target object, loading parameters in the framing loader need to be set; wherein the loading parameters include: single frame maximum load time and/or single frame maximum load. In this way, the overhead of loading resource tasks by a single frame is controlled by the maximum loading time per frame or the maximum loading amount of a single frame, so as to avoid the problem that a certain frame takes too long to cause a jam.
In practical applications, the implementation manner of the framing loader may be different, and the loading task may be placed on the main thread to be unloaded, or may be placed on an additional loading thread to be unloaded, so that if the loading task is placed on the additional loading thread to be unloaded, it is required to ensure that the order of subsequently executing the refreshing logic and the loading order are controlled by the main thread to be consistent after the loading is completed.
In order to facilitate understanding of the embodiments of the present invention, the present invention will be described in detail by taking a content resource that needs to be loaded by a node as a mapping resource as an example. In order to enable the page browsing sequence to accord with the habit of eyes, but under the condition that the creation sequence of the object is not modified, only the loading sequence of the required mapping resources in the object is specified, a load_order attribute (the attribute is used for indicating the loading sequence of the resources required by the object) is introduced to the object, and when the node tree is analyzed, a gen_node_order method is called, and the assignment of the load_order to the object is carried out according to the layer sequence traversal sequence. The procedure is as follows:
the defgen_node_order ("self" ") is consistent with visual effects, and the map loading order needs to be consistent with breadth-first traversal order, i.e. the background is preferentially displayed, this function is used to generate the loading order" of each node'
Figure BDA0003834041870000121
In the above procedure, template refers to node tree resource information, and may be considered as a root node configuration of a tree, which includes both the root node configuration and configuration information of nodes such as child nodes, grandchild nodes, and the like, where the Template is organized in a tree form. the template contains some basic properties of the control: the Order attribute is used for recording the sequence of the node layer sequence traversal; child_list represents configuration information of all Child nodes of the node; type represents an object Type; name represents the object Name; size represents the object Size; position object display position, etc. load_queue is the to-be-loaded queue used to assist in making layer sequence traversals. The code assigns the order attribute in the template configuration information as a layer sequence traversing order, so that the subsequent loading of the order on the resources needing to be loaded by the object is convenient.
When the loading node tree is created, an object is created first, but for the node containing the mapping resource, the mapping is not loaded immediately, the object of the mapping to be loaded is put into a queue to be loaded, and the load_order attribute of the object is input, so that the mapping loading order is controlled conveniently. The objects in the queue to be loaded record mapping information and set to be in a mapping state to be loaded, the added objects take orders as keys, and in the subsequent adding and deleting process, the queue to be loaded always arranges the objects of the mapping to be loaded according to the order of increasing orders of the orders. When an object to be loaded of a mapping exists in a queue to be loaded, the loading needs to be started, and the invention provides a framing loader which calls a LoadingTextureQueue method in game Tick logic, and fixedly executes a mapping task to achieve the task of processing a part of mapping loading per frame, and provides a configurable parameter, so that the cost of executing the mapping task for a single frame can be controlled through the maximum loading time of each frame, and the problem that the clamping is caused by too long time of a certain frame is avoided.
According to the interface resource loading method, the layering and framing loading scheme is carried out on the loading of the interface node tree, when the node tree is loaded, layering can rearrange the loading sequence of the reference resources on the premise that the creation sequence of objects is not affected, so that the display sequence of the content resources in the interface accords with the human eye browsing habit, the framing loading scheme can firstly put all the resources to be loaded into the queue to be loaded, and then load the resources in the queue to be loaded by distributing part of time for each frame, and therefore the problem that the time for loading the resources in a single frame is too long in the past is solved, and the interface is opened smoothly. Meanwhile, the method can maximize the interface loading speed without sacrificing the external memory space and ensuring the browsing habit of the player, and even the complex and huge interface is not flashed, so that the player can more smoothly perform interface interaction in the game.
Corresponding to the above method embodiment, the embodiment of the present invention further provides an interface resource loading device, as shown in fig. 7, where the device includes:
the node tree obtaining module 70 is configured to obtain a node tree corresponding to the target interface in response to a loading operation of the target interface; the node tree comprises a plurality of nodes; the nodes correspond to part of the content in the target interface; the nodes have a hierarchical relationship and a connection relationship; the hierarchy between the interconnected nodes is different.
The content loading order determining module 71 is configured to determine the content loading order in the target interface according to the hierarchical relationship among the plurality of nodes.
The resource loading module 72 is configured to load the content resources that the node needs to load in frames according to the content loading order, so as to obtain the interface content of the target interface.
When the interface resource loading device loads the target interface, firstly acquiring a node tree corresponding to the target interface; the node tree comprises a plurality of nodes, the nodes correspond to part of the content in the target interface, the nodes have a hierarchical relationship and a connection relationship, and the hierarchy of the interconnected nodes is different; then determining the content loading order in the target interface according to the hierarchical relationship among the nodes; and then according to the content loading order, carrying out framing loading on the content resources which need to be loaded by the nodes to obtain the interface content of the target interface. In the mode, according to the hierarchical relation among a plurality of nodes in the node tree corresponding to the interface, the loading order of the content resources needed to be loaded by the nodes can be rearranged, so that the display order of the content resources in the interface accords with the browsing habit of human eyes; meanwhile, the method carries out frame loading on the content resources to be loaded in the interface, so that the phenomenon of interface jamming can be avoided, and the interface loading is smoother.
Specifically, the content loading order determining module 71 is configured to: the method comprises the steps that the sequence of sequentially traversing a plurality of nodes from the highest hierarchy layer by layer from left to right is determined to be the content loading sequence in a target interface; the content loading order comprises the loading order of the content resources which need to be loaded by each node in the plurality of nodes.
Further, the resource loading module 72 includes: an object generating unit, configured to generate an object corresponding to each node based on a plurality of nodes; and the loading unit is used for carrying out framing loading on the content resources which need to be loaded by the nodes corresponding to the objects according to the content loading order so as to obtain a target interface containing the objects and the content resources corresponding to the objects.
In a specific implementation, the loading unit is configured to: placing objects which need to load content resources in the objects corresponding to the nodes into a queue to be loaded; the arrangement order of the objects in the queue to be loaded is matched with the content loading order; sequentially taking out target objects from the queues to be loaded according to the content loading order; and loading the content resources which are required to be loaded and correspond to the target object by adopting a framing loader.
Specifically, each object in the queue to be loaded stores a resource loading path, where the resource loading path is used to indicate a storage location of a content resource that needs to be loaded by the object; the loading unit is used for: and loading the content resources to be loaded of the target object from the resource loading path stored by the target object by adopting a framing loader.
Further, the device further comprises a parameter setting module for: sequentially taking out target objects from the queues to be loaded according to the content loading order; setting loading parameters in a framing loader before loading a content resource to be loaded corresponding to a target object by adopting the framing loader; wherein the loading parameters include: single frame maximum load time and/or single frame maximum load.
Further, each node in the plurality of nodes stores node configuration information; the object generating unit is used for: sequentially analyzing each node in the plurality of nodes based on the sequence of performing the preamble traversal by each node in the plurality of nodes; in the parsing process, for each node, generating an object corresponding to the current node based on node configuration information of the current node.
The implementation principle and the generated technical effects of the interface resource loading device provided by the embodiment of the invention are the same as those of the embodiment of the method, and for the sake of brief description, the corresponding contents in the embodiment of the method can be referred to for the parts of the embodiment of the device that are not mentioned.
The embodiment of the invention also provides an electronic device, as shown in fig. 8, which comprises a processor and a memory, wherein the memory stores machine executable instructions capable of being executed by the processor, and the processor executes the machine executable instructions to implement the interface resource loading method.
Specifically, the interface resource loading method includes: responding to loading operation of a target interface, and acquiring a node tree corresponding to the target interface; the node tree includes a plurality of nodes; the nodes correspond to part of the content in the target interface; the nodes have a hierarchical relationship and a connection relationship; the hierarchy between the interconnected nodes is different; determining a content loading order in a target interface according to the hierarchical relationship among the nodes; and according to the content loading order, carrying out framing loading on the content resources required to be loaded by the nodes to obtain the interface content of the target interface.
According to the interface resource loading method, the loading order of the content resources which are needed to be loaded by the nodes can be rearranged according to the hierarchical relation among the nodes in the node tree corresponding to the interface, so that the display order of the content resources in the interface accords with the browsing habit of human eyes; meanwhile, the method carries out frame loading on the content resources to be loaded in the interface, so that the phenomenon of interface jamming can be avoided, and the interface loading is smoother.
In an alternative embodiment, the step of determining the loading order of the content in the target interface according to the hierarchical relationship between the plurality of nodes includes: the method comprises the steps that the sequence of sequentially traversing a plurality of nodes from the highest hierarchy layer by layer from left to right is determined to be the content loading sequence in a target interface; the content loading order comprises the loading order of the content resources which need to be loaded by each node in the plurality of nodes.
In an optional embodiment, the step of framing and loading the content resource to be loaded by the node according to the content loading order to obtain the interface content of the target interface includes: generating an object corresponding to each node based on the plurality of nodes; and carrying out framing loading on the content resources which need to be loaded by the nodes corresponding to the objects according to the content loading order so as to obtain a target interface containing the objects and the content resources corresponding to the objects.
In an optional embodiment, the step of framing and loading the content resource to be loaded by the node corresponding to the object according to the content loading order includes: placing objects which need to load content resources in the objects corresponding to the nodes into a queue to be loaded; the arrangement order of the objects in the queue to be loaded is matched with the content loading order; sequentially taking out target objects from the queues to be loaded according to the content loading order; and loading the content resources which are required to be loaded and correspond to the target object by adopting a framing loader.
In an alternative embodiment, each object in the queue to be loaded stores a resource loading path, where the resource loading path is used to indicate a storage location of a content resource that needs to be loaded by the object; the step of loading the content resource to be loaded corresponding to the target object by adopting the framing loader comprises the following steps: and loading the content resources to be loaded of the target object from the resource loading path stored by the target object by adopting a framing loader.
In an alternative embodiment, the target objects are sequentially fetched from the queue to be loaded according to the content loading order; before the step of loading the content resource to be loaded corresponding to the target object by adopting the framing loader, the method further comprises the following steps: setting loading parameters in a split frame loader; wherein the loading parameters include: single frame maximum load time and/or single frame maximum load.
In an alternative embodiment, each node in the plurality of nodes stores node configuration information; the step of generating the object corresponding to each node based on the plurality of nodes includes: sequentially analyzing each node in the plurality of nodes based on the sequence of performing the preamble traversal by each node in the plurality of nodes; in the parsing process, for each node, generating an object corresponding to the current node based on node configuration information of the current node.
Further, the electronic device shown in fig. 8 further includes a bus 102 and a communication interface 103, and the processor 101, the communication interface 103, and the memory 100 are connected through the bus 102.
The memory 100 may include a high-speed random access memory (RAM, randomAccessMemory) and may further include a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. The communication connection between the system network element and at least one other network element is implemented via at least one communication interface 103 (which may be wired or wireless), and may use the internet, a wide area network, a local network, a metropolitan area network, etc. Bus 102 may be an ISA bus, a PCI bus, an EISA bus, or the like. The buses may be classified as address buses, data buses, control buses, etc. For ease of illustration, only one bi-directional arrow is shown in FIG. 8, but not only one bus or type of bus.
The processor 101 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in the processor 101 or instructions in the form of software. The processor 101 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a digital signal processor (Digital Signal Processing, DSP for short), application specific integrated circuit (Application Specific Integrated Circuit, ASIC for short), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA for short), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in the memory 100 and the processor 101 reads information in the memory 100 and in combination with its hardware performs the steps of the method of the previous embodiments.
The embodiment of the invention also provides a computer readable storage medium, which stores computer executable instructions that, when being called and executed by a processor, cause the processor to implement the above-mentioned interface resource loading method, and the specific implementation can be referred to the method embodiment and will not be described herein.
Specifically, the interface resource loading method includes: responding to loading operation of a target interface, and acquiring a node tree corresponding to the target interface; the node tree includes a plurality of nodes; the nodes correspond to part of the content in the target interface; the nodes have a hierarchical relationship and a connection relationship; the hierarchy between the interconnected nodes is different; determining a content loading order in a target interface according to the hierarchical relationship among the nodes; and according to the content loading order, carrying out framing loading on the content resources required to be loaded by the nodes to obtain the interface content of the target interface.
According to the interface resource loading method, the loading order of the content resources which are needed to be loaded by the nodes can be rearranged according to the hierarchical relation among the nodes in the node tree corresponding to the interface, so that the display order of the content resources in the interface accords with the browsing habit of human eyes; meanwhile, the method carries out frame loading on the content resources to be loaded in the interface, so that the phenomenon of interface jamming can be avoided, and the interface loading is smoother.
In an alternative embodiment, the step of determining the loading order of the content in the target interface according to the hierarchical relationship between the plurality of nodes includes: the method comprises the steps that the sequence of sequentially traversing a plurality of nodes from the highest hierarchy layer by layer from left to right is determined to be the content loading sequence in a target interface; the content loading order comprises the loading order of the content resources which need to be loaded by each node in the plurality of nodes.
In an optional embodiment, the step of framing and loading the content resource to be loaded by the node according to the content loading order to obtain the interface content of the target interface includes: generating an object corresponding to each node based on the plurality of nodes; and carrying out framing loading on the content resources which need to be loaded by the nodes corresponding to the objects according to the content loading order so as to obtain a target interface containing the objects and the content resources corresponding to the objects.
In an optional embodiment, the step of framing and loading the content resource to be loaded by the node corresponding to the object according to the content loading order includes: placing objects which need to load content resources in the objects corresponding to the nodes into a queue to be loaded; the arrangement order of the objects in the queue to be loaded is matched with the content loading order; sequentially taking out target objects from the queues to be loaded according to the content loading order; and loading the content resources which are required to be loaded and correspond to the target object by adopting a framing loader.
In an alternative embodiment, each object in the queue to be loaded stores a resource loading path, where the resource loading path is used to indicate a storage location of a content resource that needs to be loaded by the object; the step of loading the content resource to be loaded corresponding to the target object by adopting the framing loader comprises the following steps: and loading the content resources to be loaded of the target object from the resource loading path stored by the target object by adopting a framing loader.
In an alternative embodiment, the target objects are sequentially fetched from the queue to be loaded according to the content loading order; before the step of loading the content resource to be loaded corresponding to the target object by adopting the framing loader, the method further comprises the following steps: setting loading parameters in a split frame loader; wherein the loading parameters include: single frame maximum load time and/or single frame maximum load.
In an alternative embodiment, each node in the plurality of nodes stores node configuration information; the step of generating the object corresponding to each node based on the plurality of nodes includes: sequentially analyzing each node in the plurality of nodes based on the sequence of performing the preamble traversal by each node in the plurality of nodes; in the parsing process, for each node, generating an object corresponding to the current node based on node configuration information of the current node.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a terminal device, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings, are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above examples are only specific embodiments of the present invention, and are not intended to limit the scope of the present invention, but it should be understood by those skilled in the art that the present invention is not limited thereto, and that the present invention is described in detail with reference to the foregoing examples: any person skilled in the art may modify or easily conceive of the technical solution described in the foregoing embodiments, or perform equivalent substitution of some of the technical features, while remaining within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. An interface resource loading method, which is characterized by comprising the following steps:
responding to loading operation of a target interface, and acquiring a node tree corresponding to the target interface; the node tree comprises a plurality of nodes; the node corresponds to part of the content in the target interface; the plurality of nodes have a hierarchical relationship and a connection relationship; the hierarchy between the interconnected nodes is different;
Determining a content loading order in the target interface according to the hierarchical relationship among the plurality of nodes;
and carrying out framing loading on the content resources required to be loaded by the node according to the content loading order to obtain interface content of the target interface.
2. The method of claim 1, wherein the step of determining the order of loading content in the target interface according to the hierarchical relationship between the plurality of nodes comprises:
determining the sequence of traversing the nodes from the highest hierarchy layer by layer from left to right as the content loading sequence in the target interface; wherein the content loading order includes a loading order of content resources that each of the plurality of nodes needs to load.
3. The method according to claim 1, wherein the step of framing and loading the content resources to be loaded by the node according to the content loading order to obtain the interface content of the target interface includes:
generating an object corresponding to each node based on the plurality of nodes;
and carrying out framing loading on the content resources which need to be loaded by the nodes corresponding to the objects according to the content loading order so as to obtain the target interface containing the objects and the content resources corresponding to the objects.
4. The method according to claim 3, wherein the step of framing and loading the content resources that need to be loaded by the node corresponding to the object according to the content loading order includes:
placing objects which need to load content resources in the objects corresponding to the nodes into a queue to be loaded; the arrangement order of the objects in the queue to be loaded is matched with the content loading order;
sequentially taking out target objects from the queue to be loaded according to the content loading order; and loading the content resources which are required to be loaded and correspond to the target object by adopting a framing loader.
5. The method of claim 4, wherein each object in the queue to be loaded holds a resource loading path for indicating a storage location of a content resource that the object needs to load; the step of loading the content resource to be loaded corresponding to the target object by adopting a framing loader comprises the following steps:
and loading the content resources to be loaded of the target object from the resource loading path saved by the target object by adopting the framing loader.
6. The method of claim 4, wherein the target objects are sequentially fetched from the to-be-loaded queue in the content loading order; before the step of loading the content resource to be loaded corresponding to the target object by adopting a framing loader, the method further comprises the following steps:
setting loading parameters in the framing loader; wherein the loading parameters include: single frame maximum load time and/or single frame maximum load.
7. A method according to claim 3, wherein each of the plurality of nodes holds node configuration information;
the step of generating an object corresponding to each node based on the plurality of nodes includes:
sequentially analyzing each node of the plurality of nodes based on the sequence of performing preamble traversal by each node of the plurality of nodes;
in the parsing process, for each node, generating an object corresponding to the current node based on node configuration information of the current node.
8. An interface resource loading device, characterized in that the device comprises:
the node tree acquisition module is used for responding to the loading operation of the target interface and acquiring a node tree corresponding to the target interface; the node tree comprises a plurality of nodes; the node corresponds to part of the content in the target interface; the plurality of nodes have a hierarchical relationship and a connection relationship; the hierarchy between the interconnected nodes is different;
A content loading order determining module, configured to determine a content loading order in the target interface according to a hierarchical relationship between the plurality of nodes;
and the resource loading module is used for carrying out framing loading on the content resources required to be loaded by the node according to the content loading sequence to obtain the interface content of the target interface.
9. An electronic device comprising a processor and a memory, the memory storing machine executable instructions executable by the processor, the processor executing the machine executable instructions to implement the interface resource loading method of any one of claims 1 to 7.
10. A computer readable storage medium storing computer executable instructions which, when invoked and executed by a processor, cause the processor to implement the interface resource loading method of any one of claims 1 to 7.
CN202211083162.7A 2022-09-06 2022-09-06 Interface resource loading method and device and electronic equipment Pending CN116302146A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211083162.7A CN116302146A (en) 2022-09-06 2022-09-06 Interface resource loading method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211083162.7A CN116302146A (en) 2022-09-06 2022-09-06 Interface resource loading method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN116302146A true CN116302146A (en) 2023-06-23

Family

ID=86798320

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211083162.7A Pending CN116302146A (en) 2022-09-06 2022-09-06 Interface resource loading method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN116302146A (en)

Similar Documents

Publication Publication Date Title
CN111552473B (en) Application processing method, device and equipment
CN110489116B (en) Page rendering method and device and computer storage medium
RU2305860C2 (en) System for providing hosting to objects of graphical composition or representation
US8599217B1 (en) Methods and apparatus for reordering of rows and columns in layout grids
CN111639289A (en) Webpage loading method and device
US20120110437A1 (en) Style and layout caching of web content
WO2022089189A1 (en) Interactive plot jump method, interactive plot interface display method and apparatus, and device
CN111026490B (en) Page rendering method and device, electronic equipment and storage medium
US20230403437A1 (en) Graphics engine and graphics processing method applicable to player
CN110806847A (en) Distributed multi-screen display method, device, equipment and system
CN110727825A (en) Animation playing control method, device, server and storage medium
US7830397B2 (en) Rendering multiple clear rectangles using a pre-rendered depth buffer
CN111666100A (en) Software framework generation method and device, electronic equipment and storage medium
CN116302146A (en) Interface resource loading method and device and electronic equipment
JPH11306170A (en) Document production device
CN114356327A (en) React visual area rendering method and device
CN112732252A (en) Method and device for dynamically generating UI (user interface) and electronic equipment
CN113779466B (en) Page display method and device, storage medium and electronic equipment
CN116595284B (en) Webpage system operation method, device, equipment, storage medium and program
CN113641358A (en) Page generation and page display method and device
CN113886228A (en) Compatibility detection method and device, storage medium and electronic equipment
CN114580363A (en) Method and device for displaying web page table
CN115758024A (en) Data state processing method and system and electronic equipment
CN116628272A (en) Tree structure node rapid selection method based on vue framework
US8490114B1 (en) Method and apparatus for accessing rich internet content

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination