Exemple #1
0
        public static DraggedReferenceItem CreateDraggedReferenceItem(Object reference, PointerEventData draggingPointer, UISkin skin = null)
        {
            DraggedReferenceItem referenceItem = (DraggedReferenceItem)Object.Instantiate(Resources.Load <DraggedReferenceItem>("RuntimeInspector/DraggedReferenceItem"), DraggedReferenceItemsCanvas.transform, false);

            referenceItem.Initialize(DraggedReferenceItemsCanvas, reference, draggingPointer, skin);

            return(referenceItem);
        }
 public static void SetSkinText(this Text text, UISkin skin)
 {
     text.color    = skin.TextColor;
     text.font     = skin.Font;
     text.fontSize = skin.FontSize;
 }
        public void Initialize(Canvas canvas, Object reference, PointerEventData draggingPointer, UISkin skin)
        {
            rectTransform   = (RectTransform)transform;
            canvasTransform = (RectTransform)canvas.transform;

            m_reference        = reference;
            referenceName.text = reference.GetNameWithType();

            this.draggingPointer = draggingPointer;

            if (canvas.renderMode == RenderMode.ScreenSpaceOverlay || (canvas.renderMode == RenderMode.ScreenSpaceCamera && canvas.worldCamera == null))
            {
                worldCamera = null;
            }
            else
            {
                worldCamera = canvas.worldCamera ?? Camera.main;
            }

            if (skin != null)
            {
                borderLayoutElement.SetHeight(skin.LineHeight * 2.5f);
                background.GetComponent <LayoutElement>().minHeight = skin.LineHeight;

                float alpha     = background.color.a;
                Color skinColor = skin.InputFieldNormalBackgroundColor.Tint(0.05f);
                skinColor.a      = alpha;
                background.color = skinColor;

                referenceName.SetSkinInputFieldText(skin);
            }

            OnDrag(draggingPointer);

            draggingPointer.pointerDrag = gameObject;
            draggingPointer.dragging    = true;

            StartCoroutine(ValidatePointer());
        }
 public static void SetSkinButton(this Button button, UISkin skin)
 {
     button.targetGraphic.color = skin.ButtonBackgroundColor;
     button.GetComponentInChildren <Text>().SetSkinButtonText(skin);
 }