playMaker

Author Topic: EZ GUI and Playmaker  (Read 5840 times)

henk

  • Playmaker Newbie
  • *
  • Posts: 24
    • Dawson 3D
EZ GUI and Playmaker
« on: July 13, 2011, 11:58:30 PM »
I'm trying to get EZ GUI and Playmaker to work together. Here's a video that explains what I'm trying to do. Any help would be greatly appreciated.

http://gallery.me.com/henkdawson#100735

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: EZ GUI and Playmaker
« Reply #1 on: July 14, 2011, 12:32:21 PM »
This is the one that i wrote for getting slider values... works for me.. i have a few EZ GUI Actions that are all based on what Jean wrote and submitted in the Actions Share section.. I have managed to get pretty much anything from EZ GUI now..

Thanks again Jean!

Let me know if this works for you. I just did this up when i saw your post. I was going to need one in the future but had not gotten to it yet. I think i got it all correct... just did a quick test and it seemed to work ok.

Q
Code: [Select]
using UnityEngine;
using HutongGames.PlayMaker;

/// <summary>
/// PlayMaker Action for Delegating when a UISlider
/// has been invoked.
/// </summary>
/// <para>
/// This Action should be placed in the Start action of your
/// FSM. It will add itself as a delegate to the EZGui Slider
/// to capture events that have been triggered by the
/// button.
/// </para>
/// <remarks>The Owner must contain a UISlider class</remarks>
/// <remarks>See the EZGui Documentation for More information on this Delegate</remarks>
///
///
[ActionCategory("EzGui")]
[Tooltip("EzGui Slider Get Value")]

public class UISliderValueDelegate : FsmStateAction {

[CheckForComponent(typeof(UISlider))]
public FsmOwnerDefault gameObject;

public FsmFloat sliderValue;

private GameObject go;
private UISlider _object;


public override void Reset() {

gameObject = null;
sliderValue = 0;

}

public override void OnEnter() {

// get the UISlider attached to this object

go = gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value;
_object = go.GetComponentInChildren<UISlider>();

// set the delegate to capture change event
_object.AddValueChangedDelegate(MyDelegate);
Finish();
}

public override string ErrorCheck() {

// TODO: Missing UISlider Object

return "";
}


void MyDelegate(IUIObject obj) {

sliderValue.Value = _object.Value;
}

}

henk

  • Playmaker Newbie
  • *
  • Posts: 24
    • Dawson 3D
Re: EZ GUI and Playmaker
« Reply #2 on: July 14, 2011, 12:57:24 PM »
It worked!

Thanks a bunch!

Cheers,
Henk


qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: EZ GUI and Playmaker
« Reply #3 on: July 14, 2011, 02:26:33 PM »
Cool!

NP

Q

tobbeo

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 186
Re: EZ GUI and Playmaker
« Reply #4 on: July 14, 2011, 07:40:41 PM »
Thank you! :)