Skip to content

Commit

Permalink
Commented out prefab creator windows, began work on next release.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nebby1999 committed Nov 5, 2021
1 parent 86affd4 commit 1e81584
Show file tree
Hide file tree
Showing 8 changed files with 471 additions and 47 deletions.
26 changes: 0 additions & 26 deletions RoR2EditorKit/Assets/NullModel.asset

This file was deleted.

8 changes: 0 additions & 8 deletions RoR2EditorKit/Assets/NullModel.asset.meta

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using RoR2EditorKit.Settings;
/*using RoR2EditorKit.Settings;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace RoR2EditorKit.Core.Windows
{
public abstract class CreateRoR2PrefabWindow<T> : ExtendedEditorWindow where T : MonoBehaviour
{
public T MainComponent { get; private set; }
protected SerializedObject serializedComponent;
public RoR2EditorKitSettings Settings { get => RoR2EditorKitSettings.GetOrCreateSettings<RoR2EditorKitSettings>(); }
protected GameObject mainPrefab { get; private set; }
Expand All @@ -18,6 +21,7 @@ protected override void OnWindowOpened()
{
mainPrefab = GameObject.CreatePrimitive(PrimitiveType.Capsule);
MainComponent = mainPrefab.AddComponent<T>();
serializedComponent = new SerializedObject(MainComponent);
nameField = string.Empty;
actualName = string.Empty;
}
Expand Down Expand Up @@ -55,3 +59,4 @@ protected void TryToClose()
}
}
}
*/
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,11 @@ protected void DrawField(string propName, bool relative, SerializedProperty curr
EditorGUILayout.PropertyField(serializedObj.FindProperty(propName), true);
}
}

protected void DrawField(string propName, SerializedObject serializedObject)
{
EditorGUILayout.PropertyField(serializedObject.FindProperty(propName));
}

protected void ApplyChanges()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using RoR2EditorKit.Core.Windows;
/*using RoR2EditorKit.Core.Windows;
using RoR2.Projectile;
using RoR2EditorKit.Common;
using UnityEditor;
Expand All @@ -14,8 +14,8 @@ public enum ProjectileComponents : short
{
ProjectileSimple = 1,
ProjectileNetworkTransform = 2,
ProjectileDamage = 3,
ProjectileImpactExplosion = 4
ProjectileDamage = 4,
ProjectileImpactExplosion = 8
}
public ProjectileController projectileController;
Expand Down Expand Up @@ -43,7 +43,12 @@ protected override void OnWindowOpened()
private void OnGUI()
{
components = (ProjectileComponents)EditorGUILayout.EnumFlagsField("Projectile Components", components);
EditorGUILayout.BeginHorizontal();
EditorGUILayout.BeginVertical();
nameField = EditorGUILayout.TextField("Projectile Name");
components = (ProjectileComponents)EditorGUILayout.EnumFlagsField("Components To Add", components);
}
}
}
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
/*using RoR2EditorKit.Core.Windows;
using RoR2.Projectile;
using RoR2EditorKit.Common;
using UnityEditor;
using UnityEngine;
using System;
using RoR2;
using EntityStates;
using System.Collections.Generic;
namespace RoR2EditorKit.RoR2.EditorWindows
{
public class CreateBodyWindow : CreateRoR2PrefabWindow<CharacterBody>
{
private enum BodyWindowEnum
{
None,
Stats,
AimingAndCrosshair,
EntityStateMachine,
CharBodyExtras,
}
public CharacterBody body;
private bool flying = false;
private bool addSubtitleToken = false;
private int amountOfSkills = 1;
private int amountOfStateMachines = 1;
private BodyWindowEnum currentEnum = BodyWindowEnum.None;
[MenuItem(Constants.RoR2EditorKitContextRoot + "Prefabs/Body", false, Constants.RoR2EditorKitContextPriority)]
public static void Open()
{
OpenEditorWindow<CreateBodyWindow>(null, "Create Basic Body");
}
protected override void OnWindowOpened()
{
base.OnWindowOpened();
flying = false;
addSubtitleToken = false;
amountOfSkills = 1;
body = MainComponent;
mainSerializedObject = new SerializedObject(mainPrefab);
}
private void OnGUI()
{
if (SimpleButton("Set Defaults To CommandoBody Defaults"))
SetDefaults();
EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
EditorGUILayout.BeginVertical("box", GUILayout.ExpandHeight(true), GUILayout.MaxWidth(300));
nameField = EditorGUILayout.TextField("Body Name", nameField);
flying = EditorGUILayout.Toggle("Flying", flying);
addSubtitleToken = EditorGUILayout.Toggle($"Subtitle Token", addSubtitleToken);
amountOfSkills = EditorGUILayout.IntSlider("Amount of Skills", amountOfSkills, 1, 4);
amountOfStateMachines = EditorGUILayout.IntField("Amount of Entity State Machines", amountOfStateMachines);
DrawField("bodyFlags", serializedComponent);
DrawField("hullClassification", serializedComponent);
DrawField("isChampion", serializedComponent);
EditorGUILayout.BeginVertical("box", GUILayout.ExpandHeight(true), GUILayout.MaxWidth(300));
if (SimpleButton("Stats"))
{
currentEnum = BodyWindowEnum.Stats;
}
if(SimpleButton("Aiming and Crosshair"))
{
currentEnum = BodyWindowEnum.AimingAndCrosshair;
}
if(amountOfStateMachines > 0 && SimpleButton("Entity State Machines"))
{
currentEnum = BodyWindowEnum.EntityStateMachine;
}
if(SimpleButton("Extra Settings"))
{
currentEnum = BodyWindowEnum.CharBodyExtras;
}
EditorGUILayout.EndVertical();
EditorGUILayout.EndVertical();
EditorGUILayout.BeginVertical("box", GUILayout.ExpandHeight(true));
switch(currentEnum)
{
case BodyWindowEnum.None:
EditorGUILayout.LabelField($"Please click one of the buttons.");
break;
case BodyWindowEnum.Stats:
ShowStats();
break;
case BodyWindowEnum.AimingAndCrosshair:
ShowAimingAndCrosshair();
break;
case BodyWindowEnum.CharBodyExtras:
ShowExtras();
break;
}
EditorGUILayout.EndVertical();
EditorGUILayout.EndHorizontal();
}
private void ShowStats()
{
EditorGUILayout.BeginVertical("box", GUILayout.ExpandHeight(true));
DrawField("baseMaxHealth", serializedComponent);
DrawField("baseRegen", serializedComponent);
DrawField("baseMaxShield", serializedComponent);
DrawField("baseMoveSpeed", serializedComponent);
DrawField("baseAcceleration", serializedComponent);
DrawField("baseJumpPower", serializedComponent);
DrawField("baseDamage", serializedComponent);
DrawField("baseAttackSpeed", serializedComponent);
DrawField("baseCrit", serializedComponent);
DrawField("baseArmor", serializedComponent);
DrawField("baseJumpCount", serializedComponent);
DrawField("sprintingSpeedMultiplier", serializedComponent);
EditorGUILayout.Space();
DrawField("autoCalculateLevelStats", serializedComponent);
EditorGUILayout.Space();
if(!serializedComponent.FindProperty("autoCalculateLevelStats").boolValue)
{
DrawField("levelMaxHealth", serializedComponent);
DrawField("levelRegen", serializedComponent);
DrawField("levelMaxShield", serializedComponent);
DrawField("levelMoveSpeed", serializedComponent);
DrawField("levelJumpPower", serializedComponent);
DrawField("levelDamage", serializedComponent);
DrawField("levelAttackSpeed", serializedComponent);
DrawField("levelCrit", serializedComponent);
DrawField("levelArmor", serializedComponent);
}
EditorGUILayout.EndVertical();
serializedComponent.ApplyModifiedProperties();
}
private void ShowExtras()
{
EditorGUILayout.BeginVertical("box", GUILayout.ExpandHeight(true));
}
private void ShowAimingAndCrosshair()
{
EditorGUILayout.BeginVertical("box", GUILayout.ExpandHeight(true));
DrawField("spreadBloomDecayTime", serializedComponent);
DrawField("spreadBloomCurve", serializedComponent);
DrawField("crosshairPrefab", serializedComponent);
EditorGUILayout.EndVertical();
serializedComponent.ApplyModifiedProperties();
}
private void SetDefaults()
{
body.bodyFlags |= CharacterBody.BodyFlags.ImmuneToExecutes;
body.rootMotionInMainState = false;
body.mainRootSpeed = 0;
body.baseMaxHealth = 110;
body.baseRegen = 1;
body.baseMaxShield = 0;
body.baseMoveSpeed = 7;
body.baseAcceleration = 80;
body.baseJumpPower = 15;
body.baseDamage = 12;
body.baseAttackSpeed = 1;
body.baseCrit = 1;
body.baseArmor = 0;
body.baseJumpCount = 1;
body.sprintingSpeedMultiplier = 1.45f;
body.autoCalculateLevelStats = true;
body.spreadBloomDecayTime = 0.7f;
body.hullClassification = HullClassification.Human;
body.bodyColor = Color.white;
body.isChampion = false;
body.preferredInitialStateType = new EntityStates.SerializableEntityStateType(typeof(EntityStates.Uninitialized));
flying = false;
addSubtitleToken = true;
amountOfSkills = 4;
amountOfStateMachines = 3;
serializedComponent.Update();
}
}
}
*/

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1e81584

Please sign in to comment.