/// <summary> /// Fields for the hero property (strings). /// </summary> private static void DrawStrings() { List <StringField> items = propertyBlock.itemProperties.strings.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 + ":"); if (!items[i].useTextField) { items[i].value = SimpleLayout.TextField(items[i].value, HeroKitCommon.GetWidthForField(60, 150)); } else { items[i].value = SimpleLayout.TextArea(items[i].value, HeroKitCommon.GetWidthForField(60, 150)); } } SimpleLayout.EndVertical(); }
/// <summary> /// Draw first group of fields (name, desc, icon, price) /// </summary> private static void DrawBasics() { SimpleLayout.BeginVertical(SimpleGUI.Fields.Box.StyleB); // name field SimpleLayout.Label("Name" + ":"); stringFields[0].value = SimpleLayout.TextField(stringFields[0].value, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 450)); // description field SimpleLayout.Label("Formula" + ":"); stringFields[1].value = SimpleLayout.TextArea(stringFields[1].value, HeroKit.Editor.HeroKitCommon.GetWidthForField(60, 450)); SimpleLayout.EndVertical(); }
/// <summary> /// Draw the body of the block. /// </summary> private static void DrawBody() { SimpleLayout.BeginVertical(Box.StyleCanvasBox); SimpleLayout.BeginVertical(Box.StyleB); SimpleLayout.Label("Action (this is used during gameplay):"); heroAction.action = SimpleLayout.ObjectField(heroAction.action, 400); SimpleLayout.Label("Action (this is used to create editor fields for action):"); heroAction.actionFields = SimpleLayout.ObjectField(heroAction.actionFields, 400); SimpleLayout.EndVertical(); // ------------- SimpleLayout.BeginVertical(Box.StyleB); SimpleLayout.Label("Prefix (adds text in front of the action in the menu):"); heroAction.title = SimpleLayout.TextField(heroAction.title); SimpleLayout.Label("Description (this appears below editor fields for action):"); heroAction.description = SimpleLayout.TextArea(heroAction.description); SimpleLayout.EndVertical(); // -------------- SimpleLayout.BeginVertical(Box.StyleB); SimpleLayout.Label("Indent This Action (indents this action in menu. 0=no indent):"); heroAction.indentThis = SimpleLayout.IntField(heroAction.indentThis); SimpleLayout.Label("Indent Next Action (indents the next action in menu. 0=no indent):"); heroAction.indentNext = SimpleLayout.IntField(heroAction.indentNext); SimpleLayout.Label("Color (The color of this action in the menu):"); heroAction.titleColor = SimpleLayout.ColorField(heroAction.titleColor, 400); SimpleLayout.EndVertical(); // -------------- SimpleLayout.Label("Version (version of this action + developer notes):"); heroAction.version = SimpleLayout.TextArea(heroAction.version); SimpleLayout.EndVertical(); }
// -------------------------------------------------------------- // Action Fields // -------------------------------------------------------------- /// <summary> /// Get a value from a game object field. /// This is for a field that contains Value, 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="titleToLeft">Show the title on the left?</param> /// <returns>A game object.</returns> public static GameObject BuildFieldA(string title, HeroActionParams actionParams, HeroActionField actionField, bool titleToLeft = false) { GameObjectFieldData 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 field you want to work with. //----------------------------------------- SimpleLayout.Space(-8); data.fieldType = new HeroField.ValueTypeFieldC().SetValues(data.fieldType, 0); //----------------------------------------- // 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) //----------------------------------------- if (data.fieldType == 2 || data.fieldType == 3 || data.fieldType == 4) { 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.objectName = SimpleLayout.TextField(data.objectName, HeroKitCommon.GetWidthForField(133)); } // if this is a list, draw items (2=variables, 3=properties, 5=globals) if (data.fieldType == 2 || data.fieldType == 3 || data.fieldType == 5) { data = SetPropertyID(data, -1); List <GameObjectField> items = GetItemsFromList(data, -1); data = BuildItemFieldList(data, items); } //----------------------------------------- // 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; actionField.gameObjects[0] = data.gameObject; //----------------------------------------- // Visual stuff //----------------------------------------- SimpleLayout.Space(); SimpleLayout.EndHorizontal(); return(data.gameObject); }