Exemplo n.º 1
0
        public virtual void OnOkClick(MyGuiControlButton sender)
        {
            if (HasEntity())
            {
                if (m_idTextbox != null)
                {
                    if (m_entity.EntityId != null)
                    {
                        var newId = new MyEntityIdentifier(Convert.ToUInt32(m_idTextbox.Text));

                        if (newId.NumericValue != m_entity.EntityId.Value.NumericValue && !MyEntityIdentifier.ExistsById(newId))
                        {
                            MyEntityIdentifier.RemoveEntity(m_entity.EntityId.Value);
                            m_entity.EntityId = newId;
                            MyEntityIdentifier.AddEntityWithId(m_entity);
                        }
                    }
                }

                if (IsPositionInput())
                {
                    Vector3 position = GetNewPosition();
                    if (IsValidPositionInput(position))
                    {
                        MyEditorGizmo.MoveAndRotateObject(position, m_entity.GetWorldRotation(), m_entity);
                    }
                }
            }
        }
 /// <summary>
 /// Transform entities to starting transformation state
 /// </summary>
 /// <returns></returns>
 public override bool Rollback()
 {
     if (m_containsPrefab)
     {
         MyEditor.Static.EditPrefabContainer(m_activeContainer);
     }
     foreach (MyEditorTransformData transformData in m_startTransformData)
     {
         MyEditorGizmo.MoveAndRotateObject(transformData.GetPosition(), transformData.GetOrientation(), transformData.GetEntity());
     }
     MyEditor.Static.CheckAllCollidingObjects();
     return(true);
 }