Ejemplo n.º 1
0
        protected override void AddedToScene()
        {
            base.AddedToScene();

            // Use the bounds to layout the positioning of our drawable assets
            var bounds = VisibleBoundsWorldspace;

            ContentManager content = Application.Game.Content;
            content.RootDirectory = Application.ContentRootDirectory;

            SpriteFont font = content.Load<SpriteFont>("fonts/Segoe_UI_10_Regular");
            FontManager.DefaultFont = Engine.Instance.Renderer.CreateFont(font);

            root = new BasicUI((int)bounds.Size.Width, (int)bounds.Size.Height);
            debug = new DebugViewModel(root);
            root.DataContext = new BasicUIViewModel();

            SoundManager.Instance.LoadSounds(content, "sounds");
            ImageManager.Instance.LoadImages(content);
            FontManager.Instance.LoadFonts(content, "fonts");

            Schedule(UpdateUI);

            // Register for touch events
            var touchListener = new CCEventListenerTouchAllAtOnce();
            touchListener.OnTouchesEnded = OnTouchesEnded;
            AddEventListener(touchListener, this);
        }
Ejemplo n.º 2
0
        public override async Task Execute()
        {

            SpriteFont font = await Content.LoadAsync<SpriteFont>("Segoe_UI_10_Regular");
            FontManager.DefaultFont = Engine.Instance.Renderer.CreateFont(font);

            XenkoRenderer.GraphicsContext = Game.GraphicsContext;
            uiRoot = new BasicUI();
            debug = new DebugViewModel(uiRoot);
            uiRoot.DataContext = new BasicUIViewModel();
            
            FontManager.Instance.LoadFonts(Content);
            SoundManager.Instance.LoadSounds(Content);
            ImageManager.Instance.LoadImages(Content);
            EffectManager.Instance.LoadEffects(EffectSystem);
            
            var scene = SceneSystem.SceneInstance.Scene;
            var compositor = ((SceneGraphicsCompositorLayers)scene.Settings.GraphicsCompositor);
            compositor.Master.Renderers.Add(new SceneDelegateRenderer(Render));

            while (Game.IsRunning)
            {
                await Script.NextFrame();
                debug.Update();
                uiRoot.UpdateInput(Game.UpdateTime.Elapsed.TotalMilliseconds);
                uiRoot.UpdateLayout(Game.UpdateTime.Elapsed.TotalMilliseconds);
            }            
        }
Ejemplo n.º 3
0
 private void Window_Loaded(object sender, System.Windows.RoutedEventArgs e)
 {
     if (!DesignerProperties.GetIsInDesignMode(this))
     {
         DebugViewModel = new DebugViewModel();
         DataContext = DebugViewModel;
         DebugViewModel.Initialize();
     }
     Focusable = true;
 }
Ejemplo n.º 4
0
        public FlyoutSettingsViewModel(MainManager mainManager, ILogger logger, DebugViewModel debugViewModel)
        {
            _logger = logger;
            _debugViewModel = debugViewModel;

            MainManager = mainManager;
            Header = "Settings";
            Position = Position.Right;
            GeneralSettings = SettingsProvider.Load<GeneralSettings>();

            LogLevels = new BindableCollection<string>();
            LogLevels.AddRange(LogLevel.AllLoggingLevels.Select(l => l.Name));

            PropertyChanged += KeyboardUpdater;
            mainManager.OnEnabledChangedEvent += MainManagerOnOnEnabledChangedEvent;
            mainManager.EffectManager.OnEffectChangedEvent += EffectManagerOnOnEffectChangedEvent;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Called when the program switches to the screen. This is
        /// where screen assets are loaded and resources are created.
        /// </summary>
        public override void LoadContent()
        {
            InputDevice input = Platform.Instance.InputDevice;
            input.MouseState.Visible = true;

            Font font = BaseGameProgram.Instance.ContentDatabase.Load<Font>("Segoe_UI_10_Regular");
            FontManager.DefaultFont = Engine.Instance.Renderer.CreateFont(font);
            Viewport viewport = Platform.Instance.GraphicsDevice.Viewport;

            basicUI = new BasicUI(viewport.Width, viewport.Height);
            debug = new DebugViewModel(basicUI);
            basicUI.DataContext = new BasicUIViewModel();

            FontManager.Instance.LoadFonts(BaseGameProgram.Instance.ContentDatabase);
            ImageManager.Instance.LoadImages(BaseGameProgram.Instance.ContentDatabase);
            SoundManager.Instance.LoadSounds(BaseGameProgram.Instance.ContentDatabase);

            RelayCommand command = new RelayCommand(new Action<object>(ExitEvent));

            KeyBinding keyBinding = new KeyBinding(command, KeyCode.Escape, ModifierKeys.None);
            basicUI.InputBindings.Add(keyBinding);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            this.IsMouseVisible = true;

            SpriteFont font = Content.Load<SpriteFont>("Segoe_UI_10_Regular");
            FontManager.DefaultFont = Engine.Instance.Renderer.CreateFont(font);
            Viewport viewport = GraphicsDevice.Viewport;
            basicUI = new BasicUI(viewport.Width, viewport.Height);
            viewModel = new BasicUIViewModel();
            viewModel.Tetris = new TetrisController(basicUI.TetrisContainer, basicUI.TetrisNextContainer);
            basicUI.DataContext = viewModel;
            debug = new DebugViewModel(basicUI);

            FontManager.Instance.LoadFonts(Content);
            ImageManager.Instance.LoadImages(Content);
            SoundManager.Instance.LoadSounds(Content);

            RelayCommand command = new RelayCommand(new Action<object>(ExitEvent));

            KeyBinding keyBinding = new KeyBinding(command, KeyCode.Escape, ModifierKeys.None);
            basicUI.InputBindings.Add(keyBinding);

            RelayCommand tetrisLeft = new RelayCommand(new Action<object>(OnLeft));
            KeyBinding left = new KeyBinding(tetrisLeft, KeyCode.A, ModifierKeys.None);
            basicUI.InputBindings.Add(left);

            RelayCommand tetrisRight = new RelayCommand(new Action<object>(OnRight));
            KeyBinding right = new KeyBinding(tetrisRight, KeyCode.D, ModifierKeys.None);
            basicUI.InputBindings.Add(right);

            RelayCommand tetrisDown = new RelayCommand(new Action<object>(OnDown));
            KeyBinding down = new KeyBinding(tetrisDown, KeyCode.S, ModifierKeys.None);
            basicUI.InputBindings.Add(down);

            RelayCommand tetrisRotate = new RelayCommand(new Action<object>(OnRotate));
            KeyBinding rotate = new KeyBinding(tetrisRotate, KeyCode.W, ModifierKeys.None);
            basicUI.InputBindings.Add(rotate);
        }
Ejemplo n.º 7
0
 public PressRockerSwitchUpCommand()
 {
     debugViewModel = MainWindowViewModel.CurrentViewModelDebug;
     remoteVM       = MainWindowViewModel.CurrentViewModelRemoteController;
 }
        public CancelConfirmResetViewModel(IExtendedDeviceInfoService extendedDeviceInfoService, DebugViewModel debug, ICacheService cacheService, ICommonErrorHandler errorHandler, IStateService stateService, INavigationService navigationService, IMTProtoService mtProtoService, ITelegramEventAggregator eventAggregator)
            : base(cacheService, errorHandler, stateService, navigationService, mtProtoService, eventAggregator)
        {
            _extendedDeviceInfoService = extendedDeviceInfoService;
#if DEBUG
            HelpVisibility = Visibility.Visible;
#endif
            _type                 = stateService.Type;
            stateService.Type     = null;
            _nextType             = stateService.NextType;
            stateService.NextType = null;
            Subtitle              = GetSubtitle();

            var length = _type as ILength;
            CodeLength = length != null ? length.Length.Value : Constants.DefaultCodeLength;

            Timeout = stateService.SendCallTimeout;
            ResendCodeVisibility = stateService.SendCallTimeout != null && stateService.SendCallTimeout.Value > 0
                ? Visibility.Collapsed
                : Visibility.Visible;

            UpdateDebugString();

            EventAggregator.Subscribe(this);
            SuppressUpdateStatus = true;

            Debug = debug;

            if (StateService.ChangePhoneNumber)
            {
                _changePhoneNumber             = true;
                StateService.ChangePhoneNumber = false;
            }

            _sentCode             = StateService.SentCode;
            StateService.SentCode = null;

            //_updatesService = updatesService;

            PropertyChanged += (sender, args) =>
            {
                if (Property.NameEquals(args.PropertyName, () => Code))
                {
                    NotifyOfPropertyChange(() => CanConfirm);

                    if (!string.IsNullOrEmpty(Code) && Code.Length == CodeLength)
                    {
                        Confirm();
                    }
                }
            };

            _callTimer.Tick += (sender, args) =>
            {
                _timeCounter = Timeout == null ? 0 : (int)(Timeout.Value - (DateTime.Now - _startTime).TotalSeconds);

                if (_timeCounter > 0)
                {
#if DEBUG
                    TimeCounterString = _timeCounter.ToString(CultureInfo.InvariantCulture);
#endif

                    if (_nextType is TLCodeTypeCall)
                    {
                        TimeCounterString = string.Format(AppResources.WeWillCallYou, TimeSpan.FromSeconds(TimeCounter).ToString(@"m\:ss"));
                    }
                }
                else
                {
                    _timeCounter = 0;
                    if (_nextType is TLCodeTypeCall)
                    {
                        TimeCounterString = AppResources.TelegramDialedYourNumber;
                    }

                    HelpVisibility       = Visibility.Visible;
                    ResendCodeVisibility = Visibility.Visible;
                    _callTimer.Stop();
                }

                NotifyOfPropertyChange(() => TimeCounter);
            };
        }
Ejemplo n.º 9
0
        protected override void LoadContent()
        {
            IsMouseVisible = true;

            FontManager.DefaultFont = Engine.Instance.Renderer.CreateFont(Content.Load<SpriteFont>("Segoe_UI_10_Regular"));

            BasicUI = new BasicUI(Graphics.PreferredBackBufferWidth, Graphics.PreferredBackBufferHeight);
            ViewModel = new BasicUIViewModel();
            BasicUI.DataContext = ViewModel;
            DebugViewMode = new DebugViewModel(BasicUI);

            FontManager.Instance.LoadFonts(Content);
            ImageManager.Instance.LoadImages(Content);
            SoundManager.Instance.LoadSounds(Content);

            BasicUI.InputBindings.Add(new KeyBinding(new RelayCommand(o => Exit()), KeyCode.Escape, ModifierKeys.None));

            SCONClient = new SCONClient(ViewModel);

            base.LoadContent();
        }
 public SetHICommand()
 {
     remoteVM = MainWindowViewModel.CurrentViewModelRemoteController;
     debugVM  = MainWindowViewModel.CurrentViewModelDebug;
 }
Ejemplo n.º 11
0
        public void LoadContent()
        {                  
            SpriteFont font = Content.Load<SpriteFont>("Segoe_UI_10_Regular");
            FontManager.DefaultFont = Engine.Instance.Renderer.CreateFont(font);
            Viewport viewport = device.Viewport;
            mainMenu = new MainMenu(viewport.Width, viewport.Height);
            mainMenu.DataContext = menuModel;
            debug = new DebugViewModel(mainMenu);
            FontManager.Instance.LoadFonts(Content);
            ImageManager.Instance.LoadImages(Content);
            SoundManager.Instance.LoadSounds(Content);

            RelayCommand command = new RelayCommand(new Action<object>(ExitEvent));

            keyBinding = new KeyBinding(command, KeyCode.Escape, ModifierKeys.None);
            mainMenu.InputBindings.Add(keyBinding);
        }
 public EndlessVcUpCommand()
 {
     debugViewModel = MainWindowViewModel.CurrentViewModelDebug;
     remoteVM       = MainWindowViewModel.CurrentViewModelRemoteController;
 }
Ejemplo n.º 13
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            this.IsMouseVisible = true;

            SpriteFont font = Content.Load<SpriteFont>("Segoe_UI_10_Regular");
            FontManager.DefaultFont = Engine.Instance.Renderer.CreateFont(font);
            Viewport viewport = GraphicsDevice.Viewport;
            basicUI = new BasicUI(viewport.Width, viewport.Height);
            viewModel = new BasicUIViewModel();
            viewModel.Tetris = new TetrisController(basicUI.TetrisContainer, basicUI.TetrisNextContainer);
            basicUI.DataContext = viewModel;
            debug = new DebugViewModel(basicUI);

            FontManager.Instance.LoadFonts(Content);
            ImageManager.Instance.LoadImages(Content);
            SoundManager.Instance.LoadSounds(Content);
            EffectManager.Instance.LoadEffects(Content);

            RelayCommand command = new RelayCommand(new Action<object>(ExitEvent));

            KeyBinding keyBinding = new KeyBinding(command, KeyCode.Escape, ModifierKeys.None);
            basicUI.InputBindings.Add(keyBinding);

            RelayCommand tetrisLeft = new RelayCommand(new Action<object>(OnLeft));
            KeyBinding left = new KeyBinding(tetrisLeft, KeyCode.A, ModifierKeys.None);
            basicUI.InputBindings.Add(left);

            RelayCommand tetrisRight = new RelayCommand(new Action<object>(OnRight));
            KeyBinding right = new KeyBinding(tetrisRight, KeyCode.D, ModifierKeys.None);
            basicUI.InputBindings.Add(right);

            RelayCommand tetrisDown = new RelayCommand(new Action<object>(OnDown));
            KeyBinding down = new KeyBinding(tetrisDown, KeyCode.S, ModifierKeys.None);
            basicUI.InputBindings.Add(down);

            RelayCommand tetrisRotate = new RelayCommand(new Action<object>(OnRotate));
            KeyBinding rotate = new KeyBinding(tetrisRotate, KeyCode.W, ModifierKeys.None);
            basicUI.InputBindings.Add(rotate);

            RelayCommand resizeCommand = new RelayCommand(new Action<object>(OnResize));
            KeyBinding resizeBinding = new KeyBinding(resizeCommand, KeyCode.R, ModifierKeys.Control);
            basicUI.InputBindings.Add(resizeBinding);

            renderTarget = new RenderTarget2D(GraphicsDevice,
                100,
                100,
                false,
                GraphicsDevice.PresentationParameters.BackBufferFormat,
                DepthFormat.Depth24Stencil8);

            viewModel.RenderTargetSource = new BitmapImage();
            var texture = Engine.Instance.Renderer.CreateTexture(renderTarget);
            viewModel.RenderTargetSource.Texture = texture;
        }
Ejemplo n.º 14
0
        public ActionResult Index()
        {
            DebugViewModel viewModel = GetDebugViewModel();

            return(View("~/Views/SPRK/Debug/Index.cshtml", viewModel));
        }
Ejemplo n.º 15
0
        public DebugPage()
        {
            InitializeComponent();

            this.BindingContext = this._viewModel = new DebugViewModel();
        }
 public UndetectAudioShoeCommand()
 {
     debugVM  = MainWindowViewModel.CurrentViewModelDebug;
     remoteVM = MainWindowViewModel.CurrentViewModelRemoteController;
 }
Ejemplo n.º 17
0
 public CheckLEDStatusCommand()
 {
     remoteVM = MainWindowViewModel.CurrentViewModelRemoteController;
     debugVM  = MainWindowViewModel.CurrentViewModelDebug;
 }
Ejemplo n.º 18
0
        public void Init(StrategyGame game, Point cameraCentre, bool first = false)
        {
            model = new UIViewModel();
            font = content.Load<SpriteFont>("Segoe_UI_9_Regular");

            if (first)
            {
                ServiceManager.Instance.AddService<ILocalizationService>(new LocalizationService());
                ServiceManager.Instance.AddService<UIlib.UIViewModel.IGameService>(new GameServiceMainGame(this));                       
            }
            FontManager.DefaultFont = Engine.Instance.Renderer.CreateFont(font);

            Viewport viewport = game.GraphicsDevice.Viewport;
            UserInterface = new Root(viewport.Width, viewport.Height);
            UserInterface.DataContext = model;
            debug = new DebugViewModel(UserInterface);

            RelayCommand command = new RelayCommand(new Action<object>(OnEscEvent));
            KeyBinding escapeBinding = new KeyBinding(command, KeyCode.Escape, ModifierKeys.None);
            UserInterface.InputBindings.Add(escapeBinding);

            FontManager.Instance.LoadFonts(content);

            ImageManager.Instance.LoadImages(content);
            SoundManager.Instance.LoadSounds(content);

            centre = new Vector2(cameraCentre.X - Graphics.PreferredBackBufferWidth / 2,
                                cameraCentre.Y - Graphics.PreferredBackBufferHeight / 2);
            zoom = 0.99f;
            oldScrollValue = 0;
            pause = false;
            model.SetUp(StrategyGame.DayLengthHours);
            background = content.Load<Texture2D>("galaxyBackground");
            BackgroundRec = new Rectangle(-500, -500, background.Width, background.Height);
            BackgroundPosition = new Vector2(-500f, -500f);
            zoomedIn = needZoomIn = NeedZoomOut = false;
            currentSector = 1;
        }
 public PressPushButtonCommand()
 {
     debugVM  = MainWindowViewModel.CurrentViewModelDebug;
     remoteVM = MainWindowViewModel.CurrentViewModelRemoteController;
 }