CN110694269B - Script file loading method and device, electronic equipment and storage medium - Google Patents
Script file loading method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN110694269B CN110694269B CN201910926796.6A CN201910926796A CN110694269B CN 110694269 B CN110694269 B CN 110694269B CN 201910926796 A CN201910926796 A CN 201910926796A CN 110694269 B CN110694269 B CN 110694269B
- Authority
- CN
- China
- Prior art keywords
- script
- loading
- name
- script file
- file
- 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
Links
Images
Classifications
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/45—Controlling the progress of the video game
- A63F13/48—Starting a game, e.g. activating a game device or waiting for other players to join a multiplayer session
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The present application relates to the field of game technologies, and in particular, to a method and an apparatus for loading a script file, an electronic device, and a storage medium. According to the method and the device, the script dictionary file of the game application is loaded in response to the loading signal of the game application, the development names and the corresponding storage names of all the script files of the game application are stored in the script dictionary file, and the storage names corresponding to the development names of all the script files to be loaded can be directly searched in sequence from the script dictionary file according to the obtained loading sequence list, so that the calculation process of converting the development names of the script files to be loaded into the storage names is omitted, the script files stored locally at the user terminal are directly loaded through the searched storage names, and the loading speed of the game application can be improved.
Description
Technical Field
The present application relates to the field of game technologies, and in particular, to a method and an apparatus for loading a script file, an electronic device, and a storage medium.
Background
When a game developer develops a game application program, in order to facilitate development, a development name capable of representing the script function is named for a script file, after the development is completed, the development name of the script file is encrypted and converted into a storage name, and the version of the game application of the script file with the storage name is provided for a user to install. Thus, the user cannot know the function of the script file by storing the name, and the security of the game application can be increased.
Generally, when a game application is loaded, a script file is loaded first, and since a game engine can only obtain a development name of the script file to be loaded from a loading sequence list, in the loading process, the development name needs to be converted to obtain a storage name, and then the script file is obtained from a local storage according to the storage name to be loaded. However, in the process of loading the game application, the number of script files to be loaded is large, and each script file to be loaded has a calculation process for name conversion, so that a large calculation amount is required, and the loading speed of the game application is affected.
Disclosure of Invention
In view of this, an object of the present application is to provide a method and an apparatus for loading a script file, an electronic device, and a storage medium, which can increase the loading speed of a game application.
The application mainly comprises the following aspects:
in a first aspect, an embodiment of the present application provides a method for loading a script file, which is applied to a game application running on a user terminal, where the method for loading the script file includes:
loading a script dictionary file in the game application in response to a loading signal of the game application; the script dictionary file stores development names and corresponding storage names of all script files of the game application;
acquiring a loading sequence list of a plurality of script files to be loaded; the loading sequence list comprises development names of the script files to be loaded;
according to the loading sequence list, sequentially searching a storage name corresponding to the development name of each script file to be loaded from the script dictionary file;
and acquiring a script file which is locally stored in the user terminal and corresponds to the storage name, and loading the script file.
In one possible implementation, after the loading signal in response to the game application, the loading method further includes:
acquiring a trigger event corresponding to the loading signal;
the obtaining of the loading sequence list of the multiple script files to be loaded includes:
and determining a loading sequence list of the script files to be loaded according to the trigger event.
In one possible embodiment, the triggering event includes at least one of the following events:
starting the game application; switching game scenes; and loading game elements in the game scene.
In one possible embodiment, the script dictionary file is generated according to the following steps:
acquiring development names of all script files of the game application;
for each script file in each script file, converting the development name of each script file into a corresponding storage name through a name conversion algorithm;
and correspondingly storing the development name and the corresponding storage name of each script file in each script file to the script dictionary file one by one.
In one possible embodiment, the name conversion algorithm includes a bit arithmetic algorithm and a hash algorithm.
In one possible embodiment, the hash algorithm is a message digest algorithm; the converting the development name of each script file into a corresponding storage name by a name conversion algorithm for each script file in each script file includes:
converting the development name of each script file into a first character string based on the bit operation algorithm;
converting the first character string of each script file into a second character string according to the message digest algorithm;
and determining the second character string of each script file as a storage name corresponding to the development name of each script file.
In a possible implementation, the converting the development name of each script file into a first character string based on the bit operation algorithm includes:
performing exclusive-or operation on each character in the development name of each script file and a target numerical value to respectively obtain a plurality of character strings of a preset system;
and splicing the obtained plurality of character strings to generate the first character string of each script file.
In one possible embodiment, the target value is determined according to the following steps:
counting the number of characters in the development name of each script file;
converting the number into a third character string of the preset scale;
acquiring characters at preset positions in the third character string;
and carrying out XOR operation on the characters at the preset positions and preset numerical values to obtain a target numerical value corresponding to each script file.
In a second aspect, an embodiment of the present application further provides a device for loading a script file, where the device for loading a script file includes:
the first loading module is used for responding to a loading signal of a game application and loading a script dictionary file in the game application; the script dictionary file stores development names and corresponding storage names of all script files of the game application; the system comprises a first acquisition module, a second acquisition module and a control module, wherein the first acquisition module is used for acquiring a loading sequence list of a plurality of script files to be loaded; the loading sequence list comprises development names of the script files to be loaded; the searching module is used for sequentially searching a storage name corresponding to the development name of each script file to be loaded from the script dictionary file according to the loading sequence list;
and the second loading module is used for acquiring a script file which is locally stored by the user terminal and corresponds to the storage name, and loading the script file.
In a possible implementation, the loading device further includes:
the second acquisition module is used for acquiring a trigger event corresponding to the loading signal;
the first obtaining module is configured to determine a loading sequence list of the script file to be loaded according to the trigger event.
In one possible embodiment, the triggering event includes at least one of the following events:
starting the game application; switching game scenes; and loading game elements in the game scene.
In a possible implementation manner, the loading device further includes a generation module; the generation module is used for generating the script dictionary file; the generation module comprises:
the acquisition unit is used for acquiring the development name of each script file of the game application;
the conversion unit is used for converting the development name of each script file into a corresponding storage name through a name conversion algorithm aiming at each script file in each script file;
and the storage unit is used for storing the development name and the corresponding storage name of each script file in a one-to-one correspondence manner to the script dictionary file.
In one possible embodiment, the name conversion algorithm includes a bit operation algorithm and a hash algorithm.
In one possible embodiment, the hash algorithm is a message digest algorithm; the conversion unit is used for converting the development name of each script file into a corresponding storage name according to the following steps:
converting the development name of each script file into a first character string based on the bit operation algorithm;
converting the first character string of each script file into a second character string according to the message digest algorithm;
and determining the second character string of each script file as a storage name corresponding to the development name of each script file.
In a possible implementation manner, the conversion unit is further configured to convert the development name of each script file into the first character string according to the following steps:
performing exclusive-or operation on each character in the development name of each script file and a target numerical value to respectively obtain a plurality of character strings of a preset system;
and splicing the obtained plurality of character strings to generate the first character string of each script file.
In a possible embodiment, the conversion unit is further configured to determine the target value according to the following steps:
counting the number of characters in the development name of each script file;
converting the number into a third character string of the preset scale;
acquiring characters at preset positions in the third character string;
and carrying out XOR operation on the characters at the preset positions and preset numerical values to obtain a target numerical value corresponding to each script file.
In a third aspect, an embodiment of the present application further provides an electronic device, including: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, when the electronic device runs, the processor and the memory communicate with each other through the bus, and when the processor runs, the processor performs the steps of the method for loading a script file according to the first aspect or any one of the possible embodiments of the first aspect.
In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs the steps of the method for loading a script file described in the first aspect or any one of the possible implementation manners of the first aspect.
In the embodiment of the application, the script dictionary file of the game application is loaded in response to the loading signal of the game application, the development names and the corresponding storage names of all script files of the game application are stored in the script dictionary file, and the storage names corresponding to the development names of all script files to be loaded can be directly and sequentially searched from the script dictionary file according to the obtained loading sequence list, so that the calculation process of converting the development names of the script files to be loaded into the storage names is omitted, the script files locally stored in the user terminal are directly loaded through the searched storage names, and the loading speed of the game application can be increased.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
FIG. 1 is a flowchart illustrating a method for loading a script file according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating another method for loading a script file according to an embodiment of the present application;
FIG. 3 is a functional block diagram of an apparatus for loading a script file according to an embodiment of the present application;
fig. 4 shows a second functional block diagram of a device for loading a script file according to an embodiment of the present application;
FIG. 5 illustrates a functional block diagram of the generation block of FIG. 4;
fig. 6 shows a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
To make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it should be understood that the drawings in the present application are for illustrative and descriptive purposes only and are not used to limit the scope of protection of the present application. Further, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be performed out of order, and that steps without logical context may be performed in reverse order or concurrently. One skilled in the art, under the guidance of this application, may add one or more other operations to, or remove one or more operations from, the flowchart.
In addition, the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
To enable those skilled in the art to utilize the present disclosure, the following embodiments are presented in conjunction with a specific application scenario "loading of script files", and it will be apparent to those skilled in the art that the general principles defined herein may be applied to other embodiments and application scenarios without departing from the spirit and scope of the present disclosure.
The method, apparatus, electronic device or computer-readable storage medium described in the embodiments of the present application may be applied to any scenario that requires loading of a script file, and the embodiments of the present application do not limit a specific application scenario, and any scheme that uses the method and apparatus for loading a script file provided in the embodiments of the present application is within the scope of protection of the present application.
Before the application is provided, in the existing scheme, when a game application is loaded, a script file is loaded first, and since a game engine can only obtain a development name of the script file to be loaded from a loading sequence list, in the loading process, the development name needs to be converted to obtain a storage name, and then the script file is obtained from a local storage according to the storage name to be loaded. However, in the process of loading the game application, the number of script files to be loaded is large, and each script file to be loaded has a calculation process for name conversion, so that a large calculation amount is required, and the loading speed of the game application is affected.
In view of the above problems, in the embodiment of the present application, the script dictionary file of the game application is loaded in response to the loading signal of the game application, the development name and the corresponding storage name of each script file of the game application are stored in the script dictionary file, and the storage name corresponding to the development name of each script file to be loaded can be directly and sequentially searched from the script dictionary file according to the obtained loading sequence list, so that a calculation process of converting the development name of the script file to be loaded into the storage name is omitted, the script file locally stored in the user terminal is directly loaded through the searched storage name, and the loading speed of the game application can be increased.
It should be noted that the user terminal may be a mobile terminal or a personal computer; the game Application may be a game Application program (app) installed on the mobile terminal or the personal computer; the script file may be a game script.
For the convenience of understanding of the present application, the technical solutions provided in the present application will be described in detail with reference to specific embodiments.
Fig. 1 is a flowchart of a method for loading a script file according to an embodiment of the present application. As shown in fig. 1, the method for loading a script file provided in the embodiment of the present application is applied to a game application running on a user terminal, and includes the following steps:
s101: loading a script dictionary file in the game application in response to a loading signal of the game application; the script dictionary file stores development names and corresponding storage names of all script files of the game application.
In a specific implementation, when a loading signal of a game application is detected, a script dictionary file generated in advance is loaded while the game application is loaded in response to the loading signal of the game application, wherein the script dictionary file stores development names and storage names of all script files related to the game application in a one-to-one correspondence manner.
Here, the development name is a name that can characterize the script function, such as main, named for the script file for the convenience of development when the game developer develops the game application; the storage name is the name provided to the script file in the game application version installed by the user. The storage name of the script file is a name obtained by converting the development name according to a preset name conversion algorithm, and the obtained storage name may be a character string, for example, ec5f4ef464d7d031934c 3263 c54051242e41 c.
S102: acquiring a loading sequence list of a plurality of script files to be loaded; the loading sequence list contains development names of the script files to be loaded.
In specific implementation, after a loading signal of a game application is detected, a loading sequence list corresponding to a plurality of script files to be loaded required by the preset game application is acquired, so that the loading sequence list is read, and the script files stored locally in the user terminal are loaded according to the loading sequence list.
Here, since only the development names of the plurality of script files to be loaded and the loading sequence of the plurality of script files to be loaded can be read from the loading sequence list, in the prior art, when the game application is loaded, there is a calculation process of converting the development names into storage names, and then obtaining the script files from the local storage by the storage names for loading.
S103: and sequentially searching a storage name corresponding to the development name of each script file to be loaded from the script dictionary file according to the loading sequence list.
In specific implementation, after a loading sequence list of script files to be loaded is acquired when a game application is loaded, according to the loading sequence of each script file to be loaded in the loading sequence list, a storage name corresponding to the development name of each script file to be loaded is directly and sequentially searched from a script dictionary file, so that a calculation process of converting the development name of the script file to be loaded into the storage name is omitted, the script file locally stored in a user terminal is directly loaded through the searched storage name, and the loading speed of the game application can be improved.
S104: and acquiring a script file which is locally stored in the user terminal and corresponds to the storage name, and loading the script file.
In the specific implementation, the name of the script file stored in the user terminal is a storage name, and further, according to the loading sequence of each script file to be loaded in the loading sequence list, the corresponding script file is sequentially obtained in the local storage according to the storage name, and the script file is loaded.
Further, after the loading signal in response to the game application, the loading method further includes the steps of: acquiring a trigger event corresponding to the loading signal; the obtaining of the loading sequence list of the multiple script files to be loaded includes: and determining a loading sequence list of the script files to be loaded according to the trigger event.
In specific implementation, after receiving a loading signal of a game application, a trigger event corresponding to the loading signal is obtained, and then development names of a plurality of script files to be loaded which should be loaded and a loading sequence of each script file to be loaded are determined according to the trigger event, that is, a loading sequence list of the plurality of script files to be loaded is determined.
Here, the trigger event corresponding to the loading signal may be an event for starting a game application; the event of switching the game scene can also be taken as an event in the running process of the game; it can also be an event that loads game elements in a game scene during the running of the game.
In the embodiment of the application, the script dictionary file of the game application is loaded in response to the loading signal of the game application, the development names and the corresponding storage names of all script files of the game application are stored in the script dictionary file, and the storage names corresponding to the development names of all script files to be loaded can be directly and sequentially searched from the script dictionary file according to the obtained loading sequence list, so that the calculation process of converting the development names of the script files to be loaded into the storage names is omitted, the script files locally stored in the user terminal are directly loaded through the searched storage names, and the loading speed of the game application can be improved.
Fig. 2 is a flowchart of another script file loading method according to an embodiment of the present application. As shown in fig. 2, the method for loading a script file provided in the embodiment of the present application includes the following steps:
s201: and acquiring the development name of each script file of the game application.
In particular implementations, the script dictionary file may be generated during the downloading of the gaming application. Firstly, acquiring development names of various script files related to the game application when the script files are developed, wherein the script files are script files which need to be loaded during starting and running of the game application. The development name is a name which can represent a script function and is named for a script file for the convenience of development when a game developer develops a game application.
S202: and aiming at each script file in each script file, converting the development name of each script file into a corresponding storage name through a name conversion algorithm.
In a specific implementation, for each script file in the obtained script files of the game application, the development name of each script file can be converted into a storage name by using a name conversion algorithm, where the name conversion algorithm includes a bit operation algorithm and a hash algorithm.
Further, the hash algorithm is a message digest algorithm; in step S202, for each script file in the script files, the developing name of each script file is converted into a corresponding storage name through a name conversion algorithm, which includes the following steps:
step 2021: and converting the development name of each script file into a first character string based on the bit operation algorithm.
In specific implementation, the development name of each script file is obtained, and a bit operation algorithm is adopted to convert the development name of each script file into a first character string.
Here, the step 2021 of converting the development name of each script file into the first character string based on the bit operation algorithm includes the steps of:
performing exclusive-or operation on each character in the development name of each script file and a target numerical value to respectively obtain a plurality of character strings of a preset system; and splicing the obtained plurality of character strings to generate the first character string of each script file. In specific implementation, for the development name of each script file, performing xor operation on each character in the development name and a target numerical value to obtain a plurality of character strings of a preset scale system, and further, splicing the plurality of character strings to generate a first character string of each script file.
In an example, the development name of the script file is main, the target numerical value is 181 (decimal), the preset scale is hexadecimal, each character "m", "a", "i", "n" in the development name main is subjected to exclusive or operation with the target numerical value 181 respectively to obtain 4 hexadecimal character strings of d8, d4, dc and db respectively, and the 4 character strings are spliced to generate a first character string "d8d4dcdb", where in the exclusive or operation, the characters "m", "a", "i" and "n" need to be converted into binary values respectively and then calculated, where the binary value corresponding to the character "m" is 01101101, the binary value corresponding to the character "a" is 01100001, the binary value corresponding to the character "i" is 01101001, and the binary value corresponding to the character "n" is 01101110.
Here, the target value is determined according to the following steps:
counting the number of characters in the development name of each script file; converting the number into a third character string of the preset scale; acquiring characters at preset positions in the third character string; and carrying out XOR operation on the characters at the preset positions and preset numerical values to obtain a target numerical value corresponding to each script file.
In one example, if the development name is main, the preset number is hexadecimal, the preset position is the last position of the character string, and the preset value is decimal 81, the number of characters included in the development name is 4, the decimal number 4 is converted into the hexadecimal third character string which is "0x4", the hexadecimal character at the last position in the third character string is obtained as "4" (decimal 52), and the hexadecimal character "4" is subjected to exclusive or operation with the decimal 81, so that the target value 181 (decimal) is obtained.
Step 2022: and converting the first character string of each script file into a second character string according to the message digest algorithm.
In a specific implementation, the hash algorithm may be a message digest algorithm, and further, the first character string of each script file is converted into the second character string by the message digest algorithm. Here, a Message Digest Algorithm (MD 5) may be understood as an encryption Algorithm that may encrypt and convert a first string into a second string.
In one example, the first string is "d8d4dcdb", and after the MD5 encryption algorithm, the second string is "4ffa b45550e2bf7bf72aa2937905de".
Step 2023: and determining the second character string of each script file as a storage name corresponding to the development name of each script file.
In a specific implementation, for each script file, the development name of the script file is converted into a first character string, the first character string is further converted into a second character string, and the second character string is determined as the storage name of the script file. Here, by converting the development name into a storage name by encryption and providing the game application version of the script file with the storage name to the user, the user cannot know the function of the script file by the storage name, and the security of the game application program can be increased.
S203: and storing the development name and the corresponding storage name of each script file in a one-to-one correspondence manner to the script dictionary file.
In a specific implementation, after the development name of each script file is converted into the storage name, the development name and the storage name of each script file are stored in the script dictionary file in a one-to-one correspondence manner, so that the script dictionary file of the game application is generated.
It should be noted that, during the process of installing the game application, the script dictionary file may be generated to ensure that the game application may be loaded to the script dictionary file first when being started, and then the storage name of the script file to be loaded is found from the script dictionary file, so as to omit a calculation process of converting the development name of the script file to be loaded into the storage name, and directly load the locally stored script file through the searched storage name, thereby increasing the starting speed of the game application.
S204: loading a script dictionary file in the game application in response to a loading signal of the game application; the script dictionary file stores development names and corresponding storage names of all script files of the game application.
S205: acquiring a loading sequence list of a plurality of script files to be loaded; the loading sequence list contains development names of the script files to be loaded.
S206: and sequentially searching a storage name corresponding to the development name of each script file to be loaded from the script dictionary file according to the loading sequence list.
S207: and acquiring a script file which is locally stored in the user terminal and corresponds to the storage name, and loading the script file.
The descriptions of S204 to S207 may refer to the descriptions of S101 to S104, and the same technical effects can be achieved, which is not described in detail herein.
In the embodiment of the application, the script dictionary file of the game application is loaded in response to the loading signal of the game application, the development names and the corresponding storage names of all the script files of the game application are stored in the script dictionary file, and the storage names corresponding to the development names of all the script files to be loaded can be directly and sequentially searched from the script dictionary file according to the obtained loading sequence list, so that the calculation process of converting the development names of the script files to be loaded into the storage names is omitted, the script files locally stored in the user terminal are directly loaded through the searched storage names, and the loading speed of the game application can be improved.
Based on the same application concept, the embodiment of the present application further provides a device for loading a script file corresponding to the method for loading a script file shown in fig. 1 and 2, and since the principle of solving the problem of the device in the embodiment of the present application is similar to the method for loading a script file shown in fig. 1 and 2, the implementation of the device may refer to the implementation of the method, and repeated details are not repeated.
As shown in fig. 3, there is provided one of the functional block diagrams of an apparatus 300 for loading a script file according to an embodiment of the present application; fig. 4 is a second functional block diagram of a script file loading apparatus 300 according to an embodiment of the present application; fig. 5 is a functional block diagram of the generating module 360 in fig. 4.
As shown in fig. 3 and 4, the loading apparatus 300 of the script file includes:
a first loading module 310, configured to load a script dictionary file in a game application in response to a loading signal of the game application; the script dictionary file stores development names and corresponding storage names of all script files of the game application;
a first obtaining module 320, configured to obtain a loading sequence list of multiple script files to be loaded; the loading sequence list comprises development names of the script files to be loaded;
the searching module 330 is configured to sequentially search, according to the loading sequence list, a storage name corresponding to the development name of each script file to be loaded from the script dictionary file;
the second loading module 340 is configured to obtain a script file corresponding to the storage name, which is locally stored in the user terminal, and load the script file.
In a possible implementation, as shown in fig. 4, the loading device 300 for the script file further includes:
a second obtaining module 350, configured to obtain a trigger event corresponding to the loading signal;
the first obtaining module 320 is further configured to determine, according to the trigger event, a loading sequence list of the script file to be loaded.
In one possible embodiment, the triggering event includes at least one of the following events:
starting the game application; switching game scenes; and loading game elements in the game scene.
In a possible embodiment, as shown in fig. 4, the loading apparatus 300 of the script file further includes a generating module 360; the generating module 360 is configured to generate the script dictionary file. As shown in fig. 5, the generating module 360 includes:
an obtaining unit 361, configured to obtain a development name of each script file of the game application;
a conversion unit 362, configured to convert, for each script file in the respective script files, a development name of each script file into a corresponding storage name through a name conversion algorithm;
the storage unit 363 is configured to store the development name and the corresponding storage name of each script file in the script dictionary file in a one-to-one correspondence manner.
In one possible embodiment, the name conversion algorithm includes a bit operation algorithm and a hash algorithm.
In one possible embodiment, the hash algorithm is a message digest algorithm; as shown in fig. 5, the converting unit 362 is configured to convert the development name of each script file into a corresponding storage name according to the following steps:
converting the development name of each script file into a first character string based on the bit operation algorithm;
converting the first character string of each script file into a second character string according to the message digest algorithm;
and determining the second character string of each script file as a storage name corresponding to the development name of each script file.
In one possible embodiment, as shown in fig. 5, the converting unit 362 is configured to convert the development name of each script file into the first character string according to the following steps:
performing exclusive-or operation on each character in the development name of each script file and a target numerical value to respectively obtain a plurality of character strings of a preset system;
and splicing the obtained plurality of character strings to generate the first character string of each script file.
In a possible embodiment, as shown in fig. 5, the conversion unit 362 is further configured to determine the target value according to the following steps:
counting the number of characters in the development name of each script file;
converting the number into a third character string of the preset scale;
acquiring characters at preset positions in the third character string;
and carrying out XOR operation on the characters at the preset positions and preset numerical values to obtain a target numerical value corresponding to each script file.
In the embodiment of the application, the script dictionary file of the game application is loaded in response to the loading signal of the game application, the development names and the corresponding storage names of all the script files of the game application are stored in the script dictionary file, and the storage names corresponding to the development names of all the script files to be loaded can be directly and sequentially searched from the script dictionary file according to the obtained loading sequence list, so that the calculation process of converting the development names of the script files to be loaded into the storage names is omitted, the script files locally stored in the user terminal are directly loaded through the searched storage names, and the loading speed of the game application can be improved.
Based on the same application concept, referring to fig. 6, a schematic structural diagram of an electronic device 600 provided in the embodiment of the present application includes: a processor 610, a memory 620 and a bus 630, wherein the memory 620 stores machine-readable instructions executable by the processor 610, when the electronic device 600 runs, the processor 610 and the memory 620 communicate with each other through the bus 630, and the machine-readable instructions are executed by the processor 610 to perform the steps of the loading method of the script file as shown in fig. 1 and/or fig. 2.
In particular, the machine readable instructions, when executed by the processor 610, may perform the following:
loading a script dictionary file in the game application in response to a loading signal of the game application; the script dictionary file stores development names and corresponding storage names of all script files of the game application;
acquiring a loading sequence list of a plurality of script files to be loaded; the loading sequence list comprises development names of the script files to be loaded;
according to the loading sequence list, sequentially searching a storage name corresponding to the development name of each script file to be loaded from the script dictionary file;
and acquiring a script file which is locally stored in the user terminal and corresponds to the storage name, and loading the script file.
Further, the machine readable instructions when executed by the processor 610 may further perform the following:
acquiring a trigger event corresponding to the loading signal;
and determining a loading sequence list of the plurality of script files to be loaded according to the trigger event.
Further, the machine readable instructions when executed by the processor 610 may further perform the following:
acquiring development names of all script files of the game application;
for each script file in each script file, converting the development name of each script file into a corresponding storage name through a name conversion algorithm;
and correspondingly storing the development name and the corresponding storage name of each script file in each script file to the script dictionary file one by one.
Further, the machine readable instructions when executed by the processor 610 may further perform the following:
converting the development name of each script file into a first character string based on the bit operation algorithm;
converting the first character string of each script file into a second character string according to the message digest algorithm;
and determining the second character string of each script file as a storage name corresponding to the development name of each script file.
Further, the machine readable instructions when executed by the processor 610 may further perform the following:
performing exclusive-or operation on each character in the development name of each script file and a target numerical value to respectively obtain a plurality of character strings of a preset system;
and splicing the obtained plurality of character strings to generate the first character string of each script file.
Further, the machine readable instructions when executed by the processor 610 may also perform the following:
counting the number of characters in the development name of each script file;
converting the number into a third character string of the preset scale;
acquiring characters at preset positions in the third character string;
and carrying out XOR operation on the characters at the preset positions and preset numerical values to obtain a target numerical value corresponding to each script file.
In the embodiment of the application, the script dictionary file of the game application is loaded in response to the loading signal of the game application, the development names and the corresponding storage names of all script files of the game application are stored in the script dictionary file, and the storage names corresponding to the development names of all script files to be loaded can be directly and sequentially searched from the script dictionary file according to the obtained loading sequence list, so that the calculation process of converting the development names of the script files to be loaded into the storage names is omitted, the script files locally stored in the user terminal are directly loaded through the searched storage names, and the loading speed of the game application can be improved.
Based on the same application concept, embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs the steps of the method for loading the script file shown in fig. 1 and/or fig. 2.
Specifically, the storage medium may be a general-purpose storage medium, such as a removable disk, a hard disk, or the like, and when a computer program on the storage medium is run, the loading method of the script file may be executed, and by directly searching for a storage name corresponding to a development name of each script file to be loaded from a script dictionary file, a calculation process of converting the development name of the script file to be loaded into the storage name is omitted, and by directly loading the script file stored locally by using the searched storage name, the loading speed of the game application may be increased.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the coupling or direct coupling or communication connection between each other may be made or discussed through some communication interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts made as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (14)
1. A loading method of script files is applied to game applications running on a user terminal, and is characterized in that the loading method comprises the following steps:
loading a script dictionary file in the game application in response to a loading signal of the game application; the script dictionary file stores development names and corresponding storage names of all script files of the game application;
acquiring a loading sequence list of a plurality of script files to be loaded; the loading sequence list comprises development names of the script files to be loaded;
according to the loading sequence list, sequentially searching a storage name corresponding to the development name of each script file to be loaded from the script dictionary file;
and acquiring a script file which is locally stored in the user terminal and corresponds to the storage name, and loading the script file.
2. The loading method of claim 1, wherein after the loading signal in response to the game application, the loading method further comprises:
acquiring a trigger event corresponding to the loading signal;
the obtaining of the loading sequence list of the multiple script files to be loaded includes:
and determining a loading sequence list of the plurality of script files to be loaded according to the trigger event.
3. The loading method according to claim 2, wherein the trigger event comprises at least one of the following events:
starting the game application; switching game scenes; and loading game elements in the game scene.
4. The loading method of claim 1, wherein the script dictionary file is generated according to the following steps:
acquiring development names of all script files of the game application;
for each script file in each script file, converting the development name of each script file into a corresponding storage name through a name conversion algorithm;
and correspondingly storing the development name and the corresponding storage name of each script file in each script file to the script dictionary file one by one.
5. The loading method according to claim 4, wherein the name conversion algorithm comprises a bit operation algorithm and a hash algorithm.
6. The loading method according to claim 5, wherein the hash algorithm is a message digest algorithm; the converting the development name of each script file into a corresponding storage name by a name conversion algorithm for each script file in each script file includes:
converting the development name of each script file into a first character string based on the bit operation algorithm;
converting the first character string of each script file into a second character string according to the message digest algorithm;
and determining the second character string of each script file as a storage name corresponding to the development name of each script file.
7. The loading method according to claim 6, wherein the converting the development name of each script file into the first character string based on the bit operation algorithm comprises:
performing exclusive-or operation on each character in the development name of each script file and a target numerical value to respectively obtain a plurality of character strings of a preset system;
and splicing the obtained plurality of character strings to generate the first character string of each script file.
8. The loading method according to claim 7, wherein the target value is determined according to the following steps:
counting the number of characters in the development name of each script file;
converting the number into a third character string of the preset scale;
acquiring characters at preset positions in the third character string;
and carrying out XOR operation on the characters at the preset positions and preset numerical values to obtain a target numerical value corresponding to each script file.
9. A loading apparatus of a script file, the loading apparatus comprising:
the first loading module is used for responding to a loading signal of a game application and loading a script dictionary file in the game application; the script dictionary file stores development names and corresponding storage names of all script files of the game application;
the system comprises a first acquisition module, a second acquisition module and a control module, wherein the first acquisition module is used for acquiring a loading sequence list of a plurality of script files to be loaded; the loading sequence list comprises development names of the script files to be loaded;
the searching module is used for sequentially searching a storage name corresponding to the development name of each script file to be loaded from the script dictionary file according to the loading sequence list;
and the second loading module is used for acquiring a script file which is locally stored by the user terminal and corresponds to the storage name, and loading the script file.
10. The loading device of claim 9, further comprising:
the second acquisition module is used for acquiring a trigger event corresponding to the loading signal;
the first obtaining module is configured to determine a loading sequence list of the script file to be loaded according to the trigger event.
11. The loading device of claim 10, wherein the triggering event comprises at least one of:
starting the game application; switching game scenes; and loading game elements in the game scene.
12. The loading device of claim 9, wherein the loading device further comprises a generation module; the generation module is used for generating the script dictionary file; the generation module comprises:
the acquisition unit is used for acquiring the development name of each script file of the game application;
the conversion unit is used for converting the development name of each script file into a corresponding storage name through a name conversion algorithm aiming at each script file in each script file;
and the storage unit is used for correspondingly storing the development name and the corresponding storage name of each script file in each script file to the script dictionary file one by one.
13. An electronic device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the electronic device is running, the machine-readable instructions being executed by the processor to perform the steps of the method of loading a script file according to any one of claims 1 to 8.
14. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, performs the steps of the method for loading a script file according to any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910926796.6A CN110694269B (en) | 2019-09-27 | 2019-09-27 | Script file loading method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910926796.6A CN110694269B (en) | 2019-09-27 | 2019-09-27 | Script file loading method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110694269A CN110694269A (en) | 2020-01-17 |
CN110694269B true CN110694269B (en) | 2022-12-16 |
Family
ID=69196982
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910926796.6A Active CN110694269B (en) | 2019-09-27 | 2019-09-27 | Script file loading method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110694269B (en) |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102567516B (en) * | 2011-12-28 | 2014-01-01 | 华为技术有限公司 | Script loading method and device |
CN106850650B (en) * | 2017-02-21 | 2021-06-04 | 网易(杭州)网络有限公司 | Method for accessing data by game client and client game system |
-
2019
- 2019-09-27 CN CN201910926796.6A patent/CN110694269B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN110694269A (en) | 2020-01-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111008034B (en) | Patch generation method and device | |
JP6160259B2 (en) | Character string search method, character string search device, and character string search program | |
CN108829650B (en) | Card number generation method, device, server and storage medium | |
CN111596920B (en) | File compiling method, device, compiling equipment and storage medium | |
CN106055375B (en) | Application program installation method and device | |
CN111931185A (en) | Java anti-serialization vulnerability detection method and component | |
CN113110865A (en) | Server hot updating method and device | |
US11403388B2 (en) | Assignment device, assignment method, and assignment program | |
CN105677730B (en) | Method and device for reading webpage resources and electronic equipment | |
CN110694269B (en) | Script file loading method and device, electronic equipment and storage medium | |
CN111737057B (en) | APFS file system data recovery method and device and electronic equipment | |
CN109492398A (en) | A kind of risk checking method and device of Android application program sensitive behavior | |
CN112230963A (en) | Method and device for repairing security vulnerability, computer equipment and storage medium | |
CN111400771A (en) | Target partition checking method and device, storage medium and computer equipment | |
US11263313B2 (en) | Securing execution of a program | |
CN112506796B (en) | Data processing method, device, equipment and storage medium | |
CN114329488A (en) | Kernel function credibility verification method and device, electronic equipment and storage medium | |
CN110100409B (en) | Method and apparatus for generating secure hash values | |
CN113703753A (en) | Method and device for product development and product development system | |
CN113377382A (en) | Software installation package processing method and device, electronic equipment and storage medium | |
KR101963821B1 (en) | Method and apparatus for calculating similarity of program | |
CN116450250B (en) | Dynamic scenario execution method, system and storage medium | |
CN114297667A (en) | Vulnerability identification generation method and device, electronic equipment and storage medium | |
KR101988302B1 (en) | Apparatus and method for generating identifier of content file based on hash, and method for hash code generation | |
CN111447183B (en) | Clone detection method and device |
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 |