当前位置: 首页>>代码示例>>C#>>正文


C# System.Action类代码示例

本文整理汇总了C#中System.Action的典型用法代码示例。如果您正苦于以下问题:C# System.Action类的具体用法?C# System.Action怎么用?C# System.Action使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


System.Action类属于命名空间,在下文中一共展示了System.Action类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Load

        public bool Load(LoaderRequest request, System.Action<LoaderResponse> callback = null, object extraData = null)
        {
            if (request == null || string.IsNullOrEmpty(request.url))
            {
                return false;
            }
            else
            {
                LoaderResponse response = null;
                if (cacheMap.TryGetValue(request.url, out response))
                {
                    Debug.Log("CacheLoader complete:" + request.url);

                    if (callback != null)
                    {
                        response.extraData = extraData;
                        callback(response);
                    }
                    return true;
                }
                else
                {
                    if (loader.Load(request, LoaderCallback, extraData))
                    {
                        this.callback = callback;
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
        }
开发者ID:moto2002,项目名称:unityLab,代码行数:34,代码来源:CacheLoader.cs

示例2: AddHandler

        public void AddHandler(System.Action<ObservableTargetData> handler)
        {
            if (handler == null) return;

            if (_callback == null) this.RegisterTargetTriggerEventHandler();
            _callback += handler;
        }
开发者ID:Gege00,项目名称:spacepuppy-unity-framework,代码行数:7,代码来源:ObservableTargetData.cs

示例3: OnClose

 public override void OnClose()
 {
   this.m_Object = (object) null;
   this.m_AcceptedCallback = (System.Action<object>) null;
   this.m_IsInitialized = false;
   EditorApplication.RequestRepaintAllViews();
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:FlexibleMenuModifyItemUI.cs

示例4: RemoveHandler

        public void RemoveHandler(System.Action<ObservableTargetData> handler)
        {
            if (handler == null) return;

            _callback -= handler;
            if (_callback == null) this.UnregisterTargetTriggerEventHandler();
        }
开发者ID:Gege00,项目名称:spacepuppy-unity-framework,代码行数:7,代码来源:ObservableTargetData.cs

示例5: TestDoActionExceedThreadPool

        public void TestDoActionExceedThreadPool()
        {
            long[] data = new long[] { 1, 3 };
            System.Action<long[]> act = new System.Action<long[]>((args) =>
            {
                for (int i = 0; i < data.Length; i++)
                {
                    data[i] = 1;
                }
                Thread.Sleep(500);
            });

            long[] data2 = new long[] { 1, 3 };
            System.Action<long[]> act2 = new System.Action<long[]>((args) =>
            {
                for (int i = 0; i < data2.Length; i++)
                {
                    data2[i] = 2;
                }
                Thread.Sleep(500);
            });

            ThreadPoolUtil.Instance.DoAction<long>(act, data);
            ThreadPoolUtil.Instance.DoAction<long>(act2, data2);
            ThreadPoolUtil.Instance.WaitAll();
            Assert.Equal(string.Join(",", data), "1,1");
            Assert.Equal(string.Join(",", data2), "2,2");
        }
开发者ID:xurdegarpal,项目名称:SharpMath,代码行数:28,代码来源:TestThreadPool.cs

示例6: TimedTick

 /// Repeatable perform an action each frame for x amount of seconds until a condition is met.
 /// Takes the action to perform, the condition for completion and the maximum amount of time each frame
 /// to spend performing the action
 public TimedTick( System.Action action, System.Func<bool> stopCondition, float time = .1f )
 {
     start_ = Time.realtimeSinceStartup;
     action_ = action;
     stopCondition_ = stopCondition;
     maxTime_ = time;
 }
开发者ID:sarkahn,项目名称:unityroguetest,代码行数:10,代码来源:TimedTick.cs

示例7: Init

 public void Init(FlexibleMenuModifyItemUI.MenuType menuType, object obj, System.Action<object> acceptedCallback)
 {
   this.m_MenuType = menuType;
   this.m_Object = obj;
   this.m_AcceptedCallback = acceptedCallback;
   this.m_IsInitialized = true;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:FlexibleMenuModifyItemUI.cs

示例8: Show

        public void Show(bool instantTransition, Action onComplete)
        {
            elements.enabled = true;

            Transition (transitionIn, instantTransition, onComplete);

            OnShow ();
        }
开发者ID:hellotheredev,项目名称:Relays,代码行数:8,代码来源:View.cs

示例9: OnPointerClick

 public void OnPointerClick(PointerEventData eventData)
 {
     if (EmptyClickAction != null)
     {
         EmptyClickAction();
         EmptyClickAction = null;
     }
 }
开发者ID:rygo6,项目名称:VisualizationFramework-Unity,代码行数:8,代码来源:Catcher.cs

示例10: HostWindow

 public HostWindow(Window window, IStatusBar statusBar = null, System.Action<CloseResult> onClosed = null)
 {
     _statusBar = statusBar;
     _window = window;
     _onClosed = onClosed;
     if (_statusBar == null)
         _statusBar = window as IStatusBar;
 }
开发者ID:paytonli2013,项目名称:SolutionTool,代码行数:8,代码来源:HostWindow.cs

示例11: Initialize

		public void Initialize(RenderTexture texture, System.Action callback) {

			this.targetTexture = texture;
			this.callback = callback;

			this.StartCoroutine(this.Render());

		}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:8,代码来源:DevicePreviewCamera.cs

示例12: SetThread

        public void SetThread(Fresvii.AppSteroid.Models.Thread thread, bool isApp, System.Action<Fresvii.AppSteroid.Models.Thread> OnClickCell)
        {
            this.OnClickCell = OnClickCell;

            this.isApp = isApp;

            UpdateThread(thread);
        }
开发者ID:sinfonia2015,项目名称:iOS_AdditionCrash,代码行数:8,代码来源:AUICommunityTopCommentCell.cs

示例13: ProgressDialog

        public ProgressDialog(Window parent, string title, string message, System.Action<ProgressDialog> action)
        {
            InitializeComponent();

            this.Owner = parent;
            this.Title = title;
            messageLabel.Text = message;
            m_action = action;
        }
开发者ID:toydev,项目名称:ExampleCSharp,代码行数:9,代码来源:ProgressDialog.xaml.cs

示例14: Init

 public void Init(List<ExposablePopupMenu.ItemData> items, float itemSpacing, float minWidthOfPopup, ExposablePopupMenu.PopupButtonData popupButtonData, System.Action<ExposablePopupMenu.ItemData> selectionChangedCallback)
 {
   this.m_Items = items;
   this.m_ItemSpacing = itemSpacing;
   this.m_PopupButtonData = popupButtonData;
   this.m_SelectionChangedCallback = selectionChangedCallback;
   this.m_MinWidthOfPopup = minWidthOfPopup;
   this.CalcWidths();
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:9,代码来源:ExposablePopupMenu.cs

示例15: LoadingScreen

 public LoadingScreen(Action loadMethod, 
     Data.UI.Interfaces.IGameScreen next)
     : base(true,false)
 {
     multiThreaded = false;
     fadeBlack = false;
     _loadMethod = loadMethod;
     nextScreen = next;
 }
开发者ID:soljakwinever,项目名称:ElegyOfDisharmony,代码行数:9,代码来源:LoadingScreen.cs


注:本文中的System.Action类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。