示例#1
0
        /// <summary>
        /// タスクを実行します
        /// </summary>
        public void Play(string text, Action onCompleted)
        {
            m_name = text;

            OnStartParent?.Invoke(m_name);
            var startTime = Time.realtimeSinceStartup;
            var gcWatcher = new GCWatcher();

            gcWatcher.Start();
            m_task.Play
            (
                () =>
            {
                gcWatcher.Stop();
                OnFinishParent?.Invoke(m_name, Time.realtimeSinceStartup - startTime, gcWatcher.Count);
                onCompleted?.Invoke();
            }
            );
        }
        /// <summary>
        /// タスクを実行します
        /// </summary>
        public void Play(string text, Action onCompleted = null)
        {
#if ENABLE_DEBUG_LOG
            m_name = text;

            Log($"【SingleTask】「{m_name}」開始");
            var startTime = Time.realtimeSinceStartup;
            var gcWatcher = new GCWatcher();
            gcWatcher.Start();
            m_task.Play(() =>
            {
                gcWatcher.Stop();
                Log($"【SingleTask】「{m_name}」終了    {( Time.realtimeSinceStartup - startTime ).ToString( "0.###" ) } 秒    GC {gcWatcher.Count.ToString()} 回");
                onCompleted?.Invoke();
            });
#else
            m_task.Play(text, onCompleted);
#endif
        }
        } = true;                                                     // ログ出力が有効の場合 true

        //==============================================================================
        // 関数
        //==============================================================================
        /// <summary>
        /// タスクを追加します
        /// </summary>
        public void Add(string text, Action <Action> task)
        {
#if ENABLE_DEBUG_LOG
            m_task.Add(onEnded =>
            {
                Log($"【SingleTask】「{m_name}」「{text}」開始");
                var startTime = Time.realtimeSinceStartup;
                var gcWatcher = new GCWatcher();
                gcWatcher.Start();
                task(() =>
                {
                    gcWatcher.Stop();
                    Log($"【SingleTask】「{m_name}」「{text}」終了    {( Time.realtimeSinceStartup - startTime ).ToString( "0.###" ) } 秒    GC {gcWatcher.Count.ToString()} 回");
                    onEnded();
                });
            });
#else
            m_task.Add(text, task);
#endif
        }
示例#4
0
 /// <summary>
 /// タスクを追加します
 /// </summary>
 public void Add(string text, Action <Action> task)
 {
     m_task.Add
     (
         onNext =>
     {
         OnStartChild?.Invoke(m_name, text);
         var startTime = Time.realtimeSinceStartup;
         var gcWatcher = new GCWatcher();
         gcWatcher.Start();
         task
         (
             () =>
         {
             gcWatcher.Stop();
             OnFinishChild?.Invoke(m_name, text, Time.realtimeSinceStartup - startTime, gcWatcher.Count);
             onNext();
         }
         );
     }
     );
 }