/// <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;
 }
예제 #2
0
 public static bool Button(string text, EmptyFunction func)
 {
     if (Button(text))
     {
         func.Invoke();
         return(true);
     }
     return(false);
 }
예제 #3
0
 /// <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);
 }
예제 #4
0
 public static void BeginHorizontal(EmptyFunction func, bool flexibleSpace = false)
 {
     GUILayout.BeginHorizontal();
     if (flexibleSpace)
     {
         GUILayout.FlexibleSpace();
     }
     func.Invoke();
     GUILayout.EndHorizontal();
 }
예제 #5
0
        /* Setter & Getters */

        /* Functions */

        public static void IgnoreErrors(EmptyFunction func)
        {
            try
            {
                func.Invoke();
            }
            catch (Exception)
            {
                // ..
            }
        }
예제 #6
0
 public static void CreateGroup(EmptyFunction func, bool flexibleSpace = false)
 {
     BeginHorizontal(() =>
     {
         BeginVertical(() =>
         {
             Indent(func);
         });
     },
                     flexibleSpace);
 }
예제 #7
0
        /* 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;
        }
예제 #8
0
 public static void BeginVertical(EmptyFunction func, string style = "box")
 {
     if (style == "")
     {
         GUILayout.BeginVertical();
     }
     else
     {
         GUILayout.BeginVertical("box");
     }
     func.Invoke();
     GUILayout.EndVertical();
 }
예제 #9
0
        /// <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);
        }
예제 #10
0
        /// <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);
        }
예제 #11
0
        /// <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);
        }
예제 #12
0
 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--;
 }
예제 #15
0
 /// <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);
 }
예제 #16
0
 public static void BeginVertical(EmptyFunction func)
 {
     GUILayout.BeginVertical("box");
     func.Invoke();
     GUILayout.EndVertical();
 }
예제 #17
0
 /// <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);
 }
예제 #18
0
 /* Compatible with version 1.5.3 */
 public void SetCallback(EmptyFunction func)
 {
     this.btnCallBack += func;
 }
예제 #19
0
 /// <summary>
 /// Callback when reach destination.
 /// </summary>
 /// <param name="func"> function pointer </param>
 public void SetCallback(EmptyFunction func)
 {
     mDestinationCallback = func;
 }
예제 #20
0
 public static void Indent(EmptyFunction func)
 {
     EditorGUI.indentLevel += INDENT_LEVEL;
     func.Invoke();
     EditorGUI.indentLevel -= INDENT_LEVEL;
 }
예제 #21
0
        /// <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;
            }
        }
예제 #22
0
 public void SetSystemCallback(EmptyFunction func)
 {
     this.btnSystemCallBack += func;
 }
예제 #23
0
 /// <summary>
 /// Call back during shooting a bullet.
 /// </summary>
 /// <param name="func"> function to set. </param>
 public void SetShootCallback(EmptyFunction func)
 {
     this.mShootCallback = func;
 }