Using Tutorials
Color and Gradient Configuration
ThunderFire UX Tool offers a convenient solution for configuring colors and gradients, allowing users to apply the preset directly in the Inspector panel or through code.
How to Use
Menu bar By selecting [ThunderFireUXTool -> Create Assets -> UIColorAsset or UIGradientAsset] from the menu bar, you can generate a new configuration file for colors or gradients. Afterwards, click on [ThunderFireUXTool-> UIColorConfig], which will lead you to the following configuration interface (using color as an example; gradient follows suit).
Select a column to expand the detailed configuration, you can configure the color or change the name and notes and other information. Click the "+" or "-" sign to add or delete colors.
To access the generated code file and invoke the color configuration in your code, you can save the data to UIColorGenDef.cs (click on the Save button below). The gradient configuration will be automatically created in UIGradientGenDef.cs file. (Please refer to the program interface below for details on file format.)
Use Configuration in UXImage Component
Clicking on the UIColorConfig button in UXImage directs you to the following interface.
The window will list all configured colors. Double-click a color entry to select that color as the color used by UXImage. Click the button in the upper right corner to open the Preset Editor to edit the color.
When the color type of UXImage is set to Gradient, it opens the Gradient configuration, which is basically the same as the operation related to the Color Configuration window.
Program Interface
CS files
// The following files are automatically generated by the program and can be called by the user
// File path: Assets/UXTools/Runtime/Feature/UIColor/UIColorGenDef.cs
public sealed class UIColorGenDef {
public enum UIColorConfigDef {
Def_Color1 = 0,
Def_Color2 = 1330857165,
Def_Color3 = 888517903,
}
}
// File path: Assets/UXTools/Runtime/Feature/UIColor/UIGradientGenDef.cs
public sealed class UIGradientGenDef {
public enum UIGradientConfigDef {
Def_Gradient1 = -1179191585,
Def_Gradient2 = 549431141,
}
}
Function
// Description: Load the generated cs file into the project and call this function first when using the other functions below
// Class: UIColorUtils
// Parameters: None
// Return value: None
public static void LoadGamePlayerConfig()
// Description: Get the configured color Color
// Class: UIColorUtils
// Parameters:
// def the enumeration value in the enumeration of Color automatically generated in the above cs file
// Return value:
// The configured color, type Color
public static Color GetDefColor(UIColorGenDef.UIColorConfigDef def)
// Description: Get the configured gradient Gradient
// Class: UIColorUtils
// Parameters:
// def the enumeration value in the enumeration of the Gradient automatically generated in the above cs file
// Return value:
// The configured gradient, type Gradient
public static Gradient GetDefGradient(UIGradientGenDef.UIGradientConfigDef def)