예제 #1
0
        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);
        }
예제 #2
0
        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();
        }
예제 #5
0
        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);
 }
예제 #7
0
        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)"
//          };
        }
예제 #8
0
        public static void RunAsync(FunctionCallback functionToCall)
        {
            #if WINDOWS8
            Windows8ThreadHelper.RunAsync(functionToCall);
            return;
            #endif

            #if WINDOWS_PHONE || WINDOWS_DESKTOP
            WindowsPhoneThreadHelper.RunAsync(functionToCall);
            return;
            #endif
        }
예제 #9
0
 /// <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
                   );
     }
 }
예제 #10
0
 public void AddFunction(string functionName, FunctionCallback callback)
 {
     AddFunction(new CallbackFunction(functionName, callback));
 }
예제 #11
0
 bool Equals(FunctionCallback other) => other != null && other._function == _function;
예제 #12
0
 /// <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);
 }
예제 #13
0
 public void Init(FunctionCallback calback)
 {
     mInitCallback = calback;
     BehaviourUtil.StartCoroutine(InitConfigAndFonts());
 }
예제 #14
0
 /// <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));
 }
예제 #15
0
 public MathFunction(FunctionCallback f)
 {
     F = f;
 }
예제 #16
0
 public double Connect(FunctionCallback callback, int arg)
 {
     Console.Out.WriteLine("In server, calling callback...");
     return(callback(arg));
 }
예제 #17
0
        private unsafe static void EnumerateW(FunctionCallback dSEnumCallbackRef, IntPtr contextRef)
        {
            var hr = (HRESULT)NativeMethods.DirectSoundEnumerateW_(dSEnumCallbackRef, (void *)contextRef);

            hr.CheckError();
        }
예제 #18
0
 /// <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);
 }