Comments (10)
Wow, some of attributes there are really useful π€― And most of them are just like in MyBox π
His ShowIf is a bit simpler because his checks based only on bool values, but I've got some ideas π
Hes BoxGroup implementation looks cool, I'll consider to update my FoldoutAttribute.
You mentioned InfoBox and I remembered about CommentaryComponent! I completely forgot to write docs on it π
And I wanted to use same functionality to add comments as a fields, not as a components. So this request is WIP
from mybox.
How cool it would be to have the ability to pass Action into the attribute π€
But I've got some ideas on how to achieve this. Maybe with additional attributes. Or with string parsing, like
[ConditionalField(nameof(HostileNPC) + " == true && " + nameof(AttackRange) + " <= 5")]
public AnimationStateReference MeleeAnimation;
...buuut I'm not sureπ Maybe you have some ideas on the design of such approach?
And every time when I'm trying to imagine use-cases for such complex scenarios I come up with REALLY bad architecture design.
What is your use case for such complex conditions?
from mybox.
How do you think about ability to use validation function?
Like with the case with MeleeAnimation:
[ConditionalField("MeleeAnimationFieldShown")]
public AnimationStateReference MeleeAnimation;
private bool MeleeAnimationFieldShown() => HostileNPC && (AttackRange <= 5);
I thought about it for a while, but I didn't want to clutter code with such functions. But this is very flexible approach
from mybox.
This is the usecase (error) I have now:
I'll try your suggestion when I have time :)
from mybox.
Oh! That would be easier to fix.
I just need to check if target have its own [ConditionalField] and is visible and hopefully it won't cause any stackoverflows π
from mybox.
I have a use case where I have a dropdown the reveals some fields depending on what is selected. One of these options has some fields that are only needed some of the time so I have them hidden under a checkbox bool... I just realized as I am writing this that I could make the Checkbox only show if I have b selected in the drop-down and what they are hiding show if the box is checked...
Well, I do have another use case where I want some but not all options in the drop-down to have some fields. So something like this.
A - has the field
B - does not
C - has the field
D - has the field
from mybox.
I noticed Naughty Attributes has a conditional field that can do AND OR operations along with hiding or setting the field to "readonly".
They also has some other neat features, but I wouldn't want to decide between this and mybox, so would be cool to integrate some of those into mybox :)
from mybox.
Now it is possible to have multiple conditions on the same field. Although it's not the final version of the feature it is working π
[ConditionalField(nameof(A))] public string IsA;
[ConditionalField(nameof(B), true)] public string NotB;
[ConditionalField(nameof(A), nameof(B))] public string AandB;
[ConditionalField(new []{nameof(A), nameof(B)}, new []{true})] public string NotAandB;
[ConditionalField(new []{nameof(A), nameof(B)}, new []{false, true})] public string AnotB;
[ConditionalField(new []{nameof(A), nameof(B)}, new []{true, true})] public string NotAandNotB;
I'll add more info in wiki later. If you got some questions please let me know π
from mybox.
Hi @Deadcows!
Is there any way to set up expression where the types that must be checked can not just use the inverse pattern? 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 })]
How do I combine these? It seems to me that the fix only works when the types can be inverted, no?
Thank you again for a really fantastic project!!
from mybox.
Hi @Deadcows! Is there any way to set up expression where the types that must be checked can not just use the inverse pattern? 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 })]
How do I combine these? It seems to me that the fix only works when the types can be inverted, no?
Thank you again for a really fantastic project!!
Answered here
from mybox.
Related Issues (20)
- Bug: Waiting for user code in MyBox.dll to finish executing HOT 3
- Crash in MySerializedProperty
- Constant errors with conditional field
- Enter Play mode being slower after install the package HOT 5
- Release with .unitypackage HOT 1
- Naming Conflit HOT 1
- Editor takes a long time in "MyEditorEvents.OnWillSaveAssets" HOT 4
- [ButtonMethod] not work in list item HOT 9
- Passing a List or Array to DefinedValues HOT 3
- ConditionalField does not work when RegexString is used on the same fields HOT 1
- Missing def for Attributes/DefinedValuesAttribute.cs HOT 1
- ConditionalFieldAttribute is rather slow HOT 3
- Suggestion: Help boxes
- Using [ConditonalField] causes Editor Button to be drawn twice HOT 2
- ReadOnly HOT 1
- "No GUI Implemented" when using a UIElement Property Drawer with Default Inspector. HOT 5
- MyEditorAudio.cs not found. HOT 1
- DefinedValues w. method is null HOT 4
- [ConditionalField] doesn't work with lists or arrays HOT 1
- Foldout doesn't work properly in child classes
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mybox.