示例#1
0
        public void EditLevel(string levelPath)
        {
            GameObject existingLevel = GameObject.Find("Level");

            if (existingLevel != null)
            {
                DestroyImmediate(existingLevel);
            }

            levelPath = PathUtil.Combine(Application.streamingAssetsPath, levelPath);

            if (Path.GetExtension(levelPath) == ".json")
            {
                Dream.Dream dream = _serializer.Deserialize <Dream.Dream>(levelPath);
                if (dream.Type == DreamType.Legacy)
                {
                    LoadLBD(dream);
                }

                if (!string.IsNullOrEmpty(dream.Level))
                {
                    string tmapPath = PathUtil.Combine(Application.streamingAssetsPath, dream.Level);
                    _levelObj = _levelLoader.LoadLevel(tmapPath);
                }
                else
                {
                    newLevel();
                }
            }
            else
            {
                _levelObj = _levelLoader.LoadLevel(levelPath);
            }
        }
示例#2
0
        public void LoadLBD(Dream.Dream dream)
        {
            // check to see if there is already an LBD loaded
            GameObject existingLBD = GameObject.Find("LBD Renderer");

            if (existingLBD != null)
            {
                DestroyImmediate(existingLBD);
                DestroyImmediate(GameObject.Find("LBD Colliders"));
            }

            string lbdPath = PathUtil.Combine(Application.streamingAssetsPath, dream.LBDFolder);

            _lbdReader.LoadLBD(lbdPath, dream.LegacyTileMode, dream.TileWidth);
        }
示例#3
0
        private void importExistingDream()
        {
            var dreamPath =
                EditorUtility.OpenFilePanelWithFilters("Open dream JSON...", "", new[] { "Dream JSON file", "json" });

            if (!string.IsNullOrEmpty(dreamPath))
            {
                _dream = _serializer.Deserialize <Dream.Dream>(dreamPath);
                _dreamEnvironmentFoldoutStates.Clear();
                foreach (var env in _dream.Environments)
                {
                    _dreamEnvironmentFoldoutStates.Add(false);
                }
            }
        }