public void SetRed(float r) { var newColor = _baseColor; newColor.r = r * _multiplier; colorOutput.Invoke(newColor); }
public void SetValue(Color color) { _Value = color; SetHSV(); UpdatePreview(); UpdateHexadecimal(Value); OnValueChangedInteral.Invoke(Value); OnValueChanged.Invoke(Value); }
void Refresh() { if (active) { Color.Invoke(activeColor); } else if (highlight && !active) { Color.Invoke(highlightColor); } else { Color.Invoke(defaultColor); } }
public void UpdateColor() { swatchColor.value = new Vector3(hSlider.VerticalSliderValue, 1f, 1f); Color color = new Vector3(hSlider.VerticalSliderValue, sVSlider.HorizontalSliderValue, sVSlider.VerticalSliderValue).HSVtoRGB(); GraphicColorEvent.Invoke(color); }
private void Update() { if (colorBox != null) { colorBox.color = color; } if (!isInside) { return; } Color arg = ColorAtScreenPos(Input.mousePosition); if (!isTransparent && onColorPick != null) { if (Input.GetMouseButton(0)) { onColorPick.Invoke(arg); } onColorPreview.Invoke(arg); } else { onEndPreview.Invoke(); } }
void Update() { Vector2 delta; RectTransformUtility.ScreenPointToLocalPointInRectangle(rect, Input.mousePosition, null, out delta); var rect1 = rect.rect; float width = rect1.width; float height = rect1.height; delta += new Vector2(width * 0.5f, height * 0.5f); float x = Mathf.Clamp(delta.x / width, 0f, 1f); float y = Mathf.Clamp(delta.y / height, 0f, 1f); int textureX = Mathf.RoundToInt(x * colorTexture.width); int textureY = Mathf.RoundToInt(y * colorTexture.height); color = colorTexture.GetPixel(textureX, textureY); Vector2 localMousePosition = rect.InverseTransformPoint(Input.mousePosition); if (rect.rect.Contains(localMousePosition)) { onColorPreview?.Invoke(color); if (Input.GetMouseButtonDown(0)) { onColorSelect?.Invoke(color); painterButtons.ChangeExistingPainterButtonColor( painterButtons.GetByName(tileTypeLib.associatedButton.gameObject.name), color); } } }
// Update is called once per frame void Update() { if (RectTransformUtility.RectangleContainsScreenPoint(Rect, Input.mousePosition)) { Vector2 delta; RectTransformUtility.ScreenPointToLocalPointInRectangle(Rect, Input.mousePosition, null, out delta); string debug = "mousePosition = " + Input.mousePosition; debug += "<br>delta" + delta; float width = Rect.rect.width; float height = Rect.rect.height; delta += new Vector2(width * .5f, height * .5f); debug += "<br>offset delta =" + delta; float x = Mathf.Clamp(delta.x / width, 0f, 1f); float y = Mathf.Clamp(delta.y / height, 0f, 1f); int texX = Mathf.RoundToInt(x * ColorTexture.width); int texY = Mathf.RoundToInt(y * ColorTexture.height); Color color = ColorTexture.GetPixel(texX, texY); if (Input.touchCount > 0) { OnColorSelect?.Invoke(color); } } }
public void HandleHitCoord(bool preview, int priority, float pressure, int seed, P3dHit hit, Quaternion rotation) { if (preview == true && this.preview == false) { return; } var model = hit.Root.GetComponent <P3dModel>(); if (model != null) { var paintableTextures = P3dPaintableTexture.FilterAll(model, group); for (var i = paintableTextures.Count - 1; i >= 0; i--) { var paintableTexture = paintableTextures[i]; var coord = paintableTexture.GetCoord(ref hit); color = P3dHelper.GetPixel(paintableTexture.Current, coord); if (onColor != null) { onColor.Invoke(color); } } } }
private void ChangeColor(int channel, float value) { var old = m_Color; if (channel == 0) { m_Color.r = value; } else if (channel == 1) { m_Color.g = value; } else if (channel == 2) { m_Color.b = value; } else { m_Color.a = value; } if (old != m_Color) { m_ColorEvent.Invoke(m_Color); } }
/// <summary> Method used by the ThemeManager when the active variant or selected theme have changed </summary> /// <param name="theme"> Target theme </param> public override void UpdateTarget(ThemeData theme) { if (Event == null) { return; } if (theme == null) { return; } base.UpdateTarget(theme); if (ThemeId == Guid.Empty) { return; } if (PropertyId == Guid.Empty) { return; } if (theme.ActiveVariant == null) { return; } Event.Invoke(theme.ActiveVariant.GetColor(PropertyId)); }
protected override void Read(JToken value) { Color color; ColorUtility.TryParseHtmlString("#" + (string)value, out color); onLoad.Invoke(color); }
public void ToColor(string value) { Color color; ColorUtility.TryParseHtmlString("#" + value, out color); toColor.Invoke(color); }
void UpdateAndInvoke() { var hue = _hue - Mathf.Floor(_hue); var c = Color.HSVToRGB(hue, _saturation, _brightness); c.a = _alpha; _colorEvent.Invoke(c); }
public void Set(int index) { if (index >= colors.Length) { return; } this.index = index; Color.Invoke(colors[index]); }
// PUBLIC public void ChangeColor(Color c) { _totemAuraRenderer.material.color = c; if (OnColorChange != null) { OnColorChange.Invoke(c); } }
IEnumerator Tween_Color(Color frm, Color to) { var timer = 0f; while (timer < 1) { timer += Time.deltaTime; onColorChange.Invoke(to * timer + frm * (1 - timer)); yield return(null); } }
private void UpdateColor() { var c = Color.HSVToRGB(m_hue, m_saturation, m_value, m_hdr); c.a = m_alpha; if (m_prevColor != c) { onValueChanged.Invoke(c); m_prevColor = c; } }
public void SetColor(Color color) { _color = color; switch (_channel) { case Channel.Red: onMinChanged.Invoke(new Color(0, _color.g, _color.b)); onMaxChanged.Invoke(new Color(1, _color.g, _color.b)); break; case Channel.Green: onMinChanged.Invoke(new Color(_color.r, 0, _color.b)); onMaxChanged.Invoke(new Color(_color.r, 1, _color.b)); break; case Channel.Blue: onMinChanged.Invoke(new Color(_color.r, _color.g, 0)); onMaxChanged.Invoke(new Color(_color.r, _color.g, 1)); break; } }
public void Input(float percent) { if (reverse) { percent = 1f - percent; } if (useCurve) { percent = curve.Evaluate(percent); } Output.Invoke(Color.Lerp(start, end, percent)); }
private void OnTriggerEnter(Collider other) { if (other.tag == tagname && triEn) { if (EnableBool) { boolevents.Invoke(boolvalue); } if (EnableInt) { intevents.Invoke(intvalue); } if (EnableFloat) { floatevents.Invoke(floatvalue); } if (EnableFloatArray) { floatarratevents.Invoke(floatarrayvalue); } if (EnableColor) { colorevents.Invoke(colorvalue); } if (EnableVoid) { voidevents.Invoke(); } } }
void Update() { if (!_initialized) { return; } var exp = Mathf.Exp(-_speed * Time.deltaTime); _current = Color.Lerp(_target, _current, exp); _outputEvent.Invoke(_current); }
private void Awake() { onColorChanged = new ColorEvent(); foreach (var item in Toggles) { item.onValueChanged.AddListener(a => { if (!a) { return; } ShowColor.color = new Color(item.GetComponent <Image>().color.r, item.GetComponent <Image>().color.g, item.GetComponent <Image>().color.b, ShowColor.color.a); onColorChanged?.Invoke(ShowColor.color); }); } Diaphaneity.onValueChanged.AddListener(a => { DiaphaneityText.text = $"{Math.Round(a * 100)}%"; ShowColor.color = new Color(ShowColor.color.r, ShowColor.color.g, ShowColor.color.b, a); onColorChanged?.Invoke(ShowColor.color); }); }
public void InjectRomance(int romanceValue) { if (romanceValue == 0) { this.noRomance.Invoke(); } else { var resource = lastInjectedData.ressources.FirstOrDefault(r => r.type == ResourceType.Romance); if (romanceValue > 0) { romanceSprite.Invoke(resource.data.goodSprite); romanceColor.Invoke(resource.data.goodColor); this.romanceValue.Invoke(string.Concat("+", romanceValue.ToString())); } else { romanceSprite.Invoke(resource.data.badSprite); romanceColor.Invoke(resource.data.badColor); this.romanceValue.Invoke(romanceValue.ToString()); } } }
public override void OnUpdateBounds(Bounds bounds) { base.OnUpdateBounds(bounds); color = Create(resolution, resolution, 0, RenderTextureFormat.ARGBHalf, TextureWrapMode.Repeat); var cam = GetComponent <Camera>(); cam.targetTexture = color; cam.Render(); cam.enabled = false; onCapture.Invoke(color); }
public void InjectEpicness(int epicnessValue) { if (epicnessValue == 0) { this.noEpicness.Invoke(); } else { var resource = lastInjectedData.ressources.FirstOrDefault(r => r.type == ResourceType.Epicness); if (epicnessValue > 0) { epicnessSprite.Invoke(resource.data.goodSprite); epicnessColor.Invoke(resource.data.goodColor); this.epicnessValue.Invoke(string.Concat("+", epicnessValue.ToString())); } else { epicnessSprite.Invoke(resource.data.badSprite); epicnessColor.Invoke(resource.data.badColor); this.epicnessValue.Invoke(epicnessValue.ToString()); } } }
//Gets called after changes void updateColor() { Color c = Color.white; //Calculation of color same as above c.r = Mathf.Clamp(2 / Mathf.PI * Mathf.Asin(Mathf.Cos(outer)) * 1.5f + 0.5f, 0, 1); c.g = Mathf.Clamp(2 / Mathf.PI * Mathf.Asin(Mathf.Cos(2 * Mathf.PI * (1.0f / 3.0f) - outer)) * 1.5f + 0.5f, 0, 1); c.b = Mathf.Clamp(2 / Mathf.PI * Mathf.Asin(Mathf.Cos(2 * Mathf.PI * (2.0f / 3.0f) - outer)) * 1.5f + 0.5f, 0, 1); //Add the colors of the inner box c = Color.Lerp(c, Color.white, inner.x); c = Color.Lerp(c, Color.black, inner.y); Selection = c; onColorChanged.Invoke(c); }
IEnumerator AnimateButton() { timer = 0; while (timer < maxTime) { timer += Time.deltaTime; //myButton.transform.localScale = Vector3.one * animCurve.Evaluate(Mathf.Clamp01(timer / maxTime)); float y = animCurve.Evaluate(Mathf.Clamp01(timer / maxTime)); v3Events.Invoke(Vector3.one * y); Color clr = Color.Lerp(Color.white, Color.black, y); clrEvents.Invoke(clr); yield return(null); } }
private void HandleColor(Color read) { var color32 = (Color32)color; var read32 = (Color32)read; var threshold32 = (int)(threshold * 255.0f); var distance = 0; distance += System.Math.Abs(color32.r - read32.r); distance += System.Math.Abs(color32.g - read32.g); distance += System.Math.Abs(color32.b - read32.b); distance += System.Math.Abs(color32.a - read32.a); if (distance <= threshold32) { if (onColor != null) { onColor.Invoke(color); } } }
private void Complete() { if (startComplete) { if (EnableBool) { boolevents.Invoke(boolvalue); } if (EnableInt) { intevents.Invoke(intvalue); } if (EnableFloat) { floatevents.Invoke(floatvalue); } if (EnableFloatArray) { floatarratevents.Invoke(floatarrayvalue); } if (EnableVector3) { vector3events.Invoke(vector3value); } if (EnableColor) { colorevents.Invoke(colorvalue); } if (EnableVoid) { voidevents.Invoke(); } } }
private IEnumerator PickColor() { yield return(new WaitForEndOfFrame()); int width = 1; int height = 1; if (readPixTex == null) { readPixTex = new Texture2D(width, height, TextureFormat.RGB24, mipmap: false); } Texture2D texture2D = readPixTex; Vector3 mousePosition = Input.mousePosition; float x = mousePosition.x; Vector3 mousePosition2 = Input.mousePosition; texture2D.ReadPixels(new Rect(x, mousePosition2.y, width, height), 0, 0); readPixTex.Apply(); Color sampledColor = readPixTex.GetPixel(0, 0); onColorPick.Invoke(sampledColor); }