public override void OnInspectorGUI() { NGUIEditorTools.SetLabelWidth(120f); UIPlayAnimation pa = target as UIPlayAnimation; GUILayout.Space(6f); GUI.changed = false; EditorGUI.BeginDisabledGroup(pa.target); Animator animator = (Animator)EditorGUILayout.ObjectField("Animator", pa.animator, typeof(Animator), true); EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(pa.animator); Animation anim = (Animation)EditorGUILayout.ObjectField("Animation", pa.target, typeof(Animation), true); EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(anim == null && animator == null); string clipName = EditorGUILayout.TextField("State Name", pa.clipName); AnimationOrTween.Trigger trigger = (AnimationOrTween.Trigger)EditorGUILayout.EnumPopup("Trigger condition", pa.trigger); EditorGUI.BeginDisabledGroup(animator != null && !string.IsNullOrEmpty(clipName)); AnimationOrTween.Direction dir = (AnimationOrTween.Direction)EditorGUILayout.EnumPopup("Play direction", pa.playDirection); EditorGUI.EndDisabledGroup(); SelectedObject so = pa.clearSelection ? SelectedObject.SetToNothing : SelectedObject.KeepCurrent; bool clear = (SelectedObject)EditorGUILayout.EnumPopup("Selected object", so) == SelectedObject.SetToNothing; AnimationOrTween.EnableCondition enab = (AnimationOrTween.EnableCondition)EditorGUILayout.EnumPopup("If disabled on start", pa.ifDisabledOnPlay); ResetOnPlay rs = pa.resetOnPlay ? ResetOnPlay.RestartAnimation : ResetOnPlay.ContinueFromCurrent; bool reset = (ResetOnPlay)EditorGUILayout.EnumPopup("On activation", rs) == ResetOnPlay.RestartAnimation; AnimationOrTween.DisableCondition dis = (AnimationOrTween.DisableCondition)EditorGUILayout.EnumPopup("When finished", pa.disableWhenFinished); EditorGUI.EndDisabledGroup(); if (GUI.changed) { NGUIEditorTools.RegisterUndo("PlayAnimation Change", pa); pa.target = anim; pa.animator = animator; pa.clipName = clipName; pa.trigger = trigger; pa.playDirection = dir; pa.clearSelection = clear; pa.ifDisabledOnPlay = enab; pa.resetOnPlay = reset; pa.disableWhenFinished = dis; NGUITools.SetDirty(pa); } NGUIEditorTools.SetLabelWidth(80f); NGUIEditorTools.DrawEvents("On Finished", pa, pa.onFinished); }
public override void OnInspectorGUI() { NGUIEditorTools.SetLabelWidth(120f); UIPlayTween tw = target as UIPlayTween; GUILayout.Space(6f); GUI.changed = false; GameObject tt = (GameObject)EditorGUILayout.ObjectField("Tween Target", tw.tweenTarget, typeof(GameObject), true); var ss = tw.startState; var inc = EditorGUILayout.Toggle("Include Children", tw.includeChildren); var setState = EditorGUILayout.Toggle("Start State", tw.setState); if (setState) { ss = EditorGUILayout.FloatField(" value", ss); } var group = EditorGUILayout.IntField("Tween Group", tw.tweenGroup, GUILayout.Width(160f)); AnimationOrTween.Trigger trigger = (AnimationOrTween.Trigger)EditorGUILayout.EnumPopup("Trigger condition", tw.trigger); AnimationOrTween.Direction dir = (AnimationOrTween.Direction)EditorGUILayout.EnumPopup("Play direction", tw.playDirection); AnimationOrTween.EnableCondition enab = (AnimationOrTween.EnableCondition)EditorGUILayout.EnumPopup("If target is disabled", tw.ifDisabledOnPlay); ResetOnPlay rs = tw.resetOnPlay ? ResetOnPlay.RestartTween : (tw.resetIfDisabled ? ResetOnPlay.RestartIfNotPlaying : ResetOnPlay.ContinueFromCurrent); ResetOnPlay reset = (ResetOnPlay)EditorGUILayout.EnumPopup("On activation", rs); AnimationOrTween.DisableCondition dis = (AnimationOrTween.DisableCondition)EditorGUILayout.EnumPopup("When finished", tw.disableWhenFinished); if (GUI.changed) { NGUIEditorTools.RegisterUndo("Tween Change", tw); tw.tweenTarget = tt; tw.tweenGroup = group; tw.setState = setState; tw.startState = ss; tw.includeChildren = inc; tw.trigger = trigger; tw.playDirection = dir; tw.ifDisabledOnPlay = enab; tw.resetOnPlay = (reset == ResetOnPlay.RestartTween); tw.resetIfDisabled = (reset == ResetOnPlay.RestartIfNotPlaying); tw.disableWhenFinished = dis; NGUITools.SetDirty(tw); } NGUIEditorTools.SetLabelWidth(80f); NGUIEditorTools.DrawEvents("On Finished", tw, tw.onFinished); }
static int set_disableWhenFinished(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIPlayTween obj = (UIPlayTween)o; AnimationOrTween.DisableCondition arg0 = (AnimationOrTween.DisableCondition)ToLua.CheckObject(L, 2, typeof(AnimationOrTween.DisableCondition)); obj.disableWhenFinished = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index disableWhenFinished on a nil value")); } }
static int get_disableWhenFinished(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UIPlayTween obj = (UIPlayTween)o; AnimationOrTween.DisableCondition ret = obj.disableWhenFinished; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index disableWhenFinished on a nil value")); } }
public override void OnInspectorGUI() { NGUIEditorTools.SetLabelWidth(120f); UIPlayAnimation pa = target as UIPlayAnimation; GUILayout.Space(6f); GUI.changed = false; Animation anim = (Animation)EditorGUILayout.ObjectField("Target", pa.target, typeof(Animation), true); string clipName = EditorGUILayout.TextField("Clip Name", pa.clipName); AnimationOrTween.Trigger trigger = (AnimationOrTween.Trigger)EditorGUILayout.EnumPopup("Trigger condition", pa.trigger); AnimationOrTween.Direction dir = (AnimationOrTween.Direction)EditorGUILayout.EnumPopup("Play direction", pa.playDirection); SelectedObject so = pa.clearSelection ? SelectedObject.SetToNothing : SelectedObject.KeepCurrent; bool clear = (SelectedObject)EditorGUILayout.EnumPopup("Selected object", so) == SelectedObject.SetToNothing; AnimationOrTween.EnableCondition enab = (AnimationOrTween.EnableCondition)EditorGUILayout.EnumPopup("If disabled on start", pa.ifDisabledOnPlay); ResetOnPlay rs = pa.resetOnPlay ? ResetOnPlay.StartFromBeginning : ResetOnPlay.Continue; bool reset = (ResetOnPlay)EditorGUILayout.EnumPopup("If already playing", rs) == ResetOnPlay.StartFromBeginning; AnimationOrTween.DisableCondition dis = (AnimationOrTween.DisableCondition)EditorGUILayout.EnumPopup("When finished", pa.disableWhenFinished); if (GUI.changed) { NGUIEditorTools.RegisterUndo("PlayAnimation Change", pa); pa.target = anim; pa.clipName = clipName; pa.trigger = trigger; pa.playDirection = dir; pa.clearSelection = clear; pa.ifDisabledOnPlay = enab; pa.resetOnPlay = reset; pa.disableWhenFinished = dis; UnityEditor.EditorUtility.SetDirty(pa); } NGUIEditorTools.SetLabelWidth(80f); NGUIEditorTools.DrawEvents("On Finished", pa, pa.onFinished); }
public override void OnInspectorGUI() { NGUIEditorTools.SetLabelWidth(120f); UIPlayTween tw = target as UIPlayTween; GUILayout.Space(6f); GUI.changed = false; GameObject tt = (GameObject)EditorGUILayout.ObjectField("Tween Target", tw.tweenTarget, typeof(GameObject), true); bool inc = EditorGUILayout.Toggle("Include Children", tw.includeChildren); int group = EditorGUILayout.IntField("Tween Group", tw.tweenGroup, GUILayout.Width(160f)); AnimationOrTween.Trigger trigger = (AnimationOrTween.Trigger)EditorGUILayout.EnumPopup("Trigger condition", tw.trigger); AnimationOrTween.Direction dir = (AnimationOrTween.Direction)EditorGUILayout.EnumPopup("Play direction", tw.playDirection); AnimationOrTween.EnableCondition enab = (AnimationOrTween.EnableCondition)EditorGUILayout.EnumPopup("If disabled on start", tw.ifDisabledOnPlay); ResetOnPlay rs = tw.resetOnPlay ? ResetOnPlay.StartFromBeginning : ResetOnPlay.Continue; bool reset = (ResetOnPlay)EditorGUILayout.EnumPopup("If already playing", rs) == ResetOnPlay.StartFromBeginning; AnimationOrTween.DisableCondition dis = (AnimationOrTween.DisableCondition)EditorGUILayout.EnumPopup("When finished", tw.disableWhenFinished); if (GUI.changed) { NGUIEditorTools.RegisterUndo("Tween Change", tw); tw.tweenTarget = tt; tw.tweenGroup = group; tw.includeChildren = inc; tw.trigger = trigger; tw.playDirection = dir; tw.ifDisabledOnPlay = enab; tw.resetOnPlay = reset; tw.disableWhenFinished = dis; UnityEditor.EditorUtility.SetDirty(tw); } NGUIEditorTools.SetLabelWidth(80f); NGUIEditorTools.DrawEvents("On Finished", tw, tw.onFinished); }