Exemple #1
0
        // Save the current map to the database.  If no mapID is provided,
        // a new id is created.  Otherwise, it saves over the existing ID.
        void SaveMapToDB(string mapId)
        {
            if (mapId == null)
            {
                mapId = CommonData.currentUser.GetUniqueKey();
            }
            string path = CommonData.DBMapTablePath + mapId;
            DBStruct <LevelMap> dbLevel = new DBStruct <LevelMap>(path, CommonData.app);

            LevelMap currentLevel = CommonData.gameWorld.worldMap;

            currentLevel.SetProperties(dialogComponent.MapName.text,
                                       mapId, CommonData.currentUser.data.id, path);
            CommonData.gameWorld.OnSave();

            dbLevel.Initialize(currentLevel);
            dbLevel.PushData();

            Firebase.Analytics.FirebaseAnalytics.LogEvent(StringConstants.AnalyticsEventMapCreated,
                                                          StringConstants.AnalyticsParamMapId, CommonData.gameWorld.worldMap.mapId);

            if (Social.localUser.authenticated)
            {
                Social.ReportProgress(GPGSIds.achievement_map_maker, 100.0f, (bool success) => {
                    Debug.Log("Edit a game achiement unlocked. Sucess: " + success);
                });
            }

            CommonData.currentUser.data.AddMap(currentLevel.name, currentLevel.mapId);
            CommonData.currentUser.PushData();
            manager.PopState();
        }
        // Save the current map to the database.  If no mapID is provided,
        // a new id is created.  Otherwise, it saves over the existing ID.
        void SaveMapToDB(string mapId)
        {
            if (mapId == null)
            {
                mapId = CommonData.currentUser.GetUniqueKey();
            }
            string path = CommonData.DBMapTablePath + mapId;
            DBStruct <LevelMap> dbLevel = new DBStruct <LevelMap>(path, CommonData.app);

            LevelMap currentLevel = CommonData.gameWorld.worldMap;

            currentLevel.SetProperties(dialogComponent.MapName.text,
                                       mapId, CommonData.currentUser.data.id, path);
            CommonData.gameWorld.OnSave();

            dbLevel.Initialize(currentLevel);
            dbLevel.PushData();

            Firebase.Analytics.FirebaseAnalytics.LogEvent(StringConstants.AnalyticsEventMapCreated,
                                                          StringConstants.AnalyticsParamMapId, CommonData.gameWorld.worldMap.mapId);

            CommonData.currentUser.data.AddMap(currentLevel.name, currentLevel.mapId);
            CommonData.currentUser.PushData();
            manager.PopState();
        }
Exemple #3
0
        // Save the current map to the database.  If no mapID is provided,
        // a new id is created.  Otherwise, it saves over the existing ID.
        void SetMapToShared()
        {
            LevelMap currentLevel = CommonData.gameWorld.worldMap;

            if (currentLevel.isShared == true)
            {
                // Map is already shared.
                return;
            }

            currentLevel.isShared = true;
            DBStruct <LevelMap> dbLevel = new DBStruct <LevelMap>(
                CommonData.DBMapTablePath + currentLevel.mapId, CommonData.app);

            dbLevel.Initialize(currentLevel);
            dbLevel.PushData();
        }
Exemple #4
0
        // Save the current map to the database.  If no mapID is provided,
        // a new id is created.  Otherwise, it saves over the existing ID.
        void SaveMapToDB()
        {
            string path = CommonData.DBBonusMapTablePath + mapId;
            DBStruct <LevelMap> dbLevel = new DBStruct <LevelMap>(path, CommonData.app);

            LevelMap currentLevel = CommonData.gameWorld.worldMap;

            currentLevel.SetProperties(mapName, mapId, CommonData.currentUser.data.id, path);
            CommonData.gameWorld.OnSave();

            dbLevel.Initialize(currentLevel);
            dbLevel.PushData();

            CommonData.currentUser.data.AddMap(currentLevel.name, currentLevel.mapId);
            CommonData.currentUser.PushData();
            manager.PopState();
        }