public int GetTag(GAME_TAG tag) { int value; Tags.TryGetValue(tag, out value); return(value); }
public static int ParseTag(GAME_TAG tag, string rawValue) { switch (tag) { case ZONE: return((int)ParseEnum <TAG_ZONE>(rawValue)); case MULLIGAN_STATE: return((int)ParseEnum <TAG_MULLIGAN>(rawValue)); case PLAYSTATE: return((int)ParseEnum <TAG_PLAYSTATE>(rawValue)); case CARDTYPE: return((int)ParseEnum <TAG_CARDTYPE>(rawValue)); case CLASS: return((int)ParseEnum <TAG_CLASS>(rawValue)); default: int value; int.TryParse(rawValue, out value); return(value); } }
public void AddGameFilter(GAME_TAG key, object val, CollectionFilterFunc func) { foreach (CollectionArtFilterSet set in this.m_artFilterSets) { set.AddGameFilter(key, val, func); } }
public TagEnum GetTag <TagEnum>(GAME_TAG enumTag) { int tag = Convert.ToInt32(enumTag); int num2 = this.GetTag(tag); return((TagEnum)Enum.ToObject(typeof(TagEnum), num2)); }
private int ParseTagValue(GAME_TAG tag, string rawValue) { int value; if (tag == GAME_TAG.ZONE) { TAG_ZONE zone; Enum.TryParse(rawValue, out zone); value = (int)zone; } else if (tag == GAME_TAG.MULLIGAN_STATE) { TAG_MULLIGAN state; Enum.TryParse(rawValue, out state); value = (int)state; } else if (tag == GAME_TAG.PLAYSTATE) { TAG_PLAYSTATE state; Enum.TryParse(rawValue, out state); value = (int)state; } else if (tag == GAME_TAG.CARDTYPE) { TAG_CARDTYPE type; Enum.TryParse(rawValue, out type); value = (int)type; } else { int.TryParse(rawValue, out value); } return(value); }
private void AddNamedFiltersForEnum <T>(GAME_TAG key, FilterHasNameFunction <T> hasNameFunction, FilterGetNameFunction <T> getNameFunction) { IEnumerator enumerator = Enum.GetValues(typeof(T)).GetEnumerator(); try { while (enumerator.MoveNext()) { T current = (T)enumerator.Current; if (hasNameFunction(current)) { string name = getNameFunction(current); CollectionFilter <GAME_TAG> filter = new CollectionFilter <GAME_TAG>(); filter.SetKey(key); filter.SetValue(current); filter.SetFunc(CollectionFilterFunc.EQUAL); this.AddNamedFilter(name, filter); } } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable == null) { } disposable.Dispose(); } }
public static string GetTagString(XmlNode node, int tag, Locale loc) { XmlElement element = null; GAME_TAG game_tag = (GAME_TAG)tag; if (game_tag == GAME_TAG.ARTISTNAME) { element = node[Localization.DEFAULT_LOCALE_NAME]; } else { foreach (Locale locale in Localization.GetLoadOrder(loc, false)) { string str = locale.ToString(); element = node[str]; if (element != null) { break; } } } if (element != null) { return(TextUtils.DecodeWhitespaces(element.InnerText)); } return(null); }
public void SetupKeywordRefPanel(GAME_TAG tag) { string keywordName = GameStrings.GetKeywordName(tag); string refKeywordText = GameStrings.GetRefKeywordText(tag); this.SetupKeywordPanel(keywordName, refKeywordText); }
public bool HasGameFilter(GAME_TAG key, object val, CollectionFilterFunc func) { List <object> values = new List <object> { val }; return(this.HasGameFilter(key, values, func)); }
public static string TransformCardText(Entity entity, GAME_TAG textTag) { int damageBonus = entity.GetDamageBonus(); int damageBonusDouble = entity.GetDamageBonusDouble(); int healingDouble = entity.GetHealingDouble(); return(TransformCardText(damageBonus, damageBonusDouble, healingDouble, entity.GetStringTag(textTag))); }
public void Add <TagEnum>(GAME_TAG tag, TagEnum prev, TagEnum curr) { TagDelta item = new TagDelta { tag = (int)tag, oldValue = Convert.ToInt32(prev), newValue = Convert.ToInt32(curr) }; this.m_deltas.Add(item); }
public void AddGameFilter(GAME_TAG key, object val, CollectionFilterFunc func) { if (!this.HasGameFilter(key, val, func)) { CollectionFilter <GAME_TAG> item = new CollectionFilter <GAME_TAG>(); item.SetKey(key); item.SetValue(val); item.SetFunc(func); this.m_gameFilters.Add(item); } }
public void SetTag(GAME_TAG tag, int value) { if (!Tags.ContainsKey(tag)) { Tags.Add(tag, value); } else { Tags[tag] = value; } }
public void RemoveAllGameFiltersByTag(GAME_TAG key) { for (int i = this.m_gameFilters.Count - 1; i >= 0; i--) { CollectionFilter <GAME_TAG> filter = this.m_gameFilters[i]; if (((GAME_TAG)filter.GetKey()) == key) { this.m_gameFilters.RemoveAt(i); } } }
public int getTag(GAME_TAG gt) { foreach (tagpair t in tags) { if ((GAME_TAG)t.Name == gt) { return t.Value; } } return 0; }
public int getTag(GAME_TAG gt) { foreach (tagpair t in tags) { if ((GAME_TAG)t.Name == gt) { return(t.Value); } } return(0); }
public void RemoveGameFilter(GAME_TAG key, object val, CollectionFilterFunc func) { for (int i = 0; i < this.m_gameFilters.Count; i++) { CollectionFilter <GAME_TAG> filter = this.m_gameFilters[i]; if (((((GAME_TAG)filter.GetKey()) == key) && filter.HasValue(val)) && (filter.GetFunc() == func)) { this.m_gameFilters.RemoveAt(i); return; } } }
private bool SetupKeywordPanelIfNecessary(EntityBase entityInfo, GAME_TAG tag) { if (entityInfo.HasTag(tag)) { this.SetupKeywordPanel(tag); return(true); } if (entityInfo.HasReferencedTag(tag)) { this.SetupKeywordRefPanel(tag); return(true); } return(false); }
public void SetTag(GAME_TAG tag, int value) { var prevVal = 0; if (!Tags.ContainsKey(tag)) { Tags.Add(tag, value); } else { prevVal = Tags[tag]; Tags[tag] = value; } //Logger.WriteLine(string.Format("[id={0} cardId={1} name={2} TAG={3}] {4} -> {5}", Id, CardId, Name, tag, prevVal, value)); }
public void TagChange(IHsGameState gameState, GAME_TAG tag, int id, int value, IGame game, bool isCreationTag = false) { if (gameState.LastId != id) { if (gameState.ProposedKeyPoint != null) { ReplayMaker.Generate(gameState.ProposedKeyPoint.Type, gameState.ProposedKeyPoint.Id, gameState.ProposedKeyPoint.Player, game); gameState.ProposedKeyPoint = null; } } gameState.LastId = id; if (id > gameState.MaxId) { gameState.MaxId = id; } if (!game.Entities.ContainsKey(id)) { game.Entities.Add(id, new Entity(id)); } if (!gameState.DeterminedPlayers) { var entity = game.Entities[id]; if (tag == CONTROLLER && entity.IsInHand && string.IsNullOrEmpty(entity.CardId)) { DeterminePlayers(gameState, game, value); } } var prevValue = game.Entities[id].GetTag(tag); game.Entities[id].SetTag(tag, value); if (isCreationTag) { var action = _tagChangeActions.FindAction(tag, game, gameState, id, value, prevValue); if (action != null) { _creationTagActionQueue.Enqueue(new Tuple <int, Action>(id, action)); } } else { _tagChangeActions.FindAction(tag, game, gameState, id, value, prevValue)?.Invoke(); } }
public static int ParseTagValue(GAME_TAG tag, string rawValue) { int value; switch (tag) { case ZONE: TAG_ZONE zone; Enum.TryParse(rawValue, out zone); value = (int)zone; break; case MULLIGAN_STATE: { TAG_MULLIGAN state; Enum.TryParse(rawValue, out state); value = (int)state; } break; case PLAYSTATE: { TAG_PLAYSTATE state; Enum.TryParse(rawValue, out state); value = (int)state; } break; case CARDTYPE: TAG_CARDTYPE type; Enum.TryParse(rawValue, out type); value = (int)type; break; case CLASS: TAG_CLASS @class; Enum.TryParse(rawValue, out @class); value = (int)@class; break; default: int.TryParse(rawValue, out value); break; } return(value); }
public static int ParseTagValue(GAME_TAG tag, string rawValue) { int value; switch(tag) { case GAME_TAG.ZONE: TAG_ZONE zone; Enum.TryParse(rawValue, out zone); value = (int)zone; break; case GAME_TAG.MULLIGAN_STATE: { TAG_MULLIGAN state; Enum.TryParse(rawValue, out state); value = (int)state; } break; case GAME_TAG.PLAYSTATE: { TAG_PLAYSTATE state; Enum.TryParse(rawValue, out state); value = (int)state; } break; case GAME_TAG.CARDTYPE: TAG_CARDTYPE type; Enum.TryParse(rawValue, out type); value = (int)type; break; case GAME_TAG.CLASS: TAG_CLASS @class; Enum.TryParse(rawValue, out @class); value = (int)@class; break; default: int.TryParse(rawValue, out value); break; } return value; }
private string GetTextForTag(GAME_TAG tag, string key) { int spellPower; if (tag != GAME_TAG.SPELLPOWER) { return(GameStrings.Get(key)); } if (this.m_card != null) { spellPower = this.m_card.GetEntity().GetSpellPower(); } else if (((this.m_actor != null) && (this.m_actor.GetEntityDef() != null)) && (this.m_actor.GetEntityDef().GetCardId() == "EX1_563")) { spellPower = 5; } else { spellPower = 1; } object[] args = new object[] { spellPower }; return(GameStrings.Format(key, args)); }
public bool HasGameFilter(GAME_TAG key, List <object> values, CollectionFilterFunc func) { foreach (CollectionFilter <GAME_TAG> filter in this.m_gameFilters) { if (((GAME_TAG)filter.GetKey()) != key) { continue; } bool flag = values.Count > 0; foreach (object obj2 in values) { if (!filter.HasValue(obj2)) { flag = false; break; } } if (flag && (filter.GetFunc() == func)) { return(true); } } return(false); }
public int GetTag(GAME_TAG tag) { int value; Tags.TryGetValue(tag, out value); return value; }
public static string GetKeywordNameKey(GAME_TAG tag) { string[] strArray = null; return(!s_keywordText.TryGetValue(tag, out strArray) ? null : strArray[0]); }
public void SetTag(GAME_TAG tag, int value) { var prevVal = 0; if(!Tags.ContainsKey(tag)) Tags.Add(tag, value); else { prevVal = Tags[tag]; Tags[tag] = value; } //Logger.WriteLine(string.Format("[id={0} cardId={1} name={2} TAG={3}] {4} -> {5}", Id, CardId, Name, tag, prevVal, value)); }
public bool HasTag(GAME_TAG tag) { return(GetTag(tag) > 0); }
public static bool HasRefKeywordText(GAME_TAG tag) { return(s_refKeywordText.ContainsKey(tag)); }
private int ParseTagValue(GAME_TAG tag, string rawValue) { int value; if(tag == GAME_TAG.ZONE) { TAG_ZONE zone; Enum.TryParse(rawValue, out zone); value = (int)zone; } else if(tag == GAME_TAG.MULLIGAN_STATE) { TAG_MULLIGAN state; Enum.TryParse(rawValue, out state); value = (int)state; } else if(tag == GAME_TAG.PLAYSTATE) { TAG_PLAYSTATE state; Enum.TryParse(rawValue, out state); value = (int)state; } else if(tag == GAME_TAG.CARDTYPE) { TAG_CARDTYPE type; Enum.TryParse(rawValue, out type); value = (int)type; } else int.TryParse(rawValue, out value); return value; }
public static string GetRefKeywordTextKey(GAME_TAG tag) { string[] strArray = null; return(!s_refKeywordText.TryGetValue(tag, out strArray) ? null : strArray[1]); }
public static bool HasKeywordName(GAME_TAG tag) { return(s_keywordText.ContainsKey(tag)); }
public bool HasTag(GAME_TAG tag) { return GetTag(tag) > 0; }
public static string GetRefKeywordText(GAME_TAG tag) { string[] strArray = null; return(!s_refKeywordText.TryGetValue(tag, out strArray) ? "UNKNOWN" : Get(strArray[1])); }
public static string GetKeywordName(GAME_TAG tag) { string[] strArray = null; return(!s_keywordText.TryGetValue(tag, out strArray) ? "UNKNOWN" : Get(strArray[0])); }
public void SetTag(GAME_TAG tag, int value) { if(!Tags.ContainsKey(tag)) Tags.Add(tag, value); else Tags[tag] = value; }
public bool HasTag(GAME_TAG tag) => GetTag(tag) > 0;
public bool HasTag(GAME_TAG tag) => GetTag(tag) > 0;
public void SetTag(GAME_TAG tag, string value) { if(!Tags.ContainsKey(tag)) Tags.Add(tag, ParseTagValue(tag, value)); else Tags[tag] = ParseTagValue(tag, value); }