// -------------------------------------------------------------- // Action Fields // -------------------------------------------------------------- /// <summary> /// Get a layer mask. /// </summary> /// <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> public static void BuildField(string title, HeroActionParams actionParams, HeroActionField actionField, bool titleToLeft = false) { // create the fields LayerMaskValueData 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 bool list you want to work with. // The bool list is in hero object editor > Variables //----------------------------------------- data.fieldValue = SimpleLayout.LayerMaskField(data.fieldValue, 200); //----------------------------------------- // assign values back to hero object fields //----------------------------------------- actionField.ints[0] = data.fieldValue; //----------------------------------------- // Visual stuff //----------------------------------------- SimpleLayout.Space(); SimpleLayout.EndHorizontal(); }
// -------------------------------------------------------------- // Action Fields // -------------------------------------------------------------- /// <summary> /// Get a hero property. /// </summary> /// <param name="title">Title for action field.</param> /// <param name="actionParams">Action field parameters.</param> /// <param name="actionField">Action field.</param> public static void BuildField(string title, HeroActionParams actionParams, HeroActionField actionField) { // create the fields HeroPropertyFieldData data = CreateFieldData(title, actionField, actionParams.heroObject); //----------------------------------------- // Display this title above the field //----------------------------------------- if (data.title != "") { SimpleLayout.Label(data.title); } SimpleLayout.BeginHorizontal(); //----------------------------------------- // Get the integer list you want to work with. // The integer list is in hero object editor > Variables //----------------------------------------- data.fieldValue = SimpleLayout.ObjectField(data.fieldValue, 200); //----------------------------------------- // assign values back to hero object fields //----------------------------------------- actionField.heroProperties[0] = data.fieldValue; //----------------------------------------- // Visual stuff //----------------------------------------- SimpleLayout.Space(); SimpleLayout.EndHorizontal(); }
/// <summary> /// Draw the body of the block. /// </summary> private static void DrawItems() { if (!heroObject.propertiesList.visible) { return; } // exit early if there are no items if (items == null || items.Count == 0) { return; } // display items for (int i = 0; i < items.Count; i++) { // get the box to draw around the foldout GUIStyle style = Box.StyleDefault; GUIStyle buttonStyle = Button.StyleFoldoutText; if (HeroObjectMenuBlock.propertyFocus && HeroObjectMenuBlock.propertyID == i) { style = Box.StyleMenuSelected; buttonStyle = Button.StyleFoldoutTextB; } string templateName = (items[i].propertyTemplate != null) ? items[i].propertyTemplate.name : "[none]"; // show foldout SimpleLayout.BeginHorizontal(style); SimpleLayout.Space(indentMenu); SimpleLayout.Button(blockName + " " + i + ": " + templateName, showBlockContent, showContextMenu, i, buttonStyle); SimpleLayout.EndHorizontal(); } }
/// <summary> /// Draw the body of the block. /// </summary> private static void DrawItems() { // exit early if there are no items if (items == null || items.Count == 0) { HeroKitCommon.DrawNoItemsInList(blockName); return; } SimpleLayout.BeginVertical(Box.StyleCanvasBox); // display items (move up, move down, int field, for (int i = 0; i < items.Count; i++) { SimpleLayout.BeginHorizontal(); HeroKitCommon.DrawListArrows(moveItemUp, moveItemDown, i); items[i].value = SimpleLayout.BoolListField(items[i], i); items[i].name = SimpleLayout.StringListField(items[i].name, HeroKitCommon.GetWidthForField(289)); HeroKitCommon.DrawListButtons(addItem, copyItem, pasteItem, deleteItem, i); SimpleLayout.EndHorizontal(); if (i != items.Count - 1) { SimpleLayout.Line(); } } SimpleLayout.EndVertical(); SimpleLayout.Space(20); }
private static void DrawTimerEndCond() { SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB); SimpleLayout.BeginHorizontal(); boolFields[0].value = SimpleLayout.BoolField(boolFields[0].value); SimpleLayout.Label("Turn off condition with timer"); SimpleLayout.EndHorizontal(); if (boolFields[0].value) { SimpleLayout.Line(); // list of stat change types DropDownValues changeTypeValues = new DropDownValues(); string[] changeType = { "Seconds", "Minutes", "Hours" }; changeTypeValues.setValues("", changeType); SimpleLayout.BeginHorizontal(); intFields[0].value = SimpleLayout.DropDownList(intFields[0].value, changeTypeValues, 0, 150); intFields[1].value = SimpleLayout.IntField(intFields[1].value, 150); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); } SimpleLayout.EndVertical(); }
/// <summary> /// Draw item type /// </summary> private static void DrawUsesAmmo() { SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB); SimpleLayout.BeginHorizontal(); SimpleLayout.Label("Uses Ammunition" + ":"); boolFields[3].value = SimpleLayout.BoolField(boolFields[3].value); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); if (boolFields[3].value) { SimpleLayout.Space(5); SimpleLayout.Line(); // item type field DropDownValues itemList = HeroKitCommon.databaseList(HeroKitCommon.ammunitionTypeDatabase); SimpleLayout.BeginHorizontal(); intFields[2].value = SimpleLayout.DropDownList(intFields[2].value, itemList, 0, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 200)); SimpleLayout.Label("Ammunition type"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); SimpleLayout.BeginHorizontal(); intFields[3].value = SimpleLayout.IntField(intFields[3].value); SimpleLayout.Label("Range (in meters)"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); } SimpleLayout.EndVertical(); }
/// <summary> /// Draw item type /// </summary> private static void DrawTarget2() { SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB); SimpleLayout.BeginHorizontal(); SimpleLayout.Label("Uses Ammunition" + ":"); boolFields[3].value = SimpleLayout.BoolField(boolFields[3].value); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); if (boolFields[3].value) { SimpleLayout.Space(5); SimpleLayout.Line(); // item type field string[] items = { "Another Character", "Caster" }; DropDownValues itemList = new DropDownValues(); itemList.setValues("", items); SimpleLayout.BeginHorizontal(); intFields[1].value = SimpleLayout.DropDownList(intFields[1].value, itemList, 0, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 200)); SimpleLayout.Label("Target"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); SimpleLayout.BeginHorizontal(); intFields[17].value = SimpleLayout.IntField(intFields[17].value); SimpleLayout.Label("Range (in meters)"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); } SimpleLayout.EndVertical(); }
/// <summary> /// Draw exp meter /// </summary> private static void DrawExpMeter() { SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB); SimpleLayout.BeginHorizontal(); boolFields[6].value = SimpleLayout.BoolField(boolFields[6].value); SimpleLayout.Label("Ability has Experience Meter"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); if (boolFields[6].value) { SimpleLayout.BeginHorizontal(); intFields[11].value = SimpleLayout.IntField(intFields[11].value); SimpleLayout.Label("Experience gained per use of this ability"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); SimpleLayout.BeginHorizontal(); intFields[10].value = SimpleLayout.IntField(intFields[10].value); SimpleLayout.Label("Experience needed to morph ability"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); DropDownValues itemList = HeroKitCommon.databaseList(HeroKitCommon.abilityDatabase); SimpleLayout.BeginHorizontal(); intFields[12].value = SimpleLayout.DropDownList(intFields[12].value, itemList, 0, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 250)); SimpleLayout.Label("Morph into..."); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); } SimpleLayout.EndVertical(); }
//-------------------------------------- // Methods (Draw Hero Action Windows) //-------------------------------------- /// <summary> /// Draw the title window inside the hero kit editor (hero action). /// </summary> /// <param name="id">ID assigned to the GUI Window</param> private void DrawTitleWindowHeroAction(int id) { SimpleLayout.BeginHorizontal(Box.StyleTitleWindow); TitleBlock.Block(heroKitAction.name, 1); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); }
// -------------------------------------------------------------- // Action Fields // -------------------------------------------------------------- /// <summary> /// Get values from a drop-down field. /// </summary> /// <typeparam name="T">The HeroList type.</typeparam> /// <param name="title">Title for action field.</param> /// <param name="actionParams">Action field parameters.</param> /// <param name="actionField">Action field.</param> /// <param name="dropDownField">A hero list.</param> /// <param name="titleToLeft">Show the title on the left?</param> /// <returns>The selected item in the drop-down list field</returns> public static int BuildField <T>(string title, HeroActionParams actionParams, HeroActionField actionField, T dropDownField, bool titleToLeft = false) where T : IDropDownList { DropDownFieldData data = CreateFieldData(title, actionField); //----------------------------------------- // Display this title above the field //----------------------------------------- if (data.title != "" && !titleToLeft) { SimpleLayout.Label(data.title); } SimpleLayout.BeginHorizontal(); if (data.title != "" && titleToLeft) { SimpleLayout.Label(data.title); } //----------------------------------------- // Display the operator field //----------------------------------------- actionField.ints[0] = dropDownField.SetValues(data.fieldID, 0); //----------------------------------------- // Visual stuff //----------------------------------------- SimpleLayout.Space(); SimpleLayout.EndHorizontal(); return(actionField.ints[0]); }
// -------------------------------------------------------------- // Action Fields // -------------------------------------------------------------- /// <summary> /// Get values from a drop-down field. /// </summary> /// <typeparam name="T">The HeroList type.</typeparam> /// <typeparam name="U">The items for the HeroList type.</typeparam> /// <param name="title">Title for action field.</param> /// <param name="actionParams">Action field parameters.</param> /// <param name="actionField">Action field.</param> /// <param name="dropDownField">A hero list.</param> /// <param name="items">The items for the hero list.</param> /// <returns>The selected item in the drop-down list field</returns> public static int BuildField <T, U>(string title, HeroActionParams actionParams, HeroActionField actionField, T dropDownField, List <U> items) where T : IDropDownListB <U> { DropDownBFieldData data = CreateFieldData(title, actionField); //----------------------------------------- // Display this title above the field //----------------------------------------- if (data.title != "") { SimpleLayout.Label(data.title); } SimpleLayout.BeginHorizontal(); //----------------------------------------- // Display the drop down field //----------------------------------------- actionField.ints[0] = dropDownField.SetValues(data.fieldID, items, 0); //----------------------------------------- // Visual stuff //----------------------------------------- SimpleLayout.Space(); SimpleLayout.EndHorizontal(); //----------------------------------------- // Return ID of item selected in the drop down field //----------------------------------------- return(actionField.ints[0]); }
/// <summary> /// Draw item type /// </summary> private static void DrawRange() { // item type field string[] items = { "Projectile launched at target", "Everything within radius around Caster", "Directly on Target" }; DropDownValues itemList = new DropDownValues(); itemList.setValues("", items); SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB); SimpleLayout.BeginHorizontal(); intFields[2].value = SimpleLayout.DropDownList(intFields[2].value, itemList, 0, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 200)); SimpleLayout.Label("How ability is used"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); // projectile or radius if (intFields[2].value == 1 || intFields[2].value == 2) { SimpleLayout.BeginHorizontal(); intFields[3].value = SimpleLayout.IntField(intFields[3].value); SimpleLayout.Label("Range (in meters)"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); } // projectile if (intFields[2].value == 1) { SimpleLayout.BeginHorizontal(); intFields[4].value = SimpleLayout.IntField(intFields[4].value); SimpleLayout.Label("Speed of projectile"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); // particle effect on target SimpleLayout.BeginHorizontal(); uoFields[3].value = SimpleLayout.ObjectField(uoFields[3].value as ParticleSystem, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 200)); SimpleLayout.Label("Particle effect for projectile"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); } // particle effect on target SimpleLayout.BeginHorizontal(); uoFields[2].value = SimpleLayout.ObjectField(uoFields[2].value as ParticleSystem, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 200)); SimpleLayout.Label("Particle effect on target"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); // particle effect on caster SimpleLayout.BeginHorizontal(); uoFields[1].value = SimpleLayout.ObjectField(uoFields[1].value as ParticleSystem, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 200)); SimpleLayout.Label("Particle effect on caster"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); SimpleLayout.EndVertical(); }
/// <summary> /// Get a value from a bool field in a hero object template. /// This is for a field that contains Variable, Property, Global. /// </summary> /// <param name="title">Title for action field.</param> /// <param name="actionParams">Action field parameters.</param> /// <param name="actionField">Action field.</param> /// <param name="heroObject">Hero object that is the target of this action.</param> /// <param name="titleToLeft">Show the title on the left?</param> public static void BuildFieldC(string title, HeroActionParams actionParams, HeroActionField actionField, HeroObject heroObject, bool titleToLeft = false) { // create the fields BoolFieldData 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.ValueTypeFieldB().SetValues(data.fieldType, 0); //----------------------------------------- // Get the type of game object we are working with // Option 1: This game object // Option 2: Another game object in the Game Object list attached to this game object // Option 3: Another game object in the scene //----------------------------------------- data.targetHeroObject = heroObject; //----------------------------------------- // Get the bool list you want to work with. // The bool list is in hero object editor > Variables //----------------------------------------- data = SetPropertyID(data); List <BoolField> items = GetItemsFromList(data); 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[5] = data.propertyID; actionField.heroObjects[0] = data.targetHeroObject; actionField.strings[0] = data.objectName; actionField.bools[0] = data.fieldValue; //----------------------------------------- // Visual stuff //----------------------------------------- SimpleLayout.Space(); SimpleLayout.EndHorizontal(); }
//-------------------------------------- // Methods (Draw Hero Property Windows) //-------------------------------------- /// <summary> /// Draw the title window inside the hero kit editor (hero property). /// </summary> /// <param name="id">ID assigned to the GUI Window</param> private void DrawTitleWindowHeroProperty(int id) { SimpleLayout.BeginHorizontal(Box.StyleTitleWindow); TitleBlock.Block(heroKitProperty.name, 2); SimpleLayout.Space(); TitleButtonBlock.Block(true); SimpleLayout.EndHorizontal(); }
/// <summary> /// Button to add a new item to list. /// </summary> public static void AddItemButton() { SimpleLayout.BeginHorizontal(); SimpleLayout.Space(indentMenu - 3); HeroKitCommon.DrawAddNewItem("Action", addItem, Button.StyleAddMenuItem, -2); SimpleLayout.EndHorizontal(); SimpleLayout.Space(3); }
// -------------------------------------------------------------- // Methods (Draw Hero Object Windows) // -------------------------------------------------------------- /// <summary> /// Draw the title window inside the hero kit editor (hero object). /// </summary> /// <param name="id">ID assigned to the GUI Window</param> private void DrawTitleWindowHeroObject(int id) { SimpleLayout.BeginHorizontal(Box.StyleTitleWindow); TitleBlock.Block(heroObject.name, 0); SimpleLayout.Space(); TitleButtonBlock.Block(); SimpleLayout.EndHorizontal(); }
/// <summary> /// Draw the body. /// </summary> private static void DrawBody() { // draw all fields SimpleLayout.BeginVertical(Box.StyleCanvasBox); DrawItemFields(); SimpleLayout.Space(500); SimpleLayout.EndVertical(); }
/// <summary> /// Draw the block. /// </summary> private static void DrawBlock() { DrawItems(); SimpleLayout.BeginHorizontal(); SimpleLayout.Space(indentMenu - 12); addItemButton(); SimpleLayout.EndHorizontal(); }
/// <summary> /// Button to add a new item to list. /// </summary> public static void addItemButton() { if (!heroObject.states.visible) { return; } HeroKitCommon.DrawAddNewItem("State", addItem, Button.StyleAddMenuItem, indentMenu); SimpleLayout.Space(5); }
/// <summary> /// Get an animation from a legacy animation component. /// </summary> /// <param name="title">Title for action field.</param> /// <param name="actionParams">Action field parameters.</param> /// <param name="actionField">Action field.</param> /// <param name="heroObject">Hero object that is the target of this action.</param> /// <param name="stateID">ID of the state that contains the animation controller.</param> /// <param name="titleToLeft">Show the title on the left?</param> /// <returns>The animation controller.</returns> public static Animation BuildFieldA_Legacy(string title, HeroActionParams actionParams, HeroActionField actionField, HeroObject heroObject, int stateID, bool titleToLeft = false) { // create the fields AnimationParameterFieldData data = CreateFieldData(title, actionField); //----------------------------------------- // 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 animation controller we are working with //----------------------------------------- Animation animation = null; if (heroObject.states.states[stateID].heroVisuals.prefab != null) { animation = heroObject.states.states[stateID].heroVisuals.prefab.GetComponent <Animation>(); } if (animation == null) { SimpleLayout.Space(); SimpleLayout.EndHorizontal(); return(null); } //----------------------------------------- // Get the triggers we want to work with //----------------------------------------- List <string> items = GetItemsFromList_Legacy(animation); data = BuildItemFieldList(data, items); //----------------------------------------- // assign values back to hero object fields //----------------------------------------- actionField.ints[0] = data.fieldID; actionField.strings[0] = data.fieldName; //----------------------------------------- // Visual stuff //----------------------------------------- SimpleLayout.Space(); SimpleLayout.EndHorizontal(); return(animation); }
/// <summary> /// Draw item type /// </summary> private static void DrawIsTwoHanded() { SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB); SimpleLayout.BeginHorizontal(); SimpleLayout.Label("Two-Handed Weapon" + ":"); boolFields[2].value = SimpleLayout.BoolField(boolFields[2].value); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); SimpleLayout.EndVertical(); }
/// <summary> /// Draw item type /// </summary> private static void DrawAttackSpeed() { SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB); SimpleLayout.BeginHorizontal(); intFields[1].value = SimpleLayout.IntField(intFields[1].value); SimpleLayout.Label("Pause time between attacks"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); SimpleLayout.EndVertical(); }
/// <summary> /// Draw the button in the block. /// </summary> private static void DrawButton() { GUILayout.BeginVertical(); SimpleLayout.Space(10); GUILayout.BeginHorizontal(); SimpleLayout.Button(Content.MenuIcon, clickOptionsButton, Button.StyleA, 25); GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
/// <summary> /// Draw the block. /// </summary> private static void DrawBlock() { DrawListItem("Integers", 0); DrawListItem("Floats", 5); DrawListItem("Bools", 1); DrawListItem("Strings", 2); DrawListItem("Game Objects", 3); DrawListItem("Hero Objects", 4); DrawListItem("Unity Objects", 6); SimpleLayout.Space(5); }
// -------------------------------------------------------------- // Action Fields // -------------------------------------------------------------- /// <summary> /// Get an animation controller. /// </summary> /// <param name="title">Title for action field.</param> /// <param name="actionParams">Action field parameters.</param> /// <param name="actionField">Action field.</param> /// <param name="heroObject">Hero object that is the target of this action.</param> /// <param name="stateID">ID of the state that contains the animation controller.</param> /// <param name="paramType">Animation controller parameter type.</param> /// <param name="titleToLeft">Show the title on the left?</param> /// <returns>The animation controller.</returns> public static RuntimeAnimatorController BuildFieldA(string title, HeroActionParams actionParams, HeroActionField actionField, HeroObject heroObject, int stateID, AnimatorControllerParameterType paramType, bool titleToLeft = false) { // create the fields AnimationParameterFieldData data = CreateFieldData(title, actionField); //----------------------------------------- // 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 animation controller we are working with //----------------------------------------- RuntimeAnimatorController animatorController = heroObject.states.states[stateID].heroVisuals.animatorController; if (animatorController == null) { SimpleLayout.Space(); SimpleLayout.EndHorizontal(); return(null); } //----------------------------------------- // Get the triggers we want to work with //----------------------------------------- List <string> items = GetItemsFromList(animatorController, paramType); data = BuildItemFieldList(data, items); //----------------------------------------- // assign values back to hero object fields //----------------------------------------- actionField.ints[0] = data.fieldID; actionField.strings[0] = data.fieldName; //----------------------------------------- // Visual stuff //----------------------------------------- SimpleLayout.Space(); SimpleLayout.EndHorizontal(); return(animatorController); }
/// <summary> /// Get a value from a hero object field in a hero object template. /// This is for a field that contains Variable, Property, Global. /// </summary> /// <param name="title">Title for action field.</param> /// <param name="actionParams">Action field parameters.</param> /// <param name="actionField">Action field.</param> /// <param name="heroObject">Hero object that is the target of this action.</param> /// <param name="titleToLeft">Show the title on the left?</param> public static HeroObject BuildFieldC(string title, HeroActionParams actionParams, HeroActionField actionField, bool titleToLeft = false) { HeroObjectFieldData 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); } else { SimpleLayout.Space(8); } //----------------------------------------- // Get the type of object we are working with // Option 1: This object (object that this hero object is attached to) // Option 2: Another object (another object in the scene that has a hero object attached to it) //----------------------------------------- SimpleLayout.Space(-8); data = ActionCommon.GetTargetHeroTemplate(data); //----------------------------------------- // assign values back to hero object fields //----------------------------------------- actionField.heroObjects[0] = data.targetHeroObject; 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[5] = data.propertyID; actionField.strings[0] = data.objectName; //----------------------------------------- // Visual stuff //----------------------------------------- SimpleLayout.Space(); SimpleLayout.EndHorizontal(); return(data.targetHeroObject); }
/// <summary> /// Draw the body of the block. /// </summary> private static void DrawItems() { // exit early if there are no items if (items == null || items.Count == 0) { return; } // display items (move up, move down, int field, for (int i = 0; i < items.Count; i++) { // get the box to draw around the foldout GUIStyle style = Box.StyleDefault; GUIStyle buttonStyle = Button.StyleFoldoutText; if (HeroObjectMenuBlock.stateFocus && HeroObjectMenuBlock.stateID == stateIndex && HeroObjectMenuBlock.eventID == i && HeroObjectMenuBlock.actionID == -1) { style = Box.StyleMenuSelected; buttonStyle = Button.StyleFoldoutTextB; } // use default name for event if name not provided string eventName = ""; if (items[i].name == "") { if (items[i].eventType > 0) { eventName = HeroField.EventTypeField.field.items[items[i].eventType - 1]; } } else { eventName = items[i].name; } // show foldout SimpleLayout.BeginHorizontal(); SimpleLayout.Space(indentMenu); SimpleLayout.BeginHorizontal(style); GUIStyle foldoutStyle = (items[i].visible) ? Button.StyleFoldoutOpen : Button.StyleFoldoutClosed; SimpleLayout.Button("", toggleBlock, showContextMenu, stateIndex, i, foldoutStyle, 10); SimpleLayout.Button(blockName + " " + i + ": " + eventName, showBlockContent, showContextMenu, stateIndex, i, buttonStyle); SimpleLayout.EndHorizontal(); SimpleLayout.EndHorizontal(); // show actions for open foldout DrawActionForEvent(i); } }
/// <summary> /// Draw item type /// </summary> private static void DrawSuccess() { // item type field string[] items = { "100%", "95%", "90%", "85%", "80%", "75%", "70%", "65%", "60%", "55%", "50%", "45%", "40%", "35%", "30%", "25%", "20%", "15%", "15%", "5%" }; DropDownValues itemList = new DropDownValues(); itemList.setValues("", items); SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB); SimpleLayout.BeginHorizontal(); intFields[5].value = SimpleLayout.DropDownList(intFields[5].value, itemList, 0, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 200)); SimpleLayout.Label("Chance of success"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); SimpleLayout.EndVertical(); }
/// <summary> /// Draw item type /// </summary> private static void DrawTarget() { // item type field string[] items = { "Enemies", "Friends", "Caster", "Enemies and Friends", "All" }; DropDownValues itemList = new DropDownValues(); itemList.setValues("", items); // item type field string[] scope = { "All", "Some", "One" }; DropDownValues scopeList = new DropDownValues(); scopeList.setValues("", scope); SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB); SimpleLayout.BeginHorizontal(); intFields[1].value = SimpleLayout.DropDownList(intFields[1].value, itemList, 0, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 250)); SimpleLayout.Label("Target"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); SimpleLayout.BeginHorizontal(); intFields[7].value = SimpleLayout.DropDownList(intFields[7].value, scopeList, 0, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 250)); SimpleLayout.Label("Scope"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); if (intFields[7].value == 2) { SimpleLayout.BeginHorizontal(); intFields[8].value = SimpleLayout.IntField(intFields[8].value); SimpleLayout.Label("Max number of targets"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); SimpleLayout.BeginHorizontal(); boolFields[4].value = SimpleLayout.BoolField(boolFields[4].value); SimpleLayout.Label("Random"); SimpleLayout.Space(); SimpleLayout.EndHorizontal(); } SimpleLayout.EndVertical(); }
/// <summary> /// Draw an item in the list. /// </summary> /// <param name="itemName">Name of the item.</param> /// <param name="menuID">ID assigned to the list type.</param> private static void DrawListItem(string itemName, int menuID) { // get the box to draw around the foldout GUIStyle style = Box.StyleDefault; GUIStyle buttonStyle = Button.StyleFoldoutText; if (HeroObjectMenuBlock.variableFocus && HeroObjectMenuBlock.variableID == menuID) { style = Box.StyleMenuSelected; buttonStyle = Button.StyleFoldoutTextB; } // show foldout SimpleLayout.BeginHorizontal(style); SimpleLayout.Space(indentMenu); SimpleLayout.Button(HeroObjectMenuBlock.textIcon + " " + itemName, showBlockContent, menuID, buttonStyle); SimpleLayout.EndHorizontal(); }