GithubHelp home page GithubHelp logo

Comments (10)

Deadcows avatar Deadcows commented on September 2, 2024 1

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.

Deadcows avatar Deadcows commented on September 2, 2024

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.

Deadcows avatar Deadcows commented on September 2, 2024

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.

TheXRMonk avatar TheXRMonk commented on September 2, 2024

This is the usecase (error) I have now:
conditionalfield use case

I'll try your suggestion when I have time :)

from mybox.

Deadcows avatar Deadcows commented on September 2, 2024

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.

android272 avatar android272 commented on September 2, 2024

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.

TheXRMonk avatar TheXRMonk commented on September 2, 2024

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.

Deadcows avatar Deadcows commented on September 2, 2024

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.

Tommigun1980 avatar Tommigun1980 commented on September 2, 2024

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.

Deadcows avatar Deadcows commented on September 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.