public void OnGenerate() { if (ElementManager.s_element_manager.GeneratedObjects.Any()) { ElementManager.s_element_manager.WipeGeneratedObjects(); } List <PlayerData> picks = new List <PlayerData>(); foreach (GameObject obj in m_content) { NationPicker np = obj.GetComponent <NationPicker>(); string str = np.NationName; NationData data = AllNationData.AllNations.FirstOrDefault(x => x.Name == str); PlayerData pd = new PlayerData(data, np.TeamNum); if (data == null || (picks.Any(x => x.NationData.Name == data.Name) && !m_generic_starts)) { GetComponent <AudioSource>().PlayOneShot(DenyAudio); return; } picks.Add(pd); } m_nations = picks; GetComponent <AudioSource>().PlayOneShot(AcceptAudio); NodeLayout layout = m_layouts.Layouts.FirstOrDefault(x => x.Name == LayoutDropdown.options[LayoutDropdown.value].text && x.NumPlayers == m_player_count); MoveCameraForGeneration(layout); Resources.UnloadUnusedAssets(); StartCoroutine(perform_async(() => do_generate(layout), true)); }
void OnTerritoryListListener(string path, INodeData data) { NationTerritoryList territoryData = data as NationTerritoryList; if (!territoryData.Updated) { return; } for (var i = 0; i < NationManager.Instance.List.Members.Count; i++) { var nation = NationManager.Instance.List.Members[i]; int territory_count = System.Array.FindAll(NationManager.Instance.TerritoryList.TerritoryList, m => m.Owner == nation.Name).Length; nation.Occupancy = (float)territory_count / NationManager.Instance.TerritoryList.TerritoryList.Length; } for (var i = 0; i < OccupancyEntrys.Length; i++) { var entry = OccupancyEntrys[i]; NationData nationData = NationManager.Instance.List.Find(entry.natinName); LTUIUtil.SetText(entry.percentLabel, (nationData.Occupancy * 100) + "%"); entry.progressBar.value = nationData.Occupancy; } float myNationOccupancy = NationManager.Instance.List.Find(NationManager.Instance.Account.NationName).Occupancy; Hotfix_LT.Data.NationRatingRewardTemplate ratingReward = Hotfix_LT.Data.EventTemplateManager.Instance.GetNationRatingRewardTpl((int)(myNationOccupancy * 100)); if (ratingReward != null) { for (int fillIndex = 0; fillIndex < CombatRewardShowItems.Length; ++fillIndex) { if (fillIndex < ratingReward.rewardDatas.Count) { CombatRewardShowItems[fillIndex].LTItemData = ratingReward.rewardDatas[fillIndex]; } else { CombatRewardShowItems[fillIndex].mDMono.gameObject.SetActive(false); } } } else { //Debug.Log("Hotfix_LT.Data.NationRatingRewardTemplate is null for Occupancy=" + myNationOccupancy); for (int fillIndex = 0; fillIndex < CombatRewardShowItems.Length; ++fillIndex) { CombatRewardShowItems[fillIndex].mDMono.gameObject.SetActive(false); } } }
public List <PersonData> GetNPCs(CityData city, NPCGenerator gen) { var nation = new NationData() { Name = city.Nation, Races = city.Races }; var output = new List <PersonData>(); foreach (var prof in NPCs) { var npc = gen.GenerateNPCforCity(nation); npc.Profession = prof; output.Add(npc); } return(output); }
void SetOccupancy() { for (var i = 0; i < NationManager.Instance.List.Members.Count; i++) { var nation = NationManager.Instance.List.Members[i]; int territory_count = System.Array.FindAll(NationManager.Instance.TerritoryList.TerritoryList, m => m.Owner == nation.Name).Length; nation.Occupancy = (float)territory_count / NationManager.Instance.TerritoryList.TerritoryList.Length; } for (var i = 0; i < OccupancyEntrys.Length; i++) { var entry = OccupancyEntrys[i]; NationData data = NationManager.Instance.List.Find(entry.natinName); LTUIUtil.SetText(entry.percentLabel, (data.Occupancy * 100) + "%"); entry.progressBar.value = data.Occupancy; } }
public static void AddNation(NationData d) { AllNations.Add(d); }
public void Add(NationData n) { Nations.Add(n); }
public void SetNationData(NationData nationData) { NationData = nationData; }
public PlayerData(NationData nation, int team = 1) { NationData = nation; TeamNum = team; }