Exemplo n.º 1
0
        private void Awake() {
            var clearWhite = new Color(1, 1, 1, 0);

            HeldButtonUi.AddTo(this.menuNewSessionButtonImage, Inputs.PrimaryButton);
            HeldButtonUi.AddTo(this.menuExitGameButtonImage, Inputs.ExitButton);

            FloatTarget.AddTo(this.gameObject,
                v => {
                    this._currentRotation = v;
                    this.transform.eulerAngles = new Vector3(0, v, 0);
                },
                () => this._currentRotation,
                () => this._targetRotation, 7, TargetCurve.Easing);

            // Fade entire canvas in and out.
            this.headerText.color = clearWhite;
            this.resultsText.color = clearWhite;
            this.menuNewSessionText.color = clearWhite;
            this.menuExitGameText.color = clearWhite;
            this.instructionsText.color = clearWhite;
            ColorTarget.AddToTextGUIColor(this.headerText, this.ActiveColor);
            ColorTarget.AddToTextGUIColor(this.resultsText, this.ActiveColor);
            ColorTarget.AddToTextGUIColor(this.menuNewSessionText, this.ActiveColor);
            ColorTarget.AddToTextGUIColor(this.menuExitGameText, this.ActiveColor);
            ColorTarget.AddToTextGUIColor(this.instructionsText, this.ActiveColor);

            this.SetVisible(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Set color of homeworks text.
        /// </summary>
        /// <param name="target">The target of this change. <see cref="ColorTarget"/>.</param>
        /// <param name="brush">The new value (color or brush).</param>
        /// <param name="save">If true, this change will be saved.</param>
        public static void SetColor(ColorTarget target, Brush brush, bool save = true)
        {
            switch (target)
            {
            case ColorTarget.NormalHomeworks:
                Global.userData.settings.colors.NormalHomeworksColor = brush;
                break;

            case ColorTarget.Tests:
                Global.userData.settings.colors.TestsColor = brush;
                break;

            case ColorTarget.subjects:
                Global.userData.settings.colors.SubjectsColor = brush;
                break;

            case ColorTarget.HighlightedHomeworks:
                Global.userData.settings.colors.HighlightColor = brush;
                break;

            default:
                throw new Exception("ColorTarget value \"" + target + "\" isn't known (SettingsManager.SetColor)");
            }

            HomeworkManager.RecolorViewers();

            EventsManager.Call_ColorChanged(target, brush);

            if (save)
            {
                Save.SaveData();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Sets the style color for a particular UI element type.
 /// </summary>
 /// <param name="target">The type of UI element.</param>
 /// <param name="value">The new color.</param>
 public void SetColor(ColorTarget target, Color value)
 {
     NativePtr->Colors[(int)target * 4 + 0] = value.R;
     NativePtr->Colors[(int)target * 4 + 1] = value.G;
     NativePtr->Colors[(int)target * 4 + 2] = value.B;
     NativePtr->Colors[(int)target * 4 + 3] = value.A;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Sets the style color for a particular UI element type.
 /// </summary>
 /// <param name="target">The type of UI element.</param>
 /// <param name="value">The new color.</param>
 public void SetColor(ColorTarget target, Vector4 value)
 {
     _stylePtr->Colors[(int)target * 4 + 0] = value.X;
     _stylePtr->Colors[(int)target * 4 + 1] = value.Y;
     _stylePtr->Colors[(int)target * 4 + 2] = value.Z;
     _stylePtr->Colors[(int)target * 4 + 3] = value.W;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Sets the style color for a particular UI element type.
 /// </summary>
 /// <param name="target">The type of UI element.</param>
 /// <param name="value">The new color.</param>
 public void SetColor(ColorTarget target, Vector4 value)
 {
     NativePtr->Colors[(int)target * 4 + 0] = value.X;
     NativePtr->Colors[(int)target * 4 + 1] = value.Y;
     NativePtr->Colors[(int)target * 4 + 2] = value.Z;
     NativePtr->Colors[(int)target * 4 + 3] = value.W;
 }
Exemplo n.º 6
0
 public GUIColorScope(
     bool condition,
     Color color,
     ColorTarget target = ColorTarget.Normal
     ) : this(condition ? color : GUI.color, target)
 {
 }
Exemplo n.º 7
0
 private void Start()
 {
     this.numerator.color    = InvisibleColor;
     this.denominator.color  = InvisibleColor;
     this.dividingLine.color = InvisibleColor;
     ColorTarget.AddToTextGUIColor(this.numerator, () => this.IsActive && this._visible ? VisibleColor : InvisibleColor, FadeSpeed);
     ColorTarget.AddToTextGUIColor(this.denominator, () => this.IsActive && this._visible ? VisibleColor : InvisibleColor, FadeSpeed);
     ColorTarget.AddToImageColor(this.dividingLine, () => this.IsActive && this._visible ? VisibleColor : InvisibleColor, FadeSpeed);
 }
        public ColorMappingInstance(IColorPaletteEntry source, ColorTarget targetColor, ColorPaletteResources targetResources)
        {
            _source          = source;
            _targetColor     = targetColor;
            _targetResources = targetResources;

            Apply();

            _source.ActiveColorChanged += Source_ActiveColorChanged;
        }
Exemplo n.º 9
0
        private void TargetList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            selectedColorTarget = (ColorTarget)targetList.SelectedIndex;
            switch (selectedColorTarget)
            {
            case ColorTarget.Line: R = Settings.PlotVisualParams.LineColor.R; G = Settings.PlotVisualParams.LineColor.G; B = Settings.PlotVisualParams.LineColor.B; break;

            case ColorTarget.Vector: R = Settings.PlotVisualParams.ArrowColor.R; G = Settings.PlotVisualParams.ArrowColor.G; B = Settings.PlotVisualParams.ArrowColor.B; break;

            case ColorTarget.BorderFill: R = Settings.PlotVisualParams.BorderFillColor.R; G = Settings.PlotVisualParams.BorderFillColor.G; B = Settings.PlotVisualParams.BorderFillColor.B; break;

            case ColorTarget.BorderStroke: R = Settings.PlotVisualParams.BorderStrokeColor.R; G = Settings.PlotVisualParams.BorderStrokeColor.G; B = Settings.PlotVisualParams.BorderStrokeColor.B; break;
            }
            SetColorSliderValue();
            RSlider.Focus();
        }
Exemplo n.º 10
0
        protected override MutableObject Mutate(MutableObject mutable)
        {
            var groupId = GroupId.GetLastKeyValue(mutable);

            var index = DataShare.ContainsKey(groupId)
                ? DataShare[groupId]
                : 0;

            if (groupId != "")
            {
                DataShare[groupId] = index + 1;
            }

            ColorTarget.SetValue(ColorPalette.ColorFromIndex(index), mutable);

            return(mutable);
        }
Exemplo n.º 11
0
        private void Awake()
        {
            this.titleText.color       = this.titleText.color.AsTransparent();
            this.startButtonText.color = this.startButtonText.color.AsTransparent();
            this.exitButtonText.color  = this.exitButtonText.color.AsTransparent();

            ColorTarget.AddToTextGUIColor(this.titleText,
                                          () => this._isActive ? this.titleText.color.AsOpaque() : this.titleText.color.AsTransparent());
            ColorTarget.AddToTextGUIColor(this.startButtonText,
                                          () => this._isActive ? this.startButtonText.color.AsOpaque() : this.startButtonText.color.AsTransparent());
            ColorTarget.AddToTextGUIColor(this.exitButtonText,
                                          () => this._isActive ? this.exitButtonText.color.AsOpaque() : this.exitButtonText.color.AsTransparent());


            HeldButtonUi.AddTo(this.startButtonImage, Inputs.PrimaryButton);
            HeldButtonUi.AddTo(this.exitButtonImage, Inputs.ExitButton);
        }
Exemplo n.º 12
0
    public PushColor(Color inColor, ColorTarget inTarget = ColorTarget.All)
    {
        _colorTarget = inTarget;

        switch(inTarget)
        {
            case ColorTarget.Background:
                _oldColor = GUI.backgroundColor;
                GUI.backgroundColor = inColor;
                break;
            case ColorTarget.Content:
                _oldColor = GUI.color;
                GUI.contentColor = inColor;
                break;
            case ColorTarget.All:
                _oldColor = GUI.color;
                GUI.color = inColor;
                break;
        }
    }
Exemplo n.º 13
0
        private void Awake()
        {
            for (var i = 0; i < this.textMeshes.Length; i++)
            {
                var textMesh = this.textMeshes[i];
                var index    = i;
                ColorTarget.AddToTextGUIColor(textMesh,
                                              () => new Color(1, 1, 1,
                                                              this._showMeshArray != null && this._showMeshArray.Length > index && this._showMeshArray[index]
                            ? 1f
                            : 0f),
                                              NormalSpeed);
            }

            FloatTarget.AddTo(this.gameObject, v => {
                this._currentAngle         = v;
                this.transform.eulerAngles = new Vector3(0, this._currentAngle, 0);
            },
                              () => this._currentAngle,
                              () => this._currentAngleTarget, 1f, TargetCurve.Easing);
        }
Exemplo n.º 14
0
        public GUIColorScope(Color red, ColorTarget target = ColorTarget.Normal)
        {
            this.target = target;
            switch (target)
            {
            case ColorTarget.Normal:
                color     = GUI.color;
                GUI.color = red;
                break;

            case ColorTarget.Content:
                color            = GUI.contentColor;
                GUI.contentColor = red;
                break;

            case ColorTarget.Background:
                color = GUI.backgroundColor;
                GUI.backgroundColor = red;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(target), target, null);
            }
        }
Exemplo n.º 15
0
 public static void PushStyleColor(ColorTarget target, Vector4 color)
 {
     ImGuiNative.igPushStyleColor(target, color);
 }
Exemplo n.º 16
0
 public static void PushStyleColor(ColorTarget target, Vector4 color)
 {
     ImGuiNative.igPushStyleColor(target, color);
 }
Exemplo n.º 17
0
 public static extern string igGetStyleColName(ColorTarget idx);
Exemplo n.º 18
0
 public static extern void igPushStyleColor(ColorTarget idx, Vector4 col);
Exemplo n.º 19
0
 /// <summary>
 /// Sets the style color for a particular UI element type.
 /// </summary>
 /// <param name="target">The type of UI element.</param>
 /// <param name="value">The new color.</param>
 public void SetColor(ColorTarget target, Vector4 value)
 {
     _stylePtr->Colors[(int)target * 4 + 0] = value.X;
     _stylePtr->Colors[(int)target * 4 + 1] = value.Y;
     _stylePtr->Colors[(int)target * 4 + 2] = value.Z;
     _stylePtr->Colors[(int)target * 4 + 3] = value.W;
 }
Exemplo n.º 20
0
 /// <summary>
 /// Gets the current style color for the given UI element type.
 /// </summary>
 /// <param name="target">The type of UI element.</param>
 /// <returns>The element's color as currently configured.</returns>
 public Vector4 GetColor(ColorTarget target) => *(Vector4 *)&NativePtr->Colors[(int)target * 4];
Exemplo n.º 21
0
 /// <summary>
 /// Sets the style color for a particular UI element type.
 /// </summary>
 /// <param name="target">The type of UI element.</param>
 /// <param name="value">The new color.</param>
 public void SetColor(ColorTarget target, float value) => _stylePtr->Colors[(int)target] = value;
Exemplo n.º 22
0
        protected override void OnProcessOutputSchema(MutableObject newSchema)
        {
            ColorTarget.SetValue(Color.magenta, newSchema);

            Router.TransmitAllSchema(newSchema);
        }
 public ColorMapping(IColorPaletteEntry source, ColorTarget targetColor)
 {
     _source      = source;
     _targetColor = targetColor;
 }
Exemplo n.º 24
0
 public static void PushStyleColor(ColorTarget target, Color color)
 {
     ImGuiNative.igPushStyleColor(target, color.ToNumericsVector4());
 }
Exemplo n.º 25
0
 /// <summary>
 /// Gets the current style color for the given UI element type.
 /// </summary>
 /// <param name="target">The type of UI element.</param>
 /// <returns>The element's color as currently configured.</returns>
 public Vector4 GetColor(ColorTarget target) => *(Vector4*)&_stylePtr->Colors[(int)target * 4];
Exemplo n.º 26
0
 public static extern void igPushStyleColor(ColorTarget idx, Vector4 col);
Exemplo n.º 27
0
 /// <summary>
 /// Invoke ColorChanged event
 /// </summary>
 /// <param name="target">Type of element of this color (homework, test, subject)</param>
 /// <param name="brush">New color</param>
 internal static void Call_ColorChanged(ColorTarget target, Brush brush)
 {
     ColorChanged?.Invoke(target, brush);
 }
Exemplo n.º 28
0
 /// <summary>
 /// Gets the current style color for the given UI element type.
 /// </summary>
 /// <param name="target">The type of UI element.</param>
 /// <returns>The element's color as currently configured.</returns>
 public float GetColor(ColorTarget target) => _stylePtr->Colors[(int)target];
Exemplo n.º 29
0
 public static extern string igGetStyleColName(ColorTarget idx);
Exemplo n.º 30
0
        /// <summary>
        /// Gets the current style color for the given UI element type.
        /// </summary>
        /// <param name="target">The type of UI element.</param>
        /// <returns>The element's color as currently configured.</returns>
        public Color GetColor(ColorTarget target)
        {
            var vec4 = *(System.Numerics.Vector4 *) & NativePtr->Colors[(int)target * 4];

            return(new Color(vec4.X, vec4.Y, vec4.Z, vec4.W));
        }