Fix VSync button not starting in the right color.

This commit is contained in:
Pieter-Jan Briers
2019-03-08 09:06:25 +01:00
parent 40a037a97a
commit 12896f306c
3 changed files with 22 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using SS14.Shared.ViewVariables;
namespace SS14.Client.UserInterface
{
@@ -14,6 +15,7 @@ namespace SS14.Client.UserInterface
private string _styleIdentifier;
[ViewVariables]
public string StyleIdentifier
{
get => _styleIdentifier;
@@ -26,6 +28,7 @@ namespace SS14.Client.UserInterface
private string _stylePseudoClass;
[ViewVariables]
public string StylePseudoClass
{
get => _stylePseudoClass;

View File

@@ -3,6 +3,7 @@ using System;
using JetBrains.Annotations;
using SS14.Client.Utility;
using SS14.Shared.Log;
using SS14.Shared.ViewVariables;
namespace SS14.Client.UserInterface.Controls
{
@@ -27,6 +28,7 @@ namespace SS14.Client.UserInterface.Controls
private ActionMode _mode = ActionMode.Release;
[ViewVariables]
public ActionMode Mode
{
get => GameController.OnGodot ? (ActionMode) SceneControl.Get("action_mode") : _mode;
@@ -45,6 +47,7 @@ namespace SS14.Client.UserInterface.Controls
private bool _disabled;
[ViewVariables]
public bool Disabled
{
get => GameController.OnGodot ? (bool) SceneControl.Get("disabled") : _disabled;
@@ -72,6 +75,7 @@ namespace SS14.Client.UserInterface.Controls
/// <summary>
/// Whether the button is currently toggled down. Only applies when <see cref="ToggleMode"/> is true.
/// </summary>
[ViewVariables]
public bool Pressed
{
get => GameController.OnGodot ? (bool) SceneControl.Get("pressed") : _pressed;
@@ -83,13 +87,19 @@ namespace SS14.Client.UserInterface.Controls
}
else
{
_pressed = value;
if (_pressed != value)
{
_pressed = value;
DrawModeChanged();
}
}
}
}
private bool _toggleMode;
[ViewVariables]
public bool ToggleMode
{
get => GameController.OnGodot ? (bool) SceneControl.Get("toggle_mode") : _toggleMode;
@@ -112,8 +122,10 @@ namespace SS14.Client.UserInterface.Controls
Release = 1,
}
[ViewVariables]
public bool IsHovered => GameController.OnGodot ? (bool) SceneControl.Call("is_hovered") : _beingHovered;
[ViewVariables]
public DrawModeEnum DrawMode
{
get
@@ -188,7 +200,7 @@ namespace SS14.Client.UserInterface.Controls
{
if (ToggleMode)
{
Pressed = !Pressed;
_pressed = !_pressed;
OnPressed?.Invoke(buttonEventArgs);
OnToggled?.Invoke(new ButtonToggledEventArgs(Pressed, this));
}
@@ -222,7 +234,7 @@ namespace SS14.Client.UserInterface.Controls
{
if (ToggleMode)
{
Pressed = !Pressed;
_pressed = !_pressed;
}
OnPressed?.Invoke(buttonEventArgs);

View File

@@ -3,6 +3,7 @@ using SS14.Client.Graphics;
using SS14.Client.Graphics.Drawing;
using SS14.Client.Utility;
using SS14.Shared.Maths;
using SS14.Shared.ViewVariables;
namespace SS14.Client.UserInterface.Controls
{
@@ -34,6 +35,7 @@ namespace SS14.Client.UserInterface.Controls
}
private AlignMode _textAlign;
[ViewVariables]
public AlignMode TextAlign
{
get => GameController.OnGodot ? (AlignMode)SceneControl.Get("align") : _textAlign;
@@ -51,6 +53,7 @@ namespace SS14.Client.UserInterface.Controls
}
private bool _clipText;
[ViewVariables]
public bool ClipText
{
get => GameController.OnGodot ? (bool)SceneControl.Get("clip_text") : _clipText;
@@ -68,6 +71,7 @@ namespace SS14.Client.UserInterface.Controls
}
private string _text;
[ViewVariables]
public string Text
{
get => GameController.OnGodot ? (string)SceneControl.Get("text") : _text;