Beispiel #1
0
 public void UpdateData(SingleScene single)
 {
     for (int i = 0; i < s_data.Count; i++)
     {
         if (s_data[i].s_name == single.s_name)
         {
             s_data[i] = single;
             return;
         }
     }
     s_data.Add(single);
 }
        public void CorrectlyPrintsCurscenes()
        {
            //Arrange
            ColorString[] firstSceneLines =
            {
                new ColorString("There once was a man named Gold Roger"),
                new ColorString("He had fame, wealth, and power beyond your wildest dreams"),
                new ColorString("Before they hung him from the gallows,"),
                new ColorString("These were the words he said:")
            };

            SingleScene firstScene = new SingleScene(firstSceneLines);

            ColorString[] secondSceneLines =
            {
                new ColorString("If you want my treasure, you can have it!"),
                new ColorString("I left everything I had in that place")
            };

            SingleScene secondScene = new SingleScene(secondSceneLines);

            SingleScene[] scenes =
            {
                firstScene,
                secondScene
            };

            Cutscene cutscene = new Cutscene(scenes);

            //Act
            cutscene.ExecuteCutscene(_input, _output, (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1), (HumanFighter)FighterFactory.GetFighter(FighterType.HumanControlledPlayer, 1));

            //Assert
            MockOutputMessage[] outputs = _output.GetOutputs();

            int expectedNumberOfLines = firstSceneLines.Length + secondSceneLines.Length;

            Assert.AreEqual(expectedNumberOfLines, outputs.Length);

            int[] clearIndices = _output.GetClearIndices();
            Assert.AreEqual(scenes.Length, clearIndices.Length);

            int nextClearIndex = firstSceneLines.Length;

            Assert.AreEqual(nextClearIndex, clearIndices[0]);

            nextClearIndex += secondSceneLines.Length;
            Assert.AreEqual(nextClearIndex, clearIndices[1]);
        }
Beispiel #3
0
        private static void BakeSingleSceneByConfig(OCSceneConfig config)
        {
            Debug.Log("batch mode Do bake single");
            ConfigGenerator(config);
            if (!Util.IsSceneOpened(config.SceneNamePattern))
            {
                Debug.LogFormat("batch mode Open Scene {0}", config.SceneNamePattern);
                EditorSceneManager.OpenScene(String.Format("{0}/{1}.unity", config.GetSceneAssetPath(), config.SceneNamePattern));
            }


            var scene = new SingleScene(config.GetSceneAssetPath(), config.SceneNamePattern, Index.InValidIndex);

            scene.tempPath = config.TemporaryContainer;
            scene.Bake(config.ComputePerframe, config.TemporaryContainer);
        }
Beispiel #4
0
        public void BakeSingleScene()
        {
            //var config = GetSceneConfig(gameObject.scene.name);

            //if (string.IsNullOrEmpty(config.MapName))
            //{
            InitConfig();
            _scene = new SingleScene(GetScenePath(), gameObject.scene.name, Index.InValidIndex);
            _scene.Bake(Config.ComputePerframe, "D;/OCTemp");
            //}
            //else
            //{
            //ConfigGenerator(config);
            //_scene = new SingleScene(config.GetSceneAssetPath(), config.SceneNamePattern, Index.InValidIndex);
            //_scene.Bake(config.ComputePerframe, config.TemporaryContainer);
            //}
        }
        public static void TestBakeAll(string sceneName)
        {
            var config = GetSceneConfig(sceneName);

            ConfigGenerator(config);

            if (config.IsStreamScene)
            {
                var multiScene = new MultiScene(config.GetSceneAssetPath(), config.SceneNamePattern, config.TileDimension, config.TileSize);
                multiScene.BakeTiles(config.indices, config.ComputePerframe, config.TemporaryContainer);
            }
            else
            {
                var scene = new SingleScene(config.GetSceneAssetPath(), config.SceneNamePattern, Index.InValidIndex);
                scene.Bake(true, "D:/OCTemp");
            }
        }
Beispiel #6
0
        private void DrawCellsOfSingleScene(SingleScene scene)
        {
            Gizmos.color = Color.blue;
            var volumeList = scene.volumelList;

            if (volumeList == null)
            {
                return;
            }
            foreach (var volume in volumeList)
            {
                foreach (var cell in volume.cellList)
                {
                    var bounds = cell.aabb;
                    Gizmos.DrawWireCube(bounds.center, bounds.size);
                }
            }
        }
Beispiel #7
0
        private static void GenerateAllSceneRenderableObjectID()
        {
            var sceneCount = SceneManager.sceneCount;

            for (int i = 0; i < sceneCount; ++i)
            {
                var scene = SceneManager.GetSceneAt(i);
                if (scene.name.Equals(String.Empty))
                {
                    continue;
                }
                if (scene.name.EndsWith(SingleScene.StreamSuffix))
                {
                    continue;
                }

                var singleScene = new SingleScene(scene.path, scene.name, Index.InValidIndex);
                singleScene.GeneraterRenderableObjectID();
                singleScene.Save();
            }
        }
        public static bool OpenAllScenesAndGernerateGUID(string mapName)
        {
            var config = GetSceneConfig(mapName);

            if (string.IsNullOrEmpty(config.MapName))
            {
                return(false);
            }

            if (config.IsStreamScene)
            {
                Util.ClearScenes();

                var tiles = config.indices;

                var multiScene = new MultiScene(config.GetSceneAssetPath(), config.SceneNamePattern, config.TileDimension, config.TileSize);

                foreach (var tile in tiles)
                {
                    int tileX = tile.x;
                    int tileY = tile.y;

                    int tileDimension = config.TileDimension;
                    for (int x = 0; x < tileDimension; ++x)
                    {
                        for (int y = 0; y < tileDimension; ++y)
                        {
                            if (Math.Abs(x - tileX) > 1 || Math.Abs(y - tileY) > 1)
                            {
                                continue;
                            }

                            //string scenePath = string.Format("{0}/{1}.unity", config.GetSceneAssetPath(), string.Format(config.SceneNamePattern, x, y));

                            Util.OpenScene(config.GetSceneAssetPath(), string.Format(config.SceneNamePattern, x, y), OpenSceneMode.Single);
                            Util.OpenScene(config.GetSceneAssetPath() + "/Streaming", string.Format(config.SceneNamePattern, x, y) + SingleScene.StreamSuffix, OpenSceneMode.Additive);

                            SingleScene scene = new SingleScene(config.GetSceneAssetPath(), string.Format(config.SceneNamePattern, x, y), new Index(x, y), null, multiScene);
                            scene.GeneraterRenderableObjectID();

                            multiScene.AddMaxGUID(x, y, scene.MaxGameObjectIDCount);
                        }
                    }
                }

                multiScene.Save();
            }
            else
            {
                //string scenePath = string.Format("{0}/{1}.unity", config.GetSceneAssetPath(), config.SceneNamePattern);
                Util.OpenScene(config.GetSceneAssetPath(), config.SceneNamePattern, OpenSceneMode.Single);

                var singleScene = new SingleScene(config.GetSceneAssetPath(), config.SceneNamePattern, Index.InValidIndex);
                singleScene.GeneraterRenderableObjectID();
                singleScene.Save();
            }



            return(true);
        }