public static void Init(VRCSDK2.VRC_PlayerMods target, AddModCallback callback) { // Get existing open window or if none, make a new one: EditorWindow.GetWindow (typeof (VRCPlayerModEditorWindow)); addModCallback = callback; myTarget = target; type = VRCSDK2.VRCPlayerModFactory.PlayerModType.Jump; }
VRCSDK2.VRCPlayerModProperty DrawFieldForProp(VRCSDK2.VRCPlayerModProperty property) { if(property.type.SystemType == typeof(int)) { property.intValue = EditorGUILayout.IntField(property.name, property.intValue); } else if(property.type.SystemType == typeof(float)) { property.floatValue = EditorGUILayout.FloatField(property.name, property.floatValue); } else if(property.type.SystemType == typeof(string)) { property.stringValue = EditorGUILayout.TextField(property.name, property.stringValue); } else if(property.type.SystemType == typeof(bool)) { property.boolValue = EditorGUILayout.Toggle(property.name, property.boolValue); } else if(property.type.SystemType == typeof(GameObject)) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField( property.name ); property.gameObjectValue = (GameObject) EditorGUILayout.ObjectField( property.gameObjectValue, typeof( GameObject ), true ); EditorGUILayout.EndHorizontal(); } else if(property.type.SystemType == typeof(KeyCode)) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField( property.name ); property.keyCodeValue = (KeyCode) EditorGUILayout.EnumPopup( property.keyCodeValue ); EditorGUILayout.EndHorizontal(); } else if(property.type.SystemType == typeof(VRCSDK2.VRC_EventHandler.VrcBroadcastType)) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField( property.name ); property.broadcastValue = (VRCSDK2.VRC_EventHandler.VrcBroadcastType) EditorGUILayout.EnumPopup( property.broadcastValue ); EditorGUILayout.EndHorizontal(); } else if(property.type.SystemType == typeof(VRCSDK2.VRCPlayerModFactory.HealthOnDeathAction)) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField( property.name ); property.onDeathActionValue = (VRCSDK2.VRCPlayerModFactory.HealthOnDeathAction) EditorGUILayout.EnumPopup( property.onDeathActionValue); EditorGUILayout.EndHorizontal(); } else if(property.type.SystemType == typeof(RuntimeAnimatorController)) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField( property.name ); property.animationController = (RuntimeAnimatorController) EditorGUILayout.ObjectField( property.animationController, typeof( RuntimeAnimatorController ), false ); EditorGUILayout.EndHorizontal(); } return property; }