private static void RayBulletGUI() { GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Space(5); GUILayout.Label(ContentProperties.BaseOptions, UEditorStyles.SectionHeaderLabel); GUILayout.Space(7); rayBullet.SetModel(EditorGUILayout.TextField(ContentProperties.Model, rayBullet.GetModel())); rayBullet.SetDamage(EditorGUILayout.IntField(ContentProperties.Damage, rayBullet.GetDamage())); rayBullet.SetVariance(EditorGUILayout.FloatField(ContentProperties.Variance, rayBullet.GetVariance())); rayBullet.SetNumberBullet(EditorGUILayout.IntField(ContentProperties.NumberBullet, rayBullet.GetNumberBullet())); rayBullet.SetDecalProperties(UEditor.ObjectField <DecalProperties>(ContentProperties.DecalProperties, rayBullet.GetDecalProperties(), false)); GUILayout.Space(5); UEditor.HorizontalLine(); GUILayout.Space(5); EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(rayBullet.GetModel())); if (UEditor.Button("Create", "Right", GUILayout.Width(70))) { string path = EditorUtility.SaveFilePanelInProject("Create new RayBullet", rayBullet.GetModel(), "", ""); if (!string.IsNullOrEmpty(path)) { string name = System.IO.Path.GetFileName(path); path = path.Replace(name, ""); ScriptableObjectUtility.CreateAsset(rayBullet, path, name); CreateInstances(); } } EditorGUI.EndDisabledGroup(); GUILayout.Space(5); GUILayout.EndVertical(); }
private static void DrawProperties() { GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Space(5); GUILayout.Label("Base Options", UEditorStyles.SectionHeaderLabel); GUILayout.Space(5); if (properties != null) { properties.SetAIType((AIProperties.AIType)EditorGUILayout.EnumPopup(ContentProperties.Type, properties.GetAIType())); properties.SetName(EditorGUILayout.DelayedTextField(ContentProperties.Name, properties.GetName())); if (properties.GetName() == "") { properties.SetDefaultName(); } properties.SetModel((GameObject)EditorGUILayout.ObjectField(ContentProperties.Model, properties.GetModel(), typeof(GameObject), true)); if (properties.GetModel() == null) { UEditorHelpBoxMessages.Error("AI model cannot be empty!", "Add AI model."); } properties.SetController((AnimatorController)EditorGUILayout.ObjectField(ContentProperties.Controller, properties.GetController(), typeof(AnimatorController), true)); properties.DefaultPreset(EditorGUILayout.Toggle(ContentProperties.DefaultPreset, properties.DefaultPreset())); if (properties.DefaultPreset()) { properties.SetDefaultPreset(); } EditorGUI.BeginDisabledGroup(properties.DefaultPreset()); LayerMask targetMask = EditorGUILayout.MaskField(ContentProperties.Tagrets, InternalEditorUtility.LayerMaskToConcatenatedLayersMask(properties.GetTargets()), InternalEditorUtility.layers); properties.SetTargets(InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(targetMask)); LayerMask obstacleMask = EditorGUILayout.MaskField(ContentProperties.Obstacles, InternalEditorUtility.LayerMaskToConcatenatedLayersMask(properties.GetObstacles()), InternalEditorUtility.layers); properties.SetObstacles(InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(obstacleMask)); EditorGUI.EndDisabledGroup(); GUILayout.Space(5); UEditor.HorizontalLine(); GUILayout.Space(5); EditorGUI.BeginDisabledGroup(!properties.GetModel()); if (UEditor.Button("Create", "Right", GUILayout.Width(70))) { _AI = CreateAI(properties); } if (_AI != null && delay.WaitForSeconds()) { if (UDisplayDialogs.Message("Create Successful", "AI was created on scene!\nSetup AI components before start play.", "Select", "Ok")) { Selection.activeGameObject = _AI; } _AI = null; } EditorGUI.EndDisabledGroup(); } else { UEditorHelpBoxMessages.Error("Properties not loaded...", "Try to reload UProject Manager window.", true); } GUILayout.Space(5); GUILayout.EndVertical(); }
private static void PhysicsBulletGUI() { GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Space(5); GUILayout.Label(ContentProperties.BaseOptions, UEditorStyles.SectionHeaderLabel); GUILayout.Space(7); physicsBulletProperties.SetBulletType((PhysicsBullet.BulletType)EditorGUILayout.EnumPopup(ContentProperties.BulletType, physicsBulletProperties.GetBulletType())); physicsBulletProperties.SetBullet(UEditor.ObjectField <GameObject>(new GUIContent("Bullet", "Bullet gameobject."), physicsBulletProperties.GetBullet(), true)); if (physicsBulletProperties.GetBullet() == null) { UEditorHelpBoxMessages.Error("Bullet object cannot be empty!", "Add bullet gameobject."); } physicsBulletProperties.SetModel(EditorGUILayout.TextField(ContentProperties.Model, physicsBulletProperties.GetModel())); physicsBulletProperties.SetDamage(EditorGUILayout.IntField(ContentProperties.Damage, physicsBulletProperties.GetDamage())); physicsBulletProperties.SetDelay(EditorGUILayout.FloatField(ContentProperties.Delay, physicsBulletProperties.GetDelay())); if (physicsBulletProperties.GetBulletType() == PhysicsBullet.BulletType.Standard) { physicsBulletProperties.SetVariance(EditorGUILayout.FloatField(ContentProperties.Variance, physicsBulletProperties.GetVariance())); physicsBulletProperties.SetNumberBullet(EditorGUILayout.IntField(ContentProperties.NumberBullet, physicsBulletProperties.GetNumberBullet())); } else if (physicsBulletProperties.GetBulletType() == PhysicsBullet.BulletType.Rocket) { physicsBulletProperties.SetExplosionRadius(EditorGUILayout.FloatField(ContentProperties.B_ExplosionRadius, physicsBulletProperties.GetExplosionRadius())); physicsBulletProperties.SetExplosionPower(EditorGUILayout.FloatField(ContentProperties.B_ExplosionPower, physicsBulletProperties.GetExplosionPower())); physicsBulletProperties.SetExplosionEffect(UEditor.ObjectField <ParticleSystem>(ContentProperties.B_ExplosionEffect, physicsBulletProperties.GetExplosionEffect(), true)); physicsBulletProperties.SetExplosionSound(UEditor.ObjectField <AudioClip>(ContentProperties.ExplosionSound, physicsBulletProperties.GetExplosionSound(), true)); } physicsBulletProperties.SetDecalProperties(UEditor.ObjectField <DecalProperties>(ContentProperties.DecalProperties, physicsBulletProperties.GetDecalProperties(), false)); GUILayout.Space(5); UEditor.HorizontalLine(); GUILayout.Space(5); EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(physicsBulletProperties.GetModel()) || physicsBulletProperties.GetBullet() == null); if (UEditor.Button("Create", "Right", GUILayout.Width(70))) { createdObject = CreatePhysicsBullet(physicsBulletProperties); } EditorGUI.EndDisabledGroup(); if (createdObject != null && editorDelay.WaitForSeconds()) { if (UDisplayDialogs.Message("Create Successful", "Physics bullet was created on scene!\nSetup bullet components before start play.", "Select", "Ok")) { Selection.activeGameObject = createdObject; } createdObject = null; } GUILayout.Space(5); GUILayout.EndVertical(); }
private static void DrawFPWeaponGUI() { GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Space(5); GUILayout.Label(ContentProperties.BaseOptions, UEditorStyles.SectionHeaderLabel); GUILayout.Space(7); properties.SetName(EditorGUILayout.TextField(ContentProperties.WeaponName, properties.GetName())); properties.SetWeaponType((WeaponProperties.Type)EditorGUILayout.EnumPopup(ContentProperties.WeaponType, properties.GetWeaponType())); properties.SetWeapon(UEditor.ObjectField <GameObject>(ContentProperties.WeaponObject, properties.GetWeapon(), true)); if (properties.GetWeapon() == null) { UEditorHelpBoxMessages.Error("Weapon model cannot be empty!", "Add weapon model."); } properties.SetWeaponID(UEditor.ObjectField <WeaponID>(ContentProperties.WeaponID, properties.GetWeaponID(), true)); properties.SetController(UEditor.ObjectField <RuntimeAnimatorController>(ContentProperties.WeaponAnimator, properties.GetController(), false)); GUILayout.Space(10); additionalComponentsRL.DoLayoutList(); GUILayout.Space(5); UEditor.HorizontalLine(); GUILayout.Space(5); EditorGUI.BeginDisabledGroup(!properties.NameIsValid() || properties.GetWeapon() == null); if (UEditor.Button("Create", "Right", GUILayout.Width(70))) { weapon = CreateFPWeapon(properties); } EditorGUI.EndDisabledGroup(); if (weapon != null && delay.WaitForSeconds()) { if (UDisplayDialogs.Message("Create Successful", "Weapon was created on scene!\nSetup weapon components before start play.", "Select", "Ok")) { Selection.activeGameObject = weapon; } weapon = null; } GUILayout.Space(5); GUILayout.EndVertical(); }
private static void GrenadeGUI() { GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Space(5); GUILayout.Label(ContentProperties.BaseOptions, UEditorStyles.SectionHeaderLabel); GUILayout.Space(7); grenadeProperties.SetGrenadeObject((GameObject)EditorGUILayout.ObjectField(new GUIContent("Grenade", "Grenade gameobject."), grenadeProperties.GetGrenadeObject(), typeof(GameObject), true)); if (grenadeProperties.GetGrenadeObject() == null) { UEditorHelpBoxMessages.Error("Grenade object cannot be empty!", "Add grenade gameobject."); } grenadeProperties.SetModel(EditorGUILayout.TextField(ContentProperties.Model, grenadeProperties.GetModel())); grenadeProperties.SetRadius(EditorGUILayout.FloatField(ContentProperties.G_ExplosionRadius, grenadeProperties.GetRadius())); grenadeProperties.SetDelay(EditorGUILayout.FloatField(ContentProperties.Delay, grenadeProperties.GetDelay())); grenadeProperties.SetExplosionEffect((ParticleSystem)EditorGUILayout.ObjectField(ContentProperties.G_ExplosionEffect, grenadeProperties.GetExplosionEffect(), typeof(ParticleSystem), true)); grenadeProperties.SetExplosionSound((AudioClip)EditorGUILayout.ObjectField(ContentProperties.ExplosionSound, grenadeProperties.GetExplosionSound(), typeof(AudioClip), true)); grenadeProperties.SetExplosionProperties((ExplosionProperties)EditorGUILayout.ObjectField(ContentProperties.ExplosionProperties, grenadeProperties.GetExplosionProperties(), typeof(ExplosionProperties), true)); grenadeProperties.SetDecalProperties((DecalProperties)EditorGUILayout.ObjectField(ContentProperties.DecalProperties, grenadeProperties.GetDecalProperties(), typeof(DecalProperties), true)); GUILayout.Space(5); UEditor.HorizontalLine(); GUILayout.Space(5); EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(grenadeProperties.GetModel()) || grenadeProperties.GetGrenadeObject() == null); if (UEditor.Button("Create", "Right", GUILayout.Width(70))) { createdObject = CreateGreanade(grenadeProperties); } EditorGUI.EndDisabledGroup(); if (createdObject != null && editorDelay.WaitForSeconds()) { if (UDisplayDialogs.Message("Create Successful", "Greanade was created on scene!\nSetup grenade components before start play.", "Select", "Ok")) { Selection.activeGameObject = createdObject; } createdObject = null; } GUILayout.Space(5); GUILayout.EndVertical(); }
private static void DrawPickableWeaponGUI() { GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Space(5); GUILayout.Label(ContentProperties.BaseOptions, UEditorStyles.SectionHeaderLabel); GUILayout.Space(7); properties.SetName(EditorGUILayout.TextField(ContentProperties.Name, properties.GetName())); properties.SetProcessingType((PickableItem.PickupType)EditorGUILayout.EnumPopup(ContentProperties.PickupType, properties.GetProcessingType())); properties.SetObjectType((PickableItem.ItemType)EditorGUILayout.EnumPopup(ContentProperties.ObjecftType, properties.GetObjectType())); if (properties.GetProcessingType() == PickableItem.PickupType.ByKey) { properties.SetPickUpKey((KeyCode)EditorGUILayout.EnumPopup(ContentProperties.PickupKey, properties.GetPickUpKey())); } GUILayout.Space(10); GUILayout.Label(ContentProperties.ItemProperties, UEditorStyles.SectionHeaderLabel); GUILayout.Space(7); properties.SetClearWeapon(UEditor.ObjectField <GameObject>(ContentProperties.Item, properties.GetClearWeapon(), true)); if (properties.GetClearWeapon() == null) { UEditorHelpBoxMessages.Error("Item cannot be empty!", "Add item game object!"); } switch (properties.GetObjectType()) { case PickableItem.ItemType.Weapon: properties.SetWeaponID(UEditor.ObjectField <WeaponID>(ContentProperties.Weapon, properties.GetWeaponID(), true)); properties.AutoActivate(EditorGUILayout.Toggle(ContentProperties.AutoActivate, properties.AutoActivate())); break; case PickableItem.ItemType.Ammo: properties.SetWeaponID(UEditor.ObjectField <WeaponID>(new GUIContent("Target Weapon", "Target weapon for ammo."), properties.GetWeaponID(), true)); properties.SetValue(EditorGUILayout.IntField(new GUIContent("Bullets", "How many bullet add in weapon ammo."), properties.GetValue())); break; case PickableItem.ItemType.HealthBox: properties.SetValue(EditorGUILayout.IntField(new GUIContent("Health Point", "How many health point add in target."), properties.GetValue())); break; } if (!properties.DestroyAfterUse()) { float refReusableDelay = properties.GetReusableDelay(); bool refIsReusable = properties.IsReusable(); UEditor.HiddenFloatField(ContentProperties.ReusableDelay, ContentProperties.IsReusable, ref refReusableDelay, ref refIsReusable); properties.SetReusableDelay(refReusableDelay); properties.IsReusable(refIsReusable); } else { EditorGUI.BeginDisabledGroup(true); properties.IsReusable(EditorGUILayout.Toggle(ContentProperties.IsReusable, false)); EditorGUI.EndDisabledGroup(); } if (!properties.IsReusable()) { properties.DestroyAfterUse(EditorGUILayout.Toggle(ContentProperties.DestroyAfterUse, properties.DestroyAfterUse())); } else { EditorGUI.BeginDisabledGroup(true); properties.DestroyAfterUse(EditorGUILayout.Toggle(ContentProperties.DestroyAfterUse, false)); EditorGUI.EndDisabledGroup(); } GUILayout.Space(10); GUILayout.Label(ContentProperties.UI, UEditorStyles.SectionHeaderLabel); GUILayout.Space(7); if (properties.GetWeaponID() != null) { GUILayout.BeginHorizontal(); properties.SetPickUpMessage(EditorGUILayout.TextField(ContentProperties.PickUpMessage, properties.GetPickUpMessage())); if (UEditor.GenerateButton()) { properties.SetPickUpMessage("HOLD [{0}] TO PICKUP \"{1}\""); } GUILayout.EndHorizontal(); } else { properties.SetPickUpMessage(EditorGUILayout.TextField(ContentProperties.PickUpMessage, properties.GetPickUpMessage())); } if (properties.GetWeapon() != null) { GUILayout.BeginHorizontal(); properties.SetReplaceMessage(EditorGUILayout.TextField(ContentProperties.ReplaceMessage, properties.GetReplaceMessage())); if (UEditor.GenerateButton()) { properties.SetPickUpMessage("HOLD [{0}] TO CHANGE \"{1}\""); } GUILayout.EndHorizontal(); } else { properties.SetReplaceMessage(EditorGUILayout.TextField(ContentProperties.ReplaceMessage, properties.GetReplaceMessage())); } GUILayout.Space(10); GUILayout.Label(ContentProperties.Effects, UEditorStyles.SectionHeaderLabel); GUILayout.Space(7); AudioClip se = properties.GetSoundEffect(); UEditor.ObjectHiddenField <AudioClip>(ContentProperties.P_SoundEffect, ContentProperties.P_SoundEffect, ref se, ref useSoundEffect); properties.SetSoundEffect(useSoundEffect ? se : null); GUILayout.Space(5); UEditor.HorizontalLine(); GUILayout.Space(5); EditorGUI.BeginDisabledGroup(!properties.NameIsValid() || properties.GetClearWeapon() == null); if (UEditor.Button("Create", "Right", GUILayout.Width(70))) { weapon = CreatePickableWeapon(properties); } EditorGUI.EndDisabledGroup(); if (weapon != null && delay.WaitForSeconds()) { if (UDisplayDialogs.Message("Create Successful", "Pickable weapon was created on scene!\nSetup weapon components before start play.", "Select", "Ok")) { Selection.activeGameObject = weapon; } weapon = null; } GUILayout.Space(5); GUILayout.EndVertical(); }
private static void NewWeaponGUI() { GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Space(5); GUILayout.Label(ContentProperties.BaseOptions, UEditorStyles.SectionHeaderLabel); GUILayout.Space(7); GUILayout.BeginHorizontal(); GUILayout.Label(ContentProperties.ID, GUILayout.Width(100)); weaponID.SetID(EditorGUILayout.TextField(weaponID.GetID())); GUI.SetNextControlName(""); if (UEditor.GenerateIDButton()) { string id = System.Guid.NewGuid().ToString().ToUpper(); id = id.Replace("-", ""); weaponID.SetID(id); GUI.FocusControl(""); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(ContentProperties.DisplayName, GUILayout.Width(100)); weaponID.SetDisplayName(EditorGUILayout.TextField(weaponID.GetDisplayName())); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(ContentProperties.Description, GUILayout.Width(100)); weaponID.SetDescription(EditorGUILayout.TextArea(weaponID.GetDescription())); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(ContentProperties.Group, GUILayout.Width(100)); weaponID.SetGroup(EditorGUILayout.TextField(weaponID.GetGroup())); if (inventory != null) { GUI.SetNextControlName(ContentProperties.Group.text); if (UEditor.ListButton()) { InventoryGroup[] groups = inventory.GetGroups().ToArray(); if (groups != null && groups.Length > 0) { GenericMenu popup = new GenericMenu(); for (int i = 0; i < groups.Length; i++) { popup.AddItem(new GUIContent(groups[i].GetName()), false, (x) => { weaponID.SetGroup(x.ToString()); }, groups[i].GetName()); } popup.ShowAsContext(); } GUI.FocusControl(ContentProperties.Group.text); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(ContentProperties.Image, GUILayout.Width(100)); weaponID.SetImage((Sprite)EditorGUILayout.ObjectField(weaponID.GetImage(), typeof(Sprite), false)); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.Label(ContentProperties.DropProperties, UEditorStyles.SectionHeaderLabel); GUILayout.Space(7); DropProperties dropProperties = weaponID.GetDropProperties(); dropProperties.SetDropObject(UEditor.ObjectField <GameObject>(ContentProperties.DropObject, dropProperties.GetDropObject(), false)); dropProperties.SetForce(EditorGUILayout.FloatField(ContentProperties.Force, dropProperties.GetForce())); dropProperties.SetSoundEffect(UEditor.ObjectField <AudioClip>(ContentProperties.SoundEffect, dropProperties.GetSoundEffect(), false)); dropProperties.SetDistance(EditorGUILayout.FloatField(ContentProperties.Distance, dropProperties.GetDistance())); GUILayout.BeginHorizontal(); GUILayout.Label(ContentProperties.Rotation, GUILayout.Width(145)); dropProperties.SetRotation(EditorGUILayout.Vector3Field(GUIContent.none, dropProperties.GetRotation())); GUILayout.EndHorizontal(); weaponID.SetDropProperties(dropProperties); GUILayout.Space(5); UEditor.HorizontalLine(); GUILayout.Space(5); if (UEditor.Button("Create", "Right", GUILayout.Width(70))) { string path = EditorUtility.SaveFilePanelInProject("Create new Property", weaponID.GetDisplayName(), "", ""); if (!string.IsNullOrEmpty(path)) { string name = System.IO.Path.GetFileName(path); path = path.Replace(name, ""); ScriptableObjectUtility.CreateAsset(weaponID, path, name); OnEnable(); } } GUILayout.Space(5); GUILayout.EndVertical(); }