本文整理汇总了C#中VoidDelegate类的典型用法代码示例。如果您正苦于以下问题:C# VoidDelegate类的具体用法?C# VoidDelegate怎么用?C# VoidDelegate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VoidDelegate类属于命名空间,在下文中一共展示了VoidDelegate类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RegisterLogicMsg
public static void RegisterLogicMsg(this IMsgReceiver self, string msgName,VoidDelegate.WithParams callback,QMsgChannel channel = QMsgChannel.Global)
{
if (CheckStrNullOrEmpty (msgName)||CheckDelegateNull(callback)) {
return;
}
// 添加消息通道
if (!mMsgHandlerDict.ContainsKey (channel)) {
mMsgHandlerDict [channel] = new Dictionary<string, List<QMsgHandler>> ();
}
// 略过
if (!mMsgHandlerDict[channel].ContainsKey (msgName)) {
mMsgHandlerDict[channel] [msgName] = new List<QMsgHandler> ();
}
// 看下这里
var handlers = mMsgHandlerDict [channel][msgName];
// 略过
// 防止重复注册
foreach (var handler in handlers) {
if (handler.receiver == self && handler.callback == callback) {
Debug.LogWarning ("RegisterMsg:" + msgName + " ayready Register");
return;
}
}
// 再看下这里
handlers.Add (new QMsgHandler (self, callback));
}
开发者ID:Xneed,项目名称:QFramework,代码行数:31,代码来源:QMsgDispatcher.cs
示例2: OnClick
public static void OnClick(this Transform trans,VoidDelegate.WithGo callback)
{
QFramework.UI.UGUIEventListener.Get (trans.gameObject);
var listener = QFramework.UI.UGUIEventListener.CheckAndAddListener (trans.gameObject);
listener.onClick += callback;
}
开发者ID:Xneed,项目名称:QFramework,代码行数:7,代码来源:QTransExtend.cs
示例3: MakeTween
public static GoTween MakeTween(
Transform TheTransform,
Vector3 Position,
Quaternion Rotation,
float MoveTime = 0.5f,
bool IsLocal = false,
GoEaseType Ease = GoEaseType.Linear,
VoidDelegate OnCompleteFunction = null
)
{
GoTweenConfig Config = new GoTweenConfig();
Config.addTweenProperty(new PositionTweenProperty(Position, false, IsLocal));
//Config.addTweenProperty(new EulerAnglesTweenProperty(Rotation, false, IsLocal));
Config.addTweenProperty(new RotationQuaternionTweenProperty(Rotation, false, IsLocal));
Config.setEaseType(Ease);
if(OnCompleteFunction != null){
Config.onComplete(c => {
OnCompleteFunction();
});
}
GoTween NewTween = new GoTween(TheTransform, MoveTime, Config);
Go.addTween(NewTween);
return NewTween;
}
开发者ID:waikayk,项目名称:RitualCombat,代码行数:25,代码来源:GoKitHelper.cs
示例4: ScrollView
public static Vector2 ScrollView(Vector2 scrollPosition, VoidDelegate callback)
{
var newScrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
callback();
EditorGUILayout.EndScrollView();
return newScrollPosition;
}
开发者ID:Nystul-the-Magician,项目名称:daggerfall-unity,代码行数:7,代码来源:GUILayoutHelper.cs
示例5: OnClick
public static void OnClick(this GameObject go,VoidDelegate.WithGo callback)
{
QFramework.UI.UGUIEventListener.Get (go);
var listener = QFramework.UI.UGUIEventListener.CheckAndAddListener (go);
listener.onClick += callback;
}
开发者ID:CzDreamer,项目名称:QFramework,代码行数:7,代码来源:QGoExtend.cs
示例6: InvokeIfRequired
public static void InvokeIfRequired(Control c, VoidDelegate d)
{
if (c.InvokeRequired)
c.Invoke(d);
else
d.Invoke();
}
开发者ID:JesusFreke,项目名称:didjimp,代码行数:7,代码来源:InvokeUtil.cs
示例7: Move
public void Move(int numNodes, VoidDelegate callback)
{
_nodesLeft = numNodes;
_callback = callback;
StartMoving();
}
开发者ID:sxbrentxs,项目名称:GluPartyGame2.0,代码行数:7,代码来源:Pawn.cs
示例8: Init
private bool Init(UnityEngine.Object obj, EditorFeatures requirements)
{
this.editor = Editor.CreateEditor(obj);
if (this.editor == null)
{
return false;
}
if (((requirements & EditorFeatures.PreviewGUI) > EditorFeatures.None) && !this.editor.HasPreviewGUI())
{
return false;
}
MethodInfo method = this.editor.GetType().GetMethod("OnSceneDrag", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
if (method != null)
{
this.OnSceneDrag = (VoidDelegate) Delegate.CreateDelegate(typeof(VoidDelegate), this.editor, method);
}
else
{
if ((requirements & EditorFeatures.OnSceneDrag) > EditorFeatures.None)
{
return false;
}
this.OnSceneDrag = new VoidDelegate(this.DefaultOnSceneDrag);
}
return true;
}
开发者ID:randomize,项目名称:VimConfig,代码行数:26,代码来源:EditorWrapper.cs
示例9: ExecuteAssemblyCodeCompiler
/// <summary>
/// Executes NASM on the output file. It is assumed the output file now exists.
/// </summary>
/// <param name="inputFilePath">Path to the ASM file to process.</param>
/// <param name="outputFilePath">Path to output the object file to.</param>
/// <param name="OnComplete">Handler to call once NASM has completed. Default: null.</param>
/// <param name="state">The state object to use when calling the OnComplete handler. Default: null.</param>
/// <returns>True if execution completed successfully. Otherwise false.</returns>
public override bool ExecuteAssemblyCodeCompiler(string inputFilePath, string outputFilePath, VoidDelegate OnComplete = null, object state = null)
{
bool OK = true;
//Compile the .ASM file to .BIN file
string ToolPath = Path.Combine(Options.ToolsPath, @"MIPS\mips-linux-gnu-as.exe");
//Delete an existing output file so we start from scratch
if (File.Exists(outputFilePath))
{
File.Delete(outputFilePath);
}
if (!File.Exists(inputFilePath))
{
throw new NullReferenceException("ASM file does not exist! Path: \"" + inputFilePath + "\"");
}
string inputCommand = String.Format("-mips32 -Os -EL -o \"{1}\" \"{2}\"",
"elf",
outputFilePath,
inputFilePath,
"ELF");
//Logger.LogMessage(inputFilePath, 0, inputCommand);
OK = Utilities.ExecuteProcess(Path.GetDirectoryName(outputFilePath), ToolPath, inputCommand, "MIPS:GCC",
false,
null,
OnComplete,
state);
return OK;
}
开发者ID:rmhasan,项目名称:FlingOS,代码行数:40,代码来源:LibraryFunctions.cs
示例10: OnClick
public static void OnClick(this MonoBehaviour behaviour,VoidDelegate.WithGo callback)
{
QFramework.UI.UGUIEventListener.Get (behaviour.gameObject);
var listener = QFramework.UI.UGUIEventListener.CheckAndAddListener (behaviour.gameObject);
listener.onClick += callback;
}
开发者ID:Xneed,项目名称:QFramework,代码行数:7,代码来源:QBehaviourExtend.cs
示例11: Main
public static int Main()
{
RunGetFncSecTest();
int retVal = 100;
VoidDelegate md = new VoidDelegate(FunctionPtr.Method);
Console.WriteLine("\r\nTesting Marshal.GetFunctionPointerForDelegate().");
try
{
Marshal.GetFunctionPointerForDelegate<Object>(null);
retVal = 0;
Console.WriteLine("Failure - did not receive an exception while passing null as the delegate");
}
catch (ArgumentNullException e)
{
Console.WriteLine("Pass - threw the right exception passing null as the delegate");
}
catch (Exception e)
{
retVal = 0;
Console.WriteLine("Failure - receive an incorrect exception while passing null as the delegate");
Console.WriteLine(e);
}
RunGetDelForFcnPtrTest();
return retVal;
}
开发者ID:CheneyWu,项目名称:coreclr,代码行数:27,代码来源:GetFcnPtrForDel_Negative_Catchable.cs
示例12: Try
/// <summary>
/// Black magic that lets us ignore issues where something is wrong
/// without surrounding every single line in a try-catch.
/// <para>
/// Don't try this at home folks.
/// </para>
/// Source: http://stackoverflow.com/questions/117173/c-try-catch-every-line-of-code-without-individual-try-catch-blocks
/// </summary>
public static void Try(VoidDelegate v)
{
try
{
v();
}
catch { }
}
开发者ID:Kriogen777,项目名称:Otil,代码行数:16,代码来源:Utils.cs
示例13: LogBrowser
public LogBrowser()
{
closeDelegate = new VoidDelegate(this.Close);
InitializeComponent();
sqLiteConnection.Open();
logDataAdapter.Fill(logDataSet);
serversDataAdapter.Fill(serverDataSet);
}
开发者ID:MarkPaxton,项目名称:SensorShare3,代码行数:8,代码来源:LogBrowser.cs
示例14: Foldout
public static bool Foldout(bool toggle, GUIContent label, VoidDelegate callback)
{
var rect = GUILayoutUtility.GetRect(new GUIContent("\t" + label.text), GUIStyle.none);
bool result = EditorGUI.Foldout(rect, toggle, label, true);
if (result)
callback();
return result;
}
开发者ID:Nystul-the-Magician,项目名称:daggerfall-unity,代码行数:8,代码来源:GUILayoutHelper.cs
示例15: Class523
// Token: 0x060024FA RID: 9466
// RVA: 0x0001CDB8 File Offset: 0x0001AFB8
public Class523(VoidDelegate voidDelegate_1, Delegate2 delegate2_1)
: base(false)
{
Class115.bool_31 = true;
this.voidDelegate_0 = voidDelegate_1;
this.delegate2_0 = delegate2_1;
this.thread_0 = Class115.smethod_87(new VoidDelegate(this.method_0));
}
开发者ID:newchild,项目名称:Project-DayZero,代码行数:10,代码来源:Class523.cs
示例16: SensorNetServer
public SensorNetServer()
{
InitializeComponent();
descriptionUpdater = new VoidDelegate(UpdateServerDescription);
closeDelegate = new VoidDelegate(this.Close);
log.Name = "log";
log.LogMessage += new LogMessageEventHandler(log_LogMessage);
log.Start();
#region copy data files
if (!Directory.Exists(Application.UserAppDataPath))
{
Directory.CreateDirectory(Application.UserAppDataPath );
}
if (!File.Exists(Application.UserAppDataPath + "\\" + SensorNetConfig.ServerDatabase))
{
File.Copy(Application.StartupPath + "\\" + SensorNetConfig.ServerDatabase,
Application.UserAppDataPath + "\\" + SensorNetConfig.ServerDatabase);
}
database = DatabaseHelper.ConnectToSQL("Data Source=\"" + Application.UserAppDataPath +
"\\" + SensorNetConfig.ServerDatabase + "\"");
#endregion
#region Regestry data setup
RegistryKey registryKey = Registry.CurrentUser.CreateSubKey(SensorNetConfig.ConfigKeyName);
bool createNewConfig = true;
object regKey = registryKey.GetValue("ServerID");
if (regKey != null)
{
Guid serverID = new Guid((string)regKey);
CurrentServerData = DatabaseHelper.GetServerByID(database, serverID);
if (CurrentServerData != null)
{
createNewConfig = false;
}
}
if (createNewConfig)
{
// Show server config before starting server (which is automatically done when config box is closed)
Bitmap serverPic = new Bitmap(Application.StartupPath + "/defaultImage.jpg");
CurrentServerData = new ServerConfigData(Guid.Empty, "New Server", "Location", "Description", JpegImage.GetBytes(serverPic));
configMenuItem_Click(this, new EventArgs());
}
else
{
//If config isn't needed, start now
registryKey.Close();
StartServer();
}
#endregion
}
开发者ID:MarkPaxton,项目名称:SensorShare3,代码行数:58,代码来源:SensorShareServer.cs
示例17: RunHelper
public RunHelper(VoidDelegate start, VoidDelegate end, DebugDelegate deb, string name)
{
OnStart = start;
OnEnd = end;
Name = name;
OnDebug = deb;
bw.DoWork += new System.ComponentModel.DoWorkEventHandler(bw_DoWork);
bw.WorkerReportsProgress = false;
}
开发者ID:bluejack2000,项目名称:core,代码行数:9,代码来源:RunHelper.cs
示例18: MoveTo
public void MoveTo(Vector3 position, VoidDelegate onArrival = null) {
Tween.toWithSpeed(transform.position, position, 3f, Tween.EaseType.easeInOutSine,
(Tween tween) => { transform.position = (Vector3)tween.Value; },
(Tween tween) => {
if (onArrival != null)
onArrival();
}
);
}
开发者ID:runevision,项目名称:vrplatforms,代码行数:9,代码来源:Companion.cs
示例19: DumpTime
public static void DumpTime(VoidDelegate dv)
{
Stopwatch watch = new Stopwatch();
watch.Reset();
watch.Start();
dv();
watch.Stop();
LogMgr.Log("Cost Time = " + watch.ElapsedMilliseconds.ToString() + " ms");
LogMgr.Log("Cost Time Span = " + watch.Elapsed.ToString());
}
开发者ID:learnUnity,项目名称:KU_NET,代码行数:10,代码来源:KTool.cs
示例20: PushFunc
public void PushFunc(VoidDelegate func, int timeMS)
{
if(dictVoidFunc.ContainsKey(func))
{
Debug.LogWarning("void func is already exist...");
return;
}
dictVoidFunc.Add(func, new VoidTimeParam(timeMS, func));
}
开发者ID:hismile06jf,项目名称:sgqy8,代码行数:10,代码来源:TimeMgr.cs
注:本文中的VoidDelegate类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论