CN111399931B - Method and terminal for exporting UI (user interface) resources by LayaAir engine - Google Patents

Method and terminal for exporting UI (user interface) resources by LayaAir engine Download PDF

Info

Publication number
CN111399931B
CN111399931B CN201811634629.6A CN201811634629A CN111399931B CN 111399931 B CN111399931 B CN 111399931B CN 201811634629 A CN201811634629 A CN 201811634629A CN 111399931 B CN111399931 B CN 111399931B
Authority
CN
China
Prior art keywords
interface
resource
resources
character string
array
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.)
Active
Application number
CN201811634629.6A
Other languages
Chinese (zh)
Other versions
CN111399931A (en
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.)
Fujian Tianyi Network Technology Co ltd
Original Assignee
Fujian Tianyi Network Technology 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 Fujian Tianyi Network Technology Co ltd filed Critical Fujian Tianyi Network Technology Co ltd
Priority to CN201811634629.6A priority Critical patent/CN111399931B/en
Publication of CN111399931A publication Critical patent/CN111399931A/en
Application granted granted Critical
Publication of CN111399931B publication Critical patent/CN111399931B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method and a terminal for exporting UI resources by a LayaAir engine, wherein when the export of a UI interface is configured by the LayaAir engine in a separation mode, the dependency relationship between the UI interface and the corresponding UI resources is established; when the UI interface is opened, loading the UI resource corresponding to the UI interface according to the dependency relationship between the UI interface and the corresponding UI resource; when the UI interface is opened, the corresponding UI resources can be automatically loaded according to the dependency relationship, the automation degree is high, the loading process of the UI resources is optimized, and the corresponding UI resources to be loaded can be set, so that targeted loading can be realized, the used resources are configured in the dependency relationship, and the unused resources are not configured, thereby avoiding loading other useless resources and accelerating the exporting speed of the application initial package containing the UI resources.

Description

Method and terminal for exporting UI (user interface) resources by LayaAir engine
Technical Field
The invention relates to the field of computer software, in particular to a method and a terminal for exporting UI (user interface) resources by a LayaAir engine.
Background
Currently, in the process of application development of an IDE editor carried by a layair engine, when a UI resource is exported in a UI separation mode, the following two methods are generally used:
firstly, by adopting a default export mode of a LayaAir engine, a user needs to find a corresponding interface class in json data of each UI interface, namely a LayaUi.max.all.ts file, the interface class is generated by combining the interface name of each interface and a suffix of a UI format, the user needs to find a json data generation data path of a specific UI interface, and then adds a sentence code of this is.
Second, load this, create view (lay, loader, getters ("json data generating datapath for UI interface") data in each interface class created;
in both of the above two methods, the user needs to manually add a code for loading the UI resource corresponding to the UI interface to load the UI resource corresponding to the UI interface, which results in high time consumption and high cost, and affects the speed of exporting the application initial packet including the UI resource.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the method and the terminal for exporting the UI resources by the LayaAir engine can optimize a UI resource loading process and accelerate the exporting speed of the application initial packet containing the UI resources.
In order to solve the technical problems, the invention adopts a technical scheme that:
a method for a layair engine to export UI resources, comprising the steps of:
s1, when exporting a UI interface configured in a separation mode through a LayaAir engine, establishing a dependency relationship between the UI interface and a corresponding UI resource;
s2, when the UI interface is opened, loading the UI resource corresponding to the UI interface according to the dependency relationship between the UI interface and the corresponding UI resource.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
a terminal for a layaiir engine to derive UI resources, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
s1, when exporting a UI interface configured in a separation mode through a LayaAir engine, establishing a dependency relationship between the UI interface and a corresponding UI resource;
s2, when the UI interface is opened, loading the UI resource corresponding to the UI interface according to the dependency relationship between the UI interface and the corresponding UI resource.
The invention has the beneficial effects that: when the export of a UI interface is configured in a separation mode through a LayaAir engine, creating a dependency relationship between the UI interface and a corresponding UI resource; when the UI interface is opened, loading the UI resource corresponding to the UI interface according to the dependency relationship between the UI interface and the corresponding UI resource; when the UI interface is opened, the UI resources corresponding to the dependency relationship can be automatically loaded according to the dependency relationship, the automation degree is high, the loading process of the UI resources is optimized, the corresponding UI resources which need to be loaded can be set, targeted loading can be realized, the used resources are configured in the dependency relationship, configuration is not carried out when the used resources are not used, loading of other useless resources is avoided, and the export speed of the application initial packet containing the UI resources is accelerated.
Drawings
FIG. 1 is a flowchart of a method for a LayaAir engine to export UI resources according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a terminal for exporting UI resources by a layair engine according to an embodiment of the present invention;
description of the reference symbols:
1. the terminal for exporting the UI resource by the LayaAir engine; 2. a memory; 3. a processor.
Detailed Description
In order to explain the technical contents, the objects and the effects of the present invention in detail, the following description is made with reference to the accompanying drawings in combination with the embodiments.
The most key concept of the invention is as follows: by configuring the dependency relationship between the UI interface and the corresponding UI resource, and loading the corresponding UI resource according to the dependency relationship when the UI interface is opened, the loading process of the UI interface is optimized.
Referring to fig. 1, a method for a layair engine to export UI resources includes the steps of:
s1, when exporting a UI interface configured in a separation mode through a LayaAir engine, establishing a dependency relationship between the UI interface and a corresponding UI resource;
s2, when the UI interface is opened, loading the UI resource corresponding to the UI interface according to the dependency relationship between the UI interface and the corresponding UI resource.
From the above description, the beneficial effects of the present invention are: when the export of a UI interface is configured in a separation mode through a LayaAir engine, creating a dependency relationship between the UI interface and a corresponding UI resource; when the UI interface is opened, loading the UI resource corresponding to the UI interface according to the dependency relationship between the UI interface and the corresponding UI resource; the UI resources corresponding to the opened UI interface can be automatically loaded according to the dependency relationship, the automation degree is high, the loading process of the UI resources is optimized, and the development speed of the application is accelerated.
Further, creating the dependency relationship between the UI interface and the UI resource corresponding to the UI interface includes:
traversing UI resources corresponding to the UI interface to obtain character strings corresponding to preset attributes in the UI resources;
splicing the character strings according to a preset rule to obtain spliced character strings;
storing the spliced character strings to an array;
and storing the array into a json file corresponding to the UI interface.
As can be seen from the above description, by storing the array in which the character string is stored in the json file corresponding to the UI interface, the corresponding UI resource can be loaded by reading the corresponding json file when the UI interface is opened, so that the loading process of the UI interface is optimized.
Further, creating the dependency relationship between the UI interface and the corresponding UI resource includes:
judging whether the type of the UI resource is the UI interface resource, if so, executing:
s21, traversing the UI resources to obtain a first character string corresponding to a preset first attribute in the UI resources, wherein the first character string indicates a path of a first picture resource corresponding to the UI interface;
s22, splicing the first character string according to a preset rule to obtain a spliced first character string;
s23, storing the spliced first character string to a first array;
s24, storing the first array into a first json file corresponding to the UI;
if not, judging whether the UI resource is a UI special effect resource, if so, executing the steps S21-S24, and then:
s25, traversing the UI resources to obtain a second character string corresponding to a preset second attribute in the UI resources, wherein the second character string indicates a path of a second picture resource corresponding to the UI interface;
s26, splicing the second character string according to a preset rule to obtain a spliced second character string;
s27, storing the spliced second character string to a second array;
s28, storing the second array into a second json file corresponding to the UI.
According to the description, the json file corresponding to the UI interface is obtained in different modes according to different types of the UI resources, and the pertinence is high.
Further, the storing the spliced character string into an array includes:
and judging whether the spliced character string exists in the array, if so, ignoring the spliced character string, otherwise, storing the spliced character string to the array.
As can be seen from the description, the repeated storage of the character strings can be avoided through the mode, so that the uniqueness of the UI resources stored in the array is ensured.
Further, storing the array into a json file corresponding to the UI interface includes:
judging whether a json file corresponding to the UI exists or not;
if yes, deleting the existing json file, creating a new json file, and storing the array into the new json file;
otherwise, creating a json file corresponding to the UI interface, and storing the array in the json file.
As can be seen from the above description, there may be a case where a json file corresponding to a UI interface has been configured before, but since variability of UI resources is relatively large, the json file is guaranteed to be the latest json file created by the above method, and accuracy of a dependency relationship between a UI interface and a UI resource corresponding to the json file is guaranteed.
Referring to fig. 2, a terminal for a layair engine to export UI resources includes a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
s1, when exporting a UI interface configured in a separation mode through a LayaAir engine, establishing a dependency relationship between the UI interface and a corresponding UI resource;
s2, when the UI interface is opened, loading the UI resource corresponding to the UI interface according to the dependency relationship between the UI interface and the corresponding UI resource.
From the above description, the beneficial effects of the present invention are: when the export of the UI interface is configured in a separation mode through a LayaAir engine, the dependency relationship between the UI interface and the corresponding UI resource is created; when the UI interface is opened, loading the UI resource corresponding to the UI interface according to the dependency relationship between the UI interface and the corresponding UI resource; when the UI interface is opened, the corresponding UI resources can be automatically loaded according to the dependency relationship, the automation degree is high, the loading process of the UI resources is optimized, and the corresponding UI resources to be loaded can be set, so that targeted loading can be realized, the used resources are configured in the dependency relationship, and the unused resources are not configured, thereby avoiding loading other useless resources and accelerating the exporting speed of the application initial package containing the UI resources.
Further, creating the dependency relationship between the UI interface and the corresponding UI resource includes:
traversing the UI resources corresponding to the UI interface to obtain character strings corresponding to preset attributes in the UI resources;
splicing the character strings according to a preset rule to obtain spliced character strings;
storing the spliced character strings to an array;
and storing the array into a json file corresponding to the UI.
According to the description, the array in which the character strings are stored is stored in the json file corresponding to the UI, so that the corresponding UI resources can be loaded only by reading the corresponding json file when the UI is opened, and the loading process of the UI is optimized.
Further, creating the dependency relationship between the UI interface and the corresponding UI resource includes:
judging whether the type of the UI resource is the UI interface resource, if so, executing:
s21, traversing the UI resources to obtain a first character string corresponding to a preset first attribute in the UI resources, wherein the first character string indicates a path of a first picture resource corresponding to the UI interface;
s22, splicing the first character string according to a preset rule to obtain a spliced first character string;
s23, storing the spliced first character string to a first array;
s24, storing the first array into a first json file corresponding to the UI;
if not, judging whether the UI resource is a UI special effect resource, if so, executing the steps S21-S24, and then:
s25, traversing the UI resources to obtain a second character string corresponding to a preset second attribute in the UI resources, wherein the second character string indicates a path of a second picture resource corresponding to the UI interface;
s26, splicing the second character string according to a preset rule to obtain a spliced second character string;
s27, storing the spliced second character string to a second array;
s28, storing the second array into a second json file corresponding to the UI.
According to the description, the json file corresponding to the UI interface is obtained in different modes according to different types of the UI resources, and the pertinence is high.
Further, the storing the spliced character string into an array includes:
and judging whether the spliced character string exists in the array, if so, ignoring the spliced character string, otherwise, storing the spliced character string to the array.
According to the description, the repeated storage of the character strings can be avoided through the mode, and therefore the uniqueness of the UI resources stored in the array is guaranteed.
Further, storing the array in a json file corresponding to the UI interface includes:
judging whether a json file corresponding to the UI exists or not;
if yes, deleting the existing json file, creating a new json file, and storing the array into the new json file;
otherwise, creating a json file corresponding to the UI interface, and storing the array in the json file.
As can be seen from the above description, there may be a case where a json file corresponding to a UI interface has been configured before, but since variability of UI resources is relatively large, the json file is guaranteed to be the latest json file created by the above method, and accuracy of a dependency relationship between a UI interface and a UI resource corresponding to the json file is guaranteed.
Example one
Referring to fig. 1, a method for a layair engine to export UI resources includes the steps of:
s1, when the export of a UI interface is configured in a separation mode through a LayaAir engine, creating a dependency relationship between the UI interface and a corresponding UI resource;
the specific operation of configuring the UI interface in the split mode through the LayaAir engine is as follows:
opening a LayaAir engine, switching to a LayaIDE panel, pressing an F9 shortcut key, selecting a separation mode in a UI mode option column of a pop-up box, inputting 'bin/viewJson/ui.json' (a UI resource storage path under a bin folder of a current project) in a publishing directory input column for loading UI resources, and configuring a UI export mode and a generating path of a json data file of each UI interface in a UI interface data export panel;
wherein, the creating of the dependency relationship between the UI interface and the corresponding UI resource comprises:
traversing the UI resources corresponding to the UI interface to obtain character strings corresponding to preset attributes in the UI resources;
splicing the character strings according to a preset rule to obtain spliced character strings;
storing the spliced character strings to an array;
and storing the array into a json file corresponding to the UI.
The specific steps of creating the dependency relationship between the UI interface and the corresponding UI resource include:
judging whether the type of the UI resource is the UI interface resource, if so, executing:
s21, traversing the UI resources to obtain a first character string corresponding to a preset first attribute in the UI resources, wherein the first character string indicates a path of a first picture resource corresponding to the UI interface;
s22, splicing the first character string according to a preset rule to obtain a spliced first character string;
s23, storing the spliced first character string to a first array;
s24, storing the first array into a first json file corresponding to the UI;
if not, judging whether the UI resource is a UI special effect resource, if so, executing the steps S21-S24, and then:
s25, traversing the UI resources to obtain a second character string corresponding to a preset second attribute in the UI resources, wherein the second character string indicates a path of a second picture resource corresponding to the UI interface;
s26, splicing the second character string according to a preset rule to obtain a spliced second character string;
s27, storing the spliced second character string to a second array;
and S28, storing the second json file corresponding to the UI interface.
Wherein, the storing the spliced character strings to an array comprises:
and judging whether the spliced character string exists in the array, if so, ignoring the spliced character string, otherwise, storing the spliced character string to the array.
Wherein storing the array into a json file corresponding to the UI comprises:
judging whether a json file corresponding to the UI exists or not;
if so, deleting the existing json file, creating a new json file, and storing the array into the new json file;
otherwise, creating a json file corresponding to the UI interface, and storing the array in the json file.
The specific operation of creating the dependency relationship between the UI interface and the corresponding UI resource includes:
determining the position of a CodeManager.obj ToUI function in a layaimer.max.js script under an application root directory of a LayaAir engine, adding a condition judgment statement under an expression of a switch (Math.ceil) in the function, and judging whether a current export mode is a UI separation mode or not;
if so, judging whether the derived UI resource type is a UI interface resource;
if yes, executing the following steps:
step 1, analyzing UI (user interface) resources and defining a first array;
step 2, traversing the UI interface resources, and acquiring a path (namely a skin resource path) of the picture resource of each interface control in the UI interface resources;
the step 2 specifically comprises:
traversing the UI interface resource, acquiring a path of a first picture resource of each interface control in the UI interface resource, intercepting a character string of the path of the first picture resource, acquiring a character string from a first character of the character string to a previous character of a last diagonal bar (namely, the character string of the final picture resource is a character before the last diagonal bar, and characters after the diagonal bar are not acquired), and adding a suffix character string ". Atlas" to obtain a first character string corresponding to the path of the first picture resource (because the atlas name of the LayaAir engine is named by a last folder of the picture resource, the atlas is a collection of numerous scattergrams);
step 3, storing the first character string into a first array;
the step 3 specifically comprises the following steps:
judging whether the first character string exists in the first array or not;
if yes, ignoring the first character string;
otherwise, storing a first character string corresponding to the first picture resource path into a first array;
the specific step of the step 3 is to avoid repeated storage of the first character string;
because there are many data recorded in the array in the javascript script, the specific way of saving the first character string in the first array may be determined according to the actual situation, and the first character string may be saved in the first array in a data structure of [ className: interface class name, atlas { a, B, C } ] (where a, B, C represent the first character string corresponding to the path of the first picture resource of each interface control), and className is the unique identifier of the array: a key, the atlas being a detailed value of the key, so that the corresponding UI resource on which each UI interface depends can be saved into an array.
Step 4, storing the first array into a first json file corresponding to the UI;
if the derived UI resource type is judged not to be the UI interface resource, judging whether the UI resource type is the UI special effect resource, (wherein, the judgment statement of if (type manager, getfiletype (tFile) = = = = = = = = = = = graphic _ animation ") in the codemanager in the source code will judge the UI special effect resource, and after the code judges that the UI resource is the UI special effect resource, the following steps are performed), if yes, the above steps 1-4 are performed to perform the partial processing of the UI special effect resource which is the same as the format of the UI interface resource, and then the processing is performed (the principle is that one part of the UI special effect resource contains the data format of the UI interface resource, and the other part contains the data format unique to the UI special effect resource):
step 5, analyzing the unique data format part of the UI special effect resource;
step 6, traversing the unique data format part of the UI special effect resource, and acquiring a path of a second picture resource (namely acquiring a resource path of skin [ n ] [ "value" ] in each interface control);
wherein the step 6 specifically comprises the following steps:
traversing the UI special effect resource, acquiring a path of a second picture resource of each interface control in the UI special effect resource, intercepting a character string of the path of the second picture resource, acquiring a first character of the character string to a previous character of a last diagonal bar (namely the character string of the final picture resource is a character before the last diagonal bar, and the character after the diagonal bar is not acquired), and adding a suffix character string ". Atlas" to obtain a second character string corresponding to the path of the second picture resource;
step 7, storing a second character string corresponding to the path of the second picture resource into a second array;
wherein the step 7 specifically comprises the following steps:
judging whether the second character string exists in the second array or not;
if yes, ignoring the second character string;
otherwise, storing a second character string corresponding to the path of the second picture resource into a second array;
step 8, storing the second array into a second json file corresponding to the UI;
when the array is stored into a json file corresponding to the UI, judging whether the json file corresponding to the UI exists or not;
if so, deleting the existing json file, creating a new json file, and storing the array into the new json file;
s2, when the UI interface is opened, loading the UI resource corresponding to the UI interface according to the dependency relationship between the UI interface and the corresponding UI resource.
Specifically, before the UI resource corresponding to the UI interface is exported, the layout of the dependency relationship between the UI interface and the UI resource corresponding to the UI interface needs to restart the layair engine to enable the UI interface and the UI resource corresponding to the UI interface to take effect, so that the layair engine needs to be restarted first, then the layair engine is opened to be switched to the layair ide window, the cleaning under the export option of the menu bar is clicked, and the UI resource and the json file corresponding to the UI interface are exported, that is, the dependency relationship between the UI interface and the UI resource corresponding to the UI interface in the split mode is established, when the UI interface is opened, the corresponding UI resource is loaded according to the dependency relationship, and the quick loading of the UI interface is realized.
Generally speaking, because the UI interfaces create dependency relationships with their corresponding UI resources, the UI resources include atlases, each UI interface may depend on multiple atlases, the Laya engine may generate an atlas according to the folder name of the scattergram, name the folder name as the atlas name, and then create a dependency relationship between the class name of the UI interface and the dependent atlas, for example, if the interface name is test, and three atlases a, B, and C are relied on, then generate a similar relationship: [ className: when a UI interface with the interface name of test is opened, the three atlas sets A, B and C are loaded in a targeted manner, the unused atlas set cannot be loaded into a memory, a good condition basis can be provided for the release of subsequent optimization resources, and the export speed of the application initial packet containing the UI resources is accelerated; if the dependency relationship between the UI interface and the corresponding UI resource is not established, a general solution in the prior art additionally loads the UI resource that is not used, for example, when the UI interface named test is opened, two albums, i.e., three albums, i.e., a, B, and C, may be additionally loaded, thereby increasing the memory usage and performance consumption.
Example two
Referring to fig. 2, a terminal 1 for a layaiir engine to derive UI resources includes a memory 2, a processor 3, and a computer program stored in the memory 2 and executable on the processor 3, wherein the processor 3 implements the steps in the first embodiment when executing the computer program.
In conclusion, when the export of the UI interface is configured in the separation mode through the LayaAir engine, the dependency relationship between the UI interface and the corresponding UI resource is created; when the UI interface is opened, loading the UI resource corresponding to the UI interface according to the dependency relationship between the UI interface and the corresponding UI resource; when the UI interface is opened, the UI resources corresponding to the dependency relationship can be automatically loaded according to the dependency relationship, the automation degree is high, the loading process of the UI resources is optimized, and the corresponding UI resources which need to be loaded can be set, targeted loading can be realized, the used resources are configured in the dependency relationship, and the configuration is not carried out when the used resources are not used, so that loading of other useless resources is avoided, and the export speed of the application initial packet containing the UI resources is accelerated; the json file corresponding to the UI interface is obtained in different modes according to different types of UI resources, and pertinence is strong; and storing the array in which the character strings are stored into a json file corresponding to the UI interface, and loading corresponding UI resources by reading the corresponding json file when the UI interface is opened, so that the loading process of the UI interface is optimized.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all equivalent changes made by using the contents of the present specification and the drawings, or applied directly or indirectly to the related technical fields, are included in the scope of the present invention.

Claims (6)

1. A method for a LayaAir engine to export UI resources is characterized by comprising the following steps:
s1, when exporting a UI interface configured in a separation mode through a LayaAir engine, establishing a dependency relationship between the UI interface and a corresponding UI resource;
creating the dependency relationship between the UI interface and the corresponding UI resource comprises the following steps:
traversing UI resources corresponding to the UI interface to obtain character strings corresponding to preset attributes in the UI resources;
splicing the character strings according to a preset rule to obtain spliced character strings;
storing the spliced character strings into an array;
storing the array into a json file corresponding to the UI;
the step of creating the dependency relationship between the UI interface and the corresponding UI resource comprises the following steps:
judging whether the type of the UI resource is the UI interface resource, if so, executing:
s21, traversing the UI resources to obtain a first character string corresponding to a preset first attribute in the UI resources, wherein the first character string indicates a path of a first picture resource corresponding to the UI interface;
s22, splicing the first character string according to a preset rule to obtain a spliced first character string;
s23, storing the spliced first character string to a first array;
s24, storing the first array into a first json file corresponding to the UI;
if not, judging whether the UI resource is a UI special effect resource, if so, executing the steps S21-S24, and then:
s25, traversing the UI resources to obtain a second character string corresponding to a preset second attribute in the UI resources, wherein the second character string indicates a path of a second picture resource corresponding to the UI interface;
s26, splicing the second character string according to a preset rule to obtain a spliced second character string;
s27, storing the spliced second character string to a second array;
s28, storing the second array into a second json file corresponding to the UI;
s2, when the UI interface is opened, loading the UI resource corresponding to the UI interface according to the dependency relationship between the UI interface and the corresponding UI resource.
2. The method of claim 1, wherein saving the concatenated string to an array comprises:
and judging whether the spliced character string exists in the array, if so, ignoring the spliced character string, otherwise, storing the spliced character string to the array.
3. The method of claim 1, wherein storing the array in a json file corresponding to the UI interface comprises:
judging whether a json file corresponding to the UI exists or not;
if yes, deleting the existing json file, creating a new json file, and storing the array into the new json file;
otherwise, creating a json file corresponding to the UI interface, and storing the array into the json file.
4. A terminal for a layaiir engine to export UI resources, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the computer program implements the steps of:
s1, when the export of a UI interface is configured in a separation mode through a LayaAir engine, creating a dependency relationship between the UI interface and a corresponding UI resource;
the step of creating the dependency relationship between the UI interface and the corresponding UI resource comprises the following steps:
traversing the UI resources corresponding to the UI interface to obtain character strings corresponding to preset attributes in the UI resources;
splicing the character strings according to a preset rule to obtain spliced character strings;
storing the spliced character strings into an array;
storing the array into a json file corresponding to the UI;
creating the dependency relationship between the UI interface and the corresponding UI resource comprises the following steps:
judging whether the type of the UI resource is the UI interface resource, if so, executing:
s21, traversing the UI resources to obtain a first character string corresponding to a preset first attribute in the UI resources, wherein the first character string indicates a path of a first picture resource corresponding to the UI interface;
s22, splicing the first character string according to a preset rule to obtain a spliced first character string;
s23, storing the spliced first character string to a first array;
s24, storing the first array into a first json file corresponding to the UI;
if not, judging whether the UI resource is a UI special effect resource, if so, executing the steps S21-S24, and then:
s25, traversing the UI resources to obtain a second character string corresponding to a preset second attribute in the UI resources, wherein the second character string indicates a path of a second picture resource corresponding to the UI interface;
s26, splicing the second character string according to a preset rule to obtain a spliced second character string;
s27, storing the spliced second character string to a second array;
s28, storing the second array into a second json file corresponding to the UI;
s2, when the UI interface is opened, loading the UI resource corresponding to the UI interface according to the dependency relationship between the UI interface and the corresponding UI resource.
5. The terminal for the layaiir engine to export UI resources of claim 4, wherein the saving the concatenated string to an array comprises:
and judging whether the spliced character string exists in the array, if so, ignoring the spliced character string, otherwise, storing the spliced character string to the array.
6. The terminal for the layaiir engine to export UI resources of claim 4, wherein storing the array in a json file corresponding to the UI interface comprises:
judging whether a json file corresponding to the UI exists or not;
if yes, deleting the existing json file, creating a new json file, and storing the array into the new json file;
otherwise, creating a json file corresponding to the UI interface, and storing the array into the json file.
CN201811634629.6A 2018-12-29 2018-12-29 Method and terminal for exporting UI (user interface) resources by LayaAir engine Active CN111399931B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811634629.6A CN111399931B (en) 2018-12-29 2018-12-29 Method and terminal for exporting UI (user interface) resources by LayaAir engine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811634629.6A CN111399931B (en) 2018-12-29 2018-12-29 Method and terminal for exporting UI (user interface) resources by LayaAir engine

Publications (2)

Publication Number Publication Date
CN111399931A CN111399931A (en) 2020-07-10
CN111399931B true CN111399931B (en) 2022-12-09

Family

ID=71433887

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811634629.6A Active CN111399931B (en) 2018-12-29 2018-12-29 Method and terminal for exporting UI (user interface) resources by LayaAir engine

Country Status (1)

Country Link
CN (1) CN111399931B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105354049A (en) * 2015-09-29 2016-02-24 北京畅游天下网络技术有限公司 Resource loading method, apparatus and system for three-dimensional animation engine
CN105354013A (en) * 2014-08-18 2016-02-24 阿里巴巴集团控股有限公司 Application interface rendering method and apparatus
CN106293732A (en) * 2016-08-03 2017-01-04 网易(杭州)网络有限公司 Resource loading method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8417764B2 (en) * 2008-02-18 2013-04-09 International Business Machines Corporation Dynamic mashup creation from a set of resources and resource relationships

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105354013A (en) * 2014-08-18 2016-02-24 阿里巴巴集团控股有限公司 Application interface rendering method and apparatus
CN105354049A (en) * 2015-09-29 2016-02-24 北京畅游天下网络技术有限公司 Resource loading method, apparatus and system for three-dimensional animation engine
CN106293732A (en) * 2016-08-03 2017-01-04 网易(杭州)网络有限公司 Resource loading method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"Laya2.0 内嵌模式、加载模式、分离模式、文件模式的场景加载创建和场景打开关闭";tudouhu;《公开网址:http://ask.layabox.com/question/39351》;20181028;第1-15页 *
"LayaAir下分离模式的使用";cuixueying;《公开网址:http://ask.layabox.com/question/1399》;20161202;全文 *

Also Published As

Publication number Publication date
CN111399931A (en) 2020-07-10

Similar Documents

Publication Publication Date Title
US9904522B2 (en) Web development system
US8615750B1 (en) Optimizing application compiling
US8607203B1 (en) Test automation framework using dependency injection
CN106547527B (en) JavaScript file construction method and device
US10209968B2 (en) Application compiling
WO2018036342A1 (en) Csar-based template design visualization method and device
US20080229279A1 (en) Method for automatic generation of schema mapping application code
US10268568B2 (en) System and method for data element tracing
WO2019090994A1 (en) Script testing automated execution method, apparatus, equipment and storage medium
CN111694564A (en) Compiling method, device, equipment and medium for Flutter mixed mode
CN112506854B (en) Page template file storage and page generation methods, devices, equipment and media
US7966600B2 (en) Distributed resource understanding tool management
US9037994B2 (en) Navigation to a data definition in a diff context
CN109284222B (en) Software unit, project testing method, device and equipment in data processing system
WO2018001041A1 (en) Interface implementation method and device, set-top box, and storage medium
CN108845864B (en) Spring frame-based JVM garbage recycling method and device
CN108304164B (en) Business logic development method and development system
CN114217789A (en) Function component expansion method, device, equipment, storage medium and program product
CN111596970B (en) Method, device, equipment and storage medium for dynamic library delay loading
KR102141749B1 (en) APP program execution method and device
US20210117170A1 (en) Wrapping method, registration method, device, and rendering apparatus
CN111399931B (en) Method and terminal for exporting UI (user interface) resources by LayaAir engine
US20100125827A1 (en) Developing software code using parameterized annotations
CN110018866B (en) User interface theme updating method, device and system, vehicle machine and vehicle
CN114840195B (en) Privatization method for iOS SDK static library

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
GR01 Patent grant
GR01 Patent grant