Exemplo n.º 1
0
 /// <summary>
 /// チャンクの実行を行う
 /// </summary>
 /// <param name="command"></param>
 public void Execute(CommandInfoChunk chunk, System.Action endCallback = null)
 {
     if (chunk == null)
     {
         Debug.LogError("chunk is null");
         return;
     }
     _nowHandlingChunk          = chunk;
     _nextPhase                 = PStartExecute;
     _endCallback               = endCallback;
     _isCommandEnd              = false;
     _nowExecutingCommand       = null;
     _nextExecutingCommandIndex = 0;
 }
Exemplo n.º 2
0
        /// <summary>
        /// 指定パスのファイルのコンバートを試み、
        /// 成功時にDstFolderPath以下の適切な箇所に生成したファイルを保存します
        /// </summary>
        /// <param name="converter">スクリプトコンバータ</param>
        /// <param name="dstLocalFilePath">出力先パス</param>
        /// <param name="fullSrcFilePath">コンバート元ファイルのフルパス</param>
        /// <returns>コンバートを正常に終えたかどうか</returns>
        static private bool ConvertAndSave(Script2Chunk converter, string dstLocalFilePath, string fullSrcFilePath)
        {
            Debug.Log("Target:" + dstLocalFilePath);
            System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
            watch.Start();
            var chunk = converter.ParseScript(fullSrcFilePath, LoadTxtFile(fullSrcFilePath));

            if (chunk == null)
            {
                Debug.LogError(fullSrcFilePath + " : Failure create chunk");
                watch.Stop();
                Debug.Log("Parse time:" + watch.ElapsedMilliseconds + "ms");
                return(false);
            }
            watch.Stop();
            Debug.Log("Parse time:" + watch.ElapsedMilliseconds + "ms");

            watch.Reset();
            watch.Start();
            // ScriptAssetの生成
            CommandInfoChunk targetChunk = TryGetAsset <CommandInfoChunk>(DstScriptFolderPath, dstLocalFilePath, null);

            if (targetChunk != null)
            {
                targetChunk.Setup(chunk);
                EditorUtility.SetDirty(targetChunk);
            }
            else
            {
                CreateAsset(chunk, DstScriptFolderPath, dstLocalFilePath, "commandScript/script", null, false);
                EditorUtility.SetDirty(chunk);
            }
            watch.Stop();
            Debug.Log("Create script asset:" + watch.ElapsedMilliseconds + "ms");
            return(true);
        }
Exemplo n.º 3
0
 public void Setup(CommandInfoChunk src)
 {
     _scriptName   = src._scriptName;
     _commandInfos = src._commandInfos;
     _optionDict   = src._optionDict;
 }