/// <summary> /// Used to register a method to be executed when the event is fired. /// </summary> /// <param name="callback">The method to call</param> /// <returns>A reference to the event</returns> public static OnCommandLoaded Register(OnCall callback) { Logger.Log("OnCommandLoaded registered to the method " + callback.Method.Name, LogType.Debug); OnCommandLoaded pe = new OnCommandLoaded(callback); _eventQueue.Add(pe); return pe; }
private async Task <IList <UserOnCall> > GetUsersFromOnCall(OnCall onCall, List <OnCallUsersResource> users, CancellationToken cancellationToken) { var userDtos = await _userRepository.GetAll(cancellationToken); var results = new List <UserOnCall>(); foreach (var user in users) { var userDto = userDtos.FirstOrDefault( u => u.Username == user.OnCallUser.Username); if (userDto == null) { continue; } results.Add(new UserOnCall { UserId = userDto.Id, User = userDto, OnCallId = onCall.Id, OnCall = onCall }); } return(results); }
private async Task UpdateOnCall(CancellationToken cancellationToken) { _logger.LogInformation( $"VictorOpsTaskHandler.UpdateOnCall was called"); var currentOnCall = await _onCallService.GetCurrentOnCall(cancellationToken); foreach (var teamOnCall in currentOnCall.TeamsOnCall) { var voTeam = teamOnCall.Team; var team = await _teamRepository.Get(voTeam.Slug, cancellationToken); if (team == null) { continue; } foreach (var onCall in teamOnCall.OnCallNow) { var onCallDto = new OnCall { Id = $"{voTeam.Name}_{onCall.EscalationPolicy.Slug}", EscalationPolicyName = onCall.EscalationPolicy.Name, Team = team, }; onCallDto.Users = await GetUsersFromOnCall(onCallDto, onCall.Users, cancellationToken); await _onCallRepository.UpdateOrCreate(onCallDto, cancellationToken); } } }
/// <summary> /// Register this event /// The method name must be PlayerConnectEvent /// </summary> /// <param name="method">The method that will be called when the event is executed</param> /// <param name="priority">The priority of the call</param> public static void Register(OnCall method, Priority priority) { Cache r = new Cache(); r.e = new OnPlayerChatEvent(); r.method = method; r.priority = priority; r.Push(); }
public void Call(ulong acceptor) { if (CheckOperator()) { Console.WriteLine("Called {0} from {1}", acceptor, Number); OnCall?.Invoke(this, new MobileAccountEventArgs(acceptor)); } }
/// <summary> /// Register this event /// The method name must be PlayerConnectEvent /// </summary> /// <param name="method">The method that will be called when the event is executed</param> /// <param name="priority">The priority of the call</param> public static void Register(OnCall method, Priority priority) { Cache r = new Cache(); r.e = new OnPlayerConnectEvent(); r.method = method; r.priority = priority; r.Push(); }
private int Calculate(int allCount, int chosenCount) { OnCall?.Invoke(allCount, chosenCount); if (allCount == chosenCount || chosenCount == 0) { return(1); } return(Calculate(allCount - 1, chosenCount) + Calculate(allCount - 1, chosenCount - 1)); }
/// <summary> /// Register this event /// </summary> /// <param name="method">The method that will be called when the event is executed</param> /// <param name="priority">The priority of the call</param> public static void Register(OnCall method, Priority priority) { Registered r = new Registered(); System.Reflection.ParameterInfo p = method.Method.GetParameters()[0]; if (p.GetType() == typeof(PlayerConnectEvent)) r.e = new PlayerConnectEvent(); else throw new Exception("Invalid method"); r.method = method; r.priority = priority; r.GiveMuffinToDerpy(); }
public void Update() { if (Input.GetKeyDown(KeyCode.O)) { OnCallSound?.Invoke(); } if (Input.GetKeyDown(KeyCode.P)) { OnCall?.Invoke(1, 1f); } }
public void BtnExplore_Click(EventContext ev, OnCall call) { DOTween.Kill(this); this.call = call; this.touchable = false; this.visible = true; this.TweenMoveX(ModelManager.inst.gameModel.width - 209, 0.5f).OnComplete(() => { TimerManager.inst.Add(60, 1, onTimersFun); this.touchable = true; }); }
private void OnOverFunction() { DOTween.Kill(this); this.TweenMoveX(ModelManager.inst.gameModel.width, 0.5f).OnComplete(() => { if (this.call != null) { call(); } this.call = null; this.visible = false; Tools.Clear(boxBoom); }); }
public void Call(int number) { if (Monay >= MobileOperator.CallCost) { Console.WriteLine("Call to {0}", number); OnCall?.Invoke(number, _number); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("You have not enought money to make call"); Console.ResetColor(); } }
/// <summary> /// Used to register a method to be executed when the event is fired. /// </summary> /// <param name="callback">The method to call</param> /// <param name="target">The player to watch for. (null for any players)</param> /// <returns>the new OnPlayerConnect event</returns> public static OnPlayerConnect Register(OnCall callback, Player target) { Logger.Log("OnPlayerConnect registered to the method " + callback.Method.Name, LogType.Debug); //We add it to the list here OnPlayerConnect pe = _eventQueue.Find(match => (match.Player == null ? target == null : target != null && target.Username == match.Player.Username)); if (pe != null) //It already exists, so we just add it to the queue. pe._queue += callback; else { //Doesn't exist yet. Make a new one. pe = new OnPlayerConnect(callback, target); _eventQueue.Add(pe); } return pe; }
/// <summary> /// Used to register a method to be executed when the event is fired. /// </summary> /// <param name="callback">The method to call</param> /// <param name="target">The level to watch for. (null for any level)</param> /// <returns>A reference to the event</returns> public static OnLevelSave Register(OnCall callback, Level target) { Logger.Log("OnLevelSave registered to the method " + callback.Method.Name, LogType.Debug); //We add it to the list here OnLevelSave pe = _eventQueue.Find(match => match.level == null); if (pe != null) //It already exists, so we just add it to the queue. pe._queue += callback; else { //Doesn't exist yet. Make a new one. pe = new OnLevelSave(callback, target); _eventQueue.Add(pe); } return pe; }
/// <summary> /// Register this event /// </summary> /// <param name="method">The method that will be called when the event is executed</param> /// <param name="priority">The priority of the call</param> public static void Register(OnCall method, Priority priority) { Registered r = new Registered(); System.Reflection.ParameterInfo p = method.Method.GetParameters()[0]; if (p.GetType() == typeof(PlayerConnectEvent)) { r.e = new PlayerConnectEvent(); } else { throw new Exception("Invalid method"); } r.method = method; r.priority = priority; r.GiveMuffinToDerpy(); }
private int Calculate(int allCount, int chosenCount) { if (chosenCount == 0 || allCount == chosenCount) { return(1); } var savedValue = _cache[allCount, chosenCount]; if (savedValue > -1) { OnCache?.Invoke(allCount, chosenCount); return(savedValue); } OnCall?.Invoke(allCount, chosenCount); return(_cache[allCount, chosenCount] = Calculate(allCount - 1, chosenCount) + Calculate(allCount - 1, chosenCount - 1)); }
private void onTimersFun(float time) { if (ModelManager.inst.alertModel.isTip && ModelManager.inst.alertModel.type == Config.TOUCH_PROGRESSBAR) { OnMainExploreFush(); Log.debug("aaa"); return; } DOTween.Kill(this); this.touchable = false; this.TweenMoveX(ModelManager.inst.gameModel.width, 1f).OnComplete(() => { call(); this.call = null; this.visible = false; Tools.Clear(boxBoom); }); }
public void Call(object acceptor) { if (!CheckOperator()) { return; } var phoneBookContact = acceptor as MobileAccount; foreach (var contact in phonebook) { if (contact == phoneBookContact) { Console.WriteLine("Called {0} from {1}", phoneBookContact.Name, Number); OnCall?.Invoke(this, new MobileAccountEventArgs(phoneBookContact.Number)); return; } } Console.WriteLine("contact is not in phone book"); }
private int Calculate(int allCount, int chosenCount) { for (int i = 0; i <= allCount; i++) { for (int k = 0; k <= chosenCount && k <= i; k++) { if (k == 0) { _cache[i, k] = 1; } else { _cache[i, k] = _cache[i - 1, k] + _cache[i - 1, k - 1]; } OnCall?.Invoke(i, k); } } return(_cache[allCount, chosenCount]); }
public void Call(MobileAccount phoneBookContact) { if (CheckOperator()) { bool isFound = false; foreach (var contact in phonebook) { if (contact.Value == phoneBookContact) { Console.WriteLine("Called {0} from {1}", phoneBookContact.name, number); OnCall?.Invoke(this, new MobileAccountEventArgs(phoneBookContact.number)); isFound = true; } } if (!isFound) { Console.WriteLine("contact is not in phone book"); } } }
public void Call(int number) { Console.WriteLine("Call to {0}", number); OnCall?.Invoke(number, _number); }
public ParticipantDeletedTask(GoHereWithSituationEx sit, Sim sim, OnCall func) { mSituation = sit; mSim = sim; mFunc = func; }
/// <summary> /// Register this event /// </summary> /// <param name="method">The method to call when this event gets excuted</param> /// <param name="priority">The importance of the call</param> public static void Register(OnCall method, Priority priority, object passdata = null, Player target = null) { Muffins temp = new Muffins(method, priority, new OnPlayerChat(), passdata, target); Muffins.GiveDerpyMuffins(temp); }
public void Coll(int targerPhoneNumber) { CurrentCallInfo = new CallInfo(PhoneNumber, targerPhoneNumber); State = PortState.Busy; OnCall?.Invoke(CurrentCallInfo); }
internal OnCommandLoaded(OnCall callback) { _queue += callback; }
private void ThreadEventDispatch() { while (false == EventStop.Wait(1)) { string json = ""; bool pop_ok = EventJsonQueue.TryDequeue(out json); if (!pop_ok || json == null || json == "") { continue; } OnEventRawString?.Invoke(this, json); JObject jdata = null; EVENT_TYPE type = ParseEventType(json, out jdata); //因為必須在conference裡面中轉各個customized header,不得已只好自己維護live channel的資料... //收到CHANNEL_CREATE事件時就收錄channel資訊 //留在Conference Create時撈出來看 variable_sip_h_X-* 變數.... switch (type) { case EVENT_TYPE.CALL_TO_SWITCH: OnCall?.Invoke(this, new CCallEvent(jdata)); break; case EVENT_TYPE.SWITCH_CALL_USER: OnCall?.Invoke(this, new CCallEvent(jdata)); break; case EVENT_TYPE.ANSWER: OnAnswer?.Invoke(this, new CAnswerEvent(jdata)); break; case EVENT_TYPE.HANGUP: OnHangUp?.Invoke(this, new CHangUpEvent(jdata)); break; case EVENT_TYPE.DESTROY_CALL: OnCallDestroy?.Invoke(this, new CCallEvent(jdata)); break; case EVENT_TYPE.CONFERENCE_CREATE: OnRoomCreate?.Invoke(this, new CConferenceCreateEvent(jdata)); break; case EVENT_TYPE.CONFERENCE_DELETE: OnRoomDelete?.Invoke(this, new CConferenceDeleteEvent(jdata)); break; case EVENT_TYPE.JOIN_CONFERENCE: OnJoinRoom?.Invoke(this, new CJoinConferenceEvent(jdata)); break; case EVENT_TYPE.LEAVE_CONFERENCE: OnLeaveRoom?.Invoke(this, new CLeaveConferenceEvent(jdata)); break; case EVENT_TYPE.REGISTER: OnSipRegister?.Invoke(this, new CSipRegister(jdata)); break; default: Log.Warn($"Unsupported event type {type.ToString()}, skip it..."); break; } } //Queue沒有Clear(),只能用這種蠢方法清除 while (EventJsonQueue.Count > 0) { string msg = ""; EventJsonQueue.TryDequeue(out msg); } }
public MenuOption(Text obj, OnCall onCall) { text = obj.text; color = obj.color; textObj = obj; this.onCall = onCall; }
public static void Register(OnCall method, Priority priority) { EventHelper temp = new EventHelper(method, priority, new OnPlayerConnect()); EventHelper.Push(temp); }
/// <summary> /// Creates a new event. This is NOT meant to be used by user-code, only internally by events. /// </summary> /// <param name="callback">the method used for the delegate to callback upon event fire</param> /// <param name="target">The target Player we want the event for.</param> internal OnPlayerCommand(OnCall callback, Player target) : base(target) { _queue += callback; }
/// <summary> /// Creates a new event. This is NOT meant to be used by user-code, only internally by events. /// </summary> /// <param name="callback">the method used for the delegate to callback upon event fire</param> /// <param name="target">The target Player we want the event for.</param> /// <param name="datapass">The data we want to pass between events.</param> internal OnPlayerBlockChange(OnCall callback, Player target, object datapass) : base(target) { this.datapass = datapass; _queue += callback; }
/// <summary> /// Creates a new event. This is NOT meant to be used by user-code, only internally by events. /// </summary> /// <param name="callback">the method used for the delegate to callback upon event fire</param> /// <param name="target">The target Player we want the event for.</param> internal OnPlayerDisconnect(OnCall callback, Player target) : base(target) { _queue += callback; }
/// <summary> /// Creates a new event. This is NOT meant to be used by user-code, only internally by events. /// </summary> /// <param name="callback">the method used for the delegate to callback upon event fire</param> /// <param name="target">The target Player we want the event for.</param> private OnPlayerMove(OnCall callback, Player target) : base(target) { _queue += callback; }
/// <summary> /// Creates a new event. This is NOT meant to be used by user-code, only internally by events. /// </summary> /// <param name="callback">the method used for the delegate to callback upon event fire</param> /// <param name="target">The target Level we want the event for.</param> private OnLevelSave(OnCall callback, Level target) : base(target) { _queue += callback; }
public virtual void Call() { OnCall?.Invoke(); }
/// <summary> /// Register this event /// </summary> /// <param name="method">The method to call when this event gets excuted</param> /// <param name="priority">The importance of the call</param> public static void Register(OnCall method, Priority priority, object datapass = null, Player target = null) { Muffins temp = new Muffins(method, priority, new OnPlayerCommand(), datapass, target); Muffins.GiveDerpyMuffins(temp); }