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); } }
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"); EffectManager.Instance.LoadEffects(content); Schedule(UpdateUI); // Register for touch events var touchListener = new CCEventListenerTouchAllAtOnce(); touchListener.OnTouchesEnded = OnTouchesEnded; AddEventListener(touchListener, this); }
public void Render(VirtualCanvas canvas, GoBus.GoSocket sdSocket) { Joystick.Initialize(GoSockets.Socket3, GoBusIRQHandler); Joystick.Get(); while (true) { canvas.SetOrientation(Orientation.Landscape); canvas.DrawFill(ColorHelpers.GetRGB24toRGB565(255, 212, 42)); canvas.DrawString( 10, 1, ColorHelpers.GetRGB24toRGB565(0, 0, 0), VerdanaBold14.ID, "[Nwazet Playground"); canvas.RenderWidgets(Nwazet.Go.Imaging.Render.All); canvas.WidgetClicked += new WidgetClickedHandler(OnWidgetClicked); canvas.TouchscreenWaitForEvent(); canvas.WidgetClicked -= new WidgetClickedHandler(OnWidgetClicked); canvas.RenderWidgets(Nwazet.Go.Imaging.Render.Dirty); if (TemperatureAndRelayButton.Clicked) { var tempRelay = new TempRelay(); tempRelay.Render(canvas); } else if (ImageGalleryButton.Clicked) { var imageGallery = new ImageGallery(); imageGallery.Render(canvas, sdSocket); } else if (BasicUIButton.Clicked) { var basicUI = new BasicUI(); basicUI.Render(canvas); } else if (LEDMarqueeButton.Clicked) { var ledMarquee = new LEDMarquee(); ledMarquee.Render(canvas); } else if (LEDRGBArtButton.Clicked) { var ledRgbArt = new LEDRGBArt(); ledRgbArt.Render(canvas); } else if (LEDCaptureTheDotButton.Clicked) { var ledCaptureTheDot = new LEDCaptureTheDot(); ledCaptureTheDot.Render(canvas, Joystick); } else if (LEDSignShowcaseButton.Clicked) { var ledSignShowcase = new LEDSignShowcase(); ledSignShowcase.Render(); } canvas.ActivateWidgets(true); } }
public void OnApplicationStart() { // TODO: Remove this migration path at some point var songCoreIniPath = Path.Combine(UnityGame.UserDataPath, nameof(SongCore), "SongCore.ini"); if (File.Exists(songCoreIniPath)) { var modPrefs = new BS_Utils.Utilities.Config("SongCore/SongCore"); Configuration.CustomSongColors = modPrefs.GetBool("SongCore", "customSongColors", true, true); Configuration.CustomSongPlatforms = modPrefs.GetBool("SongCore", "customSongPlatforms", true, true); Configuration.DisplayDiffLabels = modPrefs.GetBool("SongCore", "displayDiffLabels", true, true); Configuration.ForceLongPreviews = modPrefs.GetBool("SongCore", "forceLongPreviews", false, true); //Delete Old Config try { File.Delete(songCoreIniPath); } catch { Logging.Logger.Warn("Failed to delete old config file!"); } } BSMLSettings.instance.AddSettingsMenu("SongCore", "SongCore.UI.settings.bsml", new SCSettingsController()); SceneManager.activeSceneChanged += OnActiveSceneChanged; _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.kyle1413.BeatSaber.SongCore"); BasicUI.GetIcons(); BS_Utils.Utilities.BSEvents.levelSelected += BSEvents_levelSelected; BS_Utils.Utilities.BSEvents.gameSceneLoaded += BSEvents_gameSceneLoaded; BS_Utils.Utilities.BSEvents.lateMenuSceneLoadedFresh += BSEvents_menuSceneLoadedFresh; if (!File.Exists(Collections.DataPath)) { File.Create(Collections.DataPath); } else { Collections.LoadExtraSongData(); } Collections.RegisterCustomCharacteristic(BasicUI.MissingCharIcon !, "Missing Characteristic", "Missing Characteristic", "MissingCharacteristic", "MissingCharacteristic", false, false, 1000); Collections.RegisterCustomCharacteristic(BasicUI.LightshowIcon !, "Lightshow", "Lightshow", "Lightshow", "Lightshow", false, false, 100); Collections.RegisterCustomCharacteristic(BasicUI.ExtraDiffsIcon !, "Lawless", "Lawless - Anything Goes", "Lawless", "Lawless", false, false, 101); var foldersXmlFilePath = Path.Combine(UnityGame.UserDataPath, nameof(SongCore), "folders.xml"); if (!File.Exists(foldersXmlFilePath)) { File.WriteAllBytes(foldersXmlFilePath, Utilities.Utils.GetResource(Assembly.GetExecutingAssembly(), "SongCore.Data.folders.xml")); } Loader.SeperateSongFolders.InsertRange(0, Data.SeperateSongFolder.ReadSeperateFoldersFromFile(foldersXmlFilePath)); }
public void OnApplicationStart() { BSMLSettings.instance.AddSettingsMenu("SongCore", "SongCore.UI.settings.bsml", SCSettings.instance); SceneManager.activeSceneChanged += OnActiveSceneChanged; //Delete Old Config try { var songCoreIniPath = Path.Combine(UnityGame.UserDataPath, "SongCore.ini"); if (File.Exists(songCoreIniPath)) { File.Delete(songCoreIniPath); } } catch { Logging.Logger.Warn("Failed to delete old config file!"); } _harmony = new Harmony("com.kyle1413.BeatSaber.SongCore"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); BasicUI.GetIcons(); BS_Utils.Utilities.BSEvents.levelSelected += BSEvents_levelSelected; BS_Utils.Utilities.BSEvents.gameSceneLoaded += BSEvents_gameSceneLoaded; BS_Utils.Utilities.BSEvents.lateMenuSceneLoadedFresh += BSEvents_menuSceneLoadedFresh; if (!File.Exists(Collections.DataPath)) { File.Create(Collections.DataPath); } else { Collections.LoadExtraSongData(); } Collections.RegisterCustomCharacteristic(BasicUI.MissingCharIcon !, "Missing Characteristic", "Missing Characteristic", "MissingCharacteristic", "MissingCharacteristic", false, false, 1000); Collections.RegisterCustomCharacteristic(BasicUI.LightshowIcon !, "Lightshow", "Lightshow", "Lightshow", "Lightshow", false, false, 100); Collections.RegisterCustomCharacteristic(BasicUI.ExtraDiffsIcon !, "Lawless", "Lawless - Anything Goes", "Lawless", "Lawless", false, false, 101); var foldersXmlFilePath = Path.Combine(UnityGame.UserDataPath, nameof(SongCore), "folders.xml"); if (!File.Exists(foldersXmlFilePath)) { File.WriteAllBytes(foldersXmlFilePath, Utilities.Utils.GetResource(Assembly.GetExecutingAssembly(), "SongCore.Data.folders.xml")); } Loader.SeperateSongFolders.InsertRange(0, Data.SeperateSongFolder.ReadSeperateFoldersFromFile(foldersXmlFilePath)); }
/// <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); }
private void LoadEmptyKeysUI() { FontManager.DefaultFont = Engine.Instance.Renderer.CreateFont(SystemFontLight); Viewport viewport = GraphicsDevice.Viewport; basicUI = new BasicUI(viewport.Width, viewport.Height); // Load View Model viewModel = new BasicUIViewModel(); basicUI.DataContext = viewModel; FontManager.Instance.LoadFonts(Content); // Load Image and Sound content if necessary //ImageManager.Instance.LoadImages(Content); //SoundManager.Instance.LoadSounds(Content); // This replaces MonoGame's Update exit command RelayCommand command = new RelayCommand(new Action <object>(ExitEvent)); KeyBinding keyBinding = new KeyBinding(command, KeyCode.Escape, ModifierKeys.None); basicUI.InputBindings.Add(keyBinding); }
public static void LoadExtensions() { Extension ext = new BasicUI(); extensionList.Add(ext.Priority, ext); foreach (KeyValuePair <int, Extension> extension in extensionList) { extension.Value.loadExtension(); } Application app = new Application(); ///app.StartupUri = new System.Uri("VoidRatsUI.xaml", UriKind.Relative); app.StartupUri = new System.Uri("pack://application:,,,/VoidRatsUIAPI;component/VoidRatsUI.xaml", UriKind.Absolute); ResourceDictionary myResourceDictionary = new ResourceDictionary(); myResourceDictionary.Source = new Uri("BlackCrystal.xaml", UriKind.Relative); app.Resources.MergedDictionaries.Add(myResourceDictionary); app.Run(); }
/// <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; }