Exemple #1
0
    public void LoadSelectedMap()
    {
        UsersRepository.Login(UserSingleton.Instance.Email, UserSingleton.Instance.Password, () =>
        {
            Debug.Log("from user list selected map id " + Assets.AdminMap.Scripts.Application.application.SelectedAdminMapId);
            MapsRepository.GetAdminMap(Application.application.SelectedAdminMapId, (mapConfig) =>
            {
                Debug.Log("fetched " + mapConfig.DatabaseId + " with " + mapConfig.tileConfigs.Count + " tiles and " + mapConfig.placeableObjectConfigs.Count + " objects");

                MapConfig.mapConfig.mapBudget = mapConfig.mapBudget;
                MapConfig.mapConfig.placeableObjectConfigs = mapConfig.placeableObjectConfigs;
                MapConfig.mapConfig.tileConfigs            = mapConfig.tileConfigs;

                foreach (var objectConfig in mapConfig.placeableObjectConfigs)
                {
                    Debug.Log("available" + objectConfig.type + ", " + objectConfig.placementCosts);
                }

                foreach (var config in MapConfig.mapConfig.placeableObjectConfigs)
                {
                    Debug.Log("available after assignment" + config.type + ", " + config.placementCosts);
                }

                PlayGame();

                //map = Instantiate(mapPrefab, transform).Initialize(100);

                /* foreach (var tile in mapConfig.tileConfigs)
                 * {
                 *   UnityObject configPrefab = null;
                 *
                 *   if (!tile.ObjectType.Equals(GameObjectType.Default))
                 *   {
                 *       configPrefab = prefabs.FirstOrDefault(prefab => prefab.Type().Equals(tile.ObjectType));
                 *   }
                 *   map.CreateTilesFromConfiguration(tile, configPrefab);
                 * }*/
            });
        });
    }
Exemple #2
0
    public void LoadSelectedMap()
    {
        String mapId = Application.application.SelectedAdminMapId;

        Debug.Log("LoadSelectedMap BrowseMapSelection" + Application.application.SelectedAdminMapId);

        UsersRepository.Login(UserSingleton.Instance.Email, UserSingleton.Instance.Password, () => {
            Debug.Log("Started fetching a map");
            MapsRepository.GetAdminMap(mapId, (fetchedMap) =>
            {
                foreach (var tile in fetchedMap.tileConfigs)
                {
                    Debug.Log("Tile type: " + tile.type);
                }

                MapConfig.mapConfig.mapBudget              = fetchedMap.mapBudget;
                MapConfig.mapConfig.tileConfigs            = fetchedMap.tileConfigs;
                MapConfig.mapConfig.placeableObjectConfigs = fetchedMap.placeableObjectConfigs;
                OpenMap();
            });
        });
    }