Exemplo n.º 1
0
        private MyGuiControlBase(IMyGuiControlsParent parent, Vector2 position, Vector4?backgroundColor, StringBuilder toolTip,
                                 MyTexture2D controlTexture, MyTexture2D hoverTexture, MyTexture2D pressedTexture, bool isActiveControl,
                                 MyTexture2D mouseCursorHoverTexture, MyTexture2D mouseCursorPressedTexture /*,
                                                                                                             * System.Drawing.Bitmap mouseCursorHoverBitmap, System.Drawing.Bitmap mouseCursorPressedBitmap*/)
        {
            Visible           = true;
            Enabled           = true;
            m_parent          = parent;
            m_position        = position;
            m_backgroundColor = backgroundColor;
            //m_toolTip = toolTip;
            if (toolTip != null)
            {
                m_toolTip = new MyToolTips(toolTip);
            }
            m_controlTexture            = controlTexture;
            m_hoverTexture              = hoverTexture;
            m_pressedTexture            = pressedTexture;
            m_isActiveControl           = isActiveControl;
            m_mouseCursorHoverTexture   = mouseCursorHoverTexture;
            m_mouseCursorPressedTexture = mouseCursorPressedTexture;

            /*
             * m_mouseCursorHoverBitmap = mouseCursorHoverBitmap;
             * m_mouseCursorPressedBitmap = mouseCursorPressedBitmap;
             */
        }
 public MyGuiControlListboxItem(int key, MyColoredText coloredText, MyTexture2D icon, MyToolTips toolTip)
 {
     Key = key;
     Icon = icon;
     ColoredText = coloredText;
     ToolTip = toolTip;
     BackgroundColor = Vector4.One;
     Enabled = true;
 }
Exemplo n.º 3
0
 public MyGuiControlListboxItem(int key, MyColoredText coloredText, MyTexture2D icon, MyToolTips toolTip)
 {
     Key             = key;
     Icon            = icon;
     ColoredText     = coloredText;
     ToolTip         = toolTip;
     BackgroundColor = Vector4.One;
     Enabled         = true;
 }
Exemplo n.º 4
0
 public MyGuiControlComboboxItem(int key, MyTexture2D icon, StringBuilder value, int sortOrder)
 {
     Key = key;
     Icon = icon;
     Value = value;
     SortOrder = sortOrder;
     if (value != null)
     {
         ToolTip = new MyToolTips(value);
     }                
 }
        public MyGuiControlListboxItem(int key, StringBuilder value, MyTexture2D icon, MyToolTips tooltip, float scale)
        {
            Key = key;
            Icon = icon;
            ToolTip = tooltip;

            if (value != null)
            {
                ColoredText = new MyColoredText(value, new Color(MyGuiConstants.LISTBOX_TEXT_COLOR),
                                  new Color(MyGuiConstants.LISTBOX_TEXT_COLOR * MyGuiConstants.CONTROL_MOUSE_OVER_BACKGROUND_COLOR_MULTIPLIER),
                                  MyGuiManager.GetFontMinerWarsBlue(),
                                  scale, Vector2.Zero);

                if (ToolTip == null)
                {
                    ToolTip = new MyToolTips(value);
                }
            }
            BackgroundColor = Vector4.One;
            Enabled = true;
        }
Exemplo n.º 6
0
        public MyGuiControlListboxItem(int key, StringBuilder value, MyTexture2D icon, MyToolTips tooltip, float scale)
        {
            Key     = key;
            Icon    = icon;
            ToolTip = tooltip;

            if (value != null)
            {
                ColoredText = new MyColoredText(value, new Color(MyGuiConstants.LISTBOX_TEXT_COLOR),
                                                new Color(MyGuiConstants.LISTBOX_TEXT_COLOR * MyGuiConstants.CONTROL_MOUSE_OVER_BACKGROUND_COLOR_MULTIPLIER),
                                                MyGuiManager.GetFontMinerWarsBlue(),
                                                scale, Vector2.Zero);

                if (ToolTip == null)
                {
                    ToolTip = new MyToolTips(value);
                }
            }
            BackgroundColor = Vector4.One;
            Enabled         = true;
        }
Exemplo n.º 7
0
 private MyToolTips GetListboxItemTooltip(MyGuiControlListbox listbox, int id)
 {
     MyInventoryItem item = m_itemsRepository.GetItem(id);
     MyToolTips toolTips = new MyToolTips();
     toolTips.AddToolTip(item.MultiLineDescription, Color.White, 0.7f);
     // add price to tooltip
     if (m_tradeForMoney)
     {
         if (item.CanBeTraded)
         {
             StringBuilder sb = new StringBuilder();
             if (listbox == m_shipInventoryListBox)
             {
                 sb.Append(MyTextsWrapper.Get(MyTextsWrapperEnum.SellFor));
             }
             else if (listbox == m_otherSideInventoryListBox)
             {
                 sb.Append(MyTextsWrapper.Get(MyTextsWrapperEnum.BuyFor));
             }
             sb.Append(GetPriceSB((decimal)GetTradeItemPrice(item)));
             toolTips.AddToolTip(sb, Color.Gold);
         }
         else
         {
             toolTips.AddToolTip(MyTextsWrapper.Get(MyTextsWrapperEnum.NotificationNonTradeableItem), Color.Red);
         }
     }
     return toolTips;
 }
 public void ShowToolTip(MyToolTips tooltip)
 {
     m_showToolTip = false;
     m_toolTip     = tooltip;
     ShowToolTip();
 }
Exemplo n.º 9
0
 private MyGuiControlListboxItem CreateListboxItem(int key, StringBuilder value, MyTexture2D icon)
 {
     MyColoredText coloredText = null;
     MyToolTips toolTips = null;
     if (value != null)
     {
         coloredText = new MyColoredText(value, new Color(MyGuiConstants.LISTBOX_TEXT_COLOR),
                                         new Color(MyGuiConstants.LISTBOX_TEXT_COLOR * MyGuiConstants.CONTROL_MOUSE_OVER_BACKGROUND_COLOR_MULTIPLIER),
                                         MyGuiManager.GetFontMinerWarsBlue(), m_textScale, Vector2.Zero);
         toolTips = new MyToolTips(value);
     }
     MyGuiControlListboxItem newItem = new MyGuiControlListboxItem(key, coloredText, icon, toolTips);
     return newItem;
 }
Exemplo n.º 10
0
 public void SetToolTip(StringBuilder tooltip)
 {
     m_toolTip = new MyToolTips(tooltip);
 }
Exemplo n.º 11
0
 private MyGuiControlBase(IMyGuiControlsParent parent, Vector2 position, Vector4? backgroundColor, StringBuilder toolTip,
     MyTexture2D controlTexture, MyTexture2D hoverTexture, MyTexture2D pressedTexture, bool isActiveControl, 
     MyTexture2D mouseCursorHoverTexture, MyTexture2D mouseCursorPressedTexture/*,
     System.Drawing.Bitmap mouseCursorHoverBitmap, System.Drawing.Bitmap mouseCursorPressedBitmap*/) 
 {
     Visible = true;
     Enabled = true;
     m_parent = parent;
     m_position = position;
     m_backgroundColor = backgroundColor;
     //m_toolTip = toolTip;
     if (toolTip != null)
     {
         m_toolTip = new MyToolTips(toolTip);
     }
     m_controlTexture = controlTexture;
     m_hoverTexture = hoverTexture;
     m_pressedTexture = pressedTexture;
     m_isActiveControl = isActiveControl;
     m_mouseCursorHoverTexture = mouseCursorHoverTexture;
     m_mouseCursorPressedTexture = mouseCursorPressedTexture;
     /*
     m_mouseCursorHoverBitmap = mouseCursorHoverBitmap;
     m_mouseCursorPressedBitmap = mouseCursorPressedBitmap;
     */
 }
        private MyGuiControlListboxItem CreateListboxItemAndAddToRepository(MyInventoryItem inventoryItem) 
        {
            int inventoryItemKey = m_inventoryItemsRepository.AddItem(inventoryItem);            

            StringBuilder description = null;
            if (inventoryItem.Icon == null)
            {
                description = inventoryItem.MultiLineDescription;
            }

            MyToolTips toolTips = new MyToolTips();
            toolTips.AddToolTip(inventoryItem.MultiLineDescription, Color.White, 0.7f);            

            MyGuiControlListboxItem listboxItem = new MyGuiControlListboxItem(inventoryItemKey, description, inventoryItem.Icon, toolTips, MyGuiConstants.LABEL_TEXT_SCALE);
            listboxItem.IconTexts = new MyIconTexts();

            // add amount icon's text
            if (inventoryItem.Amount != 1f || inventoryItem.Amount != inventoryItem.MaxAmount)
            {
                StringBuilder amount = new StringBuilder();
                amount.Append(inventoryItem.Amount.ToString());
                MyGuiDrawAlignEnum align;
                Vector2 offset;
                if (inventoryItem.AmountTextAlign == MyInventoryAmountTextAlign.MiddleRight)
                {
                    align = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
                    offset = new Vector2(-0.004f, 0.0038f);
                }
                else if (inventoryItem.AmountTextAlign == MyInventoryAmountTextAlign.BottomRight)
                {
                    align = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM;
                    offset = new Vector2(-0.004f, -0.0025f);
                }
                else
                {
                    throw new MyMwcExceptionApplicationShouldNotGetHere();
                }
                listboxItem.IconTexts[align] = new MyColoredText(amount, Color.White, Color.White, MyGuiManager.GetFontMinerWarsWhite(), 0.5f, offset);
            }

            return listboxItem;
        }
Exemplo n.º 13
0
 public void ShowToolTip(MyToolTips tooltip)
 {
     m_showToolTip = false;
     m_toolTip = tooltip;
     ShowToolTip();
 }
Exemplo n.º 14
0
 public void SetToolTip(StringBuilder tooltip)
 {
     m_toolTip = new MyToolTips(tooltip);
 }