/// <summary> /// Handles clicking the TTS toggle button /// </summary> /// <param name="sender">Button object</param> /// <param name="e">Event args</param> private void TtsToggle_Click(object sender, RoutedEventArgs e) { Config.Instance.TtsEnabled = !Config.Instance.TtsEnabled; Logger.Log($"Text to Speech: {Config.Instance.TtsEnabled}", LogLevel.Info); UiHelpers.UpdateButton("tts", ref TtsToggle); Config.Instance.SaveConfig(); }
/// <summary> /// Handles clicking the play toggle button /// </summary> /// <param name="sender">Button object</param> /// <param name="e">Event args</param> private void PlayToggle_Click(object sender, RoutedEventArgs e) { Config.Instance.PlayEnabled = !Config.Instance.PlayEnabled; Logger.Log($"Playsound: {Config.Instance.PlayEnabled}", LogLevel.Info); UiHelpers.UpdateButton("play", ref PlayToggle); Config.Instance.SaveConfig(); }
/// <summary> /// Handles clicking the webcam toggle button /// </summary> /// <param name="sender">Button object</param> /// <param name="e">Event args</param> private void WebcamToggle_Click(object sender, RoutedEventArgs e) { Config.Instance.CamEnabled = !Config.Instance.CamEnabled; Logger.Log($"Webcam: {Config.Instance.CamEnabled}", LogLevel.Info); UiHelpers.UpdateButton("webcam", ref WebcamToggle); Config.Instance.SaveConfig(); }
/// <summary> /// Handles clicking the screenshot toggle button /// </summary> /// <param name="sender">Button object</param> /// <param name="e">Event args</param> private void ScreenshotToggle_Click(object sender, RoutedEventArgs e) { Config.Instance.SsEnabled = !Config.Instance.SsEnabled; Logger.Log($"Screenshot: {Config.Instance.SsEnabled}", LogLevel.Info); UiHelpers.UpdateButton("screenshot", ref ScreenshotToggle); Config.Instance.SaveConfig(); }
public override void Start() { var w = this.web; w.Run <xofz.Framework.Timer>(t => { w.Run <EventRaiser>(er => { w.Run <Messages>(messages => { var waitingMessage = messages.Waiting; UiHelpers.Write( this.ui, () => { this.ui.HasteRating = waitingMessage; this.ui.HastePercentage = waitingMessage; }); }); er.Raise( t, nameof(t.Elapsed)); }); t.Start(TimeSpan.FromMinutes(5)); }, "HomeTimer"); }
protected override void ExecuteQuery() { var activationParameters = new ActivationParameters { PayManaCost = D._p.PayManaCost }; var spellPrerequisites = SelectSpell(); if (spellPrerequisites == null) { return; } UiHelpers.SelectX(spellPrerequisites, activationParameters, canCancel: false); UiHelpers.SelectTargets(spellPrerequisites, activationParameters, canCancel: false); var playable = new PlayableSpell { Card = D._p.Card, ActivationParameters = activationParameters, Index = spellPrerequisites.Index }; Result = new ChosenPlayable { Playable = playable }; }
/// <summary> /// Handles clicking the processes toggle button /// </summary> /// <param name="sender">Button object</param> /// <param name="e">Event args</param> private void ProcToggle_Click(object sender, RoutedEventArgs e) { Config.Instance.ProcessesEnabled = !Config.Instance.ProcessesEnabled; Logger.Log($"Processes: {Config.Instance.ProcessesEnabled}", LogLevel.Info); UiHelpers.UpdateButton("proc", ref ProcToggle); Config.Instance.SaveConfig(); }
/// <summary> /// Handles clicking the recording toggle button /// </summary> /// <param name="sender">Button object</param> /// <param name="e">Event args</param> private void RecordingToggle_Click(object sender, RoutedEventArgs e) { Config.Instance.RecordingEnabled = !Config.Instance.RecordingEnabled; Logger.Log($"Recording: {Config.Instance.RecordingEnabled}", LogLevel.Info); UiHelpers.UpdateButton("recording", ref RecordingToggle); Config.Instance.SaveConfig(); }
/// <summary> /// Colors the UI toggle buttons /// </summary> private void InitButtons() { UiHelpers.UpdateButton("webcam", ref WebcamToggle); UiHelpers.UpdateButton("screenshot", ref ScreenshotToggle); UiHelpers.UpdateButton("play", ref PlayToggle); UiHelpers.UpdateButton("tts", ref TtsToggle); UiHelpers.UpdateButton("proc", ref ProcToggle); UiHelpers.UpdateButton("recording", ref RecordingToggle); }
public override void Start() { // Generates the following UI: // |---------------| // | | <-- _messageBox // | | // |---------------| // | | <-- _chatText // |---------------| backgroundSprite = "GenericPanel"; name = "MPChatLogPanel"; color = new Color32(22, 22, 22, 240); // Activates the dragging of the window AddUIComponent(typeof(UIDragHandle)); // Grab the view for calculating width and height of game var view = UIView.GetAView(); // Center this window in the game relativePosition = new Vector3(10.0f, view.fixedHeight - 440.0f); width = 500; height = 300; // Create the message box _messageBox = (UIListBox)AddUIComponent(typeof(UIListBox)); _messageBox.isVisible = true; _messageBox.isEnabled = true; _messageBox.width = 480; _messageBox.height = 240; _messageBox.position = new Vector2(10, -10); _messageBox.multilineItems = true; _messageBox.textScale = 0.8f; _messageBox.itemHeight = 20; // Create the message text box (used for sending messages) _chatText = (UITextField)AddUIComponent(typeof(UITextField)); _chatText.width = width; _chatText.height = 30; _chatText.position = new Vector2(0, -270); _chatText.atlas = UiHelpers.GetAtlas("Ingame"); _chatText.normalBgSprite = "TextFieldPanelHovered"; _chatText.builtinKeyNavigation = true; _chatText.isInteractive = true; _chatText.readOnly = false; _chatText.horizontalAlignment = UIHorizontalAlignment.Left; _chatText.eventKeyDown += OnChatKeyDown; _chatText.textColor = new Color32(0, 0, 0, 255); _chatText.padding = new RectOffset(6, 6, 6, 6); _chatText.selectionSprite = "EmptySprite"; base.Start(); }
public virtual void Start() { var s = this.shell; UiHelpers.WriteSync( s, () => { s.SwitchUi( this.ui); }); }
public void Setup() { if (Interlocked.CompareExchange(ref this.setupIf1, 1, 0) == 1) { return; } var w = this.web; w.Run <EventSubscriber>(subscriber => { subscriber.Subscribe( this.ui, nameof(this.ui.ExitRequested), this.ui_ExitRequested); w.Run <xofz.Framework.Timer>(t => { subscriber.Subscribe( t, nameof(t.Elapsed), this.timer_Elapsed); }, "HomeTimer"); }); w.Run <GlobalSettingsHolder>(s => { var charName = s.CharacterName; UiHelpers.Write( this.ui, () => this.ui.CharacterName = charName); }); w.Run <VersionReader>(vr => { var version = vr.Read(); var coreVersion = vr.ReadCoreVersion(); UiHelpers.Write( this.ui, () => { this.ui.Version = version; this.ui.CoreVersion = coreVersion; }); }); w.Run <Navigator>(n => n.RegisterPresenter(this)); }
public override void Start() { UiHelpers.WriteSync( this.ui, () => { try { this.ui.Display(); } catch { // assume already visible, swallow } }); }
public MasterView() { InitializeComponent(); Menu = this.MenuListView; Menu.ItemsSource = new List <MainMenuItem> { new MainMenuItem { Title = "Feed", IconSource = UiHelpers.SetOsImagePath("home.png"), TargetType = typeof(PostList) }, new MainMenuItem { Title = "Sources", IconSource = UiHelpers.SetOsImagePath("RSSMenuIcon.png"), TargetType = typeof(SourceList) } }; }
private void Activate() { if (!IsPlayable) { return; } var activationParameters = new ActivationParameters(); var playableActivator = SelectAbility(); if (playableActivator == null) { return; } var wasCanceled = UiHelpers.SelectX( playableActivator.Prerequisites, activationParameters, canCancel: true) && UiHelpers.SelectTargets( playableActivator.Prerequisites, activationParameters, canCancel: true); if (!wasCanceled) { return; } var ability = playableActivator.GetPlayable(activationParameters); Publisher.Publish(new PlayableSelected { Playable = ability }); }
public ShoppingPageItem(IWebDriver browser, IWebElement shoppingItem) { _browser = browser; _shoppingItem = shoppingItem; _uiHelper = new UiHelpers(_browser); }
public override void Stop() { UiHelpers.WriteSync( this.ui, this.ui.Hide); }
public override void Start() { // Generates the following UI: // /NAME-----------\ <-- UIDragHandle // |---------------|-| // | | |<-- _messageBox, _getscrollablepanel // | | | // |---------------| | // | | |<-- _chatText // |---------------|-| // |-|<-- _resize // ^ // ¦-- _scrollbar, _trackingsprite, _trackingthumb backgroundSprite = "GenericPanel"; name = "ChatLogPanel"; color = new Color32(22, 22, 22, 240); // Activates the dragging of the window _draghandle = AddUIComponent <UIDragHandle>(); _draghandle.name = "ChatLogPanelDragHandle"; // Grab the view for calculating width and height of game UIView view = UIView.GetAView(); // Center this window in the game relativePosition = new Vector3(10.0f, view.fixedHeight - 440.0f); width = 500; height = 310; minimumSize = new Vector2(300, 310); // Add resize component _resize = AddUIComponent <UIResizeHandle>(); _resize.position = new Vector2((width - 20), (-height + 10)); _resize.width = 20f; _resize.height = 20f; _resize.color = new Color32(255, 255, 255, 255); _resize.backgroundSprite = "GenericTabPressed"; _resize.name = "ChatLogPanelResize"; // Add scrollable panel component _scrollablepanel = AddUIComponent <UIScrollablePanel>(); _scrollablepanel.width = 490; _scrollablepanel.height = 240; _scrollablepanel.position = new Vector2(10, -30); _scrollablepanel.clipChildren = true; _scrollablepanel.name = "ChatLogPanelScrollablePanel"; // Add title _title = AddUIComponent <UILabel>(); _title.position = new Vector2(10, -5); _title.text = "Multiplayer Chat"; _title.textScale = 0.8f; _title.autoSize = true; _title.name = "ChatLogPanelTitle"; // Add messagebox component _messageBox = _scrollablepanel.AddUIComponent <UILabel>(); _messageBox.isVisible = true; _messageBox.isEnabled = true; _messageBox.autoSize = false; _messageBox.autoHeight = true; _messageBox.width = 470; _messageBox.height = 240; _messageBox.position = new Vector2(10, -30); _messageBox.textScale = 0.8f; _messageBox.wordWrap = true; _messageBox.name = "ChatLogPanelMessageBox"; // Add scrollbar component _scrollbar = AddUIComponent <UIScrollbar>(); _scrollbar.name = "Scrollbar"; _scrollbar.width = 20f; _scrollbar.height = _scrollablepanel.height; _scrollbar.orientation = UIOrientation.Vertical; _scrollbar.pivot = UIPivotPoint.TopLeft; _scrollbar.position = new Vector2(480, -30); _scrollbar.minValue = 0; _scrollbar.value = 0; _scrollbar.incrementAmount = 50; _scrollbar.name = "ChatLogPanelScrollBar"; // Add scrollbar background sprite component _trackingsprite = _scrollbar.AddUIComponent <UISlicedSprite>(); _trackingsprite.position = new Vector2(0, 0); _trackingsprite.autoSize = true; _trackingsprite.size = _trackingsprite.parent.size; _trackingsprite.fillDirection = UIFillDirection.Vertical; _trackingsprite.spriteName = "ScrollbarTrack"; _trackingsprite.name = "ChatLogPanelTrack"; _scrollbar.trackObject = _trackingsprite; _scrollbar.trackObject.height = _scrollbar.height; // Add scrollbar thumb component _trackingthumb = _scrollbar.AddUIComponent <UISlicedSprite>(); _trackingthumb.position = new Vector2(0, 0); _trackingthumb.fillDirection = UIFillDirection.Vertical; _trackingthumb.autoSize = true; _trackingthumb.width = _trackingthumb.parent.width - 8; _trackingthumb.spriteName = "ScrollbarThumb"; _trackingthumb.name = "ChatLogPanelThumb"; _scrollbar.thumbObject = _trackingthumb; _scrollbar.isVisible = true; _scrollbar.isEnabled = true; _scrollablepanel.verticalScrollbar = _scrollbar; // Add text field component (used for inputting) _chatText = (UITextField)AddUIComponent(typeof(UITextField)); _chatText.width = width; _chatText.height = 30; _chatText.position = new Vector2(0, -280); _chatText.atlas = UiHelpers.GetAtlas("Ingame"); _chatText.normalBgSprite = "TextFieldPanelHovered"; _chatText.builtinKeyNavigation = true; _chatText.isInteractive = true; _chatText.readOnly = false; _chatText.horizontalAlignment = UIHorizontalAlignment.Left; _chatText.eventKeyDown += OnChatKeyDown; _chatText.textColor = new Color32(0, 0, 0, 255); _chatText.padding = new RectOffset(6, 6, 6, 6); _chatText.selectionSprite = "EmptySprite"; _chatText.name = "ChatLogPanelChatText"; WelcomeChatMessage(); // Add resizable adjustments eventSizeChanged += (component, param) => { _scrollablepanel.width = (width - 30); _scrollablepanel.height = (height - 70); _messageBox.width = (width - 30); _chatText.width = width; _scrollbar.height = _scrollablepanel.height; _trackingsprite.size = _trackingsprite.parent.size; _chatText.position = new Vector3(0, (-height + 30)); _resize.position = new Vector2((width - 20), (-height + 10)); _scrollbar.position = new Vector2((width - 20), (-30)); }; base.Start(); }
public override void Start() { // Generates the following UI: // |---------------| // | | <-- _messageBox // | | // |---------------| // | | <-- _chatText // |---------------| backgroundSprite = "GenericPanel"; name = ChatLogPanel.NAME; color = new Color32(22, 22, 22, 240); // Activates the dragging of the window AddUIComponent(typeof(UIDragHandle)); // Grab the view for calculating width and height of game var view = UIView.GetAView(); // Center this window in the game relativePosition = new Vector3(10.0f, view.fixedHeight - 440.0f); width = 500; height = 300; // Create the message box _messageBox = (UIListBox)AddUIComponent(typeof(UIListBox)); _messageBox.isVisible = true; _messageBox.isEnabled = true; _messageBox.width = 480; _messageBox.height = 240; _messageBox.position = new Vector2(10, -10); _messageBox.multilineItems = true; _messageBox.textScale = 0.8f; _messageBox.itemHeight = 20; _messageBox.multilineItems = true; // Create the message text box (used for sending messages) _chatText = (UITextField)AddUIComponent(typeof(UITextField)); _chatText.width = width; _chatText.height = 30; _chatText.position = new Vector2(0, -270); _chatText.atlas = UiHelpers.GetAtlas("Ingame"); _chatText.normalBgSprite = "TextFieldPanelHovered"; _chatText.builtinKeyNavigation = true; _chatText.isInteractive = true; _chatText.readOnly = false; _chatText.horizontalAlignment = UIHorizontalAlignment.Left; _chatText.eventKeyDown += OnChatKeyDown; _chatText.textColor = new Color32(0, 0, 0, 255); _chatText.padding = new RectOffset(6, 6, 6, 6); _chatText.selectionSprite = "EmptySprite"; _initialOpacity = opacity; PrintGameMessage("Welcome to Cities: Skylines Multiplayer!"); PrintGameMessage("Press the ~ (tilde) key to show or hide the chat."); PrintGameMessage("Join our discord server at: https://discord.gg/RjACPhd"); PrintGameMessage("Type '/help' to see a list of commands and usage."); PrintGameMessage("Type '/support' to find out where to report bugs and get help."); base.Start(); }
private void timer_Elapsed() { var h = this.timerHandlerFinished; h.Reset(); var w = this.web; w.Run < HttpClientFactory, GlobalSettingsHolder, Messages>((factory, settings, messages) => { var errorMessage = messages.Error; string hasteRating; string hastePercentage; using (var client = factory.Create()) { var uri = new StringBuilder() .Append("https://") .Append(settings.Location) .Append(".api.battle.net/wow/character/") .Append(settings.Realm) .Append('/') .Append(settings.CharacterName) .Append("?fields=stats") .Append("&locale=en_US") .Append("&apikey=") .Append(settings.PublicApiKey) .ToString(); client.Timeout = TimeSpan.FromMilliseconds(10000); Task <string> readHasteTask; try { readHasteTask = client.GetStringAsync(uri); readHasteTask.Wait(); } catch { hasteRating = errorMessage; hastePercentage = errorMessage; goto setHaste; } HasteResponseData data; try { var json = readHasteTask.Result; data = JsonConvert.DeserializeObject <HasteResponseData>(json); } catch { hasteRating = errorMessage; hastePercentage = errorMessage; goto setHaste; } hasteRating = data ?.stats ?.hasteRating .ToString() ?? errorMessage; hastePercentage = data ?.stats ?.haste .ToString() ?? errorMessage; if (hastePercentage != errorMessage) { hastePercentage += ' '; hastePercentage += '%'; } setHaste: UiHelpers.Write( this.ui, () => { this.ui.HasteRating = hasteRating; this.ui.HastePercentage = hastePercentage; }); } }); h.Set(); }