Exemple #1
0
 public static void SetKeyCallback(Window window, KeyFunc callback)
 {
     keyFunc = callback;
     var ptr = Marshal.GetFunctionPointerForDelegate(callback);
     glfwSetKeyCallback(window.Ptr, ptr);
     GC.KeepAlive(callback);
 }
    private static bool __GetKey(KeyFunc keyFunc, Keys key)
    {
        if (key == Keys.Up)
        {
            return keyFunc(KeyCode.UpArrow) || keyFunc(KeyCode.W);
        }
        else if (key == Keys.Down)
        {
            return keyFunc(KeyCode.DownArrow) || keyFunc(KeyCode.S);
        }
        else if (key == Keys.Left)
        {
            return keyFunc(KeyCode.LeftArrow) || keyFunc(KeyCode.A);
        }
        else if (key == Keys.Right)
        {
            return keyFunc(KeyCode.RightArrow) || keyFunc(KeyCode.D);
        }
        else if (key == Keys.Advance)
        {
            return keyFunc(KeyCode.Space);
        }

        Debug.Log("Error: Key not recognized: " + key);
        return false;
    }
Exemple #3
0
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public virtual async Task <TKey> CreateAsync(TInput input)
        {
            var entity = _mapper.Map <TEntity>(input);
            await _repository.CreateAsync(entity);

            return(KeyFunc.Invoke(entity));
        }
Exemple #4
0
    public void SetKeyFunc(int where, KeyFunc func)
    {
        switch (where)
        {
        case 1:
            Key1Func = func;
            break;

        case 2:
            Key2Func = func;
            break;

        case 3:
            Key3Func = func;
            break;

        case 4:
            Key4Func = func;
            break;

        case 5:
            MouseLeftFunc = func;
            break;

        case 6:
            MouseRightFunc = func;
            break;
        }
    }
Exemple #5
0
    private static bool __GetKey(KeyFunc keyFunc, Keys key)
    {
        if (key == Keys.Up)
        {
            return(keyFunc(KeyCode.UpArrow) || keyFunc(KeyCode.W));
        }
        else if (key == Keys.Down)
        {
            return(keyFunc(KeyCode.DownArrow) || keyFunc(KeyCode.S));
        }
        else if (key == Keys.Left)
        {
            return(keyFunc(KeyCode.LeftArrow) || keyFunc(KeyCode.A));
        }
        else if (key == Keys.Right)
        {
            return(keyFunc(KeyCode.RightArrow) || keyFunc(KeyCode.D));
        }
        else if (key == Keys.Advance)
        {
            return(keyFunc(KeyCode.Space));
        }

        Debug.Log("Error: Key not recognized: " + key);
        return(false);
    }
Exemple #6
0
        /// <summary>
        /// 获取并发乐观锁异常的数据Key集合
        /// </summary>
        /// <param name="ex"></param>
        /// <returns></returns>
        private ArrayList GetKeysByDbUpdateConcurrencyException(DbUpdateConcurrencyException ex)
        {
            var keyarray = new ArrayList(ex.Entries.Count);

            foreach (var item in ex.Entries)
            {
                if (item.Entity is TEntity entity)
                {
                    var key = KeyFunc.Invoke(entity);
                    keyarray.Add(key);
                }
            }
            return(keyarray);
        }
Exemple #7
0
    public void SetKeyFunc(int where, KeyFunc func)
    {
        switch (where)
        {
        case 0:
            KeyQFunc = func;
            break;

        case 1:
            KeyWFunc = func;
            break;

        case 2:
            KeyEFunc = func;
            break;
        }
    }
Exemple #8
0
 public static object MapTree(KeyFunc fn, object x)
 {
     if (Consp(x))
     {
         var c = (Cons)x;
         var a = fn(Car(c));
         var b = (Cons)MapTree(fn, Cdr(c));
         if (a == Car(c) && b == Cdr(c))
         {
             return(x);
         }
         else
         {
             return(MakeCons(a, b));
         }
     }
     else
     {
         return(fn(x));
     }
 }
 public Namer(CppNamespace ns, KeyFunc keyFunc)
 {
     this.ns      = ns;
     this.keyFunc = keyFunc;
 }
Exemple #10
0
 public static object MapTree(KeyFunc fn, object x)
 {
     if (Consp(x))
     {
         var c = (Cons)x;
         var a = fn(Car(c));
         var b = (Cons)MapTree(fn, Cdr(c));
         if (a == Car(c) && b == Cdr(c))
         {
             return x;
         }
         else
         {
             return MakeCons(a, b);
         }
     }
     else
     {
         return fn(x);
     }
 }
Exemple #11
0
 // Use this for initialization
 void Start()
 {
     Key1Func = () => Debug.Log("I'm Key1Func()");
 }