Exemplo n.º 1
0
 private void ContextSelected(ContextMenuButton sender)
 {
     if ((string)sender.UserData == "examine")
     {
         var newExamine = new ExamineWindow(new Vector2i(300, 200), _owningEntity, _resourceCache);
         _userInterfaceManager.AddComponent(newExamine);
         newExamine.Position = new Vector2i(ClientArea.Left, ClientArea.Top);
     }
     else
     {
         _owningEntity.SendMessage(this, ComponentMessageType.ContextMessage, (string)sender.UserData);
     }
 }
Exemplo n.º 2
0
        private void ContextSelected(ContextMenuButton sender)
        {
            if ((string)sender.UserData == "examine")
            {
                var newExamine = new ExamineWindow(new Vector2i(300, 200), _owningEntity, _resourceManager);
                _userInterfaceManager.AddComponent(newExamine);
                newExamine.Position = new Vector2i(ClientArea.Left, ClientArea.Top);
            }
            else if ((string)sender.UserData == "svars")
            {
                var newSVars = new SVarEditWindow(new Vector2i(350, 400), _owningEntity);
                _userInterfaceManager.AddComponent(newSVars);
                newSVars.Position = new Vector2i(ClientArea.Left, ClientArea.Top);

                _owningEntity.GetComponent <ISVarsComponent>(ComponentFamily.SVars).GetSVarsCallback +=
                    newSVars.GetSVarsCallback;
                _owningEntity.GetComponent <ISVarsComponent>(ComponentFamily.SVars).DoGetSVars();
            }
            else
            {
                _owningEntity.SendMessage(this, ComponentMessageType.ContextMessage, (string)sender.UserData);
            }
        }