示例#1
0
    void Start()
    {
        FPMapper.Initialise();
        _selectedCountry = null;

        fileName = PlayerPrefs.GetString("ID");

        _coreDataManager = new CoreDataManager();
        _coreDataManager.setNewCoreDataModel(FPRepository.LoadJSONProfile(fileName + ".json", "Profiles/", true));

        _newsDataManager = new NewsDataManager();
        _newsDataManager.setNewsDataModelJSON(FPRepository.LoadFile("News.json", "Config/"));

        NewsGenerator newGen = this.gameObject.AddComponent <NewsGenerator>();

        newGen.newsData  = _newsDataManager;
        newGen.countries = _coreDataManager.GetListCountriesList().ToArray();

        List <NationDataModel> models = _coreDataManager.GetCountries();

        foreach (NationDataModel ndm in models)
        {
            GameObject country = new GameObject(ndm.Name);
            country.transform.parent = this.transform;
            country.tag = "Country";

            FPMapper.MapCountry(country, ndm);
        }
示例#2
0
    // Use this for initialization
    void Start()
    {
        // Saving the players enetered data in a string

        PlayerID = PlayerPrefs.GetString("ID");
        Debug.Log(PlayerID);
        PlayerCountry = PlayerPrefs.GetString("Country");
        Debug.Log(PlayerCountry);
        Score  = Standings.GetScore();
        Player = GameObject.Find(PlayerCountry);


        CoreDataManager        PlayerDataManger = new CoreDataManager();
        List <NationDataModel> nationList       = new List <NationDataModel>();

        nationList = PlayerDataManger.GetCountries();
        //List<GameObject> gos = GameObject.FindGameObjectsWithTag("Country");

        //still cant get it to pass the countrys data into the script
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("Country"))
        {
            Debug.Log("Entering player Data");
            NationDataModel ndm = new NationDataModel();
            ndm.Name            = go.GetComponent <CountryStanding>().Name;
            ndm.Population      = go.GetComponent <CountryStanding>().Population;
            ndm.MapPosition     = go.GetComponent <CountryStanding>().MapPosition;
            ndm.Budget          = go.GetComponent <CountryStanding>().Budget;
            ndm.Allies          = go.GetComponent <CountryStanding>().Allies;
            ndm.Enemies         = go.GetComponent <CountryStanding>().Enemies;
            ndm.TradingPartners = go.GetComponent <CountryStanding>().TradingPartners;
            nationList.Add(ndm);
        }

        foreach (NationDataModel nation in nationList)
        {
            if (nation.Name == Player.name)
            {
                PlayerBudget          = nation.Budget;
                PlayerPopulation      = nation.Population;
                PlayerAllies          = nation.Allies;
                PlayerTradingPartners = nation.TradingPartners;
                PlayerEnemies         = nation.Enemies;
                Debug.Log(PlayerBudget);
                Debug.Log(PlayerPopulation);
            }
        }
    }