/* * Layout Builders */ internal static int OnCheckBoxGuiHand(GestureManager manager, GestureHand hand, int position, Func <int, int> onNone) { var gesture = new bool[8]; var texture = EditorGUIUtility.isProSkin ? GestureManagerStyles.PlusTexturePro : GestureManagerStyles.PlusTexture; gesture[position] = true; for (var i = 1; i < 8; i++) { GUILayout.BeginHorizontal(); GUILayout.Label(manager.GetFinalGestureName(hand, i)); GUILayout.FlexibleSpace(); gesture[i] = GUILayout.Toggle(gesture[i], ""); if (!manager.Module.HasGestureBeenOverridden(i)) { OverrideButton(texture, manager, hand, i); } else { GUILayout.Space(35); } GUILayout.EndHorizontal(); } for (var i = 0; i < gesture.Length; i++) { if (!gesture[i] || position == i) { continue; } for (var ix = 0; ix < gesture.Length; ix++) { if (ix != i) { gesture[ix] = false; } } } for (var i = 0; i < gesture.Length; i++) { if (gesture[i]) { return(i); } } return(onNone(position)); }
private static void RequestGestureDuplication(GestureManager manager, GestureHand hand, int gestureIndex) { var fullGestureName = manager.GetFinalGestureName(hand, gestureIndex); var gestureName = "[" + fullGestureName.Substring(fullGestureName.IndexOf("]", StringComparison.Ordinal) + 2) + "]"; var newAnimation = GmgAnimationHelper.CloneAnimationAsset(manager.Module.GetFinalGestureByIndex(hand, gestureIndex)); var path = EditorUtility.SaveFilePanelInProject("Creating Gesture: " + fullGestureName, gestureName + ".anim", "anim", "Hi (?)"); if (path.Length == 0) { return; } AssetDatabase.CreateAsset(newAnimation, path); newAnimation = AssetDatabase.LoadAssetAtPath <AnimationClip>(path); manager.Module.AddGestureToOverrideController(gestureIndex, newAnimation); }