Esempio n. 1
0
    protected override void Start()
    {
        base.Start();

        _tintPressed = UtilsColor.ConvertColor("#e95525");             // e9552575         // ef805cbf

        GameObject child = gameObject.MakeUiObject("Tint");

        _tintImage = child.AddComponent <Image>();
        _tintImage.SetSize(new Vector2(Image.GetWidth(), Image.GetHeight()));
        _tintImage.sprite = tintImage;
        _tintImage.color  = Color.clear;

        _scrollRect = GetComponentInParent <ScrollRectExtend>();
        _scrollRect.OnBeginDragEvent += OnBeginDrag;
        _scrollRect.OnEndDragEvent   += OnEndDrag;
    }
Esempio n. 2
0
    private void Initialize(GameObject focusGameObject)
    {
        Image blockerImage = gameObject.AddComponent <Image>();

        // TODO: Animate blocker's black cover alpha

        blockerImage.color = UtilsColor.ConvertColor("#00000099");                // use black cover
        // blockerImage.color = Utils.ConvertColor("#FF000000");     // last two 00 are alpha

        // Note: Assumption that all GameObjects are scaled at 100%
        RectTransform canvasRect = focusGameObject.GetCanvasRect();

        blockerImage.SetSize(canvasRect.sizeDelta);
        // blockerImage.SetScale(new Vector3(1f, 1f, 1));
        Vector3 position = -GetSumOfPositions(focusGameObject);

        blockerImage.SetPosition(position);
        _iBlockResolver = gameObject.GetComponentInParent <IBlockResolver>();
    }
Esempio n. 3
0
    public void SetStyle(string normalColor,
                         string highlightedColor,
                         string pressedColor,
                         string selectedColor,
                         string disabledColor)
    {
        NormalColor      = normalColor;
        HighlightedColor = highlightedColor;
        PressedColor     = pressedColor;
        SelectedColor    = selectedColor;
        DisabledColor    = disabledColor;

        // ensure Text Color
        if (string.IsNullOrEmpty(NormalColor))
        {
            _normalColor = textField.color;
        }
        else
        {
            _normalColor = UtilsColor.ConvertColor(NormalColor);
        }

        if (string.IsNullOrEmpty(HighlightedColor))
        {
            _highlightedColor = _normalColor;
        }
        else
        {
            _highlightedColor = UtilsColor.ConvertColor(HighlightedColor);
        }

        if (string.IsNullOrEmpty(PressedColor))
        {
            _pressedColor = _highlightedColor;
        }
        else
        {
            _pressedColor = UtilsColor.ConvertColor(PressedColor);
        }

        if (string.IsNullOrEmpty(SelectedColor))
        {
            _selectedColor = _pressedColor;
        }
        else
        {
            _selectedColor = UtilsColor.ConvertColor(SelectedColor);
        }

        if (string.IsNullOrEmpty(DisabledColor))
        {
            // TODO: Use alpha? or Grey?
            _disabledColor = _normalColor;
        }
        else
        {
            _disabledColor = UtilsColor.ConvertColor(DisabledColor);
        }

        textField.raycastTarget = false;
    }