Пример #1
0
 public override void Reset()
 {
     this.gameObject  = null;
     this.reference   = null;
     this.startIndex  = null;
     this.parseRange  = null;
     this.textAsset   = null;
     this.split       = SplitTextToArrayList.SplitSpecialChars.NewLine;
     this.parseAsType = SplitTextToArrayList.ArrayMakerParseStringAs.String;
 }
Пример #2
0
        public void splitText()
        {
            if (!base.isProxyValid())
            {
                return;
            }
            string text;

            if (this.OrThisString.Value.Length == 0)
            {
                if (this.textAsset == null)
                {
                    return;
                }
                text = this.textAsset.text;
            }
            else
            {
                text = this.OrThisString.Value;
            }
            this.proxy.arrayList.Clear();
            string[] array;
            if (this.OrThisChar.Value.Length == 0)
            {
                char c = '\n';
                SplitTextToArrayList.SplitSpecialChars splitSpecialChars = this.split;
                if (splitSpecialChars != SplitTextToArrayList.SplitSpecialChars.Tab)
                {
                    if (splitSpecialChars == SplitTextToArrayList.SplitSpecialChars.Space)
                    {
                        c = ' ';
                    }
                }
                else
                {
                    c = '\t';
                }
                array = text.Split(new char[]
                {
                    c
                });
            }
            else
            {
                array = text.Split(this.OrThisChar.Value.ToCharArray());
            }
            int value = this.startIndex.Value;
            int num   = array.Length;

            if (this.parseRange.Value > 0)
            {
                num = Mathf.Min(num - value, this.parseRange.Value);
            }
            string[] array2 = new string[num];
            int      num2   = 0;

            for (int i = value; i < value + num; i++)
            {
                array2[num2] = array[i];
                num2++;
            }
            if (this.parseAsType == SplitTextToArrayList.ArrayMakerParseStringAs.String)
            {
                this.proxy.arrayList.InsertRange(0, array2);
            }
            else if (this.parseAsType == SplitTextToArrayList.ArrayMakerParseStringAs.Int)
            {
                int[] array3 = new int[array2.Length];
                int   num3   = 0;
                foreach (string s in array2)
                {
                    int.TryParse(s, out array3[num3]);
                    num3++;
                }
                this.proxy.arrayList.InsertRange(0, array3);
            }
            else if (this.parseAsType == SplitTextToArrayList.ArrayMakerParseStringAs.Float)
            {
                float[] array5 = new float[array2.Length];
                int     num4   = 0;
                foreach (string s2 in array2)
                {
                    float.TryParse(s2, out array5[num4]);
                    num4++;
                }
                this.proxy.arrayList.InsertRange(0, array5);
            }
        }