playMaker

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

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NGUI Integration (WIP)
« Reply #105 on: May 21, 2013, 01:24:36 AM »
Hi,

 Good catch :) sorry about that, It's now implemented correctly, you can redownload here;

https://hutonggames.fogbugz.com/default.asp?W1111

Bye,

 Jean

JennaReanne

  • Junior Playmaker
  • **
  • Posts: 57
    • Little Worlds Interactive
Re: NGUI Integration (WIP)
« Reply #106 on: May 21, 2013, 10:07:17 AM »
Hi Jean,
I am still unable to get the "drop" action to work (though the new debugging messages are hugely helpful!)  Unless I'm missing something?  Should the action fire when I drop it anywhere, or does it need to be dropped over something specific?

Thanks for helping me figure this out,
Jenna

EDIT: Ok, just realized that the "UIDrag Object" script that I'm using doesn't have the OnDrop function within it, which would explain why it's not firing!  I'm going to dig into this a bit and see if I can figure out the best way to do this.
« Last Edit: May 21, 2013, 10:11:52 AM by JennaReanne »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NGUI Integration (WIP)
« Reply #107 on: May 22, 2013, 12:51:57 AM »
Hi,

 Yes, I tested and it work. You need to explicitly define the "event receiver" in the nGui component that will fire the drop event, in most case the gameObject itself.

bye,

 Jean

cmvrgr

  • Junior Playmaker
  • **
  • Posts: 64
Re: NGUI Integration (WIP)
« Reply #108 on: May 28, 2013, 04:43:37 PM »
Hi.

Do you know where  I can find a demo on how I can use "ui popup list" of ngui ?

Thanks !

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NGUI Integration (WIP)
« Reply #109 on: May 29, 2013, 02:10:01 AM »
Hi,

 You can find a demo in nGui package itself, it's in "NGUI/examples/Scenes/TUtorial 11"

 and for that matter, I have updated the playmaker port so that you can get the OnSelectionChange Event.

Simply download the new version or  NGuiEventsToPlaymakerFsmEvents.cs on the wiki:

https://hutonggames.fogbugz.com/default.asp?W1111


drag that on the gameObject "SlicedSprite - Rectangle" ( because the pop uplist has set it's receiver to that object), then add a Fsm on "SlicedSprite - Rectangle" too, with an event "NGUI / ON SELECTION CHANGE", and you will be getting the selection ( in the event data as a string.

Bye,

 Jean

cmvrgr

  • Junior Playmaker
  • **
  • Posts: 64
Re: NGUI Integration (WIP)
« Reply #110 on: May 29, 2013, 06:03:36 PM »
My brain has been frozen !  :D Can you upload a demo scene ?

I would like to thank you in advance

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NGUI Integration (WIP)
« Reply #111 on: May 30, 2013, 06:54:13 AM »
Hi,

 ok, I have done quite a bit of rework on the NGUI bridge, I have attached a complete Package.

 In there, you will find a "examples" folder, and the scene "Tutorial 11 PlayMaker", it's the popup list examples, with playmaker bridges setup.

Can you tell me if you find it easier like that?

-- ALL ngui playmaker events are now globals and hosted in "NGUI PlayMaker Proxy" prefab, so put that in your scene and you will not have to manually create these events

-- the event bridge between NGUI and PlayMaker has now a very advanced Custom Inspector
  -- if there is no fsm, it will let you create one with a button
  -- if it finds a fsm on that gameObject or if you target a specific fsm, it will then look up if ngui events are implemented or not.
   -- during the playback it will also give you stats on usage for each of these ngui events, so that you can quickly know what's going on.

Also, study carefully the different Fsm, especiall the one attached to the gameObject "Popup List" and the one attached to the gameObject "SlicedSprite - Rectangle", it's very important that you grasp the way NGUI works with these events, in our case, Popup list targets "slicedSprite -Rectangle" so you can only received "NGUI / ON SELECTION CHANGE" on that gameObject, so the "NGuiEventsToPlaymakerFsmEvents" MUST BE on that GameObject. You can however redirect to any Fsm of course.

I am thinking of working on another aspect of this bridge, cause I still don't like the fact that it's within NGUI that you set up the link, I would like to find a way so that within the "NGuiEventsToPlaymakerFsmEvents", you define what NGUI component to listen too, that will lift another possible area of misunderstanding and frustration if it's not properly understood.

I need to do some more clean up, and I will release this on the wiki.

bye

 Jean

ghostmachine

  • Playmaker Newbie
  • *
  • Posts: 8
Re: NGUI Integration (WIP)
« Reply #112 on: May 30, 2013, 09:10:39 PM »
Jean,

  I hope you find a way I like your thinking and I believe your way will reduce unwanted use of resources. :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NGUI Integration (WIP)
« Reply #113 on: May 31, 2013, 01:58:27 AM »
Hi,

Thanks :)

 It's not so much resources, but more workflow related here, linking from ngui to playmaker or the opposite is the same under the hood, it's just less obvious for beginners, and generally less convenient.

bye,

 Jean

cmvrgr

  • Junior Playmaker
  • **
  • Posts: 64
Re: NGUI Integration (WIP)
« Reply #114 on: June 02, 2013, 06:12:07 PM »
Is it possible to find a video tutorial of popup list ?

Its a bit hard to understand how you do it

Best Regards

LiveWire

  • Playmaker Newbie
  • *
  • Posts: 7
Re: NGUI Integration (WIP)
« Reply #115 on: June 11, 2013, 02:27:44 AM »
Yes, I tested and it work. You need to explicitly define the "event receiver" in the nGui component that will fire the drop event, in most case the gameObject itself.

Hi, I'm trying to get an a simple Drag&Drop action happening with my UI, but I can't get the OnDrop event to fire.

What I am trying to achieve: click and drag an icon from the UI onto an object in 3D space in the scene, and fire an event on that object.

I have a UIDragObject script on the object I wish to drag, and a Playmaker FSM on the object I wish to drop it on. This FSM contains only two states, with an OnDrop event that, as I understand it, should trigger once and OnDrop event is fired while the mouse is over it.

Both objects have the NGui Events to Playmaker Fsm Events script with the Target FSM variable set to their respective FSMs.

The Drag works exactly as expected, however when I perform the drop nothing happens.

The Debug log shows OnDrag updating position while dragging and OnPress returning to False when the mouse is released, but I am not seeing any OnDrop debug lines.

What am I missing? I Do not quite understand the post quoted above either. Which is the component that will fire the event? The Object I originally clicked on or the Object  I'm dropping on to? Furthermore where is the "event receiver" and which of the two objects am I setting it to?

Sorry if this post is a little long, I am rather confused :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NGUI Integration (WIP)
« Reply #116 on: June 11, 2013, 05:37:18 AM »
Hi,

 It's actually very straightforward.

1: open the ngui example11 scene
2: select the gameObject 3D/Stage/DragDropSurface
3: add the component "NGuiEventsToPlaymakerFsmEvents" to it
4: add a Fsm component to DragDropSurface as well
5: in the fsm, add a state with a global transition "NGUI / ON DROP" ( all ngui events are available in the transition menu under "global events"
6: double check that in the NGuiEventsToPlaymakerFsmEvents, the Drop entry turned green, this means, we have detected that you are actually implement the "NGUI / ON DROP" event.
7: run the scene, drop something onto the cube, and the fsm will receive the drop event.

Now, if you ae building a scene from scratch, it could simply be that you don't set up ngui properly to being with.
-- also, you may think that the gameobject you have adde the component NGuiEventsToPlaymakerFsmEvents received drop events, but actually doesn't, that's something you will need to verify outside playmaker environment, like dropping a simply script that listen to drop events ( very much like "DragDropSurface" script provided in the example 11 scene.

hope this helps, else get back to me, I'll have a look at your project.

bye,

 Jean

Satrio

  • Junior Playmaker
  • **
  • Posts: 67
Re: NGUI Integration (WIP)
« Reply #117 on: June 11, 2013, 03:17:42 PM »
Ok.. I am trying to fix the project after accidentally deleting the global vars file... tedious. Now I am trying the new Ngui-playmaker stuff and I must say I would rather prefer the old method where you could write your own "event name".
My problem is I have two buttons, Ok and Cancel. With the new way of doing it, I only get "onClick" event fired. So both buttons fire the same event. not cool if I need one button to fire a cancel event...

I wonder if the old way is still available.. I donĀ“t know the name of the script..
/s

Satrio

  • Junior Playmaker
  • **
  • Posts: 67
Re: NGUI Integration (WIP)
« Reply #118 on: June 11, 2013, 03:52:39 PM »
From the wiki:
"Put this component on the GameObject with the Collider used by NGUI. Choose an FSM to send events to (leave blank to target an FSM on the same GameObject). You can rename the events to match descriptive event names in your FSM. E.g., "OK Button Pressed" NOTE: Use the Get Event Info action in PlayMaker to get event arguments. See also: http://www.tasharen.com/?page_id=160"

How do I rename the events? In the old UItoPlaymaker I got a list of events that I could rename, now I only got this:

Maybe there is an installation problem?

Getting frustrated here.. all my work just falls apart, because of new versions of NGUI and PM destroyed my game.. stuff just stopped working that worked perfectly before. Probably operator malfunction...:(

bizilux

  • Full Member
  • ***
  • Posts: 171
Re: NGUI Integration (WIP)
« Reply #119 on: June 11, 2013, 04:41:03 PM »
can we get MOUSE EXIT function?


nevermind, i got it working with on hover, and then adding second on hover to hide it
« Last Edit: June 11, 2013, 05:11:45 PM by bizilux »