playMaker

Author Topic: Need a little help for UI Basics  (Read 3447 times)

suppenhuhn

  • Playmaker Newbie
  • *
  • Posts: 12
Need a little help for UI Basics
« on: February 24, 2015, 04:10:53 AM »
Hi!

I'm using Playmaker since yesterday - i think it's possibilitys are awesome!

I've watched many tutorials on this page - but as it is - when you start your own "thing" you don't have a glue where to start  :o

So i'm trying to build a kind of a basic mockup for a simple menu with the new UI. I need a button which toggles an object on/off AND enables the blur filter on a camera when turn the object on and disables the filter when turning the object off.

I have a State with the UGUI / ON CLICK global transition on it and two empty states : Blurred and notBlurred. Also two custom Transitions: isBlurred and isNotBlurred.

My first action in this State is "get Property" of the Filtercomponent, check if it's enabled and store this into a Bool-variable.

And now i don't know how to make a "conditional" action, like: when the variable == true please fire the isBlurred transition, if the variable == false please fire the isNotBlurred transition.


Would be happy for every hint :)
Robert

« Last Edit: February 24, 2015, 04:27:57 AM by suppenhuhn »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Need a little help for UI Basics
« Reply #1 on: March 03, 2015, 01:01:19 AM »
Hi,

 you are going to create a FsmBool named "Is Blurred" and you set it to false by default.

 everytime you get the UGUI / ON CLICK you use the action "Bool Flip" to toggle this "Is Blurred" bool, then the next action will be "Bool Test" where you can then transit to either of your states to effectivly blur or not your scene.

 does that make sense?

 Bye,

 Jean

suppenhuhn

  • Playmaker Newbie
  • *
  • Posts: 12
Re: Need a little help for UI Basics
« Reply #2 on: March 05, 2015, 07:45:21 AM »
Hi Jean,

thank you for the answer - it makes sense! ;)

But i'm not sure what the FSM Bool is..is it a bool Variable or is it something else? My way is now to set a global Bool-Variable "IsBlurred" to false. Then UGUI / ON CLICK the bool-flip and bool-test actions.

Thank you so far!

suppenhuhn

  • Playmaker Newbie
  • *
  • Posts: 12
Re: Need a little help for UI Basics
« Reply #3 on: March 05, 2015, 08:00:06 AM »
By the way :

Is it somehow possible to check which button was clicked?

Let's say i have 3 Buttons ( A,B,C ) each with UGUI / ON CLICK State. And also a "Manager" Gameobjekt listening to the clicks. Is there an action available for the "Manager" to check which Button has send the click action?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Need a little help for UI Basics
« Reply #4 on: March 05, 2015, 08:30:37 AM »
Hi,

 there isn't a global manager for ngui events within PlayMaker, not that I am aware of.

 instead, forward manually the on click event to your manager from all the buttons you want, and then your manager can know the sender of that event. so it's possible, only that you have to have this proxy on each button.

 Bye,

Jean

suppenhuhn

  • Playmaker Newbie
  • *
  • Posts: 12
Re: Need a little help for UI Basics
« Reply #5 on: March 05, 2015, 09:34:18 AM »
Hi,

sounds good to me ->
Now i have a send event-action on my buttons . The Target is my manager, the event i'm sending is UGUI / ON CLICK ( or do i need another event? ).

Then i got a get-event-info action on my manager - but i can't get it to trace the sender's name ?!?

There is a "Sent By Game Object" part - but there is "none" selected and i can't change that value to store that name to a variable or so..

Any ideas?


« Last Edit: March 05, 2015, 10:10:19 AM by suppenhuhn »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Need a little help for UI Basics
« Reply #6 on: March 06, 2015, 03:37:21 AM »
Hi,

 in the fsm on each buttons that receives the UGUI / ON CLICK you forward it by using the action "Send Event", that action will fill automatically the "sent By GameObject", and so this is a read only variable, setup by PlayMaker. so you can get it in the "Get Event info".

 to actually SET event data, use "Set Event data",  but in your case you don't need to, this sill be populated automatically as you want the sender, not custom data.



 Bye,

 Jean

suppenhuhn

  • Playmaker Newbie
  • *
  • Posts: 12
Re: Need a little help for UI Basics
« Reply #7 on: March 06, 2015, 07:38:45 AM »
Yeah that's right ->

I've got the Start-State with the "Get Event Info" Action on my Manager. But which action should be next in this State? How do i read this "sent By GameObject" to check what action will be fired? In example:

If: Button_A was clicked fire "Btn_A_clicked"-action.
If: Button_B was clicked fire "Btn_B_clicked"-action.
..etc..

So i don't know how to fire actions on my manager depending on which button was clicked.

Do you know what i mean?
« Last Edit: March 06, 2015, 07:47:46 AM by suppenhuhn »