public static void UpdateDistribution(EventEnum eventType, IDistribution distribution) { lock (lockobj) { _distribution[eventType] = distribution; } }
public static IDistribution GetDistribution(EventEnum eventType) { lock (lockobj) { return(_distribution[eventType]); } }
public void RemoveListener(EventEnum eventType, VoidDelegate func) { if (allEvents.ContainsKey(eventType) && allEvents[eventType] != null) { allEvents[eventType] -= func; } }
void EventProcess(EventEnum value, GameObject obj) { switch (value) { case EventEnum.ShowBuildMenu: updateTowerMenu.SetActive(false); buildTowerMenu.SetActive(true); buildTowerMenu.transform.position = Camera.main.WorldToScreenPoint(obj.transform.position); currentObj = obj; break; case EventEnum.CloseMenu: break; case EventEnum.ShowUpdateMenu: buildTowerMenu.SetActive(false); updateTowerMenu.SetActive(true); updateTowerMenu.transform.position = Camera.main.WorldToScreenPoint(obj.transform.position); currentObj = obj; break; default: break; } }
override public void HandleEvent(EventEnum eventEnum) { switch (eventEnum) { case EventEnum.ATTACK: animator.SetTrigger(ShootAnimParam); break; case EventEnum.ATTACKING: animator.SetBool(EatAnimParam, true); break; case EventEnum.NOT_ATTACKING: animator.SetBool(EatAnimParam, false); break; case EventEnum.START_MOVING: animator.SetBool(MoveAnimParam, true); break; case EventEnum.STOP_MOVING: animator.SetBool(MoveAnimParam, false); break; default: break; } }
public void NotifyObservers(EventEnum eventEnum) { foreach (Observer observer in observers) { observer.HandleEvent(eventEnum); } }
public Slot(EventEnum name, SlotDetail slotDetail, bool editable) { Name = name; SlotSession = slotDetail; _sessions = new List <Session>(); Editable = editable; }
public void Register(EventEnum eventEnum, Func <object[], Task> action, int sortIndex = 0) { List <EventItem> list; if (!dic.TryGetValue(eventEnum, out list)) { list = new List <EventItem>(); dic.Add(eventEnum, list); } for (int i = 0; i < list.Count; i++) { if (list[i].sortIndex >= sortIndex) { list.Insert(i, new EventItem() { action = action, sortIndex = sortIndex, }); return; } } list.Add(new EventItem() { action = action, sortIndex = sortIndex, }); }
/// <summary> /// 移除事件监听者 /// </summary> /// <param name="type">监听类型</param> /// <param name="listenerEvent">监听回调</param> public void RemoveListener(EventEnum type, Action <EventEnum, object[]> listenerEvent) { if (eventListeners.ContainsKey(type)) { eventListeners[type] -= listenerEvent; } }
public static void RaiseEvent(EventEnum eventType) { if (eventDictionary.ContainsKey(eventType) && eventDictionary[eventType] != null) { eventDictionary[eventType].Invoke(); } }
public EconQuestXml([JsonProperty(PropertyName = "name", Required = Required.Always)] string name, [JsonProperty(PropertyName = "questid", Required = Required.Always)] int questId, [JsonProperty(PropertyName = "icon", Required = Required.Always)] string icon, [JsonProperty(PropertyName = "icontexturecoords", Required = Required.Always)] string iconTextureCoords, [JsonProperty(PropertyName = "rollovertextid", Required = Required.Always)] int rollOverTextId, [JsonProperty(PropertyName = "displaynameid", Required = Required.Always)] int displayNameId, [JsonProperty(PropertyName = "typeid", Required = Required.Always)] int typeId, [JsonProperty(PropertyName = "itemlevel", Required = Required.Always)] int itemLevel, [JsonConverter(typeof(StringEnumConverter))] [JsonProperty(PropertyName = "offertype", Required = Required.Always)] EOfferTypeEnum offerType, [JsonConverter(typeof(StringEnumConverter))] [JsonProperty(PropertyName = "rarity", Required = Required.Always)] CRarityEnum rarity, [JsonProperty(PropertyName = "summary", Required = Required.Always)] EconQuestXmlSummary summary, [JsonConverter(typeof(StringEnumConverter))] [JsonProperty(PropertyName = "alliance", DefaultValueHandling = DefaultValueHandling.Ignore)] EAllianceEnum alliance, [JsonConverter(typeof(StringEnumConverter))] [JsonProperty(PropertyName = "event", DefaultValueHandling = DefaultValueHandling.Ignore)] EventEnum @event) { Name = name; QuestId = questId; Icon = icon; IconTextureCoords = iconTextureCoords; RollOverTextId = rollOverTextId; DisplayNameId = displayNameId; TypeId = typeId; ItemLevel = itemLevel; OfferType = offerType; Rarity = rarity; Summary = summary; Alliance = alliance; Event = @event; }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.GameEngineAssaultEventFlags = ((Flags)(binaryReader.ReadInt16())); this.fieldpad = binaryReader.ReadBytes(2); this.Event = ((EventEnum)(binaryReader.ReadInt16())); this.Audience = ((AudienceEnum)(binaryReader.ReadInt16())); this.fieldpad0 = binaryReader.ReadBytes(2); this.fieldpad1 = binaryReader.ReadBytes(2); this.DisplayString = binaryReader.ReadStringID(); this.RequiredField = ((RequiredFieldEnum)(binaryReader.ReadInt16())); this.ExcludedAudience = ((ExcludedAudienceEnum)(binaryReader.ReadInt16())); this.PrimaryString = binaryReader.ReadStringID(); this.PrimaryStringDuration = binaryReader.ReadInt32(); this.PluralDisplayString = binaryReader.ReadStringID(); this.fieldpad2 = binaryReader.ReadBytes(28); this.SoundDelay = binaryReader.ReadSingle(); this.GameEngineAssaultEventSoundFlags = ((SoundFlags)(binaryReader.ReadInt16())); this.fieldpad3 = binaryReader.ReadBytes(2); this.Sound = binaryReader.ReadTagReference(); pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.ExtraSounds.ReadFields(binaryReader))); this.fieldpad4 = binaryReader.ReadBytes(4); this.fieldpad5 = binaryReader.ReadBytes(16); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(80)); return(pointerQueue); }
public void UnRegisterEvent(EventEnum eventEnum, EventObserver observer) { if (!events.ContainsKey(eventEnum)) { return; } List <EventObserver> list = events[eventEnum]; bool find = false; foreach (EventObserver obj in events[eventEnum]) { if (obj == observer) { find = true; break; } } if (find) { list.Remove(observer); } else { Debug.Log("no Add"); } }
public void RaiseEvent(EventEnum typeEvent, Board board) { foreach (Card card in Events[Enum.GetName(typeof(EventEnum), typeEvent)]) { card.ExecuteActions(typeEvent, board); } }
public void HandleEvent(EventEnum eventTriggered) { if (GuiController == null)// game unload { return; } switch (eventTriggered) { case (EventEnum.MattFollowJoJo): MattFollowJoJo(); break; case (EventEnum.ExitLounge): ExitLounge(); break; case (EventEnum.DemonKilled): DemonKilled(); break; case (EventEnum.EnterBedroom): EnterBedroom(); break; case (EventEnum.NearJarTrigger): JoJoNearJar(); break; default: return; } }
public void dispatchEvent <T, W, X, Y, Z>(EventEnum eventName, T t, W w, X x, Y y, Z z) { checkDispatchEvent(eventName); CallBack <T, W, X, Y, Z> callBack = (CallBack <T, W, X, Y, Z>)_events[eventName]; callBack(t, w, x, y, z); }
/// <summary> /// 添加事件 /// </summary> /// <param name="type">事件类型</param> /// <param name="listenerFunc">监听函数</param> public static void addEventListener(EventEnum type, EventHandleDelegate listener) { //if (type == EventEnum.RefreshBossTip) return; try { if (listener == null) { return; } Delegate func; if (delegates.TryGetValue(type, out func)) { func = Delegate.Remove(func, listener);//去除重复 func = Delegate.Combine(func, listener); } else { func = listener; } delegates[type] = func; } catch (Exception e) { Debug.LogError("addEventListener error " + e + " " + type); } }
public EconLootRollXml([JsonProperty(PropertyName = "name", Required = Required.Always)] string name, [JsonProperty(PropertyName = "icon", Required = Required.Always)] string icon, [JsonProperty(PropertyName = "rollovertextid", Required = Required.Always)] int rollOverTextId, [JsonProperty(PropertyName = "displaynameid", Required = Required.Always)] int displayNameId, [JsonProperty(PropertyName = "itemlevel", Required = Required.Always)] int itemLevel, [JsonConverter(typeof(StringEnumConverter))] [JsonProperty(PropertyName = "rarity", Required = Required.Always)] CRarityEnum rarity, [JsonConverter(typeof(StringEnumConverter))] [JsonProperty(PropertyName = "loottable", Required = Required.Always)] LootTableEnum lootTable, [JsonConverter(typeof(StringEnumConverter))] [JsonProperty(PropertyName = "alliance", DefaultValueHandling = DefaultValueHandling.Ignore)] EAllianceEnum alliance, [JsonConverter(typeof(StringEnumConverter))] [JsonProperty(PropertyName = "event", DefaultValueHandling = DefaultValueHandling.Ignore)] EventEnum @event) { Name = name; Icon = icon; RollOverTextId = rollOverTextId; DisplayNameId = displayNameId; ItemLevel = itemLevel; Rarity = rarity; LootTable = lootTable; Alliance = alliance; Event = @event; }
//remove an event public static void RemoveListener(EventEnum eventType, MyDelegate func) { if (allEvents.ContainsKey(eventType) && allEvents[eventType] != null) //remove a listener, if the event doesnt exist you cant remove it. { allEvents[eventType] -= func; } }
public void dispatchEvent <T, W, X>(EventEnum eventName, T t, W w, X x) { checkDispatchEvent(eventName); CallBack <T, W, X> callBack = (CallBack <T, W, X>)_events[eventName]; callBack(t, w, x); }
public static void RemoveListener(EventEnum type, System.Action <T> function) { if (eventDictionary.ContainsKey(type) && eventDictionary[type] != null) { eventDictionary[type] -= function; } }
public void dispatchEvent <T, W>(EventEnum eventName, T t, W w) { checkDispatchEvent(eventName); CallBack <T, W> callBack = (CallBack <T, W>)_events[eventName]; callBack(t, w); }
private void Initialization( double startOfSimulationTime, double endOfSimulationTime, int numberOfServers, double arrivalTimeMean, double arrivalTimeStdDev, double departureTimeMean, double departureTimeStdDev) { //Set the start of simultion time clock = startOfSimulationTime; //Set the end of simulation time endTime = endOfSimulationTime; //Set next arrival as next event nextEvent = EventEnum.Arrival; //Generate first events eventList[(int)nextEvent] = new Arrival(arrivalTimeMean, arrivalTimeStdDev, clock); eventList[(int)EventEnum.Departure] = new Departure(departureTimeMean, departureTimeStdDev); //Advance clock of simulation to first event if (eventList[(int)nextEvent] is Arrival a) { clock += a.Time; } //Create servers servers = new Server[numberOfServers].Select(s => new Server()).ToArray(); }
public void dispatchEvent <T>(EventEnum eventName, T t) { checkDispatchEvent(eventName); CallBack <T> callBack = (CallBack <T>)_events[eventName]; callBack(t); }
public void dispatchEvent(EventEnum eventName) { checkDispatchEvent(eventName); CallBack callBack = (CallBack)_events[eventName]; callBack(); }
private async Task <IEnumerable <Assertion> > BuildWorldState(EventEnum onEvent, SessionEventArgs e) { var state = new List <Assertion>(); state.Add(new Assertion { Part = PartEnum.Url, Op = OpEnum.Equals, Value = e.WebSession.Request.RequestUri.ToString() }); state.Add(new Assertion { Part = PartEnum.Headers, Op = OpEnum.Equals, Value = (onEvent == EventEnum.request) ? e.WebSession.Request.HeaderText : e.WebSession.Response.HeaderText }); state.Add(new Assertion { Part = PartEnum.StatusCode, Op = OpEnum.Equals, Value = (onEvent == EventEnum.request) ? null : e.WebSession.Response.StatusCode.ToString() }); state.Add(await GetBodyAsAssertion(onEvent, e)); return(state); }
//Call all the events with the event key public static void RaiseEvent(EventEnum eventType) { if (allEvents.ContainsKey(eventType) && allEvents[eventType] != null) { allEvents[eventType].Invoke(); } }
/// <summary> /// Initializes a new instance of the <see cref="AccountEvent" /> class. /// </summary> /// <param name="_event">The event. >Permitted values: `InactivateAccount`, `RefundNotPaidOutTransfers`. For more information, refer to [Verification checks](https://docs.adyen.com/marketpay/onboarding-and-verification/verification-checks). (required).</param> /// <param name="executionDate">The date on which the event will take place. (required).</param> /// <param name="reason">The reason why this event has been created. (required).</param> public AccountEvent(EventEnum _event = default(EventEnum), DateTime? executionDate = default(DateTime?), string reason = default(string)) { // to ensure "_event" is required (not null) if (_event == null) { throw new InvalidDataException("_event is a required property for AccountEvent and cannot be null"); } else { this.Event = _event; } // to ensure "executionDate" is required (not null) if (executionDate == null) { throw new InvalidDataException("executionDate is a required property for AccountEvent and cannot be null"); } else { this.ExecutionDate = executionDate; } // to ensure "reason" is required (not null) if (reason == null) { throw new InvalidDataException("reason is a required property for AccountEvent and cannot be null"); } else { this.Reason = reason; } }
public async Task Call(EventEnum eventEnum, int seat, params object[] args) { //Log.Debug($"触发了{eventEnum}事件"); if (dic.TryGetValue(eventEnum, out List <EventItem> value)) { List <EventItem> itemList = new List <EventItem>(value);//对注册的回调进行排序 itemList.Sort((x, y) => { int xindex = getDistance(seat, x.Seat); int yindex = getDistance(seat, y.Seat); if (x.Seat - y.Seat == 0) { return(x.sortIndex - y.sortIndex); } else { return(xindex - yindex); } }); eventStack.Push(eventEnum); while (itemList.Count > 0) { //取出所有和第一个事件同一座次和排序的事件 EventItem next = itemList[0]; List <EventItem> nextLists = new List <EventItem>(); while (itemList.Count > 0 && itemList[0].Seat == next.Seat && itemList[0].sortIndex == next.sortIndex)//每一次都执行同一个座次和同一个优先级的事件 { nextLists.Add(itemList[0]); itemList.RemoveAt(0); } await game.whenAll(nextLists.Select(item => item.action(args))); //if (seat >= 0 && seat < game.Players.Count) //{ // while (nextLists.Count > 1) // { // //说明同一玩家在此处注册了多个事件 // PlayerAction.TakeChoiceResponse response = (PlayerAction.TakeChoiceResponse)await game.WaitAnswer(new PlayerAction.TakeChoiceRequest() // { // Infos = nextLists.Select(x => x.name).ToList(), // PlayerId = game.Players[next.Seat].Id, // }.SetTimeOut(game.RequestTime)); // await nextLists[response.Index].action(param); // nextLists.RemoveAt(response.Index); // } // await nextLists[0].action(param); //} //else //{ // //并非玩家注册的,直接按顺序执行 // foreach (var eventItem in items) // { // await eventItem.action(param); // } //} }//按照顺序进行结算 eventStack.Pop(); } }
public static void AddListener(EventEnum type, System.Action <T> function) { if (!eventDictionary.ContainsKey(type)) { eventDictionary.Add(type, null); } eventDictionary[type] += function; }
//Add an event. public static void SubscribeToEvent(EventEnum eventType, MyDelegate func) { if (!allEvents.ContainsKey(eventType)) //if the event type doesnt exist yet, add it. { allEvents.Add(eventType, null); } allEvents[eventType] += func; }
public void ExecuteActions(EventEnum typeEvent, Board board) { foreach (CardAction cardAction in CardActions) { if(cardAction.TypeEvent == typeEvent) { cardAction.Execute(board); } } }
public bool Execute(EventEnum eventEnum) { Func<bool> action = null; switch (eventEnum) { case EventEnum.Arena: action = new Func<bool>(this.ArenaAction); break; case EventEnum.Boss: action = new Func<bool>(this.BossAction); break; case EventEnum.QuestAction: action = new Func<bool>(this.QuestAction); break; case EventEnum.LoginToGame: action = new Func<bool>(this.LoginToGameAction); break; case EventEnum.GuildBoss: action = new Func<bool>(this.GuildBossAction); break; case EventEnum.CityEvent: action = new Func<bool>(this.CityEvent); break; case EventEnum.GetMails: action = new Func<bool>(this.GetMailsAction); break; case EventEnum.EnhanceCard: action = new Func<bool>(this.EnhanceCardAction); break; case EventEnum.SellCards: action = new Func<bool>(this.SellCardsAction); break; case EventEnum.SellAllPoorCards: action = new Func<bool>(this.SellAllPoorCards); break; } bool result = false; if (action != null) { try { result = this.ExecuteAction(action); } catch (Exception e) { this.logger.Add(e.Message, LogType.Information); } } else { this.logger.Add("Event is not selected", LogType.Information); } return result; }
public Requestor(ILogger logger, IUser user, long timerInterval, EventEnum eventEnum, bool backupUsers = false) { this.initialEvent = eventEnum; this.logger = logger; this.user = user; this.timer = new Timer((double)timerInterval); this.timer.Elapsed += new ElapsedEventHandler(this.TimerOnElapsed); if (backupUsers) { this.SerializeUsersData(); } }