public static String Get(STType type, int index) { try { return(items.Find(x => x.Type == type && x.Index == index).Text); } catch { } return(String.Empty); }
private void DrawButtons(List <NetInfo> t, STType type, bool scrollNeeded) { for (int i = 0; i < t.Count; i++) { if (GUI.Button(new Rect(2, 2 + i * 27, scrollNeeded ? 338 : 357, 25), t[i].name)) { // select 't[i]' as the prefab to use on all paths of STType 'type'. SetStationTrackForType(selectedPrefab, type, t[i]); } } }
void viewAction(STType triggerType, SCard source, int param) { if (triggerType == STType.onDraw) { game.logger.show(this, this.host); } if (triggerType == STType.onDeploy) { game.logger.show(this); } }
private void addTrackToList(STType type, NetInfo info) { if (info != null) { if (tracks[type].Contains(info)) { return; } tracks[type].Add(info); alltracks.Add(info); } }
private void addTrackToList(STType type, string name) { var p = PrefabCollection <NetInfo> .FindLoaded(name); if (p != null) { if (tracks[type].Contains(p)) { return; } tracks[type].Add(p); alltracks.Add(p); } }
// self-explanatory private void SetStationTrackForType(BuildingInfo info, STType type, NetInfo net) { if (info.m_paths != null) { var paths = info.m_paths; if (paths.Length != 0) { for (uint i = 0; i < paths.Length; i++) { if (paths[i].m_netInfo != null) { if (GetTrackType(paths[i].m_netInfo) == type) { paths[i].m_finalNetInfo = net; } } } } } }
// self-explanatory private void SetStationTrackForType(BuildingInfo info, STType type, NetInfo net) { if (info.m_paths != null) { var paths = info.m_paths; if (paths.Length != 0) { for (uint i = 0; i < paths.Length; i++) { if (paths[i].m_netInfo != null) { if (GetTrackType(paths[i].m_netInfo) == type) { paths[i].m_finalNetInfo = net; } } } } } //SubBuildings if (info.m_subBuildings == null) { return; } var subBuildingsCount = info.m_subBuildings.Length; for (int i = 0; i < subBuildingsCount; i++) { var subBuildingInfo = info.m_subBuildings[i]; if (subBuildingInfo == null) { continue; } this.SetStationTrackForType(subBuildingInfo.m_buildingInfo, type, net); } }
public void trigger(STType triggerType, SCard source = null, int param = 0) { if (containsTrigger(triggerType)) { _triggers[triggerType](this, source, param); } // then show it to someone // or hide from someone viewAction(triggerType, source, param); // if a trigger from range 20..100 // then its a trigger, what will trigger // other cards with %OtherTrigger% case int triggerNum = (int)triggerType; if (triggerNum < 20 || triggerNum > 100) { return; } foreach (SCard otherCard in _game.cards.select(SFilter.inGame(), SFilter.otherThen(this)).cards) { otherCard.trigger((STType)(triggerNum + 100), this); } }
/// <summary> /// This function does nothing but return false /// </summary> /// <param name="parameterName">ignored</param> /// <param name="type">ignored</param> /// <returns>always false</returns> public bool SetParamType(string parameterName, STType type) { bool whatever = false; return(whatever); }
public void setTrigger(STType triggerType, STrigger trigger) { _triggers.Add(triggerType, trigger); }
public bool containsTrigger(STType triggerType) { return(_triggers.ContainsKey(triggerType)); }
public SCards move(SLocation location) { List <STType> triggers = new List <STType>(); foreachCard((c) => { STType trigger = STType.none; // see what to trigger on movement if (location.place == SPlace.board) { trigger = c.location.place == SPlace.graveyard ? STType.onRessurect : STType.onDeploy; } // if moven to graveyard // from hand = discard // from board = die -> then // trigger deathwish // if just moved from board to graveyard // then prevent onDie effect // from the higher level if (location.place == SPlace.graveyard) { if (c.location.place == SPlace.hand) { trigger = STType.onDiscard; } if (c.location.place == SPlace.board) { trigger = STType.onDie; //c.containsTag(STag.doomed) } } if (location.place == SPlace.banish && c.location.place == SPlace.board) { trigger = STType.onBanish; } // when back to deck // shuffled when from board/graveyard // otherwise swapped if (location.place == SPlace.deck) { trigger = c.location.place == SPlace.hand ? STType.onSwap : STType.onShuffle; } // from deck to hand if (location.place == SPlace.hand && c.location.place == SPlace.deck) { trigger = STType.onDraw; } // trigger moe when still on board, // but a row changed if (location.Equals(c.location) && location.place == SPlace.board && location.row != c.location.row) { trigger = STType.onMove; } // then move and remember trigger // SLocation prevLocation = c.location; c.game.logger.move(c, location); c.location = location; triggers.Add(trigger); }); // after all cards moved // trigger in order their deploys, // deathwishes or whatever for (int i = 0; i < triggers.Count; ++i) { if (triggers[i] != STType.none) { _cards[i].trigger(triggers[i]); } } return(this); }