public Event CreateEvent(Event.Type _action, BookCondition _bookCondition, Client _client) { Event newEvent = new Event(_action, _bookCondition, _client); repository.AddEvent(newEvent); return(newEvent); }
public void Execute(Event.Type type, int id, Event e) { switch (type) { case Event.Type.LightOff: global.intensity = 0.03f; break; case Event.Type.CheckDoor: StartCoroutine(ShowMessage("这扇门被锁住了。")); break; case Event.Type.Fire: StartCoroutine(Fire(e, id, 1f)); break; case Event.Type.CloseDoor: break; case Event.Type.HuaRongDao: break; case Event.Type.Puzzle: break; case Event.Type.NPC_Move: break; case Event.Type.PlayerDefeat: break; } }
public bool Event(Client c, Event.Type type, int ex) { Event p = new Event(c, type, ex); lock (syncLock) { m_stateEventList.AddLast(p); } return(true); }
bool ProcessEventUsingRegex(string content) { // optimization to avoid json parsing if possible string id; string username; string profile_image_url; string color; string message; Event.Type type = EvaluateRegex( content, out id, out username, out profile_image_url, out color, out message); if (type != Event.Type.Unknown) { var userHash = UserHasher.Instance.ComputeUserHash(id); CacheOrUpdateUser(userHash, null, id, username, profile_image_url); switch (type) { case Event.Type.Heart: numHeartsProcessed++; foreach (EventsProcessor processor in this.eventProcessors) { processor.OnPeriscopeHeartEvent(userCache[userHash], color); } break; case Event.Type.Chat: numChatsProcessed++; foreach (EventsProcessor processor in this.eventProcessors) { processor.OnPeriscopeChatEvent(userCache[userHash], color, message); } break; case Event.Type.Join: numChatsProcessed++; foreach (EventsProcessor processor in this.eventProcessors) { processor.OnPeriscopeJoinEvent(userCache[userHash], color); } break; } return(true); } return(false); }
public async Task EventStart(Event.Type ev, params string[] options) { var(opts, _) = OptionsParser.Default.ParseFrom(new EventOptions(), options); if (!await _service.TryCreateEventAsync(Context.Guild.Id, Context.Channel.Id, ev, opts, GetEmbed )) { await ReplyErrorLocalized("start_event_fail").ConfigureAwait(false); return; } }
private EmbedBuilder GetEmbed(Event.Type type, EventOptions opts, long currentPot) { switch (type) { case Event.Type.Reaction: return(new EmbedBuilder() .WithOkColor() .WithTitle(GetText("reaction_title")) .WithDescription(GetDescription(opts.Amount, currentPot)) .WithFooter(GetText("new_reaction_footer", opts.Hours))); default: break; } throw new ArgumentOutOfRangeException(nameof(type)); }
public async Task <bool> TryCreateEventAsync(ulong guildId, ulong channelId, Event.Type type, EventOptions opts, Func <Event.Type, EventOptions, long, EmbedBuilder> embed) { SocketGuild g = _client.GetGuild(guildId); SocketTextChannel ch = g?.GetChannel(channelId) as SocketTextChannel; if (ch == null) { return(false); } ICurrencyEvent ce; if (type == Event.Type.Reaction) { ce = new ReactionEvent(_client, _cs, _bc, g, ch, opts, embed); } //else if (type == Event.Type.NotRaid) //{ // ce = new NotRaidEvent(_client, _cs, _bc, g, ch, opts, embed); //} else { return(false); } var added = _events.TryAdd(guildId, ce); if (added) { try { ce.OnEnded += OnEventEnded; await ce.Start(); } catch (Exception ex) { _log.Warn(ex); _events.TryRemove(guildId, out ce); return(false); } } return(added); }
public override bool ProcessEvent(Client c, Event.Type p, int error) { return(pprocess.ProcessEvent(c, p, error)); }
public void RemoveEvent(Event.Type type) { _events.Remove(type); }
public void AddEvent(Event.Type type) { _events.Add(type, new Event()); }
public Event GetEvent(Event.Type type) { return(_events[type]); }
public virtual bool ProcessEvent(Client c, Event.Type p, int error) { return(true); }