public static void Event(eventType type, string message) { switch (type) { case eventType.Information: logger.Info(message); break; case eventType.Warning: logger.Warn(message); break; case eventType.Debug: logger.Debug(message); break; case eventType.Fatal: logger.Fatal(message); break; default: logger.Error(message); break; } }
public GameObject GetEvent(eventType eventType) { switch (eventType) { case eventType.StartGame: return startGameEvent; case eventType.ShipDeath: return shipDeathEvent; case eventType.EnemyDeath: return enemyDeathEvent; case eventType.Escape: return escapeEvent; case eventType.Shop: return shopEvent; case eventType.Standard: int rdm = Random.Range(100, 101); return GetEvent(rdm); case eventType.Quest: return null; case eventType.Encounter: return null; default: return null; } }
public List <VotingBonus> GetSavedVotingBonuses() { string jsonString = PlayerPrefs.GetString("VotingBonusSavedString" + PlayerPrefs.GetInt("PlayerId"), ""); var votingBonuses = new List <VotingBonus> (); if (jsonString != "") { var json = JSON.Parse(jsonString); var count = json.Count; for (int i = 0; i < count; i++) { int id = int.Parse(json [i] ["Id"].ToString().Trim("\"".ToCharArray())); int type = int.Parse(json [i] ["EventType"].ToString().Trim("\"".ToCharArray())); eventType typeinEnum = (eventType)type; string EndTimeString = json [i] ["Endtime"].ToString().Trim("\"".ToCharArray()); var temp = Convert.ToInt64(EndTimeString); VotingBonus Vb = new VotingBonus(); Vb.Id = id; Vb.Type = typeinEnum; Vb.DestroyTime = DateTime.FromBinary(temp); votingBonuses.Add(Vb); } } return(votingBonuses); }
public GameObject GetEvent(eventType eventType) { switch (eventType) { case eventType.StartGame: return(startGameEvent); case eventType.ShipDeath: return(shipDeathEvent); case eventType.EnemyDeath: return(enemyDeathEvent); case eventType.Escape: return(escapeEvent); case eventType.Shop: return(shopEvent); case eventType.Standard: int rdm = Random.Range(100, 101); return(GetEvent(rdm)); case eventType.Quest: return(null); case eventType.Encounter: return(null); default: return(null); } }
//Events ändern zur Laufzeit ihren EventType. // Bsp: Betti will Eric etwas schreiben. //1) der TCP Listener erkennt eine eingehende Nachricht, er will nicht wissen was es ist, nur das es da ist. // Er erstellt über den EventManager ein IncomingTCPMessage Event und übergibt ihm dabei die TCP-Nachricht. //2) Main ruft zyklisch den EventManager.Run() auf, dieser Ruft Event.Run() und damit kommen wir hier her. // Das Switch case findet heraus was für ein Event ansteht - in diesem Fall eine neue TCP Nachricht. // In dieser Nachricht könnte alles mögliche drinn stehen, ein Login Versuch eines neuen Nutzers, // Ein Broadcast, ein Kommando (bsp Für Serverneustart)... oder eine Private Nachricht wie in diesem Fall. // Um herauszufinden wie mit der Nachricht umgegangen werden muss muss die Nachricht ANALysiert werden. // Dazu wird TCPParser() aufgerufen. //3) TCPParser zerlegt die Nachricht in seine Bestandteile. Er merkt dass es eine Private Nachricht ist welche // Von Betti kommt und zu Eric soll. Er ändert den EventTyp zu PrivateMessage. //4) Event.Run() wird erneut durch den EventManager aufgerufen da EventFinished noch nicht true ist. // Das Switch Case erkennt den EventTyp PrivateMessage und ruft den UserManager auf, gibt ihm einen String // mit der Nachricht die gesendet werden soll, und Eric als Ziel an. Anschließend sendet der UserManager die Nachricht. // Tritt hierbei kein Fehler auf wird // das Event anschließend mit EventFinished = true als abgeschlossen markiert. //5) Der EventManager erkennt dass EventFinished = true abgeschlossen ist und löscht das Event aus der Liste. public bool Run() { //HERE BE DRAGONS switch (EventType) { //Das Event kam vom TCP Manager. Es muss gelesen werden um zu verstehen wie wir darauf reagieren müssen. //Der Parser ändert anschließend den EventTyp und schreibt die Nutzdaten in einen Separaten String "Payload". case eventType.IncomingTCPMessage: TCPParser(); break; //Try - Catch Blöcke lösen in Catch{} diesen EventTyp aus case eventType.DebugMessage: //Das Event wird als Debuginfo ausgegeben und damit abgeschlossen. //Der Clou an den meistens uninteressanten DebugInfos ist dass ich sie später per Knopfdruck ausblendbar machen will PrintDebugMessageAsync("INFO: " + EventContent); EventFinished = true; break; case eventType.Error: //Das Event wird als Fehlermeldung ausgegeben und damit abgeschlossen. PrintDebugMessageAsync("ERROR: " + EventContent); EventFinished = true; break; //Ein unbekanntes Event! Wie konnte das nur passieren!? default: EventType = eventType.Error; EventContent = "Unbekanntest Event aufgetreten! Sollte niemals passieren..." + EventContent; break; } return(EventFinished); }
public Event(string s, SNSAlarm myAlarm, SNS_Alarm_Action myAlarmAction, SNS_Action mySNSAction) { eventDateTime = DateTime.Now.ToString("F"); source = s; message = myAlarm.Message; //determine if alarm was turned into an action if (mySNSAction.cName == className.NONE) { exceptionNFO = true; } //figure out event type if (mySNSAction.cName == className.EMAIL) { eveType = eventType.INFO; } else if (mySNSAction.cName == className.RAISE_SCOM_ALERT) { eveType = eventType.WARNING; } else { eveType = eventType.ERROR; } }
public Event(eventType incomingType, string input, MainPage link) { EventType = incomingType; EventContent = input; EventFinished = false; MainPage = link; }
private static string decideOnTitle(string goalName, eventType eventTakenPlace) { string titleToUse = "YEAH"; if (eventTakenPlace == eventType.DeletedGoal) { titleToUse = $"Gave up on {goalName}"; } if (eventTakenPlace == eventType.CompletedGoal) { titleToUse = "Goal Completed!"; } if (eventTakenPlace == eventType.NegativeUpdate || eventTakenPlace == eventType.PositiveUpdate) { titleToUse = "Updated Progress"; } if (eventTakenPlace == eventType.NewGoal) { titleToUse = "Created a New Goal!"; } return(titleToUse); }
/// <summary> /// Toggles a specific event on or off. /// </summary> /// <param name="e">The command event which was executed.</param> /// <returns>A message in the channel that the events have been changed. /// In case of a failed input, returns an error message that the command was wrongly used.</returns> private async Task ToggleSpecificEvent(CommandEventArgs e) { try { string[] input = Utils.ReturnInputParameterStringArray(e); string firstParameter = input[0]; string secondParameter = input[1]; //Meaning that there are more given parameters than necessary. if (input.Length >= 3) { throw new UnusedParametersException("Too many parameters were given."); } else if (input.Length <= 1) { throw new UnusedParametersException("Too few parameters were given."); } eventType eventtype = eventType.none; if (e.Command.Text.Contains("user")) { eventtype = eventType.user; Properties.Default.userEvents = !Properties.Default.userEvents; } else if (e.Command.Text.Contains("channel")) { eventtype = eventType.channel; Properties.Default.channelEvents = !Properties.Default.channelEvents; } else if (e.Command.Text.Contains("role")) { eventtype = eventType.role; Properties.Default.roleEvents = !Properties.Default.roleEvents; } Properties.Default.eventsChannel = firstParameter; Properties.Default.welcomeChannel = secondParameter; if (eventtype != eventType.none) { await e.Channel.SendMessage(ToggleEvents(eventtype)); } else { throw new UnknownEventException("Event not found."); } } catch (Exception ex) when(ex is UnusedParametersException || ex is IndexOutOfRangeException) { Console.WriteLine(String.Format("Toggle Events - {0}", ex.Message)); await Utils.InproperCommandUsageMessage(e, "toggle<EVENT>", "!toggle<EVENT> <CHANNELNAME> <CHANNELNAME>"); } catch (Exception uee) { Console.WriteLine(String.Format("Toggle Events - {0}", uee.Message)); await e.Channel.SendMessage("Something went wrong that shouldn't have went wrong..."); } }
public Event(string s, string m, bool except, eventType eveTy) { source = s; message = m; eventDateTime = DateTime.Now.ToString("F"); exceptionNFO = except; eveType = eveTy; }
public GameEvent(Kingdom a, int aID, Kingdom b, int bID, eventType e) { initiator = a; initiatorArmyID = aID; target = b; targetID = bID; type = e; }
public Event(DateTime startOfEvent, DateTime endOfEvent, string eventTitile, string eventDescription, eventType eventType) { this.startOfEvent = startOfEvent; this.endOfEvent = endOfEvent; this.eventTitile = eventTitile; this.eventDescription = eventDescription; this.eventType = eventType; }
private void TCPParser() { // die nachricht auf kommandozeichen und inhalte prüfen und separat abspeichern // die Eventklasse wird sich danach von TCPNachricht auf eine neue Klasse ändern //TCP String noch nicht definiert! Solang machen wir einfach aus allem DebugEvents. EventType = eventType.DebugMessage; }
public Event(Blaster[] targets, float time, eventType type) { this.targets = targets; this.time = time; this.type = type; lookDir = Vector3.zero; printMsg = ""; newColor = 0; newGobo = 0; }
// Use this for initialization void Start() { L = Left.GetComponent <Rigidbody2D>(); R = Right.GetComponent <Rigidbody2D>(); Event = eventType.AtoB; EventFlag = false; Gate_a.SetActive(false); Gate_b.SetActive(true); Gate_c.SetActive(true); }
/// <summary> /// Toggles events being sent to certains channels or not. /// </summary> /// <param name="eventType">The type of the events.</param> /// <param name="welcomeChannel">The channel where welcome messages should be posted.</param> /// <param name="eventsChannel">Channel where the rest should be posted.</param> private string ToggleEvents(eventType eventType) { switch (eventType) { case eventType.user: #region Messages when user joins, gets banned/unbanned or leaves. if (Properties.Default.userEvents) { client.UserJoined += OnUserJoined; client.UserBanned += OnUserBanned; client.UserUnbanned += OnUserUnbanned; client.UserLeft += OnUserLeft; } else { client.UserJoined -= OnUserJoined; client.UserBanned -= OnUserBanned; client.UserUnbanned -= OnUserUnbanned; client.UserLeft -= OnUserLeft; } #endregion return(Properties.Default.userEvents ? "User events have now been turned on." : "User events have now been turned off."); case eventType.channel: #region Channel creation/destruction if (Properties.Default.channelEvents) { client.ChannelCreated += OnChannelCreated; client.ChannelDestroyed += OnChannelCreated; } else { client.ChannelCreated -= OnChannelCreated; client.ChannelDestroyed -= OnChannelCreated; } #endregion return(Properties.Default.channelEvents ? "Channel events have now been turned on." : "Channel events have now been turned off."); case eventType.role: #region Role creation/destruction if (Properties.Default.roleEvents) { client.RoleCreated += OnRoleCreated; client.RoleDeleted += OnRoleDeleted; } else { client.RoleCreated -= OnRoleCreated; client.RoleDeleted -= OnRoleDeleted; } #endregion return(Properties.Default.roleEvents ? "Role events have now been turned on." : "Role events have now been turned off."); } return("Something went wrong that shouldn't have went wrong..."); }
/// <summary> /// Prompts user using the dialog box. /// Use this method during runtime to invoke the dialog box. /// </summary> /// <param name="loadSaveButtonText">Text of the load / save button</param> /// <param name="cancelButtonText">Text of the cancel button</param> /// <param name="eventIn">Event handler for event raised when user presses the load/save button</param> public void Prompt(string loadSaveButtonText, string cancelButtonText, eventType eventIn) { //change text of load/save button saveButton.text = loadSaveButtonText; cancelButton.text = cancelButtonText; currentEvent = eventIn;//set event //make visible isVisible = true; }
public void addEvent(eventType t) { if (index < 0) { list.Add(new myEvent(t)); } else { list.Insert(index, new myEvent(t)); } }
public Event(double _lat, double _lng, DateTime _oDate, DateTime _ambulDate, eventType _type) { lat = _lat; lng = _lng; occuredDate = _oDate; ambulDate = _ambulDate; droneDate = new DateTime(); type = _type; result = 0; station = null; }
protected TLogDTO CreateFromLog(string userId, string description, eventType eventType = eventType.Info, string DetailLevelKeyword = "", [CallerLineNumber] int lineNumber = 0, [CallerMemberName] string caller = null) { return(new TLogDTO() { Class = caller, Description = description, DetailLevelKeyword = DetailLevelKeyword, eventType = eventType, LineNumber = lineNumber, Timestamp = DateTime.UtcNow, }); }
/// <summary> /// data base transaction implementation /// </summary> /// <param name="a"></param> void Sys_Action(eventType a) { try { //select // System.Diagnostics.Debugger.Launch(); string T_dur = string.Empty; string Time = DateTime.Now.ToString(); int result = -1; int SAPID = 0; DataTable dataTable = new DataTable(); DataSet ds = new DataSet(); OleDbDataAdapter dAdapter = new OleDbDataAdapter("select * from SAP_TIME_RECORD where ID = (select max(ID) from SAP_TIME_RECORD) ", ConnectioString); OleDbCommandBuilder cBuilder = new OleDbCommandBuilder(dAdapter); dAdapter.Fill(dataTable); ds.Tables.Add(dataTable); if (ds.Tables[0].Rows.Count > 0 && string.IsNullOrEmpty(Convert.ToString(ds.Tables[0].Rows[0]["Duration"]))) { StartTime = Convert.ToDateTime(ds.Tables[0].Rows[0]["StartTime"]); SAPID = Convert.ToInt32(ds.Tables[0].Rows[0]["ID"]); TimeSpan Duartion = DateTime.Parse(DateTime.Now.ToString()).Subtract(DateTime.Parse(StartTime.ToString())); bookCon = new OleDbConnection(ConnectioString); bookCon.Open(); DbCommand.Connection = bookCon; DbCommand.CommandText = "update SAP_TIME_RECORD set EndTime = '" + Time + "' , Duration = '" + Duartion.ToString() + "' where ID =" + SAPID; result = DbCommand.ExecuteNonQuery(); bookCon.Dispose(); } if (a != eventType.Shutdown) { bookCon = new OleDbConnection(ConnectioString); bookCon.Open(); DbCommand.Connection = bookCon; DbCommand.CommandText = "insert into SAP_TIME_RECORD (StartTime,To_Date,Event) values ('" + Time + "','" + DateTime.Now.Date.ToString() + "','" + a.ToString() + "')"; result = DbCommand.ExecuteNonQuery(); bookCon.Dispose(); } } catch (Exception e) { bookCon.Dispose(); } }
public Event(double _lat, double _lng, DateTime _oDate, DateTime _ambulDate, eventType _type, Address _addr, double[] _weather, bool[] _b_weather) { lat = _lat; lng = _lng; occuredDate = _oDate; ambulDate = _ambulDate; droneDate = new DateTime(); type = _type; result = 0; station = null; addr = _addr; weather = _weather; b_weather = _b_weather; }
// if no value for variables, use "" or equivalent public MedicalEvent(int eType, string eTitle, int y, int m, int d, GameController.gameState gState, Vector3 location, string note, string drugsAdm, string imgPath) { type = (eventType)eType; title = eTitle; date = new System.DateTime(y, m, d); state = gState; //site = GetSiteVector(place); SetSiteString(); specificLocation = location; notes = note; drugs = drugsAdm; imagePath = imgPath; if (imagePath != null) { imgSprite = Resources.Load <Sprite>(imagePath); } }
public void AddEvent() { int randomIndex = Random.Range(0, 2); eventType newEvent = eventType.eventA; switch (randomIndex) { case 0: newEvent = eventType.eventA; break; case 1: newEvent = eventType.eventB; break; } events.Add(new ProceduralEvent(newEvent, Random.Range(0f, 10f))); }
// Response string from NRA private void addLogData(eventType evnt, string IASUTDIDstring, // IASUTDID string taskLogInfo, // Информация за задачата, която да се запише в LOG-a int responceCode, // ResponceCode from NRA string responceStr) { LogData ld = new LogData(); ld.eventDateTime = DateTime.Now; ld.IasutdID = IASUTDIDstring; ld.ResponseCode = responceCode; ld.ResponseStr = responceStr; ld.evnt = evnt; ld.evntAddInfo = taskLogInfo.Trim(); try { dataGridViewLog.Rows.Add(ld.eventDateTime.ToString("dd.MM.yyyy HH:mm:ss"), ld.IasutdID, ld.evnt.ToString(), ld.evntAddInfo, ld.ResponseCode, ld.ResponseStr); dataGridViewLog.CurrentCell = dataGridViewLog[0, dataGridViewLog.RowCount - 1]; while (dataGridViewLog.RowCount > 100) dataGridViewLog.Rows.RemoveAt(0); } catch { } try { using (StreamWriter sw = File.AppendText("NRA.LOG")) { sw.WriteLine(ld.eventDateTime.ToString("dd.MM.yyyy HH:mm:ss") + ";" + ld.IasutdID + ";" + ld.evnt.ToString() + ";" + ld.evntAddInfo + ";" + ld.ResponseCode.ToString() + ";" + ld.ResponseStr); } } catch { } Application.DoEvents(); }
public void addEvent(eventType type, string text) { lock (objSync) { TreeNode node = default(TreeNode); switch (type) { case eventType.TypeError: node = rootErrors; break; case eventType.TypeConnection: node = rootConnections; break; default: node = rootErrors; break; } text = DateTime.Now.ToString("[HH:mm:ss] ") + text; RoutinesLibrary.UI.TreeViewUtils.AddNode(node, string.Format("yyyyMMdd_HHmmss", DateTime.Now), text); } }
public virtual async Task Log(int parentID, string userId, string description, eventType eventType = eventType.Info, string DetailLevelKeyword = "", [CallerLineNumber] int lineNumber = 0, [CallerMemberName] string caller = null) { TLogDTO dto = this.CreateFromLog(userId, description, eventType, DetailLevelKeyword, lineNumber, caller); await this.repo.Insert(dto, userId); }
public Game_Event(int _eventId, eventType _type, GameObject _eventGO) { eventId = _eventId; type = _type; eventGO = _eventGO; }
public Event(eventType type, Int64 replay, DriverInfo driver, String desc, Sessions.SessionInfo.sessionType session, Int32 lap) { this.type = type; this.timestamp = DateTime.Now; this.replaypos = replay; this.driver = driver; this.description = desc; this.session = session; this.lapnum = lap; this.rewind = 0; }
public static string eventTypeToName(eventType _type) { string t = string.Empty; switch (_type) { case eventType.text: t = "显示文本框文字"; break; case eventType.textSpecial: t = "显示特殊文字"; break; case eventType.beBlack: t = "黑屏"; break; case eventType.beWhite: t = "白屏"; break; case eventType.changeGlobalFloat: t = "浮点变量操作"; break; case eventType.changeGlobalInt: t = "整数变量操作"; break; case eventType.changeGlobalSwith: t = "开关操作"; break; case eventType.changeIndependentSwitch: t = "独立开关操作"; break; case eventType.changeScene: t = "场景移动"; break; case eventType.commonEvent: t = "公共事件"; break; case eventType.debugLog: t = "控制台输出"; break; case eventType.hidePic: t = "隐藏图片"; break; case eventType.movePic: t = "移动图片"; break; case eventType.playBgm: t = "播放BGM"; break; case eventType.playBgs: t = "播放BGS"; break; case eventType.playSE: t = "播放SE"; break; case eventType.showPic: t = "显示图片"; break; case eventType.startUserControl: t = "开启角色控制"; break; case eventType.stopBgm: t = "停止BGM"; break; case eventType.stopBgs: t = "停止BGS"; break; case eventType.stopUserControl: t = "关闭角色控制"; break; case eventType.wait: t = "等待"; break; case eventType.playAnima: t = "播放动画"; break; case eventType.moveCamera: t = "移动相机"; break; case eventType.sbMoveToSw: t = "设置移动路线"; break; case eventType.flashScreen: t = "闪烁屏幕"; break; case eventType.shakeScreen: t = "震动屏幕"; break; case eventType.changeWeather: t = "改变天气"; break; case eventType.showSavePanel: t = "打开存档界面"; break; case eventType.changeItem: t = "增减道具"; break; case eventType.changeThingPos: t = "设置物体位置"; break; case eventType.changeTurn: t = "设置人物朝向"; break; case eventType.changeThingActive: t = "设置物体可见性"; break; case eventType.startQuest: t = "任务开始"; break; case eventType.changeQuest: t = "更改任务状态"; break; case eventType.If: t = "如果"; break; default: t = "错误,未找到"; break; } return(t); }
public myEvent(eventType _type) { type = _type; }
public override async Task Log(int StrategyRuns_ID, string userId, string description, eventType eventType = eventType.Info, string DetailLevelKeyword = "", [CallerLineNumber] int lineNumber = 0, [CallerMemberName] string caller = null) { StrategyLogsDTO dto = this.CreateFromLog(userId, description, eventType, DetailLevelKeyword, lineNumber, caller); dto.StrategyRuns_ID = StrategyRuns_ID; await this.repo.Insert(dto, userId); }
public Event(int streamNo, eventType type) { this.type = type; this.streamNo = streamNo; }
public ProceduralEvent(eventType _type, float _timeActivation) { type = _type; timeActivation = _timeActivation; }