playMaker

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

Sjones

  • Full Member
  • ***
  • Posts: 203
Re: NGUI Integration (WIP)
« Reply #60 on: October 26, 2012, 01:16:36 AM »
I am not sure if this will help anyone but the play direction is controlled as part of the animation clip, along with name etc, the code they are using

Code: [Select]
int pd = -(int)playDirection;
Direction dir = forward ? playDirection : ((Direction)pd);
ActiveAnimation anim = ActiveAnimation.Play(target, clipName, dir, ifDisabledOnPlay, disableWhenFinished);
if (resetOnPlay) anim.Reset();

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NGUI Integration (WIP)
« Reply #61 on: October 26, 2012, 03:07:26 AM »

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: NGUI Integration (WIP)
« Reply #62 on: November 28, 2012, 08:59:53 PM »
I have a project where the user interacts with a large list of buttons.  I am using the UIEventsToPlaymaker script to send an event from each button to my FSM.

My list is several hundred entries long, so I can't give each button a unique event to send. How can I acquire the identity of the button that last sent an event? Ideally I want to click any button in the list, and know which button it was.

Thanks in advance!


amaranth

  • Full Member
  • ***
  • Posts: 172
Re: NGUI Integration (WIP)
« Reply #63 on: November 28, 2012, 09:34:23 PM »
I had a similar problem. Maybe you could try this workflow:

1) player clicks button
2) button sends event to FSM
3) In FSM, use Get Event Info to grab the Game Object, which is the button.
4) Grab a property of the Game Object that identifies it & use this to identify your button.

This is what I did:
1) attached ButtonID script with an empty ID to button Game Object template
2) When game starts, used a FSM to generate 100 buttons + set the value of the ID field in the ButtonID script.
3) When player clicks button & the event goes to the FSM, I use Get Event Info to get the button game object. Then I use Get Component to get the ButtonID script, then use Get Property to get the ID in the ButtonID script.

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: NGUI Integration (WIP)
« Reply #64 on: November 29, 2012, 06:00:32 PM »
*bumpity*

So, I've tried multiple things here:
ScreenPick
MousePick
MousePickEvent
GetEventInfo

So far none of them have worked.  The *Pick actions never seem to be able to grab the NGUI elements, even when they're masked out to only the NGUI layer, and the main camera is set up to do the same (excluding everything else).

GetEventInfo had some promise, but when I set a "Sent By Game Object" to a variable to catch the Button sending the event, it instead returns the GameObject that the FSM is on. 

So I had to turn a project prototype in this morning that was hacky, hacky, hacky.  Just terrible.  It was only acceptable because it was just a prototype, but I *need* to find a proper solution to this.  It shouldn't be that difficult, so I would greatly appreciate some assistance from someone who might know how the NGUI/Playmaker interface script works, or something else I might have missed.

Thanks in advance.


artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: NGUI Integration (WIP)
« Reply #65 on: December 03, 2012, 08:33:56 AM »
Could I get some help with this?  Should I move it to the "Help" forum?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NGUI Integration (WIP)
« Reply #66 on: December 11, 2012, 05:26:57 PM »
Hi,

 Could you make a small project to hilite your struggle, I'll have a look at it then,

bye,

 Jean

cmvrgr

  • Junior Playmaker
  • **
  • Posts: 64
Re: NGUI Integration (WIP)
« Reply #67 on: January 05, 2013, 04:44:06 PM »
Any example on how playmaker works with NGUI popup menu ?

tofusoup

  • Playmaker Newbie
  • *
  • Posts: 30
Re: NGUI Integration (WIP) [Solved]
« Reply #68 on: January 22, 2013, 08:17:10 PM »
So I've been following the this thread, and recently bought ngui.  I think I get most of it.  I tried to setup a simple button to test, but when I try to Get Property > onPressEvent, it only gives me the option to store it as a string.

Is that correct?  When I look at the NGUI events, it says onPressEvent is a bool.

I'm a little confused.  I've attached an image.  What am I suppose to do with the string?


[updated]

Ok I guess I also needed cornflakes.  I read the post made by Alex a few more times and it finally sunk in.  On my FSM, I needed an event "OnClick".  I was way over thinking as usual.  Instead it's very simple.

Some reason I kept thinking I had to use GetProperty to check on the "onClick" and then store it in a bool.

« Last Edit: January 23, 2013, 01:09:28 PM by tofusoup »

Sjones

  • Full Member
  • ***
  • Posts: 203
Re: NGUI Integration (WIP)
« Reply #69 on: February 01, 2013, 12:59:59 AM »
I know I have asked a lot of the community and have had lots of help with everything :p however I have another small request.

with the UIEventsToPlaymakerFSM script, is there any chance of getting a slight extension to the onclick, could we have the option to set a int variable in the targeted FSM to a number.

I know this is kinda specific, however I hope to use this to keep the FSM's clean, I have a lot of buttons and for each button it sets a int value to be used elsewhere, it seems a bit excessive having 50+ events and corresponding state just to set an int value.

digimbyte

  • Junior Playmaker
  • **
  • Posts: 52
Re: NGUI Integration (WIP)
« Reply #70 on: February 12, 2013, 09:27:34 PM »
So I'm using NGUI for my menu's and i've hit an issue
I use Get/Set from playmaker to Set the Panel i want to Active = False
the idea is this should disable the panel and it would be inactive until its needed

problem is, even though its inactive, i can still click on it, sound effect plays and it works still

anyway to fix this or am i disabling panels wrong?

digimbyte

  • Junior Playmaker
  • **
  • Posts: 52
Re: NGUI Integration (WIP)
« Reply #71 on: February 13, 2013, 01:51:44 PM »
How to disable NGUI Panels in Playmaker explained;
the Get/Set can disable things perfectly fine but its not a recursive (what ever that is)
I looked into it more and PlayMaker has a recursive disable/active script that can auto reverse on state exit
"Activate Game Object"

will_brett

  • Junior Playmaker
  • **
  • Posts: 72
Re: NGUI Integration (WIP)
« Reply #72 on: February 13, 2013, 04:50:50 PM »
I know this is quite an old thread now... but I've been trying to figure out how to use the "input" asset on NGUI.

What I want to do is:

1. Have an input asset that let's user type name and then save as a string so that I can use it in other FSM's

2. Much the same as above but for a chat room, I'm not sure if this is the same as above which is why I have         asked it separately.

Thank you

will_brett

  • Junior Playmaker
  • **
  • Posts: 72
Re: NGUI Integration (WIP)
« Reply #73 on: February 13, 2013, 08:03:30 PM »
Solved issue number 1 (See image). I dont know if this is a good method but it works perfectly fine. Let me know if this is not a good method. I am using photon in this project.


Mayhem

  • Full Member
  • ***
  • Posts: 171
Re: NGUI Integration (WIP)
« Reply #74 on: March 06, 2013, 10:56:40 AM »
Is there a way to create NGUI Items and make them Children of the UI-Root-Object via FSM?