Esempio n. 1
0
        /// <summary>
        /// コンバート処理開始時の共通処理
        /// </summary>
        /// <param name="srcFiles">コンバート元ファイル</param>
        static private void ConvertStarter(LinterRepository linterRepository, params string[] srcFiles)
        {
            Debug.Log("Start script convert");
            // スクリプトコンバータの生成
            var scriptConverter = new Script2Chunk();

            scriptConverter.SetLinterRepository(linterRepository);

            int successCount = 0;
            int failedCount  = 0;

            UpdateProgress(successCount + failedCount, srcFiles.Length);
            foreach (var baseFilePath in srcFiles)
            {
                var filePath         = baseFilePath.Replace("\\", "/");
                var srcLocalFilePath = filePath.Replace(SrcFolderPath, "");
                var dstLocalFilePath = Path.ChangeExtension(srcLocalFilePath, ".asset");
                if (ConvertAndSave(scriptConverter, dstLocalFilePath, filePath))
                {
                    ++successCount;
                }
                else
                {
                    ++failedCount;
                }
                UpdateProgress(successCount + failedCount, srcFiles.Length);
            }
            EditorUtility.ClearProgressBar();
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
            Debug.Log(string.Format("End convert Total file: {0}, success: {1}, failure: {2}",
                                    srcFiles.Length, successCount, failedCount));
        }
Esempio n. 2
0
    public IEnumerator ScenarioPlayByText()
    {
        Debug.Log("スクリプトテキストからのチャンク生成と実行");
        // スクリプトコンバータの生成
        var converter = new CommandScripter.Script2Chunk();

        converter.SetLinterRepository(new Scenario.LinterRepository());
        // スクリプトテキストの読み込み・チャンク生成
        var scriptText = Resources.Load <TextAsset>("CommandScripts/Sources/WaitSample");
        var chunk      = converter.ParseScript("WaitSample", scriptText.text);

        Assert.IsNotNull(chunk);
        // コマンドコントローラ生成
        var playerGo = new GameObject();
        var player   = playerGo.AddComponent <CommandScripter.CommandController>();
        var comRepo  = playerGo.AddComponent <Scenario.CommandRepository>();

        player.Initialize(comRepo);
        // チャンクの実行
        player.Execute(chunk, () =>
        {
            Debug.Log("Play end");
        });
        Assert.IsTrue(player.IsPlaying);
        while (player.IsPlaying)
        {
            yield return(null);
        }
    }
Esempio n. 3
0
    public void Convert()
    {
        var converter = new CommandScripter.Script2Chunk();

        converter.SetLinterRepository(new Scenario.LinterRepository());
        var scriptText = Resources.Load <TextAsset>("CommandScripts/Sources/WaitSample");
        var chunk      = converter.ParseScript("WaitSample", scriptText.text);

        Assert.IsNotNull(chunk);
    }