private void ContextSelected(ContextMenuButton sender) { if ((string) sender.UserData == "examine") { var newExamine = new ExamineWindow(new Size(300, 200), _owningEntity, _resourceManager); _userInterfaceManager.AddComponent(newExamine); newExamine.Position = new Point(ClientArea.X, ClientArea.Y); } else if ((string) sender.UserData == "svars") { var newSVars = new SVarEditWindow(new Size(350, 400), _owningEntity); _userInterfaceManager.AddComponent(newSVars); newSVars.Position = new Point(ClientArea.X, ClientArea.Y); _owningEntity.GetComponent<ISVarsComponent>(ComponentFamily.SVars).GetSVarsCallback += newSVars.GetSVarsCallback; _owningEntity.GetComponent<ISVarsComponent>(ComponentFamily.SVars).DoGetSVars(); } else _owningEntity.SendMessage(this, ComponentMessageType.ContextMessage, (string) sender.UserData); }
private void ContextSelected(ContextMenuButton sender) { if ((string)sender.UserData == "examine") { var newExamine = new ExamineWindow(new Size(300, 200), _owningEntity, _resourceManager); _userInterfaceManager.AddComponent(newExamine); newExamine.Position = new Point(ClientArea.X, ClientArea.Y); } else if ((string)sender.UserData == "svars") { var newSVars = new SVarEditWindow(new Size(350, 400), _owningEntity); _userInterfaceManager.AddComponent(newSVars); newSVars.Position = new Point(ClientArea.X, ClientArea.Y); _owningEntity.GetComponent <ISVarsComponent>(ComponentFamily.SVars).GetSVarsCallback += newSVars.GetSVarsCallback; _owningEntity.GetComponent <ISVarsComponent>(ComponentFamily.SVars).DoGetSVars(); } else { _owningEntity.SendMessage(this, ComponentMessageType.ContextMessage, (string)sender.UserData); } }