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


C# Cube.MyTerminalBlock类代码示例

本文整理汇总了C#中Sandbox.Game.Entities.Cube.MyTerminalBlock的典型用法代码示例。如果您正苦于以下问题:C# MyTerminalBlock类的具体用法?C# MyTerminalBlock怎么用?C# MyTerminalBlock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MyTerminalBlock类属于Sandbox.Game.Entities.Cube命名空间,在下文中一共展示了MyTerminalBlock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ChangeOwnershipToNearestPlayer

        private static void ChangeOwnershipToNearestPlayer( MyTerminalBlock block )
        {
            Wrapper.GameAction( () =>
                                {
                                    double minDist = 0;
                                    MyPlayer nearest = null;

                                    foreach ( var player in MySession.Static.Players.GetOnlinePlayers() )
                                    {
                                        var dist = Vector3D.DistanceSquared( player.GetPosition(), block.PositionComp.GetPosition() );

                                        if ( nearest == null )
                                        {
                                            nearest = player;
                                            minDist = dist;
                                        }
                                        else if ( dist < minDist )
                                            nearest = player;
                                    }

                                    if ( nearest == null )
                                        return;
                                    MyAPIGateway.Utilities.InvokeOnGameThread(()=>block.ChangeBlockOwnerRequest( nearest.Identity.IdentityId, MyOwnershipShareModeEnum.Faction ));
                                } );
        }
开发者ID:rexxar-tc,项目名称:EssentialsPlugin,代码行数:25,代码来源:PlayerBlockEnforcement.cs

示例2: AddRow

 private void AddRow(MyTerminalBlock block)
 {
     MyGuiControlTable.Row row;
     MyGuiControlTable.Cell cell;
     row = new MyGuiControlTable.Row(block);
     cell = new MyGuiControlTable.Cell(block.CustomName);
     row.AddCell(cell);
     m_selectedBlocks.Add(row);
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:9,代码来源:MyGuiScreenTriggerBlockDestroyed.cs

示例3: AddToClipboard

 private static void AddToClipboard(MyTerminalBlock block)
 {
     if (MySession.Static.ElapsedGameTime != m_lastAccess)
     {
         Clipboard.Clear();
         m_lastAccess = MySession.Static.ElapsedGameTime;
     }
     Clipboard.Add(block);
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:9,代码来源:MyScenarioBuildingBlock.cs

示例4: Add

        public void Add(MyTerminalBlock block)
        {
            if (block.MarkedForClose)
                return;
            Debug.Assert(!m_blocks.Contains(block), "Block to add is already in terminal");
            m_blocks.Add(block);

            var handler = BlockAdded;
            if (handler != null) handler(block);
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:10,代码来源:MyGridTerminalSystem.cs

示例5: Add

        public void Add(MyTerminalBlock block)
        {
            if (block.MarkedForClose || block.IsBeeingRemoved)
                return;
            Debug.Assert(!m_blockTable.ContainsKey(block.EntityId), "Block to add is already in terminal");
            m_blockTable.Add(block.EntityId, block);
            m_blocks.Add(block);

            var handler = BlockAdded;
            if (handler != null) handler(block);
        }
开发者ID:liiir1985,项目名称:SpaceEngineers,代码行数:11,代码来源:MyGridTerminalSystem.cs

示例6: Initialize

        public void Initialize(Vector3 panelOrientation, bool isTwoSided, float panelOffset, MyTerminalBlock solarBlock)
        {
            m_initialized = true;

            m_panelOrientation = panelOrientation;
            m_isTwoSided = isTwoSided;
            m_panelOffset = panelOffset;
            m_solarBlock = solarBlock;

            //Warning: this will change the NeedsUpdate variable on the entity
            NeedsUpdate |= MyEntityUpdateEnum.EACH_100TH_FRAME;
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:12,代码来源:MySolarGameLogicComponent.cs

示例7: MyDebugRenderComponentSolarPanel

        public MyDebugRenderComponentSolarPanel(MyTerminalBlock solarBlock):base(solarBlock)
        {
            m_solarBlock = solarBlock;

            MyGameLogicComponent logicComponent;
            if (m_solarBlock.Components.TryGet(out logicComponent))
            {
                m_solarComponent = logicComponent as MySolarGameLogicComponent;
            }

            if (m_solarComponent == null)
            {
                System.Diagnostics.Debug.Fail("No solar component was found!");
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:15,代码来源:MyDebugRenderComponentSolarPanel.cs

示例8: Remove

        public void Remove(MyTerminalBlock block)
        {
            if (block.MarkedForClose)
                return;
            Debug.Assert(m_blocks.Contains(block), "Block to remove is not in terminal");
            m_blocks.Remove(block);

            for (int i = 0; i < BlockGroups.Count; i++)
            {
                var group = BlockGroups[i];
                if (group.Blocks.Contains(block))
                    group.Blocks.Remove(block);
                if (group.Blocks.Count == 0)
                {
                    RemoveGroup(group);
                    i--;
                }
            }

            var handler = BlockRemoved;
            if (handler != null) handler(block);
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:22,代码来源:MyGridTerminalSystem.cs

示例9: TerminalSystem_BlockRemoved

 void TerminalSystem_BlockRemoved(MyTerminalBlock obj)
 {
     obj.CustomNameChanged -= block_CustomNameChanged;
     obj.PropertiesChanged -= block_CustomNameChanged;
     Debug.Assert(m_blockListbox != null);
     if (m_blockListbox != null && (obj.ShowInTerminal || m_showAllTerminalBlocks))
     { 
         m_blockListbox.Remove((item) => (item.UserData == obj));
     }
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:10,代码来源:MyTerminalControlPanel.cs

示例10: TerminalSystem_BlockAdded

 void TerminalSystem_BlockAdded(MyTerminalBlock obj)
 {
     AddBlockToList(obj);
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:4,代码来源:MyTerminalControlPanel.cs

示例11: thrust_EnabledChanged

 private void thrust_EnabledChanged(MyTerminalBlock obj)
 {
     MarkDirty();
     if (CubeGrid.Physics != null && !CubeGrid.Physics.RigidBody.IsActive)
         CubeGrid.ActivatePhysics();
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:6,代码来源:MyThrusterBlockThrustComponent.cs

示例12: reflector_EnabledChanged

 private void reflector_EnabledChanged(MyTerminalBlock obj)
 {
     Debug.Assert(obj is MyReflectorLight);
     m_reflectorsEnabledNeedsRefresh = true;
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:5,代码来源:MyGridReflectorLightSystem.cs

示例13: block_ShowInTerminalChanged

 void block_ShowInTerminalChanged(MyTerminalBlock obj)
 {
     ClearBlockList();
     PopulateBlockList();
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:5,代码来源:MyTerminalControlPanel.cs

示例14: UpdateCubeBlock

        public void UpdateCubeBlock(MyTerminalBlock block)
        {

            if (block == null)
                return;

            if (m_terminalSystem != null)
            {
                m_terminalSystem.BlockAdded -= TerminalSystem_BlockAdded;
                m_terminalSystem.BlockRemoved -= TerminalSystem_BlockRemoved;
                m_terminalSystem.GroupAdded -= TerminalSystem_GroupAdded;
                m_terminalSystem.GroupRemoved -= TerminalSystem_GroupRemoved;
            }

            var grid = block.CubeGrid;
            m_terminalSystem = grid.GridSystems.TerminalSystem;
            m_tmpGroup = new MyBlockGroup(grid);

            m_terminalSystem.BlockAdded += TerminalSystem_BlockAdded;
            m_terminalSystem.BlockRemoved += TerminalSystem_BlockRemoved;
            m_terminalSystem.GroupAdded += TerminalSystem_GroupAdded;
            m_terminalSystem.GroupRemoved += TerminalSystem_GroupRemoved;

            SelectBlocks(new MyTerminalBlock[] { block });


        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:27,代码来源:MyTerminalControlPanel.cs

示例15: block_CustomNameChanged

        void block_CustomNameChanged(MyTerminalBlock obj)
        {
            System.Diagnostics.Debug.Assert(m_blockListbox != null, "block_CustomNameChanged was not unregistered!");

            if (m_blockListbox == null)
                return;

            ProfilerShort.Begin("MyTerminalControlPanel.block_CustomNameChanged");
            foreach (var item in m_blockListbox.Items)
            {
                if (item.UserData == obj)
                {
                    UpdateItemAppearance(obj, item);
                    break;
                }
            }

            if (CurrentBlocks.Count > 0 && CurrentBlocks[0] == obj)
                m_blockNameLabel.Text = obj.CustomName.ToString();

            ProfilerShort.End();
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:22,代码来源:MyTerminalControlPanel.cs


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