public override void Render(IDrawingSurface context, ElementFrameGeometry geometry)
        {
            ColorProperty prefixColor = new ColorProperty(
                Color.FromArgb(_settings.PrefixAlpha, _settings.PrefixRed, _settings.PrefixGreen, _settings.PrefixBlue));

            context.DrawString(_settings.PrefixText, CodeRush.VSSettings.FontName,CodeRush.VSSettings.FontSize,prefixColor,geometry.Location);
        }
        public override void Render(IDrawingSurface context, ElementFrameGeometry geometry)
        {
            ColorProperty metaColor = new ColorProperty(
                Color.FromArgb(_settings.BlockMetaDataAlpha, _settings.BlockMetaDataRed, _settings.BlockMetaDataGreen, _settings.BlockMetaDataBlue));

            float fontSize = CodeRush.VSSettings.FontSize;

            context.DrawString (_customMetaString, CodeRush.VSSettings.FontName, fontSize , metaColor, geometry.Location.MoveDown(2));
        }
 public static Color GetColor(VisualStyleElement element, ColorProperty colorProperty, Color defaultColor)
 {
     if(VisualStyleRenderer.IsSupported && VisualStyleRenderer.IsElementDefined(element))
     {
         return new VisualStyleRenderer(element).GetColor(colorProperty);
     }
     else
     {
         return defaultColor;
     }
 }
示例#4
0
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            if (this.duration <= 0.0f)
            {
                if (this.graphic != null)
                {
                    this.graphic.color = this.color.GetValue();
                }
                return(true);
            }

            return(false);
        }
        /// <summary>
        ///  [See win32 equivalent.]
        /// </summary>
        public Color GetColor(ColorProperty prop)
        {
            // Valid values are 0xed9 to 0xeef
            if (!ClientUtils.IsEnumValid(prop, (int)prop, (int)ColorProperty.BorderColor, (int)ColorProperty.AccentColorHint))
            {
                throw new InvalidEnumArgumentException(nameof(prop), (int)prop, typeof(ColorProperty));
            }

            int color = 0;

            _lastHResult = GetThemeColor(this, Part, State, (int)prop, ref color);
            return(ColorTranslator.FromWin32(color));
        }
        /// <summary>
        ///  [See win32 equivalent.]
        /// </summary>
        public Color GetColor(ColorProperty prop)
        {
            //valid values are 0xed9 to 0xeef
            if (!ClientUtils.IsEnumValid(prop, (int)prop, (int)ColorProperty.BorderColor, (int)ColorProperty.AccentColorHint))
            {
                throw new InvalidEnumArgumentException(nameof(prop), (int)prop, typeof(ColorProperty));
            }

            int color = 0;

            lastHResult = SafeNativeMethods.GetThemeColor(new HandleRef(this, Handle), part, state, (int)prop, ref color);
            return(ColorTranslator.FromWin32(color));
        }
            public ColorPropertyChannel(ColorProperty parent, string suffix, int channel)
            {
                nameSB       = new StringBuilder();
                valueSB      = new StringBuilder();
                this.parent  = parent;
                this.suffix  = suffix;
                this.channel = channel;

                Flags     = BlockPropertyFlags.IsIntegral | BlockPropertyFlags.CanUseMultipliers;
                MinValue  = 0;
                MaxValue  = 1;
                Increment = 1;
            }
    // Update is called once per frame
    void Update()
    {
        if (isEmpty)
        {
            inStack = false;
            Color tempColor = new Color(1, 1, 1, 0.0f);
            this.GetComponent <SpriteRenderer>().color       = tempColor;
            this.GetComponent <CircleCollider2D>().isTrigger = true;
            BubbleColor = ColorProperty.NullType;
        }
        else if (!isEmpty)
        {
            switch (BubbleColor)
            {
            case ColorProperty.Green:
                sp.sprite = gameManager.sp_bubble[0];
                //sp.color = new Color(0, 1, 0);
                break;

            case ColorProperty.Blue:
                sp.sprite = gameManager.sp_bubble[1];
                //sp.color = new Color(0, 0, 1);
                break;

            case ColorProperty.Yellow:
                sp.sprite = gameManager.sp_bubble[2];
                //sp.color = new Color(1, 1, 0);
                break;

            case ColorProperty.Red:
                sp.sprite = gameManager.sp_bubble[3];
                //sp.color = new Color(1, 0, 0);
                break;

            case ColorProperty.Purple:
                sp.sprite = gameManager.sp_bubble[4];
                //sp.color = new Color32(238, 130, 238, 255);
                break;

            case ColorProperty.Black:
                sp.sprite = gameManager.sp_bubble[5];
                //sp.color = new Color(0, 1, 0);
                break;
            }
            Color tempColor = new Color(1, 1, 1, 1f);
            this.GetComponent <SpriteRenderer>().color       = tempColor;
            this.GetComponent <CircleCollider2D>().isTrigger = false;
        }
    }
 public void SetProperty(ColorProperty property)
 {
     foreach (var mat in materials)
     {
         mat.SetColor(property.name, property.val);
     }
     foreach (var r in renderers)
     {
         r.SetColor(property.name, property.val);
     }
     if (toGlobal)
     {
         Shader.SetGlobalColor(property.name, property.val);
     }
 }
示例#10
0
        internal Sky(bool flag) : base()
        {
            _displayName     = "Sky";
            _icon            = "Legacy/weather_cloudy.png";
            _instances       = new UISafeObservableCollection <Instance>();
            _allowedChildren = new List <Type>();
            _isRoot          = true;
            _ambient         = new ColorProperty(220, 220, 220, 255);
            _shadowColor     = new ColorProperty(140, 140, 140, 255);
            _diffuseColor    = new ColorProperty(0, 0, 0);
            _specularColor   = new ColorProperty(0, 0, 0);
            _sunDirection    = new Properties.Vector3(0.02f, -.94f, -.03f);
            _sunDirection.PropertyChanged += SunDirectionPropertyChanged;

            Initialize();
        }
示例#11
0
        /// <summary>
        /// Called whenever properties affecting the image are changed.
        /// </summary>
        public virtual void ImageChanged()
        {
            if (ImageComponent == null)
            {
                return;
            }

            if (ColorProperty.IsUndefined(this))
            {
                if (ImageComponent.sprite != null || ImageComponent.overrideSprite != null)
                {
                    // use white color by default if image is set
                    ImageComponent.color = Color.white;
                }
                else
                {
                    // use clear color by default if image isn't set
                    ImageComponent.color = Color.clear;
                }
            }

            var sprite = ImageComponent.overrideSprite ?? ImageComponent.sprite;

            if (WidthProperty.IsUndefined(this) && HeightProperty.IsUndefined(this))
            {
                // if width and height is undefined, adjust size to native size of sprite
                if (sprite != null)
                {
                    ImageComponent.SetNativeSize();
                    OverrideWidth  = ElementSize.FromPixels(ImageComponent.rectTransform.sizeDelta.x);
                    OverrideHeight = ElementSize.FromPixels(ImageComponent.rectTransform.sizeDelta.y);
                }
            }

            bool isLoading = Sprite != null && !Sprite.IsLoaded;

            if (isLoading && sprite == null)
            {
                // always disable image while loading
                ImageComponent.enabled = false;
            }
            else
            {
                // disable raycast blocks if image is transparent
                ImageComponent.enabled = RaycastBlockMode == RaycastBlockMode.Always ? true : ImageComponent.color.a > 0;
            }
        }
    /**
     * flip action is called when user switches between bubbles in game
     **/
    public void flip()
    {
        Current.GetComponent <SpriteRenderer>().enabled  = true;
        Upcoming.GetComponent <SpriteRenderer>().enabled = true;
        //print("Current Object color before flip" + Current.GetComponent<Current_Cannon_Switcher>().this_switch_color);
        //print("Next Object color before flip" + Upcoming.GetComponent<Current_Cannon_Switcher>().this_switch_color);
        //print("Current Color Before Flip " + Current_Color);
        //print("Next Color Before Flip " + next_Color);
        ColorProperty temp = Current_Color;

        Current_Color = next_Color;
        next_Color    = temp;

        Current.GetComponent <Current_Cannon_Switcher>().this_switch_color  = next_Color;
        Upcoming.GetComponent <Current_Cannon_Switcher>().this_switch_color = Current_Color;
        //print("Current Color After Flip " + Current_Color);
        //print("Next Color After Flip " + next_Color);



        ///----------------------------------------------------------------------
        ///
        //Current.GetComponent<SplineInterpolator>().Reset();
        //Upcoming.GetComponent<SplineInterpolator>().Reset();

        //Current.GetComponent<SplineController>().enabled = true;
        //Upcoming.GetComponent<SplineController>().enabled = true;

        //Upcoming

        Current.GetComponent <SplineController>().FollowSpline();
        Upcoming.GetComponent <SplineController>().FollowSpline();



        GameObject temp3 = Current_SplineRoot;

        Current_SplineRoot  = Upcoming_SplineRoot;
        Upcoming_SplineRoot = temp3;



        StartCoroutine("WaitForSpline");


        UpdateUpColor();            //update upcoming color
    }
示例#13
0
//  private ColorProperty _colorMerge1;
//  private ColorProperty _colorMerge2;

        void Start()
    {
                _panelSpriteRenderer = new SpriteRenderer[3];
                _colorSpriteRenderer = new SpriteRenderer[3];
                _colorMerge          = new ColorProperty[2];
                for(int i            = 0; i < 2; i++)
                    _colorMerge[i]   = new ColorProperty(0, Color.red, 0);
             //  _colorMerge1 = new ColorProperty(0,Color.red,0);
             //  _colorMerge2 = new ColorProperty(0,Color.red,0);
                for(int i = 0; i < 3; i++)
        {
                        _panelSpriteRenderer[i] = colorPanel[i].GetComponent <SpriteRenderer>();
                    
        }

                for(int i = 0; i < 3; i++)
                    _colorSpriteRenderer[i] = color[i].GetComponent <SpriteRenderer>();
            
    }
示例#14
0
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            if (this.light != null)
            {
                if (this.changeRange)
                {
                    this.light.range = this.range.GetValue();
                }
                if (this.changeIntensity)
                {
                    this.light.intensity = this.intensity.GetValue();
                }
                if (this.changeColor)
                {
                    this.light.color = this.color.GetValue();
                }
            }

            return(true);
        }
示例#15
0
    private void Update()
    {
        if (picker == null)
        {
            return;
        }

        if (!Input.GetMouseButtonDown(0))
        {
            return;
        }

        Vector3  screenPosition = Input.mousePosition;
        Pickable picked         = picker.GetPickableAt(screenPosition);

        if (picked == lastPicked)
        {
            return;
        }

        if (lastPicked != null)
        {
            ColorProperty colorProperty = lastPicked.GetComponent <ColorProperty>();
            if (colorProperty != null)
            {
                colorProperty.Color = originalColor;
            }
        }

        lastPicked = picked;

        if (lastPicked != null)
        {
            ColorProperty colorProperty = lastPicked.GetComponent <ColorProperty>();
            if (colorProperty != null)
            {
                originalColor       = colorProperty.Color;
                colorProperty.Color = Color.green;
            }
        }
    }
示例#16
0
    IEnumerator WaitForChange()
    {
        yield return(new WaitForSeconds(0.1f));

        this.BubbleColor = GameObject.FindObjectOfType <NextBubbleManager>().UpdateColorsOfObstacle();
        switch (this.BubbleColor)
        {
        case ColorProperty.Green:
            sp.sprite = gameManager.sp_bubble[0];
            //sp.color = new Color(0, 1, 0);
            break;

        case ColorProperty.Blue:
            sp.sprite = gameManager.sp_bubble[1];
            //sp.color = new Color(0, 0, 1);
            break;

        case ColorProperty.Yellow:
            sp.sprite = gameManager.sp_bubble[2];
            //sp.color = new Color(1, 1, 0);
            break;

        case ColorProperty.Red:
            sp.sprite = gameManager.sp_bubble[3];
            //sp.color = new Color(1, 0, 0);
            break;

        case ColorProperty.Purple:
            sp.sprite = gameManager.sp_bubble[4];
            //sp.color = new Color32(238, 130, 238, 255);
            break;

        case ColorProperty.Black:
            sp.sprite = gameManager.sp_bubble[5];
            //sp.color = new Color(0, 1, 0);
            break;
        }
        yield return(new WaitForSeconds(0.4f));

        sp.enabled = true;                  // Test
    }
示例#17
0
        /// <summary>
        /// Retrieves all block ITerminalProperty values.
        /// </summary>
        private List <IScrollableProp> GetScrollableProps()
        {
            List <ITerminalProperty> properties = new List <ITerminalProperty>(12);
            List <IScrollableProp>   scrollables;
            IMyBatteryBlock          battery = TBlock as IMyBatteryBlock;
            IMyTerminalControl       terminalControl;
            string name;

            TBlock.GetProperties(properties);
            scrollables = new List <IScrollableProp>(properties.Count);

            foreach (ITerminalProperty prop in properties)
            {
                name            = GetTooltipName(prop);
                terminalControl = prop as IMyTerminalControl;

                if (name.Length > 0 && terminalControl != null && terminalControl.Visible(TBlock))
                {
                    if (prop is ITerminalProperty <bool> )
                    {
                        scrollables.Add(new BoolProperty(name, (ITerminalProperty <bool>)prop, this));
                    }
                    else if (prop is ITerminalProperty <float> )
                    {
                        scrollables.Add(new FloatProperty(name, (ITerminalProperty <float>)prop, this));
                    }
                    else if (prop is ITerminalProperty <Color> )
                    {
                        scrollables.AddRange(ColorProperty.GetColorProperties(name, this, (ITerminalProperty <Color>)prop));
                    }
                }
            }

            if (battery != null)
            {
                scrollables.Add(new BattProperty(battery));
            }

            return(scrollables);
        }
示例#18
0
        private ReportCellProperty GetCellProperty(AttributeBase attribute)
        {
            ReportCellProperty property = null;

            switch (attribute)
            {
            case AlignmentAttribute alignmentAttribute:
                property = new AlignmentProperty(alignmentAttribute.Alignment);
                break;

            case BoldAttribute _:
                property = new BoldProperty();
                break;

            case ColorAttribute colorAttribute:
                property = new ColorProperty(colorAttribute.FontColor, colorAttribute.BackgroundColor);
                break;

            case DateTimeFormatAttribute dateTimeFormatAttribute:
                property = new DateTimeFormatProperty(dateTimeFormatAttribute.Format);
                break;

            case DecimalPrecisionAttribute decimalPrecisionAttribute:
                property = new DecimalPrecisionProperty(decimalPrecisionAttribute.Precision);
                break;

            case MaxLengthAttribute maxLengthAttribute:
                property = new MaxLengthProperty(maxLengthAttribute.MaxLength);
                break;

            case PercentFormatAttribute percentFormatAttribute:
                property = new PercentFormatProperty(percentFormatAttribute.Precision)
                {
                    PostfixText = percentFormatAttribute.PostfixText,
                };
                break;
            }

            return(property);
        }
示例#19
0
文件: Part.cs 项目: ext0/Flex
        public override void Initialize()
        {
            _position = new Properties.Vector3(0, 0, 0);
            _position.PropertyChanged += PositionPropertyChanged;

            _rotation = new Rotation();
            _rotation.PropertyChanged += RotationPropertyChanged;

            _size = new Properties.Vector3(8, 4, 4);
            _size.PropertyChanged += SizePropertyChanged;

            _color = new ColorProperty(Colors.White);
            _color.PropertyChanged += ColorPropertyChanged;

            Engine.QueueForRenderDispatcher(() =>
            {
                InitializeVisual();
                LoadPhysicsInstance();

                _initialized = true;
            });
        }
示例#20
0
    IEnumerator ColorPopulation()
    {
        yield return(new WaitForSeconds(0.1f));

        sp = this.GetComponent <SpriteRenderer>();
        this.BubbleColor = GameObject.FindObjectOfType <NextBubbleManager>().GetCurrent();
        switch (this.BubbleColor)
        {
        case ColorProperty.Green:
            sp.sprite = gameManager.sp_bubble[0];
            //sp.color = new Color(0, 1, 0);
            break;

        case ColorProperty.Blue:
            sp.sprite = gameManager.sp_bubble[1];
            //sp.color = new Color(0, 0, 1);
            break;

        case ColorProperty.Yellow:
            sp.sprite = gameManager.sp_bubble[2];
            //sp.color = new Color(1, 1, 0);
            break;

        case ColorProperty.Red:
            sp.sprite = gameManager.sp_bubble[3];
            //sp.color = new Color(1, 0, 0);
            break;

        case ColorProperty.Purple:
            sp.sprite = gameManager.sp_bubble[4];
            //sp.color = new Color32(238, 130, 238, 255);
            break;

        case ColorProperty.Black:
            sp.sprite = gameManager.sp_bubble[5];
            //sp.color = new Color(0, 1, 0);
            break;
        }
    }
示例#21
0
        public void ColorPropertyStore(ColorProperty _colorMerge, SpriteRenderer _colorSpriteRenderer, int _colorCount)
        
    {
                _colorMerge._mergeNumber   = _colorCount;
                _colorMerge._colorValue255 = _colorSpriteRenderer.color;
            //  Debug.Log("_colorValue255.r: " + _colorMerge._colorValue255.r*255);
                int i = 0;

                for(i = 0; i < 8; i++)
        {
                        if(_colorMerge._colorValue255.r * 255 <= colorSlot[i].r + 0.5f && _colorMerge._colorValue255.r * 255 >= colorSlot[i].r - 0.5f)
            {
                                _colorMerge._colorIndex = i;
                            //  Debug.Log("_colorValue255.r: " + _colorMerge._colorValue255.r*255 + "       colorSlot.r: " + colorSlot[i].r);
                                    break;

                            
            }
                    
        }
            
    }
示例#22
0
        public override IEnumerator Execute(GameObject target, IAction[] actions, int index)
        {
            if (this.graphic != null)
            {
                Color currentColor = this.graphic.color;
                Color targetColor  = this.color.GetValue(target);

                float     startTime = Time.unscaledTime;
                WaitUntil waitUntil = new WaitUntil(() =>
                {
                    float t            = (Time.unscaledTime - startTime) / this.duration;
                    this.graphic.color = Color.Lerp(currentColor, targetColor, t);

                    return(t > 1.0f);
                });

                yield return(waitUntil);

                this.graphic.color = targetColor;
            }

            yield return(0);
        }
示例#23
0
 set => base.SetValue(ColorProperty, value);
示例#24
0
 public System.Drawing.Color GetColor(ColorProperty prop)
 {
 }
this.SetValue(ColorProperty, value);
        /// <include file='doc\VisualStyleRenderer.uex' path='docs/doc[@for="VisualStyleRenderer.GetColor"]/*' />
        /// <devdoc>
        ///    <para>
        ///       [See win32 equivalent.]
        ///    </para>
        /// </devdoc>
        public Color GetColor(ColorProperty prop) {
            //valid values are 0xed9 to 0xeef
            if (!ClientUtils.IsEnumValid(prop, (int)prop, (int)ColorProperty.BorderColor, (int)ColorProperty.AccentColorHint))
            {
                throw new InvalidEnumArgumentException("prop", (int)prop, typeof(ColorProperty));
            }

            int color = 0;
            lastHResult = SafeNativeMethods.GetThemeColor(new HandleRef(this, Handle), part, state, (int)prop, ref color);
            return ColorTranslator.FromWin32(color);
        }
示例#27
0
 set { SetValue(ColorProperty, value); CodeColor = Color.ToString(); }
 public System.Drawing.Color GetColor(ColorProperty prop)
 {
     if (!System.Windows.Forms.ClientUtils.IsEnumValid(prop, (int) prop, 0xed9, 0xeef))
     {
         throw new InvalidEnumArgumentException("prop", (int) prop, typeof(ColorProperty));
     }
     int pColor = 0;
     this.lastHResult = System.Windows.Forms.SafeNativeMethods.GetThemeColor(new HandleRef(this, this.Handle), this.part, this.state, (int) prop, ref pColor);
     return ColorTranslator.FromWin32(pColor);
 }
示例#29
0
		public int UxThemeGetThemeColor (IntPtr hTheme, int iPartId, int iStateId, ColorProperty prop, out Color result)
		{
			int retval;
			int hresult = UXTheme.GetThemeColor (hTheme, iPartId, iStateId, (int)prop, out retval);

			result = System.Drawing.Color.FromArgb ((int)(0x000000FFU & retval),
			     (int)(0x0000FF00U & retval) >> 8, (int)(0x00FF0000U & retval) >> 16);
			return hresult;
		}
示例#30
0
 public int UxThemeGetThemeColor(IntPtr hTheme, int iPartId, int iStateId, ColorProperty prop, out Color result) => throw new InvalidOperationException();
示例#31
0
        public void CreatingNewObject_ShouldHaveCorrectValueIfCorectDataGiven()
        {
            var actual = new ColorProperty(new HexLiteral(Color.Violet));

            Assert.Equal(Color.Violet, actual.Value.Value);
        }
		public Color GetColor (ColorProperty prop)
		{
			if (!Enum.IsDefined (typeof (ColorProperty), prop))
				throw new System.ComponentModel.InvalidEnumArgumentException ("prop", (int)prop, typeof (ColorProperty));

			Color result;
			last_hresult = VisualStyles.UxThemeGetThemeColor (theme, this.part, this.state, prop, out result);
			return result;
		}
		public int UxThemeGetThemeColor (IntPtr hTheme, int iPartId, int iStateId, ColorProperty prop, out Color result)
		{
			result = Color.Black;
			return (int)S.S_FALSE;
		}
示例#34
0
 public virtual TResult Visit(ColorProperty expression, TEnvironment environment)
 {
     expression.Value.Accept(this, environment);
     return(default(TResult));
 }
示例#35
0
 public Color GetColor(ColorProperty prop)
 {
     throw null;
 }
 public System.Drawing.Color GetColor(ColorProperty prop)
 {
 }
示例#37
0
 get => (Color)GetValue(ColorProperty); set => SetValue(ColorProperty, value);
示例#38
0
 set => SetValue(ColorProperty, value);
示例#39
0
 public virtual TResult Visit(ColorProperty property, TEnvironment environment)
 {
     property.Value.Accept(this, environment);
     return(default(TResult));
 }