protected override object ConstructTexture(ConnectorSide side, ConnectorDirection direction, bool connected, Color tint = default(Color))
        {

            string iconBase = null;

            if (direction == ConnectorDirection.Input && connected) iconBase = _filledInputIconCode;
            if (direction == ConnectorDirection.Input && !connected) iconBase = _emptyInputIconCode;
            if (direction == ConnectorDirection.Output && connected) iconBase = _filledOutputIconCode;
            if (direction == ConnectorDirection.Output && !connected) iconBase = _emptyOutputIconCode;
            if (direction == ConnectorDirection.TwoWay && connected) iconBase = _emptyTwoWayIconCode;
            if (direction == ConnectorDirection.TwoWay && !connected) iconBase = _filledTwoWayIconCode;

            var baseTexture = ElementDesignerStyles.GetSkinTexture(iconBase);

            if (tint != default(Color))
            {
                baseTexture = baseTexture.Tint(tint);
            }

            switch (side)
            {
                default:
                    return baseTexture;
            }

            return null;
        }
Пример #2
0
    private void MoveUI()
    {
        //for each side get button and have hover over side pos
        //   Debug.Log("moveuio called");
        int count = 0;

        foreach (GameObject side in ConnSides)
        {
            ConnectorSide CSide   = side.transform.parent.transform.gameObject.GetComponent <ConnectorSide>();
            Vector3       sidePos = Camera.main.WorldToScreenPoint(side.transform.position);

            ConnButtons[count].transform.position = sidePos;

            if (side.transform.parent.transform.gameObject.GetComponent <ConnectorSide>().ButtonAdded == false)
            {
                // ConnectorSide CSide = side.transform.parent.transform.gameObject.GetComponent<ConnectorSide>();
                // button.GetComponent<Button>().onClick.AddListener(CSide.ModifySide);

                ConnButtons[count].gameObject.GetComponent <Button>().onClick.AddListener(CSide.ModifySide);
                side.transform.parent.transform.gameObject.GetComponent <ConnectorSide>().buttonAssigned = ConnButtons[count];

                side.transform.parent.transform.gameObject.GetComponent <ConnectorSide>().ButtonAdded = true;
            }

            if (side.transform.parent.transform.gameObject.GetComponent <ConnectorSide>().upgradeLevel > 0)
            {
                // Debug.Log("> 0");
                if (side.transform.parent.transform.gameObject.GetComponent <ConnectorSide>().subButtonAdded == false)
                {
                    ConnButtons[count].transform.GetChild(1).transform.GetComponent <Button>().onClick.AddListener(CSide.SwapConnType);
                    side.transform.parent.transform.gameObject.GetComponent <ConnectorSide>().subButtonAdded = true;
                    // Debug.Log("listener added");
                }

                switch (CSide.connectorStatus)
                {
                case 1:
                    ConnButtons[count].transform.GetChild(1).transform.GetChild(0).GetComponent <Text>().text = "Exp";
                    break;

                case 2:
                    ConnButtons[count].transform.GetChild(1).transform.GetChild(0).GetComponent <Text>().text = "Inp";
                    break;

                default: break;
                }
            }
            count++;
        }
    }
Пример #3
0
        protected override object ConstructTexture(ConnectorSide side, ConnectorDirection direction, bool connected, Color tint = default(Color))
        {
            string iconBase = null;

            if (direction == ConnectorDirection.Input && connected)
            {
                iconBase = _filledInputIconCode;
            }
            if (direction == ConnectorDirection.Input && !connected)
            {
                iconBase = _emptyInputIconCode;
            }
            if (direction == ConnectorDirection.Output && connected)
            {
                iconBase = _filledOutputIconCode;
            }
            if (direction == ConnectorDirection.Output && !connected)
            {
                iconBase = _emptyOutputIconCode;
            }
            if (direction == ConnectorDirection.TwoWay && connected)
            {
                iconBase = _emptyTwoWayIconCode;
            }
            if (direction == ConnectorDirection.TwoWay && !connected)
            {
                iconBase = _filledTwoWayIconCode;
            }

            var baseTexture = ElementDesignerStyles.GetSkinTexture(iconBase);

            if (tint != default(Color))
            {
                baseTexture = baseTexture.Tint(tint);
            }

            switch (side)
            {
            default:
                return(baseTexture);
            }

            return(null);
        }
Пример #4
0
        public object GetTexture(ConnectorSide side, ConnectorDirection direction, bool connected, Color tint = default(Color))
        {
            var item = new SideDirectionItem()
            {
                Side        = side,
                Direction   = direction,
                IsConnected = connected,
                Tint        = tint
            };


            object value = null;

            TexturesCache.TryGetValue(item, out value);
            if (value == null || value.Equals(null))
            {
                TexturesCache[item] = ConstructTexture(side, direction, connected, tint);
            }

            return(TexturesCache[item]);
        }
        public object GetTexture(ConnectorSide side, ConnectorDirection direction, bool connected, Color tint = default(Color))
        {
            var item = new SideDirectionItem()
            {
                Side = side,
                Direction = direction,
                IsConnected = connected,
                Tint = tint
            };


            object value = null;
            TexturesCache.TryGetValue(item, out value);
            if (value == null || value.Equals(null))
            {
                TexturesCache[item] = ConstructTexture(side, direction, connected, tint);
            }

            return TexturesCache[item];

        }
Пример #6
0
 protected abstract object ConstructTexture(ConnectorSide side, ConnectorDirection direction, bool connected, Color tint = default(Color));
 protected abstract object ConstructTexture(ConnectorSide side, ConnectorDirection direction, bool connected, Color tint = default(Color));