Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: spiralKing on September 17, 2014, 09:52:22 PM

Title: UIHints [SOLVED]
Post by: spiralKing on September 17, 2014, 09:52:22 PM
It's not so much an action I need to share but more a question I need to ask

I took a look at the playMaker documentation for creating custom actions, specifically the "Action Attributes" section
https://hutonggames.fogbugz.com/default.asp?W352

My question is, can I get some examples of situations where each UIHint is used?
I understand how to use the "Variable" Hint (they're many actions in playMaker that use it)
C# Example:
Code: [Select]
[UIHint(UIHint.Variable)]
public FsmFloat health;
but I'm not understanding the other Hints, the "Description" Hint in particular, how do I use it?
Can I get an example in code?

I would have posted in "Playmaker Help", but they never answer my custom action questions there
Title: Re: UIHints
Post by: Alex Chouls on September 17, 2014, 10:59:37 PM
The UIHints are described here:
https://hutonggames.fogbugz.com/default.asp?W352

The best way to find code examples would be to search for the UIHint in the action source files (Find in Files...)
Title: Re: UIHints
Post by: Lane on September 18, 2014, 08:49:19 AM
Here is a script using them, hopefully it answers your questions.

.cs file and result image attached, code below.

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.

using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Input)]
[Tooltip("UI Hint Examples.")]
public class UIHintExamples : FsmStateAction
{
[RequiredField] // this is a required field, you have to put something in it.
[CheckForComponent(typeof(Rigidbody))] // tells the ui to look for a type of component, like a Rigidbody.
[Tooltip("The GameObject you want.")] // basic tooltip for hover descriptions.
public FsmOwnerDefault gameObject; // FsmOwnerDefault uses the owner GameObject as the variable.

[ActionSection("  UI Hints")]

[UIHint(UIHint.Layer)] // Use on an integer field for a Layer popup button.
public FsmInt layerSingle; // Not an array, single choice.

[UIHint(UIHint.Layer)]
public FsmInt[] layerMulti; // As an array, this allows for multiple layer choices.

[ActionSection("Behavior")]

[UIHint(UIHint.Behaviour)]
[Tooltip("The name of the Behaviour.")] // See Enable Behavior
public FsmString behaviour;

[ActionSection("Coroutine")]

[UIHint(UIHint.Coroutine)]
[Tooltip("The name of the coroutine method.")] // See StartCoroutine
public FunctionCall functionCall;

[ActionSection("Script")]

[UIHint(UIHint.Script)]
[Tooltip("The name of the script.")] // See AddScript
public FsmString someString;

[ActionSection("Tags")]

[UIHint(UIHint.Tag)]
public FsmString someTagSingle; // See SetTag

[UIHint(UIHint.Tag)]
public FsmString[] someTagMultiple;

[ActionSection("Text Area")]

[UIHint(UIHint.TextArea)]
public FsmString textArea;

[ActionSection("Description Area")]

[UIHint(UIHint.Description)] // Use on a string field to format the text in a large readonly info box.
public string descriptionArea;

[ActionSection("Comment Area")]

[UIHint(UIHint.Comment)]
public FsmString commentArea;

[ActionSection("Basic Variables")]

[UIHint(UIHint.Variable)] // Use on an Fsm Variable field (FsmFloat, FsmInt, FsmBool...)
public FsmFloat numbers;

[UIHint(UIHint.Variable)]
public FsmBool boolean;

[ActionSection("Animation Hint")]

[UIHint(UIHint.Animation)]
public FsmString animation;

public override void Reset() // the Reset area defines the default values for your action variables.
{
gameObject = null;
someTagSingle = null;
someTagMultiple = new FsmString[2];
textArea = "Regular text area";
commentArea = "Stuff, comment stuff.";
descriptionArea = "lorum ipsum bippity bop doo dah lorum ipsum bippity bop doo dah lorum ipsum bippity bop doo dah lorum ipsum bippity bop doo dah lorum ipsum bippity bop doo dah lorum ipsum bippity bop doo dah";
layerSingle = null;
layerMulti = new FsmInt[3];
numbers = 14.3f;
boolean = true;
animation = null;

}

public override void Awake()
{

}

public override void OnEnter()
{

}

public override void OnFixedUpdate()
{

}

void DoLook()
{

}
}
}
Title: Re: UIHints
Post by: spiralKing on September 19, 2014, 12:26:02 PM
Lane, awesome thanks, this does answer my question

and Alex, it's like you just skimmed through my question and didn't really read it
Title: Re: UIHints [SOLVED]
Post by: Alex Chouls on September 19, 2014, 08:19:17 PM
Sorry - must admit I did skim it (probably on my phone), just saw that you found the link to the docs... Lane did a much better job! :)
Title: Re: UIHints [SOLVED]
Post by: spiralKing on September 19, 2014, 08:44:01 PM
Alex

I accept your apology :)