コード例 #1
0
ファイル: ComponentLaser.cs プロジェクト: Souper07/Autopilot
 /// <summary>
 /// Creates the laser component from a laser antenna block.
 /// </summary>
 /// <param name="laser">The block to create the laser component for.</param>
 public ComponentLaser(Ingame.IMyLaserAntenna laser)
 {
     this.m_logger = new Logger(GetType().Name, laser);
     this.m_laser = laser;
 }
コード例 #2
0
        private bool GetTextPanel(string name, out Ingame.IMyTextPanel panel)
        {
            IMyCubeBlock foundBlock = null;
            int bestNameLength = int.MaxValue;

            AttachedGrid.RunOnAttachedBlock(Grid, AttachedGrid.AttachmentKind.Permanent, block => {
                IMyCubeBlock Fatblock = block.FatBlock;
                if (Fatblock != null && Block.canControlBlock(Fatblock))
                {
                    string blockName = Fatblock.DisplayNameText.LowerRemoveWhitespace();

                    if (blockName.Length < bestNameLength && blockName.Contains(name))
                    {
                        foundBlock = Fatblock;
                        bestNameLength = blockName.Length;
                        if (name.Length == bestNameLength)
                            return true;
                    }
                }
                return false;
            }, true);

            panel = foundBlock as Ingame.IMyTextPanel;
            return panel != null;
        }