/// <summary> /// Start a new event with interval of time. /// </summary> /// <param name="intervalTime"> Interval of time to execute each operation. </param> /// <param name="evt"> Operation to get execute. </param> public void StartEvent(float intervalTime, EmptyFunction evt) { this.mIntervalTime = intervalTime; this.mExecution = evt; this.mTimer = 0.0f; this.mActive = true; }
public static bool Button(string text, EmptyFunction func) { if (Button(text)) { func.Invoke(); return(true); } return(false); }
/// <summary> /// Tween to this vector either position, scale, rotation. /// </summary> /// <param name="to"> target vector 3 </param> /// <param name="resetElapsedTime"> reset elapsed time? (default : true) </param> /// <param name="typeX"> easing type for x axis. </param> /// <param name="typeY"> easing type for y axis. </param> /// <param name="typeZ"> easing type for z axis. </param> /// <param name="callback"> callback function pointer. </param> public void DoTween( Vector3 to, bool resetElapsedTime, JCS_TweenType typeX, JCS_TweenType typeY, JCS_TweenType typeZ, EmptyFunction callback = null) { DoTween(to, resetElapsedTime, mDurationX, mDurationY, mDurationZ, typeX, typeY, typeZ, callback); }
public static void BeginHorizontal(EmptyFunction func, bool flexibleSpace = false) { GUILayout.BeginHorizontal(); if (flexibleSpace) { GUILayout.FlexibleSpace(); } func.Invoke(); GUILayout.EndHorizontal(); }
/* Setter & Getters */ /* Functions */ public static void IgnoreErrors(EmptyFunction func) { try { func.Invoke(); } catch (Exception) { // .. } }
public static void CreateGroup(EmptyFunction func, bool flexibleSpace = false) { BeginHorizontal(() => { BeginVertical(() => { Indent(func); }); }, flexibleSpace); }
/* Functions */ private void Awake() { this.mSelections = JCS_Util.RemoveEmptySlot(mSelections); // let them know the grouper. foreach (JCS_ButtonSelection bs in mSelections) { bs.ButtonSelectionGroup = this; } selectionChanged = EmptyCallbackSelectionChanged; }
public static void BeginVertical(EmptyFunction func, string style = "box") { if (style == "") { GUILayout.BeginVertical(); } else { GUILayout.BeginVertical("box"); } func.Invoke(); GUILayout.EndVertical(); }
/// <summary> /// Tween to this vector either position, scale, rotation. /// </summary> /// <param name="to"> target vector 3 </param> /// <param name="resetElapsedTime"> reset elapsed time? (default : true) </param> /// <param name="durationX"> how fast it tween on x axis. </param> /// <param name="durationY"> how fast it tween on y axis. </param> /// <param name="durationZ"> how fast it tween on z axis. </param> /// <param name="typeX"> easing type for x axis. </param> /// <param name="typeY"> easing type for y axis. </param> /// <param name="typeZ"> easing type for z axis. </param> /// <param name="callback"> callback function pointer. </param> public void DoTween( Vector3 to, bool resetElapsedTime, float durationX, float durationY, float durationZ, JCS_TweenType typeX, JCS_TweenType typeY, JCS_TweenType typeZ, EmptyFunction callback = null) { Vector3 from = GetSelfTransformTypeVector3(); DoTween(from, to, resetElapsedTime, durationX, durationY, durationZ, typeX, typeY, typeZ, callback); }
/// <summary> /// Prepare for tweening. /// </summary> /// <param name="from"></param> /// <param name="to"></param> /// <param name="durationX"></param> /// <param name="durationY"></param> /// <param name="durationZ"></param> /// <param name="easingX"></param> /// <param name="easingY"></param> /// <param name="easingZ"></param> /// <param name="callback"></param> private void StartTween( Vector3 from, Vector3 to, bool resetElapsedTime = true, float durationX = 1f, float durationY = 1f, float durationZ = 1f, TweenDelegate easingX = null, TweenDelegate easingY = null, TweenDelegate easingZ = null, EmptyFunction callback = null) { mDestinationCallback = callback; this.mIsDoneTweening = false; this.mDoneTweenX = false; this.mDoneTweenY = false; this.mDoneTweenZ = false; this.mContinueTween = false; // Sets The Position From -> To mTweenerX.easeFromTo( from.x, to.x + mValueOffset.x, // add offset to final value. resetElapsedTime, durationX, easingX, DoneTweeningX); // Sets The Position From -> To mTweenerY.easeFromTo( from.y, to.y + mValueOffset.y, // add offset to final value. resetElapsedTime, durationY, easingY, DoneTweeningY); // Sets The Position From -> To mTweenerZ.easeFromTo( from.z, to.z + mValueOffset.z, // add offset to final value. resetElapsedTime, durationZ, easingZ, DoneTweeningZ); }
/// <summary> /// Tween to this vector either position, scale, rotation. /// </summary> /// <param name="from"> starting vector 3 </param> /// <param name="to"> target vector 3 </param> /// <param name="resetElapsedTime"> reset elapsed time? (default : true) </param> /// <param name="durationX"> how fast it tween on x axis. </param> /// <param name="durationY"> how fast it tween on y axis. </param> /// <param name="durationZ"> how fast it tween on z axis. </param> /// <param name="typeX"> easing type for x axis. </param> /// <param name="typeY"> easing type for y axis. </param> /// <param name="typeZ"> easing type for z axis. </param> /// <param name="callback"> callback function pointer. </param> public void DoTween( Vector3 from, Vector3 to, bool resetElapsedTime, float durationX, float durationY, float durationZ, JCS_TweenType typeX, JCS_TweenType typeY, JCS_TweenType typeZ, EmptyFunction callback = null) { TweenDelegate easingX = JCS_Util.GetEasing(typeX); TweenDelegate easingY = JCS_Util.GetEasing(typeY); TweenDelegate easingZ = JCS_Util.GetEasing(typeZ); StartTween(from, to, resetElapsedTime, durationX, durationY, durationZ, easingX, easingY, easingZ, callback); }
public void SetCallback(EmptyFunction func) { this.mColorCallback = func; }
/// <summary> /// Call back during shooting a bullet. /// </summary> /// <param name="func"> function to set. </param> public void SetShootCallback(EmptyFunction func) { this.mShootAction.SetShootCallback(func); }
public static void Indent(EmptyFunction func) { EditorGUI.indentLevel++; func.Invoke(); EditorGUI.indentLevel--; }
/// <summary> /// Tween to this vector either position, scale, rotation. /// </summary> /// <param name="to"> target vector 3 </param> /// <param name="callback"> callback function pointer. </param> public void DoTween(Vector3 to, EmptyFunction callback = null) { DoTween(to, true, mEasingX, mEasingY, mEasingZ, callback); }
public static void BeginVertical(EmptyFunction func) { GUILayout.BeginVertical("box"); func.Invoke(); GUILayout.EndVertical(); }
/// <summary> /// Tween to this vector either position, scale, rotation. /// </summary> /// <param name="to"> target vector 3 </param> /// <param name="resetElapsedTime"> reset elapsed time? (default : true) </param> /// <param name="callback"> callback function pointer. </param> public void DoTween(Vector3 to, bool resetElapsedTime, EmptyFunction callback = null) { DoTween(to, resetElapsedTime, mEasingX, mEasingY, mEasingZ, callback); }
/* Compatible with version 1.5.3 */ public void SetCallback(EmptyFunction func) { this.btnCallBack += func; }
/// <summary> /// Callback when reach destination. /// </summary> /// <param name="func"> function pointer </param> public void SetCallback(EmptyFunction func) { mDestinationCallback = func; }
public static void Indent(EmptyFunction func) { EditorGUI.indentLevel += INDENT_LEVEL; func.Invoke(); EditorGUI.indentLevel -= INDENT_LEVEL; }
/// <summary> /// Eases from value to value. /// </summary> /// <param name="from">From.</param> /// <param name="to">To.</param> /// <param name="duration">Duration.</param> /// <param name="easing">Easing.</param> public void easeFromTo(float from, float to, bool resetElapsedTime = true, float duration = 1.0f, TweenDelegate easing = null, EmptyFunction callback = null) { if (easing == null) { easing = Easing.Linear; } _Easing = easing; SetCallback(callback); _From = from; _To = to; _Duration = duration; _ProgressPct = 0.0f; _Animating = true; if (resetElapsedTime) { _TimeElapsed = 0.0f; } }
public void SetSystemCallback(EmptyFunction func) { this.btnSystemCallBack += func; }
/// <summary> /// Call back during shooting a bullet. /// </summary> /// <param name="func"> function to set. </param> public void SetShootCallback(EmptyFunction func) { this.mShootCallback = func; }