Exemplo n.º 1
0
    private object GetValue(Type type, string dataText)
    {
        object result = null;

        if (dataText.Equals(string.Empty))
        {
            return(null);
        }
        try
        {
            if (type.IsEnum)
            {
                if (dataText.Contains(','))
                {
                    string[] array = dataText.Split(new char[]
                    {
                        ','
                    });
                    int num = 0;
                    foreach (string value in array)
                    {
                        num |= (int)Enum.Parse(type, value, false);
                    }
                    result = num;
                }
                else
                {
                    result = Enum.Parse(type, dataText, false);
                }
            }

            /*else if (type == typeof(UnityEngine.Vector3))
             * {
             *  string[] array3 = dataText.Split(new char[]
             *  {
             *      ','
             *  });
             *  if (array3.Length == 3)
             *  {
             *      result = new UnityEngine.Vector3(Convert.ToSingle(array3[0]), Convert.ToSingle(array3[1]), Convert.ToSingle(array3[2]));
             *  }
             * }*/
            /*else if (type == typeof(Cwave.Vector3))
             * {
             *  string[] array4 = dataText.Split(new char[]
             *  {
             *      ','
             *  });
             *  if (array4.Length == 3)
             *  {
             *      result = new Cwave.Vector3(Convert.ToSingle(array4[0]), Convert.ToSingle(array4[1]), Convert.ToSingle(array4[2]));
             *  }
             * }*/
            /*else if (type == typeof(UnityEngine.Vector2))
             * {
             *  string[] array5 = dataText.Split(new char[]
             *  {
             *      ','
             *  });
             *  if (array5.Length == 2)
             *  {
             *      result = new UnityEngine.Vector2(Convert.ToSingle(array5[0]), Convert.ToSingle(array5[1]));
             *  }
             * }*/
            /*else if (type == typeof(Cwave.Vector2))
             * {
             *  string[] array6 = dataText.Split(new char[]
             *  {
             *      ','
             *  });
             *  if (array6.Length == 2)
             *  {
             *      result = new Cwave.Vector2(Convert.ToSingle(array6[0]), Convert.ToSingle(array6[1]));
             *  }
             * }*/
            /*else if (type == typeof(Color))
             * {
             *  string[] array7 = dataText.Split(new char[]
             *  {
             *      ','
             *  });
             *  if (array7.Length == 3)
             *  {
             *      result = new Color(Convert.ToSingle(array7[0]), Convert.ToSingle(array7[1]), Convert.ToSingle(array7[2]));
             *  }
             * }*/
            /*else if (type == typeof(Cwave.Color32))
             * {
             *  string[] array8 = dataText.Split(new char[]
             *  {
             *      ','
             *  });
             *  if (array8.Length == 3)
             *  {
             *      result = new Cwave.Color32(Convert.ToByte(array8[0]), Convert.ToByte(array8[1]), Convert.ToByte(array8[2]), byte.MaxValue);
             *  }
             * }*/
            else if (type == typeof(SkillID))
            {
                result = new SkillID(dataText);
            }
            else if (type == typeof(ItemID))
            {
                result = new ItemID(dataText);
            }
            else if (type == typeof(SkillBuffID))
            {
                result = new SkillBuffID(dataText);
            }
            else if (type == typeof(PawnClassID))
            {
                result = new PawnClassID(dataText);
            }
            else if (type == typeof(PawnBodyID))
            {
                result = new PawnBodyID(dataText);
            }

            /*else if (type == typeof(ItemBoxID))
             * {
             *  result = new ItemBoxID(dataText);
             * }*/
            else if (type == typeof(SkillOptionID))
            {
                result = new SkillOptionID(dataText);
            }

            /*else if (type == typeof(SkillProjectileID))
             * {
             *  result = new SkillProjectileID(dataText);
             * }*/
            /*else if (type == typeof(RTLB))
             * {
             *  result = new RTLB(dataText);
             * }*/
            else if (type == typeof(MapID))
            {
                result = new MapID(dataText);
            }
            else
            {
                result = Convert.ChangeType(dataText, type);
            }
        }
        catch (Exception innerException)
        {
            string message = "[XmlClass] Invalid Value! Type:" + type.ToString() + " Value: " + dataText;
            throw new Exception(message, innerException);
        }
        return(result);
    }
Exemplo n.º 2
0
 public void method_37(SkillBuffID skillBuffID_0)
 {
     this.method_36(skillBuffID_0.skillResultID_0);
     this.method_55(skillBuffID_0.int_0);
 }