public void OnChangeTimeCommand(ServerPlayer player, int hours = -1, bool freezeClock = false) { if (hours < 0 || hours > 23) { player.Notify("Du musst eine gültige Stundenanzahl (0-23) angeben!", NotificationType.Error); return; } _worldData.Clock = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hours, 0, 0); _worldData.ClockPaused = freezeClock; /*var lambda = new AsyncFunctionCallback<IPlayer>(async (IPlayer p) => * { * await p.SetDateTimeAsync(_worldData.Clock); * }); * * await Alt.ForEachPlayers(lambda);*/ var lambda = new FunctionCallback <IPlayer>((p) => { p.SetDateTime(_worldData.Clock); }); Alt.ForEachPlayers(lambda); }
internal long AddCallback(FunctionCallback callback) { int callbackIdx = callbacks.Count; callbacks.Add(callback); return(Utils.TwoIntToLong(Idx, callbackIdx)); }
public void Accept() { //Save the quest if neccesary successFunction(); successFunction?.Invoke(); successFunction = null; DialogCanvas.SetActive(false); }
public CustomEffectFactory(Type effectType, Func <ID2D1EffectImpl> createID2D1EffectImplFunc) { _effectType = effectType; _createID2D1EffectImplFunc = createID2D1EffectImplFunc; _createEffect = new CreateCustomEffectDelegate(CreateCustomEffectImpl); Callback = new FunctionCallback(Marshal.GetFunctionPointerForDelegate(_createEffect)); _propertyNatives = GetPropertyNatives().ToArray(); }
public CallbackFunction(string name, FunctionCallback callback) { if (name == null) throw new ArgumentNullException("name"); if (callback == null) throw new ArgumentNullException("callback"); this.name = name; this.callback = callback; }
public void ShowDialog(DialogData data, FunctionCallback success, FunctionCallback decline) { successFunction = success; declineFunction = decline; DialogText.text = LanguageController.instance.GetTextById(data.TextId); Image = data.Image; isQuest = data.IsQuest; Title.text = data.CharacterName; DialogCanvas.SetActive(true); }
static Function() { Functions2 = new Dictionary <string, FunctionCallback2>(); Functions = new Dictionary <string, FunctionCallback>(); FunctionsIF = new Dictionary <string, FunctionCallbackIF>(); // FunctionsIF2 = new Dictionary<string, FunctionCallbackIF2>(); Functions["abs"] = new FunctionCallback(Math.Abs); Functions["sin"] = new FunctionCallback(Math.Sin); Functions["cos"] = new FunctionCallback(Math.Cos); Functions["tan"] = new FunctionCallback(Math.Tan); Functions["sqrt"] = new FunctionCallback(Math.Sqrt); Functions["log"] = new FunctionCallback(Math.Log10); Functions2["log"] = new FunctionCallback2(Math.Log); Functions["ln"] = new FunctionCallback(Ln); Functions["acos"] = new FunctionCallback(Math.Acos); Functions["asin"] = new FunctionCallback(Math.Asin); Functions["atan"] = new FunctionCallback(Math.Atan); //Functions2["atan2"] = new FunctionCallback2(Math.Atan2); Functions["ceiling"] = new FunctionCallback(Math.Ceiling); Functions["floor"] = new FunctionCallback(Math.Floor); Functions["cosh"] = new FunctionCallback(Math.Cosh); Functions["sinh"] = new FunctionCallback(Math.Sinh); Functions["tanh"] = new FunctionCallback(Math.Tanh); Functions2["max"] = new FunctionCallback2(Math.Max); Functions2["min"] = new FunctionCallback2(Math.Min); Functions2["round"] = new FunctionCallback2(Round); Functions["round"] = new FunctionCallback(Round); Functions["exp"] = new FunctionCallback(Math.Exp); FunctionsIF["if"] = new FunctionCallbackIF(IF); // FunctionsIF2["if"] = new FunctionCallbackIF2(IF); // FunctionsList = new string[] // { // "abs(a)", // "sin(a)", // "asin(a)", // "sinh(a)", // "cos(a)", // "acos(a)", // "cosh(a)", // "tan(a)", // "atan(a)", // //"atan2(y, x)", // "tanh(a)", // "sqrt(a)", // "log(a, base)", // "log(a)", // "ln(a)", // "ceiling(a)", // "floor(a)", // "max(a, b)", // "min(a, b)", // "round(a, b)" // }; }
public static void RunAsync(FunctionCallback functionToCall) { #if WINDOWS8 Windows8ThreadHelper.RunAsync(functionToCall); return; #endif #if WINDOWS_PHONE || WINDOWS_DESKTOP WindowsPhoneThreadHelper.RunAsync(functionToCall); return; #endif }
/// <summary> /// Registers a new callback method for when pressing a button /// </summary> /// <param name="npc">Npc who owns the function</param> /// <param name="dialog">DialogType to register</param> /// <param name="callback">Associated callback method</param> protected void RegisterDialog(BaseNPC npc, DialogType dialog, FunctionCallback callback) { try { npc.state.Add(dialog, callback); } catch (ArgumentException e) { throw new ArgumentException( string.Format("Dialog with of the type {0} is already added on class {1}", dialog, npc), e ); } }
public void AddFunction(string functionName, FunctionCallback callback) { AddFunction(new CallbackFunction(functionName, callback)); }
bool Equals(FunctionCallback other) => other != null && other._function == _function;
/// <summary> /// Creates a new LayeCallback using the given function. /// </summary> /// <param name="callback"></param> public LayeCallback(FunctionCallback function) : base(TYPE) { callback = (state, ths, args) => function(state, args); }
public void Init(FunctionCallback calback) { mInitCallback = calback; BehaviourUtil.StartCoroutine(InitConfigAndFonts()); }
/// <unmanaged>HRESULT IDirectInput8W::EnumDevices([In] unsigned int arg0,[In] __function__stdcall* arg1,[In] void* arg2,[In] DIEDFL arg3)</unmanaged> internal unsafe HRESULT EnumDevices(int arg0, FunctionCallback arg1, IntPtr arg2, DIEDFL arg3) { //calli(System.Int32(System.Void*,System.Int32,System.Void*,System.Void*,System.Int32), this._nativePointer, arg0, arg1, (void*)arg2, arg3, *(*(IntPtr*)this._nativePointer + (IntPtr)4 * (IntPtr)sizeof(void*))).CheckError(); return((HRESULT)NativeHelper.CalliInt32(4, _nativePointer, arg0, (void *)arg1, (void *)arg2, (int)arg3)); }
public MathFunction(FunctionCallback f) { F = f; }
public double Connect(FunctionCallback callback, int arg) { Console.Out.WriteLine("In server, calling callback..."); return(callback(arg)); }
private unsafe static void EnumerateW(FunctionCallback dSEnumCallbackRef, IntPtr contextRef) { var hr = (HRESULT)NativeMethods.DirectSoundEnumerateW_(dSEnumCallbackRef, (void *)contextRef); hr.CheckError(); }
/// <summary> /// Determines whether the specified <see cref = "FunctionCallback" /> is equal to this instance. /// </summary> /// <param name = "other">The <see cref = "FunctionCallback" /> to compare with this instance.</param> /// <returns> /// <c>true</c> if the specified <see cref = "FunctionCallback" /> is equal to this instance; otherwise, <c>false</c>. /// </returns> public bool Equals(FunctionCallback other) { return(Pointer == other.Pointer); }