Beispiel #1
0
        // Private because this should be used only through the static methods.
        private MyGuiScreenHighlight(MyHighlightControl[] controlsData)
            : base(Vector2.Zero, size: Vector2.One * 2.5f)
        {
            m_highlightedControlsData = controlsData;
            m_highlightedControls     = new MyGuiControls(this);

            foreach (var controlData in m_highlightedControlsData)
            {
                if (controlData.CustomToolTips != null)
                {
                    controlData.CustomToolTips.Highlight      = true;
                    controlData.CustomToolTips.HighlightColor = controlData.Color ?? Color.Yellow;
                }

                m_highlightedControls.AddWeak(controlData.Control);
            }

            m_backgroundColor     = Color.Black;
            m_backgroundFadeColor = Color.Black;
            CanBeHidden           = false;
            CanHaveFocus          = true;
            m_canShareInput       = false;
            CanHideOthers         = false;
            EnabledBackgroundFade = true;
            DrawMouseCursor       = true;
            CloseButtonEnabled    = false;
        }
 //public void RemoveEditorControlsFromList(ref List<MyGuiControlBase> removeFromControlsList)
 public void RemoveEditorControlsFromList(MyGuiControls removeFromControlsList)
 {
     if (removeFromControlsList != null)
     {
         foreach (MyGuiControlBase control in m_editorControls)
         {
             removeFromControlsList.Remove(control);
         }
     }
 }
 //public void AddEditorControlsToList(ref List<MyGuiControlBase> addToControlsList)
 public void AddEditorControlsToList(MyGuiControls addToControlsList)
 {
     if (addToControlsList != null)
     {
         foreach (MyGuiControlBase control in m_editorControls)
         {
             addToControlsList.Add(control);
         }
     }
 }
 public MyGuiControlParent(
     Vector2? position = null,
     Vector2? size = null,
     Vector4? backgroundColor = null,
     String toolTip = null)
     : base( position: position,
             size: size,
             colorMask: backgroundColor,
             toolTip: toolTip,
             isActiveControl: true,
             canHaveFocus: true)
 {
     m_controls = new MyGuiControls(this);
 }
 private void OnVisibleControlsChanged(MyGuiControls sender)
 {
     Recalculate();
 }
 public MyGuiControlScrollablePanel(MyGuiControlBase scrolledControl)
 {
     Name = "ScrollablePanel";
     ScrolledControl = scrolledControl;
     m_controls = new MyGuiControls(this);
     m_controls.Add(ScrolledControl);
 }
        public MyGuiControlTable():
            base(canHaveFocus: true)
        {
            m_scrollBar = new MyVScrollbar(this);
            m_scrollBar.ValueChanged += verticalScrollBar_ValueChanged;
            m_rows = new List<Row>();
            m_columnsMetaData = new List<ColumnMetaData>();
            VisualStyle = MyGuiControlTableStyleEnum.Default;

            m_controls = new MyGuiControls(null);

            base.Name = "Table";
        }
        protected MyGuiScreenBase(
            Vector2? position = null,
            Vector4? backgroundColor = null,
            Vector2? size = null,
            bool isTopMostScreen = false,
            string backgroundTexture = null, 
            float backgroundTransition = 0.0f,
            float guiTransition = 0.0f)
        {
            m_controls = new MyGuiControls(this);
            m_backgroundFadeColor = Color.White;
            m_backgroundColor = backgroundColor;
            m_size = size;
            m_isTopMostScreen = isTopMostScreen;
            m_allowUnhidePreviousScreen = true;

            State = MyGuiScreenState.OPENING;
            m_lastTransitionTime = MyGuiManager.TotalTimeInMilliseconds;
            m_position = position ?? new Vector2(0.5f, 0.5f);

            m_backgroundTexture = backgroundTexture;

            Elements = new MyGuiControls(this);
            m_backgroundTransition = backgroundTransition;
            m_guiTransition = guiTransition;
            CreateCloseButton();
            SetDefaultCloseButtonOffset();
        }
 public static MyGuiControlButton ButtonByText(this MyGuiControls group, MyStringId stringId)
 {
     return(group.GetInstanceFieldOrThrow <List <MyGuiControlBase> >("m_visibleControls").OfType <MyGuiControlButton>()
            .First(x => x.Text == MyTexts.Get(stringId).ToString()));
 }