本文整理汇总了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 ));
} );
}
示例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);
}
示例3: AddToClipboard
private static void AddToClipboard(MyTerminalBlock block)
{
if (MySession.Static.ElapsedGameTime != m_lastAccess)
{
Clipboard.Clear();
m_lastAccess = MySession.Static.ElapsedGameTime;
}
Clipboard.Add(block);
}
示例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);
}
示例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);
}
示例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;
}
示例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!");
}
}
示例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);
}
示例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));
}
}
示例10: TerminalSystem_BlockAdded
void TerminalSystem_BlockAdded(MyTerminalBlock obj)
{
AddBlockToList(obj);
}
示例11: thrust_EnabledChanged
private void thrust_EnabledChanged(MyTerminalBlock obj)
{
MarkDirty();
if (CubeGrid.Physics != null && !CubeGrid.Physics.RigidBody.IsActive)
CubeGrid.ActivatePhysics();
}
示例12: reflector_EnabledChanged
private void reflector_EnabledChanged(MyTerminalBlock obj)
{
Debug.Assert(obj is MyReflectorLight);
m_reflectorsEnabledNeedsRefresh = true;
}
示例13: block_ShowInTerminalChanged
void block_ShowInTerminalChanged(MyTerminalBlock obj)
{
ClearBlockList();
PopulateBlockList();
}
示例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 });
}
示例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();
}