Пример #1
0
    public void OnDrag(PointerEventData eventData)
    {
        float hueValue = SetPickerPositionFromScreen(Input.mousePosition);

        ColorSBPicker.SetHue(hueValue);
        ColorPicker.SetTargetColor();
    }
Пример #2
0
    public static void SetColor(Color c)
    {
        HSBColor hsb = HSBColor.FromColor(c);

        ColorPicker.selectedColor = c;
        chp.SetPickerPositionFromHue(hsb.h);
        ColorSBPicker.SetHue(hsb.h);
        csbp.SetPickerPositionFromSB(hsb.s, hsb.b);
    }
Пример #3
0
//	void Update()
//	{
//		if (Input.GetMouseButtonDown (0)) {
//			// inrect is set to return always false.. This is for later
//			if (inRect(Input.mousePosition)) {
//				float hueValue = SetPickerPositionFromScreen (Input.mousePosition);
//				ColorSBPicker.SetHue (hueValue);
//			}
//		}
//	}

    void Initialize()
    {
        bgTrans   = HBackground.GetComponent <RectTransform> ();
        rectTrans = gameObject.GetComponent <RectTransform> ();
        width     = bgTrans.rect.width;
        height    = bgTrans.rect.height;
        Vector2 p = rectTrans.anchoredPosition;

        ColorSBPicker.SetHue(GetHueValueFromPoint((horizontalHueScale) ? p.x : p.y));
    }
Пример #4
0
    void Start()
    {
        ColorPicker.chp = gameObject.GetComponent <ColorHPicker> ();
        bgTrans         = HBackground.GetComponent <RectTransform> ();
        rectTrans       = gameObject.GetComponent <RectTransform> ();
        width           = bgTrans.rect.width;
        height          = bgTrans.rect.height;
        Vector2 p = rectTrans.anchoredPosition;

        shift = new Vector2(bgTrans.position.x, bgTrans.position.y);
        GameObject cp = GameObject.FindGameObjectWithTag("ColorWheel");

        setShaderOrigin(cp.GetComponent <RectTransform>().anchoredPosition);

        float hue = circularScale ? width * (turnableScale ? 0.125f : -0.25f) : p.x;

        if (turnableScale)
        {
            Material m = HBackground.GetComponent <Shape> ().material;
            m.SetFloat("_Rotation", 0);
        }
        ColorSBPicker.SetHue(GetHueValueFromPoint(hue));
        ColorPicker.SetTargetColor();
    }