playMaker

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

Sjones

  • Full Member
  • ***
  • Posts: 203
Re: NGUI Integration (WIP)
« Reply #90 on: March 08, 2013, 10:16:14 PM »
have it set to always off?

and then when it is on, set it to on?

for example, I am guessing your weapon fire is controlled by FSM? so in its idle state (not firing) have a event called OnHover

when its in its firing state also have another event called OnHover.

and then send these events to an action that flips a bool to determine if the mouse is hovering over UI

from this bool flip have a bool test to see if you was previously in an idle state or firing state.

set the firing state bool at the beginning of the idle or firing actions

Red

  • Hero Member
  • *****
  • Posts: 563
Re: NGUI Integration (WIP)
« Reply #91 on: March 09, 2013, 01:39:37 PM »
Tried that. On the surface it does look like it is working but put that on a smaller button where the mouse could go over it faster than the FSM can calculate the action and it'll reverse the value of the boolean that's being used to store the "hovering" state.

If you're developing for mobile, chances are this will fit the bill since you have a set framework and a smaller range of CPU power/latency... but for a PC deployed action game with a deployment across a very broad range of CPU power, i cannot afford to have that level of unpredictability since that bug (and it is a bug) could ruin the gameplay for some of my players and it'd be more noticeable on lower-end computers. so, if the toggle gets flipped and doesn't flip back properly, their entire weapon systems will be disabled with this method and that would lead to an infuriatingly-negative customer experience.

Found more ways it could break too... Since it's using a flip instead of a manual set, if this is using buttons within a screen that has this feature (so, say a screen is open with a character sheet and it also has a selection of buttons... the bool is already supposed to be "disable weapons" but when it rolls over another button in this character screen it could toggle it as well. I do understand you can change these things but from a design perspective, it's not a very good workaround since my menu screens are designed in such a way as to give the player the option to do some menu actions on the fly and some while paused. setting up a system to detect and disable/enable as needed is a potential workaround but that is a lot more work to try and get around not being able to view and use a simple boolean value.

Simple boolean value? no workaround, you just use it.

complex and convoluted workaround? too many options where bugs can occour and it's an awful lot of wiring just to get around not being able to access a simple value.

So, i guess i'd like to put in a request for either an action set or an adjustment to the first script (or both?) so as to be able to find and read these values. Also, being able to access these values more directly will allow more options for useability and less headached with workarounds.
« Last Edit: March 09, 2013, 01:50:33 PM by Red »

Red

  • Hero Member
  • *****
  • Posts: 563
Re: NGUI Integration (WIP)
« Reply #92 on: March 10, 2013, 01:22:29 PM »
You know, thinking back on it, i feel i owe you an apology, Sjones.

Looking back on it, the system you recommended does work (albeit it has potential for issues which places it on my "maybe use but refine if future updates to system allow more direct control" list) and i feel calling it an outright bug was uncalled for and a bit extreme.

That doesn't mean i'm not hoping for a refining of the NGui integration so as to give the users direct access to the states themselves as a boolean value, but in the end i feel that my words were harsher than i initially intended them to be. Please accept my apology as you did not deserve such harshness.

Sjones

  • Full Member
  • ***
  • Posts: 203
Re: NGUI Integration (WIP)
« Reply #93 on: March 10, 2013, 07:09:23 PM »
dont worry, I understand where you are coming from, I have similar issues with unity, things that should be easy are not and things that should work dont work the way you expect and have to find fixes.

unfortunately there is nothing else I can suggest apart from going through the ngui code to find out what their bool code is exactly.

Mayhem

  • Full Member
  • ***
  • Posts: 171
Re: NGUI Integration (WIP)
« Reply #94 on: March 16, 2013, 07:18:04 PM »
Is there a way to access certain Classmethods which aren't components on an object like the NGUITool functions?

Being specific i want to access the NGUITool.AddChild-function, because ArenMook (developer of NGUI) always persists to use this function in order to instantiate Widget-Prefabs and not the Unity-Instantiate-Method.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NGUI Integration (WIP)
« Reply #95 on: March 30, 2013, 03:02:16 PM »
Hi,

 For this, specificy custom actions will be necessary. I am about to seriously get into porting nGui, so I will port this nGuitool set as well, it holds some very cool functions and helpers.

Bye,

 Jean

Andys

  • Playmaker Newbie
  • *
  • Posts: 30
Re: NGUI Integration (WIP)
« Reply #96 on: April 01, 2013, 07:54:00 AM »
Just started using Ngui for creating my HUD with health bars, this works great with playmaker Set Properties and Ngui progress bars, but they update every frame and you can see the jump from say 51 to 52 to 53 etc.

Is there a way to smooth this out with Itween? ive tried a couple way but can get it to smooth out.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NGUI Integration (WIP)
« Reply #97 on: April 03, 2013, 02:01:08 AM »
Hi,

yes, but don't use tweening. Tween engine are not good when the target is changing values.

You need to add one layer of indirection. Store your health in a fsm float ( instead of int), us it as a target, and play catch up with the current health variable ( the one you inject on your hud), and use an action such as "float lerp"

http://hutonggames.com/playmakerforum/index.php?topic=2905.msg13336#msg13336

bye,

 Jean

Andys

  • Playmaker Newbie
  • *
  • Posts: 30
Re: NGUI Integration (WIP)
« Reply #98 on: April 04, 2013, 11:54:50 AM »
This is my current setup for player health updating NGUI, how to i use the float lerp with this?

lolonoa

  • Playmaker Newbie
  • *
  • Posts: 18
Re: NGUI Integration (WIP)
« Reply #99 on: April 04, 2013, 12:32:30 PM »
Thank you so much, I have been stucked here for a couples of days unitill I find this, I don't know what to say, love you :-* :-* :-* :-* :-*

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NGUI Integration (WIP)
« Reply #100 on: April 09, 2013, 03:18:19 AM »
Hi,

 ok, here is a ngui health bar with smoothing, simply adjust the health property in the fsm inspector and you'll see the ngui slider move smoothly to catch up with the health value.

Enjoy :)

 Jean

Petar Ivanček

  • Playmaker Newbie
  • *
  • Posts: 1
Re: NGUI Integration (WIP)
« Reply #101 on: April 12, 2013, 10:35:56 AM »
Hi there!

I was wondering what would be the process of getting the OnSubmit event from an nGUI Input Field.
When the user types in the string, pressing ENTER by default sends and event called OnSubmit.
The component you provided didn't have the OnSubmit field, so I tried adding it myself.

I've added another field in the main class setup:
Code: [Select]
public string OnSubmitEvent = "OnSubmit";
and then added another function:

Code: [Select]
void OnSubmit(string show)
{
if (!enabled || targetFSM == null) return;
Fsm.EventData.StringData = show;
targetFSM.SendEvent(OnSubmitEvent);
}

and this seems to fire the event in the FSM.

So, being nowhere near a programmer, I want to know if what I did is ok.

Thanks,
Petar.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NGUI Integration (WIP)
« Reply #102 on: April 15, 2013, 02:08:37 AM »
Hi,

 perfect! you acquired the most important skill for programming: clever copy/paste! I am not joking, I think I simply never actually start anything from scratch, it's always been done before somehow, so copy pasting code is very important, and when done right, you get new features :)

bye,

 Jean

jeanfabre

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

 Started a wiki page that will feature all the Ngui work to work with it from PlayMaker.

 The first script is an extension of this UI event forwarder that features the ability to receiver slider change callback.

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

bye,

 Jean

JennaReanne

  • Junior Playmaker
  • **
  • Posts: 57
    • Little Worlds Interactive
Re: NGUI Integration (WIP)
« Reply #104 on: May 20, 2013, 04:00:13 PM »
Hello!  I've been using UIEventsToPlaymakerFSM, generally to great success.  However, I can't seem to get the "On Drop" action to fire.  I opened up the script and it doesn't look like an OnDrop function is referenced at all.. however I am not a programmer so I would be grateful if someone with more coding knowledge could take a look at this for me?

Thank you!