コード例 #1
0
    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));
    }
コード例 #2
0
        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);
                }
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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;
            }
        }
コード例 #5
0
 public static void AddNation(NationData d)
 {
     AllNations.Add(d);
 }
コード例 #6
0
 public void Add(NationData n)
 {
     Nations.Add(n);
 }
コード例 #7
0
 public void SetNationData(NationData nationData)
 {
     NationData = nationData;
 }
コード例 #8
0
ファイル: PlayerData.cs プロジェクト: stvnksslr/mapnuke
 public PlayerData(NationData nation, int team = 1)
 {
     NationData = nation;
     TeamNum    = team;
 }