Complex custom component

Hello! How to make a complex custom component. In the picture below I made an example.
Depending on the selected item in the “Category” property, one of the lists (“Modes” or “Property”) should be displayed. The number of items in the “Category” property will be more than 3, for example I showed only 2.

I’m using coconut creator v.3.8.1

Attention! Please ignore the property names and their values. I just chose the first script I came across as an example. Example is for demonstration purposes only. :grinning: :sweat_smile: :face_with_hand_over_mouth:

Example:
2024-03-06_20-07-45

export enum Category {
    Normal  = 0,
    Timer   = 1,
    NonStop = 2,
    Simple  = 3};
export enum Example1 {
    Normal  = 0,
    Timer   = 1,
    NonStop = 2,
    Simple  = 3};
export enum Example2 {
    Normal  = 0,
    Timer   = 1,
    NonStop = 2,
    Simple  = 3};

Enum(Category);
Enum(Example1);
Enum(Example2);

@ccclass('Modes')
export class Modes extends Component {
    @property({ type : Category })
    category : Category = Category.Simple;

    @property({ type : Example1 })
    modes : Example1 = Example1.Timer;

    @property({ type : Example2 })
    property : Example2 = Example2.Normal;
}

Hi, you are required to implement something like this:

@property({
	type: Example1,
	visible: function(this:Modes){
		return this.Modes == Category.Simple
	}
})

Check this file:

1 Like

Thank you!
I wanted to post my example, although I was unhappy with it because it was cumbersome… :face_with_hand_over_mouth:
I’d rather put my example away so as not to scare anyone. :sweat_smile: :sweat_smile: :sweat_smile:

1 Like