playMaker

Author Topic: NGUI Integration (WIP) [NGUI 3.5.9 supported]  (Read 148252 times)

kyy921

  • Junior Playmaker
  • **
  • Posts: 50
    • 上海杉蔓数字科技
Re: NGUI Integration (WIP)
« Reply #15 on: April 28, 2012, 12:49:26 AM »
I wanna set postion of an Ngui's panel allow an object's postion

but ngui's camera and the main camera is different camera,
could some action to easy make Ui element and object can be well fit?

like the pic I show

Denominator90

  • Playmaker Newbie
  • *
  • Posts: 1
Re: NGUI Integration (WIP)
« Reply #16 on: May 04, 2012, 02:56:17 AM »
Thank you so much for this thread!

Lars Steenhoff

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 46
Re: NGUI Integration (WIP)
« Reply #17 on: May 09, 2012, 06:03:32 PM »
Could you show an example of set property on ngui label for highscore?

I'm a bit lost how to set it.

normally I use "set GUI text", would love an action for "set NGUI text"
Thanks

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: NGUI Integration (WIP)
« Reply #18 on: May 09, 2012, 10:25:12 PM »
Here's a screenshot.

You need to drag the UILabel component into the Target Object slot, then select the "text" property.

TIP: Lock the Playmaker selection when dragging components from other GameObjects. Here the FSM is on the UI Root (2D) object, but targets the UILabel component on a child.

BTW, this will be even easier in 1.4 - you can just drag a component onto the State panel to make a Get or Set Property action that targets that component. Or drag it onto the Variables panel to make a variable containing the component!  ;D



 
« Last Edit: May 09, 2012, 10:28:11 PM by Alex Chouls »

Lars Steenhoff

  • Beta Group
  • Playmaker Newbie
  • *
  • Posts: 46
Re: NGUI Integration (WIP)
« Reply #19 on: May 12, 2012, 06:56:45 PM »
Thanks , setting the lock button helped me solve the mystery.
Initially I was looking for a text property on the game object, but then found the way to set the script property.

QuasarTD

  • Playmaker Newbie
  • *
  • Posts: 2
Re: NGUI Integration (WIP)
« Reply #20 on: May 18, 2012, 09:17:56 AM »
i'm having a bit of trouble working out how to get this to work. (i'm new to playmaker and have come over from uSCript) I will give a very simple example or what i'm trying to do.

I have a simple NGUI image button on the screen and would like to trigger an FSM attached to the button itself when it is clicked.
So far I have attached the provided script from the OP to the button and have created an FSM on the button. This is the part I can't figure out. In the instruction in the OP it says to use a Get Event Info action in the FSM which I have done but I don't know what to set in the Get Event Info action. I tried creating a GameObject variable with the button in it but you can't add the NGUI buttons as a GameObject. I tried adding it as an Object of type UIImageButton but you can't do that either. I know it's probably something simple I'm just not doing right. If someone could point me in the right direction that would be great. Thanks.

Also is there a tutorial on writing your own actions and does uScript and playmaker play nice together?

Thanks

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: NGUI Integration (WIP)
« Reply #21 on: May 18, 2012, 02:04:16 PM »
1. Add the UIEventsToPlayMakerFSM script to the NGUI Button.
2. Drag the PlayMakerFSM that you want to send events to into the Target FSM field.
3. Add the NGUI events you want to respond to in the FSM (E.g., OnClick etc.)
4. Respond to the events :)

I've attached a screenshot that shows the final setup.

You only need to use Get Event Info if you need more information about the event.

Some docs on writing actions: https://hutonggames.fogbugz.com/default.asp?W166

You can also find a lot of tips on making custom actions on the forum, and Playmaker ships with the source code for hundreds of actions as examples.

I haven't spent a lot of time with uScript... In theory Playmaker and uScript should work quite well together :)



QuasarTD

  • Playmaker Newbie
  • *
  • Posts: 2
Re: NGUI Integration (WIP)
« Reply #22 on: May 19, 2012, 06:26:21 AM »
Thanks very much. That has helped me out a lot. Very usefull info.

kyy921

  • Junior Playmaker
  • **
  • Posts: 50
    • 上海杉蔓数字科技
Re: NGUI Integration (WIP)
« Reply #23 on: May 24, 2012, 02:35:41 PM »
it seen that using set property cannot change ngui's sprite color, is that some way to change it??

ByronNilsson

  • Playmaker Newbie
  • *
  • Posts: 18
Re: NGUI Integration (WIP)
« Reply #24 on: May 29, 2012, 12:40:32 PM »
How do i select the fsm off an object and paste it into UIevents to playmaker on my ngui button. I can only see one thing at once in the inspector?

Thanks Byron.

Sorted, had a dummy object in the scene to receive the event, as my characters are created at run-time.

Thanks.

« Last Edit: May 29, 2012, 12:55:21 PM by ByronNilsson »

gamedivision

  • Full Member
  • ***
  • Posts: 227
Re: NGUI Integration (WIP)
« Reply #25 on: June 01, 2012, 08:01:24 AM »
im sure people speak in riddles here haha,
im still struggling with this,creating a simple button,i added a playmaker fsm to the uiroot 2d and also a uievents to playmaker fsm
on the button ive added another fsm and dragged that fsm to the target fsm on the uiroot 2d then on the button fsm i created a OnClick event added that to my idle state then connected that to a clicked state now im not sure were to go from here
can anyone help or create a simple scene demonstrating the use of ngui and playmaker


thank you

Amy

  • Playmaker Newbie
  • *
  • Posts: 36
Re: NGUI Integration (WIP)
« Reply #26 on: June 01, 2012, 03:22:31 PM »
So I bought NGUI....I had the free version and now my work is all messed up caused I tried to translate.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: NGUI Integration (WIP)
« Reply #27 on: June 01, 2012, 06:09:08 PM »
... and also a uievents to playmaker fsm

The UIEventsToPlayMakerFSM script should go on the button (or the object with the Collider). All it does is forward NGUI Events to a PlayMakerFSM. But it has to go on the NGUI object generating the events. Otherwise it doesn't do anything!  :P

jerware

  • Playmaker Newbie
  • *
  • Posts: 23
Re: NGUI Integration (WIP)
« Reply #28 on: June 01, 2012, 06:18:22 PM »
I just want to say that finding this thread today was like finding a pot of gold. I'm just starting with Unity and have been learning both of these plug-ins. Now the power of them is combined. Thank you!

Amy

  • Playmaker Newbie
  • *
  • Posts: 36
Re: NGUI Integration (WIP)
« Reply #29 on: June 02, 2012, 02:02:42 AM »
So if I get this straight...you're saying just try to use both together there's no real set up?