public unsafe void BindAxis(Name AxisName, AxisDelegate Handler) { var func = Marshal.GetDelegateForFunctionPointer <BindAxisFunction>(Native->BindAxisFunction); func(Main.GameInstance, this, AxisName); AxisBindings.Add(AxisName, Handler); }
public static void Unbind(int axis, AxisDelegate handler) { if (HasInstance()) { Instance.RemoveAxisBind(axis, handler); } }
public DelegatedAxleButtonInputSignature(string id, AxisDelegate del, AxleValueConsideration consideration = AxleValueConsideration.Positive, float axisButtnDeadZone = InputUtil.DEFAULT_AXLEBTNDEADZONE) : base(id) { _delegate = del; this.AxisButtonDeadZone = axisButtnDeadZone; this.Consideration = consideration; }
public static InputToken CreateCustom(AxisDelegate del) { return(new InputToken() { Type = InputType.Custom, _axisDelegate = del }); }
public static InputToken CreateCustom(AxisDelegate axisDel, ButtonDelegate buttonDel) { return(new InputToken() { Type = InputType.Custom, _axisDelegate = axisDel, _buttonDelegate = buttonDel }); }
/* * Profile Group Factory */ /* * Merge */ public static AxisDelegate Merge(this AxisDelegate d1, AxisDelegate d2) { if (d1 == null) { return(d2); } if (d2 == null) { return(d1); } return(() => UnityEngine.Mathf.Clamp(d1() + d2(), -1f, 1f)); }
public void RemoveAxisBind(int axis, AxisDelegate handler) { AxisDelegate deleg; if (axisTable.TryGetValue(axis, out deleg)) { deleg = Delegate.Remove(deleg, handler) as AxisDelegate; axisTable[axis] = deleg; if (axisTable[axis] == null) { axisTable.Remove(axis); } } }
public void AddAxisBind(int axis, AxisDelegate handler) { AxisDelegate deleg; if (axisTable.TryGetValue(axis, out deleg)) { axisTable[axis] = Delegate.Combine(deleg, handler) as AxisDelegate; //UnityEngine.Debug.LogError(axis+" leaking invok list"+axisTable[axis].GetInvocationList().Length); } else { axisTable[axis] = handler; } }
public static AxisDelegate CreateTriggerDelegate(AxisDelegate del, AxleValueConsideration axisConsideration = AxleValueConsideration.Positive) { if (del == null) { return(null); } switch (axisConsideration) { case AxleValueConsideration.Positive: return(() => UnityEngine.Mathf.Clamp01(del())); case AxleValueConsideration.Negative: return(() => - UnityEngine.Mathf.Clamp(del(), -1f, 0f)); case AxleValueConsideration.Absolute: return(() => Math.Abs(del())); default: return(null); } }
public static void AddAxisDelegate(string inputName, AxisDelegate axisDelegate) { if (isApplicationQuitting) { return; } if (instance == null) { InstantiateInstance(); } if (!dictAxisDelegates.ContainsKey(inputName)) { dictAxisDelegates.Add(inputName, axisDelegate); } else { dictAxisDelegates[inputName] += axisDelegate; } }
public static ButtonDelegate CreateAxleButtonDelegate(AxisDelegate axis, AxleValueConsideration consideration, float axleButtonDeadZone = InputUtil.DEFAULT_AXLEBTNDEADZONE) { if (axis == null) { return(null); } switch (consideration) { case AxleValueConsideration.Positive: return(() => axis() > axleButtonDeadZone); case AxleValueConsideration.Negative: return(() => axis() < -axleButtonDeadZone); case AxleValueConsideration.Absolute: return(() => Math.Abs(axis()) > axleButtonDeadZone); default: return(null); } }
public static void RemoveAxisDelegate(string inputName, AxisDelegate axisDelegate) { if (isApplicationQuitting || (instance == null)) { return; } if (dictAxisDelegates.ContainsKey(inputName)) { AxisDelegate dictDelegate = dictAxisDelegates[inputName]; dictDelegate -= axisDelegate; if (dictDelegate == null) { dictAxisDelegates.Remove(inputName); } else { dictAxisDelegates[inputName] = dictDelegate; } } }
public DelegatedDualAxleInputSignature(string id, AxisDelegate hor, AxisDelegate ver) : base(id) { _horizontal = hor; _vertical = ver; }
public DelegatedAxleInputSignature(string id, AxisDelegate del) : base(id) { _delegate = del; }
public DelegatedDualAxleButtonInputSignature(string id, AxisDelegate hor, AxisDelegate ver, float axisButtnDeadZone = InputUtil.DEFAULT_AXLEBTNDEADZONE) : base(id, hor, ver) { this.AxisButtonDeadZone = axisButtnDeadZone; }
public static void Bind(int axis, AxisDelegate handler) { Instance.AddAxisBind(axis, handler); }