Three-dimensional UI production method and equipment based on Cocos game engine
By preparing text and initializing canvas in the Cocos game engine, content drawing and grid creation, combined with the use of the echarts library, the problem of insufficient support for 3D UI by the Cocos engine is solved, and the 3D UI display requirements of the digital twin visualization system is realized. Ensures efficient and low consumption results.
Patent Information
- Application Number
- CN202411230306.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2044-09-04
AI Technical Summary
The Cocos game engine lacks support for 3D UI and is difficult to display UI in 3D in digital twin visualization systems.
By preparing text and initializing canvas, drawing content and converting it into an image, creating grid and assignment materials, installing the echarts library in the project directory and preparing data, customizing functions for different charts, initializing canvas and drawing content, and converting the drawn content Create grids and assign corresponding materials to images and grids to realize the production of 3D UI.
When the Cocos game engine does not support 3D UI, the production and generation of 3D UI is realized, meeting the 3D UI display needs of the digital twin visualization system, ensuring the clarity and synchronization efficiency of charts and texts, while maintaining low performance Consumption.
Smart Images

Figure CN118736173B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the technical field of three-dimensional UI production, and in particular to a three-dimensional UI production method and device based on the Cocos game engine. Background Art
[0002] As an important digital means, digital twin visualization has been deeply applied to the construction of smart cities. With the continuous mention in recent years, the concept of digital twin has received unprecedented attention. Cocos Creator game engine (hereinafter referred to as Cocos game engine) can produce web-native digital twin applications. It is a high-performance, low-power, cross-platform open source graphics engine that can fully utilize the capabilities of Vulkan, OpenGL ES, Metal, WebGL, WebGPU and other rendering backends with high performance on different platforms. In digital twin engineering projects, 3D UI (text, data charts) are required in the scene, but Cocos lacks support for 3D UI. Therefore, the development of a 3D UI production method and equipment based on the Cocos game engine can effectively overcome the defects in the above-mentioned related technologies, which has become a technical problem that needs to be solved in the industry. Summary of the invention
[0003] In view of the above problems existing in the prior art, an embodiment of the present invention provides a 3D UI production method and device based on the Cocos game engine.
[0004] In the first aspect, an embodiment of the present invention provides a three-dimensional UI production method based on the Cocos game engine, including: step 1, preparing relevant text to be displayed and initializing canvas; step 2, drawing content and converting the drawn content into an image; step 3, creating a corresponding grid and assigning corresponding materials; step 4, installing the echarts library in the project directory and preparing data; step 5, customizing relevant functions for drawing different charts; step 6, initializing canvas and drawing content, converting the drawn content into an image, creating a grid and assigning corresponding materials.
[0005] Based on the content of the above method embodiment, the three-dimensional UI production method based on the Cocos game engine provided in the embodiment of the present invention, step 1 specifically includes: using an interface or a local file to read relevant text into the memory, analyzing the content of the relevant text and using the relevant unique identifier as the primary key, establishing a corresponding mapping table in the memory, the mapping table is used for multiple text contents, and is returned in the same interface or local file. If the original content is lacking at the beginning of the operation, the test text is used to perform a text drawing test; the canvas is initialized based on the different sizes required for drawing the content, and then the relevant information is saved in the memory respectively. If the text content changes later, the relevant information is used again for drawing.
[0006] Based on the content of the above method embodiment, the three-dimensional UI production method based on the Cocos game engine provided in the embodiment of the present invention, step 2 specifically includes: clearing the context content of the current canvas, and drawing the text outline, color, size and special effects according to the determined text drawing function for the prepared display content; converting the canvas into an image resource, and then drawing an image of a corresponding size according to the size of the data corresponding to the image resource, and then setting the image Mipmap level and the winding mode of the map.
[0007] Based on the content of the above method embodiment, the three-dimensional UI production method based on the Cocos game engine provided in the embodiment of the present invention, step 3 specifically includes: calculating the mesh vertex coordinates and UV coordinates according to the aspect ratio calculated according to the width and height of the canvas, using the built-in mesh creation method in Cocos, and after the corresponding mesh is created, using the converted image to create a mesh material, and assigning it to the created mesh.
[0008] Based on the content of the above method embodiment, the three-dimensional UI production method based on the Cocos game engine provided in the embodiment of the present invention, step 4 specifically includes: opening the Cocos project directory, and in the assets directory, using the npm command "npm install echarts" to install the echarts dependency library; using the interface or local file to read the data into the memory, analyzing the data and using the data-related unique identifier as the primary key, establishing a mapping table relationship in the memory, the mapping table relationship is used for echarts image drawing, and if there is a lack of original data in the initial operation, use simulated data for drawing testing.
[0009] Based on the content of the above method embodiment, the three-dimensional UI production method based on the Cocos game engine provided in the embodiment of the present invention, step 5 specifically includes: formulating internal chart drawing logic according to the display requirements of different charts in actual business scenarios, and customizing corresponding functions for different charts. The chart drawing function is used to draw data and display styles without destroying the drawing component logic and changing the drawing component code, and attaching specific business logic.
[0010] Based on the content of the above method embodiment, the three-dimensional UI production method based on the Cocos game engine provided in the embodiment of the present invention, step 6 specifically includes: initializing the canvas, eliminating the operation of clearing the context content in step 2 in the drawing content, and instead calling the echarts initialization method to pass in the created canvas.
[0011] In the second aspect, an embodiment of the present invention provides a three-dimensional UI production device based on the Cocos game engine, including: a first main module, used to implement step 1, prepare relevant text to be displayed and initialize canvas; a second main module, used to implement step 2, draw content, and convert the drawn content into an image; a third main module, used to implement step 3, create a corresponding grid and assign corresponding materials; a fourth main module, used to implement step 4, install the echarts library in the project directory and prepare data; a fifth main module, used to implement step 5, customize relevant functions for drawing different charts; a sixth main module, used to implement step 6, initialize canvas and draw content, convert the drawn content into an image, create a grid and assign corresponding materials.
[0012] In a third aspect, an embodiment of the present invention provides an electronic device, including:
[0013] At least one processor, at least one memory and a communication interface; wherein,
[0014] The processor, memory and communication interface communicate with each other;
[0015] The memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the three-dimensional UI production method based on the Cocos game engine provided by any one of the various implementation methods of the first aspect.
[0016] In a fourth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions enable a computer to execute a three-dimensional UI production method based on the Cocos game engine provided by any one of the various implementation methods of the first aspect.
[0017] The Cocos game engine-based 3D UI production method and device provided in the embodiment of the present invention prepare relevant text to be displayed and initialize canvas; draw content and convert it into an image; create a corresponding grid and assign corresponding materials; install the echarts library in the project directory and prepare data; customize relevant functions for drawing different charts; initialize canvas and draw content, convert the drawn content into an image, create a grid and assign corresponding materials. 3D UI can be produced and generated in the Cocos game engine when the 3D UI is not supported, thereby meeting the 3D UI display requirements of the digital twin visualization system. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 A schematic diagram of a process flow of a 3D UI production method based on the Cocos game engine provided by an embodiment of the present invention;
[0020] Figure 2 A schematic diagram of the structure of a 3D UI production device based on the Cocos game engine provided by an embodiment of the present invention;
[0021] Figure 3 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical scheme and advantages of the embodiment of the present invention clearer, the technical scheme in the embodiment of the present invention will be clearly and completely described in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention. In addition, the technical features in the various embodiments or single embodiments provided by the present invention can be combined with each other arbitrarily to form a feasible technical solution. This combination is not subject to the constraints of the sequence of steps and / or the structural composition mode, but must be based on the ability of ordinary technicians in the field to achieve. When the combination of technical solutions is contradictory or cannot be achieved, it should be considered that the combination of such technical solutions does not exist and is not within the scope of protection required by the present invention. If there are step numbers in the following embodiments, they are only set for the convenience of explanation, and the order between the steps is not limited in any way. The execution order of each step in the embodiment can be adaptively adjusted according to the understanding of those skilled in the art.
[0023] The method of drawing echarts or canvas through the built-in mesh of Cocos solves the problem that Cocos cannot display charts or texts in 3D scenes based on real-time data, thereby meeting the 3D UI display requirements of the digital twin visualization system and ensuring the clarity and synchronization efficiency of charts and texts as much as possible while ensuring the lowest performance consumption. The text drawn by canvas and the chart drawn by echarts are drawn separately and in parallel without interfering with each other. Based on this, an embodiment of the present invention provides a three-dimensional UI production method based on the Cocos game engine, see Figure 1 The method includes: step 1, preparing relevant text to be displayed and initializing canvas; step 2, drawing content and converting the drawn content into an image; step 3, creating a corresponding grid and assigning corresponding materials; step 4, installing the echarts library in the project directory and preparing data; step 5, customizing relevant functions for drawing different charts; step 6, initializing canvas and drawing content, converting the drawn content into an image, creating a grid and assigning corresponding materials.
[0024] Based on the content of the above method embodiment, as an optional embodiment, the three-dimensional UI production method based on the Cocos game engine provided in the embodiment of the present invention, step 1 specifically includes: using an interface or a local file to read relevant text into the memory, analyzing the content of the relevant text and using the relevant unique identifier as the primary key, establishing a corresponding mapping table in the memory, the mapping table is used for multiple text contents, and is returned in the same interface or local file. If the original content is lacking at the beginning of the operation, a test text is used to perform a text drawing test; the canvas is initialized based on the different sizes required for drawing the content, and then the relevant information is saved in the memory respectively, and if the text content changes later, the relevant information is used again for drawing.
[0025] Based on the content of the above method embodiment, as an optional embodiment, the three-dimensional UI production method based on the Cocos game engine provided in the embodiment of the present invention, step 2 specifically includes: clearing the context content of the current canvas, and drawing the text outline, color, size and special effects according to the prepared display content according to the determined text drawing function (which part draws the title, which part draws the content or other, generally speaking, different UI display styles are basically different); converting the canvas into an image resource, and then drawing an image of the corresponding size according to the size of the data corresponding to the image resource, and then setting the image Mipmap level and the wrapping mode of the map.
[0026] Based on the content of the above method embodiment, as an optional embodiment, the three-dimensional UI production method based on the Cocos game engine provided in the embodiment of the present invention, step 3 specifically includes: according to the aspect ratio calculated by the width and height of the canvas, the mesh vertex coordinates and UV coordinates are calculated, and the built-in mesh creation method in Cocos is used to create a mesh material using the converted image after the corresponding mesh is created, and assign it to the created mesh. It should be noted that steps 1, 2, and 3 are for text drawing.
[0027] Based on the content of the above method embodiment, as an optional embodiment, the three-dimensional UI production method based on the Cocos game engine provided in the embodiment of the present invention, step 4 specifically includes: opening the Cocos project directory, and in the assets directory, using the npm command "npm install echarts" to install the echarts dependency library; using the interface or local file to read the data into the memory, analyzing the data and using the data-related unique identifier as the primary key, establishing a mapping table relationship in the memory, the mapping table relationship is used for echarts image drawing, and if there is a lack of original data in the initial operation, use simulated data for drawing testing.
[0028] Based on the content of the above method embodiment, as an optional embodiment, the three-dimensional UI production method based on the Cocos game engine provided in the embodiment of the present invention, step 5 specifically includes: according to the display requirements of different charts in actual business scenarios, formulate internal chart drawing logic, customize corresponding functions for different charts, and the chart drawing function is used to draw data and display styles without destroying the drawing component logic and changing the drawing component code, and attach specific business logic. In another embodiment, the specific business logic is to switch by clicking on the data panel, and click on the specific chart to pop up the corresponding input box.
[0029] Based on the content of the above method embodiment, as an optional embodiment, the 3D UI production method based on the Cocos game engine provided in the embodiment of the present invention, step 6 specifically includes: initializing the canvas, removing the operation of clearing the context content in step 2 from the drawing content, and calling the echarts initialization method instead, and passing the created canvas in. It should be noted that steps 4, 5 and 6 are for chart drawing.
[0030] The 3D UI production method based on the Cocos game engine provided by the embodiment of the present invention prepares relevant text to be displayed and initializes canvas; draws content and converts it into an image; creates a corresponding grid and assigns corresponding materials; installs the echarts library in the project directory and prepares data; customizes relevant functions for drawing different charts; initializes canvas and draws content, converts the drawn content into an image, creates a grid and assigns corresponding materials. 3D UI can be produced and generated in the Cocos game engine when the 3D UI is not supported, thereby meeting the 3D UI display requirements of the digital twin visualization system.
[0031] During the specific implementation, the import script imports the code script of this application into the Cocos project that needs to be displayed in 3D. If a chart is to be displayed, the echarts library needs to be installed, and then relevant sub-item scripts are created, relevant functions are customized, and corresponding data attributes are opened; after reading the simulation data, the relevant attributes that need to be set are filled in; the sub-item script is mounted on the node that needs to be used, and it can be drawn automatically.
[0032] The implementation basis of each embodiment of the present invention is to implement programmed processing through a device with a processor function. Therefore, in engineering practice, the technical solutions and functions of each embodiment of the present invention can be encapsulated into various modules. Based on this reality, on the basis of the above embodiments, the embodiment of the present invention provides a 3D UI production device based on the Cocos game engine, which is used to execute the 3D UI production method based on the Cocos game engine in the above method embodiment. Figure 2 The device includes: a first main module, used to implement step 1, prepare relevant text to be displayed and initialize canvas; a second main module, used to implement step 2, draw content, and convert the drawn content into an image; a third main module, used to implement step 3, create a corresponding grid and assign corresponding materials; a fourth main module, used to implement step 4, install the echarts library in the project directory and prepare data; a fifth main module, used to implement step 5, customize relevant functions for drawing different charts; a sixth main module, used to implement step 6, initialize canvas and draw content, convert the drawn content into an image, create a grid and assign corresponding materials.
[0033] The 3D UI production device based on the Cocos game engine provided by the embodiment of the present invention adopts Figure 2 Several modules in it prepare the relevant text to be displayed and initialize the canvas; draw the content and convert it into an image; create the corresponding grid and assign the corresponding material; install the echarts library in the project directory and prepare the data; customize the relevant functions for drawing different charts; initialize the canvas and draw the content, convert the drawn content into an image, create a grid and assign the corresponding material. 3D UI can be made and generated in the Cocos game engine even if it does not support 3D UI, which meets the 3D UI display requirements of the digital twin visualization system.
[0034] It should be noted that the device in the device embodiment provided by the present invention can be used to implement the method in the above method embodiment as well as the method in other method embodiments provided by the present invention. The only difference is that the corresponding functional modules are set, and the principle is basically the same as the principle of the above device embodiment provided by the present invention. As long as the technical personnel in the field refer to the specific technical solutions in other method embodiments on the basis of the above device embodiment, obtain the corresponding technical means and the technical solutions composed of these technical means by combining technical features, the device in the above device embodiment can be improved on the premise of ensuring the practicality of the technical solution, thereby obtaining the corresponding device class embodiment, which is used to implement the methods in other method class embodiments. For example:
[0035] Based on the content of the above-mentioned device embodiment, as an optional embodiment, the three-dimensional UI production device based on the Cocos game engine provided in the embodiment of the present invention also includes: a first sub-module, which is used to implement step 1, which specifically includes: using an interface or a local file to read relevant text into the memory, analyzing the content of the relevant text and using the relevant unique identifier as the primary key, and establishing a corresponding mapping table in the memory, wherein the mapping table is used for multiple text contents, and is returned in the same interface or local file. If the original content is lacking at the beginning of the operation, a test text is used to perform a text drawing test; the canvas is initialized based on the different sizes required for drawing the content, and then the relevant information is saved in the memory respectively. If the text content changes later, the relevant information is used again for drawing.
[0036] Based on the content of the above-mentioned device embodiment, as an optional embodiment, the three-dimensional UI production device based on the Cocos game engine provided in the embodiment of the present invention also includes: a second sub-module, which is used to implement step 2, specifically including: clearing the context content of the current canvas, and drawing the text outline, color, size and special effects according to the determined text drawing function for the prepared display content; converting the canvas into an image resource, and then drawing an image of a corresponding size according to the size of the data corresponding to the image resource, and then setting the image Mipmap level and the wrapping mode of the map.
[0037] Based on the content of the above-mentioned device embodiment, as an optional embodiment, the three-dimensional UI production device based on the Cocos game engine provided in the embodiment of the present invention also includes: a third sub-module, which is used to implement step 3, specifically including: calculating the mesh vertex coordinates and UV coordinates according to the aspect ratio calculated according to the width and height of the canvas, using the built-in mesh creation method in Cocos, and creating a mesh material using the converted image after the corresponding mesh is created, and assigning it to the created mesh.
[0038] Based on the content of the above-mentioned device embodiment, as an optional embodiment, the three-dimensional UI production device based on the Cocos game engine provided in the embodiment of the present invention also includes: a fourth sub-module, which is used to implement step 4, specifically including: opening the Cocos project directory, and using the npm command "npm install echarts" in the assets directory to install the echarts dependency library; using the interface or local file to read the data into the memory, analyzing the data and using the data-related unique identifier as the primary key to establish a mapping table relationship in the memory, wherein the mapping table relationship is used for echarts image drawing. If the original data is lacking at the initial stage of operation, simulated data is used for drawing testing.
[0039] Based on the content of the above-mentioned device embodiment, as an optional embodiment, the three-dimensional UI production device based on the Cocos game engine provided in the embodiment of the present invention also includes: a fifth sub-module, which is used to implement step 5, specifically including: formulating internal chart drawing logic according to the display requirements of different charts in actual business scenarios, and customizing corresponding functions for different charts. The chart drawing function is used to draw data and display styles without destroying the drawing component logic and changing the drawing component code, and attaching specific business logic.
[0040] Based on the content of the above-mentioned device embodiment, as an optional embodiment, the three-dimensional UI production device based on the Cocos game engine provided in the embodiment of the present invention also includes: a sixth sub-module, which is used to implement step 6, specifically including: initializing the canvas, eliminating the operation of clearing the context content in step 2 from the drawing content, and instead calling the echarts initialization method to pass in the created canvas.
[0041] The method of the embodiment of the present invention is implemented by relying on electronic devices, so it is necessary to introduce the relevant electronic devices. Based on this purpose, the embodiment of the present invention provides an electronic device, such as Figure 3 As shown, the electronic device includes: at least one processor, a communication interface, at least one memory, and a communication bus, wherein at least one processor, the communication interface, and at least one memory communicate with each other through the communication bus. At least one processor can call the logic instructions in at least one memory to execute all or part of the steps of the method provided by the aforementioned various method embodiments.
[0042] In addition, the logic instructions in the at least one memory mentioned above can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each method embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program code.
[0043] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0044] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0045] The flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present invention. Based on this understanding, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and sometimes in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of the boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0046] It should be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "includes..." do not exclude the existence of other identical elements in the process, method, article or device including the elements. Any "predetermined threshold", "preset threshold" and other similar expressions that do not indicate specific values can be determined by a person of ordinary skill in the art through simple experiments or corresponding debugging.
[0047] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A 3D UI production method based on Cocos game engine, characterized in that: include: Step 1: Prepare the relevant text to be displayed and initialize the canvas; Step 2: Draw the content and convert the drawn content into an image; Step 3, create the corresponding grid and assign the corresponding material; Step 4, install the echarts library in the project directory and prepare the data; Step 5, customize the relevant functions for drawing different charts; Step 6, initialize the canvas and draw the content, convert the drawn content into an image, create a grid and assign the corresponding material.
2. The 3D UI production method based on Cocos game engine according to claim 1, characterized in that: Step 1 specifically includes: using an interface or a local file to read the relevant text into the memory, analyzing the content of the relevant text and using the relevant unique identifier as the primary key, establishing a corresponding mapping table in the memory, wherein the mapping table is used for multiple text contents, and is returned in the same interface or local file. If the original content is lacking at the beginning of the operation, the test text is used to perform a text drawing test; the canvas is initialized based on the different sizes required for drawing the content, and then the relevant information is saved in the memory respectively. If the text content changes later, the relevant information is used again for drawing.
3. The 3D UI production method based on Cocos game engine according to claim 2, characterized in that: Step 2 specifically includes: clearing the context content of the current canvas, drawing the text outline, color, size and special effects of the prepared display content according to the determined text drawing function; converting the canvas into an image resource, and then drawing an image of corresponding size according to the size of the data corresponding to the image resource, and then setting the image Mipmap level and the winding mode of the texture.
4. The 3D UI production method based on Cocos game engine according to claim 3, characterized in that: Step 3 specifically includes: calculating the mesh vertex coordinates and UV coordinates based on the width and height ratio of the canvas, using the built-in mesh creation method in Cocos, creating a mesh material using the converted image after the corresponding mesh is created, and assigning it to the created mesh.
5. The 3D UI production method based on Cocos game engine according to claim 4, characterized in that: Step 4 specifically includes: open the Cocos project directory, and in the assets directory, use the npm command "npm install echarts" to install the echarts dependency library; use the interface or local file to read the data into the memory, analyze the data and use the data-related unique identifier as the primary key to establish a mapping table relationship in the memory. The mapping table relationship is used for echarts image drawing. If there is a lack of original data at the beginning of the operation, use simulated data for drawing testing.
6. The 3D UI production method based on Cocos game engine according to claim 5, characterized in that: Step 5 specifically includes: formulating internal chart drawing logic according to the display requirements of different charts in actual business scenarios, and customizing corresponding functions for different charts. The chart drawing function is used to draw data and display styles without destroying the drawing component logic and changing the drawing component code, and attaching specific business logic.
7. The 3D UI production method based on Cocos game engine according to claim 6, characterized in that: Step 6 specifically includes: initializing the canvas, removing the operation of clearing the context content in step 2 from the drawing content, and calling the echarts initialization method instead to pass in the created canvas.
8. A 3D UI production device based on Cocos game engine, characterized in that: include: The first main module is used to implement step 1, prepare the relevant text to be displayed and initialize the canvas; The second main module is used to implement step 2, draw the content, and convert the drawn content into an image; the third main module is used to implement step 3, create the corresponding grid and assign the corresponding material; the fourth main module is used to implement step 4, install the echarts library in the project directory and prepare data; the fifth main module is used to implement step 5, customize relevant functions for drawing different charts; the sixth main module is used to implement step 6, initialize the canvas and draw the content, convert the drawn content into an image, create a grid and assign the corresponding material.
9. An electronic device, characterized in that: include: At least one processor, at least one memory and a communication interface; wherein, The processor, memory and communication interface communicate with each other; The memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the method according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer instructions that cause a computer to execute the method of any one of claims 1 to 7.
