本文整理汇总了C#中VoidDelegate类的典型用法代码示例。如果您正苦于以下问题:C# VoidDelegate类的具体用法?C# VoidDelegate怎么用?C# VoidDelegate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VoidDelegate类属于命名空间,在下文中一共展示了VoidDelegate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例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;
}
示例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;
}
示例4: ScrollView
public static Vector2 ScrollView(Vector2 scrollPosition, VoidDelegate callback)
{
var newScrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
callback();
EditorGUILayout.EndScrollView();
return newScrollPosition;
}
示例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;
}
示例6: InvokeIfRequired
public static void InvokeIfRequired(Control c, VoidDelegate d)
{
if (c.InvokeRequired)
c.Invoke(d);
else
d.Invoke();
}
示例7: Move
public void Move(int numNodes, VoidDelegate callback)
{
_nodesLeft = numNodes;
_callback = callback;
StartMoving();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 { }
}
示例13: LogBrowser
public LogBrowser()
{
closeDelegate = new VoidDelegate(this.Close);
InitializeComponent();
sqLiteConnection.Open();
logDataAdapter.Fill(logDataSet);
serversDataAdapter.Fill(serverDataSet);
}
示例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;
}
示例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));
}