/** * The constructor for <ThreadController> * Initialises all objs and threads needed for the <GameApplication> to run */ public ThreadController(Shared.Dispatch dispatch) { gameMessageQueue = dispatch.GetGameQueue(); twitchOutQueue = dispatch.GetTwitchOutQueue(); discordOutQueue = dispatch.GetDiscordOutQueue(); encounters = new List <KeyValuePair <string, Threads.EncounterController> >(); cooldownList = new List <KeyValuePair <string, System.Timers.Timer> >(); active = true; }
//Function: TwitchClient // //The constructor for this class. // //Parameters: //channel - the name of the channel to connect to //trigger - a refrence to the timer shared by all <TwitchClient> objects, triggers the event handler //queue - a refrence to the queue shared by all the <TwitchClient> objects and the <KafkaProducer> //blacklist - the users who ar enot participating and should be ignored public TwitchClientWriter(String channel, Shared.Dispatch dispatch) { Console.WriteLine(channel + " Thread Start"); cycles = 0; this.MessageQueue = dispatch.GetTwitchOutQueue(); this.ErrorQueue = dispatch.GetErrorQueue(); this.channel = channel; messageCooldown = new System.Timers.Timer(2000); messageCooldown.AutoReset = false; Alive = true; messageTemplate = $":{username}!{username}@{username}.tmi.twitch.tv PRIVMSG #{channel} : "; //messageTemplate = $"PRIVMSG #{channel} :"; Console.WriteLine("Channel Thread " + channel + " start"); Connect(); }