Ejemplo n.º 1
0
 public void AddCameraUserControls()
 {
     if (Configuration.physicsCamera)
     {
         physicsCamera = new PhysicsCamera(camera);
         AddPhysicsObject(physicsCamera);
         MovePhysicsObject(physicsCamera, physicsCamera.Frame.LocalToWorld.Matrix);
         physicsCamera.RigidBody.AffectedByGravity = userInterfaceManager.FlyMode ? false : true;
         cameraControls = new PhysicsFpsFrameController();
         (cameraControls as PhysicsFpsFrameController).PhysicsObject = physicsCamera;
     }
     else
     {
         if (Configuration.lockUpVector)
         {
             cameraControls = new HeadingElevationFrameController();
         }
         else
         {
             cameraControls = new FrameController();
         }
         cameraControls.Frame = camera.Frame;
     }
     userInterfaceManager.ConnectUserControls();
 }
Ejemplo n.º 2
0
 public ViewBase(string uri, IAppModel appModel, IFrameController frameController, IFrameConfig frameConfig)
 {
     _Uri            = uri;
     AppModel        = appModel;
     FrameController = frameController;
     FrameConfig     = frameConfig;
 }
Ejemplo n.º 3
0
        private void InitAppWithConfig(IFrameConfig frameConfig)
        {
            if (_FrameController != null)
            {
                _FrameController.Stop();
            }
            _FrameController = new FrameController(frameConfig, new UIDispatchDelegate((a) => UIDispatch.Invoke(a)));
            _ViewManager     = new ViewManager(this, _FrameController, frameConfig);

            ShowDebugInfo = _FrameConfig.ShowDebugInfo;

            _FrameController.CurrentPhotoChanged += (s, e) =>
            {
                CreateAndShowNewView();
            };

            CreateAndShowNewView();

            _FrameController.TimerValueChanged += (s, e) =>
            {
                TimerValue = _FrameController.TimerValue;
            };

            _FrameController.Start();
        }
Ejemplo n.º 4
0
 public static void SetController(Frame holder, IFrameController controller)
 {
     if (controller == null)
     {
         return;
     }
     controller.Holder = holder;
 }
Ejemplo n.º 5
0
        public ViewModelColorize(IFrameController frameController, IFrameConfig config)
            : base(frameController, config)
        {
            var colorizeInfo = frameController.GetNextColorizeInfo();

            Hue        = colorizeInfo.Hue;
            Saturation = colorizeInfo.Saturation;
            Lightness  = colorizeInfo.Lightness;
        }
Ejemplo n.º 6
0
 public ViewModelBase(IFrameController frameController, IFrameConfig config)
 {
     FrameController = frameController;
     FrameConfig     = config;
     ImageUri        = frameController.CurrentPhoto;
     FrameController.CurrentPhotoChanged += FrameController_CurrentPhotoChanged;
     _Counter++;
     Console.WriteLine($"Number of ViewModels: {_Counter}");
 }
Ejemplo n.º 7
0
 public void UpdateFixedStep()
 {
     if (RuntimeConfiguration.gameTest == false)
     {
         IFrameController cameraControls = sceneManager.CameraControls;
         if (userControls != null)
         {
             cameraControls.UpdateFixedStep();
         }
     }
 }
Ejemplo n.º 8
0
        private void HomeCamera(Area area)
        {
            Camera camera = sceneManager.Camera;

            camera.Frame.LocalToParent.Set(
                Matrix4.CreateLookAt(
                    sceneManager.Home,
                    Vector3.Zero,
                    Vector3.UnitY
                    )
                );
            IFrameController cameraControls = sceneManager.CameraControls;

            cameraControls.SetTransform(camera.Frame.LocalToParent.Matrix);
            cameraControls.Clear();
        }
Ejemplo n.º 9
0
        public void UpdateOncePerFrame()
        {
            if (RuntimeConfiguration.gameTest == false)
            {
                IFrameController cameraControls = sceneManager.CameraControls;

                //if(ignore != false)
                {
                    current = OpenTK.Input.Mouse.GetState();
                    if (mouseReset == false && (current != previous))
                    {
                        if (lockMouse && hasMouse && window.Focused)
                        {
                            int   xdelta     = current.X - previous.X;
                            int   ydelta     = current.Y - previous.Y;
                            float wheelDelta = current.WheelPrecise - previous.WheelPrecise;
                            if ((xdelta > 0) || (ydelta > 0) || (xdelta < 0) || (ydelta < 0))
                            {
                                userControls.RotateY.Adjust(-xdelta / 1024.0f);
                                userControls.RotateX.Adjust(-ydelta / 1024.0f);
                                CenterMouse();
                                //System.Console.WriteLine("Mouse delta: " + xdelta + ", " + ydelta);
                            }
                        }
                    }
                    previous = current;
                }
                cameraControls.UpdateOncePerFrame();
            }

            //float wheelNow = window.Mouse.WheelPrecise;
            //float wheelDelta = wheel - wheelNow;
            //wheel = wheelNow;

            var m = materialManager[CurrentMaterial];
            {
                if (m != null)
                {
                    m.Sync();
                }
            }
        }
Ejemplo n.º 10
0
 public void ToggleController()
 {
     if (userControls == sceneManager.CameraControls)
     {
         if (RuntimeConfiguration.gameTest)
         {
             var game = Services.Get <Game>();
             if (game != null)
             {
                 var player = game.Player;
                 if (player != null)
                 {
                     userControls = player.Controller;
                 }
             }
         }
     }
     else
     {
         userControls = sceneManager.CameraControls;
     }
 }
Ejemplo n.º 11
0
 public ViewNormal(IAppModel appModel, IFrameController frameController, IFrameConfig config)
     : base("ViewNormal.qml", appModel, frameController, config)
 {
 }
Ejemplo n.º 12
0
 public TestView(string uri, IAppModel appModel, IFrameController frameController, IFrameConfig config)
     : base(uri, appModel, frameController, config)
 {
     ViewModelMock = Mock.Of <IViewModel>();
 }
Ejemplo n.º 13
0
 public ViewModelNormal(IFrameController frameController, IFrameConfig config)
     : base(frameController, config)
 {
 }
        public SimulationControllerBase(bool load = false, string path = "./model.json", Func <TGroup> generator = null,
                                        SimulationStrategy strategy = SimulationStrategy.Plane)
        {
            if (load)
            {
                switch (strategy)
                {
                case SimulationStrategy.None:
                {
                    Frames = new SimulationNoMemoryFrameController <State>();
                    break;
                }

                case SimulationStrategy.Plane:
                {
                    Frames = new SimulationPlaneFrameController <State>(path);
                    break;
                }

                case SimulationStrategy.Diffs:
                {
                    Frames = new SimulationDiffFrameController <State>(path);
                    break;
                }

                default: throw new ArgumentOutOfRangeException(nameof(strategy), strategy, null);
                }


                state = Load();
            }
            else
            {
                if (generator != null)
                {
                    state.TopGroup = generator();
                }
                else
                {
                    throw new Exception("Bad generator");
                }

                state.RefreshMarks();
                state.TimeStep = state.TopGroup.SetGlobatTransitionTimeScales();

                var fat = state.TopGroup.Descriptor.SubGroups.Values
                          .Traverse(g => g.Value.Descriptor.SubGroups.Values)
                          .SelectMany(g => g.Value.Descriptor.Transitions)
                          .Select(pair => pair.Value).ToList();
                fat.AddRange(state.TopGroup.Descriptor.Transitions.Values);

                Transitions = fat.OrderBy(
                    x =>
                {
                    if (x.Attributes.Any(a => a is PrioretyAttribute))
                    {
                        var pa = (PrioretyAttribute)x.Attributes.First(a => a is PrioretyAttribute);
                        return(pa.Priorety);
                    }

                    return(0);
                }
                    )
                              .ToList();

                if (Transitions
                    .Any(descriptor => !descriptor.Value.CheckActionFunctions()))
                {
                    throw new Exception("Bad Action routing detected");
                }

                switch (strategy)
                {
                case SimulationStrategy.None:
                {
                    Frames = new SimulationNoMemoryFrameController <State>();

                    break;
                }

                case SimulationStrategy.Plane:
                {
                    Frames = new SimulationPlaneFrameController <State>(path, false);

                    break;
                }

                case SimulationStrategy.Diffs:
                {
                    Frames = new SimulationDiffFrameController <State>(path, false);
                    break;
                }

                default: throw new ArgumentOutOfRangeException(nameof(strategy), strategy, null);
                }

                Frames.SaveState(state);
            }
        }
Ejemplo n.º 15
0
 public ViewTestBase()
 {
     _AppModelMock        = Mock.Of <IAppModel>();
     _FrameControllerMock = Mock.Of <IFrameController>();
     _FrameConfigMock     = Mock.Of <IFrameConfig>();
 }
Ejemplo n.º 16
0
 public ViewModelBorder(IFrameController frameController, IFrameConfig config)
     : base(frameController, config)
 {
     BorderColor = ColorToString(FrameController.GetNextBorderColor());
     BorderWidth = FrameConfig.BorderWidth;
 }
Ejemplo n.º 17
0
 public ViewBorder(IAppModel appModel, IFrameController frameController, IFrameConfig config)
     : base("ViewBorder.qml", appModel, frameController, config)
 {
 }
Ejemplo n.º 18
0
 public ViewModelBaseTestClass(IFrameController frameController, IFrameConfig frameConfig)
     : base(frameController, frameConfig)
 {
 }
Ejemplo n.º 19
0
 public ViewModelTestBase()
 {
     _FrameControllerMock = Mock.Of <IFrameController>();
     _FrameConfigMock     = Mock.Of <IFrameConfig>();
 }
Ejemplo n.º 20
0
 public ViewManagerTest()
 {
     _AppModelMock        = Mock.Of <IAppModel>();
     _FrameControllerMock = Mock.Of <IFrameController>();
     _FrameConfigMock     = Mock.Of <IFrameConfig>();
 }
Ejemplo n.º 21
0
 public ViewColorize(IAppModel appModel, IFrameController frameController, IFrameConfig frameConfig)
     : base("ViewColorized.qml", appModel, frameController, frameConfig)
 {
 }
Ejemplo n.º 22
0
 public ViewManager(IAppModel appModel, IFrameController frameController, IFrameConfig frameConfig)
 {
     _appModel        = appModel;
     _frameController = frameController;
     _frameConfig     = frameConfig;
 }