private void frmMain_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F11) { masterController.toogleMaximize(); } if (isLogin) { if (e.Control && e.Shift && e.KeyCode == Keys.L) { masterController.logout(); } else if (e.Alt && (e.KeyCode == Keys.OemPeriod || e.KeyCode == Keys.Oemcomma)) { KeyFunction menuBarKeyFunction = menuBar.getMenuBarKeyFunction; menuBarKeyFunction(e); } } if (keyFunction != null) { keyFunction(e); } }
// KEEP void Start() { currentEnemiesList = new List <SkeletonBehaviour>(); reset(); // Reiniciamos el juego KeyFunction.createInstance(KeyCode.R, reset); // DELETE }
public AuthStateReqs(KeyFunction Func, LMKPairs.LMKPair LMKKeyPair, string Variant, AuthorizedStateRequirement Req) { this.Func = Func; this.LMKKeyPair = LMKKeyPair; this.var = Variant; this.Requirement = Req; }
void Key_TextEnteredSync(char arg1, KeyFunction arg2) { if (writingChatLine) { chatLine += arg1; } }
public void Add(int frame, T value, KeyFunction function = KeyFunction.Linear) { Add(new Keyframe <T> { Frame = frame, Value = value, Function = function }); }
public void AddOrdered(int frame, object value, KeyFunction function = KeyFunction.Linear) { AddOrdered(new Keyframe <T> { Frame = frame, Value = (T)value, Function = function }); }
/// <summary> /// Add a binding with both a key and a function /// </summary> /// <param name="Key"></param> /// <param name="function"></param> /// <returns>Returns false if a duplicate binding is found</returns> public static bool AddBinding(KeyCode?Key, KeyFunction function) { if (Bindings.Contains(new KeyValuePair <KeyCode?, KeyFunction>(Key, function))) { return(false); } Bindings.Add(new KeyValuePair <KeyCode?, KeyFunction>(Key, function)); return(true); }
// This will be call upon content change void masterController_ContentChange(object sender, ContentArgs e) { keyFunction = null; if (e.currentContent is IKeyController) { IKeyController keyController = e.currentContent as IKeyController; keyFunction = keyController.getKeyController; } }
public static IKeyframe CreateForType(Type type, int frame, object value, KeyFunction function = KeyFunction.Linear) { var k = CreateForType(type); k.Frame = frame; k.Value = value; k.Function = function; return(k); }
/// <summary> /// Returns an authorized state requirement. /// </summary> /// <param name="function">Function requested.</param> /// <param name="pair">LMK pair for which function is requested.</param> /// <param name="variant">Variant requested.</param> /// <returns>Requirement.</returns> public static StateRequirementType GetRequirement(KeyFunction function, LmkPair pair, int variant) { foreach (var req in Reqs.Where(req => req.Function == function && req.Pair == pair && req.Variant == variant)) { return(req.Requirement); } return(StateRequirementType.NotAllowed); }
/// <summary> /// Given a collection of values a key function, builds a dictionary /// </summary> /// <param name="values">List of values</param> /// <param name="keyFunction">Key function, mapping from key to value</param> /// <returns>The dictionay</returns> public static IDictionary <TKey, TValue> NewReadOnlyDictionary <TKey, TValue>( IEnumerable <TValue> values, KeyFunction <TKey, TValue> keyFunction) { IDictionary <TKey, TValue> rv = NewDictionary <TKey, TValue>(values, keyFunction); return(new ReadOnlyDictionary <TKey, TValue>(rv)); }
public static void moveToKeyFunctionsGroup(KeyFunction keyFunction) { GameObject folder = GameObject.Find("Key_Functions"); // KeyFunction folder if (folder == null) { folder = new GameObject("Key_Functions"); } keyFunction.transform.parent = folder.transform; }
/*------------------------------------------------------------------------- * アサインされたキーの文字列を得る * アサインされていなければ""を返す * ---------------------------------------------------------------------------*/ private string get_assign_shortcut_text(KeyFunction function) { string shortcut = m_lib.KeyAssignManager.List.GetAssignShortcutText(function); if (String.IsNullOrEmpty(shortcut)) { return(""); } return("(" + shortcut + ")"); }
void customerInformationViewKeys(KeyEventArgs e) { if (orderSliderPane1.isOpen()) { KeyFunction keyFunction = orderSliderPane1.getKeyController; if (keyFunction != null) { keyFunction(e); } } }
public static AuthorizedStateRequirement GetAuthorizedStateRequirement(KeyFunction NeededFunction, LMKPairs.LMKPair LMKKeyPair, string Variant) { for (int i = 0; i < Reqs.GetUpperBound(0); i++) { if ((Reqs[i].Func == NeededFunction) && (Reqs[i].LMKKeyPair == LMKKeyPair) && (Reqs[i].var == Variant)) { return(Reqs[i].Requirement); } } return(AuthorizedStateRequirement.NotAllowed); }
internal void SetKeyFunction(KeyFunction value) { foreach (var animable in editorParams.RootObjects.OfType <IAnimationHost>()) { IAnimator animator; if (animable.Animators.TryFind(editorParams.PropertyPath, out animator, Document.Current.AnimationId)) { var keyframe = animator.ReadonlyKeys.FirstOrDefault(i => i.Frame == Document.Current.AnimationFrame).Clone(); keyframe.Function = value; Core.Operations.SetKeyframe.Perform(animable, editorParams.PropertyPath, Document.Current.AnimationId, keyframe); } } }
public void Bind(KeyFunction function, Key primaryKey, Key secondaryKey = Key.None) { if (Shortcuts.ContainsKey(function)) { if (primaryKey != Key.None) { Shortcuts[function].PrimaryKey = primaryKey; } if (secondaryKey != Key.None) { Shortcuts[function].SecondaryKey = secondaryKey; } } }
/// <summary> /// Gets a Binding's index by the function bound /// </summary> /// <param name="function"></param> /// <returns>Returns -1 if no binding exists for the given function</returns> public static int[] GetBindingIndexs(KeyFunction function) { List <int> ints = new List <int>(); int i = 0; foreach (KeyValuePair <KeyCode?, KeyFunction> Binding in Bindings) { if (Binding.Value == function) { ints.Add(i); } i++; } Debug.LogWarning("Attempted to get the index of a binding that does not exist"); return(ints.ToArray()); }
public void setKeyEvent(KeySet.KeyName name, TriggerType type, KeyFunction function) { // create set if none if (!triggeredKeys.ContainsKey(type) || triggeredKeys[type] == null) { triggeredKeys[type] = new HashSet <KeySet.KeyName> (); } // remove old trigger key if (key2type.ContainsKey(name) && key2type [name] != type) { triggeredKeys [key2type [name]].Remove(name); } // create new link triggeredKeys[type].Add(name); key2type [name] = type; triggerFunction [name] = function; }
/// <summary> /// Given a collection of values a key function, builds a dictionary /// </summary> /// <param name="values">List of values</param> /// <param name="keyFunction">Key function, mapping from key to value</param> /// <returns>The dictionay</returns> public static IDictionary <TKey, TValue> NewDictionary <TKey, TValue>( IEnumerable <TValue> values, KeyFunction <TKey, TValue> keyFunction) { IDictionary <TKey, TValue> rv = new Dictionary <TKey, TValue>(); if (values != null) { foreach (TValue value in values) { TKey key = keyFunction(value); //DONT use Add - it throws exceptions if already there rv[key] = value; } } return(rv); }
/// <summary> /// Validates an authorized state requirement. /// </summary> /// <param name="func">Function to perform.</param> /// <param name="pair">LMK pair.</param> /// <param name="variant">Variant.</param> /// <param name="mr">Message response to add error code to, if parsing fails.</param> /// <returns>True if the operation is allowed.</returns> protected bool ValidateAuthStateRequirement(KeyFunction func, LmkPair pair, int variant, StreamResponse mr) { var req = AuthStateRequirements.GetRequirement(func, pair, variant); if (req == StateRequirementType.NotAllowed) { mr.Append(ErrorCodes.ER_29_FUNCTION_NOT_PERMITTED); return(false); } if (req == StateRequirementType.NeedsAuthorizedState && !ConfigHelpers.IsInAuthorizedState()) { mr.Append(ErrorCodes.ER_17_HSM_IS_NOT_IN_THE_AUTHORIZED_STATE); return(false); } return(true); }
// This will be call upon content change void masterController_ContentChange(object sender, ContentArgs e) { keyFunction = null; if (e.currentContent is IKeyController) { IKeyController keyController = e.currentContent as IKeyController; keyFunction = keyController.getKeyController; } if (masterController.history.Count == 0) { back1.enable(false); } else { back1.enable(true); } }
public void AddKey(KeyFunction key) { switch (key) { case KeyFunction.a: keyA.SetActive(true); break; case KeyFunction.w: keyW.SetActive(true); break; case KeyFunction.s: keyS.SetActive(true); break; case KeyFunction.d: keyD.SetActive(true); break; case KeyFunction.q: keyQ.SetActive(true); break; case KeyFunction.e: keyE.SetActive(true); break; case KeyFunction.enter: keyEnter.SetActive(true); break; case KeyFunction.esc: keyEsc.SetActive(true); break; case KeyFunction.space: keySpace.SetActive(true); break; default: return; } }
public bool Commit(ITerminalEmulatorOptions options, ICoreServicePreference window_options) { StringResource sr = OptionDialogPlugin.Instance.Strings; bool successful = false; string itemname = null; try { //Win9xでは、左右のAltの区別ができないので別々の設定にすることを禁止する if (System.Environment.OSVersion.Platform == PlatformID.Win32Windows && ((EnumListItem <AltKeyAction>)_leftAltKeyAction.SelectedItem).Value != ((EnumListItem <AltKeyAction>)_rightAltKeyAction.SelectedItem).Value) { GUtil.Warning(this, sr.GetString("Message.OptionDialog.AltKeyOnWin9x")); return(false); } options.LeftAltKey = ((EnumListItem <AltKeyAction>)_leftAltKeyAction.SelectedItem).Value; options.RightAltKey = ((EnumListItem <AltKeyAction>)_rightAltKeyAction.SelectedItem).Value; options.Send0x7FByDel = _send0x7FByDel.Checked; options.Send0x7FByBack = _send0x7FByBack.Checked; options.Zone0x1F = ((EnumListItem <KeyboardStyle>)_zone0x1FBox.SelectedItem).Value; itemname = "Custom Key Setting"; KeyFunction.Parse(_customKeySettingsBox.Text); //パースできればOK options.CustomKeySettings = _customKeySettingsBox.Text; window_options.AutoCopyByLeftButton = _autoCopyByLeftButton.Checked; options.RightButtonAction = ((EnumListItem <MouseButtonAction>)_rightButtonAction.SelectedItem).Value; options.MiddleButtonAction = ((EnumListItem <MouseButtonAction>)_middleButtonAction.SelectedItem).Value; itemname = sr.GetString("Caption.OptionDialog.MousewheelAmount"); options.WheelAmount = Int32.Parse(_wheelAmount.Text); window_options.ViewSplitModifier = ((ListItem <Keys>)_viewSplitModifierBox.SelectedItem).Value; successful = true; } catch (FormatException) { GUtil.Warning(this, String.Format(sr.GetString("Message.OptionDialog.InvalidItem"), itemname)); } catch (InvalidOptionException ex) { GUtil.Warning(this, ex.Message); } return(successful); }
private KeyFunction SelectKeyFunction(KeyFunction a, KeyFunction b) { if (a == b) { return(a); } if (a == KeyFunction.Steep || b == KeyFunction.Steep) { return(KeyFunction.Steep); } if (a == KeyFunction.ClosedSpline || b == KeyFunction.ClosedSpline) { return(KeyFunction.ClosedSpline); } if (a == KeyFunction.Spline || b == KeyFunction.Spline) { return(KeyFunction.Spline); } return(KeyFunction.Linear); }
string FunctionToString(KeyFunction function) { switch (function) { case KeyFunction.Linear: return("Linear"); case KeyFunction.Steep: return("None"); case KeyFunction.Spline: return("Spline"); case KeyFunction.ClosedSpline: return("ClosedSpline"); default: throw new ArgumentException(); } }
private void Approximate(int index1, int index2, KeyFunction keyFunction, int numberOfPoints) { int index0; int index3; approximation.Clear(); if (keyFunction == KeyFunction.Spline) { index0 = index1 < 1 ? 0 : index1 - 1; index3 = index2 >= points.Count - 1 ? points.Count - 1 : index2 + 1; } else if (keyFunction == KeyFunction.ClosedSpline) { index0 = index1 < 1 ? points.Count - 1 : index1 - 1; index3 = index2 >= points.Count - 1 ? 0 : index2 + 1; } else { approximation.Add(points[index1]); approximation.Add(points[index2]); return; } approximation.Add(points[index1]); for (int i = 1; i < numberOfPoints - 1; ++i) { approximation.Add( Mathf.CatmullRomSpline( (float)i / numberOfPoints, points[index0], points[index1], points[index2], points[index3] ) ); } approximation.Add(points[index2]); }
private void CacheInterpolationParameters(double time) { int count = ReadonlyKeys.Count; if (count == 0) { Value2 = default(T); minTime = -float.MaxValue; maxTime = float.MaxValue; function = KeyFunction.Steep; return; } var i = keyIndex; if (i >= count) { i = count - 1; } int frame = AnimationUtils.SecondsToFrames(time); // find rightmost key on the left from the given frame while (i < count - 1 && frame > ReadonlyKeys[i].Frame) { i++; } while (i >= 0 && frame < ReadonlyKeys[i].Frame) { i--; } keyIndex = i; int minFrame, maxFrame; if (i < 0) { keyIndex = 0; maxFrame = ReadonlyKeys[0].Frame; minFrame = int.MinValue; Value2 = ReadonlyKeys[0].Value; function = KeyFunction.Steep; } else if (i == count - 1) { minFrame = ReadonlyKeys[i].Frame; maxFrame = int.MaxValue; Value2 = ReadonlyKeys[i].Value; function = KeyFunction.Steep; } else { var key1 = ReadonlyKeys[i]; var key2 = ReadonlyKeys[i + 1]; minFrame = key1.Frame; maxFrame = key2.Frame; Value2 = key1.Value; Value3 = key2.Value; function = key1.Function; if (function == KeyFunction.Spline) { Value1 = ReadonlyKeys[i < 1 ? 0 : i - 1].Value; Value4 = ReadonlyKeys[i + 1 >= count - 1 ? count - 1 : i + 2].Value; } else if (function == KeyFunction.ClosedSpline) { Value1 = ReadonlyKeys[i < 1 ? count - 2 : i - 1].Value; Value4 = ReadonlyKeys[i + 1 >= count - 1 ? 1 : i + 2].Value; } } minTime = minFrame * AnimationUtils.SecondsPerFrame; maxTime = maxFrame * AnimationUtils.SecondsPerFrame; }
public static void Render(Vector2 a, Vector2 b, Color4 color, KeyFunction func) { var segmentWidth = b.X - a.X; var segmentHeight = b.Y - a.Y; switch (func) { case KeyFunction.Linear: vertices[0].Pos = new Vector2(a.X, b.Y - 0.5f); vertices[1].Pos = new Vector2(b.X, a.Y); vertices[2].Pos = new Vector2(b.X, b.Y - 0.5f); for (int i = 0; i < vertices.Length; i++) { vertices[i].Color = color; } Renderer.DrawTriangleFan(vertices, numVertices: 3); break; case KeyFunction.Steep: var leftSmallRectVertexA = new Vector2(a.X + 0.5f, a.Y + segmentHeight / 2); var leftSmallRectVertexB = new Vector2(a.X + segmentWidth / 2, b.Y - 0.5f); Renderer.DrawRect(leftSmallRectVertexA, leftSmallRectVertexB, color); var rightBigRectVertexA = new Vector2(a.X + segmentWidth / 2, a.Y + 0.5f); var rightBigRectVertexB = new Vector2(b.X, b.Y - 0.5f); Renderer.DrawRect(rightBigRectVertexA, rightBigRectVertexB, color); break; case KeyFunction.Spline: var numSegments = 5; var center = new Vector2(a.X, b.Y - 0.5f); vertices[0] = new Vertex { Pos = center, Color = color }; for (int i = 0; i < numSegments; i++) { var r = Vector2.CosSin(i * Mathf.HalfPi / (numSegments - 1)); vertices[i + 1].Pos = new Vector2( center.X + r.X * segmentWidth, center.Y - r.Y * segmentHeight); vertices[i + 1].Color = color; } Renderer.DrawTriangleFan(vertices, numSegments + 1); break; case KeyFunction.ClosedSpline: var circleCenter = new Vector2(a.X + segmentWidth / 2, a.Y + segmentHeight / 2); var circleRadius = 0f; if (segmentWidth < segmentHeight) { circleRadius = circleCenter.X - a.X - 0.5f; } else { circleRadius = circleCenter.Y - a.Y - 0.5f; } Renderer.DrawRound(circleCenter, circleRadius, numSegments: 6, color); break; default: throw new System.NotImplementedException("Unknown KeyFunction value"); } }
private int Round(int block, byte key) { var rightSide = block & rightSideMask; var admixture = new KeyFunction().Execute(rightSide, key); var leftSide = (block & leftSideMask) >> 4; leftSide ^= admixture; return leftSide << 4 | rightSide; }
/// <summary> /// Add a binding with no Key assigned /// </summary> /// <param name="function"></param> /// <returns></returns> public static bool AddBinding(KeyFunction function) { return(AddBinding(null, function)); }
// This will be call upon content change void masterController_ContentChange(object sender, ContentArgs e) { keyFunction = null; if (e.currentContent is IKeyController) { IKeyController keyController = e.currentContent as IKeyController; keyFunction = keyController.getKeyController; } if (masterController.history.Count == 0) back1.enable(false); else back1.enable(true); }