当前位置: 首页>>代码示例>>C#>>正文


C# MyToolbar.SlotToIndex方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:8,代码来源:MySessionComponentVoxelHand.cs

示例2: CurrentToolbar_SlotActivated

		private void CurrentToolbar_SlotActivated(MyToolbar toolbar, MyToolbar.SlotArgs args)
		{
			if (!(toolbar.GetItemAtIndex(toolbar.SlotToIndex(args.SlotNumber.Value)) is MyToolbarItemAreaMarker))
				AreaMarkerDefinition = null;
		}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:5,代码来源:MyPlaceAreas.cs

示例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);
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:52,代码来源:MyButtonPanel.cs

示例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;
 }
开发者ID:avivbeeri,项目名称:SpaceEngineers,代码行数:7,代码来源:MyAIComponent.cs

示例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));
         }
     }
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:16,代码来源:MyGuiControlToolbar.cs

示例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));
         }
     }
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:15,代码来源:MyGuiControlToolbar.cs

示例7: CurrentToolbar_SlotActivated

 private void CurrentToolbar_SlotActivated(MyToolbar toolbar, MyToolbar.SlotArgs args)
 {
     if (!(toolbar.GetItemAtIndex(toolbar.SlotToIndex(args.SlotNumber.Value)) is MyToolbarItemPrefabThrower))
         Enabled = false;
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:5,代码来源:MyThrowerSessionComponent.cs


注:本文中的Sandbox.Game.Screens.Helpers.MyToolbar.SlotToIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。