A method and system for setting the polymorphism of control images
By generating image configuration files and traversing the loading image item selection interface, the problem of cumbersome control image settings in the existing technology is solved, and the automatic configuration and management of the control image in different states is realized.
Patent Information
- Application Number
- CN202111211346.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-18
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2041-10-18
AI Technical Summary
In the prior art, when setting pictures of different states for software interface controls, multiple pictures need to be set one by one, which is cumbersome and difficult to manage, especially when the control adds a new state or replaces pictures, it needs to be reset.
By configuring the picture files in the game project to generate configuration files, traverse and load the picture item selection interface, configure different pictures according to the status of the picture item, and realize that the control displays different pictures in different states.
It simplifies the management and configuration of control images, facilitates the unified management of control images in game projects, reduces modifications to the original interface and programs, and improves efficiency.
Smart Images

Figure CN113893537B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and particularly to a method and system for setting polymorphic pictures of controls. Background Art
[0002] In software interface production, it is often necessary to set different pictures for interface controls such as button controls, list controls, window controls, picture controls, etc. However, many controls need to support different states. For example, a button control often has the following four states:
[0003] (1) Normal state, indicating that the button control is in an active state and is not currently in use;
[0004] (2) Click state, indicating that the button control is being clicked or is in use;
[0005] (3) Disabled state, indicating that the button control is not enabled and cannot be used;
[0006] (4) Selected state, indicating that the current button control has been selected.
[0007] For button controls in different states, it is often necessary to set different state pictures for them. For example, a normal state button needs to be set with a normal picture, and a disabled state button needs to be set with a grayscale picture, so as to distinguish the state of the current button control. The same is true for other controls. For example, a window control is sometimes divided into a normal state and a floating state when the mouse moves over it, and different state pictures also need to be set for it.
[0008] The prior art mainly sets pictures by selecting different pictures for different states of the control. If this method is implemented, it is necessary to find all pictures in different states each time for one-by-one setting, which is rather cumbersome and not easy to manage. Sometimes, when a new state is added to the control or the picture is changed, it is necessary to reset the pictures corresponding to the states, which is very troublesome. Summary of the Invention
[0009] To overcome the above problems, the purpose of the present invention is to provide a method for setting pictures of interface controls in a game project in multiple states.
[0010] The present invention adopts the following scheme: A method for setting polymorphic pictures of controls, the method comprising the following steps:
[0011] Step S1, configuring picture files in the game project to generate a picture configuration file;
[0012] Step S2, traversing all picture configuration files in the game project to load the picture item selection interface;
[0013] Step S3: After selecting a picture item, configure different pictures according to the different states of the picture control of the picture item, so as to enable the interface control to display pictures in different states in different states.
[0014] Further, step S1 is further specifically: Configure all picture files required in the game project, configure several pictures of the same type as a picture item, and set the specific number of pictures. Sort and configure the pictures in specific states according to the number of pictures, so as to generate a picture configuration file.
[0015] Further, step S2 is further specifically: Traverse and read all picture configuration files in the project, load the picture items. A picture item is a set with the number of pictures and the specific picture path, that is, a picture set in the picture configuration file. Select an interface for the user to select the picture item to be used.
[0016] Further, step S3 is further specifically: After selecting a specific picture item, configure the picture item for the picture control. Judge which state the picture corresponds to according to the number of pictures of the selected picture item, and determine the control state corresponding to each picture according to several pictures of the same type as a picture item.
[0017] The present invention also provides a system for setting the polymorphism of control pictures, including a configuration module, a traversal module, and a selection module. The configuration module configures the picture files in the game project to generate a picture configuration file. The traversal module traverses all picture configuration files in the game project and loads the picture item selection interface. The rotation module, after selecting a picture item, configures different pictures according to the different states of the picture control of the picture item, so as to enable the interface control to display pictures in different states in different states.
[0018] Further, the configuration module is further specifically: Configure all picture files required in the game project, configure several pictures of the same type as a picture item, and set the specific number of pictures. Sort and configure the pictures in specific states according to the number of pictures, so as to generate a picture configuration file.
[0019] Further, the traversal module is further specifically: Traverse and read all picture configuration files in the project, load the picture items. A picture item is a set with the number of pictures and the specific picture path, that is, a picture set in the picture configuration file. Select an interface for the user to select the picture item to be used.
[0020] Further, the selection module is further specifically configured as follows: after selecting a specific picture item, configure the picture item for the picture control, determine which state picture each picture corresponds to based on the number of pictures in the selected picture item, and determine the control state corresponding to each picture according to several pictures of the same type as a picture item.
[0021] The beneficial effects of the present invention are as follows: through the present invention, the controls in the game interface can change pictures in different states according to different operation states, which is convenient for the unified management of the control pictures in the game project, helps with the configuration of the control pictures, and facilitates the setting of the game interface in the game project. Description of the Drawings
[0022] Figure 1 It is a schematic flowchart of the method of the present invention.
[0023] Figure 2 It is a schematic block diagram of the system of the present invention. Detailed Embodiments
[0024] The present invention will be further described below with reference to the accompanying drawings.
[0025] Please refer to Figure 1 As shown, a method for setting the polymorphism of control pictures of the present invention includes the following steps:
[0026] Step S1: Configure the picture files in the game project to generate a picture configuration file;
[0027] Step S2: Traverse all the picture configuration files in the game project and load the picture item selection interface;
[0028] Step S3: After selecting a picture item, configure different pictures according to the different states of the picture control of the picture item, so as to realize that the interface control displays pictures in different states in different states.
[0029] The present invention will be further described below through a specific embodiment:
[0030] 1. Configure the picture files in the game project to generate a picture configuration file
[0031] Configure all the picture files required in the game project (such as the Conquer game), configure several pictures of the same type as a picture item (a picture item is a collection with the number of pictures and the specific picture path), and set the specific number of pictures, and sort and configure the pictures in specific states according to the number of pictures, so as to generate a picture configuration file. The picture configuration method is as follows:
[0032] (1) If the number of pictures is 1, the set picture is a normal state picture or a background picture.
[0033] (2) If the number of images is 2, the set images are the normal state image and the clicked state image.
[0034] (3) If the number of images is 3, the set images are the normal state image, the clicked state image and the disabled state image.
[0035] (4) If the number of images is 4, the set images are the normal state image, the clicked state image, the disabled state image and the selected state image.
[0036] (5) If the number of images is 9, the set images are nine-grid images, corresponding to the nine images of the nine-grid respectively.
[0037] 2. Traverse all image configuration files in the game project and load the image item selection interface
[0038] When editing the game project interface, add controls that need to set images, which can be button controls, window controls, list controls, image controls (any control that needs to set images can be used, and these controls will be collectively referred to as image controls later), etc. On the interface, after adding specific image controls, images need to be set for the image controls. The program will automatically traverse and read all image configuration files in the project to load the image item (an image item is a collection with the number of images and the specific image path, that is, an image collection in the image configuration file in step 1) selection interface for the user to select the image item to be used. The image item selection interface will provide a preview of each image of all image items in the project by the program. The user selects the corresponding image item according to the image to be used, so as to set the image item to the image control.
[0039] 3. After selecting the image item, configure different images according to the different states of the image control
[0040] On the game interface, the controls can be button controls, window controls, list controls, image controls. Button controls and window controls need to set specific button images and background images, etc. These controls that need to set images are collectively referred to as image controls. After selecting a specific image item, configure the image item for the image control added in step 2. By the number of images of the selected image item, judge which state image each image corresponds to, mainly according to the configuration method in step 1 to determine the control state corresponding to each image.
[0041] Then, according to the different states of the picture control, different pictures are configured for the picture control. For example, when the control is in the normal state, the picture of Frame0 of this picture item in the configuration file is selected; when the control is in the clicked state, the picture of Frame1 of this picture item is used; when the control is in the disabled state, the picture of Frame2 of this picture item is used. In this way, only one picture item needs to be set for the picture control, and the rest of the pictures are dynamically set by the program reading the state of the picture control. If it is necessary to modify the pictures in different states for the control in the future, there is no need to modify the original interface and program. Just modify the configuration file using this picture to directly perform the replacement.
[0042] The present invention is further illustrated by a specific application scenario:
[0043] First, it is necessary to configure the picture files required in the project. Several pictures of the same type are configured as a picture item, and the specific number of pictures is set to generate a control.ini configuration file. The pictures in specific states are configured according to the number of pictures. The configuration method is as follows:
[0044] (1) If the number of pictures is 1, the set picture is the normal state picture or the background picture. (That is, Frame0 in the following figure is the normal state picture) For example:
[0045] / / Chat interface - Chat prompt text picture
[0046] [copliaotian_lttswbpic]
[0047] FrameAmount = 1
[0048] Frame0 = data / interface_en / liaotian / lttswbpic.png
[0049] (2) If the number of pictures is 2, the set pictures are the normal state picture and the clicked state picture. (That is, Frame0 in the following figure is the normal state picture, and Frame1 is the clicked state picture) For example:
[0050] / / Select table - normal button
[0051] [xzzmnormalbtn]
[0052] FrameAmount = 2
[0053] Frame0 = data / interface_en / xzzm / xzzmnormalbtnnormal.png
[0054] Frame1 = data / interface_en / xzzm / xzzmnormalbtnclick.png
[0055] (3) If the number of pictures is 3, the set pictures are normal state picture, click state picture and disabled state picture. For example:
[0056] / / Tianshi interface - close button
[0057] [CloseButton]
[0058] FrameAmount = 3
[0059] Frame0 = data / interface / tsshangdian / bigserverbtnnormal.png
[0060] Frame1 = data / interface / tsshangdian / bigserverbtnclick.png
[0061] Frame2 = data / interface / tsshangdian / bigserverbtndisable.png
[0062] (4) If the number of pictures is 4, the set pictures are normal state picture, click state picture, disabled state picture and selected state picture. For example:
[0063] / / Select table - wallet button
[0064] [xzzmqianbaobtn]
[0065] FrameAmount = 3
[0066] Frame0 = data / interface_en / xzzm / xzzmqianbaobtnnormal.png
[0067] Frame1 = data / interface_en / xzzm / xzzmqianbaobtnclick.png
[0068] Frame2 = data / interface_en / xzzm / xzzmqianbaobtndisable.png
[0069] Frame3 = data / interface_en / xzzm / xzzmqianbaobtnselect.png
[0070] (5) If the number of pictures is 9, the pictures set are nine-grid pictures, corresponding to the nine pictures of the nine-grid respectively. For example:
[0071] / / New version of the universal baseboard
[0072] [universalbg]
[0073] FrameAmount = 9
[0074] Frame0 = data / interface / jiuzy / universalbg1.png
[0075] Frame1 = data / interface / jiuzy / universalbg2.png
[0076] Frame2 = data / interface / jiuzy / universalbg3.png
[0077] Frame3 = data / interface / jiuzy / universalbg4.png
[0078] Frame4 = data / interface / jiuzy / universalbg5.png
[0079] Frame5 = data / interface / jiuzy / universalbg6.png
[0080] Frame6 = data / interface / jiuzy / universalbg7.png
[0081] Frame7 = data / interface / jiuzy / universalbg8.png
[0082] Frame8 = data / interface / jiuzy / universalbg9.png
[0083] Taking the third picture item "CloseButton" above as an example, this close button has three pictures. The first one is bigserverbtnnormal.png in Frame0, which represents the button picture in the normal state. The second one is bigserverbtnclick.png in Frame1, which represents the button picture in the clicked state. The third one is bigserverbtndisable.png in Frame2, which represents the button picture in the disabled state. Since the pictures are selected from the current project, relative paths are used (the specific absolute path is the current project path plus the relative path of the picture).
[0084] When editing the project interface, add the controls that need to set pictures, which can be button controls, window controls, list controls, picture controls (any control that needs to set pictures can be used, and these controls will be collectively referred to as picture controls later), etc. After adding the specific picture control on the interface, it is necessary to set a picture for the picture control. The program will automatically traverse and read all the picture configuration files in the project, and load the picture item selection interface for the user to select the picture item to be used. The picture item selection interface will provide a preview of each picture of all the picture items in the project by the program. The user selects the corresponding picture item according to the picture to be used, so as to set the picture item to the picture control.
[0085] Then, select a specific picture item and set the picture item for the picture control. For example, select the picture item "CloseButton" in the above example. It is read that this picture item has three pictures. According to the number of pictures, it is judged which state each picture corresponds to. According to the different states of the picture control, different pictures are configured for the picture control. If the picture control is in the normal state, the picture bigserverbtnnormal.png in Frame1 of this picture item is selected; if the picture control is in the clicked state, the picture bigserverbtnclick.png in Frame2 of this picture item is used; if the picture is in the disabled state, the picture bigserverbtndisable.png in Frame3 of this picture item is used. In this way, only one picture item needs to be set for the picture control, and the rest are dynamically set by the program reading the state of the picture control. If it is necessary to modify the pictures in different states for the control in the future, there is no need to modify the original interface and program. Just modify the configuration file using this picture to directly replace it.
[0086] In summary, the present invention mainly provides a method for setting images in multiple states for interface controls in a game project. It is necessary to pre-configure the image files in the game project, set the image files into image items (an image item is a set with the number of images and the specific image paths), so as to generate an image configuration file. When editing the game interface and setting images for the game interface controls, all image configuration files are read, image items are read from the image configuration files, according to the read image items, the number of images corresponding to the image items is obtained, as well as the specific images in all different states, and then the selected image item is set for the interface control. Finally, the interface control sets the specific images in the selected image item according to its own state. In this way, there is no need to set different images for each state of the interface control, and only one image item needs to be set, so that the interface control can display different state images in different states.
[0087] Please refer to Figure 2 As shown, the present invention also provides a system for setting the polymorphism of control images, including a configuration module, a traversal module, and a selection module. The configuration module configures the image files in the game project to generate an image configuration file. The traversal module traverses all the image configuration files in the game project and loads the image item selection interface. The rotation module, after selecting an image item, configures different images according to the different states of the image controls of the image item, so as to realize that the interface control displays different state images in different states.
[0088] The configuration module is further specifically: configuring all the image files required in the game project, configuring several images of the same type as an image item, and setting the specific number of images. Sort and configure the images in specific states according to the number of images, so as to generate an image configuration file.
[0089] The traversal module is further specifically: traversing and reading all the image configuration files in the project, loading the image items. An image item is a set with the number of images and the specific image paths, that is, an image set in the image configuration file, and a selection interface for the user to select the image item to be used.
[0090] The selection module is further specifically: after selecting a specific image item, configuring the image item for the image control, judging which state the image corresponds to according to the number of images of the selected image item, and determining the control state corresponding to each image according to several images of the same type as an image item.
[0091] The above are only the preferred embodiments of the present invention. All equivalent changes and modifications made according to the scope of the patent application of the present invention shall fall within the scope covered by the present invention.
Claims
1. A method for setting the polymorphism of control pictures, characterized in that, The method includes the following steps: Step S1: Configure the picture files in the game project to generate a picture configuration file; Step S2: Traverse all the picture configuration files in the game project and load the picture item selection interface; Step S3: After selecting a picture item, configure different pictures according to the different states of the picture control of the picture item, so as to enable the interface control to display pictures in different states in different states; The specific content of step S1 is further as follows: Configure all the picture files required in the game project, configure several pictures of the same type as a picture item, and set the specific number of pictures. Sort and configure the pictures in specific states according to the number of pictures, so as to generate a picture configuration file.
2. The method for setting control picture polymorphism according to claim 1, characterized in that: The specific content of step S2 is further as follows: Traverse and read all the picture configuration files in the project, load the picture items. A picture item is a collection with the number of pictures and the specific picture path, that is, a picture collection in the picture configuration file, and a selection interface for the user to select the picture item to be used.
3. A method for setting the polymorphism of control pictures according to claim 1, characterized in that: The specific content of step S3 is further as follows: After selecting a specific picture item, configure the picture item for the picture control. By the number of pictures of the selected picture item, judge which state each picture corresponds to, and determine the control state corresponding to each picture according to several pictures of the same type as a picture item.
4. A system for setting the polymorphism of control pictures, characterized in that: It includes a configuration module, a traversal module and a selection module. The configuration module is to configure the picture files in the game project to generate a picture configuration file; The traversal module is to traverse all the picture configuration files in the game project and load the picture item selection interface; The selection module is to, after selecting a picture item, configure different pictures according to the different states of the picture control of the picture item, so as to enable the interface control to display pictures in different states in different states; The specific content of the configuration module is further as follows: Configure all the picture files required in the game project, configure several pictures of the same type as a picture item, and set the specific number of pictures. Sort and configure the pictures in specific states according to the number of pictures, so as to generate a picture configuration file.
5. The system for setting the polymorphism of control pictures according to claim 4, characterized in that: The specific content of the traversal module is further as follows: Traverse and read all the picture configuration files in the project, load the picture items. A picture item is a collection with the number of pictures and the specific picture path, that is, a picture collection in the picture configuration file, and a selection interface for the user to select the picture item to be used.
6. A system for setting control picture polymorphism according to claim 4, characterized in that: The specific content of the selection module is further as follows: After selecting a specific picture item, configure the picture item for the picture control. By the number of pictures of the selected picture item, judge which state each picture corresponds to, and determine the control state corresponding to each picture according to several pictures of the same type as a picture item.
Citation Information
Patent Citations
Method for realizing operation and display of button type panel control
CN101727315A