public Dictionary <Faction, FactionData> LoadFactionData() { Dictionary <Faction, FactionData> factions = new Dictionary <Faction, FactionData>(); IDataReader factionReader = GameManager.Inst.DBManager.RunQuery( "SELECT * from factions"); while (factionReader.Read()) { FactionData faction = new FactionData(); int factionID = factionReader.GetInt32(0); faction.FactionID = (Faction)Enum.Parse(typeof(Faction), factionID.ToString()); faction.Name = factionReader.GetString(1); faction.CharacterType = (CharacterType)Enum.Parse(typeof(CharacterType), factionReader.GetInt32(3).ToString()); string rawModelList = factionReader.GetString(2); faction.MemberModelIDs = rawModelList.Split('/'); //now get relationship IDataReader relReader = GameManager.Inst.DBManager.RunQuery( "SELECT * from faction_relationships WHERE faction_id = '" + factionID + "'"); while (relReader.Read()) { int targetID = relReader.GetInt32(1); Faction target = (Faction)Enum.Parse(typeof(Faction), targetID.ToString()); float relationship = relReader.GetFloat(2); faction.AddRelationshipEntry(target, relationship); } factions.Add(faction.FactionID, faction); } return(factions); }
public void init(FactionData factionData, int position, bool ally, FactionDiplomacyPanel parent) { this.m_parent = parent; this.m_position = position; this.m_factionData = factionData; this.clearControls(); if ((position & 1) == 0) { this.backgroundImage.Image = (Image)GFXLibrary.lineitem_strip_02_light; } else { this.backgroundImage.Image = (Image)GFXLibrary.lineitem_strip_02_dark; } this.backgroundImage.Position = new Point(60, 0); this.backgroundImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.factionClick)); base.addControl(this.backgroundImage); this.Size = this.backgroundImage.Size; this.flagImage.createFromFlagData(factionData.flagData); this.flagImage.Position = new Point(0, 0); this.flagImage.Scale = 0.25; this.flagImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.factionClick)); base.addControl(this.flagImage); this.factionName.Text = factionData.factionName; this.factionName.Color = ARGBColors.Black; this.factionName.Position = new Point(9, 0); this.factionName.Size = new Size(500, this.backgroundImage.Height); this.factionName.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.factionName.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT; this.factionName.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.factionClick)); this.backgroundImage.addControl(this.factionName); }
//Adds an explored system to the list public static void AddExploredSystem(int factionID, GalaxyNode newExploredSystem) { if (factionID < factions.Length && factionID >= 0) { //Check the system is not already in the list bool alreadyInList = false; bool alreadyInIDList = false; FactionData data = factions[factionID]; for (int i = 0; i < data.exploredSystems.Count; i++) { if (data.exploredSystems.Contains(newExploredSystem)) { alreadyInList = true; } if (data.exploredSystemIDs.Contains(newExploredSystem.nodeID)) { alreadyInIDList = true; } } //If allowed to proceed if (alreadyInList == false) { factions[factionID].exploredSystems.Add(newExploredSystem); } if (alreadyInIDList == false) { factions[factionID].exploredSystemIDs.Add(newExploredSystem.nodeID); } } }
/* * public int GetCharacterRelationship(Character c) * { * if(_parentCharacter.Faction == c.Faction) * { * if(_parentCharacter.Faction != Faction.Loner) * { * return 4; * } * else * { * if(_parentCharacter.SquadID == c.SquadID) * { * return 4; * } * else * { * return (Convert.ToInt32(c.SquadID) + Convert.ToInt32(_parentCharacter.SquadID)) > 30 ? 1 : 2; //loner relationships are random * } * } * } * else * { * FactionData myFaction = GameManager.Inst.NPCManager.GetFactionData(_parentCharacter.Faction); * FactionData otherFaction = GameManager.Inst.NPCManager.GetFactionData(c.Faction); * * if(myFaction == null || otherFaction == null) * { * return 1; * } * * float relationship = myFaction.GetRelationshipByID(c.Faction); * if(relationship <= 0.25) * { * return 1; * } * else if(relationship <= 0.5) * { * return 2; * } * else if(relationship <= 0.75) * { * return 3; * } * else * { * return 4; * } * * } * } */ public int IsCharacterEnemy(Character c) //0=enemy, 1=negative neutral, 2=positive neutral, 3=friendly { if (_parentCharacter.Faction == c.Faction) { if (_parentCharacter.Faction != Faction.Loner) { return(3); } else { if (_parentCharacter.SquadID == c.SquadID) { return(3); } else { int rand = (Convert.ToInt32(c.SquadID) + Convert.ToInt32(_parentCharacter.SquadID)); //loner relationships are random if (rand > 30) { return(0); } else { return(2); } } } } else { FactionData myFaction = GameManager.Inst.NPCManager.GetFactionData(_parentCharacter.Faction); FactionData otherFaction = GameManager.Inst.NPCManager.GetFactionData(c.Faction); if (myFaction == null || otherFaction == null) { return(0); } float relationship = myFaction.GetRelationshipByID(c.Faction); if (relationship <= 0.25f) { return(0); } else if (relationship <= 0.5f) { return(1); } else if (relationship <= 0.75f) { return(2); } else if (relationship > 0.75f) { return(3); } } return(0); }
//Update the amount of a resource a faction collects for a period of time. private static void UpdateResourceInflux(int factionID, GalaxyNode resourceNode) { if (factionID < factions.Length && factionID >= 0) { GalaxyNodeResourceData[] resources = resourceNode.GetResourcesData(); //For every resource in the node for (int i = 0; i < resources.Length; i++) { //Get faction data FactionData data = GetFactionData(factionID); //For every resource the faction can collect for (int j = 0; j < data.resourceData.Length; j++) { if (data.resourceData[j].resourceType == resources[i].resourceType) { //If the producing resource node is enabled (has the faction built a mining rig? etc..) if (resources[i].isEnabled) { //Add to resource influx data.resourceData[j].resourceInflux += resources[i].productionRate; } } } } } }
/// <summary> /// Merges faction data from savevars into a new faction dictionary. /// Does not affect factions as read from FACTIONS.TXT. /// This resultant set of factions is the character's live faction setup. /// This is only used when importing a classic save. /// Daggerfall Unity uses a different method of storing faction data with saves. /// </summary> /// <param name="saveVars"></param> public Dictionary <int, FactionData> Merge(SaveVars saveVars) { // Create clone of base faction dictionary Dictionary <int, FactionData> dict = new Dictionary <int, FactionData>(); foreach (var kvp in factionDict) { dict.Add(kvp.Key, kvp.Value); } // Merge save faction data from savevars FactionData[] factions = saveVars.Factions; foreach (var srcFaction in factions) { if (dict.ContainsKey(srcFaction.id)) { FactionData dstFaction = dict[srcFaction.id]; // First a quick sanity check to ensure IDs are the same if (dstFaction.id != srcFaction.id) { throw new Exception(string.Format("ID mismatch while merging faction data. SrcFaction=#{0}, DstFaction=#{1}", srcFaction.id, dstFaction.id)); } // Copy live reputation value from SAVEVARS.DAT // Other values remain as pre-generated from faction.txt // This is to prevent bad save data polluting faction structure dstFaction.rep = srcFaction.rep; // May migrate other values later //dstFaction.type = srcFaction.type; //dstFaction.name = srcFaction.name; //dstFaction.region = srcFaction.region; //dstFaction.power = srcFaction.power; //dstFaction.flags = srcFaction.flags; //dstFaction.ruler = srcFaction.ruler; //dstFaction.ally1 = srcFaction.ally1; //dstFaction.ally2 = srcFaction.ally2; //dstFaction.ally3 = srcFaction.ally3; //dstFaction.enemy1 = srcFaction.enemy1; //dstFaction.enemy2 = srcFaction.enemy2; //dstFaction.enemy3 = srcFaction.enemy3; //dstFaction.face = srcFaction.face; //dstFaction.race = srcFaction.race; //dstFaction.flat1 = srcFaction.flat1; //dstFaction.flat2 = srcFaction.flat2; //dstFaction.sgroup = srcFaction.sgroup; //dstFaction.ggroup = srcFaction.ggroup; //dstFaction.vam = srcFaction.vam; // Store merged data back in new dictionary dict[srcFaction.id] = dstFaction; } } RelinkChildren(dict); return(dict); }
public bool CanHarm(FactionData other) { if (other == null) { return(true); } return(other != null && EnemyList.Contains(other)); }
public static List <Selectable> GetCurrentlySelectedUnitsFromFaction(FactionData faction) { return(_knownSelectablesList .Where(facade => (facade.selected.Value == true && facade.selectableObject != null && facade.selectableObject.myFactionAffiliation.MyFaction == faction)) .Select(facade => facade.selectableObject) .ToList()); }
//Getters and Setters public void SetOwningFaction(int factionID) { owningFactionID = factionID; SpriteRenderer renderer = GetComponent <SpriteRenderer>(); FactionData data = Factions.GetFactionData(factionID); renderer.color = data.factionColour; }
private void Setup(FactionData templateArg) { factionId = templateArg.factionId; factionName = templateArg.factionName; factionDescription = templateArg.factionDescription; canFriendlyFire = templateArg.canFriendlyFire; inherentlyHostile = templateArg.inherentlyHostile; }
public ShipData(NodeData orbit, FactionData f) { Name = "Ship " + f.ShipNumber; f.ShipNumber++; on_orbit = orbit; Faction = f; f.Ships.Add(this); }
//Function to remove an explored system from the list public static void RemoveExploredSystem(int factionID, GalaxyNode systemToRemove) { if (factionID < factions.Length && factionID >= 0) { FactionData data = factions[factionID]; data.exploredSystems.Remove(systemToRemove); data.exploredSystemIDs.Remove(systemToRemove.nodeID); } }
//Function to remove a controlled system from the list public static void RemoveControlledSystem(int factionID, GalaxyNode systemToRemove) { if (factionID < factions.Length && factionID >= 0) { FactionData data = factions[factionID]; data.ownedSystems.Remove(systemToRemove); data.ownedSystemIDs.Remove(systemToRemove.nodeID); UpdateResourceInflux(factionID, systemToRemove); } }
/// <summary> /// Register a custom faction not in the DF FACTION.TXT file /// </summary> /// <param name="factionId">faction id for the new faction</param> /// <param name="factionData">faction data struct for new faction, including child list</param> /// <returns>true if faction was registered, false if the faction id is already in use</returns> public static bool RegisterCustomFaction(int factionId, FactionData factionData) { DaggerfallUnity.LogMessage("RegisterCustomFaction: " + factionId, true); if (!customFactions.ContainsKey(factionId)) { customFactions.Add(factionId, factionData); return(true); } return(false); }
public static FactionData CreateInstance(FactionData original) { FactionData copy = ScriptableObject.CreateInstance <FactionData>(); copy.name = original.name; copy.flower_data = original.flower_data; copy.icon = original.icon; copy.color = original.color; return(copy); }
private void houseClicked() { if ((this.m_userInfo != null) && (this.m_userInfo.factionID >= 0)) { FactionData data = GameEngine.Instance.World.getFaction(this.m_userInfo.factionID); if (data != null) { InterfaceMgr.Instance.showHousePanel(data.houseID); } } }
/// <summary> /// Class constructor /// </summary> /// <param name="data">Serialized faction data</param> /// <param name="race">Race of the faction</param> /// <param name="unitTypes">Faction's unit types: id => unit type</param> public Faction(FactionData data, Race race, Dictionary <int, UnitType> unitTypes) { _data = data; _race = race; _lowercaseName = _data.name.Replace(' ', '_').ToLower() + "_faction"; _provinces = new Dictionary <int, Province>(); // NOTE: here we can differentiate factions by assigning different AIs _strategicAI = new Strategos(this); _tacticalAI = new Tactician(_data.level); }
public Faction() { NodeData = new FactionData(); Type = NodeType.PARAM_FACTION; //Update text NodeName.Content = "Faction"; AddDatabaseSelection(); }
public void SetCurrentPlayerInfo(string player_name, FactionData player_faction) { TMP_Text name = player_info.GetComponentInChildren <TMP_Text>(); name.text = player_name; // name.color = player_faction.color; Image background = player_info.GetComponent <Image>(); background.sprite = player_faction.icon; }
/// <summary> /// Gets faction data from faction ID. /// </summary> /// <param name="factionID">Faction ID.</param> /// <param name="factionDataOut">Receives faction data.</param> /// <returns>True if successful.</returns> public bool GetFactionData(int factionID, out FactionData factionDataOut) { factionDataOut = new FactionData(); if (factionDict.ContainsKey(factionID)) { factionDataOut = factionDict[factionID]; return(true); } return(false); }
// calls when you want to create your very own faction public void CreateFaction() { factionPanel.SetActive(false); createFactionPanel.SetActive(true); currentFaction = new FactionData(); CreateAFaction newFaction = new CreateAFaction(); //play sounds? AudioManager.GetComponent <AudioManager>().PlayMenuSelectMid(); }
public void SaveFaction() { if ((faction.factionName != null) && (faction.playerName != null) && (faction.voice != VoiceType.COUNT) && (faction.style != FactionStyle.COUNT) && (faction.attribute != Attribute.COUNT)) { Debug.Log("You can move on to faction screen"); createFactionPanel.SetActive(false); factionPanel.SetActive(true); FactionData.ExportJSON(faction, faction.factionName + ".json"); GameObject newButton = Instantiate(buttonprefab); newButton.transform.SetParent(content.transform); newButton.GetComponent <Button>().onClick.AddListener(delegate { factionScript.FactionSelection(newButton.GetComponent <Button>()); }); newButton.transform.localScale = new Vector3(1, 1, 1); content.sizeDelta = new Vector2(content.rect.width, content.rect.height + 20); for (int i = 0; i < newButton.transform.childCount; i++) { Transform child = newButton.transform.GetChild(i); Image childImage = null; Debug.Log(child.name); if ((childImage = child.GetComponent <Image>()) != null) { if (child.name == "Pic") { childImage.GetComponent <Image>().sprite = faction.playerPortrait; } if (child.name == "FoodPic") { switch (faction.style) { case FactionStyle.AMERICAN: child.gameObject.GetComponent <Image>().sprite = burgerSprite; break; case FactionStyle.ITALIAN: child.gameObject.GetComponent <Image>().sprite = pizzaSprite; break; case FactionStyle.MEXICAN: child.gameObject.GetComponent <Image>().sprite = tacoSprite; break; } } } } newButton.GetComponentInChildren <Text>().text = faction.factionName; factionScript.ResetFactionCreation(); } else { Debug.Log("You can't move on"); } }
/// <summary> /// Merges faction data from savevars into a new faction dictionary. /// Does not affect factions as read from FACTIONS.TXT. /// This resultant set of factions is the character's live faction setup. /// This is only used when importing a classic save. /// Daggerfall Unity uses a different method of storing faction data with saves. /// </summary> /// <param name="saveVars"></param> public Dictionary <int, FactionData> Merge(SaveVars saveVars) { // Create clone of base faction dictionary Dictionary <int, FactionData> dict = new Dictionary <int, FactionData>(); foreach (var kvp in factionDict) { dict.Add(kvp.Key, kvp.Value); } // Merge save faction data from savevars FactionData[] factions = saveVars.Factions; foreach (var srcFaction in factions) { if (dict.ContainsKey(srcFaction.id)) { FactionData dstFaction = dict[srcFaction.id]; // First a quick sanity check to ensure IDs are the same if (dstFaction.id != srcFaction.id) { throw new Exception(string.Format("ID mismatch while merging faction data. SrcFaction=#{0}, DstFaction=#{1}", srcFaction.id, dstFaction.id)); } // Copy live data from SAVEVARS.DAT dstFaction.type = srcFaction.type; dstFaction.name = srcFaction.name; dstFaction.rep = srcFaction.rep; dstFaction.region = srcFaction.region; dstFaction.power = srcFaction.power; dstFaction.flags = srcFaction.flags; dstFaction.ruler = srcFaction.ruler; dstFaction.ally1 = srcFaction.ally1; dstFaction.ally2 = srcFaction.ally2; dstFaction.ally3 = srcFaction.ally3; dstFaction.enemy1 = srcFaction.enemy1; dstFaction.enemy2 = srcFaction.enemy2; dstFaction.enemy3 = srcFaction.enemy3; dstFaction.face = srcFaction.face; dstFaction.race = srcFaction.race; dstFaction.flat1 = srcFaction.flat1; dstFaction.flat2 = srcFaction.flat2; dstFaction.sgroup = srcFaction.sgroup; dstFaction.ggroup = srcFaction.ggroup; dstFaction.vam = srcFaction.vam; // Store data back in new dictionary dict[srcFaction.id] = dstFaction; } } return(dict); }
public void OnHumanDeath(Character killer, Character victim) { if (killer == null || victim == null || killer.Faction == victim.Faction) { return; } FactionData killerFaction = GetFactionData(killer.Faction); FactionData victimFaction = GetFactionData(victim.Faction); victimFaction.ReduceRelationshipByID(killer.Faction, 0.25f); killerFaction.ReduceRelationshipByID(victim.Faction, 0.25f); }
//Function to check for capitulation public static void CheckForCapitulation() { //Check for capitulation of other nation for (int i = 0; i < factions.Length; i++) { FactionData data = GetFactionData(i); int homeSystemOwner = data.homeSystem.GetOwningFactionID(); if (data.factionID != homeSystemOwner) { SetCapitulatedStatus(data.factionID, true); } } }
public FactionData GetFaction(int id) { if (!_factionMap.TryGetValue(id, out var item)) { _factionMap.Add(id, null); _factionMap[id] = item = FactionData.Deserialize(_jsonDatabase.GetFaction(id), this); } if (item == null) { throw new DatabaseException(CircularDependencyText + "Faction_" + id); } return(item); }
public ColonyData(WorldData w, FactionData f, NodeData node, bool first_colony) { Node = node; setFaction(f); world = w; //Ships=new List<ShipData>(); if (first_colony) { Energy = 20; Industry = industry_max; } }
// Use this for initialization public ServerFactions() { functionName = "Factions"; // Database tables name tableName = "factions"; functionTitle = "Factions Configuration"; loadButtonLabel = "Load Factions"; notLoadedText = "No Faction loaded."; // Init dataRegister = new Dictionary<int, FactionData> (); editingDisplay = new FactionData (); originalDisplay = new FactionData (); }
// Gets called when clciking a certain faction to play as public void FactionSelection(Button button) { ToggleFactionButton(); selectedFactionButton = button; ToggleFactionButton(); FactionData tempSelectedData = FactionData.LoadJSON(button.GetComponentInChildren <Text>().text + ".json"); selectedFactionImage.sprite = tempSelectedData.playerPortrait; selectedCharacterName.text = tempSelectedData.playerName; selectedCharacterVoice.text = tempSelectedData.voiceNames[tempSelectedData.voice]; selectedFactionName.text = tempSelectedData.factionName; selectedFactionFoodType.text = tempSelectedData.foodName[tempSelectedData.style]; selectedFactionAbility.text = tempSelectedData.attributeNames[tempSelectedData.attribute]; selectedFactionAbilityDescription.text = tempSelectedData.attributeDefinitions[tempSelectedData.attribute]; }
/// <summary> /// Increase/decrease faction reputation standing. /// </summary> /// <param name="factionArg"></param> /// <param name="repPtsArg"></param> private void ChangeFactionReputation(FactionData factionArg, int repPtsArg) { // if familiar with given faction if (AreFamiliarWithFaction(factionArg)) { // add/decrease faction's rep standing GetDataEntryAssociatedWithFaction(factionArg).valueInt += repPtsArg; } // else no knowledge of given faction else { // add new rep standing entry for given faction factionsAndReputationPoints.Add(new SerializableDataFactionDataAndInt(factionArg, repPtsArg)); } }
public void GetObjectData(object obj, SerializationInfo info, StreamingContext context) { FactionData data = (FactionData)obj; info.AddValue("name", data.factionName); info.AddValue("id", data.factionID); info.AddValue("colorR", data.factionColour.r); info.AddValue("colorG", data.factionColour.g); info.AddValue("colorB", data.factionColour.b); info.AddValue("colorA", data.factionColour.a); info.AddValue("capitulation", data.hasCapitulated); info.AddValue("homeSystem", data.homeSystem.nodeID); info.AddValue("explored", data.exploredSystemIDs); info.AddValue("controlled", data.ownedSystemIDs); }
void ParseFactionData(ref string[] block, ref FactionData faction) { string[] parts; int allyCount = 0; int enemyCount = 0; int flatCount = 0; for (int i = 0; i < block.Length; i++) { string line = block[i]; // Get faction id if (line.Contains("#")) { parts = line.Split('#'); faction.id = ParseInt(parts[1].Trim()); continue; } // Handle empty lines if (string.IsNullOrEmpty(line.Trim())) continue; // Split string into tag and value using ':' character parts = line.Split(':'); if (parts.Length != 2) { // Attempt to split by space // Original faction.txt has malformed tag missing colon // If this still fails throw an exception parts = line.Split(' '); if (parts.Length != 2) throw new Exception(string.Format("Invalid tag format for data {0} on faction {1}", line, faction.id)); } // Get tag and value strings string tag = parts[0].Trim().ToLower(); string value = parts[1].Trim(); // Set tag value in faction switch (tag) { case "name": faction.name = value; break; case "rep": faction.rep = ParseInt(value); break; case "summon": faction.summon = ParseInt(value); break; case "region": faction.region = ParseInt(value); break; case "type": faction.type = ParseInt(value); break; case "power": faction.power = ParseInt(value); break; case "flags": faction.flags = ParseInt(value); break; case "ruler": faction.ruler = ParseInt(value); break; case "face": faction.face = ParseInt(value); break; case "race": faction.race = ParseInt(value); break; case "sgroup": faction.sgroup = ParseInt(value); break; case "ggroup": faction.ggroup = ParseInt(value); break; case "minf": faction.minf = ParseInt(value); break; case "maxf": faction.maxf = ParseInt(value); break; case "vam": faction.vam = ParseInt(value); break; case "rank": faction.rank = ParseInt(value); break; case "ally": int ally = ParseInt(value); if (allyCount == 0) faction.ally1 = ally; else if (allyCount == 1) faction.ally2 = ally; else if (allyCount == 2) faction.ally3 = ally; else throw new Exception(string.Format("Too many allies for faction #{0}", faction.id)); allyCount++; break; case "enemy": int enemy = ParseInt(value); if (enemyCount == 0) faction.enemy1 = enemy; else if (enemyCount == 1) faction.enemy2 = enemy; else if (enemyCount == 2) faction.enemy3 = enemy; else throw new Exception(string.Format("Too many enemies for faction #{0}", faction.id)); enemyCount++; break; case "flat": int flat = ParseFlat(value); if (flat > 0) { if (flatCount == 0) { // When a single flat is specified Daggerfall stores for both male and female faction.flat1 = flat; faction.flat2 = flat; } else if (flatCount == 1) { // The second flat found is a female flat faction.flat2 = flat; } else { throw new Exception(string.Format("Too many flats for faction #{0}", faction.id)); } flatCount++; } break; default: throw new Exception(string.Format("Unexpected tag '{0}' with value '{1}' encountered on faction #{2}", tag, value, faction.id)); } } }
// Edit or Create public override void DrawEditor(Rect box, bool newItem) { // Setup the layout Rect pos = box; pos.x += ImagePack.innerMargin; pos.y += ImagePack.innerMargin; pos.width -= ImagePack.innerMargin; pos.height = ImagePack.fieldHeight; if (!linkedTablesLoaded) { LoadFactionOptions(); linkedTablesLoaded = true; } // Draw the content database info //pos.y += ImagePack.fieldHeight; if (newItem) { ImagePack.DrawLabel (pos.x, pos.y, "Create a new Faction"); pos.y += ImagePack.fieldHeight; } editingDisplay.name = ImagePack.DrawField (pos, "Name:", editingDisplay.name, 0.75f); pos.y += ImagePack.fieldHeight; editingDisplay.group = ImagePack.DrawField (pos, "Group:", editingDisplay.group, 0.75f); pos.y += ImagePack.fieldHeight; pos.width /= 2; editingDisplay.modifyable = ImagePack.DrawToggleBox (pos, "Dynamic:", editingDisplay.modifyable); pos.y += ImagePack.fieldHeight; int selectedStance = GetPositionOfStance(editingDisplay.defaultStance); selectedStance = ImagePack.DrawSelector (pos, "Default Stance:", selectedStance, FactionData.stanceOptions); editingDisplay.defaultStance = FactionData.stanceValues[selectedStance]; pos.y += 1.5f*ImagePack.fieldHeight; if (editingDisplay.factionStances.Count == 0) { editingDisplay.factionStances.Add(new FactionStanceEntry(0, 0)); } for (int i = 0; i < editingDisplay.factionStances.Count; i++) { ImagePack.DrawLabel (pos.x, pos.y, "Faction Stance:"); pos.y += ImagePack.fieldHeight; int otherFactionID = GetPositionOfFaction(editingDisplay.factionStances[i].otherFactionID); otherFactionID = ImagePack.DrawSelector (pos, "Other Faction:", otherFactionID, factionOptions); editingDisplay.factionStances[i].otherFactionID = factionIds[otherFactionID]; pos.x += pos.width; selectedStance = GetPositionOfStance(editingDisplay.factionStances[i].defaultStance); selectedStance = ImagePack.DrawSelector (pos, "Default Stance:", selectedStance, FactionData.stanceOptions); editingDisplay.factionStances[i].defaultStance = FactionData.stanceValues[selectedStance]; pos.y += ImagePack.fieldHeight; if (ImagePack.DrawButton (pos.x, pos.y, "Delete Stance")) { if (editingDisplay.factionStances[i].id > 0) editingDisplay.stancesToBeDeleted.Add(editingDisplay.factionStances[i].id); editingDisplay.factionStances.RemoveAt(i); } pos.x -= pos.width; pos.y += ImagePack.fieldHeight; } if (ImagePack.DrawButton (pos.x, pos.y, "Add Stance")) { editingDisplay.factionStances.Add(new FactionStanceEntry(0, 0)); } pos.width *= 2; pos.y += 1.4f * ImagePack.fieldHeight; // Save data pos.x -= ImagePack.innerMargin; pos.width /= 3; if (ImagePack.DrawButton (pos.x, pos.y, "Save Data")) { if (newItem) InsertEntry (); else UpdateEntry (); state = State.Loaded; } // Delete data if (!newItem) { pos.x += pos.width; if (ImagePack.DrawButton (pos.x, pos.y, "Delete Data")) { DeleteEntry (); newSelectedDisplay = 0; state = State.Loaded; } } // Cancel editing pos.x += pos.width; if (ImagePack.DrawButton (pos.x, pos.y, "Cancel")) { editingDisplay = originalDisplay.Clone(); if (newItem) state = State.New; else state = State.Loaded; } if (resultTimeout != -1 && resultTimeout > Time.realtimeSinceStartup) { pos.y += ImagePack.fieldHeight; ImagePack.DrawText(pos, result); } }
public override void CreateNewData() { editingDisplay = new FactionData (); originalDisplay = new FactionData (); selectedDisplay = -1; }
void LoadFactionStances(FactionData factionData) { // Read all entries from the table string query = "SELECT * FROM " + "faction_stances" + " where factionID = " + factionData.id; // If there is a row, clear it. if (rows != null) rows.Clear (); // Load data rows = DatabasePack.LoadData (DatabasePack.contentDatabasePrefix, query); //Debug.Log("#Rows:"+rows.Count); // Read all the data if ((rows!=null) && (rows.Count > 0)) { foreach (Dictionary<string,string> data in rows) { FactionStanceEntry entry = new FactionStanceEntry (); entry.id = int.Parse (data ["id"]); entry.factionID = int.Parse (data ["factionID"]); entry.otherFactionID = int.Parse (data ["otherFaction"]); entry.defaultStance = int.Parse (data ["defaultStance"]); factionData.factionStances.Add(entry); } } }
// Load Database Data public override void Load() { if (!dataLoaded) { // Clean old data dataRegister.Clear (); displayKeys.Clear (); // Read all entries from the table string query = "SELECT * FROM " + tableName; // If there is a row, clear it. if (rows != null) rows.Clear (); // Load data rows = DatabasePack.LoadData (DatabasePack.contentDatabasePrefix, query); //Debug.Log("#Rows:"+rows.Count); // Read all the data if ((rows!=null) && (rows.Count > 0)) { foreach (Dictionary<string,string> data in rows) { //foreach(string key in data.Keys) // Debug.Log("Name[" + key + "]:" + data[key]); //return; FactionData display = new FactionData (); display.id = int.Parse (data ["id"]); display.name = data ["name"]; display.group = data ["factionGroup"]; display.modifyable = bool.Parse(data ["public"]); display.defaultStance = int.Parse(data ["defaultStance"]); display.isLoaded = true; //Debug.Log("Name:" + display.name + "=[" + display.id + "]"); dataRegister.Add (display.id, display); displayKeys.Add (display.id); } LoadSelectList(); } dataLoaded = true; } foreach(FactionData factionData in dataRegister.Values) { LoadFactionStances(factionData); } }
public void init(FactionData factionData, int position, FactionInvitePanel parent, bool invite) { this.m_parent = parent; this.m_position = position; this.m_factionData = factionData; this.clearControls(); if ((position & 1) == 0) { this.backgroundImage.Image = (Image) GFXLibrary.lineitem_strip_02_light; } else { this.backgroundImage.Image = (Image) GFXLibrary.lineitem_strip_02_dark; } this.backgroundImage.Position = new Point(60, 0); base.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clickedLine)); base.addControl(this.backgroundImage); this.Size = this.backgroundImage.Size; this.flagImage.createFromFlagData(factionData.flagData); this.flagImage.Position = new Point(0, 0); this.flagImage.Scale = 0.25; this.flagImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clickedLine)); base.addControl(this.flagImage); NumberFormatInfo nFI = GameEngine.NFI; this.playerName.Text = factionData.factionName; this.playerName.Color = ARGBColors.Black; this.playerName.Position = new Point(9, 0); this.playerName.Size = new Size(280, this.backgroundImage.Height); this.playerName.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.playerName.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT; this.playerName.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clickedLine)); this.backgroundImage.addControl(this.playerName); if (invite) { if (RemoteServices.Instance.UserFactionID < 0) { this.acceptButton.ImageNorm = (Image) GFXLibrary.mail2_button_blue_141wide_normal; this.acceptButton.ImageOver = (Image) GFXLibrary.mail2_button_blue_141wide_over; this.acceptButton.ImageClick = (Image) GFXLibrary.mail2_button_blue_141wide_pushed; this.acceptButton.Position = new Point(350, 0); this.acceptButton.Text.Text = SK.Text("FactionInviteLine_Accept", "Accept"); this.acceptButton.Text.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.acceptButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold); this.acceptButton.TextYOffset = -3; this.acceptButton.Text.Color = ARGBColors.Black; this.acceptButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.acceptClicked), "FactionInvitePanel_accept_clicked"); this.backgroundImage.addControl(this.acceptButton); } this.declineButton.ImageNorm = (Image) GFXLibrary.mail2_button_blue_141wide_normal; this.declineButton.ImageOver = (Image) GFXLibrary.mail2_button_blue_141wide_over; this.declineButton.ImageClick = (Image) GFXLibrary.mail2_button_blue_141wide_pushed; this.declineButton.Position = new Point(500, 0); this.declineButton.Text.Text = SK.Text("FactionInviteLine_Decline", "Decline"); this.declineButton.Text.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.declineButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold); this.declineButton.TextYOffset = -3; this.declineButton.Text.Color = ARGBColors.Black; this.declineButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.declineClicked), "FactionInvitePanel_declined_clicked"); this.backgroundImage.addControl(this.declineButton); } else { this.declineButton.ImageNorm = (Image) GFXLibrary.mail2_button_blue_141wide_normal; this.declineButton.ImageOver = (Image) GFXLibrary.mail2_button_blue_141wide_over; this.declineButton.ImageClick = (Image) GFXLibrary.mail2_button_blue_141wide_pushed; this.declineButton.Position = new Point(500, 0); this.declineButton.Text.Text = SK.Text("GENERIC_Cancel", "Cancel"); this.declineButton.Text.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.declineButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold); this.declineButton.TextYOffset = -3; this.declineButton.Text.Color = ARGBColors.Black; this.declineButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.appCancelClicked), "FactionInvitePanel_declined_clicked"); this.backgroundImage.addControl(this.declineButton); } base.invalidate(); }
public void init(bool resized) { int height = base.Height; instance = this; base.clearControls(); NumberFormatInfo nFI = GameEngine.NFI; this.sidebar.addSideBar(3, this); FactionData yourFaction = GameEngine.Instance.World.YourFaction; if (yourFaction == null) { yourFaction = new FactionData(); } this.mainBackgroundImage.FillColor = Color.FromArgb(0x86, 0x99, 0xa5); this.mainBackgroundImage.Position = new Point(0, 0); this.mainBackgroundImage.Size = new Size(base.Width - 200, height); base.addControl(this.mainBackgroundImage); this.backgroundFade.Image = (Image) GFXLibrary.background_top; this.backgroundFade.Position = new Point(0, 0); this.backgroundFade.Size = new Size(base.Width - 200, this.backgroundFade.Image.Height); this.mainBackgroundImage.addControl(this.backgroundFade); this.backImage1.Image = (Image) GFXLibrary.faction_tanback; this.backImage1.Position = new Point((this.mainBackgroundImage.Size.Width - this.backImage1.Size.Width) - 0x19, 12); this.mainBackgroundImage.addControl(this.backImage1); this.backImage2.Image = (Image) GFXLibrary.faction_title_band; this.backImage2.Position = new Point(20, 20); this.mainBackgroundImage.addControl(this.backImage2); this.barImage1.Image = (Image) GFXLibrary.faction_bar_tan_1_heavier; this.barImage1.Position = new Point(0x114, 70); this.mainBackgroundImage.addControl(this.barImage1); this.barImage2.Image = (Image) GFXLibrary.faction_bar_tan_1_lighter; this.barImage2.Position = new Point(0x114, 0x5e); this.mainBackgroundImage.addControl(this.barImage2); this.barImage3.Image = (Image) GFXLibrary.faction_bar_tan_1_heavier; this.barImage3.Position = new Point(0x114, 0x76); this.mainBackgroundImage.addControl(this.barImage3); this.factionNameLabel.Text = yourFaction.factionName; this.factionNameLabel.Color = ARGBColors.Black; this.factionNameLabel.Position = new Point(0xcd, 10); this.factionNameLabel.Size = new Size(600, 40); this.factionNameLabel.Font = FontManager.GetFont("Arial", 20f, FontStyle.Regular); this.factionNameLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.factionNameLabel); int num2 = GameEngine.Instance.World.getYourFactionRank(); this.factionMottoLabel.Text = "\"" + yourFaction.factionMotto + "\""; this.factionMottoLabel.Color = ARGBColors.Black; if (num2 == 1) { this.factionMottoLabel.Position = new Point(230, 0x29); } else { this.factionMottoLabel.Position = new Point(0xcd, 0x29); } this.factionMottoLabel.Size = new Size(600, 40); this.factionMottoLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular); this.factionMottoLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.factionMottoLabel); this.applicationButton.ImageNorm = (Image) GFXLibrary.misc_button_blue_210wide_normal; this.applicationButton.ImageOver = (Image) GFXLibrary.misc_button_blue_210wide_over; this.applicationButton.ImageClick = (Image) GFXLibrary.misc_button_blue_210wide_pushed; this.applicationButton.Position = new Point(0x18, 0x7e); if (yourFaction.openForApplications) { this.applicationButton.Text.Text = SK.Text("FactionInvites_Accepting_Apps", "Accepting"); } else { this.applicationButton.Text.Text = SK.Text("FactionInvites_Not_Accepting_App", "Not Accepting"); } this.applicationButton.Text.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.applicationButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold); this.applicationButton.TextYOffset = -3; this.applicationButton.Text.Color = ARGBColors.Black; this.applicationButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.setApplicationModeClicked)); this.applicationButton.Enabled = true; this.mainBackgroundImage.addControl(this.applicationButton); this.applicationsLabel.Text = SK.Text("FactionInvites_Applications", "Applications"); this.applicationsLabel.Color = ARGBColors.Black; this.applicationsLabel.Position = new Point(0x18, 0x60); this.applicationsLabel.Size = this.applicationButton.Size; this.applicationsLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.applicationsLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.mainBackgroundImage.addControl(this.applicationsLabel); if (num2 == 1) { this.editButton.ImageNorm = (Image) GFXLibrary.faction_pen; this.editButton.ImageOver = (Image) GFXLibrary.faction_pen; this.editButton.ImageClick = (Image) GFXLibrary.faction_pen; this.editButton.Position = new Point(0xcd, 0x29); this.editButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.editClicked), "FactionOfficersPanel_edit"); this.mainBackgroundImage.addControl(this.editButton); } if (yourFaction.houseID > 0) { this.houseLabel.Text = SK.Text("STATS_CATEGORY_TITLE_HOUSE", "House") + " " + yourFaction.houseID.ToString(); this.houseLabel.Color = ARGBColors.Black; this.houseLabel.Position = new Point(0x23f, 110); this.houseLabel.Size = new Size(200, 50); this.houseLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular); this.houseLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.houseLabel.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.houseClicked), "FactionOfficersPanel_house"); this.mainBackgroundImage.addControl(this.houseLabel); this.houseImage.Image = (Image) GFXLibrary.house_circles_large[yourFaction.houseID - 1]; this.houseImage.Position = new Point(0x2a3 - (this.houseImage.Image.Width / 2), (0x41 - (this.houseImage.Image.Height / 2)) + 8); this.houseImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.houseClicked), "FactionOfficersPanel_house"); this.mainBackgroundImage.addControl(this.houseImage); } this.membersLabel.Text = SK.Text("FactionInvites_Members", "Members"); this.membersLabel.Color = ARGBColors.Black; this.membersLabel.Position = new Point(0x11c, 0x49); this.membersLabel.Size = new Size(600, 40); this.membersLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.membersLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.membersLabel); this.membersLabelValue.Text = yourFaction.numMembers.ToString(); this.membersLabelValue.Color = ARGBColors.Black; this.membersLabelValue.Position = new Point(30, 0x49); this.membersLabelValue.Size = new Size(0x1e2, 40); this.membersLabelValue.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.membersLabelValue.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; this.mainBackgroundImage.addControl(this.membersLabelValue); this.rankHeaderLabel.Text = SK.Text("STATS_CATEGORY_TITLE_RANK", "Rank"); this.rankHeaderLabel.Color = ARGBColors.Black; this.rankHeaderLabel.Position = new Point(0x11c, 0x79); this.rankHeaderLabel.Size = new Size(600, 40); this.rankHeaderLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.rankHeaderLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.rankHeaderLabel); this.rankHeaderLabelValue.Text = (GameEngine.Instance.World.getYourFactionRank() + 1).ToString("N", nFI); this.rankHeaderLabelValue.Color = ARGBColors.Black; this.rankHeaderLabelValue.Position = new Point(30, 0x79); this.rankHeaderLabelValue.Size = new Size(0x1e2, 40); this.rankHeaderLabelValue.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.rankHeaderLabelValue.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; this.mainBackgroundImage.addControl(this.rankHeaderLabelValue); this.pointsHeaderLabel.Text = SK.Text("FactionsPanel_Points", "Points"); this.pointsHeaderLabel.Color = ARGBColors.Black; this.pointsHeaderLabel.Position = new Point(0x11c, 0x61); this.pointsHeaderLabel.Size = new Size(600, 40); this.pointsHeaderLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.pointsHeaderLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.pointsHeaderLabel); this.pointsHeaderLabelValue.Text = yourFaction.points.ToString("N", nFI); this.pointsHeaderLabelValue.Color = ARGBColors.Black; this.pointsHeaderLabelValue.Position = new Point(30, 0x61); this.pointsHeaderLabelValue.Size = new Size(0x1e2, 40); this.pointsHeaderLabelValue.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.pointsHeaderLabelValue.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; this.mainBackgroundImage.addControl(this.pointsHeaderLabelValue); this.headerLabelsImage.Size = new Size(((base.Width - 0x19) - 0x17) - 200, 0x1c); this.headerLabelsImage.Position = new Point(0x19, 0x9f); this.mainBackgroundImage.addControl(this.headerLabelsImage); this.headerLabelsImage.Create((Image) GFXLibrary.mail2_field_bar_mail_left, (Image) GFXLibrary.mail2_field_bar_mail_middle, (Image) GFXLibrary.mail2_field_bar_mail_right); this.playerNameLabel.Text = SK.Text("UserInfoPanel_", "Player Name"); this.playerNameLabel.Color = ARGBColors.Black; this.playerNameLabel.Position = new Point(9, -2); this.playerNameLabel.Size = new Size(0x143, this.headerLabelsImage.Height); this.playerNameLabel.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.playerNameLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT; this.headerLabelsImage.addControl(this.playerNameLabel); this.leadershipVoteLabel.Text = SK.Text("FactionsPanel_Leadership_Vote", "Leadership Vote"); this.leadershipVoteLabel.Color = ARGBColors.Black; this.leadershipVoteLabel.Position = new Point(0x1bc, -2); this.leadershipVoteLabel.Size = new Size(300, this.headerLabelsImage.Height); this.leadershipVoteLabel.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.leadershipVoteLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.headerLabelsImage.addControl(this.leadershipVoteLabel); InterfaceMgr.Instance.setVillageHeading(SK.Text("FactionInvites_Faction_Officers", "Faction Officers")); this.inviteButton.ImageNorm = (Image) GFXLibrary.mail2_button_blue_141wide_normal; this.inviteButton.ImageOver = (Image) GFXLibrary.mail2_button_blue_141wide_over; this.inviteButton.ImageClick = (Image) GFXLibrary.mail2_button_blue_141wide_pushed; this.inviteButton.Position = new Point(20, height - 30); this.inviteButton.Text.Text = SK.Text("FactionsPanel_Invite_User", "Invite User"); this.inviteButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold); this.inviteButton.TextYOffset = -3; this.inviteButton.Text.Color = ARGBColors.Black; this.inviteButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.inviteClick), "FactionOfficersPanel_invite"); this.mainBackgroundImage.addControl(this.inviteButton); this.wallScrollArea.Position = new Point(0x19, 0xbc); this.wallScrollArea.Size = new Size(0x2c1, ((height - 50) - 150) - 40); this.wallScrollArea.ClipRect = new Rectangle(new Point(0, 0), new Size(0x2c1, ((height - 50) - 150) - 40)); this.mainBackgroundImage.addControl(this.wallScrollArea); this.mouseWheelOverlay.Position = this.wallScrollArea.Position; this.mouseWheelOverlay.Size = this.wallScrollArea.Size; this.mouseWheelOverlay.setMouseWheelDelegate(new CustomSelfDrawPanel.CSDControl.CSD_MouseWheelDelegate(this.mouseWheelMoved)); this.mainBackgroundImage.addControl(this.mouseWheelOverlay); this.flagimage.createFromFlagData(yourFaction.flagData); this.flagimage.Position = new Point(0x23, 6); this.flagimage.Scale = 0.5; this.flagimage.ClickArea = new Rectangle(0, 0, GFXLibrary.factionFlags[0].Width / 2, GFXLibrary.factionFlags[0].Height / 2); if (num2 == 1) { this.flagimage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.editClicked), "FactionOfficersPanel_edit"); } else { this.flagimage.setClickDelegate(null); } this.mainBackgroundImage.addControl(this.flagimage); int num1 = this.wallScrollBar.Value; this.wallScrollBar.Visible = false; this.wallScrollBar.Position = new Point(0x2dd, 0xbc); this.wallScrollBar.Size = new Size(0x18, ((height - 50) - 150) - 40); this.mainBackgroundImage.addControl(this.wallScrollBar); this.wallScrollBar.Value = 0; this.wallScrollBar.Max = 100; this.wallScrollBar.NumVisibleLines = 0x19; this.wallScrollBar.Create(null, null, null, (Image) GFXLibrary._24wide_thumb_top, (Image) GFXLibrary._24wide_thumb_middle, (Image) GFXLibrary._24wide_thumb_bottom); this.wallScrollBar.setValueChangeDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ValueChangedDelegate(this.wallScrollBarMoved)); bool uptodate = false; FactionMemberData[] fmd = GameEngine.Instance.World.getFactionMemberData(yourFaction.factionID, ref uptodate); if (!resized && !uptodate) { RemoteServices.Instance.set_GetViewFactionData_UserCallBack(new RemoteServices.GetViewFactionData_UserCallBack(this.getViewFactionDataCallback)); RemoteServices.Instance.GetViewFactionData(yourFaction.factionID); } this.addPlayers(fmd); }
public void init(FactionData factionData, int position, bool ally, FactionDiplomacyPanel parent) { this.m_parent = parent; this.m_position = position; this.m_factionData = factionData; this.clearControls(); if ((position & 1) == 0) { this.backgroundImage.Image = (Image) GFXLibrary.lineitem_strip_02_light; } else { this.backgroundImage.Image = (Image) GFXLibrary.lineitem_strip_02_dark; } this.backgroundImage.Position = new Point(60, 0); this.backgroundImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.factionClick)); base.addControl(this.backgroundImage); this.Size = this.backgroundImage.Size; this.flagImage.createFromFlagData(factionData.flagData); this.flagImage.Position = new Point(0, 0); this.flagImage.Scale = 0.25; this.flagImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.factionClick)); base.addControl(this.flagImage); this.factionName.Text = factionData.factionName; this.factionName.Color = ARGBColors.Black; this.factionName.Position = new Point(9, 0); this.factionName.Size = new Size(500, this.backgroundImage.Height); this.factionName.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.factionName.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT; this.factionName.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.factionClick)); this.backgroundImage.addControl(this.factionName); }
public void init(FactionData factionData, int position, HouseInfoPanel parent) { this.m_parent = parent; this.m_position = position; this.m_factionData = factionData; this.m_application = false; this.clearControls(); if ((position & 1) == 0) { this.backgroundImage.Image = (Image) GFXLibrary.lineitem_strip_02_light; } else { this.backgroundImage.Image = (Image) GFXLibrary.lineitem_strip_02_dark; } this.backgroundImage.Position = new Point(60, 0); base.addControl(this.backgroundImage); this.Size = this.backgroundImage.Size; this.flagImage.createFromFlagData(factionData.flagData); this.flagImage.Position = new Point(0, 0); this.flagImage.Scale = 0.25; this.flagImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clickedLine)); base.addControl(this.flagImage); NumberFormatInfo nFI = GameEngine.NFI; this.factionName.Text = factionData.factionName; this.factionName.Color = ARGBColors.Black; this.factionName.Position = new Point(9, 0); this.factionName.Size = new Size(220, this.backgroundImage.Height); this.factionName.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.factionName.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT; this.factionName.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clickedLine)); this.backgroundImage.addControl(this.factionName); this.pointsLabel.Text = factionData.points.ToString("N", nFI); this.pointsLabel.Color = ARGBColors.Black; this.pointsLabel.Position = new Point(0xeb, 0); this.pointsLabel.Size = new Size(100, this.backgroundImage.Height); this.pointsLabel.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.pointsLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_RIGHT; this.pointsLabel.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.clickedLine)); this.backgroundImage.addControl(this.pointsLabel); base.invalidate(); }
void ParseFactions(string txt) { // Unmodded faction.txt contains multiples of same id // This resolver counter is used to give a faction a unique id if needed int resolverId = 1000; // Clear existing dictionary factionDict.Clear(); // First pass reads each faction text block in order List<string[]> factionBlocks = new List<string[]>(); using (StringReader reader = new StringReader(txt)) { List<string> currentblock = new List<string>(); while (true) { // Handle end of file string line = reader.ReadLine(); if (line == null) { // Store final block if (currentblock.Count > 0) factionBlocks.Add(currentblock.ToArray()); break; } // Ignore comment lines and empty lines if (line.StartsWith(";") || string.IsNullOrEmpty(line)) continue; // All factions blocks start with a '#' character if (line.Contains("#")) { // Store current block if (currentblock.Count > 0) factionBlocks.Add(currentblock.ToArray()); // Start new block currentblock.Clear(); } // Add line to current faction block currentblock.Add(line); } } // Second pass parses the text block into FactionData int lastPrecedingTabs = 0; FactionData previousFaction = new FactionData(); Stack<int> parentStack = new Stack<int>(); for (int i = 0; i < factionBlocks.Count; i++) { // Start a new faction FactionData faction = new FactionData(); string[] block = factionBlocks[i]; // Parent child relationship determined by preceding tabs int precedingTabs = CountPrecedingTabs(block[0]); if (precedingTabs > lastPrecedingTabs) { parentStack.Push(previousFaction.id); } else if (precedingTabs < lastPrecedingTabs) { while(parentStack.Count > precedingTabs) parentStack.Pop(); } lastPrecedingTabs = precedingTabs; // Set parent from top of stack if (parentStack.Count > 0) faction.parent = parentStack.Peek(); // Parse faction block ParseFactionData(ref block, ref faction); // Store faction just read if (!factionDict.ContainsKey(faction.id)) { factionDict.Add(faction.id, faction); } else { // Duplicate id detected faction.id = resolverId++; factionDict.Add(faction.id, faction); } previousFaction = faction; } }
// Draw the loaded list public override void DrawLoaded(Rect box) { // Setup the layout Rect pos = box; pos.x += ImagePack.innerMargin; pos.y += ImagePack.innerMargin; pos.width -= ImagePack.innerMargin; pos.height = ImagePack.fieldHeight; if (dataRegister.Count <= 0) { pos.y += ImagePack.fieldHeight; ImagePack.DrawLabel (pos.x, pos.y, "You must create a Faction before edit it."); return; } // Draw the content database info ImagePack.DrawLabel (pos.x, pos.y, "Faction Configuration"); if (newItemCreated) { newItemCreated = false; LoadSelectList(); newSelectedDisplay = displayKeys.Count - 1; } // Draw data Editor if (newSelectedDisplay != selectedDisplay) { selectedDisplay = newSelectedDisplay; int displayKey = displayKeys [selectedDisplay]; editingDisplay = dataRegister [displayKey]; originalDisplay = editingDisplay.Clone(); } //if (!displayList.showList) { pos.y += ImagePack.fieldHeight; pos.x -= ImagePack.innerMargin; pos.y -= ImagePack.innerMargin; pos.width += ImagePack.innerMargin; DrawEditor (pos, false); pos.y -= ImagePack.fieldHeight; //pos.x += ImagePack.innerMargin; pos.y += ImagePack.innerMargin; pos.width -= ImagePack.innerMargin; //} if (state != State.Loaded) { // Draw combobox pos.width /= 2; pos.x += pos.width; newSelectedDisplay = ImagePack.DrawCombobox (pos, "", selectedDisplay, displayList); pos.x -= pos.width; pos.width *= 2; } }
public void init(bool resized) { int height = base.Height; instance = this; base.clearControls(); NumberFormatInfo nFI = GameEngine.NFI; this.sidebar.addSideBar(1, this); FactionData data = GameEngine.Instance.World.getFaction(m_selectedFaction); if (data == null) { data = new FactionData(); } this.greyOverlay.Size = base.Size; this.mainBackgroundImage.FillColor = Color.FromArgb(0x86, 0x99, 0xa5); this.mainBackgroundImage.Position = new Point(0, 0); this.mainBackgroundImage.Size = new Size(base.Width - 200, height); base.addControl(this.mainBackgroundImage); this.backgroundFade.Image = (Image) GFXLibrary.background_top; this.backgroundFade.Position = new Point(0, 0); this.backgroundFade.Size = new Size(base.Width - 200, this.backgroundFade.Image.Height); this.mainBackgroundImage.addControl(this.backgroundFade); this.backImage1.Image = (Image) GFXLibrary.faction_tanback; this.backImage1.Position = new Point((this.mainBackgroundImage.Size.Width - this.backImage1.Size.Width) - 0x19, 12); this.mainBackgroundImage.addControl(this.backImage1); this.backImage2.Image = (Image) GFXLibrary.faction_title_band; this.backImage2.Position = new Point(20, 20); this.mainBackgroundImage.addControl(this.backImage2); this.barImage1.Image = (Image) GFXLibrary.faction_bar_tan_1_heavier; this.barImage1.Position = new Point(0x114, 70); this.mainBackgroundImage.addControl(this.barImage1); this.barImage2.Image = (Image) GFXLibrary.faction_bar_tan_1_lighter; this.barImage2.Position = new Point(0x114, 0x5e); this.mainBackgroundImage.addControl(this.barImage2); this.barImage3.Image = (Image) GFXLibrary.faction_bar_tan_1_heavier; this.barImage3.Position = new Point(0x114, 0x76); this.mainBackgroundImage.addControl(this.barImage3); this.factionNameLabel.Text = data.factionName; this.factionNameLabel.Color = ARGBColors.Black; this.factionNameLabel.Position = new Point(0xcd, 10); this.factionNameLabel.Size = new Size(600, 40); this.factionNameLabel.Font = FontManager.GetFont("Arial", 20f, FontStyle.Regular); this.factionNameLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.factionNameLabel); this.factionMottoLabel.Text = "\"" + data.factionMotto + "\""; this.factionMottoLabel.Color = ARGBColors.Black; this.factionMottoLabel.Position = new Point(0xcd, 0x29); this.factionMottoLabel.Size = new Size(600, 40); this.factionMottoLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular); this.factionMottoLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.factionMottoLabel); if (data.houseID > 0) { this.houseLabel.Text = SK.Text("STATS_CATEGORY_TITLE_HOUSE", "House") + " " + data.houseID.ToString(); this.houseLabel.Color = ARGBColors.Black; this.houseLabel.Position = new Point(0x23f, 110); this.houseLabel.Size = new Size(200, 50); this.houseLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular); this.houseLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.houseLabel.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.houseClicked), "FactionMyFactionPanel_house"); this.mainBackgroundImage.addControl(this.houseLabel); this.houseImage.Image = (Image) GFXLibrary.house_circles_large[data.houseID - 1]; this.houseImage.Position = new Point(0x2a3 - (this.houseImage.Image.Width / 2), (0x41 - (this.houseImage.Image.Height / 2)) + 8); this.houseImage.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.houseClicked), "FactionMyFactionPanel_house"); this.mainBackgroundImage.addControl(this.houseImage); } this.membersLabel.Text = SK.Text("FactionInvites_Members", "Members"); this.membersLabel.Color = ARGBColors.Black; this.membersLabel.Position = new Point(0x11c, 0x49); this.membersLabel.Size = new Size(600, 40); this.membersLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.membersLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.membersLabel); this.membersLabelValue.Text = data.numMembers.ToString(); this.membersLabelValue.Color = ARGBColors.Black; this.membersLabelValue.Position = new Point(30, 0x49); this.membersLabelValue.Size = new Size(0x1e2, 40); this.membersLabelValue.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.membersLabelValue.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; this.mainBackgroundImage.addControl(this.membersLabelValue); this.rankHeaderLabel.Text = SK.Text("STATS_CATEGORY_TITLE_RANK", "Rank"); this.rankHeaderLabel.Color = ARGBColors.Black; this.rankHeaderLabel.Position = new Point(0x11c, 0x79); this.rankHeaderLabel.Size = new Size(600, 40); this.rankHeaderLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.rankHeaderLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.rankHeaderLabel); this.rankHeaderLabelValue.Text = (GameEngine.Instance.World.getFactionRank(m_selectedFaction) + 1).ToString("N", nFI); this.rankHeaderLabelValue.Color = ARGBColors.Black; this.rankHeaderLabelValue.Position = new Point(30, 0x79); this.rankHeaderLabelValue.Size = new Size(0x1e2, 40); this.rankHeaderLabelValue.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.rankHeaderLabelValue.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; this.mainBackgroundImage.addControl(this.rankHeaderLabelValue); this.pointsHeaderLabel.Text = SK.Text("FactionsPanel_Points", "Points"); this.pointsHeaderLabel.Color = ARGBColors.Black; this.pointsHeaderLabel.Position = new Point(0x11c, 0x61); this.pointsHeaderLabel.Size = new Size(600, 40); this.pointsHeaderLabel.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.pointsHeaderLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.pointsHeaderLabel); this.pointsHeaderLabelValue.Text = data.points.ToString("N", nFI); this.pointsHeaderLabelValue.Color = ARGBColors.Black; this.pointsHeaderLabelValue.Position = new Point(30, 0x61); this.pointsHeaderLabelValue.Size = new Size(0x1e2, 40); this.pointsHeaderLabelValue.Font = FontManager.GetFont("Arial", 10f, FontStyle.Regular); this.pointsHeaderLabelValue.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; this.mainBackgroundImage.addControl(this.pointsHeaderLabelValue); this.headerLabelsImage.Size = new Size(((base.Width - 0x19) - 0x17) - 200, 0x1c); this.headerLabelsImage.Position = new Point(0x19, 0x9f); this.mainBackgroundImage.addControl(this.headerLabelsImage); this.headerLabelsImage.Create((Image) GFXLibrary.mail2_field_bar_mail_left, (Image) GFXLibrary.mail2_field_bar_mail_middle, (Image) GFXLibrary.mail2_field_bar_mail_right); this.divider1Image.Image = (Image) GFXLibrary.mail2_field_bar_mail_divider; this.divider1Image.Position = new Point(290, 0); this.headerLabelsImage.addControl(this.divider1Image); this.divider2Image.Image = (Image) GFXLibrary.mail2_field_bar_mail_divider; this.divider2Image.Position = new Point(440, 0); this.headerLabelsImage.addControl(this.divider2Image); this.divider3Image.Image = (Image) GFXLibrary.mail2_field_bar_mail_divider; this.divider3Image.Position = new Point(610, 0); this.headerLabelsImage.addControl(this.divider3Image); this.playerNameLabel.Text = SK.Text("UserInfoPanel_", "Player Name"); this.playerNameLabel.Color = ARGBColors.Black; this.playerNameLabel.Position = new Point(9, -2); this.playerNameLabel.Size = new Size(0x143, this.headerLabelsImage.Height); this.playerNameLabel.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.playerNameLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT; this.headerLabelsImage.addControl(this.playerNameLabel); this.pointsLabel.Text = SK.Text("FactionsPanel_Points", "Points"); this.pointsLabel.Color = ARGBColors.Black; this.pointsLabel.Position = new Point(0x127, -2); this.pointsLabel.Size = new Size(140, this.headerLabelsImage.Height); this.pointsLabel.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.pointsLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.headerLabelsImage.addControl(this.pointsLabel); this.rankLabel.Text = SK.Text("STATS_CATEGORY_TITLE_RANK", "Rank"); this.rankLabel.Color = ARGBColors.Black; this.rankLabel.Position = new Point(0x1bd, -2); this.rankLabel.Size = new Size(0xdf, this.headerLabelsImage.Height); this.rankLabel.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.rankLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_LEFT; this.headerLabelsImage.addControl(this.rankLabel); this.villagesLabel.Text = SK.Text("UserInfoPanel_Villages", "Villages"); this.villagesLabel.Color = ARGBColors.Black; this.villagesLabel.Position = new Point(0x267, -2); this.villagesLabel.Size = new Size(110, this.headerLabelsImage.Height); this.villagesLabel.Font = FontManager.GetFont("Arial", 9f, FontStyle.Regular); this.villagesLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.headerLabelsImage.addControl(this.villagesLabel); this.flagimage.createFromFlagData(data.flagData); this.flagimage.Position = new Point(0x23, 6); this.flagimage.Scale = 0.5; this.mainBackgroundImage.addControl(this.flagimage); if (data.factionID == RemoteServices.Instance.UserFactionID) { InterfaceMgr.Instance.setVillageHeading(SK.Text("FactionInvites_My_Faction_Details", "My Faction Details")); } else { InterfaceMgr.Instance.setVillageHeading(SK.Text("FactionInvites_Faction_Details", "Faction Details")); } if ((RemoteServices.Instance.UserFactionID < 0) && GameEngine.Instance.World.alreadyGotFactionApplication(data.factionID)) { this.diplomacyLabel.Text = SK.Text("FactionInvites_Application Pending", "Application Pending"); this.diplomacyLabel.Color = ARGBColors.Black; this.diplomacyLabel.Position = new Point(0x18, 0x7e); this.diplomacyLabel.Size = new Size(240, 40); this.diplomacyLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular); this.diplomacyLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_LEFT; this.mainBackgroundImage.addControl(this.diplomacyLabel); } else if (((RemoteServices.Instance.UserFactionID < 0) && data.openForApplications) && !GameEngine.Instance.World.alreadyGotFactionApplication(data.factionID)) { if (GameEngine.Instance.World.getRank() >= 6) { this.diplomacyButton.ImageNorm = (Image) GFXLibrary.misc_button_blue_210wide_normal; this.diplomacyButton.ImageOver = (Image) GFXLibrary.misc_button_blue_210wide_over; this.diplomacyButton.ImageClick = (Image) GFXLibrary.misc_button_blue_210wide_pushed; this.diplomacyButton.Position = new Point(0x18, 0x7e); this.diplomacyButton.Text.Text = SK.Text("FactionInvites_Apply", "Apply To Join"); this.diplomacyButton.Text.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.diplomacyButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold); this.diplomacyButton.TextYOffset = -3; this.diplomacyButton.Text.Color = ARGBColors.Black; this.diplomacyButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.applyClicked), "FactionMyFactionPanel_diplomacy"); this.mainBackgroundImage.addControl(this.diplomacyButton); } } else if (data.factionID != RemoteServices.Instance.UserFactionID) { if (GameEngine.Instance.World.getYourFactionRank() == 1) { this.diplomacyButton.ImageNorm = (Image) GFXLibrary.misc_button_blue_210wide_normal; this.diplomacyButton.ImageOver = (Image) GFXLibrary.misc_button_blue_210wide_over; this.diplomacyButton.ImageClick = (Image) GFXLibrary.misc_button_blue_210wide_pushed; this.diplomacyButton.Position = new Point(0x18, 0x7e); this.diplomacyButton.Text.Text = ""; this.diplomacyButton.Text.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.CENTER_CENTER; this.diplomacyButton.Text.Font = FontManager.GetFont("Arial", 9f, FontStyle.Bold); this.diplomacyButton.TextYOffset = -3; this.diplomacyButton.Text.Color = ARGBColors.Black; this.diplomacyButton.setClickDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ClickDelegate(this.diplomacyClicked), "FactionMyFactionPanel_diplomacy"); this.mainBackgroundImage.addControl(this.diplomacyButton); } else { this.diplomacyLabel.Text = ""; this.diplomacyLabel.Color = ARGBColors.Black; this.diplomacyLabel.Position = new Point(0x18, 0x7e); this.diplomacyLabel.Size = new Size(240, 40); this.diplomacyLabel.Font = FontManager.GetFont("Arial", 12f, FontStyle.Regular); this.diplomacyLabel.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_RIGHT; this.mainBackgroundImage.addControl(this.diplomacyLabel); } } this.wallScrollArea.Position = new Point(0x19, 0xbc); this.wallScrollArea.Size = new Size(0x2c1, (height - 0x26) - 150); this.wallScrollArea.ClipRect = new Rectangle(new Point(0, 0), new Size(0x2c1, (height - 0x26) - 150)); this.mainBackgroundImage.addControl(this.wallScrollArea); this.mouseWheelOverlay.Position = this.wallScrollArea.Position; this.mouseWheelOverlay.Size = this.wallScrollArea.Size; this.mouseWheelOverlay.setMouseWheelDelegate(new CustomSelfDrawPanel.CSDControl.CSD_MouseWheelDelegate(this.mouseWheelMoved)); this.mainBackgroundImage.addControl(this.mouseWheelOverlay); int num1 = this.wallScrollBar.Value; this.wallScrollBar.Position = new Point(0x2dd, 0xbc); this.wallScrollBar.Size = new Size(0x18, (height - 0x26) - 150); this.mainBackgroundImage.addControl(this.wallScrollBar); this.wallScrollBar.Value = 0; this.wallScrollBar.Max = 100; this.wallScrollBar.NumVisibleLines = 0x19; this.wallScrollBar.Create(null, null, null, (Image) GFXLibrary._24wide_thumb_top, (Image) GFXLibrary._24wide_thumb_middle, (Image) GFXLibrary._24wide_thumb_bottom); this.wallScrollBar.setValueChangeDelegate(new CustomSelfDrawPanel.CSDControl.CSD_ValueChangedDelegate(this.wallScrollBarMoved)); bool uptodate = false; FactionMemberData[] fmd = GameEngine.Instance.World.getFactionMemberData(m_selectedFaction, ref uptodate); if (!resized) { if ((GameEngine.Instance.LocalWorldData.AIWorld && (data.factionID >= 1)) && (data.factionID <= 4)) { uptodate = true; fmd = new FactionMemberData[] { new FactionMemberData() }; switch (data.factionID) { case 1: fmd[0].userID = 1; fmd[0].userName = "******"; fmd[0].status = 1; fmd[0].numVillages = GameEngine.Instance.World.countRatsCastles(); break; case 2: fmd[0].userID = 2; fmd[0].userName = "******"; fmd[0].status = 1; fmd[0].numVillages = GameEngine.Instance.World.countSnakesCastles(); break; case 3: fmd[0].userID = 3; fmd[0].userName = "******"; fmd[0].status = 1; fmd[0].numVillages = GameEngine.Instance.World.countPigsCastles(); break; case 4: fmd[0].userID = 4; fmd[0].userName = "******"; fmd[0].status = 1; fmd[0].numVillages = GameEngine.Instance.World.countWolfsCastles(); break; } } if (!uptodate) { RemoteServices.Instance.set_GetViewFactionData_UserCallBack(new RemoteServices.GetViewFactionData_UserCallBack(this.getViewFactionDataCallback)); RemoteServices.Instance.GetViewFactionData(m_selectedFaction); } this.diplomacyOverlayVisible = false; } this.addPlayers(fmd); if (resized && this.diplomacyOverlayVisible) { this.addDiplomacyOverlay(); } }
public void setApplicationModeClicked() { FactionData yourFaction = GameEngine.Instance.World.YourFaction; if (yourFaction == null) { yourFaction = new FactionData(); } this.applicationButton.Enabled = false; RemoteServices.Instance.set_FactionApplicationProcessing_UserCallBack(new RemoteServices.FactionApplicationProcessing_UserCallBack(this.factionApplicationProcessingCallback)); RemoteServices.Instance.FactionApplicationSetMode(!yourFaction.openForApplications); }