예제 #1
0
    private void ActivateSprite(Vector2 position)
    {
        if (BoardAgent.GetSpriteEnabled(position))
        {
            return;
        }

        BoardAgent.SetSpriteImage(position, SpriteAgent.GetCurrentSprite());

        Color color = ColorAgent.GetCurrentColorPack().foregroundColor;

        if (color == ColorAgent.RainbowColor)
        {
            BoardAgent.SetSpriteColor(position, Utilities.ColorFromHSV(((position.y / (float)BoardAgent.BoardHeight) * 360f + colorOffset) % 360f, 1f, 1f));
        }
        else if (color == ColorAgent.RandomColor)
        {
            BoardAgent.SetSpriteColor(position, Utilities.ColorFromHSV(Random.Range(0f, 360f), 1f, 1f));
        }
        else
        {
            BoardAgent.SetSpriteColor(position, color);
        }

        BoardAgent.SetSpriteScale(position, new Vector3(BoardAgent.CellSize * (Random.value < 0.5f ? 1f : -1f), BoardAgent.CellSize * (Random.value < 0.5f ? 1f : -1f), 1f));
        BoardAgent.SetSpriteEnabled(position, true);
    }
예제 #2
0
    private void OnTouchUp(int fingerIndex, Vector2 fingerPos, float timeHeldDown)
    {
        if (!gameObject.activeInHierarchy || (ignoreOnPopUp && RatingAgent.GetPopUpEnabled()))
        {
            return;
        }

        if (colorController)
        {
            colorController.SetColor(ColorAgent.GetCurrentColorPack().TypeToColor(colorController.colorType));
        }

        if (GameAgent.GetWasHolding())
        {
            return;
        }

        if (RectTransformUtility.RectangleContainsScreenPoint(rectTransform, fingerPos, null))
        {
            if (OnAreaTouch != null)
            {
                OnAreaTouch();
            }

            if (OnAreaTouchWithCallback != null)
            {
                OnAreaTouchWithCallback(this);
            }

            AudioAgent.PlaySoundEffect(AudioAgent.SoundEffectType.ButtonTap);
        }
    }
예제 #3
0
    private void OnTouchDown(int fingerIndex, Vector2 fingerPos)
    {
        if (!gameObject.activeInHierarchy || (ignoreOnPopUp && RatingAgent.GetPopUpEnabled()))
        {
            return;
        }

        if (RectTransformUtility.RectangleContainsScreenPoint(rectTransform, fingerPos, null) && !GameAgent.GetWasHolding())
        {
            colorController.SetColor(ColorAgent.GetCurrentColorPack().midColor);
        }
    }
예제 #4
0
    public void SetColor(Color color)
    {
        if (colorType == ColorAgent.ColorType.Foreground && (color == ColorAgent.RainbowColor || color == ColorAgent.RandomColor))
        {
            color = (ColorAgent.GetCurrentColorPack().backgroundColor == Color.white ? Color.black : Color.white);
        }

        switch (uiType)
        {
        case UIType.UIImage: GetComponent <Image>().color = new Color(color.r, color.g, color.b, GetComponent <Image>().color.a); break;

        case UIType.UIText: GetComponent <Text>().color = new Color(color.r, color.g, color.b, GetComponent <Text>().color.a); break;

        case UIType.UICamera: GetComponent <Camera>().backgroundColor = new Color(color.r, color.g, color.b, GetComponent <Camera>().backgroundColor.a); break;
        }
    }
예제 #5
0
 void OnEnable()
 {
     ColorAgent.RegisterColorController(this);
     SetColor(ColorAgent.GetCurrentColorPack().TypeToColor(colorType));
 }