Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: MultiConditionalFields part 2 #220

Closed
Tommigun1980 opened this issue Dec 23, 2022 · 2 comments
Closed

Feature Request: MultiConditionalFields part 2 #220

Tommigun1980 opened this issue Dec 23, 2022 · 2 comments

Comments

@Tommigun1980
Copy link

Tommigun1980 commented Dec 23, 2022

#59 is a request for MultiConditionalFields but the fix doesn't seem to work unless the types that are compared can be inverted.

As an example let's say that queryType must be Option2 and someFlag must true.

These don't work:
[ConditionalField(new[] { nameof(queryType), nameof(someFlag) }, null, new object[] { QueryType.Option2, true })]

[ConditionalField(new[] { nameof(queryType), nameof(someFlag) }, new bool[] { false, true }, new object[] { QueryType.Option2 })]

[ConditionalField(new[] { nameof(queryType), nameof(someFlag) }, null, new object[] { QueryType.Option2 }, new object[] { true })]

It seems to me that the fix only works when the types can be inverted, no?

Thank you again for a really fantastic project!!

@Tommigun1980 Tommigun1980 changed the title eature Request: MultiConditionalFields part 2 Feature Request: MultiConditionalFields part 2 Dec 23, 2022
@Deadcows
Copy link
Owner

I know it's really confusing to do complex checks. Hopefully, when I'm done with MyBox 2.0 you'll be able to simply put several ConditionalField attributes on top of one field.

But for now..
Actually, it looks like your first attempt should work. At least this quick test works for me

public enum MyEnum
{
	A, B, C
}

public MyEnum EnumCondition;
public bool BoolCondition;

[ConditionalField(new[] { nameof(EnumCondition), nameof(BoolCondition) }, null, new object[] { MyEnum.B, true })]
public string WhenB_and_True;

Can you please try it again and confirm, that both queryType and someFlag are shown in inspector. And also tell me if tested field is always shown or in contrary is always hidden?

@Tommigun1980
Copy link
Author

Hi @Deadcows and thanks for the reply!

You are absolutely correct, my first attempt does work, I must have failed my testing.
Thanks so much and sorry for the false report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants