public GameInfo(string name) : base(name) { this.isATemplate = false; factionRelations = new GameFactionRelations(); unifiedOrdersRegistry = new UnifiedOrdersRegistry(); lastTurnPriority = -1; }
/// <summary> /// since we can limit the number of diplomatic messages sent per turn, /// we must check if we haven't reached our limit already before opening this panel /// </summary> /// <param name="sendingFac"></param> /// <param name="receivingFac"></param> public void OpenIfPossible(Faction sendingFac, Faction receivingFac) { //check how many msgs we sent this turn... //show warning box instead of opening this if we've already reached the limit gameObject.SetActive(true); CleanAllContainers(); this.sendingFac = sendingFac; this.receivingFac = receivingFac; //fill allies and enemies containers FillRelatedFactionsPanel(alliesContainer, GameFactionRelations.GetFactionsWithTargetStandingWithFac(receivingFac, GameFactionRelations.FactionStanding.ally)); FillRelatedFactionsPanel(enemiesContainer, GameFactionRelations.GetFactionsWithTargetStandingWithFac(receivingFac, GameFactionRelations.FactionStanding.enemy)); //fill diplo options container curTargetFacTxt.text = receivingFac.name; curTargetFacTxt.color = receivingFac.color; }
public void FillRelatedFactionsPanel(Transform targetContainer, List <Faction> relatedFacsList) { foreach (Faction f in relatedFacsList) { GameObject newEntry = Instantiate(factionRelatedEntryPrefab, targetContainer); FactionEntryWithNameAndTooltip entryScript = newEntry.GetComponent <FactionEntryWithNameAndTooltip>(); entryScript.SetNameAndColorToFac(f); entryScript.tooltip.text = string.Concat("Standing with ", sendingFac.name, ": ", GameFactionRelations.StandingToNiceName(sendingFac.GetStandingWith(f))); } }
public void ImportDataFromTemplate(TemplateInfo baseData) { factions = baseData.factions; zones = baseData.zones; troopTypes = baseData.troopTypes; deployedCommanders = baseData.deployedCommanders; mercCaravans = baseData.mercCaravans; rules = baseData.rules; this.isATemplate = false; factionRelations = new GameFactionRelations(); unifiedOrdersRegistry = new UnifiedOrdersRegistry(); lastTurnPriority = -1; }
/// <summary> /// does some other required setup steps and sets the slider's value to the current relation value /// </summary> /// <param name="theOtherFac"></param> public void SetSliderAccordingToRelationWith(Faction theOtherFac) { thePanelsCurFaction = theOtherFac; float ourRelations = myContent.GetRelationWith(theOtherFac); relationSlider.minValue = GameFactionRelations.MIN_RELATIONS; relationSlider.maxValue = GameFactionRelations.MAX_RELATIONS; relationSlider.value = ourRelations; curRelationTxt.text = GameFactionRelations.RelationValueToNiceName(ourRelations); }
public void UpdateFactionRelationsAccordingToSlider(float newSliderValue) { myContent.SetRelationWith(thePanelsCurFaction, newSliderValue); curRelationTxt.text = GameFactionRelations.RelationValueToNiceName(newSliderValue); }