本文整理汇总了C#中Sandbox.Game.Screens.Helpers.MyToolbar.SlotToIndex方法的典型用法代码示例。如果您正苦于以下问题:C# MyToolbar.SlotToIndex方法的具体用法?C# MyToolbar.SlotToIndex怎么用?C# MyToolbar.SlotToIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sandbox.Game.Screens.Helpers.MyToolbar
的用法示例。
在下文中一共展示了MyToolbar.SlotToIndex方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CurrentToolbar_SlotActivated
private void CurrentToolbar_SlotActivated(MyToolbar toolbar, MyToolbar.SlotArgs args)
{
if (!(toolbar.GetItemAtIndex(toolbar.SlotToIndex(args.SlotNumber.Value)) is MyToolbarItemVoxelHand))
{
if (Enabled)
Enabled = false;
}
}
示例2: CurrentToolbar_SlotActivated
private void CurrentToolbar_SlotActivated(MyToolbar toolbar, MyToolbar.SlotArgs args)
{
if (!(toolbar.GetItemAtIndex(toolbar.SlotToIndex(args.SlotNumber.Value)) is MyToolbarItemAreaMarker))
AreaMarkerDefinition = null;
}
示例3: Init
public override void Init(MyObjectBuilder_CubeBlock builder, MyCubeGrid cubeGrid)
{
SyncFlag = true;
var sinkComp = new MyResourceSinkComponent();
sinkComp.Init(
BlockDefinition.ResourceSinkGroup,
0.0001f,
() => IsFunctional ? 0.0001f : 0);
sinkComp.IsPoweredChanged += Receiver_IsPoweredChanged;
sinkComp.IsPoweredChanged += ComponentStack_IsFunctionalChanged;
ResourceSink = sinkComp;
base.Init(builder, cubeGrid);
m_emissiveNames = new List<string>(BlockDefinition.ButtonCount);
for (int i = 1; i <= BlockDefinition.ButtonCount; i++) //button dummies have 1-based index
{
m_emissiveNames.Add(string.Format("Emissive{0}", i)); // because of modding
}
var ob = builder as MyObjectBuilder_ButtonPanel;
Toolbar = new MyToolbar(MyToolbarType.ButtonPanel, Math.Min(BlockDefinition.ButtonCount, MyToolbar.DEF_SLOT_COUNT), (BlockDefinition.ButtonCount / MyToolbar.DEF_SLOT_COUNT) + 1);
Toolbar.DrawNumbers = false;
Toolbar.GetSymbol = (slot) =>
{
var ret = new Sandbox.Graphics.GUI.MyGuiControlGrid.ColoredIcon();
if(Toolbar.SlotToIndex(slot) < BlockDefinition.ButtonCount)
{
ret.Icon = BlockDefinition.ButtonSymbols[Toolbar.SlotToIndex(slot) % BlockDefinition.ButtonSymbols.Length];
var color = BlockDefinition.ButtonColors[Toolbar.SlotToIndex(slot) % BlockDefinition.ButtonColors.Length];
color.W = 1;
ret.Color = color;
}
return ret;
};
Toolbar.Init(ob.Toolbar, this);
Toolbar.ItemChanged += Toolbar_ItemChanged;
AnyoneCanUse = ob.AnyoneCanUse;
SlimBlock.ComponentStack.IsFunctionalChanged += ComponentStack_IsFunctionalChanged;
ResourceSink.Update();
if (ob.CustomButtonNames != null)
{
m_customButtonNames = ob.CustomButtonNames;
}
NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME | MyEntityUpdateEnum.EACH_FRAME;
UseObjectsComponent.GetInteractiveObjects<MyUseObjectPanelButton>(m_buttonsUseObjects);
}
示例4: CurrentToolbar_SlotActivated
private void CurrentToolbar_SlotActivated(MyToolbar toolbar, MyToolbar.SlotArgs args)
{
if (!(toolbar.GetItemAtIndex(toolbar.SlotToIndex(args.SlotNumber.Value)) is MyToolbarItemBot))
BotToSpawn = null;
if (!(toolbar.GetItemAtIndex(toolbar.SlotToIndex(args.SlotNumber.Value)) is MyToolbarItemAiCommand))
CommandDefinition = null;
}
示例5: UpdateItemIcon
private void UpdateItemIcon(MyToolbar toolbar, MyToolbar.IndexArgs args)
{
if (toolbar.IsValidIndex(args.ItemIndex))
{
var slot = toolbar.IndexToSlot(args.ItemIndex);
if (slot != -1)
m_toolbarItemsGrid.GetItemAt(slot).Icon = toolbar.GetItemIcon(args.ItemIndex);
}
else
{
for (int i = 0; i < m_toolbarItemsGrid.ColumnsCount; ++i)
{
m_toolbarItemsGrid.GetItemAt(i).Icon = toolbar.GetItemIcon(toolbar.SlotToIndex(i));
}
}
}
示例6: Toolbar_ItemEnabledChanged
private void Toolbar_ItemEnabledChanged(MyToolbar toolbar, MyToolbar.SlotArgs args)
{
if (args.SlotNumber.HasValue)
{
var idx = args.SlotNumber.Value;
m_toolbarItemsGrid.GetItemAt(idx).Enabled = toolbar.IsEnabled(toolbar.SlotToIndex(idx));
}
else
{
for (int i = 0; i < m_toolbarItemsGrid.ColumnsCount; ++i)
{
m_toolbarItemsGrid.GetItemAt(i).Enabled = toolbar.IsEnabled(toolbar.SlotToIndex(i));
}
}
}
示例7: CurrentToolbar_SlotActivated
private void CurrentToolbar_SlotActivated(MyToolbar toolbar, MyToolbar.SlotArgs args)
{
if (!(toolbar.GetItemAtIndex(toolbar.SlotToIndex(args.SlotNumber.Value)) is MyToolbarItemPrefabThrower))
Enabled = false;
}