本文整理汇总了C#中System.Logger.debugLog方法的典型用法代码示例。如果您正苦于以下问题:C# Logger.debugLog方法的具体用法?C# Logger.debugLog怎么用?C# Logger.debugLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Logger
的用法示例。
在下文中一共展示了Logger.debugLog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Orbiter
public Orbiter(Mover mover, AllNavigationSettings navSet, string entity)
: base(mover, navSet)
{
this.m_logger = new Logger(GetType().Name, m_controlBlock.CubeBlock);
this.m_navBlock = m_navSet.Settings_Current.NavigationBlock;
switch (entity.LowerRemoveWhitespace())
{
case "asteroid":
SetOrbitClosestVoxel(true);
CalcFakeOrbitSpeedForce();
m_logger.debugLog("Orbiting asteroid: " + OrbitEntity.getBestName(), Logger.severity.INFO);
break;
case "planet":
SetOrbitClosestVoxel(false);
OrbitSpeed = (float)Math.Sqrt((OrbitEntity as MyPlanet).GetGravityMultiplier(m_navBlock.WorldPosition) * 9.81f * Altitude);
if (OrbitSpeed < 1f)
CalcFakeOrbitSpeedForce();
m_logger.debugLog("Orbiting planet: " + OrbitEntity.getBestName(), Logger.severity.INFO);
break;
default:
m_gridFinder = new GridFinder(navSet, mover.Block, entity, mustBeRecent: true);
m_logger.debugLog("Searching for a grid: " + entity, Logger.severity.INFO);
break;
}
m_navSet.Settings_Task_NavMove.NavigatorMover = this;
}
示例2: Grinder
public Grinder(Mover mover, AllNavigationSettings navSet, float maxRange)
: base(mover, navSet)
{
this.m_logger = new Logger(GetType().Name, () => m_controlBlock.CubeGrid.DisplayName, () => m_stage.ToString());
this.m_startPostion = m_controlBlock.CubeBlock.GetPosition();
this.m_longestDimension = m_controlBlock.CubeGrid.GetLongestDim();
PseudoBlock navBlock = m_navSet.Settings_Current.NavigationBlock;
m_navGrind = navBlock.Block is Ingame.IMyShipGrinder
? new MultiBlock<MyObjectBuilder_ShipGrinder>(navBlock.Block)
: new MultiBlock<MyObjectBuilder_ShipGrinder>(() => m_mover.Block.CubeGrid);
if (m_navGrind.FunctionalBlocks == 0)
{
m_logger.debugLog("no working grinders", Logger.severity.INFO);
return;
}
m_grinderOffset = m_navGrind.Block.GetLengthInDirection(m_navGrind.Block.GetFaceDirection()[0]) * 0.5f + 2.5f;
if (m_navSet.Settings_Current.DestinationRadius > m_longestDimension)
{
m_logger.debugLog("Reducing DestinationRadius from " + m_navSet.Settings_Current.DestinationRadius + " to " + m_longestDimension, Logger.severity.DEBUG);
m_navSet.Settings_Task_NavRot.DestinationRadius = m_longestDimension;
}
this.m_finder = new GridFinder(m_navSet, mover.Block, maxRange);
this.m_finder.GridCondition = GridCondition;
m_navSet.Settings_Task_NavRot.NavigatorMover = this;
m_navSet.Settings_Task_NavRot.NavigatorRotator = this;
}
示例3: Hacker
public Hacker(IMyCubeBlock block)
{
m_logger = new Logger(GetType().Name, block);
m_hackBlock = block as IMyLandingGear;
m_logger.debugLog("created for: " + block.DisplayNameText);
m_logger.debugLog(!IsHacker(block), "Not a hacker", Logger.severity.FATAL);
}
示例4: Cluster
public Cluster(List<IMyEntity> missiles, IMyEntity launcher)
{
m_logger = new Logger(GetType().Name);
Vector3 centre = Vector3.Zero;
foreach (IMyEntity miss in missiles)
centre += miss.GetPosition();
centre /= missiles.Count;
float masterDistSq = float.MaxValue;
foreach (IMyEntity miss in missiles)
{
float distSq = Vector3.DistanceSquared(centre, miss.GetPosition());
if (distSq < masterDistSq)
{
Master = miss;
masterDistSq = distSq;
}
}
masterVelocity = Master.Physics.LinearVelocity;
// master must initially have same orientation as launcher or rail will cause a rotation
MatrixD masterMatrix = launcher.WorldMatrix;
masterMatrix.Translation = Master.WorldMatrix.Translation;
MainLock.UsingShared(() => Master.WorldMatrix = masterMatrix);
Vector3 masterPos = Master.GetPosition();
MatrixD masterInv = Master.WorldMatrixNormalizedInv;
float Furthest = 0f;
Slaves = new List<IMyEntity>(missiles.Count - 1);
SlaveOffsets = new List<Vector3>(missiles.Count - 1);
foreach (IMyEntity miss in missiles)
{
if (miss == Master)
continue;
Slaves.Add(miss);
SlaveOffsets.Add(Vector3.Transform(miss.GetPosition(), masterInv));
float distSq = Vector3.DistanceSquared(miss.GetPosition(), masterPos);
m_logger.debugLog("slave: " + miss + ", offset: " + SlaveOffsets[SlaveOffsets.Count - 1], Logger.severity.TRACE);
if (distSq > Furthest)
Furthest = distSq;
}
Furthest = (float)Math.Sqrt(Furthest);
for (int i = 0; i < SlaveOffsets.Count; i++)
SlaveOffsets[i] = SlaveOffsets[i] / Furthest;
MinOffMult = Furthest * 2f;
OffsetMulti = Furthest * 1e6f; // looks pretty
m_logger.debugLog("created new cluster, missiles: " + missiles.Count + ", slaves: " + Slaves.Count + ", offsets: " + SlaveOffsets.Count + ", furthest: " + Furthest, Logger.severity.DEBUG);
}
示例5: Ammo
private Ammo(MyAmmoMagazineDefinition ammoMagDef)
{
MyAmmoDefinition ammoDef = MyDefinitionManager.Static.GetAmmoDefinition(ammoMagDef.AmmoDefinitionId);
this.myLogger = new Logger("Ammo", () => ammoMagDef.Id.ToString(), () => ammoDef.Id.ToString());
this.AmmoDefinition = ammoDef;
this.MissileDefinition = AmmoDefinition as MyMissileAmmoDefinition;
this.MagazineDefinition = ammoMagDef;
if (MissileDefinition != null && !MissileDefinition.MissileSkipAcceleration)
{
this.TimeToMaxSpeed = (MissileDefinition.DesiredSpeed - MissileDefinition.MissileInitialSpeed) / MissileDefinition.MissileAcceleration;
this.DistanceToMaxSpeed = (MissileDefinition.DesiredSpeed + MissileDefinition.MissileInitialSpeed) / 2 * TimeToMaxSpeed;
}
else
{
this.TimeToMaxSpeed = 0;
this.DistanceToMaxSpeed = 0;
}
Description = AmmoDescription.CreateFrom(AmmoDefinition);
if (Description == null)
return;
if (Description.ClusterCooldown > 0f)
{
myLogger.debugLog("Is a cluster missile");
IsCluster = true;
}
if (!string.IsNullOrWhiteSpace(Description.Radar))
{
try
{
RadarDefinition = new RadarEquipment.Definition();
XML_Amendments<RadarEquipment.Definition> ammender = new XML_Amendments<RadarEquipment.Definition>(RadarDefinition);
ammender.primarySeparator = new char[] { ',' };
ammender.AmendAll(Description.Radar, true);
RadarDefinition = ammender.Deserialize();
myLogger.debugLog("Loaded description for radar", Logger.severity.DEBUG);
}
catch (Exception ex)
{
Logger.debugNotify("Failed to load radar description for an ammo", 10000, Logger.severity.ERROR);
myLogger.alwaysLog("Failed to load radar description for an ammo", Logger.severity.ERROR);
myLogger.alwaysLog("Exception: " + ex, Logger.severity.ERROR);
RadarDefinition = null;
}
}
}
示例6: GridFinder
/// <summary>
/// Creates a GridFinder to find an enemy grid based on distance.
/// </summary>
public GridFinder(AllNavigationSettings navSet, ShipControllerBlock controller, float maxRange = 0f)
{
this.m_logger = new Logger(GetType().Name, controller.CubeBlock);
m_logger.debugLog(navSet == null, "navSet == null", Logger.severity.FATAL);
m_logger.debugLog(controller == null, "controller == null", Logger.severity.FATAL);
m_logger.debugLog(controller.CubeBlock == null, "controller.CubeBlock == null", Logger.severity.FATAL);
this.m_controlBlock = controller;
//this.m_enemies = new List<LastSeen>();
this.MaximumRange = maxRange;
this.m_navSet = navSet;
this.m_mustBeRecent = true;
}
示例7: GuidedMissileLauncher
public GuidedMissileLauncher(WeaponTargeting weapon)
{
m_weaponTarget = weapon;
FuncBlock = CubeBlock as IMyFunctionalBlock;
myLogger = new Logger("GuidedMissileLauncher", CubeBlock);
var defn = CubeBlock.GetCubeBlockDefinition();
Vector3[] points = new Vector3[3];
points[0] = CubeBlock.LocalAABB.Min;
points[1] = CubeBlock.LocalAABB.Max;
points[2] = CubeBlock.LocalAABB.Min + Vector3.Up * CubeBlock.GetCubeBlockDefinition().Size.Y * CubeBlock.CubeGrid.GridSize;
MissileSpawnBox = BoundingBox.CreateFromPoints(points);
if (m_weaponTarget.myTurret != null)
{
myLogger.debugLog("original box: " + MissileSpawnBox, "GuidedMissileLauncher()");
MissileSpawnBox.Inflate(CubeBlock.CubeGrid.GridSize * 2f);
}
myLogger.debugLog("MissileSpawnBox: " + MissileSpawnBox, "GuidedMissileLauncher()");
myInventory = (CubeBlock as Interfaces.IMyInventoryOwner).GetInventory(0);
m_weaponTarget.AllowedState = WeaponTargeting.State.GetOptions;
Registrar.Add(weapon.FuncBlock, this);
}
示例8: RelayStorage
public RelayStorage(RelayNode primary)
{
this.m_logger = new Logger(GetType().Name, () => primary.LoggingName);
this.PrimaryNode = primary;
m_logger.debugLog("Created", Logger.severity.DEBUG);
}
示例9: Turret
public Turret(IMyCubeBlock block)
: base(block)
{
myLogger = new Logger("Turret", block);
Registrar.Add(CubeBlock, this);
if (TP_TargetMissiles == null)
{
myLogger.debugLog("Filling Terminal Properties", "Turret()", Logger.severity.INFO);
IMyTerminalBlock term = CubeBlock as IMyTerminalBlock;
TP_TargetMissiles = term.GetProperty("TargetMissiles").AsBool();
TP_TargetMeteors = term.GetProperty("TargetMeteors").AsBool();
TP_TargetCharacters = term.GetProperty("TargetCharacters").AsBool();
TP_TargetMoving = term.GetProperty("TargetMoving").AsBool();
TP_TargetLargeGrids = term.GetProperty("TargetLargeShips").AsBool();
TP_TargetSmallGrids = term.GetProperty("TargetSmallShips").AsBool();
TP_TargetStations = term.GetProperty("TargetStations").AsBool();
}
// definition limits
MyLargeTurretBaseDefinition definition = CubeBlock.GetCubeBlockDefinition() as MyLargeTurretBaseDefinition;
if (definition == null)
throw new NullReferenceException("definition");
minElevation = Math.Max(MathHelper.ToRadians(definition.MinElevationDegrees), -0.6f);
maxElevation = MathHelper.ToRadians(definition.MaxElevationDegrees);
minAzimuth = MathHelper.ToRadians(definition.MinAzimuthDegrees);
maxAzimuth = MathHelper.ToRadians(definition.MaxAzimuthDegrees);
Can360 = Math.Abs(definition.MaxAzimuthDegrees - definition.MinAzimuthDegrees) >= 360;
// speeds are in rads per ms (from S.E. source)
speedElevation = definition.ElevationSpeed * 100f / 6f;
speedAzimuth = definition.RotationSpeed * 100f / 6f;
setElevation = myTurret.Elevation;
setAzimuth = myTurret.Azimuth;
//if (CubeBlock.OwnedNPC() && s_npcHasOpts && ArmsGuiWeapons.GetPropertyValue(myTurret, ref ArmsGuiWeapons.TP_ARMS_Control))
// myTurret.ApplyAction("ARMS_Control");
//if (myTurret is Ingame.IMyLargeInteriorTurret && myTurret.BlockDefinition.SubtypeName == "LargeInteriorTurret" && !ArmsGuiWeapons.GetPropertyValue(myTurret, ref ArmsGuiWeapons.TP_Interior_Turret))
// myTurret.ApplyAction("Interior_Turret");
myLogger.debugLog("definition limits = " + definition.MinElevationDegrees + ", " + definition.MaxElevationDegrees + ", " + definition.MinAzimuthDegrees + ", " + definition.MaxAzimuthDegrees, "Turret()");
myLogger.debugLog("radian limits = " + minElevation + ", " + maxElevation + ", " + minAzimuth + ", " + maxAzimuth, "Turret()");
}
示例10: AttachedGrid
private AttachedGrid(IMyCubeGrid grid)
{
this.myLogger = new Logger("AttachedGrid", () => grid.DisplayName);
this.myGrid = grid;
Registrar.Add(grid, this);
myLogger.debugLog("Initialized");
}
示例11: Beacon
public Beacon(IMyCubeBlock block)
{
CubeBlock = block;
myBeacon = block as Ingame.IMyBeacon;
myLogger = new Logger("Beacon", CubeBlock);
myLogger.debugLog("init as beacon: " + CubeBlock.BlockDefinition.SubtypeName, "Init()", Logger.severity.TRACE);
}
示例12: GridFinder
/// <summary>
/// Creates a GridFinder to find an enemy grid based on distance.
/// </summary>
public GridFinder(AllNavigationSettings navSet, ShipControllerBlock controller, float maxRange = 0f)
{
this.m_logger = new Logger(GetType().Name + " enemy", controller.CubeBlock);
m_logger.debugLog(navSet == null, "navSet == null", "GridFinder()", Logger.severity.FATAL);
m_logger.debugLog(controller == null, "controller == null", "GridFinder()", Logger.severity.FATAL);
m_logger.debugLog(controller.CubeBlock == null, "controller.CubeBlock == null", "GridFinder()", Logger.severity.FATAL);
this.m_controlBlock = controller;
this.m_enemies = new List<LastSeen>();
if (!Registrar.TryGetValue(controller.CubeBlock.EntityId, out this.m_controller))
throw new NullReferenceException("ShipControllerBlock is not a ShipController");
this.MaximumRange = maxRange;
this.m_navSet = navSet;
this.m_mustBeRecent = true;
}
示例13: FixedWeapon
public FixedWeapon(IMyCubeBlock block)
: base(block)
{
myLogger = new Logger("FixedWeapon", block);
Registrar.Add(CubeBlock, this);
myLogger.debugLog("Initialized", "FixedWeapon()");
AllowFighterControl = WeaponDescription.GetFor(block).AllowFighterControl;
}
示例14: Cluster
public Cluster(List<IMyEntity> missiles)
{
m_logger = new Logger(GetType().Name);
Vector3 centre = Vector3.Zero;
foreach (IMyEntity miss in missiles)
centre += miss.GetPosition();
centre /= missiles.Count;
float masterDistSq = float.MaxValue;
foreach (IMyEntity miss in missiles)
{
float distSq = Vector3.DistanceSquared(centre, miss.GetPosition());
if (distSq < masterDistSq)
{
Master = miss;
masterDistSq = distSq;
}
}
Vector3 masterPos = Master.GetPosition();
MatrixD masterInv = Master.WorldMatrixNormalizedInv;
float Furthest = 0f;
Slaves = new List<IMyEntity>(missiles.Count - 1);
SlaveOffsets = new List<Vector3>(missiles.Count - 1);
foreach (IMyEntity miss in missiles)
{
if (miss == Master)
continue;
Slaves.Add(miss);
SlaveOffsets.Add(Vector3.Transform(miss.GetPosition(), masterInv));
float distSq = Vector3.DistanceSquared(miss.GetPosition(), masterPos);
m_logger.debugLog("slave: " + miss + ", offset: " + SlaveOffsets[SlaveOffsets.Count - 1], "Cluster()", Logger.severity.TRACE);
if (distSq > Furthest)
Furthest = distSq;
}
Furthest = (float)Math.Sqrt(Furthest);
for (int i = 0; i < SlaveOffsets.Count; i++)
SlaveOffsets[i] = SlaveOffsets[i] / Furthest;
OffsetMulti = 1f;
m_logger.debugLog("created new cluster, missiles: " + missiles.Count + ", slaves: " + Slaves.Count + ", offsets: " + SlaveOffsets.Count + ", furthest: " + Furthest, "Cluster()", Logger.severity.DEBUG);
}
示例15: VoxelData
public VoxelData(Ingame.IMyOreDetector oreDetector, IMyVoxelBase voxel, float maxRange)
{
this.m_logger = new Logger(GetType().Name, () => oreDetector.CubeGrid.DisplayName, () => oreDetector.DisplayNameText, () => voxel.ToString());
this.m_oreDetector = oreDetector;
this.m_voxel = voxel;
this.m_storage.Resize(new Vector3I(QUERY_STEP, QUERY_STEP, QUERY_STEP));
this.m_maxRange = maxRange;
m_logger.debugLog("Created for voxel at " + voxel.PositionLeftBottomCorner, "VoxelData()");
}