Ejemplo n.º 1
0
        private static Color32 UF_GetTargetColor(int type, int idx, GradualData data)
        {
            if (type < 0 || type > 3)
            {
                type = 0;
            }
            if (idx < 0 || idx > 5)
            {
                idx = 0;
            }
            int val = s_MapColorType [type, idx];

            if (val == 0)
            {
                return(data.colorA);
            }
            else if (val == 1)
            {
                return(data.colorB);
            }
            else
            {
                return((Color)data.colorB + (Color)data.colorA / 2);
            }
        }
Ejemplo n.º 2
0
        private static void UF_HandleToken(List <TextToken> tokens, List <GradualData> listColors)
        {
            int overlying = 0;

            listColors.Clear();
            for (int k = 0; k < tokens.Count; k++)
            {
                if (tokens [k].type == TextTokenType.HEAD_G)
                {
                    overlying++;
                    for (int i = k + 1; i < tokens.Count; i++)
                    {
                        if (tokens [i].type == TextTokenType.HEAD_G)
                        {
                            overlying++;
                        }
                        else if (tokens [i].type == TextTokenType.END_G)
                        {
                            overlying--;
                            if (overlying == 0)
                            {
                                GradualData data = new GradualData();
                                data.idx    = tokens [k].index;
                                data.length = tokens [i].index - tokens [k].index;
                                int idxG = tokens [k].buffer.IndexOf("g=");
                                if (idxG > -1)
                                {
                                    data.type = RichText.UF_ReadInt(tokens[k].buffer, idxG + 2, 0);
                                }

                                data.colorA = RichText.UF_ReadColor(tokens [k].buffer, tokens [k].buffer.IndexOf('#') + 1);
                                data.colorB = RichText.UF_ReadColor(tokens [k].buffer, tokens [k].buffer.LastIndexOf('#') + 1);
                                listColors.Add(data);
                                break;
                            }
                        }
                    }
                }
            }
        }