コード例 #1
0
ファイル: Context.cs プロジェクト: ankushraizada/Dynamo
 public void SetExprInterpreterProperties(int currentBlockID, ProtoCore.Runtime.RuntimeMemory memState, int watchScope, DebugProperties debugProps)
 {
     CurrentBlockId = currentBlockID;
     MemoryState = memState;
     WatchClassScope = watchScope;
     DebugProps = debugProps;
 }
コード例 #2
0
ファイル: Context.cs プロジェクト: zjloscar/Dynamo
 public void SetExprInterpreterProperties(int currentBlockID, ProtoCore.Runtime.RuntimeMemory memState, int watchScope, DebugProperties debugProps)
 {
     CurrentBlockId  = currentBlockID;
     MemoryState     = memState;
     WatchClassScope = watchScope;
     DebugProps      = debugProps;
 }
コード例 #3
0
 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]);
 }
コード例 #4
0
 private static void SetDebugProperty(DebugProperties debugProperty, object value)
 {
     DebugContext.SetProperty(debugProperty, value);
 }
コード例 #5
0
 internal static object GetDebugProperty(DebugProperties debugProperty)
 {
     return(CallContext.LogicalGetData(DebugContext.propertyNames[(int)debugProperty]));
 }
コード例 #6
0
        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);
        }