public void TriggerEvent(RaiseEvent raiseEvent) { m_actions.Enqueue(new StoryEventAction() { Type = StoryActionType.TriggerEvent, Event = raiseEvent }); }
private void EventHandle(object sender, RaiseEvent e) { if (e.m_eventType != StarPlatinum.StoryReader.StoryReader.EventType.invokeEvent) { return; } if (e.m_eventName != m_eventName) { return; } switch (m_operationAfterReceiveEvent) { case OperationAfterReceiveEvent.EnableGameobject: if (m_boxCollider == null) { Debug.LogError(m_eventName + " is triggered, but collision is null."); break; } m_boxCollider.enabled = true; break; case OperationAfterReceiveEvent.DisableGameobject: if (m_boxCollider == null) { Debug.LogError(m_eventName + " is triggered, but collision is null."); break; } m_boxCollider.enabled = false; break; default: break; } }
private Set GetSetter(ElementBuilder eb, Property propertyClone, string varName) { Set setter = eb.BuildSetter(); If ifStatement = eb.BuildIf(eb.OpNotEquals("value", varName)); ifStatement.AddNode(eb.BuildAssignment(varName, "value")); ExpressionCollection args = new ExpressionCollection(); args.Add(new SnippetExpression(CodeRush.StrUtil.AddQuotes(propertyClone.Name))); ExpressionCollection arguments = new ExpressionCollection(); arguments.Add(eb.BuildThisReferenceExpression()); arguments.Add(eb.BuildObjectCreationExpression("PropertyChangedEventArgs", args)); if (CodeRush.Language.IsCSharp) { ifStatement.AddNode(eb.BuildMethodCall("PropertyChanged", arguments, null /* qualifier */)); } else if (CodeRush.Language.IsBasic) { RaiseEvent raiseEvent = new RaiseEvent(eb.BuildMethodCallExpression("PropertyChanged", arguments)); ifStatement.AddNode(raiseEvent); } setter.AddNode(ifStatement); return(setter); }
private void AddTrack(object sender, TrackInAirspaceEvent arg) { trackUpdate = new TrackUpdateEvent(); foreach (var track in arg.tracks) { if (Calculator.Calculator.TrackIsInsideAirSpace(track)) { if (trackTags.Contains(track.Tag)) { UpdateTrack(track); trackUpdate.ListOfUpdatedTracks.Add(track); } else { trackTags.Add(track.Tag); AddNewTrack(track); trackUpdate.ListOfNewTracks.Add(track); } } else { if (trackTags.Contains(track.Tag)) { trackTags.Remove(track.Tag); tracks.Remove(tracks.First(t => t.New.Tag == track.Tag)); } } } AreTracksColliding(); RaiseEvent?.Invoke(this, trackUpdate); }
private object OnRaiseEvent(IConnection connection, RaiseEvent payload) { if (payload != null && LocalInstances.TryGetValue(payload.Eid, out var instance)) { instance.RaiseEvent(connection, payload); } return(null); }
/// <summary> /// Returns a flag whether a given use action can be called on given raise event. /// </summary> /// <param name="raiseEvent">Event to raise</param> /// <returns>Flag whether a given use action can be called on given raise event</returns> private static bool CanCallAction(RaiseEvent raiseEvent) { // MN:TO_DO: fix getting inputs? switch (raiseEvent) { case RaiseEvent.LeftClick: { return(Input.GetMouseButtonDown(0)); } case RaiseEvent.RightClick: { return(Input.GetMouseButtonDown(1)); } default: { return(false); } } }
/// <summary> /// Draw array of use actions. /// </summary> /// <param name="useActionsProp">Property holding collection of use actions</param> private void DrawArrayOfUseActions(SerializedProperty useActionsProp) { for (int i = 0; i < useActionsProp.arraySize; i++) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("x", GUILayout.Width(20))) { useActionsProp.DeleteArrayElementAtIndex(i); serializedObject.ApplyModifiedProperties(); // Break, because if someone remove element from array, this array size is changed, so we need // to wait for the next frame to refresh all this code ('OnInspectorGUI()' is called once per frame). break; } SerializedProperty useAction = useActionsProp.GetArrayElementAtIndex(i); if (useAction != null) { // To 'FindPropertyRelative()' method, we can only pass serialized fields or public fields (they are also serialized). // You cannot pass there a property. SerializedProperty raiseEventProp = useAction.FindPropertyRelative("_raiseEvent"); SerializedProperty targetComponentProp = useAction.FindPropertyRelative("_targetComponent"); // Get old raise event (value that is currently in 'Item._raiseEvent' field). RaiseEvent oldRaiseEvent = (RaiseEvent)raiseEventProp.enumValueIndex; // Draw enum drop dawn, with selected element ('enumValueIndex' is used for setting selected element). // 'EnumPopup' returns currently selected item (so if user changes selection in editor, we can get that way newly selected element). RaiseEvent newRaiseEvent = (RaiseEvent)EditorGUILayout.EnumPopup(oldRaiseEvent, GUILayout.Width(140)); // Set newly selected element in property. raiseEventProp.enumValueIndex = (int)newRaiseEvent; // Create simple control for changing '_targetComponent' property. EditorGUILayout.PropertyField(targetComponentProp, GUIContent.none, false); // Apply changes. serializedObject.ApplyModifiedProperties(); } EditorGUILayout.EndHorizontal(); } }
private Set GetSetter(ElementBuilder eb, Property propertyClone, string varName) { Set setter = eb.BuildSetter(); If ifStatement = eb.BuildIf(eb.OpNotEquals("value", varName)); ifStatement.AddNode(eb.BuildAssignment(varName, "value")); ExpressionCollection args = new ExpressionCollection(); args.Add(new SnippetExpression(CodeRush.StrUtil.AddQuotes(propertyClone.Name))); ExpressionCollection arguments = new ExpressionCollection(); arguments.Add(eb.BuildThisReferenceExpression()); arguments.Add(eb.BuildObjectCreationExpression("PropertyChangedEventArgs", args)); if (CodeRush.Language.IsCSharp) { ifStatement.AddNode(eb.BuildMethodCall("PropertyChanged", arguments, null /* qualifier */)); } else if (CodeRush.Language.IsBasic) { RaiseEvent raiseEvent = new RaiseEvent(eb.BuildMethodCallExpression("PropertyChanged", arguments)); ifStatement.AddNode(raiseEvent); } setter.AddNode(ifStatement); return setter; }
public void Any(RaiseEvent request) { Webhooks.Publish(request.EventName, request.Data); }
public void HandleHandHistory(string handHistory) { _summary = false; ResetOpponentsEvent?.Invoke(); foreach (var line in handHistory.Split('\n')) { if (line.Contains("Seat") && !line.Contains("button") && !_summary) { var split = line.Split(':'); var name = split[1].Substring(1, split[1].IndexOf('(') - 2); if (name == Controller.User.UserName) { continue; } if (!Controller.Opponents.ContainsKey(name)) { Controller.Opponents[name] = new Opponent { Name = name, HandsPlayed = 1 } } ; else { Controller.Opponents[name].HandsPlayed++; Controller.Opponents[name].InPlay = true; } } else if (line.Contains("HOLE") || line.Contains("FLOP") || line.Contains("TURN") || line.Contains("RIVER") || line.Contains("SHOW DOWN") || line.Contains("SUMMARY")) { var split = line.Split(' '); SetHandHistoryStateEvent?.Invoke(split[1]); if (line.Contains("SUMMARY")) { _summary = true; } } else if (line.Contains(Controller.User.UserName) && line.Contains("collected")) { SetHandWonEvent?.Invoke(); } else if (line.Contains(Controller.User.UserName)) { if (line.Contains("calls")) { CallEvent?.Invoke(); } else if (line.Contains("bets")) { BetEvent?.Invoke(); } else if (line.Contains("raises")) { RaiseEvent?.Invoke(); } else if (line.Contains("checks")) { CheckEvent?.Invoke(); } else if (line.Contains("folds")) { FoldEvent?.Invoke(); } } else if (line.Contains("Hand #")) { var split = line.Split(' '); SetHandNumEvent?.Invoke(split[2]); } else if (line.Contains("calls")) { var user = line.Split(':')[0]; OpponentCallEvent?.Invoke(user); } else if (line.Contains("checks")) { var user = line.Split(':')[0]; OpponentCheckEvent?.Invoke(user); } else if (line.Contains("bets")) { var user = line.Split(':')[0]; OpponentBetEvent?.Invoke(user); } else if (line.Contains("raises")) { var user = line.Split(':')[0]; OpponentRaiseEvent?.Invoke(user); } else if (line.Contains("folds")) { var user = line.Split(':')[0]; OpponentFoldEvent?.Invoke(user); } } }
/// <summary>Raise event</summary> /// <param name="raiseEvent">Evento</param> internal void Raise(RaiseEvent raiseEvent) { Events.Enqueue(raiseEvent); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors #endregion //------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods internal static void DispatchEvent(ProxySimple el, IntPtr hwnd, int eventId, object idProp, int idObject) { // This logic uses a hastables in order to get to a delegate that will raise the correct Automation event // that may be a property change event a Automation event or a structure changed event. // There are three hashtables one for each idObject we support. Depending on the idObject that gets // passed in we access one of these hashtables with a key of an automation identifier and then retrieve // the data which ia a delegate of type RasieEvent. This delegate is called to raise the correct type of event. RaiseEvent raiseEvent = null; switch (idObject) { case NativeMethods.OBJID_WINDOW: lock (_classLock) { if (_objectIdWindow == null) { InitObjectIdWindow(); } } raiseEvent = (RaiseEvent)_objectIdWindow[idProp]; break; case NativeMethods.OBJID_CLIENT: lock (_classLock) { if (_objectIdClient == null) { InitObjectIdClient(); } } raiseEvent = (RaiseEvent)_objectIdClient[idProp]; break; case NativeMethods.OBJID_VSCROLL: case NativeMethods.OBJID_HSCROLL: lock (_classLock) { if (_objectIdScroll == null) { InitObjectIdScroll(); } } raiseEvent = (RaiseEvent)_objectIdScroll[idProp]; break; case NativeMethods.OBJID_CARET: lock (_classLock) { if (_objectIdCaret == null) { InitObjectIdCaret(); } } raiseEvent = (RaiseEvent)_objectIdCaret[idProp]; break; case NativeMethods.OBJID_SYSMENU: case NativeMethods.OBJID_MENU: lock (_classLock) { if (_objectIdMenu == null) { InitObjectIdMenu(); } } raiseEvent = (RaiseEvent)_objectIdMenu[idProp]; break; default: // Commented out to remove annoying asserts temporarily. // (See work item PS1254940.) //System.Diagnostics.Debug.Assert(false, "Unexpected idObject " + idObject); return; } if (raiseEvent != null) { raiseEvent(el, hwnd, eventId); } else { // If there is no delegate then we need to handle this property genericly by just getting the property value // and raising the a property changed event. AutomationProperty property = idProp as AutomationProperty; if (property == null) { System.Diagnostics.Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Unexpected idProp {0} for idOject 0x{1:x8} on element {2} for event {3}", idProp, idObject, el, eventId)); return; } object propertyValue = ((IRawElementProviderSimple)el).GetPropertyValue(property.Id); RaisePropertyChangedEvent(el, property, propertyValue); } }
protected virtual void OnRaiseEvent() { RaiseEvent?.Invoke(this, EventArgs.Empty); }
protected virtual void OnEvent(EventArgs @eventArgs, Event @event) { RaiseEvent?.Invoke(@eventArgs, @event); }
void OnEnable() { m_script = (RaiseEvent)target; }
public void SetParam(string Key, object Value) { Params[Key] = Value.ToString(); RaiseEvent?.Invoke(this, Key); }