public void init() { if (Settings.IsInExtensionMode) { return; } this.currentFaction = "entropy"; Dictionary <string, Faction> factions1 = this.factions; string key1 = "entropy"; EntropyFaction entropyFaction1 = new EntropyFaction("Entropy", 5); entropyFaction1.idName = "entropy"; EntropyFaction entropyFaction2 = entropyFaction1; factions1.Add(key1, (Faction)entropyFaction2); this.factions.Add("lelzSec", new Faction("lelzSec", 1000) { idName = "lelzSec" }); Dictionary <string, Faction> factions2 = this.factions; string key2 = "hub"; HubFaction hubFaction1 = new HubFaction("CSEC", 10); hubFaction1.idName = "hub"; HubFaction hubFaction2 = hubFaction1; factions2.Add(key2, (Faction)hubFaction2); }
public void init() { var dictionary1 = factions; var key1 = "entropy"; var entropyFaction1 = new EntropyFaction("Entropy", 5); entropyFaction1.idName = "entropy"; var entropyFaction2 = entropyFaction1; dictionary1.Add(key1, entropyFaction2); factions.Add("lelzSec", new Faction("lelzSec", 1000) { idName = "lelzSec" }); var dictionary2 = factions; var key2 = "hub"; var hubFaction1 = new HubFaction("CSEC", 10); hubFaction1.idName = "hub"; var hubFaction2 = hubFaction1; dictionary2.Add(key2, hubFaction2); }
public static Faction loadFromSave(XmlReader xmlRdr) { var _name = "UNKNOWN"; var str = ""; var flag = false; var _neededValue = 100; var num = 0; while (xmlRdr.Name != "Faction" && xmlRdr.Name != "EntropyFaction" && xmlRdr.Name != "HubFaction") xmlRdr.Read(); var name = xmlRdr.Name; if (xmlRdr.MoveToAttribute("name")) _name = xmlRdr.ReadContentAsString(); if (xmlRdr.MoveToAttribute("id")) str = xmlRdr.ReadContentAsString(); if (xmlRdr.MoveToAttribute("neededVal")) _neededValue = xmlRdr.ReadContentAsInt(); if (xmlRdr.MoveToAttribute("playerVal")) num = xmlRdr.ReadContentAsInt(); if (xmlRdr.MoveToAttribute("playerHasPassed")) flag = xmlRdr.ReadContentAsString().ToLower() == "true"; Faction faction; switch (name) { case "HubFaction": faction = new HubFaction(_name, _neededValue); break; case "EntropyFaction": faction = new EntropyFaction(_name, _neededValue); break; default: faction = new Faction(_name, _neededValue); break; } faction.playerValue = num; faction.idName = str; faction.playerHasPassedValue = flag; return faction; }