Exemple #1
0
    public static IEnumerable <SignitureItem> LoadFromXml(string text)
    {
        XmlDocument doc = new XmlDocument();

        doc.LoadXml(text);
        List <SignitureItem> ret = new List <SignitureItem>();

        foreach (XmlElement item in doc.DocumentElement.ChildNodes)
        {
            SignitureItem loadedItem = SignitureItem.FromXml(item);
            ret.Add(loadedItem);
        }
        return(ret.OrderBy(item => item.StartTime));
    }
Exemple #2
0
    private string AddTextFor(SignitureItem item)
    {
        float rawRank        = (float)item.Rank / _items.Length;
        float sizeRampedRank = Mathf.Pow(rawRank, SizeRamp);
        float size           = Mathf.Lerp(Low, High, sizeRampedRank);

        float colorRampedRank = Mathf.Pow(rawRank, ColorRamp);
        float lowColorRamp    = Mathf.Clamp01(colorRampedRank * 2);
        float highColorRamp   = Mathf.Clamp01(colorRampedRank * 2 - 1);
        Color color           = Color.Lerp(LowColor, MidColor, lowColorRamp);

        color = Color.Lerp(color, HighColor, highColorRamp);
        string colorString = GetHexString(color);

        string ret = "<color=" + colorString + "><size=" + size + ">" + item.Phrase + "</size></color>";

        return(ret);
    }
Exemple #3
0
    private ExplodedItem InitializeExplodedItem(SignitureItem item)
    {
        GameObject pivotA = new GameObject();

        pivotA.transform.parent = transform;


        GameObject pivotB = new GameObject();

        pivotB.transform.parent = pivotA.transform;

        GameObject newObj = Instantiate(TextMeshPrefab);

        newObj.transform.parent = pivotB.transform;
        ExplodedItem explodedItem = newObj.GetComponent <ExplodedItem>();

        explodedItem.Item          = item;
        explodedItem.RandomSeed    = UnityEngine.Random.value;
        explodedItem.TextMesh.text = GetTextFor(item);
        explodedItem.Renderer      = newObj.GetComponent <MeshRenderer>();
        return(explodedItem);
    }
Exemple #4
0
    private Color GetColorFor(SignitureItem item, float param)
    {
        float rawRank         = (float)item.Rank / _itemsCount;
        float colorRampedRank = Mathf.Pow(rawRank, ColorRamp);
        float lowColorRamp    = Mathf.Clamp01(colorRampedRank * 2);
        float highColorRamp   = Mathf.Clamp01(colorRampedRank * 2 - 1);
        Color color           = Color.Lerp(LowColor, MidColor, lowColorRamp);

        color = Color.Lerp(color, HighColor, highColorRamp);

        float offsetParam         = (param + RotationalOffset / 360) % 1;
        float backgroundColorFade = Mathf.Abs(offsetParam - .5f) * 2;

        backgroundColorFade = Mathf.Lerp(1, backgroundColorFade, FadePower);
        color = Color.Lerp(BackgroundColor, color, backgroundColorFade);
        color = new Color(
            Mathf.Pow(color.r, RampColor) * ScaleColor,
            Mathf.Pow(color.g, RampColor) * ScaleColor,
            Mathf.Pow(color.b, RampColor) * ScaleColor,
            1);
        return(color);
    }
Exemple #5
0
    private string GetTextFor(SignitureItem item)
    {
        string quotesRemoved = item.Phrase.Substring(1, item.Phrase.Length - 2).Replace(".", "");

        return(quotesRemoved);
    }