/// <summary> /// Draw fields for an item /// </summary> private static void DrawItemFields() { HeroKitCommon.DrawItemDropdown(intFields, "Element Type", 0, HeroKitCommon.elementTypeDatabase); HeroKitCommon.BasicFieldsB(stringFields, 0, 1); }
/// <summary> /// Add item at end of list. /// </summary> private static void addItem() { HeroKitCommon.deselectField(); items.Add(new HeroEvent()); }
// -------------------------------------------------------------- // Methods (Fields) // -------------------------------------------------------------- /// <summary> /// A field for a hero property file. /// </summary> private static void DrawItemType() { SimpleLayout.BeginHorizontal(); SimpleLayout.Label("Item Type:"); SimpleLayout.Space(13); propertyBlock.propertyTemplate = SimpleLayout.ObjectField(propertyBlock.propertyTemplate, HeroKitCommon.GetWidthForField(120)); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); // SHOW FIELDS FOR SPECIFIC HERO PROPERTY // if hero property has been removed, sanitize properties list if (propertyBlock.propertyTemplate != null) { SimpleLayout.Space(5); SimpleLayout.Line(); } else { propertyBlock.itemProperties = new HeroList(); } }
/// <summary> /// Draw fields for an item /// </summary> private static void DrawItemFields() { HeroKitCommon.BasicFieldsB(stringFields, 0, 1); }
/// <summary> /// Button to add a new item to list. /// </summary> public static void addItemButton() { HeroKitCommon.DrawAddNewItem(blockName, addItem, Button.StyleAddMenuItem, 11); }
/// <summary> /// Delete an item and replace it with this item. /// </summary> /// <param name="obj">The other item.</param> public static void pasteItemHere(object obj) { int index = (int)obj; HeroKitCommon.pasteItemHere(items, savedFieldList, index); }
/// <summary> /// Delete an item. /// </summary> /// <param name="object">The item.</param> private static void deleteItem(object obj) { int index = (int)obj; HeroKitCommon.deleteItem(items, deletedFields, deletedFieldsIndex, blockName, index); }
public static void CreateMaterial() { HeroKitCommon.CreateHeroKitProjectFolders(); }
public static HeroObject Create() { return(HeroKitCommon.AddHeroObjectToFolder(true)); }
/// <summary> /// Add item at specific position in the list. /// </summary> /// <param name="index">Index in list where item should be added.</param> public static void addItem(int index) { HeroKitCommon.deselectField(); items.Insert(index, new HeroAction()); }
// -------------------------------------------------------------- // Properties // -------------------------------------------------------------- private static HeroProperties getHeroProperties() { return(HeroKitCommon.getHeroProperties(HeroKitCommon.ammunitionTypeProperties)); }
/// <summary> /// Add item at end of list. /// </summary> private static void addItem() { HeroKitCommon.addItem(items, getHeroProperties()); HeroKitCommon.addItem(attributes, getAttributeProperties()); }
private static HeroProperties getAttributeProperties() { return(HeroKitCommon.getHeroProperties(HeroKitCommon.attributeProperties)); }
// -------------------------------------------------------------- // Properties // -------------------------------------------------------------- private static HeroProperties getHeroProperties() { return(HeroKitCommon.getHeroProperties(HeroKitCommon.subclassProperties)); }
/// <summary> /// Add item below another item in the list. /// </summary> /// <param name="obj">The other item.</param> public static void addItemBelow(object obj) { int index = (int)obj + 1; HeroKitCommon.addItem(items, getHeroProperties(), index); }
public static HeroObject Create() { return(HeroKitCommon.CreateHeroObject()); }
/// <summary> /// Copy an item. /// </summary> /// <param name="obj">The item.</param> private static void copyItem(object obj) { int index = (int)obj; savedFieldList = HeroKitCommon.copyItem(items, savedFieldList, index); }
public static HeroKitProperty Create() { return(HeroKitCommon.AddHeroPropertyToFolder(true)); }
/// <summary> /// Delete item at end of list. /// </summary> private static void deleteItem() { int index = items.Count - 1; HeroKitCommon.deleteItem(items, deletedFields, deletedFieldsIndex, blockName, index); }
public static HeroKitAction Create() { return(HeroKitCommon.AddHeroActionToFolder(true)); }
/// <summary> /// Restore the last item that was deleted from the list. /// </summary> private static void restoreItem(object obj) { HeroKitCommon.restoreItem(items, deletedFields, deletedFieldsIndex); }
// -------------------------------------------------------------- // Properties // -------------------------------------------------------------- private static HeroProperties getHeroProperties() { return(HeroKitCommon.getHeroProperties(HeroKitCommon.meterProperties)); }
// -------------------------------------------------------------- // Action Fields // -------------------------------------------------------------- /// <summary> /// Get a value from a unity object field. /// This is for a field that contains Value, Variable, Property, Global. /// </summary> /// <typeparam name="T">The type of unity object.</typeparam> /// <param name="title">Title for action field.</param> /// <param name="actionParams">Action field parameters.</param> /// <param name="actionField">Action field.</param> /// <param name="titleToLeft">Show the title on the left?</param> /// <returns></returns> public static T BuildFieldA <T>(string title, HeroActionParams actionParams, HeroActionField actionField, bool titleToLeft = false) where T : Object { // create the fields UnityObjectFieldData data = CreateFieldData(title, actionField, actionParams.heroObject); //----------------------------------------- // Display this title above the field //----------------------------------------- if (data.title != "" && !titleToLeft) { SimpleLayout.Label(data.title); } SimpleLayout.BeginHorizontal(); if (data.title != "" && titleToLeft) { SimpleLayout.Label(data.title); } //----------------------------------------- // Get the type of field you want to work with. //----------------------------------------- data.fieldType = new HeroField.ValueTypeField().SetValues(data.fieldType, 0); //----------------------------------------- // Get the type of game object we are working with // Option 1: This game object (game object that this hero object is attached to) // Option 2: Another game object (another game object in the scene that has a hero object attached to it) //----------------------------------------- if (data.fieldType == 2 || data.fieldType == 3) { data = ActionCommon.GetTargetHeroObject(data); } //----------------------------------------- // Get the integer list you want to work with. // The integer list is in hero object editor > Variables //----------------------------------------- // if this is a field, draw field (1=value) if (data.fieldType == 1) { data.fieldValue = SimpleLayout.ObjectField(data.fieldValue as T, HeroKitCommon.GetWidthForField(135)); SetScene(ref data); } // if this is a list, draw ints (2=variables, 3=properties) if (data.fieldType != 1) { data = SetPropertyID(data, -1); List <UnityObjectField> items = GetItemsFromList(data, -1); data = BuildItemFieldList(data, items); } //----------------------------------------- // assign values back to hero object fields //----------------------------------------- actionField.ints[0] = data.objectType; actionField.ints[1] = data.objectID; actionField.ints[2] = data.fieldID; actionField.ints[3] = data.fieldType; actionField.ints[4] = data.heroGUID; actionField.ints[6] = data.propertyID; actionField.heroObjects[0] = data.targetHeroObject; actionField.strings[0] = data.objectName; actionField.unityObjects[0] = data.fieldValue; actionField.ints[5] = data.sceneID; actionField.strings[1] = data.sceneName; //----------------------------------------- // Visual stuff //----------------------------------------- SimpleLayout.Space(); SimpleLayout.EndHorizontal(); return(data.fieldValue as T); }
// -------------------------------------------------------------- // Methods (On Click State in Menu) // -------------------------------------------------------------- /// <summary> /// Show the state in the canvas window. /// </summary> /// <param name="itemID">ID of the state.</param> public static void showBlockContent(int itemID) { HeroKitCommon.ResetCanvasContent(); HeroKitMenuBlock.itemFocus = true; HeroKitMenuBlock.itemID = itemID; }
// -------------------------------------------------------------- // Methods (On Click Event in Menu) // -------------------------------------------------------------- /// <summary> /// Toggle the event menu block on and off. /// </summary> /// <param name="i">ID assigned to the event.</param> private static void toggleBlock(int i) { HeroKitCommon.deselectField(); HeroKitCommon.toggleBool(ref heroObject.states.states[stateIndex].heroEvent[i].visible); }
/// <summary> /// Move item down. /// </summary> /// <param name="obj">Item to move down.</param> private static void moveItemDown(object obj) { int index = (int)obj; HeroKitCommon.moveItemDown(items, index); }
/// <summary> /// Add item at specific position in the list. /// </summary> /// <param name="index">Index in list where item should be added.</param> private static void addItem(int index) { HeroKitCommon.deselectField(); items.Insert(index, new HeroEvent()); }
/// <summary> /// Add item at end of list. /// </summary> private static void addItem() { HeroKitCommon.addItem(items, getHeroProperties()); }
/// <summary> /// Fields for the hero property (unity objects). /// </summary> private static void DrawUnityObjects() { List <UnityObjectField> items = propertyBlock.itemProperties.unityObjects.items; // exit early if there are no values if (items == null || items.Count == 0) { return; } SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB); for (int i = 0; i < items.Count; i++) { SimpleLayout.Label(items[i].name + ":"); switch (items[i].objectType) { case 1: // audio items[i].value = SimpleLayout.ObjectField(items[i].value as AudioClip, HeroKitCommon.GetWidthForField(60, 150)); break; case 2: // sprite items[i].value = SimpleLayout.ObjectField(items[i].value as Sprite, HeroKitCommon.GetWidthForField(60, 150)); break; case 3: // scene items[i].value = SimpleLayout.ObjectField(items[i].value as SceneAsset, HeroKitCommon.GetWidthForField(60, 150)); if (items[i].value != null) { // add the scene to the editor build settings if it doesn't already exist there. HeroKitCommon.AddSceneToBuildSettings(items[i].value as SceneAsset); } break; case 4: // particle system items[i].value = SimpleLayout.ObjectField(items[i].value as ParticleSystem, HeroKitCommon.GetWidthForField(60, 150)); break; case 5: // script items[i].value = SimpleLayout.ObjectField(items[i].value as MonoScript, HeroKitCommon.GetWidthForField(60, 150)); break; } } SimpleLayout.EndVertical(); }
/// <summary> /// Restore the last item that was deleted from the list. /// </summary> private static void restoreItem(object obj) { HeroKitCommon.restoreItem(items, deletedFields, deletedFieldsIndex); HeroKitCommon.restoreItem(attributes, deletedAttributes, deletedAttributesIndex); HeroKitCommon.restoreItem(states, deletedStates, deletedStatesIndex); }