Resource subcontracting method, device, equipment and storage medium

By obtaining resource dependencies for automated subcontracting, the problems of low resource packaging efficiency and high memory footprint in the existing technology are solved, and efficient resource loading and reduced memory footprint are achieved.

CN114237868BActive Publication Date: 2025-07-29SHANGYU SOFTWARE (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111351244.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-15
Publication Date
2025-07-29
Estimated Expiration
2041-11-15

AI Technical Summary

Technical Problem

The existing technology requires manual sorting of resource directories and relationships when packaging resources, which are inefficient and prone to errors, resulting in slow resource loading and high memory usage.

Method used

By obtaining the dependency resource tree of each root resource, determining the dependency resource list, and subcontracting resources according to the dependency relationship, reducing the number of redundant resources, reducing the number of dependent resource packages, and automating the resource subcontracting process.

Benefits of technology

It improves resource subcontracting and packaging efficiency, reduces resource loading time and memory usage, and avoids inefficiency and errors in manual resource structuring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114237868B_ABST
    Figure CN114237868B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of computers, and discloses a resource subcontracting method, device, equipment and storage medium. The present invention obtains the dependency resource trees of each root resource, determines the dependency resource lists corresponding to each root resource according to the dependency resource trees, and loads the dependency resources according to the dependency resource lists; determines the root resource lists corresponding to each dependency resource according to the dependency relationships between the dependency resources and the root resources; subcontracts the root resources according to the dependency relationships in combination with configurations or folders to obtain a number of root resource data packets; subcontracts the dependency resources according to the root resource lists to obtain a number of dependency resource data packets. Since the resources are divided into root resources and dependency resources during resource subcontracting, and then resource subcontracting can be carried out according to the dependency relationships between the root resources and the dependency resources, there is no need for manual arrangement of resource relationships and resource subcontracting, which improves the efficiency of resource subcontracting and packaging, reasonably and effectively improves the resource loading efficiency and reduces the resource memory occupation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular, to a resource subcontracting method, device, equipment and storage medium. Background Art

[0002] AssetBundle is a resource packaging method provided by the Unity engine, which can package and compress any resources except C# scripts. This resource compression package can contain multiple resources, and the required resources can be loaded from the resource compression package during runtime.

[0003] Currently, when performing hot updates on game software, the loaded resource packages are all pre-processed by Assetbundle packaging. AssetBundle packaging can reduce the size of the installation package. However, in actual use, the dependency relationships between various resources are very complex. If the resources are not reasonably subcontracted, the dependency relationships between resource data packets will be complex, and too many dependent resource data packets need to be loaded when loading resources, resulting in slow loading and high memory occupancy. Sorting out resource relationships and subcontracting dependent resources rely on manual processing, which is costly, inefficient, and extremely error-prone when there are many dependent resources.

[0004] The above content is only used to assist in understanding the technical solution of the present invention, and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main purpose of the present invention is to provide a resource subcontracting method, device, equipment and storage medium, aiming to solve the technical problem of low execution efficiency in manually sorting out the resource directory and resource relationships when packaging resources in the prior art.

[0006] To achieve the above purpose, the present invention provides a resource subcontracting method, and the method includes the following steps:

[0007] Obtain the dependency resource tree of each root resource, determine the dependency resource list corresponding to each root resource according to the dependency resource tree, and load the dependent resources according to the dependency resource list;

[0008] Determine the root resource list corresponding to each dependent resource according to the dependency relationship between the dependent resource and the root resource;

[0009] Subcontract the root resources according to the dependency resource list to obtain several root resource data packets;

[0010] Subcontract the dependent resources according to the root resource list to obtain several dependent resource data packets.

[0011] Optionally, before the step of subcontracting the root resources according to the list of dependent resources to obtain a plurality of root resource data packets, the method further includes:

[0012] Determining whether there is a circular dependency between the root resources and the dependent resources according to the list of root resources and the list of dependent resources;

[0013] If not, execute the step of subcontracting the root resources according to the list of dependent resources to obtain a plurality of root resource data packets.

[0014] Optionally, after the step of determining whether there is a circular dependency between the root resources and the dependent resources according to the list of root resources and the list of dependent resources, the method further includes:

[0015] If so, mark the root resources and dependent resources that form a circular dependency as circular resources;

[0016] Incorporate the circular resources into the same resource package to obtain a circular resource data packet, and execute the step of subcontracting the root resources according to the list of dependent resources to obtain a plurality of root resource data packets.

[0017] Optionally, the step of subcontracting the root resources according to the list of dependent resources to obtain a plurality of root resource data packets includes:

[0018] Obtaining the list of dependent resources corresponding to each root resource;

[0019] Incorporate the root resources with the same list of dependent resources into the same resource package to obtain a plurality of root resource data packets.

[0020] Optionally, the step of subcontracting the dependent resources according to the list of root resources to obtain a plurality of dependent resource data packets includes:

[0021] Obtaining the list of root resources corresponding to each dependent resource;

[0022] Incorporate the dependent resources with the same list of root resources into the same resource package to obtain a plurality of dependent resource data packets.

[0023] Optionally, after the step of subcontracting the dependent resources according to the list of root resources to obtain a plurality of dependent resource data packets, the method further includes:

[0024] Regarding the dependent resource data packet that is only dependent on one resource data packet as the target resource data packet;

[0025] Incorporate the target resource data packet into the resource data packet corresponding to the target resource data packet.

[0026] Optionally, the steps of obtaining the dependency resource tree of each root resource, determining the dependency resource list corresponding to each root resource according to the dependency resource tree, and loading the dependency resources according to the dependency resource list include:

[0027] Determine the root resource path according to the resource list specified by the user;

[0028] Load a number of root resources according to the root resource path;

[0029] Read the dependency configuration file corresponding to each root resource to obtain the dependency resource tree corresponding to each root resource;

[0030] Traverse the dependency resource tree, and determine the dependency resource list corresponding to each root resource according to the traversal result;

[0031] Determine the dependency resource path according to the dependency resource list, and load the dependency resources according to the dependency resource path.

[0032] In addition, to achieve the above object, the present invention also provides a resource sub-packaging device, which includes the following modules:

[0033] A resource acquisition module, configured to obtain the dependency resource tree of each root resource, determine the dependency resource list corresponding to each root resource according to the dependency resource tree, and load the dependency resources according to the dependency resource list;

[0034] A dependency sorting module, configured to determine the root resource list corresponding to each dependency resource according to the dependency relationship between the dependency resource and the root resource;

[0035] A root resource processing module, configured to sub-package the root resources according to the dependency resource list to obtain a number of root resource data packets;

[0036] A dependency resource processing module is further configured to sub-package the dependency resources according to the root resource list to obtain a number of dependency resource data packets.

[0037] In addition, to achieve the above object, the present invention also provides a resource sub-packaging device, which includes: a processor, a memory, and a resource sub-packaging program stored on the memory and executable on the processor. When the resource sub-packaging program is executed by the processor, the steps of the resource sub-packaging method described above are implemented.

[0038] In addition, to achieve the above object, the present invention also provides a computer-readable storage medium, on which a resource sub-packaging program is stored. When the resource sub-packaging program is executed, the steps of the resource sub-packaging method described above are implemented.

[0039] The present invention obtains the dependency resource trees of each root resource, determines the dependency resource lists corresponding to each root resource according to the dependency resource trees, and loads the dependency resources according to the dependency resource lists; determines the root resource lists corresponding to each dependency resource according to the dependency relationship between the dependency resources and the root resources; subcontracts the root resources according to the dependency resource lists to obtain a number of root resource data packets; and subcontracts the dependency resources according to the root resource lists to obtain a number of dependency resource data packets. Since the resources are divided into root resources and dependency resources during resource subcontracting, and then resource subcontracting can be performed according to the dependency relationship between the root resources and the dependency resources, the number of redundant resources is reduced, the number of dependency resource packets of the root resources is reduced, the number of dependency resource packets that need to be loaded is reduced, and there is no need for manual arrangement of resource relationships and resource subcontracting, thereby improving the efficiency of resource subcontracting and packaging, and reasonably and effectively improving the resource loading efficiency and reducing the resource memory occupation. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 is a schematic structural diagram of an electronic device in the hardware operating environment related to the solution of the embodiment of the present invention;

[0041] Figure 2 is a schematic flowchart of the first embodiment of the resource subcontracting method of the present invention;

[0042] Figure 3 is a schematic diagram of the resource dependency relationship of an embodiment of the present invention;

[0043] Figure 4 is a schematic flowchart of the second embodiment of the resource subcontracting method of the present invention;

[0044] Figure 5 is a structural block diagram of the first embodiment of the resource subcontracting device of the present invention.

[0045] The implementation, functional features and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0046] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0047] Refer to Figure 1 , Figure 1 is a schematic structural diagram of a resource subcontracting device in the hardware operating environment related to the solution of the embodiment of the present invention.

[0048] As Figure 1As shown in the figure, the electronic device may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard). Optionally, the user interface 1003 may further include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a Wireless-Fidelity (WI-FI) interface). The memory 1005 may be a high-speed Random Access Memory (RAM), or a stable Non-Volatile Memory (NVM), such as a disk memory. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0049] Those skilled in the art can understand that Figure 1 the structure shown in the figure does not constitute a limitation on the electronic device, and it may include more or fewer components than shown in the figure, or combine some components, or have different component arrangements.

[0050] As Figure 1 shown, in the memory 1005 as a storage medium, there may be included an operating system, a network communication module, a user interface module, and a resource subcontracting program.

[0051] In Figure 1 the electronic device shown in the figure, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the electronic device of the present invention may be provided in a resource subcontracting device. The electronic device calls the resource subcontracting program stored in the memory 1005 through the processor 1001 and executes the resource subcontracting method provided by the embodiments of the present invention.

[0052] The embodiments of the present invention provide a resource subcontracting method. Referring to Figure 2 , Figure 2 it is a schematic flowchart of the first embodiment of a resource subcontracting method of the present invention.

[0053] In this embodiment, the resource subcontracting method includes the following steps:

[0054] Step S10: Obtain the dependency resource tree of each root resource, determine the dependency resource list corresponding to each root resource according to the dependency resource tree, and load the dependency resources according to the dependency resource list.

[0055] It should be noted that the execution subject of this embodiment may be the resource subcontracting device. The resource subcontracting device may be an electronic device such as a personal computer or a server, or other devices that can implement the same or similar functions. This embodiment does not limit this. In this embodiment and the following embodiments, the resource subcontracting method of the present invention will be described by taking the resource subcontracting device as an example.

[0056] It should be noted that resource dependency means that one resource references another resource. The resource that is relied on by other resources can be called a dependent resource. Resource dependency can be divided into direct dependency and indirect dependency according to the reference relationship. For example: if resource A directly references resource b, then resource b is a dependent resource at this time, and resource A directly depends on resource b; if resource A directly references resource b, and resource b references resource c, then both resource b and resource c are dependent resources at this time, and resource A indirectly depends on resource c. The root resource can be a resource specified by the user that needs to be packaged. For example: if the user specifies to package resource A, then resource A can be used as the root resource at this time. The dependent resource tree can be a tree-shaped data including the resource information of all dependent resources of the root resource. The root node in the dependent resource tree stores the resource information of the root resource, and the child nodes store the resource information of the dependent resources of the resource corresponding to the parent node. Among them, the resource information can include information such as the resource name and the resource access path. Determining the dependent resource list corresponding to the root resource according to the dependent resource tree can be to traverse the nodes in the dependent resource tree, traverse all the nodes in the dependent resource tree, and then the resource information of the dependent resources directly or indirectly depended on by the root resource can be obtained, so as to obtain the dependent resource list.

[0057] It can be understood that the dependent resource list includes the resource information of each dependent resource, and the resource information includes the resource access path. Therefore, after obtaining the dependent resource list corresponding to the root resource, the resource information of each dependent resource in the dependent resource list can be read, the resource information can be parsed to obtain the resource access path, and the dependent resources can be loaded according to the resource access path.

[0058] Furthermore, in order to meet the actual needs of users as much as possible and reduce the operation difficulty of users during the packaging process, step S10 in this embodiment may include:

[0059] Determine the root resource path according to the resource list specified by the user;

[0060] Load a number of root resources according to the root resource path;

[0061] Read the dependent configuration files corresponding to each root resource to obtain the dependent resource trees corresponding to each root resource;

[0062] Traverse the dependency resource tree and determine the list of dependency resources corresponding to each root resource according to the traversal result;

[0063] Determine the dependency resource path according to the list of dependency resources, and load the dependency resources according to the dependency resource path.

[0064] It should be noted that the root resource path can be the resource access path of the root resource. When the user performs packaging, the root resources to be packaged may belong to different folders or even different servers, and it is difficult for the user to select them one by one manually. For the convenience of the user, the user can write a resource list in a preset format according to the resource access paths of the root resources to be loaded, and send the resource list to the resource sub-packaging device. Then the resource sub-packaging device can parse the resource list to obtain the root resource paths of the root resources, and then obtain and load the root resources according to the root resource paths.

[0065] It should be noted that when a resource makes a resource reference, it will write the resource information of the dependent dependency resource into the dependency configuration file. Therefore, by reading the data in the dependency configuration file corresponding to the root resource and loading the read data in a tree-like data, the dependency resource tree corresponding to the root resource can be obtained.

[0066] In actual use, traversing the dependency resource tree and determining the list of dependency resources corresponding to each root resource according to the traversal result can be to traverse the dependency resource tree in a recursive traversal manner to obtain the list of dependency resources corresponding to the root resource. Among them, in order to avoid infinite loop recursion, during the recursive traversal of the dependency resource tree, if the node is a root resource, the node can no longer be recursively traversed.

[0067] It should be noted that the dependency resource path can be the resource access path of the dependency resource. Determining the dependency resource path according to the list of dependency resources and loading the dependency resources according to the dependency resource path can be to parse the list of dependency resources to obtain the resource information corresponding to each dependency resource, determine the dependency resource path corresponding to each dependency resource according to the resource information, and then obtain and load the dependency resources according to the dependency resource path.

[0068] Step S20: Determine the list of root resources corresponding to each dependency resource according to the dependency relationship between the dependency resources and the root resources.

[0069] It should be noted that a dependent resource can be directly or indirectly dependent on multiple root resources at the same time. Determining the root resource list corresponding to a dependent resource based on the dependency relationship between the dependent resource and the root resource can be done by determining all root resources that directly or indirectly depend on the dependent resource based on the dependency relationship between the dependent resource and the root resource, and aggregating the resource information of the root resources that directly or indirectly depend on the dependent resource to obtain a root resource list. For example: root resource A directly depends on resource b, resource b depends on resource c, and root resource B depends on resource c. If dependent resource c is directly or indirectly dependent on both root resource A and root resource B, then the resource information of root resource A and root resource B can be obtained, and the root resource list corresponding to dependent resource c can be constructed based on the resource information of root resource A and root resource B.

[0070] Step S30: Sub-packaging the root resource according to the dependent resource list to obtain a plurality of root resource data packets.

[0071] It should be noted that the root resources can be packaged according to the dependent resource list to obtain several root resource data packets. The root resources can be divided into several groups according to the dependent resource list corresponding to the root resources. After grouping, the root resources divided into the same group are packaged into a resource package, thereby obtaining several root resource data packets.

[0072] Furthermore, in order to minimize resource usage, step S30 in this embodiment may include:

[0073] Obtain a list of dependent resources corresponding to each root resource; merge root resources with the same dependent resource list into the same resource package to obtain several root resource data packages.

[0074] It should be noted that if the dependency resource lists corresponding to two root resources are exactly the same, it means that the dependency resources of these two root resources are exactly the same. Incorporating root resources with exactly the same dependency resources into the same resource package will not affect the resource call of the root resource. Therefore, root resources with the same dependency resource list can be incorporated into the same resource package to obtain multiple resource packages. At this time, each resource package is a root resource data package.

[0075] It is understandable that by changing the process of packaging each root resource into a separate resource package to packaging multiple root resources with the same dependent resources into one resource package, the compression ratio can be further increased, the space occupied by resources can be reduced, and the speed of resource loading will be faster, which can improve the resource loading efficiency.

[0076] Step S40: Packaging the dependent resources according to the root resource list to obtain a plurality of dependent resource data packets.

[0077] It should be noted that subcontracting the dependent resources according to the root resource list to obtain a number of dependent resource data packets may mean dividing the dependent resources into several groups according to the root resource list corresponding to the dependent resources, and after grouping, packaging the dependent resources in the same group into a resource packet, so as to obtain a number of dependent resource data packets.

[0078] In actual use, after subcontracting the root resources into a number of root resource data packets and subcontracting the dependent resources into a number of dependent resource data packets, the root resource data packets and the dependent resource data packets can be packaged into an AssetBundle package by using a packaging (Builder) tool, and the link of setting the BundleName can be skipped, thus forming a Build package, and the software can be hot updated according to the Build package.

[0079] Furthermore, in order to minimize the resource occupancy space as much as possible, step S40 in this embodiment may include:

[0080] Obtain the root resource list corresponding to each dependent resource; incorporate the dependent resources with the same root resource list into the same resource packet to obtain a number of dependent resource data packets.

[0081] It should be noted that if the root resource lists corresponding to two dependent resources are exactly the same, it means that these two dependent resources are dependent on the same root resource. Incorporating the dependent resources that are dependent on the same root resource into the same resource packet to form a dependent resource data packet, then the root resource can directly call the dependent resource data packet, which will not affect the resource call of the root resource.

[0082] It can be understood that the traditional packaging method incorporates the root resources and the dependent resources into the same resource packet, and the dependent resources of multiple root resources may be the same. In this case, there will be duplicate packaging of the dependent resources. Incorporating the dependent resources with the same root resource list into the same resource packet, the root resources with the same dependent resources can directly depend on the dependent resource data packet, which can avoid duplicate packaging of the dependent resources and can further reduce the resource occupancy space.

[0083] Furthermore, in order to further reduce the resource occupancy space, after step S40 in this embodiment, it may further include:

[0084] Take the dependent resource data packet that is only dependent on one resource data packet as the target resource data packet; incorporate the target resource data packet into the resource packet corresponding to the target resource data packet.

[0085] It should be noted that the dependent resource data packet that is only dependent on one resource data packet may be a dependent resource data packet that is only referenced by one root resource data packet, or a dependent resource data packet that is only referenced by one dependent resource data packet.

[0086] It is understandable that if a dependent resource data packet is only dependent on by one resource data packet, that is, it means that the dependent resource data packet is not referenced by other resource data packets, then there is no need for the dependent resource data packet to form a separate resource data packet. The dependent resource data packet can be incorporated into the resource data packet that references the dependent resource data packet, further improving the resource compression ratio and reducing the resource occupancy space.

[0087] For ease of understanding, reference Figure 3 is made for illustration, but the solution of the present invention is not limited thereby. Figure 3 is a schematic diagram of the resource dependency relationship of the present invention. Among them, capital letters represent root resources, lowercase letters represent dependent resources, and the arrow direction represents the dependency relationship. For example: if A points to a through an arrow, it means that the root resource A depends on the dependent resource a. According to Figure 3 the dependency relationship, the subcontracting situation is as follows:

[0088] The root resources A, B, and E all depend on the dependent resources a, h, u, b, i, v, c, p, w, e, l, x. The dependent resources of the root resources A, B, and E are completely the same and can be incorporated into the same resource package A1.

[0089] The root resources C and D both depend on the dependent resources c, p, u, w, d, k, y. The dependent resources of the root resources C and D are completely the same and are incorporated into the same resource package A2.

[0090] The root resources F and G both depend on the dependent resources f, s, y, g, t, z. The dependent resources of the root resources F and G are completely the same and are incorporated into the same resource package A3.

[0091] The dependent resources f, s, g, t, z are only dependent on by the root resources in the resource package A3. The root resource packages of these dependent resources are completely the same and are incorporated into the same resource package B1.

[0092] The dependent resources a, h, b, i, v, e, l, x are all dependent on by the root resources in the resource package A1. The root resource packages of these resources are completely the same and are incorporated into the same package B2.

[0093] The dependent resources c, p, u, w are all dependent on by the root resources in the resource packages A1 and A2. The root resource packages of these resources are completely the same and are incorporated into the same package B3.

[0094] The dependent resources d, k are all dependent on by the root resources in the resource package A2. The root resource packages of these resources are completely the same and are incorporated into the same package B4.

[0095] The dependent resource y is referenced by the resource packages A1, A2, and A3 and is placed separately in a resource package B5.

[0096] Resource package B1 is only dependent on resource package A3, so the resources in resource package B1 are incorporated into resource package A3. Resource package B4 is only dependent on resource package A2, so the resources in resource package B4 are incorporated into resource package A2. Then, resource package B2 is only dependent on resource package A1, so the resources in resource package B2 are incorporated into resource package A1.

[0097] In summary, 27 resources are divided into 7 resource packages such as A1, A2, A3, B3, and B5.

[0098] In this embodiment, by obtaining the dependency resource trees of each root resource, determining the dependency resource lists corresponding to each root resource according to the dependency resource trees, and loading the dependency resources according to the dependency resource lists; determining the root resource lists corresponding to each dependency resource according to the dependency relationships between the dependency resources and the root resources; subcontracting the root resources according to the dependency resource lists to obtain a number of root resource data packets; and subcontracting the dependency resources according to the root resource lists to obtain a number of dependency resource data packets. Since the resources are divided into root resources and dependency resources during resource subcontracting, and then resource subcontracting can be carried out according to the dependency relationships between the root resources and the dependency resources, the number of redundant resources is reduced, the number of dependency resource packages of the root resources is reduced, the number of dependency resource packages that need to be loaded is reduced, and there is no need for manual arrangement of resource relationships and resource subcontracting, which improves the efficiency of resource subcontracting and packaging, thereby reasonably and effectively improving the resource loading efficiency and reducing the resource memory occupancy.

[0099] Reference Figure 4 , Figure 4 is a schematic flowchart of the second embodiment of a resource subcontracting method of the present invention.

[0100] Based on the above first embodiment, before the step S30 of this embodiment's resource subcontracting method, it further includes:

[0101] Step S21: Judging whether there is a circular dependency between the root resources and the dependency resources according to the root resource list and the dependency resource list.

[0102] It should be noted that circular dependency refers to the situation where a resource indirectly references itself. For example: resource A depends on resource h, resource h depends on resource B, resource B depends on resource i, and resource i depends on resource h. At this time, resource h indirectly references itself, that is, a circular dependency is formed. Judging whether there is a circular dependency between the root resources and the dependency resources according to the root resource list and the dependency resource list can be to judge whether there is a situation where a root resource or a dependency resource indirectly references itself. If there is a situation where a root resource indirectly references itself or a dependency resource indirectly references itself, it can be determined that there is a circular dependency.

[0103] In actual use, if there are circular dependencies in the resource packages, then when the resources are loaded or unloaded, the dependency counts between the resource packages cannot be correctly calculated, and thus the unloading of these resources cannot be automatically managed. Therefore, before performing resource subcontracting, it is necessary to first determine whether there are circular dependencies among the root resources and dependent resources. After performing additional processing on the root resources or dependent resources that form circular dependencies, subsequent steps can be carried out.

[0104] It can be understood that if there are no circular dependencies among the root resources and dependent resources, it means that there are no root resources or dependent resources that indirectly reference themselves, and no additional processing is required. Therefore, step S30 can be directly executed.

[0105] Step S22: If there are circular dependencies, mark the root resources and dependent resources that form circular dependencies as circular resources.

[0106] It should be noted that the root resources and dependent resources that form circular dependencies can be all the root resources and dependent resources involved in the dependency chain when the root resources or dependent resources indirectly reference themselves. For example: Resource A depends on resource h, resource h depends on resource B, resource B depends on resource i, and resource i depends on resource h. Among them, A and B are root resources, and i and h are dependent resources. At this time, the dependent resource h indirectly references itself, that is, a circular dependency is formed. The dependency chain that forms the circular dependency is h - B - i - h. Then, at this time, the root resource B and the dependent resources i and h are the root resources and dependent resources that form circular dependencies. Therefore, the root resource B and the dependent resources i and h can be marked as circular resources.

[0107] Step S23: Incorporate the circular resources into the same resource package to obtain a circular resource data packet.

[0108] It should be noted that if there are circular dependencies in the resource packages, then when the resources are loaded or unloaded, the dependency counts between the resource packages cannot be correctly calculated, and thus the unloading of these resources cannot be automatically managed. For the convenience of management, the circular resources can be incorporated into the same resource package. Then, the reference relationship of this circular dependency only appears in one resource package and will not be associated with other resource packages, which is convenient for management.

[0109] It can be understood that after performing additional processing on the root resources or dependent resources that form circular dependencies, the remaining root resources and dependent resources can be normally subcontracted for resources. Therefore, step S30 can be executed.

[0110] In this embodiment, it is determined whether there is a circular dependency between the root resources and the dependent resources according to the root resource list and the dependent resource list; if so, the root resources and the dependent resources that form the circular dependency are marked as circular resources; the circular resources are incorporated into the same resource package to obtain a circular resource data packet. Since it is detected whether there is a circular dependency before resource sub-packaging of the root resources and the dependent resources, when there is a circular dependency, the root resources and the dependent resources that form the circular dependency are incorporated into the same resource package to generate a circular resource data packet, and then the remaining root resources and dependent resources are sub-packaged, avoiding the abnormal resource management phenomenon caused by the circular dependency and improving the reliability of the resource sub-packaging method of the present invention.

[0111] In addition, an embodiment of the present invention further provides a storage medium, on which a resource sub-packaging program is stored, and when the resource sub-packaging program is executed by a processor, the steps of the resource sub-packaging method as described above are implemented.

[0112] Referring to Figure 5 , Figure 5 is a structural block diagram of the first embodiment of the resource sub-packaging device of the present invention.

[0113] As Figure 5 shown, the resource sub-packaging device proposed in the embodiment of the present invention includes:

[0114] A resource acquisition module 10, configured to acquire a dependent resource tree of each root resource, determine a dependent resource list corresponding to each root resource according to the dependent resource tree, and load dependent resources according to the dependent resource list;

[0115] A dependency sorting module 20, configured to determine a root resource list corresponding to each dependent resource according to the dependency relationship between the dependent resources and the root resources;

[0116] A root resource processing module 30, configured to sub-package the root resources according to the dependent resource list to obtain a plurality of root resource data packets;

[0117] A dependent resource processing module 40 is further configured to sub-package the dependent resources according to the root resource list to obtain a plurality of dependent resource data packets.

[0118] In this embodiment, by obtaining the dependency resource trees of each root resource, determining the dependency resource lists corresponding to each root resource according to the dependency resource trees, and loading the dependency resources according to the dependency resource lists; determining the root resource lists corresponding to each dependency resource according to the dependency relationships between the dependency resources and the root resources; subcontracting the root resources according to the dependency resource lists to obtain a number of root resource data packets; and subcontracting the dependency resources according to the root resource lists to obtain a number of dependency resource data packets. Since the resources are divided into root resources and dependency resources during resource subcontracting, and then resource subcontracting can be performed according to the dependency relationships between the root resources and the dependency resources, the number of redundant resources is reduced, the number of dependency resource packets of the root resources is reduced, the number of dependency resource packets that need to be loaded is decreased, and there is no need for manual arrangement of resource relationships and resource subcontracting, thus improving the efficiency of resource subcontracting and packaging, and reasonably and effectively improving the resource loading efficiency and reducing the resource memory occupation.

[0119] Further, the root resource processing module 30 is further configured to determine whether there is a circular dependency between the root resources and the dependency resources according to the root resource list and the dependency resource list; if not, execute the step of subcontracting the root resources according to the dependency resource list to obtain a number of root resource data packets.

[0120] Further, the root resource processing module 30 is further configured to, if there is, mark the root resources and the dependency resources that form a circular dependency as circular resources; incorporate the circular resources into the same resource packet to obtain a circular resource data packet, and execute the step of subcontracting the root resources according to the dependency resource list to obtain a number of root resource data packets.

[0121] Further, the root resource processing module 30 is further configured to obtain the dependency resource lists corresponding to each root resource; incorporate the root resources with the same dependency resource list into the same resource packet to obtain a number of root resource data packets.

[0122] Further, the dependency resource processing module 40 is further configured to obtain the root resource lists corresponding to each dependency resource; incorporate the dependency resources with the same root resource list into the same resource packet to obtain a number of dependency resource data packets.

[0123] Further, the dependency resource processing module 40 is further configured to use the dependency resource packet that is only dependent on one resource packet as the target resource packet; incorporate the target resource packet into the resource packet corresponding to the target resource packet.

[0124] Further, the resource acquisition module 10 is further configured to determine a root resource path according to a resource list specified by a user; load a plurality of root resources according to the root resource path; read a dependency configuration file corresponding to each root resource to obtain a dependency resource tree corresponding to each root resource; traverse the dependency resource tree, and determine a dependency resource list corresponding to each root resource according to a traversal result; determine a dependency resource path according to the dependency resource list, and load dependency resources according to the dependency resource path.

[0125] It should be understood that the above is only an example for illustration and does not constitute any limitation to the technical solution of the present invention. In specific applications, those skilled in the art can set according to needs, and the present invention does not make any limitation thereto.

[0126] It should be noted that the above-described work process is only illustrative and does not constitute a limitation to the protection scope of the present invention. In actual applications, those skilled in the art can select some or all of them according to actual needs to achieve the purpose of the solution of this embodiment, and no limitation is made here.

[0127] In addition, for technical details not described in detail in this embodiment, reference can be made to the resource subcontracting method provided in any embodiment of the present invention, and details will not be repeated here.

[0128] In addition, it should be noted that in this article, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or system. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, article or system including that element.

[0129] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

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

[0131] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be similarly included in the patent protection scope of the present invention.

Claims

1. A resource subcontracting method, characterized in that, The resource subcontracting method includes the following steps: Obtain the dependency resource trees of each root resource, determine the dependency resource lists corresponding to each root resource according to the dependency resource trees, and load the dependency resources according to the dependency resource lists; Determine the root resource lists corresponding to each dependency resource according to the dependency relationship between the dependency resources and the root resources; Subcontract the root resources according to the dependency resource lists to obtain a number of root resource data packets; Subcontract the dependency resources according to the root resource lists to obtain a number of dependency resource data packets; The step of subcontracting the root resources according to the dependency resource lists to obtain a number of root resource data packets includes: Obtain the dependency resource lists corresponding to each root resource; Merge the root resources with the same dependency resource list into the same resource packet to obtain a number of root resource data packets; The step of subcontracting the dependency resources according to the root resource lists to obtain a number of dependency resource data packets includes: Obtain the root resource lists corresponding to each dependency resource; Merge the dependency resources with the same root resource list into the same resource packet to obtain a number of dependency resource data packets.

2. The resource subcontracting method according to claim 1, characterized in that, Before the step of subcontracting the root resources according to the dependency resource lists to obtain a number of root resource data packets, it further includes: Judge whether there is a circular dependency between the root resources and the dependency resources according to the root resource lists and the dependency resource lists; If not, execute the step of subcontracting the root resources according to the dependency resource lists to obtain a number of root resource data packets.

3. The resource subcontracting method according to claim 2, wherein, After the step of judging whether there is a circular dependency between the root resources and the dependency resources according to the root resource lists and the dependency resource lists, it further includes: If there is, mark the root resources and dependency resources that form a circular dependency as circular resources; Merge the circular resources into the same resource packet to obtain a circular resource data packet, and execute the step of subcontracting the root resources according to the dependency resource lists to obtain a number of root resource data packets.

4. The resource subcontracting method according to claim 1, wherein After the step of subcontracting the dependency resources according to the root resource lists to obtain a number of dependency resource data packets, it further includes: Regard the dependency resource data packet that is only depended on by one resource data packet as the target resource data packet; Merge the target resource data packet into the resource data packet corresponding to the target resource data packet, and the resource data packet corresponding to the target resource data packet is the resource data packet that references the target resource data packet.

5. The resource subcontracting method according to any one of claims 1-4, characterized in that The step of obtaining the dependency resource trees of each root resource, determining the dependency resource lists corresponding to each root resource according to the dependency resource trees, and loading the dependency resources according to the dependency resource lists includes: Determine the root resource paths according to the resource list specified by the user; Load a number of root resources according to the root resource paths; Read the dependency configuration files corresponding to each root resource to obtain the dependency resource trees corresponding to each root resource; Traverse the dependency resource trees, and determine the dependency resource lists corresponding to each root resource according to the traversal results; Determine the dependency resource paths according to the dependency resource lists, and load the dependency resources according to the dependency resource paths.

6. A resource subcontracting device, characterized in that, The resource subcontracting device includes the following modules: A resource acquisition module, configured to acquire the dependency resource trees of each root resource, determine the dependency resource lists corresponding to each root resource according to the dependency resource trees, and load the dependency resources according to the dependency resource lists; A dependency sorting module, configured to determine the root resource lists corresponding to each dependency resource according to the dependency relationships between the dependency resources and the root resources; A root resource processing module, configured to subpackage the root resources according to the dependency resource lists to obtain a plurality of root resource data packets; A dependency resource processing module, configured to subpackage the dependency resources according to the root resource lists to obtain a plurality of dependency resource data packets; The root resource processing module is further configured to acquire the dependency resource lists corresponding to each root resource; incorporate the root resources with the same dependency resource lists into the same resource package to obtain a plurality of root resource data packets; The dependency resource processing module is further configured to acquire the root resource lists corresponding to each dependency resource; incorporate the dependency resources with the same root resource lists into the same resource package to obtain a plurality of dependency resource data packets.

7. A resource subcontracting device, characterized in that, The resource subpackaging device includes: a processor, a memory, and a resource subpackaging program stored on the memory and executable on the processor, and when the resource subpackaging program is executed by the processor, the steps of the resource subpackaging method according to any one of claims 1-5 are implemented.

8. A computer-readable storage medium, characterized in that, A resource subpackaging program is stored on the computer-readable storage medium, and when the resource subpackaging program is executed, the steps of the resource subpackaging method according to any one of claims 1-5 are implemented.

Citation Information

Patent Citations

  • Resource-bundle obtaining method and device, equipment and computer readable storage medium

    CN108536463A

  • Resource packaging method and device, server and storage medium

    CN110908697A