Exemple #1
0
        public override void OnPreviewGUI(Rect rect, GUIStyle background)
        {
            ProceduralImage image = target as ProceduralImage;

            if (image == null || image.sprite == null)
            {
                return;
            }

            float min = Mathf.Min(rect.width, rect.height - 50);

            rect = new Rect(rect.x + rect.width / 2 - min / 2, rect.y + rect.height / 2 - min / 2 - 20, min, min);

            Rect r = image.rectTransform.rect;

            //Fixing proportion of rect
            Vector2 center = rect.center;

            if (r.width > r.height)
            {
                rect.height = rect.height * (r.height / r.width);
            }
            else
            {
                rect.width = rect.width * (r.width / r.height);
            }
            //recenter rect
            rect.center = center;

            EditorGUI.DrawPreviewTexture(rect, image.sprite.texture, image.material);
        }
Exemple #2
0
    void Awake()
    {
        _proceduralImage = GetComponent <ProceduralImage>();
        SetBGCol         = SetBGColor();

        for (var i = 0; i < EmoticonButtons.Length; i++)
        {
            var local  = i;
            var button = EmoticonButtons[i];

            button.OnClickAsObservable().Subscribe((_) =>
            {
                OnEmoticonClick(local + 1);
            }).AddTo(this);
        }

        RxSubjects.Emoticon.Subscribe((e) => {
            if (!gameObject.activeInHierarchy)
            {
                return;
            }

            StopCoroutine(SetBGCol);
            SetBGCol = SetBGColor();
            StartCoroutine(SetBGCol);
        }).AddTo(this);
    }
Exemple #3
0
 protected virtual void Reset()
 {
     m_Base   = GetComponent <ProceduralImage>();
     m_Effect = transform.Find("Effect")?.GetComponent <ProceduralImage>();
     m_Shadow = transform.Find("Shadow")?.GetComponent <ProceduralImage>();
     m_Button = GetComponent <Button>();
 }
    void ChangePImageColor(ColorValue _colorvalue)
    {
        ProceduralImage pImage        = GetComponent <ProceduralImage>();
        float           alpha         = pImage.color.a;
        Color           colorToChange = colorPalleteHolder.GetColor(_colorvalue);

        pImage.color = new Color(colorToChange.r, colorToChange.g, colorToChange.b, alpha);
    }
Exemple #5
0
 private void Reset()
 {
     m_Base   = GetComponent <ProceduralImage>();
     m_Top    = transform.Find("Top")?.GetComponent <ProceduralImage>();
     m_Effect = m_Top?.transform.Find("Effect")?.GetComponent <ProceduralImage>();
     m_Bottom = transform.Find("Bottom")?.GetComponent <ProceduralImage>();
     m_Button = GetComponent <Button>();
 }
Exemple #6
0
    void Start()
    {
        bgImage = GetComponent <ProceduralImage>();

        GameSetting.TableSprite.Subscribe((sprite) => {
            bgImage.color = BgColor;
            border.color  = BorderColor;
        }).AddTo(this);
    }
Exemple #7
0
    void Start( )
    {
        img   = GetComponent <ProceduralImage>( );
        input = this.GetAddComp <PUIMouseTouch>( );

        input.OnClick += MouseClick;
        input.OnDown  += EaseStart;
        input.OnUp    += EaseStart;
    }
    public void ChangeToFilterColor(ProceduralImage[] arr, ProceduralImage image)
    {
        for (int i = 0; i < arr.Length; i++)
        {
            arr[i].BorderWidth = 3;
            arr[i].color       = normalColor;
        }

        image.BorderWidth = 0;
        image.color       = selectedColor;
    }
Exemple #9
0
    private void Reset()
    {
        m_Cursor      = transform.Find("Cursor")?.GetComponent <ProceduralImage>();
        m_ButtonViews = GetComponentsInChildren <ButtonObject>();

        if (m_ButtonViews.Length <= 0)
        {
            return;
        }

        var cursorRect = m_Cursor.transform as RectTransform;
        var buttonRect = m_ButtonViews[0].transform as RectTransform;

        cursorRect.sizeDelta = new Vector3(buttonRect.sizeDelta.x, cursorRect.sizeDelta.y, 0);
    }
Exemple #10
0
    void Awake()
    {
        if (maskCache == null)
        {
            maskCache = Resources.Load <GameObject>("Prefab/CircleMask");
        }

        var go = Instantiate(maskCache);

        proImage = go.GetComponent <ProceduralImage>();

        proImage.transform.SetParent(transform, false);
        proImage.enabled = false;

        numberText         = go.transform.Find("Number").GetComponent <Text>();
        numberText.enabled = false;
    }
 public void ChangeTransactinTypeElement(ProceduralImage image)
 {
     ChangeToFilterColor(transactionTypetems, image);
 }
 public void ChangeDashBoardElement(ProceduralImage image)
 {
     ChangeToFilterColor(dashBoardItems, image);
 }
Exemple #13
0
 void Awake()
 {
     button = GetComponent <Button>();
     image  = GetComponent <ProceduralImage>();
 }
Exemple #14
0
    // Use this for initialization
    void Start()
    {
        timer  = 0.0f;
        height = 300;
        width  = 400;



        nLines = nPoints - 1;
        iWidth = width / nLines;
        values = new float[nPoints];
        lines  = new GameObject[nLines];

        curMin = -1.0f;
        curMax = -1.0f;

        // Range 2 - 5;
        for (int i = 0; i < nPoints; i++)
        {
            values[i] = Random.Range(lower, upper);
            Debug.Log(i + ": " + values[i]);
            if (values[i] > curMax || curMax < 0)
            {
                curMax = values[i];
            }

            if (values[i] < curMin || curMin < 0)
            {
                curMin = values[i];
            }
        }

        Debug.Log("Min: " + curMin);
        Debug.Log("Max: " + curMax);

        CalcStats();

        Debug.Log("Mean: " + mean);
        Debug.Log("Standard Deviation: " + sd);

        for (int i = 0; i < nLines; i++)
        {
            lines[i] = new GameObject();
            RectTransform rect = lines[i].AddComponent <RectTransform>();
            Color         color;
            ColorUtility.TryParseHtmlString("#0A62EEFF", out color);
            ProceduralImage img = lines[i].AddComponent <ProceduralImage>();
            img.color           = color;
            img.FalloffDistance = 0.0001f;
            img.ModifierType    = typeof(RoundModifier);

            lines[i].transform.SetParent(transform);
            lines[i].name = "Line" + i;

            // Set default values
            rect.localPosition = Vector3.zero;
            rect.localRotation = Quaternion.identity;
            rect.localScale    = new Vector3(1, 1, 1);

            PlaceLine(lines[i].GetComponent <RectTransform>(), new Vector2(i * iWidth, GetInRange(values[i])),
                      new Vector2((i + 1) * iWidth, GetInRange(values[i + 1])));
        }
    }
Exemple #15
0
 private void Reset()
 {
     m_Frame  = transform.Find("Frame")?.GetComponent <ProceduralImage>();
     m_Effect = transform.Find("Effect")?.GetComponent <ProceduralImage>();
     m_Button = GetComponent <Button>();
 }
Exemple #16
0
 private void Reset()
 {
     m_Base = GetComponent <ProceduralImage>();
 }
Exemple #17
0
        public override string GetInfoString()
        {
            ProceduralImage image = target as ProceduralImage;

            return(string.Format("Modifier: {0}, Line-Weight: {1}", attrList[selectedId].Name, image.BorderWidth));
        }
Exemple #18
0
 private void Awake()
 {
     image           = GetComponent <ProceduralImage>();
     pulseElement    = GetComponent <PulseElement>();
     label.fontStyle = FontStyle.Normal;
 }