public static Tile LoadFromJson(JSONClass p_json) { try { string name = Util.getValue <string> (p_json, "name"); ETileColor color = Util.parseEnum <ETileColor> (Util.getValue <string> (p_json, "color")); ETileIcon icon = Util.parseEnum <ETileIcon> (Util.getValue <string> (p_json, "icon")); int price = Util.getValue <int> (p_json, "price"); ETileLetter letter = Util.parseEnum <ETileLetter> (Util.getValue <string> (p_json, "letter")); int number = Util.getValue <int> (p_json, "number"); List <Trigger> triggers = new List <Trigger> (); if (p_json ["triggers"] != null) { foreach (JSONNode trigger in p_json["triggers"].AsArray) { triggers.Add(Trigger.LoadFromJson(trigger.AsObject)); } } Effect immediate_effect = null; if (p_json ["immediate"] != null && p_json ["immediate"].Value != "NONE") { immediate_effect = new Effect(Util.parseEnum <ETileResource> (p_json ["immediate"] ["resource"].Value), p_json ["immediate"] ["value"].AsInt); } return(new Tile(name, color, icon, price, letter, number, triggers, immediate_effect)); } catch (ArgumentException) { Debug.LogError("Error while loading Tile from Json !"); return(null); } }
private Tile(string p_name, ETileColor p_color, ETileIcon p_icon, int p_price, ETileLetter p_letter, int p_number, List <Trigger> p_triggers, Effect p_immediate_effect) { m_name = p_name; m_color = p_color; m_icon = p_icon; m_price = p_price; m_letter = p_letter; m_number = p_number; m_triggers = p_triggers; m_immediate_effect = p_immediate_effect; }
private Tile(string p_name, ETileColor p_color, ETileIcon p_icon, int p_price, ETileLetter p_letter, int p_number, List<Trigger> p_triggers, Effect p_immediate_effect) { m_name = p_name; m_color = p_color; m_icon = p_icon; m_price = p_price; m_letter = p_letter; m_number = p_number; m_triggers = p_triggers; m_immediate_effect = p_immediate_effect; }
public static TileType LoadFromValue(string p_value) { ETileColor color_type = Util.tryEnum <ETileColor> (p_value); if (color_type != ETileColor.NULL) { return(new TileType(color_type)); } ETileIcon icon_type = Util.tryEnum <ETileIcon> (p_value); if (icon_type != ETileIcon.NULL && icon_type != ETileIcon.NONE) { return(new TileType(icon_type)); } if (icon_type != ETileIcon.NULL && icon_type == ETileIcon.NONE) { return(new TileType(ETileIcon.NULL)); } return(null); }
/// <summary> /// Initializes a new instance of the <see cref="TileType"/> class to represent icon type. /// </summary> /// <param name="p_icon">P_icon.</param> public TileType(ETileIcon p_icon) { m_color = ETileColor.NULL; m_icon = p_icon; }
/// <summary> /// Initializes a new instance of the <see cref="TileType"/> class to represent color type /// </summary> /// <param name="p_color">P_color.</param> public TileType(ETileColor p_color) { m_color = p_color; m_icon = ETileIcon.NULL; }