Пример #1
0
        /// <summary>
        /// Adds added logic specific to RADIO and TOGGLE buttons to the Widjet update loop
        /// </summary>
        public override void Update()
        {
            base.Update();

            if ((buttonType == ButtonType.RADIO || buttonType == ButtonType.TOGGLE) && isSelected && !isDisabled)
            {
                if (!hasOnSelectedFired)
                {
                    hasOnSelectedFired = true;
                    OnSelectedEvent.Invoke(this, null);
                }

                if (isDefaultImage)
                {
                    buttonImage.Color = Color.Cyan;
                }
                else if (buttonSpriteMap != null)
                {
                    if (buttonSpriteMap != null)
                    {
                        buttonSpriteMap.Play("clicked");
                    }
                }
            }
            else if ((buttonType == ButtonType.RADIO || buttonType == ButtonType.TOGGLE) && !isSelected && !isDisabled)
            {
                if (hasOnSelectedFired)
                {
                    hasOnSelectedFired = false;
                    OnDeselectedEvent.Invoke(this, null);
                }

                if (!hasOnHoverFired)
                {
                    if (isDefaultImage)
                    {
                        buttonImage.Color = Color.White;
                    }
                    else if (buttonSpriteMap != null)
                    {
                        if (buttonSpriteMap != null)
                        {
                            buttonSpriteMap.Play("inactive");
                        }
                    }
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Distpaches event to remove this connector
 /// This is a forced remove the connector is invoking
 /// </summary>
 void RemoveConnector()
 {
     OnDeselectedEvent?.Invoke(this);
 }