Esempio n. 1
0
        public void ShouldFailIfNoneSet()
        {
            Action act = () => EngineProvider <ITestEngine> .Get();

            act.Should().Throw <InvalidOperationException>()
            .WithMessage("Must select VisualPinball.Engine.Test.Common.ITestEngine engine before retrieving!");
        }
Esempio n. 2
0
        static FipsAes()
        {
            EngineProvider provider = new EngineProvider(null);

            // FSM_STATE:3.AES.0,"AES ENCRYPT DECRYPT KAT", "The module is performing AES encrypt and decrypt KAT self-test"
            // FSM_TRANS:3.AES.0,"POWER ON SELF-TEST", "AES ENCRYPT DECRYPT KAT", "Invoke AES Encrypt/Decrypt KAT self-test"
            provider.CreateEngine(EngineUsage.GENERAL);
            // FSM_TRANS:3.AES.1,"AES ENCRYPT DECRYPT KAT", "POWER ON SELF-TEST", "AES Encrypt / Decrypt KAT self-test successful completion"

            // FSM_STATE:3.AES.1,"CCM GENERATE VERIFY KAT", "The module is performing AES CCM generate and verify KAT self-test"
            // FSM_TRANS:3.AES.2,"POWER ON SELF-TEST", "CCM GENERATE VERIFY KAT",	"Invoke CCM Generate/Verify KAT self-test"
            CcmStartUpTest(provider);
            // FSM_TRANS:3.AES.3, "CCM GENERATE VERIFY KAT", "POWER ON SELF-TEST", "CCM Generate/Verify KAT self-test successful completion"

            // FSM_STATE:3.AES.2,"AES-CMAC GENERATE VERIFY KAT", "The module is performing AES-CMAC generate and verify KAT self-test"
            // FSM_TRANS:3.AES.4, "POWER ON SELF-TEST", "AES-CMAC GENERATE VERIFY KAT", "Invoke CMAC Generate/Verify KAT self-test"
            CMacStartUpTest(provider);
            // FSM_TRANS:3.AES.5, "AES-CMAC GENERATE VERIFY KAT", "POWER ON SELF-TEST", "CMAC Generate/Verify KAT self-test successful completion"

            // FSM_STATE:3.AES.3,"GCM GMAC GENERATE VERIFY KAT", "The module is performing GCM/GMAC generate and verify KAT self-test"
            // FSM_TRANS:3.AES.6,"POWER ON SELF-TEST", "GCM GMAC GENERATE VERIFY KAT",	"Invoke GCM Generate/Verify KAT self-test"
            GcmStartUpTest(provider);
            // FSM_TRANS:3.AES.7, "GCM GMAC GENERATE VERIFY KAT", "POWER ON SELF-TEST", "GCM Generate/Verify KAT self-test successful completion"

            ENGINE_PROVIDER = provider;
        }
Esempio n. 3
0
        public static void Update(ref BulletPhysicsComponent bpc)
        {
            foreach (var entry in _flippers)
            {
                PhyFlipper phyFlipper = entry.Value;
                phyFlipper._FlipperUpdate(ref bpc);

                // debug
                var dbg = EngineProvider <IDebugUI> .Get();

                bool  isChanged = false;
                float sa        = phyFlipper._startAngle * 180.0f / Mathf.PI;
                float se        = phyFlipper._endAngle * 180.0f / Mathf.PI;

                isChanged |= dbg.GetProperty(phyFlipper.dbgPropStartAngle, ref sa);
                isChanged |= dbg.GetProperty(phyFlipper.dbgPropEndAngle, ref se);

                if (isChanged)
                {
                    phyFlipper._startAngle = sa * Mathf.PI / 180.0f;
                    phyFlipper._endAngle   = se * Mathf.PI / 180.0f;

                    HingeConstraint hinge = (HingeConstraint)phyFlipper._constraint;
                    if (phyFlipper.RotationDirection == 1)
                    {
                        hinge.SetLimit(phyFlipper._startAngle, phyFlipper._endAngle, 0.0f);
                    }
                    else
                    {
                        hinge.SetLimit(phyFlipper._endAngle, phyFlipper._startAngle, 0.0f);
                    }
                }
            }
        }
Esempio n. 4
0
        protected void UpdatePhysics(float deltaTime)
        {
            _RemoveVPXPhysicSystems();

            currentTime += (double)deltaTime;
            var    td       = currentTime - simulationTime;
            double stepTime = 1.0 / (double)stepsPerSecond;
            int    steps    = (int)(td * stepsPerSecond);

            if (steps > 0)
            {
                while (steps > 0)
                {
                    Stopwatch stopwatch = new Stopwatch();
                    stopwatch.Start();

                    int executedSteps = World.StepSimulation((float)stepTime, 1, (float)stepTime);
                    _UpdateGameObjects();
                    simulationTime += stepTime * executedSteps;
                    _physicsFrame  += executedSteps;
                    --steps;

                    if (EngineProvider <IDebugUI> .Exists)
                    {
                        EngineProvider <IDebugUI> .Get().OnPhysicsUpdate(simulationTime, 1, (float)stopwatch.Elapsed.TotalMilliseconds);
                    }
                }
            }

            PhyGate.dbg(entityManager);
        }
Esempio n. 5
0
        private async Task RunBasicTest(string path, Version version, bool inProcess, TargetPlatform target)
        {
            var engine = EngineProvider.Get(version, path, null, inProcess, target, true);
            await engine.Initialize(null, _ct);

            await engine.Execute(_basicTestScript, _ct);

            var pyObj = await engine.LoadScript(_basicTestScript, _ct);

            const string param    = "dummy";
            var          resHello = await engine.InvokeMethod(pyObj, "hello", new object[] { param }, _ct);

            Assert.Equal("Hello " + param, engine.Convert(resHello, typeof(string)));

            var resFib = await engine.InvokeMethod(pyObj, "fib", new object[] { 10 }, _ct);

            Assert.Equal(55, engine.Convert(resFib, typeof(int)));

            var resArray = await engine.InvokeMethod(pyObj, "arr", new object[] { 10, 10 }, _ct);

            Assert.Equal(10, ((int[])engine.Convert(resArray, typeof(int[]))).Length);

            var resNoParam = await engine.InvokeMethod(pyObj, "no_param", null, _ct);

            Assert.Equal("no_param", engine.Convert(resNoParam, typeof(string)));

            await engine.Release();
        }
		public BallApi CreateBall(Player player, IBallCreationPosition ballCreator, float radius, float mass)
		{
			// calculate mass and scale
			var m = player.TableToWorld;

			var localPos = ballCreator.GetBallCreationPosition(_table).ToUnityFloat3();
			var localVel = ballCreator.GetBallCreationVelocity(_table).ToUnityFloat3();
			localPos.z += radius;
			//float4x4 model = player.TableToWorld * Matrix4x4.TRS(localPos, Quaternion.identity, new float3(radius));

			var worldPos = m.MultiplyPoint(localPos);
			var scale3 = new Vector3(
				m.GetColumn(0).magnitude,
				m.GetColumn(1).magnitude,
				m.GetColumn(2).magnitude
			);
			var scale = (scale3.x + scale3.y + scale3.z) / 3.0f; // scale is only scale (without radiusfloat now, not vector.
			var material = BallMaterial.CreateMaterial();
			var mesh = GetSphereMesh();

			// create ball entity
			EngineProvider<IPhysicsEngine>.Get()
				.BallCreate(mesh, material, worldPos, localPos, localVel, scale, mass, radius);

			return null;
		}
Esempio n. 7
0
 protected virtual void Start()
 {
     if (EngineProvider <IDebugUI> .Exists)
     {
         EngineProvider <IDebugUI> .Get().Init(this);
     }
 }
Esempio n. 8
0
        private async Task RunTypesTest(string path, Version version, bool inProcess, TargetPlatform target)
        {
            // init engine
            var engine = EngineProvider.Get(version, path, null, inProcess, target, true);
            await engine.Initialize(null, _ct);

            // load test script
            var pyScript = await engine.LoadScript(_typeTestScript, _ct);

            foreach (var typeInfo in _types)
            {
                var    element = typeInfo.Value;
                object array   = Array.CreateInstance(typeInfo.Key, 10);

                // invoke with simple type
                var resObj = await engine.InvokeMethod(pyScript, "dummy", new[] { element }, _ct);

                var simpleType = engine.Convert(resObj, typeInfo.Key);
                Assert.True(typeInfo.Key == simpleType.GetType());

                // invoke with array type
                resObj = await engine.InvokeMethod(pyScript, "dummy", new[] { array }, _ct);

                var arrayType = engine.Convert(resObj, array.GetType());
                Assert.True(array.GetType() == arrayType.GetType());
            }
            await engine.Release();
        }
        public void ManualBallRoller()
        {
            float3 p;

            if (_debugUI.VPE.GetClickCoords(out p))
            {
                EngineProvider <IPhysicsEngine> .Get().BallManualRoll(_lastCreatedBallEntityForManualBallRoller, p);
            }
        }
Esempio n. 10
0
        public static IEngine Create(IEnumerable <IElementType> types, EngineProvider provider)
        {
            //var enginePath = Environment.CurrentDirectory + "\\Engines\\";
            var enginePath = @"C:\_APPLICATION\FEASERVER\ENGINE_\Engines\bin\x64\Debug";

            if (!Directory.Exists(enginePath))
            {
                Directory.CreateDirectory(enginePath);
            }
            Assembly assembly;
            Type     engineType;

            switch (provider)
            {
            case EngineProvider.Cpu:
                assembly   = Assembly.LoadFile(Path.Combine(enginePath, "FeaServer.Engine.Cpu.dll"));
                engineType = assembly.GetType("FeaServer.Engine.CpuEngine", true);
                break;

            case EngineProvider.Cuda:
                assembly   = Assembly.LoadFile(Path.Combine(enginePath, "FeaServer.Engine.Cuda.dll"));
                engineType = assembly.GetType("FeaServer.Engine.CudaEngine", true);
                break;

            case EngineProvider.Managed:
                assembly   = Assembly.LoadFile(Path.Combine(enginePath, "FeaServer.Engine.Managed.dll"));
                engineType = assembly.GetType("FeaServer.Engine.ManagedEngine", true);
                break;

            case EngineProvider.OpenCL_App:
                assembly   = Assembly.LoadFile(Path.Combine(enginePath, "FeaServer.Engine.OpenCL.App.dll"));
                engineType = assembly.GetType("FeaServer.Engine.OpenCLEngine", true);
                break;

            case EngineProvider.OpenCL_Cuda:
                assembly   = Assembly.LoadFile(Path.Combine(enginePath, "FeaServer.Engine.OpenCL.Cuda.dll"));
                engineType = assembly.GetType("FeaServer.Engine.OpenCLEngine", true);
                break;

            default:
                throw new NotImplementedException();
            }
            if (engineType == null)
            {
                throw new InvalidOperationException();
            }
            var engine = (Activator.CreateInstance(engineType) as IEngine);

            //if (types != null)
            //{
            //    var engineTypes = engine.Types;
            //    foreach (var type in types)
            //        engineTypes.Add(type);
            //}
            return(engine);
        }
Esempio n. 11
0
        public void AutomaticVersionDetection(string path, Version version)
        {
            Skip.IfNot(ValidateRuntime(path));
            var target = X64Engines.Any(x => x[0].Equals(path) && x[1].Equals(version))
                ? TargetPlatform.x64
                : TargetPlatform.x86;
            var engine = EngineProvider.Get(Version.Auto, path, null, true, target, true);

            Assert.Equal(engine.Version, version);
        }
Esempio n. 12
0
 public void DelEngine()
 {
     try
     {
         EngineProvider.DeleteEngine();
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 13
0
 public void EngineScore()
 {
     //启动引擎
     EngineProvider.AppKey        = GlobalUser.APPKEY;
     EngineProvider.SecretKey     = GlobalUser.SECRETKEY;
     EngineProvider.ServerUri     = GlobalUser.SERVERURI;
     EngineProvider.ServerTimeout = GlobalUser.SERVERTIMEOUT;
     ES = EngineProvider.GetEngine();
     Log4NetHelper.Info("----------------------------- 引擎 启动 成功-----------------------------");
 }
Esempio n. 14
0
        static public void SliderFloat(string label, DebugFlipperSliderParam param, float min, float max)
        {
            var engine = EngineProvider <IPhysicsEngine> .Get();

            float val = engine.GetFlipperDebugValue(param);

            if (ImGui.SliderFloat(label, ref val, min, max))
            {
                engine.SetFlipperDebugValue(param, val);
            }
        }
        protected void Awake()
        {
            EngineProvider <IPhysicsEngine> .Set(physicsEngineId);

            EngineProvider <IPhysicsEngine> .Get().Init(this);

            if (!string.IsNullOrEmpty(debugUiId))
            {
                EngineProvider <IDebugUI> .Set(debugUiId);
            }
        }
Esempio n. 16
0
 public void Initialize(string path, Version version, string workingFolder)
 {
     try
     {
         _engine = EngineProvider.Get(version, path);
         _engine.Initialize(workingFolder, _ct).Wait();
     }
     catch (Exception ex)
     {
         ExceptionDispatchInfo.Capture(ex.InnerException ?? ex).Throw();
     }
 }
Esempio n. 17
0
 public ElementImage GetImage(EngineProvider provider)
 {
     switch (provider)
     {
         case EngineProvider.Cpu:
             return new ElementImage
             {
                 StateSizeInBytes = 100,
             };
         default:
             throw new NotImplementedException();
     }
 }
Esempio n. 18
0
        void _AddDebugProperties()
        {
            var dbg = EngineProvider <IDebugUI> .Get();

            if (dbgFlippersRoot == -1)
            {
                dbgFlippersRoot = dbg.AddProperty(-1, "Flippers Props", this);
            }

            dbgThisFlipper    = dbg.AddProperty(dbgFlippersRoot, base.name, this);
            dbgPropStartAngle = dbg.AddProperty(dbgThisFlipper, "Start Angle", _startAngle * 180.0f / Mathf.PI);
            dbgPropEndAngle   = dbg.AddProperty(dbgThisFlipper, "End Angle", _endAngle * 180.0f / Mathf.PI);
        }
Esempio n. 19
0
        public ElementImage GetImage(EngineProvider provider)
        {
            switch (provider)
            {
            case EngineProvider.Cpu:
                return(new ElementImage
                {
                    StateSizeInBytes = 100,
                });

            default:
                throw new NotImplementedException();
            }
        }
Esempio n. 20
0
        private async Task RunUnicodeTests(string path, Version version, bool inProcess, TargetPlatform target)
        {
            // init engine
            var engine = EngineProvider.Get(version, path, null, inProcess, target, true);
            await engine.Initialize(null, _ct);

            // load test script
            var pyScript = await engine.LoadScript(_unicodeTestScript, _ct);

            var resNoParam = await engine.InvokeMethod(pyScript, "test", null, _ct);

            Assert.Equal("´©Ãˆ§‰©ù¨ëéüÇïçâèàêÉîôû", engine.Convert(resNoParam, typeof(string)));
            await engine.Release();
        }
Esempio n. 21
0
        public void RegisterFlipper(Flipper flipper, Entity entity, GameObject go)
        {
            var flipperApi = new FlipperApi(flipper, entity, this);

            _tableApi.Flippers[flipper.Name] = flipperApi;
            _initializables.Add(flipperApi);
            _hittables[entity]   = flipperApi;
            _rotatables[entity]  = flipperApi;
            _collidables[entity] = flipperApi;

            if (EngineProvider <IDebugUI> .Exists)
            {
                EngineProvider <IDebugUI> .Get().OnRegisterFlipper(entity, flipper.Name);
            }
        }
Esempio n. 22
0
            internal Service(Key key)
            {
                this.approvedOnlyMode = CryptoServicesRegistrar.IsInApprovedOnlyMode();
                this.keyAlg           = key.Algorithm;
                this.keyBytes         = key.GetKeyBytes();

                IEngineProvider <Internal.IBlockCipher> engineProvider = new EngineProvider(new KeyParameter(keyBytes));

                this.prov = new Provider("FipsTripleDes", engineProvider);

                if (!CryptoServicesRegistrar.IsInApprovedOnlyMode())
                {
                    this.genProvForIV = new TripleDes.ProviderForIV("FipsTripleDes", engineProvider);
                }
            }
Esempio n. 23
0
        public void ShouldProvideIfSet()
        {
            EngineProvider <ITestEngine> .Set("VisualPinball.Engine.Test.Common.TestEngine1");

            var engine = EngineProvider <ITestEngine> .Get();

            engine.Should().NotBeNull();
            engine.Name.Should().Be("Engine 1");

            EngineProvider <ITestEngine> .Set("VisualPinball.Engine.Test.Common.TestEngine2");

            engine = EngineProvider <ITestEngine> .Get();

            engine.Should().NotBeNull();
            engine.Name.Should().Be("Engine 2");
        }
Esempio n. 24
0
        private void AddGetToDebugWindow()
        { 
            var dbg = EngineProvider<IDebugUI>.Get();
            if (dbg != null)
            {
                if (dbgGate == -1)
                    dbgGate = dbg.AddProperty(-1, "Gates", this);

                int me = dbg.AddProperty(dbgGate, base.name, this);
                dbgSa = dbg.AddProperty(me, "start angle", _startAngle.ToDeg());
                dbgEa = dbg.AddProperty(me, "end angle", _endAngle.ToDeg());
                dbgDamping = dbg.AddProperty(me, "damping", body.AngularDamping);
                dbgHa = dbg.AddProperty(me, "angle", 0.0f);
            }

        }
Esempio n. 25
0
        static FipsRsa()
        {
            EngineProvider provider = new EngineProvider();

            // FSM_STATE:3.RSA.0,"RSA SIGN VERIFY KAT", "The module is performing RSA sign and verify KAT self-test"
            // FSM_TRANS:3.RSA.0,"POWER ON SELF-TEST","RSA SIGN VERIFY KAT", "Invoke RSA Sign/Verify KAT self-test"
            rsaSignTest(provider);
            // FSM_TRANS:3.RSA.1,"RSA SIGN VERIFY KAT","POWER ON SELF-TEST", "RSA Sign/Verify KAT self-test successful completion"

            // FSM_STATE:3.RSA.1, "KEY TRANSPORT USING RSA VERIFY KAT", "The module is performing RSA Key Transport verify KAT self-test"
            // FSM_TRANS:3.RSA.2,"POWER ON SELF-TEST","KEY TRANSPORT USING RSA VERIFY KAT", "Invoke Key Transport Using RSA, Specific SP 800-56B KAT self-test"
            rsaKeyTransportTest(provider);
            // FSM_TRANS:3.RSA.3,"KEY TRANSPORT USING RSA VERIFY KAT", "POWER ON SELF-TEST", "Key Transport Using RSA, Specific SP 800-56B KAT self-test successful completion"

            ENGINE_PROVIDER = provider;
        }
Esempio n. 26
0
        protected override void OnUpdate()
        {
            _simulationTime.Restart();

            var sim = World.GetExistingSystem <VisualPinballSimulationSystemGroup>();

            _staticCounts = PhysicsConstants.StaticCnts;
            var dTime    = sim.PhysicsDiffTime;
            var numSteps = 0;

            while (dTime > 0)
            {
                HitTime = (float)dTime;

                ApplyFlipperTime();
                ClearContacts();

                _dynamicBroadPhaseSystem.Update();
                _staticBroadPhaseSystem.Update();
                _staticNarrowPhaseSystem.Update();
                _dynamicNarrowPhaseSystem.Update();

                ApplyStaticTime();

                _displacementSystemGroup.Update();
                _dynamicCollisionSystem.Update();
                _staticCollisionSystem.Update();
                _contactSystem.Update();

                ClearContacts();

                _ballSpinHackSystem.Update();

                dTime -= HitTime;

                SwapBallCollisionHandling = !SwapBallCollisionHandling;
                ++numSteps;
            }

            // debug ui update
            if (EngineProvider <IDebugUI> .Exists)
            {
                PhysicsEngine.UpdateDebugFlipperStates();
                PhysicsEngine.PushPendingCreateBallNotifications();
                EngineProvider <IDebugUI> .Get().OnPhysicsUpdate(sim.CurrentPhysicsTime, numSteps, (float)_simulationTime.Elapsed.TotalMilliseconds);
            }
        }
Esempio n. 27
0
 public static IEngine Create(IEnumerable<IElementType> types, EngineProvider provider)
 {
     //var enginePath = Environment.CurrentDirectory + "\\Engines\\";
     var enginePath = @"C:\_APPLICATION\FEASERVER\ENGINE_\Engines\bin\x64\Debug";
     if (!Directory.Exists(enginePath))
         Directory.CreateDirectory(enginePath);
     Assembly assembly;
     Type engineType;
     switch (provider)
     {
         case EngineProvider.Cpu:
             assembly = Assembly.LoadFile(Path.Combine(enginePath, "FeaServer.Engine.Cpu.dll"));
             engineType = assembly.GetType("FeaServer.Engine.CpuEngine", true);
             break;
         case EngineProvider.Cuda:
             assembly = Assembly.LoadFile(Path.Combine(enginePath, "FeaServer.Engine.Cuda.dll"));
             engineType = assembly.GetType("FeaServer.Engine.CudaEngine", true);
             break;
         case EngineProvider.Managed:
             assembly = Assembly.LoadFile(Path.Combine(enginePath, "FeaServer.Engine.Managed.dll"));
             engineType = assembly.GetType("FeaServer.Engine.ManagedEngine", true);
             break;
         case EngineProvider.OpenCL_App:
             assembly = Assembly.LoadFile(Path.Combine(enginePath, "FeaServer.Engine.OpenCL.App.dll"));
             engineType = assembly.GetType("FeaServer.Engine.OpenCLEngine", true);
             break;
         case EngineProvider.OpenCL_Cuda:
             assembly = Assembly.LoadFile(Path.Combine(enginePath, "FeaServer.Engine.OpenCL.Cuda.dll"));
             engineType = assembly.GetType("FeaServer.Engine.OpenCLEngine", true);
             break;
         default:
             throw new NotImplementedException();
     }
     if (engineType == null)
         throw new InvalidOperationException();
     var engine = (Activator.CreateInstance(engineType) as IEngine);
     //if (types != null)
     //{
     //    var engineTypes = engine.Types;
     //    foreach (var type in types)
     //        engineTypes.Add(type);
     //}
     return engine;
 }
Esempio n. 28
0
        protected override async Task <Action <NativeActivityContext> > ExecuteAsync(NativeActivityContext context, CancellationToken cancellationToken)
        {
            string path = Path.Get(context);

            if (!path.IsNullOrEmpty() && !Directory.Exists(path))
            {
                throw new DirectoryNotFoundException(string.Format(Resources.InvalidPathException, path));
            }

            cancellationToken.ThrowIfCancellationRequested();

            _pythonEngine = EngineProvider.Get(Version, path, !Isolated, TargetPlatform, ShowConsole);

            var workingFolder = WorkingFolder.Get(context);

            if (!workingFolder.IsNullOrEmpty())
            {
                var dir = new DirectoryInfo(workingFolder);
                if (!dir.Exists)
                {
                    throw new DirectoryNotFoundException(Resources.WorkingFolderPathInvalid);
                }
                workingFolder = dir.FullName; //we need to pass an absolute path to the python host
            }

            try
            {
                await _pythonEngine.Initialize(workingFolder, cancellationToken);
            }
            catch (Exception e)
            {
                Trace.TraceError($"Error initializing Python engine: {e.ToString()}");
                Cleanup();
                throw new InvalidOperationException(Resources.PythonInitializeException, e);
            }

            cancellationToken.ThrowIfCancellationRequested();
            return(ctx =>
            {
                ctx.ScheduleAction(Body, _pythonEngine, OnCompleted, OnFaulted);
            });
        }
Esempio n. 29
0
        private void Awake()
        {
            var tableComponent  = gameObject.GetComponent <TableAuthoring>();
            var engineComponent = GetComponent <IGameEngineAuthoring>();

            Table         = tableComponent.CreateTable(tableComponent.Data);
            BallManager   = new BallManager(Table, TableToWorld);
            _inputManager = new InputManager();

            if (engineComponent != null)
            {
                GameEngine = engineComponent.GameEngine;
            }

            EngineProvider <IPhysicsEngine> .Set(physicsEngineId);

            EngineProvider <IPhysicsEngine> .Get().Init(tableComponent, BallManager);

            if (!string.IsNullOrEmpty(debugUiId))
            {
                EngineProvider <IDebugUI> .Set(debugUiId);
            }
        }
Esempio n. 30
0
        /// <summary>
        /// Mains the specified args.
        /// </summary>
        /// <param name="args">The args.</param>
        static void Main(string[] args)
        {
            Console.WriteLine("Start.");
            using (var provider = EngineProvider.CreateProvider())
            {
                //provider.Types.Add(new SimpleType());
                //provider.Objects.Add(new EngineObject { Type = "A", DataMisalignedException  });
                provider.EvaluateFrame(100);
            }

            //using (var timeEngine = new TimeEngine())
            //{
            //    var linkItem = new LinkItem();
            //    linkItem.Action = delegate(TimeEngine.ThreadContext threadContext)
            //    {
            //        threadContext.AddValue(linkItem.Link, TimePrecision.ParseTime(1.0M));
            //        Console.WriteLine(".");
            //    };
            //    timeEngine.AddValue(linkItem.Link, TimePrecision.ParseTime(1.25M));
            //    timeEngine.EvaluateFrame(100);
            //}
            Console.WriteLine("Done.");
        }
Esempio n. 31
0
        public static void dbg(EntityManager entityManager)
        {
            var dbg = EngineProvider<IDebugUI>.Get();
            if (dbg == null)
                return;

            foreach (var gate in _gates)
            {
                bool isLimitChanged = false;

                float sa = 0, ea = 0, damping = 0;

                isLimitChanged |= dbg.GetProperty(gate.dbgSa, ref sa);
                isLimitChanged |= dbg.GetProperty(gate.dbgEa, ref ea);
                if (isLimitChanged)
                    gate._constraint.SetLimit(sa.ToRad(), ea.ToRad(), 0);

                if (dbg.GetProperty(gate.dbgDamping, ref damping))
                    gate.body.SetDamping(damping, damping);
                float ha = gate._constraint.HingeAngle.ToDeg();
                dbg.SetProperty(gate.dbgHa, ha); // we don't read it... only display
            }            
        }
Esempio n. 32
0
        private void DrawEngineSelector <T>(string engineName, ref string engineId, ref T[] instances, ref string[] names, ref int index) where T : IEngine
        {
            if (instances == null)
            {
                // get all instances
                instances = EngineProvider <T> .GetAll().ToArray();

                names = instances.Select(x => x.Name).ToArray();

                // set the current index based on the table's ID
                index = -1;
                for (var i = 0; i < instances.Length; i++)
                {
                    if (EngineProvider <T> .GetId(instances[i]) == engineId)
                    {
                        index = i;
                        break;
                    }
                }
                if (instances.Length > 0 && index < 0)
                {
                    index    = 0;
                    engineId = EngineProvider <T> .GetId(instances[index]);
                }
            }
            if (names.Length == 0)
            {
                return;
            }
            var newIndex = EditorGUILayout.Popup(engineName, index, names);

            if (index != newIndex)
            {
                index    = newIndex;
                engineId = EngineProvider <T> .GetId(instances[newIndex]);
            }
        }
Esempio n. 33
0
 public ElementImage GetImage(EngineProvider provider)
 {
     return new ElementImage { };
 }
Esempio n. 34
0
 public int GetSize(EngineProvider provider)
 {
     return 0;
 }