public override void OnInspectorGUI() { Tapestry_ItemWeaponMelee w = target as Tapestry_ItemWeaponMelee; if (ReferenceEquals(w.effectStanding, null)) { w.effectStanding = (Tapestry_Effect)ScriptableObject.CreateInstance("Tapestry_Effect"); } if (ReferenceEquals(w.effectStanding.payload, null)) { w.effectStanding.payload = (Tapestry_EffectBuilder_Payload)ScriptableObject.CreateInstance("Tapestry_EffectBuilder_Payload_Damage"); } if (startup) { pSel = ArrayUtility.IndexOf(Tapestry_Config.GetPayloadTypes().Values.ToArray(), w.effectStanding.payload.GetType()); startup = false; } GUILayout.BeginVertical("box"); pSel = w.effectStanding.DrawInspector(pSel); GUILayout.EndVertical(); base.OnInspectorGUI(); }
public override void OnInspectorGUI() { Tapestry_EffectZone e = target as Tapestry_EffectZone; if (ReferenceEquals(e.effect, null)) { e.effect = (Tapestry_Effect)ScriptableObject.CreateInstance("Tapestry_Effect"); } if (ReferenceEquals(e.effect.payload, null)) { e.effect.payload = (Tapestry_EffectBuilder_Payload)ScriptableObject.CreateInstance("Tapestry_EffectBuilder_Payload_Damage"); } if (startup) { pSel = ArrayUtility.IndexOf(Tapestry_Config.GetPayloadTypes().Values.ToArray(), e.effect.payload.GetType()); startup = false; } GUILayout.BeginVertical("box"); GUILayout.BeginHorizontal(); e.removeEffectOnTriggerLeave = EditorGUILayout.Toggle(e.removeEffectOnTriggerLeave, GUILayout.Width(12)); GUILayout.Label("Remove Effect on Trigger Leave?"); GUILayout.EndHorizontal(); toolbarActive = GUILayout.Toolbar(toolbarActive, toolbarNames); if (toolbarActive != -1) { if (toolbarNames[toolbarActive] == "Effect") { pSel = e.effect.DrawInspector(pSel); } else if (toolbarNames[toolbarActive] == "Filters") { DrawTabFilters(e); } } GUILayout.EndVertical(); DrawDefaultInspector(); }
public override void OnInspectorGUI() { Tapestry_ItemEquippable i = target as Tapestry_ItemEquippable; i.data.isHoldable = true; if (startup) { if (!ReferenceEquals(i.data.effect, null)) { if (!ReferenceEquals(i.data.effect.payload, null)) { pSel = ArrayUtility.IndexOf(Tapestry_Config.GetPayloadTypes().Values.ToArray(), i.data.effect.payload.GetType()); } } else { pSel = 0; } slotEnum = new List <string>(); foreach (Tapestry_EquipSlot es in System.Enum.GetValues(typeof(Tapestry_EquipSlot))) { if (es.ToString() != "LeftHand" && es.ToString() != "RightHand") { slotEnum.Add(es.ToString()); } } startup = false; } string displayTooltip = "What string will display on the player's HUD when looking at this object.", prefabTooltip = "What is the name of the prefab (placed in the Resources/Items folder) that should be instantiated when this object is dropped in world?\n\nGenerally this should be the object's in-world name, rather than its display name.", interactableTooltip = "Can the player take this object to their inventory?", displayNameTooltip = "Should the object still show its display name when the player's cursor is hovering over the object?", valueTooltip = "How valuable is this object?", slotTooltip = "What slot should this object go into when equipped?"; GUILayout.BeginVertical("box"); GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent("Display Name", displayTooltip)); GUILayout.FlexibleSpace(); i.displayName = EditorGUILayout.DelayedTextField(i.displayName, GUILayout.Width(270)); i.data.displayName = i.displayName; GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent("Prefab Name", prefabTooltip)); GUILayout.FlexibleSpace(); i.data.prefabName = EditorGUILayout.DelayedTextField(i.data.prefabName, GUILayout.Width(270)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); i.isInteractable = EditorGUILayout.Toggle(i.isInteractable, GUILayout.Width(12)); GUILayout.Label(new GUIContent("Takeable?", interactableTooltip)); GUILayout.Space(20); if (!i.isInteractable) { i.displayNameWhenUnactivatable = EditorGUILayout.Toggle(i.displayNameWhenUnactivatable, GUILayout.Width(12)); GUILayout.Label(new GUIContent("Display Name Anyway?", displayNameTooltip)); GUILayout.FlexibleSpace(); } GUILayout.FlexibleSpace(); GUILayout.Label(new GUIContent("Value", valueTooltip)); i.data.value = EditorGUILayout.DelayedIntField(i.data.value, GUILayout.Width(50)); GUILayout.EndHorizontal(); slotEnumSelection = i.data.slot.ToString(); int enumIndex = slotEnum.IndexOf(slotEnumSelection); GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent("Slot", slotTooltip), GUILayout.Width(42)); slotEnumSelection = slotEnum[EditorGUILayout.Popup(enumIndex, slotEnum.ToArray(), GUILayout.Width(122))]; GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); i.data.slot = (Tapestry_EquipSlot)System.Enum.Parse(typeof(Tapestry_EquipSlot), slotEnumSelection); GUILayout.EndVertical(); DrawSubTabItemData(i); DrawSubTabEffect(i); DrawSubTabKeywords(i); }
public override void OnInspectorGUI() { Tapestry_Item i = target as Tapestry_Item; if (startup) { if (!ReferenceEquals(i.data.effect, null)) { if (!ReferenceEquals(i.data.effect.payload, null)) { pSel = ArrayUtility.IndexOf(Tapestry_Config.GetPayloadTypes().Values.ToArray(), i.data.effect.payload.GetType()); } } else { pSel = 0; } startup = false; } string displayTooltip = "What string will display on the player's HUD when looking at this object.", prefabTooltip = "What is the name of the prefab (placed in the Resources/Items folder) that should be instantiated when this object is dropped in world?\n\nGenerally this should be the object's in-world name, rather than its display name.", interactableTooltip = "Can the player take this object to their inventory?", displayNameTooltip = "Should the object still show its display name when the player's cursor is hovering over the object?", valueTooltip = "How valuable is this object?"; GUILayout.BeginVertical("box"); GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent("Display Name", displayTooltip)); GUILayout.FlexibleSpace(); i.displayName = EditorGUILayout.DelayedTextField(i.displayName, GUILayout.Width(270)); i.data.displayName = i.displayName; GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(new GUIContent("Prefab Name", prefabTooltip)); GUILayout.FlexibleSpace(); i.data.prefabName = EditorGUILayout.DelayedTextField(i.data.prefabName, GUILayout.Width(270)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); i.isInteractable = EditorGUILayout.Toggle(i.isInteractable, GUILayout.Width(12)); GUILayout.Label(new GUIContent("Takeable?", interactableTooltip)); GUILayout.Space(20); if (!i.isInteractable) { i.displayNameWhenUnactivatable = EditorGUILayout.Toggle(i.displayNameWhenUnactivatable, GUILayout.Width(12)); GUILayout.Label(new GUIContent("Display Name Anyway?", displayNameTooltip)); GUILayout.FlexibleSpace(); } GUILayout.FlexibleSpace(); GUILayout.Label(new GUIContent("Value", valueTooltip)); i.data.value = EditorGUILayout.DelayedIntField(i.data.value, GUILayout.Width(50)); GUILayout.EndHorizontal(); GUILayout.EndVertical(); DrawSubTabItemData(i); DrawSubTabEffect(i); DrawSubTabKeywords(i); }
public int DrawInspector(int pSel) { if (ReferenceEquals(payload, null)) { payload = (Tapestry_EffectBuilder_Payload_Damage)ScriptableObject.CreateInstance("Tapestry_EffectBuilder_Payload_Damage"); } if (ReferenceEquals(keywords, null)) { keywords = (Tapestry_KeywordRegistry)ScriptableObject.CreateInstance("Tapestry_KeywordRegistry"); } Dictionary <string, Type> payloads = Tapestry_Config.GetPayloadTypes(); GUIStyle title = new GUIStyle(); title.fontStyle = FontStyle.Bold; title.fontSize = 14; EditorGUILayout.BeginVertical("box"); GUILayout.BeginHorizontal(); GUILayout.Label("Effect", title, GUILayout.Width(60)); displayName = EditorGUILayout.DelayedTextField(displayName); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(65); canBeStacked = EditorGUILayout.Toggle(canBeStacked, GUILayout.Width(12)); GUILayout.Label("Can be stacked?"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); EditorGUILayout.BeginVertical("box"); EditorGUILayout.BeginHorizontal(); GUILayout.Label("Duration", title); GUILayout.FlexibleSpace(); if (payload.mustBeInstant) { duration = Tapestry_EffectBuilder_Duration.Instant; EditorGUILayout.Popup(0, new string[] { "Instant" }); } else { duration = (Tapestry_EffectBuilder_Duration)EditorGUILayout.EnumPopup(duration); } EditorGUILayout.EndHorizontal(); if (duration == Tapestry_EffectBuilder_Duration.Timed) { payload.exposeTimeControls = true; EditorGUILayout.BeginHorizontal("box"); GUILayout.Space(40); decayTime = EditorGUILayout.DelayedFloatField(decayTime, GUILayout.Width(42)); GUILayout.Label("Seconds"); GUILayout.FlexibleSpace(); EditorGUILayout.EndHorizontal(); } else if (duration == Tapestry_EffectBuilder_Duration.Permanent) { payload.exposeTimeControls = true; } else { payload.exposeTimeControls = false; } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical("box"); EditorGUILayout.BeginHorizontal(); GUILayout.Label("Payload", title); GUILayout.FlexibleSpace(); pSel = EditorGUILayout.Popup(pSel, payloads.Keys.ToArray()); EditorGUILayout.EndHorizontal(); Type pType = payloads[payloads.Keys.ToArray()[pSel]]; if (ReferenceEquals(payload, null) || payload.GetType() != pType) { payload = (Tapestry_EffectBuilder_Payload)ScriptableObject.CreateInstance(pType.ToString()); } payload.DrawInspector(); EditorGUILayout.EndVertical(); keywords.DrawInspector(); EditorGUILayout.EndVertical(); //if (GUILayout.Button("save")) //{ // AssetDatabase.CreateAsset(this, "Assets/Prefabs/Tapestry/Effects/" + displayName + ".asset"); //} return(pSel); }