private void SetGridItemAt(int slot, MyToolbarItem item, string icon, string subicon, String tooltip, Sandbox.Graphics.GUI.MyGuiControlGrid.ColoredIcon?symbol = null) { var gridItem = m_toolbarItemsGrid.GetItemAt(slot); if (gridItem == null) { gridItem = new MyGuiControlGrid.Item( icon: icon, subicon: subicon, toolTip: tooltip, userData: item); if (DrawNumbers) { gridItem.AddText(MyToolbarComponent.GetSlotControlText(slot)); } //Ammo amount in toolbar if (item != null) { gridItem.AddText(item.IconText, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM); } else { gridItem.ClearText(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM); } gridItem.Enabled = (item != null) ? item.Enabled : true; if (symbol.HasValue) { gridItem.AddIcon(symbol.Value, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); } m_toolbarItemsGrid.SetItemAt(slot, gridItem); } else { gridItem.UserData = item; gridItem.Icon = icon; gridItem.SubIcon = subicon; if (gridItem.ToolTip == null) { gridItem.ToolTip = new MyToolTips(); } gridItem.ToolTip.ToolTips.Clear(); gridItem.ToolTip.AddToolTip(tooltip); //Ammo amount in toolbar if (item != null) { gridItem.AddText(item.IconText, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM); } else { gridItem.ClearText(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM); } gridItem.Enabled = (item != null) ? item.Enabled : true; if (symbol.HasValue) { gridItem.AddIcon(symbol.Value, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); } } }
protected virtual void SetGridItemAt(int slot, MyToolbarItem item, string[] icons, string subicon, String tooltip, Sandbox.Graphics.GUI.MyGuiControlGrid.ColoredIcon?symbol = null) { var gridItem = m_toolbarItemsGrid.GetItemAt(slot); if (gridItem == null) { gridItem = new MyGuiControlGrid.Item( icons: icons, subicon: subicon, toolTip: tooltip, userData: item); if (DrawNumbers) { gridItem.AddText(MyToolbarComponent.GetSlotControlText(slot)); } //By Gregory: Changed to IconText for weapon check MyToolbarItemWeapon IconText override if (item != null) { gridItem.AddText(item.IconText, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM); } else { gridItem.ClearText(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM); } gridItem.Enabled = (item != null) ? item.Enabled : true; if (symbol.HasValue) { gridItem.AddIcon(symbol.Value, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); } m_toolbarItemsGrid.SetItemAt(slot, gridItem); } else { gridItem.UserData = item; gridItem.Icons = icons; gridItem.SubIcon = subicon; if (gridItem.ToolTip == null) { gridItem.ToolTip = new MyToolTips(); } gridItem.ToolTip.ToolTips.Clear(); gridItem.ToolTip.AddToolTip(tooltip); //By Gregory: Changed to IconText for weapon check MyToolbarItemWeapon IconText override if (item != null) { gridItem.AddText(item.IconText, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM); } else { gridItem.ClearText(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM); } gridItem.Enabled = (item != null) ? item.Enabled : true; if (symbol.HasValue) { gridItem.AddIcon(symbol.Value, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP); } } }