private void InjectionInitialize( IScreenManager screenManager, IEventManager eventManager) { this.screenManager = screenManager; this.eventManager = eventManager; }
public StartScreen(IScreenManager manager) : base(manager) { Background = new BorderBrush(Color.DarkRed); StackPanel stack = new StackPanel(manager); Controls.Add(stack); // Button zur Controls Demo Button controlScreenButton = Button.TextButton(manager, "Controls", "special"); //Button mit speziellen Style erstellen controlScreenButton.LeftMouseClick += (s, e) => //Click Event festlegen { manager.NavigateToScreen(new SplitScreen(manager)); //Screen wechseln }; stack.Controls.Add(controlScreenButton); //Button zu Root hinzufügen // Button zur Mouse Capture Demo Button capturedMouseButton = Button.TextButton(manager, "Captured Mouse", "special"); capturedMouseButton.LeftMouseClick += (s, e) => manager.NavigateToScreen(new MouseCaptureScreen(manager)); stack.Controls.Add(capturedMouseButton); Button tabDemoScreen = Button.TextButton(manager, "Tab Demo", "special"); tabDemoScreen.LeftMouseClick += (s, e) => manager.NavigateToScreen(new TabScreen(manager)); stack.Controls.Add(tabDemoScreen); }
/// <summary> /// Initializes a new instance of the <see cref="SoundScreen"/> class. /// </summary> /// <param name="graphicsManager">The graphics manager.</param> /// <param name="screenManager">The screen manager.</param> public SoundScreen(IBallerburgGraphicsManager graphicsManager, IScreenManager screenManager) : base(graphicsManager, screenManager, "Ballerburg3D") { // Zurück button zurueckMenuEntry = new MenuEntry(this, ResourceLoader.GetString("BackText"), 0) { Position = new Vector2(500, 450) }; zurueckMenuEntry.Selected += ZurueckMenuEntrySelected; musicVolumeSlider = new HSlider(this, new Rectangle(250, 100, 300, 20), screenManager.ApplicationSettings.MusicVolume); musicVolumeSlider.ValueChanged += OnMusicVolumeChanged; soundFxVolumeSlider = new HSlider(this, new Rectangle(250, 200, 300, 20), screenManager.ApplicationSettings.FxVolume); menuEffectsVolumeSlider = new HSlider(this, new Rectangle(250, 300, 300, 20), screenManager.ApplicationSettings.MenuEffectsVolume); var musicList = new List<string> { "DarkStar", "High Tension", "Tentacle", "Death Row", "Boomerang", "Aus" }; musicSelectButton = new ComboToggleButton(this, "Musik", new Collection<string>(musicList), 0, 0) { Position = new Vector2(20, 100) }; musicSelectButton.Selected += OnMusicButtonSelected; toggleMenuEffectsActionButton = new OnOffToggleButton(this, "Menueeffekte", true, 0) { Position = new Vector2(20, 200) }; toggleSoundEffectsActionButton = new OnOffToggleButton(this, "Soundeffekte", true, 0) { Position = new Vector2(20, 300) }; ControlsContainer.Add(zurueckMenuEntry); ControlsContainer.Add(musicVolumeSlider); ControlsContainer.Add(soundFxVolumeSlider); ControlsContainer.Add(menuEffectsVolumeSlider); ControlsContainer.Add(musicSelectButton); ControlsContainer.Add(toggleMenuEffectsActionButton); ControlsContainer.Add(toggleSoundEffectsActionButton); }
/// <summary> /// Base Constructor /// </summary> /// <param name="manager">ScreenManager</param> public TabControl(IScreenManager manager) : base(manager) { Manager = manager; Pages = new ItemCollection<TabPage>(); Pages.OnInsert += OnInsert; Pages.OnRemove += OnRemove; tabControlStack = new StackPanel(manager); tabControlStack.HorizontalAlignment = HorizontalAlignment.Stretch; tabControlStack.VerticalAlignment = VerticalAlignment.Stretch; Content = tabControlStack; tabListStack = new StackPanel(manager); tabListStack.HorizontalAlignment = HorizontalAlignment.Stretch; tabListStack.Orientation = Orientation.Horizontal; tabListStack.Background = TabListBackground; tabControlStack.Controls.Add(tabListStack); tabPage = new ContentControl(manager); tabPage.HorizontalAlignment = HorizontalAlignment.Stretch; tabPage.VerticalAlignment = VerticalAlignment.Stretch; tabPage.Margin = new Border(0, 10, 0, 10); tabPage.Background = TabPageBackground; tabControlStack.Controls.Add(tabPage); tabPage.Margin = new Border(0, -50, 0, 0); ApplySkin(typeof(TabControl)); }
public MouseCaptureScreen(IScreenManager manager) : base(manager) { DefaultMouseMode = MouseMode.Captured; Background = new BorderBrush(Color.Green); StackPanel stack = new StackPanel(manager); Controls.Add(stack); Label title = new Label(manager) { TextColor = Color.White, Text = "Press ESC to return to Main Screen", }; output = new Label(manager) { TextColor = Color.White, Text = position.ToString(), }; stack.Controls.Add(title); stack.Controls.Add(output); }
public Grid(IScreenManager manager, string style = "") : base(manager, style) { Columns = new List<ColumnDefinition>(); Rows = new List<RowDefinition>(); ApplySkin(typeof(Grid)); }
/// <summary> /// Initialisiert einen Standard-Button mit Text-Inhalt /// </summary> /// <param name="text">Enthaltener Text</param> /// <returns>Button-Instanz</returns> public static Button TextButton(IScreenManager manager, string text, string style = "") { return new Button(manager, style) { Content = new Label(manager) { Text = text } }; }
public PreferencesViewModel(ISettingsProvider settingsProvider, IScreenManager screenManager) { this.settingsProvider = settingsProvider; Screens = new ObservableCollection<DetailedScreen>(screenManager.GetScreens()); Settings = settingsProvider.GetSettings<PopupSettings>(); PlaceScreen(); AvailableColors = new ObservableCollection<AvailableColor>(); var properties = typeof(Colors).GetProperties(BindingFlags.Static | BindingFlags.Public); foreach (var prop in properties) { var name = prop.Name; var value = (Color)prop.GetValue(null, null); var availableColor = new AvailableColor(name, value); if (Settings.FontColor == name) FontColor = availableColor; if (Settings.ItemBackgroundColor == name) ItemBackgroundColor = availableColor; AvailableColors.Add(availableColor); } SaveCommand = new DelegateCommand(SaveSettings); ResetToDefaultsCommand = new DelegateCommand(() => settingsProvider.ResetToDefaults<PopupSettings>()); VisitCommand = new DelegateCommand(Visit); }
public Checkbox(IScreenManager manager) : base(manager) { CanFocus = true; TabStop = true; ApplySkin(typeof(Checkbox)); }
public KeyMapper(IScreenManager manager) { manager.KeyDown += KeyDown; manager.KeyUp += KeyUp; manager.KeyPress += KeyPressed; bindings = new Dictionary<string, Binding>(); }
/// <summary> /// Initializes a new instance of the <see cref="MenuScreen"/> class. /// </summary> /// <param name="graphicsManager">The graphics manager.</param> /// <param name="screenManager">The screen manager.</param> /// <param name="menuTitle">The menu title.</param> protected MenuScreen(IBallerburgGraphicsManager graphicsManager, IScreenManager screenManager, string menuTitle) : base(graphicsManager) { this.menuTitle = menuTitle; this.screenManager = screenManager; TransitionOnTime = TimeSpan.FromSeconds(0); TransitionOffTime = TimeSpan.FromSeconds(0); }
/// <summary> /// Initializes a new instance of the <see cref="GraphikScreen"/> class. /// </summary> /// <param name="graphicsManager">The graphics manager.</param> /// <param name="screenManager">The screen manager.</param> public GraphikScreen(IBallerburgGraphicsManager graphicsManager, IScreenManager screenManager) : base(graphicsManager, screenManager, "Ballerburg3D") { // Zurück button zurueckMenuEntry = new MenuEntry(this, ResourceLoader.GetString("BackText"), 0) { Position = new Vector2(500, 450) }; zurueckMenuEntry.Selected += ZurueckMenuEntrySelected; ControlsContainer.Add(zurueckMenuEntry); }
public Button(IScreenManager manager, string style = "") : base(manager, style) { TabStop = true; CanFocus = true; ApplySkin(typeof(Button)); }
public Splitter(IScreenManager manager, string style = "") : base(manager, style) { CanFocus = true; TabStop = true; ApplySkin(typeof(Splitter)); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { _screenManager = new ScreenManager(this); //_screenManager.ActivateScreen(new Screens.TerrainTest(this)); _screenManager.ActivateScreen(new Screens.MainLevel(this)); Components.Add(_screenManager); base.Initialize(); }
public Textbox(IScreenManager manager, string style = "") : base(manager, style) { TextColor = Color.Black; TabStop = true; CanFocus = true; Padding = Border.All(5); ApplySkin(typeof(Textbox)); }
public SplitScreen(IScreenManager manager) : base(manager) { Background = new BorderBrush(Color.Gray); Button backButton = Button.TextButton(manager, "Back"); backButton.HorizontalAlignment = HorizontalAlignment.Left; backButton.VerticalAlignment = VerticalAlignment.Top; backButton.LeftMouseClick += (s, e) => { manager.NavigateBack(); }; Controls.Add(backButton); }
public Slider(IScreenManager manager, string style = "") : base(manager, style) { CanFocus = true; TabStop = true; Range = 100; Value = 50; ApplySkin(typeof(Slider)); }
public ScrollContainer(IScreenManager manager) : base(manager) { HorizontalScrollbarEnabled = false; VerticalScrollbarEnabled = true; HorizontalScrollbarVisible = false; VerticalScrollbarVisible = true; CanFocus = true; TabStop = true; ApplySkin(typeof(ScrollContainer)); }
protected void ShowAttachToServerDialog() { IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>(); screenManager.ShowDialog(Consts.DIALOG_ATTACH_TO_SERVER, (dialogName, instanceId) => { if (_attachInfoDialogHandle == null) { LeaveConfiguration(); } }); }
public StartScreen(IScreenManager manager) : base(manager) { Background = new BorderBrush(Color.DarkRed); Button nextButton = Button.TextButton(manager, "Next", "special"); nextButton.LeftMouseClick += (s, e) => { manager.NavigateToScreen(new SplitScreen(manager)); }; Controls.Add(nextButton); }
protected static void FindSkinAndTheme(out Skin skin, out Theme theme) { IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>(); ISkinResourceBundle bundle = screenManager.CurrentSkinResourceBundle; theme = bundle as Theme; skin = bundle as Skin; if (theme != null) { skin = bundle.InheritedSkinResources as Skin; } }
public Screen(IScreenManager manager) : base(manager) { Manager = manager; IsOverlay = false; InHistory = true; HorizontalAlignment = HorizontalAlignment.Stretch; VerticalAlignment = VerticalAlignment.Stretch; Margin = Border.All(0); Padding = Border.All(20); ApplySkin(typeof(Screen)); }
public SourceClipboardQuantityOverlayViewModel( IScreenManager screenManager, IThreadDelay threadDelay, IEnvironmentInformation environmentInformation, IMainViewModel mainViewModel) { this.screenManager = screenManager; this.threadDelay = threadDelay; this.environmentInformation = environmentInformation; this.mainViewModel = mainViewModel; SetupEvents(); }
public void InitScreens(IRenderer renderer, IScreenManager screenManager) { ScreenManager = screenManager; int width = 1536; int height = 2048; landingScreen = screenManager.CreateScreen(); LandingAreaLayout = landingScreen.CreateLayout(width, height).MakeActive().SetScreenOrientation(ScreenOrientation.Vertical); LandingAreaLayout.LayoutView = new LandingAreaLayout(this, renderer, LandingAreaLayout); ScreenManager.ChangeScreen(landingScreen); }
/// <summary> /// Activates the loading screen. /// </summary> public static void Load(IScreenManager screenManager, bool loadingIsSlow, PlayerIndex? controllingPlayer, params Screen[] screensToLoad) { // Tell all the current screens to transition off. foreach (Screen screen in screenManager.GetScreens()) screen.ExitScreen(); // Create and activate the loading screen. LoadingScreen loadingScreen = new LoadingScreen(loadingIsSlow, screensToLoad); screenManager.AddScreen(loadingScreen, controllingPlayer); }
/// <summary> /// Called from the GUI when the user chooses to leave the party mode. /// </summary> public void QueryLeavePartyMode() { ServiceRegistration.Get <ILogger>().Info("PartyMusicPlayerModel: Request to leave party mode"); if (UseEscapePassword) { IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>(); screenManager.ShowDialog(Consts.DIALOG_QUERY_ESCAPE_PASSWORD); } else { LeavePartyMode(); } }
public PreferencesViewModel(ISettingsProvider settingsProvider, IScreenManager screenManager) { this.settingsProvider = settingsProvider; Screens = new ObservableCollection <DetailedScreen>(screenManager.GetScreens()); Settings = settingsProvider.GetSettings <PopupSettings>(); PlaceScreen(); AvailableColors = new ObservableCollection <AvailableColor>(); var properties = typeof(Colors).GetProperties(BindingFlags.Static | BindingFlags.Public); foreach (var prop in properties) { var name = prop.Name; var value = (Color)prop.GetValue(null, null); var availableColor = new AvailableColor(name, value); if (Settings.FontColor == name) { FontColor = availableColor; } if (Settings.ItemBackgroundColor == name) { ItemBackgroundColor = availableColor; } if (Settings.LeftClickColor == name) { LeftClickColor = availableColor; } if (Settings.RightClickColor == name) { RightClickColor = availableColor; } AvailableColors.Add(availableColor); } if (LeftClickColor == null) { LeftClickColor = new AvailableColor("OrangeRed", Colors.OrangeRed); } if (RightClickColor == null) { RightClickColor = new AvailableColor("RoyalBlue", Colors.RoyalBlue); } SaveCommand = new DelegateCommand(SaveSettings); ResetToDefaultsCommand = new DelegateCommand(() => settingsProvider.ResetToDefaults <PopupSettings>()); VisitCommand = new DelegateCommand(Visit); }
public void ShowBusyScreen() { lock (_syncObj) { _busyScreenRequests++; if (_busyScreenRequests != 1) { return; } } IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>(); screenManager.SetSuperLayer(BUSY_CURSOR_SCREEN_NAME); }
/// <summary> /// Creates an instance of the LoadGameManagerScreen class /// </summary> /// <param name="graphics">The Graphicsdevicemanager of the game</param> /// <param name="director">The Director of the game</param> /// <param name="content">The Contentmanager of the game</param> /// <param name="screenResolution">Screen resolution of the game.</param> /// <param name="screenManager">Stack screen manager of the game.</param> /// <param name="game">Used to pass on to the options screen to change game settings</param> public LoadGameManagerScreen(GraphicsDeviceManager graphics, ref Director director, ContentManager content, Vector2 screenResolution, IScreenManager screenManager, Game1 game) { mScreenManager = screenManager; mGame = game; mGraphics = graphics; mDirector = director; mContent = content; sPressed = "None"; sResolutionChanged = false; mGameLoaded = false; mNewGame = false; mName = ""; }
public static List<CrewMember> getCrew(IScreenManager manager) { using (Stream stream = File.Open("./Assets/OctoAwesome.Client/Crew/crew.xml", FileMode.Open, FileAccess.Read)) { try { XmlSerializer serializer = new XmlSerializer(typeof(List<CrewMember>)); return (List<CrewMember>)serializer.Deserialize(stream); } catch { } return new List<CrewMember>(); } }
/// <summary> /// Shows an info dialog that the server with the given <see cref="sd"/> was attached. /// </summary> /// <param name="sd">Descriptor of the server whose information should be shown.</param> protected void ShowAttachInformationDialogAndClose(ServerDescriptor sd) { IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>(); IDialogManager dialogManager = ServiceRegistration.Get <IDialogManager>(); _attachInfoDialogHandle = Guid.Empty; // Set this to value != null here to make the attachment dialog's close handler know we are not finished in our WF-state screenManager.CloseTopmostDialog(); string header = LocalizationHelper.Translate(Consts.RES_ATTACH_INFO_DIALOG_HEADER); string text = LocalizationHelper.Translate(Consts.RES_ATTACH_INFO_DIALOG_TEXT, sd.ServerName, sd.GetPreferredLink().HostName); Guid handle = dialogManager.ShowDialog(header, text, DialogType.OkDialog, false, DialogButtonType.Ok); lock (_syncObj) _attachInfoDialogHandle = handle; }
protected void CheckResumeMenuInternal(MediaItem item) { IResumeState resumeState = null; IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>(); if (userProfileDataManagement.IsValidUser) { string resumeStateString; if (userProfileDataManagement.UserProfileDataManagement.GetUserMediaItemData(userProfileDataManagement.CurrentUser.ProfileId, item.MediaItemId, PlayerContext.KEY_RESUME_STATE, out resumeStateString)) { resumeState = ResumeStateBase.Deserialize(resumeStateString); } } if (resumeState == null) { // Asynchronously leave the current workflow state because we're called from a workflow model method IThreadPool threadPool = ServiceRegistration.Get <IThreadPool>(); threadPool.Add(() => { LeaveCheckResumePlaybackSingleItemState(); PlayItem(item); }); return; } _playMenuItems = new ItemsList(); ListItem resumeItem = new ListItem(Consts.KEY_NAME, Consts.RES_PLAYBACK_RESUME) { Command = new MethodDelegateCommand(() => { LeaveCheckResumePlaybackSingleItemState(); PlayItem(item, resumeState); }) }; _playMenuItems.Add(resumeItem); ListItem playItem = new ListItem(Consts.KEY_NAME, Consts.RES_PLAYBACK_FROMSTART) { Command = new MethodDelegateCommand(() => { LeaveCheckResumePlaybackSingleItemState(); PlayItem(item); }) }; _playMenuItems.Add(playItem); IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>(); screenManager.ShowDialog(Consts.DIALOG_PLAY_MENU, (dialogName, dialogInstanceId) => LeaveCheckResumePlaybackSingleItemState()); }
/// <summary> /// Initializes the <see cref="ClientSockets"/> instance. This only needs to be called once. /// </summary> /// <param name="screenManager">The <see cref="IScreenManager"/> instance.</param> /// <exception cref="ArgumentNullException"><see cref="screenManager"/> is null.</exception> public static void Initialize(IScreenManager screenManager) { if (screenManager == null) { throw new ArgumentNullException("screenManager"); } if (Instance != null) { return; } _instance = new ClientSockets(screenManager); }
/// <summary> /// Creates an instance of the GamePauseManagerScreen class /// </summary> /// <param name="screenResolution">Screen resolution of the game.</param> /// <param name="screenManager">Stack screen manager of the game.</param> /// <param name="director">Director of the game.</param> public GamePauseManagerScreen(Vector2 screenResolution, IScreenManager screenManager, Director director) { mScreenManager = screenManager; mDirector = director; mScreenResolution = screenResolution; Initialize(screenResolution, director); mScreenState = EScreen.GamePauseScreen; sPressed = "None"; mTransitionState = 0; }
public static List <CrewMember> getCrew(IScreenManager manager) { using (Stream stream = File.Open("./Assets/OctoAwesome.Client/Crew/crew.xml", FileMode.Open, FileAccess.Read)) { try { XmlSerializer serializer = new XmlSerializer(typeof(List <CrewMember>)); return((List <CrewMember>)serializer.Deserialize(stream)); } catch { } return(new List <CrewMember>()); } }
// Constructor public Engine(IAssetManager assetManager, IInputManager inputManager, IScreenManager screenManager, ITimeManager timeManager, ISceneManager sceneManager, IRenderManager renderManager, IDebugManager debugManager) { // Managers _assetManager = assetManager as IAssetManagerInternal; _inputManager = inputManager as IInputManagerInternal; _screenManager = screenManager as IScreenManagerInternal; _timeManager = timeManager as ITimeManagerInternal; _sceneManager = sceneManager as ISceneManagerInternal; _renderManager = renderManager as IRenderManagerInternal; _debugManager = debugManager as IDebugManagerInternal; Instance = this; }
public Control(IScreenManager manager, string style = "") { if (manager == null) throw new ArgumentNullException("manager"); ScreenManager = manager; Style = style; children = new ControlCollection(this); children.OnInsert += ControlCollectionInsert; children.OnRemove += ControlCollectionRemove; ApplySkin(typeof(Control)); }
/// <summary> /// Initializes a new instance of the <see cref="GameScreen"/> class. /// </summary> /// <param name="screenManager">The <see cref="IScreenManager"/> to add this <see cref="GameScreen"/> to.</param> /// <param name="name">Unique name of the screen that can be used to identify and /// call it from other screens</param> /// <exception cref="ArgumentNullException"><paramref name="screenManager"/> is null.</exception> /// <exception cref="ArgumentNullException"><paramref name="name"/> is null or empty.</exception> protected GameScreen(IScreenManager screenManager, string name) { if (screenManager == null) throw new ArgumentNullException("screenManager"); if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); _screenManager = screenManager; _name = name; var font = GetScreenManagerFont(ScreenManager) ?? screenManager.DefaultFont; _guiManager = ScreenManager.CreateGUIManager(font); screenManager.Add(this); }
/// <summary> /// Creates an instance of the MainMenuManagerScreen class /// </summary> /// <param name="screenResolution">Screen resolution of the game.</param> /// <param name="screenManager">Stack screen manager of the game.</param> /// <param name="director">The director of the game.</param> /// <param name="showSplash">Defines if the splash screen should be shown /// (used when going back to main menu from within the game where showing the /// splash screen would not be necessary).</param> /// <param name="game">Used to pass on to the options screen to change game settings</param> public MainMenuManagerScreen(Vector2 screenResolution, IScreenManager screenManager, ref Director director, bool showSplash, Game1 game) { mScreenManager = screenManager; mGame = game; mDirector = director; Initialize(screenResolution, false, showSplash, game); mScreenState = showSplash ? EScreen.SplashScreen : EScreen.MainMenuScreen; sPressed = "None"; sResolutionChanged = false; mTransitionState = 0; }
protected bool UpdateScreen() { IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>(); if (_screenName != null) { if (!screenManager.CheckScreen(_screenName, !_backgroundDisabled).HasValue) { // If the opened screen is not present or erroneous, we cannot update the screen return(false); } } screenManager.BackgroundDisabled = _backgroundDisabled; return(true); }
public Screen(IScreenManager manager) : base(manager) { Manager = manager; IsOverlay = false; InHistory = true; IsVisibleScreen = false; IsActiveScreen = false; DefaultMouseMode = MouseMode.Free; HorizontalAlignment = HorizontalAlignment.Stretch; VerticalAlignment = VerticalAlignment.Stretch; Margin = Border.All(0); Padding = Border.All(20); ApplySkin(typeof(Screen)); }
/// <summary> /// Activates the loading screen. /// </summary> public static void Load(IScreenManager screenManager, bool loadingIsSlow, PlayerIndex?controllingPlayer, params Screen[] screensToLoad) { // Tell all the current screens to transition off. foreach (Screen screen in screenManager.GetScreens()) { screen.ExitScreen(); } // Create and activate the loading screen. LoadingScreen loadingScreen = new LoadingScreen(loadingIsSlow, screensToLoad); screenManager.AddScreen(loadingScreen, controllingPlayer); }
internal Game1() { mGraphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; LoadConfig(); mGraphicsAdapter = GraphicsAdapter.DefaultAdapter; mDirector = new Director(Content, mGraphics, mInstance); mScreenManager = new StackScreenManager(Content, mDirector.GetInputManager); mDirector.GetStoryManager.SetScreenManager(mScreenManager); }
public ScreenChoiceView( IViewManager viewManager, IScreenManager screenManager, ILiveOptions <ApplicationConfiguration> liveOptions, IApplicationLauncher applicationLauncher) { this.viewManager = viewManager.ThrowIfNull(nameof(viewManager)); this.screenManager = screenManager.ThrowIfNull(nameof(screenManager)); this.liveOptions = liveOptions.ThrowIfNull(nameof(liveOptions)); this.applicationLauncher = applicationLauncher.ThrowIfNull(nameof(applicationLauncher)); this.InitializeComponent(); this.selectedId = this.liveOptions.Value.DesiredGuildwarsScreen; this.CanTest = applicationLauncher.IsGuildwarsRunning; this.SetupView(); }
public TabScreen(IScreenManager manager) : base(manager) { //Create Tab Pages TabPage tabPage = new TabPage(manager, "Tab 1"); TabPage tabPage2 = new TabPage(manager, "Tab 2"); TabPage tabPage3 = new TabPage(manager, "Tab 3"); //Create Tab Control & Add Pages TabControl tab = new TabControl(manager); tab.Pages.Add(tabPage); tab.Pages.Add(tabPage2); tab.Pages.Add(tabPage3); tab.VerticalAlignment = VerticalAlignment.Stretch; tab.HorizontalAlignment = HorizontalAlignment.Stretch; //Add Text to Page 1 tabPage.Controls.Add(new Label(manager) { Text = "Content on Page 1" }); //Add "Create Tab" to page 2 Button createPage = Button.TextButton(manager, "Create Tab"); createPage.LeftMouseClick += (s, e) => { TabPage page = new TabPage(manager, "NEW TAB"); page.Controls.Add(new Label(manager) { Text = "This is a new tab page" }); tab.Pages.Add(page); }; tabPage2.Controls.Add(createPage); //Add "Remove this page" to page 3 Button removePage3 = Button.TextButton(manager, "Remove this Page"); removePage3.LeftMouseClick += (s, e) => { tab.Pages.Remove(tabPage3); }; tabPage3.Controls.Add(removePage3); Controls.Add(tab); }
private void OnApplicationIdle(object sender, EventArgs e) { try { // Screen saver IInputManager inputManager = ServiceRegistration.Get <IInputManager>(); // Remember old state, calls to IScreenManager are only required on state changes bool wasScreenSaverActive = _isScreenSaverActive; if (_isScreenSaverEnabled) { IPlayerManager playerManager = ServiceRegistration.Get <IPlayerManager>(); IPlayerContextManager playerContextManager = ServiceRegistration.Get <IPlayerContextManager>(); IPlayer primaryPlayer = playerManager[PlayerManagerConsts.PRIMARY_SLOT]; IMediaPlaybackControl mbc = primaryPlayer as IMediaPlaybackControl; bool preventScreenSaver = ((primaryPlayer is IVideoPlayer || primaryPlayer is IImagePlayer) && (mbc == null || !mbc.IsPaused)) || playerContextManager.IsFullscreenContentWorkflowStateActive; _isScreenSaverActive = !preventScreenSaver && SkinContext.FrameRenderingStartTime - inputManager.LastMouseUsageTime > _screenSaverTimeOut && SkinContext.FrameRenderingStartTime - inputManager.LastInputTime > _screenSaverTimeOut; if (_screenSaverController != null) { bool?activeOverride = _screenSaverController.IsScreenSaverActiveOverride; if (activeOverride.HasValue) { _isScreenSaverActive = activeOverride.Value; } } } else { _isScreenSaverActive = false; } if (wasScreenSaverActive != _isScreenSaverActive) { IScreenManager superLayerManager = ServiceRegistration.Get <IScreenManager>(); superLayerManager.SetSuperLayer(_isScreenSaverActive ? SCREEN_SAVER_SCREEN : null); } // If we are in fullscreen mode, we may control the mouse cursor, else reset it to visible state, if state was switched ShowMouseCursor(!IsFullScreen || inputManager.IsMouseUsed); } catch (Exception ex) { ServiceRegistration.Get <ILogger>().Error("SkinEngine MainForm: Error occured in Idle handler", ex); } }
/// <summary> /// Creates the <see cref="Control"/>s for the primary menu links. /// </summary> /// <param name="screenManager">The <see cref="IScreenManager"/> for the screen.</param> /// <param name="parent">The parent control to attach the buttons to.</param> /// <param name="names">The unique name of the buttons.</param> /// <returns> /// The menu <see cref="Control"/>s, where the unique name is the key and the <see cref="Control"/> instance /// is the value. /// </returns> public static IDictionary <string, Control> CreateMenuButtons(IScreenManager screenManager, Control parent, params string[] names) { // The offset from the side of the screen var baseOffset = new Vector2(25f); // The spacing between each button const float spacing = 10f; var clientSize = parent == null ? screenManager.ScreenSize : parent.ClientSize; var sumSize = 0f; var ret = new Dictionary <string, Control>(StringComparer.OrdinalIgnoreCase); // Create each button in reverse (so the items at the end of the list end up at the bottom) for (var i = names.Length - 1; i >= 0; i--) { // Create the button var c = new MenuButton(parent, Vector2.One) { Text = names[i] }; // Measure the size of the text var textSize = c.Font.MeasureString(c.Text); // Get the position var newPos = (clientSize - baseOffset - textSize); // Offset on the y-axis by the sum size newPos.Y -= sumSize; // Update the sumSize sumSize += textSize.Y + spacing; // Set the new position c.Position = newPos; // Add to the return collection ret.Add(names[i], c); if (log.IsDebugEnabled) { log.DebugFormat("Created menu button `{0}`.", c.Text); } } return(ret); }
public static void ShowDialog(string title, ItemsList list) { var wf = ServiceRegistration.Get <IWorkflowManager>(); SlimTvExtScheduleModel model = wf.GetModel(SlimTvExtScheduleModel.MODEL_ID) as SlimTvExtScheduleModel; model.InitModel(); model.DialogHeader = title; model._dialogActionsList.Clear(); foreach (ListItem i in list) // ItemsList doesn't have AddRange method :-( { model._dialogActionsList.Add(i); } IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>(); screenManager.ShowDialog("DialogExtSchedule"); }
public Listbox(IScreenManager manager) : base(manager) { ScrollContainer = new ScrollContainer(manager) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, }; Children.Add(ScrollContainer); StackPanel = new StackPanel(manager); Orientation = Orientation.Vertical; ScrollContainer.Content = StackPanel; ApplySkin(typeof(Listbox <T>)); }
void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == WorkflowManagerMessaging.CHANNEL) { if ((WorkflowManagerMessaging.MessageType)message.MessageType == WorkflowManagerMessaging.MessageType.StatePushed) { var workflowManager = ServiceRegistration.Get <IWorkflowManager>(); var isHomeScreen = workflowManager.CurrentNavigationContext.WorkflowState.StateId.ToString().Equals("7F702D9C-F2DD-42da-9ED8-0BA92F07787F", StringComparison.OrdinalIgnoreCase); if (isHomeScreen) { // Show Dialog IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>(); screenManager.ShowDialog("whats-new"); } } } }
/// <summary> /// Initializes a new instance of the <see cref="ClientSockets"/> class. /// </summary> /// <param name="screenManager">The <see cref="IScreenManager"/> instance.</param> /// <exception cref="MethodAccessException">An instance of this object has already been created.</exception> ClientSockets(IScreenManager screenManager) : base(CommonConfig.NetworkAppIdentifier) { if (_instance != null) throw new MethodAccessException("ClientSockets instance was already created. Use that instead."); _screenManager = screenManager; _packetHandler = new ClientPacketHandler(this, ScreenManager, DynamicEntityFactory.Instance); // When debugging, use the StatMessageProcessorManager instead (same thing as the other, but provides network statistics) #if DEBUG var m = new StatMessageProcessorManager(_packetHandler, EnumHelper<ServerPacketID>.BitsRequired); m.Stats.EnableFileOutput(ContentPaths.Build.Root.Join("netstats_in" + EngineSettings.DataFileSuffix)); _messageProcessorManager = m; #else _messageProcessorManager = new MessageProcessorManager(_packetHandler, EnumHelper<ServerPacketID>.BitsRequired); #endif }
protected BasicLevel(GraphicsDeviceManager graphics, ref Director director, ContentManager content, IScreenManager screenmanager, LevelType level, IArtificalIntelligence ai) { mDirector = director; mDirector.GetStoryManager.SetLevelType(level, this); mDirector.GetStoryManager.LoadAchievements(); mGraphics = graphics; mScreenManager = screenmanager; Screen = EScreen.GameScreen; Ai = ai; StandardInitialization(content); }
/// <summary> /// Initializes a new instance of the <see cref="StartScreen"/> class. /// </summary> /// <param name="graphicsManager">The graphics manager.</param> /// <param name="screenManager">The screen manager.</param> public StartScreen(IBallerburgGraphicsManager graphicsManager, IScreenManager screenManager) : base(graphicsManager, screenManager, "Ballerburg3D") { // Create our menu entries. spielStartenMenuEntry = new MenuEntry(this, "Spiel starten", 0) { Position = new Vector2(100, 150) }; spielerVerbindenMenuEntry = new MenuEntry(this, "Spieler verbinden", 1) { Position = new Vector2(100, 150 + 50) }; beendenMenuEntry = new MenuEntry(this, "Beenden", 2) { Position = new Vector2(100, 150 + 100) }; // Hook up menu event handlers. spielStartenMenuEntry.Selected += SpielStartenMenuEntrySelected; spielerVerbindenMenuEntry.Selected += SpielerVerbindenMenuEntrySelected; beendenMenuEntry.Selected += OnCancel; ControlsContainer.Add(spielStartenMenuEntry); ControlsContainer.Add(spielerVerbindenMenuEntry); ControlsContainer.Add(beendenMenuEntry); }
private void Init(IGameManagerService gameManagerService, IScreenManager screenManager, IPlayerModel playerModel) { _gameManagerService = gameManagerService; _screenManager = screenManager; _playerModel = playerModel; _gameManagerService.Splashed += OnSplashed; _gameManagerService.CardUpdate += OnCardUpdate; _pointsText.text = _totalPoints.ToString(PointsFormat); var showMaxRecord = _playerModel.HumanRecord > 0; _cupImage.SetActive(showMaxRecord); _maxRecordText.gameObject.SetActive(showMaxRecord); _maxRecordText.text = _playerModel.HumanRecord.ToString(PointsFormat); }
public void ReloadContent(ContentManager content, GraphicsDeviceManager graphics, ref Director director, IScreenManager screenmanager) { mScreenManager = screenmanager; mGraphics = graphics; //Load stuff var platformConeTexture = content.Load <Texture2D>("Cones"); var platformCylTexture = content.Load <Texture2D>("Cylinders"); var platformBlankTexture = content.Load <Texture2D>("PlatformBasic"); var platformDomeTexture = content.Load <Texture2D>("Dome"); MilitaryUnit.mMilSheet = content.Load <Texture2D>("UnitSpriteSheet"); MilitaryUnit.mGlowTexture = content.Load <Texture2D>("UnitGlowSprite"); var mapBackground = content.Load <Texture2D>("backgroundGrid"); var libSans12 = content.Load <SpriteFont>("LibSans12"); PlatformFactory.Init(platformConeTexture, platformCylTexture, platformDomeTexture, platformBlankTexture, libSans12); PlatformBlank.mLibSans12 = libSans12; director.ReloadContent(mDirector, Map.GetMeasurements(), content, mGraphics); mDirector = director; //Map related stuff Camera.ReloadContent(mGraphics, ref mDirector); mFow.ReloadContent(mGraphics, Camera); Ui = new UserInterfaceScreen(ref mDirector, Map, Camera, mScreenManager); Ui.LoadContent(content); Ui.Loaded = true; //This has to be after ui creation, because the ui graphid dictionary is updated in the structuremap.reloadcontent method Map.ReloadContent(mapBackground, Camera, mFow, ref mDirector, content, Ui); GameScreen.ReloadContent(content, graphics, Map, mFow, Camera, ref mDirector, Ui); mDirector.GetUserInterfaceController.ReloadContent(ref mDirector); mDirector.GetUserInterfaceController.ControlledUserInterface = Ui; // the UI needs to be added to the controller // Reload map for the military manager var map = Map; director.GetMilitaryManager.ReloadSetMap(ref map); // the input manager keeps this from not getting collected by the GC mDebugscreen = new DebugScreen((StackScreenManager)mScreenManager, Camera, Map, ref mDirector); mDirector.GetInputManager.FlagForAddition(this); //AI Stuff Ai?.ReloadContent(ref mDirector); StructureLayoutHolder.Initialize(ref mDirector); }
public void HideBusyScreen() { lock (_syncObj) { _busyScreenRequests--; if (_busyScreenRequests < 0) { _busyScreenRequests = 0; throw new IllegalCallException("Busy screen should be hidden but is not visible"); } if (_busyScreenRequests != 0) { return; } } IScreenManager screenManager = ServiceRegistration.Get <IScreenManager>(); screenManager.SetSuperLayer(_currentSuperLayerName); }
/// <summary> /// Initializes a new instance of the <see cref="ClientPacketHandler"/> class. /// </summary> /// <param name="networkSender">The socket sender.</param> /// <param name="screenManager">The <see cref="IScreenManager"/>.</param> /// <param name="dynamicEntityFactory">The <see cref="IDynamicEntityFactory"/> used to serialize /// <see cref="DynamicEntity"/>s.</param> /// <exception cref="ArgumentNullException"><paramref name="dynamicEntityFactory" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException"><paramref name="screenManager" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException"><paramref name="networkSender" /> is <c>null</c>.</exception> public ClientPacketHandler(INetworkSender networkSender, IScreenManager screenManager, IDynamicEntityFactory dynamicEntityFactory) { if (dynamicEntityFactory == null) throw new ArgumentNullException("dynamicEntityFactory"); if (screenManager == null) throw new ArgumentNullException("screenManager"); if (networkSender == null) throw new ArgumentNullException("networkSender"); _networkSender = networkSender; _dynamicEntityFactory = dynamicEntityFactory; _screenManager = screenManager; _peerTradeInfoHandler = new ClientPeerTradeInfoHandler(networkSender); _peerTradeInfoHandler.GameMessageCallback += PeerTradeInfoHandler_GameMessageCallback; _objGrabber = new ObjGrabber(this); }
public GameManager( EntityWorld world, SpriteBatch spriteBatch, IGraphicsManager graphicsManager, ISystemLoader systemLoader, IScreenManager screenManager, IScreenFactory screenFactory, IInputManager inputManager, ICameraManager cameraManager, IScriptManager scriptManager ) { _world = world; _spriteBatch = spriteBatch; _graphicsManager = graphicsManager; _systemLoader = systemLoader; _screenManager = screenManager; _screenFactory = screenFactory; _inputManager = inputManager; _cameraManager = cameraManager; _scriptManager = scriptManager; }
/// <summary> /// Initializes a new instance of the <see cref="SpielerDialogScreen"/> class. /// </summary> /// <param name="graphicsManager">The GraphicsManager</param> /// <param name="screenManager">The screen manager.</param> /// <param name="spielerNr">The spieler nr.</param> /// <param name="playerSettings">The player settings.</param> public SpielerDialogScreen(IBallerburgGraphicsManager graphicsManager, IScreenManager screenManager, int spielerNr, PlayerSettings playerSettings) : base(graphicsManager, screenManager, "Spieler" + spielerNr.ToString() + " Dialog") { this.playerSettings = playerSettings; // Zurück button zurueckMenuEntry = new MenuEntry(this, ResourceLoader.GetString("BackText"), 0) { Position = new Vector2(500, 450) }; zurueckMenuEntry.Selected += ZurueckMenuEntrySelected; castleType = screenManager.PlayerSettings[spielerNr - 1].Castle.CastleType; var selectedEntry = 0; if (screenManager.PlayerSettings[spielerNr - 1].PlayerType == PlayerType.Computer) { selectedEntry = 1; } var entries = new List<string> { "Aus", "An" }; computerMenuEntry = new ComboToggleButton(this, "Computer", new Collection<string>(entries), selectedEntry, 0) { Position = new Vector2(10, 100) }; computerMenuEntry.Selected += ComputerMenuEntrySelected; txtCastleName = new TextBox(this, false) { Position = new Vector2(260, 270), ShowCursor = false }; nameLabel = new MenuEntry(this, "Name", 0) { Position = new Vector2(10, 200) }; nameLabel.Selected += NameMenuEntrySelected; ControlsContainer.Add(zurueckMenuEntry); ControlsContainer.Add(computerMenuEntry); ControlsContainer.Add(nameLabel); ControlsContainer.Add(txtCastleName); var pp = GraphicsManager.GraphicsDevice.PresentationParameters; renderTarget = new RenderTarget2D(GraphicsManager.GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8); }