Ejemplo n.º 1
0
    public void SetText(string text, VertexGradient colours)
    {
        TextMeshPro tm = GetComponent <TextMeshPro>();

        tm.text          = text;
        tm.colorGradient = colours;
    }
Ejemplo n.º 2
0
 public Tweener DOVertexGradient(VertexGradient endValue, float duration)
 {
     IsModified = true;
     return(DOTween.To(VertexGradientPlugin,
                       GetVertexGradient, SetVertexGradient,
                       endValue, duration));
 }
Ejemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     _initial_gradient = _text.colorGradient;
     //_is_running = true;
     //_stopwatch.Start();
     //_initial_text = _text.text;
 }
Ejemplo n.º 4
0
    public void Init(Player _playerModel, bool _enabled)
    {
        VertexGradient newColorGradient = playerScoreText.colorGradient;

        newColorGradient.bottomLeft   = newColorGradient.bottomRight = playersColorsList.GetColorByPlayer(_playerModel.Number);
        playerScoreText.colorGradient = newColorGradient;

        CurrentPlayerScore = _playerModel.Score;

        cardHandView = new List <CardView>();
        for (int cardIndex = 0; cardIndex < _playerModel.CardHand.Count; cardIndex++)
        {
            CardView newCard = Instantiate(cardPrefab, transform);

            bool isAllOpenRuleActive   = Game.activeRules.HasFlag(GameRule.AllOpen);
            bool isThreeOpenRuleActive = Game.activeRules.HasFlag(GameRule.ThreeOpen);
            bool isOpenCard            = (isAllOpenRuleActive || (isThreeOpenRuleActive && cardIndex < 3));
            newCard.Init(_playerModel.CardHand[cardIndex], isOpenCard);

            float endPosition = cardIndex * (-newCard.SpriteRenderer.bounds.size.y * 0.525f);
            newCard.transform.localPosition = new Vector3(0, endPosition + 10, (_playerModel.CardHand.Count - cardIndex) * 0.001f);
            newCard.transform.DOLocalMoveY(endPosition, 0.35f, false)
            .SetDelay((_playerModel.CardHand.Count - cardIndex) * 0.095f)
            .OnStart(() => {
                AudioManager.Instance.PlaySound(drawCardSound);
            })
            .OnComplete(CardAnimationFinished);

            cardHandView.Add(newCard);
        }
    }
Ejemplo n.º 5
0
        void DoMeshChange()
        {
            if (!UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject)))
            {
                Debug.LogError("No textmesh pro component was found on " + gameObject);
                return;
            }

            cG = this.cachedComponent.colorGradient;

            if (!topLeft.IsNone)
            {
                cG.topLeft = topLeft.Value;
            }
            if (!topRight.IsNone)
            {
                cG.topRight = topRight.Value;
            }
            if (!bottomLeft.IsNone)
            {
                cG.bottomLeft = bottomLeft.Value;
            }
            if (!bottomRight.IsNone)
            {
                cG.bottomRight = bottomRight.Value;
            }

            this.cachedComponent.colorGradient = cG;
        }
Ejemplo n.º 6
0
        public Tweener DOGradient(int charIndex, VertexGradient endValue, float duration)
        {
            NotifyActiveColorTween();
            ProxyColor proxy = GetProxyColor(charIndex);

            return(proxy.AddTween(proxy.DOColorGradient(endValue, duration)));
        }
Ejemplo n.º 7
0
 public void healUpdateHealth(float newHealth)
 {
     health         = (int)newHealth;
     effectColor    = Color.blue;
     effectGradient = new VertexGradient(effectColor);
     effectEndTime  = Time.time + effectTimeOut;
 }
Ejemplo n.º 8
0
 protected override void Awake()
 {
     if (Application.isPlaying)
     {
         m_fontColorGradient = new VertexGradient(fontGradient_topLeft, fontGradient_topRight, fontGradient_bottomLeft, fontGradient_bottomRight);
     }
     base.Awake();
 }
Ejemplo n.º 9
0
    public void SetValues(string name, string text, VertexGradient nameColor, VertexGradient textColor)
    {
        CharacterName.text = name;
        SentenceText.text  = text;

        CharacterName.colorGradient = nameColor;
        SentenceText.colorGradient  = textColor;
    }
 public void Blend(VertexGradient startValue, VertexGradient endValue, float inputWeight, float progress)
 {
     _blendedTopLeft     = Color.Lerp(startValue.topLeft, endValue.topLeft, progress) * inputWeight;
     _blendedTopRight    = Color.Lerp(startValue.topRight, endValue.topRight, progress) * inputWeight;
     _blendedBottomLeft  = Color.Lerp(startValue.bottomLeft, endValue.bottomLeft, progress) * inputWeight;
     _blendedBottomRight = Color.Lerp(startValue.bottomRight, endValue.bottomRight, progress) * inputWeight;
     _totalWeight       += inputWeight;
 }
Ejemplo n.º 11
0
 private void ChangeCurrentString()
 {
     s_CurrentString = lvlM.levelContainer[lvlM.CurrentStage.Current]
                       .StringRepresentArray[index.Current].NameString;
     s_Gradient = lvlM.levelContainer[lvlM.CurrentStage.Current]
                  .StringRepresentArray[index.Current].ColorOfString;
     index++;
     mainText.UpdateKey(s_CurrentString, s_Gradient);
 }
Ejemplo n.º 12
0
 void Start()
 {
     playerHealth    = this;
     healthText      = GetComponentInChildren <TextMeshProUGUI>();
     defaultColor    = healthText.color;
     defaultGradient = healthText.colorGradient;
     effectColor     = defaultColor;
     effectGradient  = defaultGradient;
 }
Ejemplo n.º 13
0
        /// <summary>
        /// グラデーションカラー(ショートカット)
        /// </summary>
        public void SetGradientColor(params Color[] tColor)
        {
            TextMeshProUGUI tTextMesh = _textMesh;

            if (tTextMesh == null)
            {
                return;
            }

            if (tColor == null || tColor.Length == 0)
            {
                return;
            }

            int l = tColor.Length;

            if (l == 1)
            {
                // 単色

                VertexGradient vg = new VertexGradient();

                vg.topLeft     = tColor[0];
                vg.topRight    = tColor[0];
                vg.bottomLeft  = tColor[0];
                vg.bottomRight = tColor[0];

                tTextMesh.colorGradient = vg;
            }
            else
            if (l == 2 || l == 3)
            {
                // 上下
                VertexGradient vg = new VertexGradient();

                vg.topLeft     = tColor[0];
                vg.topRight    = tColor[0];
                vg.bottomLeft  = tColor[1];
                vg.bottomRight = tColor[1];

                tTextMesh.colorGradient = vg;
            }
            else
            if (l >= 4)
            {
                // 全体
                VertexGradient vg = new VertexGradient();

                vg.topLeft     = tColor[0];
                vg.topRight    = tColor[1];
                vg.bottomLeft  = tColor[2];
                vg.bottomRight = tColor[3];

                tTextMesh.colorGradient = vg;
            }
        }
Ejemplo n.º 14
0
    public void RestartWordDisplay()
    {
        text.text = myWord;
        VertexGradient textGradient = text.colorGradient;

        textGradient.bottomLeft  = new Color32(33, 255, 0, 255);
        textGradient.bottomRight = new Color32(112, 215, 167, 255);
        textGradient.topLeft     = new Color32(18, 230, 154, 255);
        textGradient.topRight    = new Color32(169, 223, 255, 255);
        text.colorGradient       = textGradient;
    }
Ejemplo n.º 15
0
    public void RemoveLetter()
    {
        text.text = text.text.Remove(0, 1);
        VertexGradient textGradient = text.colorGradient;

        textGradient.bottomLeft  = new Color32(255, 185, 0, 255);
        textGradient.bottomRight = new Color32(255, 84, 84, 255);
        textGradient.topLeft     = new Color32(255, 49, 96, 255);
        textGradient.topRight    = new Color32(255, 0, 0, 255);
        text.colorGradient       = textGradient;
    }
Ejemplo n.º 16
0
    public void SetWordSizeAndColor()
    {
        text.fontSize = 300;
        VertexGradient textGradient = text.colorGradient;

        textGradient.bottomLeft  = new Color32(33, 255, 0, 255);
        textGradient.bottomRight = new Color32(112, 215, 167, 255);
        textGradient.topLeft     = new Color32(18, 230, 154, 255);
        textGradient.topRight    = new Color32(169, 223, 255, 255);
        text.colorGradient       = textGradient;
    }
Ejemplo n.º 17
0
 public ProxyColor(Color color, VertexGradient colorGradient, bool useColorGradient, int charIndex)
 {
     Tweens           = new List <Tween>();
     UseColorGradient = useColorGradient;
     if (UseColorGradient)
     {
         ColorGradient = colorGradient;
     }
     else
     {
         Color = color;
     }
     CharIndex = charIndex;
 }
Ejemplo n.º 18
0
 public void OnCharacterDamaged(CharacterDamagedEvent damagedEvent)
 {
     if (DamageText != null)
     {
         Vector3    randOffset    = new Vector3(Random.Range(0f, RandOffset.x), Random.Range(0f, RandOffset.y), 0);
         GameObject damageTextObj = Instantiate(
             DamageText,
             damagedEvent.Position + new Vector3(Offset.x, Offset.y, 0) + randOffset,
             Quaternion.identity
             );
         DamageText     damageText = damageTextObj.GetComponentInChildren <DamageText>();
         VertexGradient gradient   = damagedEvent.CharacterType == AllyType.Friendly ?
                                     new VertexGradient(topAllyColour, topAllyColour, botAllyColour, botAllyColour) :
                                     new VertexGradient(topEnemyColour, topEnemyColour, botEnemyColour, botEnemyColour);
         damageText.SetText(damagedEvent.Damage.ToString(), gradient);
     }
 }
Ejemplo n.º 19
0
        private IEnumerator ColorPizzazz(TextMeshProUGUI placingText)
        {
            VertexGradient magicalColors = new VertexGradient(pizzazz[0], pizzazz[1], pizzazz[2], pizzazz[3]);

            placingText.enableVertexGradient = true;
            placingText.colorGradient        = magicalColors;
            Color color1          = pizzazz[0];
            Color color2          = pizzazz[1];
            Color color3          = pizzazz[2];
            Color color4          = pizzazz[3];
            int   cycleStartIndex = 1;

            float t = 0;

            while (true)
            {
                yield return(null);

                t += Time.deltaTime;
                if (t > 1)
                {
                    t = 0;
                    int nextColorIndex = cycleStartIndex;
                    SetNextColor(ref color1, ref nextColorIndex);
                    SetNextColor(ref color2, ref nextColorIndex);
                    SetNextColor(ref color3, ref nextColorIndex);
                    SetNextColor(ref color4, ref nextColorIndex);
                    if (++cycleStartIndex >= pizzazz.Count)
                    {
                        cycleStartIndex = 0;
                    }
                }

                Color c1 = Color.Lerp(color1, color2, t);
                Color c2 = Color.Lerp(color2, color3, t);
                Color c3 = Color.Lerp(color3, color4, t);
                Color c4 = Color.Lerp(color4, color1, t);
                magicalColors.topLeft     = c1;
                magicalColors.topRight    = c2;
                magicalColors.bottomRight = c3;
                magicalColors.bottomLeft  = c4;
                placingText.colorGradient = magicalColors;
            }
        }
Ejemplo n.º 20
0
 public Am_Text(string DisplayText,
                TMP_FontAsset Font = null,
                int Size           = 24,
                bool Bold          = false, bool Italic = false, bool Underline = false, bool Strike = false, bool Highlight = false, bool LowerCase = false, bool UpperCase = false, bool Subscript = false, bool Superscript = false,
                Color color        = default, VertexGradient gradient = default)
 {
     this.DisplayText = DisplayText;
     this.Font        = Font;
     this.Size        = Size;
     this.Bold        = Bold;
     this.Italic      = Italic;
     this.Underline   = Underline;
     this.Strike      = Strike;
     this.Highlight   = Highlight;
     this.LowerCase   = LowerCase;
     this.UpperCase   = UpperCase;
     this.Subscript   = Subscript;
     this.Superscript = Superscript;
     this.color       = color;
     this.gradient    = gradient;
 }
    void Update()
    {
        float timeSpeed = Time.time * Speed;

        rainbowColor        = HSBColor.ToColor(new HSBColor(Mathf.PingPong(timeSpeed, 1), 1, 1));
        inverseRainbowColor = InvertColor(rainbowColor);
        VertexGradient colorGrad = new VertexGradient(rainbowColor, inverseRainbowColor, rainbowColor, inverseRainbowColor);

        if (gO)
        {
            gameObject.GetComponent <MeshRenderer>().material.color = rainbowColor;
        }
        if (pS)
        {
            pS.startColor = rainbowColor;
        }
        if (textMeshUGUI)
        {
            textMeshUGUI.colorGradient = colorGrad;
        }
    }
Ejemplo n.º 22
0
 // Update is called once per frame
 void Update()
 {
     if (ColorSpin)
     {
         colorTimeCounter += (unscaledTime ? Time.unscaledDeltaTime : Time.deltaTime) * colorMultiplier;
         if (colorTimeCounter >= colorTime)
         {
             colorTimeCounter = colorTime;
             colorMultiplier  = -1;
         }
         else if (colorTimeCounter <= 0)
         {
             colorTimeCounter = 0;
             colorMultiplier  = 1;
         }
         var   vertexGradient = new VertexGradient();
         Color top            = Color.Lerp(colorA, colorB, colorTimeCounter / colorTime);
         Color bottom         = Color.Lerp(colorB, colorA, colorTimeCounter / colorTime);
         vertexGradient.topLeft        = top;
         vertexGradient.topRight       = top;
         vertexGradient.bottomLeft     = bottom;
         vertexGradient.bottomRight    = bottom;
         textMeshProUgui.colorGradient = vertexGradient;
     }
     if (PuffUp)
     {
         puffTimeCounter += (unscaledTime ? Time.unscaledDeltaTime : Time.deltaTime) * puffMultiplier;
         if (puffTimeCounter >= puffUpAnimationTime)
         {
             puffTimeCounter = puffUpAnimationTime;
             puffMultiplier  = -1;
         }
         else if (puffTimeCounter <= 0)
         {
             puffTimeCounter = 0;
             puffMultiplier  = 1;
         }
         transform.localScale = Vector3.Lerp(minSize, maxSize, puffUpAnimation.Evaluate(Mathf.InverseLerp(0, puffUpAnimationTime, puffTimeCounter)));
     }
 }
Ejemplo n.º 23
0
 public Tweener DOGradient(int charIndex, VertexGradient endValue, float duration)
 {
     return(MonitorColorTween(GetProxyColor(charIndex).DOVertexGradient(endValue, duration)));
 }
Ejemplo n.º 24
0
 public void SetColorGradient(VertexGradient value)
 {
     IsModified       = true;
     UseColorGradient = true;
     ColorGradient    = value;
 }
Ejemplo n.º 25
0
 public void SetGradient(int charIndex, VertexGradient value)
 {
     GetProxyColor(charIndex).VertexGradient = value;
     _updateColorsPending = true;
 }
Ejemplo n.º 26
0
    public void OpenMenu()
    {
        SentencesDataV2 data = IOScript.GetData();

        Dictionary <int, ChapterDataV2> chapters = new Dictionary <int, ChapterDataV2>();

        int nextchapter = 0;

        for (int i = 0; i < data.chapters.Length; i++)
        {
            chapters.Add(i, data.chapters[i]);
        }

        foreach (ChapterDataV2 temp in data.chapters)
        {
            if (chapters.TryGetValue(nextchapter, out ChapterDataV2 chapter))
            {
                GameObject chapterGO = Instantiate(ChapterPrefab, Item.ItemList);

                PreviewChapter chapterscript = chapterGO.transform.GetComponent <PreviewChapter>();

                chapterGO.name           = chapter.ChapterName;
                chapterscript.Title.text = chapter.ChapterName;

                nextchapter = chapter.NextChapter;

                foreach (SentenceDataV2 sentence in chapter.sentences)
                {
                    GameObject sentenceGO = Instantiate(SentencePrefab, chapterscript.ItemList);
                    sentenceGO.name = sentence.Name;

                    PreviewSentence sentenceScript = sentenceGO.transform.GetComponent <PreviewSentence>();

                    CharacterDataV2 character = ReturnCharacter(data, sentence.Name);

                    VertexGradient NameColor = new VertexGradient(Color.white);
                    VertexGradient TextColor = new VertexGradient(Color.white);

                    if (character.useSeperateColors)
                    {
                        if (character.useSeperateGradientColors)
                        {
                            switch (character.gradientType)
                            {
                            case 0: {
                                NameColor = new VertexGradient(HexToColor(character.nameColorHex));
                                TextColor = new VertexGradient(HexToColor(character.textColorHex));
                                break;
                            }

                            case 1: {
                                NameColor = new VertexGradient(HexToColor(character.nameColorHex), HexToColor(character.nameColorHex), HexToColor(character.nameColorGradientHex), HexToColor(character.nameColorGradientHex));
                                TextColor = new VertexGradient(HexToColor(character.textColorHex));
                                break;
                            }

                            case 2: {
                                NameColor = new VertexGradient(HexToColor(character.nameColorHex));
                                TextColor = new VertexGradient(HexToColor(character.textColorHex), HexToColor(character.textColorHex), HexToColor(character.textColorGradientHex), HexToColor(character.textColorGradientHex));
                                break;
                            }

                            case 3: {
                                NameColor = new VertexGradient(HexToColor(character.nameColorHex), HexToColor(character.nameColorHex), HexToColor(character.nameColorGradientHex), HexToColor(character.nameColorGradientHex));
                                TextColor = new VertexGradient(HexToColor(character.textColorHex), HexToColor(character.textColorHex), HexToColor(character.textColorGradientHex), HexToColor(character.textColorGradientHex));
                                break;
                            }
                            }
                        }
                        else
                        {
                            switch (character.gradientType)
                            {
                            case 0: {
                                NameColor = new VertexGradient(HexToColor(character.nameColorHex));
                                TextColor = new VertexGradient(HexToColor(character.textColorHex));
                                break;
                            }

                            case 1: {
                                NameColor = new VertexGradient(HexToColor(character.nameColorHex), HexToColor(character.nameColorHex), HexToColor(character.nameColorGradientHex), HexToColor(character.nameColorGradientHex));
                                TextColor = new VertexGradient(HexToColor(character.textColorHex));
                                break;
                            }

                            case 2: {
                                NameColor = new VertexGradient(HexToColor(character.nameColorHex));
                                TextColor = new VertexGradient(HexToColor(character.textColorHex), HexToColor(character.textColorHex), HexToColor(character.textColorGradientHex), HexToColor(character.textColorGradientHex));
                                break;
                            }

                            case 3: {
                                NameColor = new VertexGradient(HexToColor(character.nameColorHex), HexToColor(character.nameColorHex), HexToColor(character.colorGradientHex), HexToColor(character.colorGradientHex));
                                TextColor = new VertexGradient(HexToColor(character.textColorHex), HexToColor(character.textColorHex), HexToColor(character.colorGradientHex), HexToColor(character.colorGradientHex));
                                break;
                            }
                            }
                        }
                    }
                    else
                    {
                        if (character.useSeperateGradientColors)
                        {
                            switch (character.gradientType)
                            {
                            case 0: {
                                NameColor = new VertexGradient(HexToColor(character.colorHex));
                                TextColor = new VertexGradient(HexToColor(character.colorHex));
                                break;
                            }

                            case 1: {
                                NameColor = new VertexGradient(HexToColor(character.colorHex), HexToColor(character.colorHex), HexToColor(character.nameColorGradientHex), HexToColor(character.nameColorGradientHex));
                                TextColor = new VertexGradient(HexToColor(character.colorHex));
                                break;
                            }

                            case 2: {
                                NameColor = new VertexGradient(HexToColor(character.colorHex));
                                TextColor = new VertexGradient(HexToColor(character.colorHex), HexToColor(character.colorHex), HexToColor(character.textColorGradientHex), HexToColor(character.textColorGradientHex));
                                break;
                            }

                            case 3: {
                                NameColor = new VertexGradient(HexToColor(character.colorHex), HexToColor(character.colorHex), HexToColor(character.nameColorGradientHex), HexToColor(character.nameColorGradientHex));
                                TextColor = new VertexGradient(HexToColor(character.colorHex), HexToColor(character.colorHex), HexToColor(character.textColorGradientHex), HexToColor(character.textColorGradientHex));
                                break;
                            }
                            }
                        }
                        else
                        {
                            switch (character.gradientType)
                            {
                            case 0: {
                                NameColor = new VertexGradient(HexToColor(character.colorHex));
                                TextColor = new VertexGradient(HexToColor(character.colorHex));
                                break;
                            }

                            case 1: {
                                NameColor = new VertexGradient(HexToColor(character.colorHex), HexToColor(character.colorHex), HexToColor(character.nameColorGradientHex), HexToColor(character.nameColorGradientHex));
                                TextColor = new VertexGradient(HexToColor(character.colorHex));
                                break;
                            }

                            case 2: {
                                NameColor = new VertexGradient(HexToColor(character.colorHex));
                                TextColor = new VertexGradient(HexToColor(character.colorHex), HexToColor(character.colorHex), HexToColor(character.textColorGradientHex), HexToColor(character.textColorGradientHex));
                                break;
                            }

                            case 3: {
                                NameColor = new VertexGradient(HexToColor(character.colorHex), HexToColor(character.colorHex), HexToColor(character.colorGradientHex), HexToColor(character.colorGradientHex));
                                TextColor = new VertexGradient(HexToColor(character.colorHex), HexToColor(character.colorHex), HexToColor(character.colorGradientHex), HexToColor(character.colorGradientHex));
                                break;
                            }
                            }
                        }
                    }

                    foreach (SentenceActionDataV2 action in sentence.sentenceActions)
                    {
                        GameObject actionGO = Instantiate(SentenceActionPrefab, sentenceScript.ItemList);

                        PreviewSentenceAction actionScript = actionGO.GetComponent <PreviewSentenceAction>();

                        var r = new Regex(@"
						(?<=[A-Z])(?=[A-Z][a-z]) |
						(?<=[^A-Z])(?=[A-Z]) |
						(?<=[A-Za-z])(?=[^A-Za-z])"                        , RegexOptions.IgnorePatternWhitespace);

                        actionScript.SetValues(r.Replace(action.ActionType.ToString(), " "));
                    }

                    sentenceScript.SetValues((sentence.OverrideName) ? sentence.DisplayName : sentence.Name, sentence.Text, NameColor, TextColor);
                }
            }
        }
    }
Ejemplo n.º 27
0
 private void SetVertexGradient(VertexGradient value)
 {
     IsModified     = true;
     VertexGradient = value;
 }
Ejemplo n.º 28
0
 public void UpdateKey(string newKey, VertexGradient gradient)
 {
     key               = newKey;
     txt.text          = LocalizationManager.inst.GetValue(key);
     txt.colorGradient = gradient;
 }
 public void SetColorGradient(int charIndex, VertexGradient value)
 {
     GetProxyColor(charIndex).SetColorGradient(value);
     colorsChangedByProperties = true;
 }