public void SetExprInterpreterProperties(int currentBlockID, ProtoCore.Runtime.RuntimeMemory memState, int watchScope, DebugProperties debugProps) { CurrentBlockId = currentBlockID; MemoryState = memState; WatchClassScope = watchScope; DebugProps = debugProps; }
private static void SetProperty(DebugProperties debugProperty, object value) { if (value != null) { value.GetType(); CallContext.LogicalSetData(DebugContext.propertyNames[(int)debugProperty], value); return; } CallContext.FreeNamedDataSlot(DebugContext.propertyNames[(int)debugProperty]); }
private static void SetDebugProperty(DebugProperties debugProperty, object value) { DebugContext.SetProperty(debugProperty, value); }
internal static object GetDebugProperty(DebugProperties debugProperty) { return(CallContext.LogicalGetData(DebugContext.propertyNames[(int)debugProperty])); }
public void WeaponModule_Shot_Test() { var settings = new EngineSettings { DebugProperties = new DebugProperties(true, true) }; var server = EnvironmentGlobal.CreateGameServer("CommandsTests_Weapon", settings); server.EnableDebugMode(); var gameSession = EnvironmentGlobal.GetSession(server); var spaceship = gameSession.GetPlayerSpaceShip(); var targetSpacecraft = gameSession.GetCelestialObject(1000348945).ToSpaceship(); var module = spaceship.GetWeaponModules().First(); IDebugProperties debug = new DebugProperties(true, true); server.Command(server.SessionId, ModuleCommand.ToJson(gameSession, module.Shot, 1000348945, ((IModule)module).Id, 1)); Assert.AreEqual(1, server.Commands.Count); Assert.AreEqual(200, targetSpacecraft.Shields); Assert.AreEqual(false, targetSpacecraft.IsDestroyed); server.TurnCalculation(10); gameSession = EnvironmentGlobal.GetSession(server); spaceship = gameSession.GetPlayerSpaceShip(); targetSpacecraft = gameSession.GetCelestialObject(1000348945, false).ToSpaceship(); Assert.AreEqual(0, server.Commands.Count); Assert.AreEqual(170, targetSpacecraft.Shields); Assert.AreEqual(false, targetSpacecraft.IsDestroyed); server.Wait(5); server.Command(server.SessionId, ModuleCommand.ToJson(gameSession, module.Shot, 1000348945, ((IModule)module).Id, 1)); server.TurnCalculation(10); gameSession = EnvironmentGlobal.GetSession(server); targetSpacecraft = gameSession.GetCelestialObject(1000348945, false).ToSpaceship(); Assert.AreEqual(140, targetSpacecraft.Shields); Assert.AreEqual(false, targetSpacecraft.IsDestroyed); server.Command(server.SessionId, ModuleCommand.ToJson(gameSession, module.Shot, 1000348945, ((IModule)module).Id, 1)); server.TurnCalculation(10); gameSession = EnvironmentGlobal.GetSession(server); targetSpacecraft = gameSession.GetCelestialObject(1000348945, false).ToSpaceship(); Assert.AreEqual(110, targetSpacecraft.Shields); Assert.AreEqual(false, targetSpacecraft.IsDestroyed); server.Command(server.SessionId, ModuleCommand.ToJson(gameSession, module.Shot, 1000348945, ((IModule)module).Id, 1)); server.TurnCalculation(10); gameSession = EnvironmentGlobal.GetSession(server); targetSpacecraft = gameSession.GetCelestialObject(1000348945, false).ToSpaceship(); Assert.AreEqual(80, targetSpacecraft.Shields); Assert.AreEqual(false, targetSpacecraft.IsDestroyed); server.Command(server.SessionId, ModuleCommand.ToJson(gameSession, module.Shot, 1000348945, ((IModule)module).Id, 1)); server.TurnCalculation(10); gameSession = EnvironmentGlobal.GetSession(server); targetSpacecraft = gameSession.GetCelestialObject(1000348945, false).ToSpaceship(); Assert.AreEqual(50, targetSpacecraft.Shields); Assert.AreEqual(false, targetSpacecraft.IsDestroyed); server.Command(server.SessionId, ModuleCommand.ToJson(gameSession, module.Shot, 1000348945, ((IModule)module).Id, 1)); server.TurnCalculation(10); gameSession = EnvironmentGlobal.GetSession(server); targetSpacecraft = gameSession.GetCelestialObject(1000348945, false).ToSpaceship(); Assert.AreEqual(20, targetSpacecraft.Shields); Assert.AreEqual(false, targetSpacecraft.IsDestroyed); server.Command(server.SessionId, ModuleCommand.ToJson(gameSession, module.Shot, 1000348945, ((IModule)module).Id, 1)); server.TurnCalculation(10); gameSession = EnvironmentGlobal.GetSession(server); targetSpacecraft = gameSession.GetCelestialObject(1000348945, false).ToSpaceship(); Assert.AreEqual(true, targetSpacecraft.IsDestroyed); }