From 8efd04f4314e44c5b732e95163383b1911d279cb Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期一, 29 十月 2018 17:30:38 +0800
Subject: [PATCH] 4340 【前端】支持xlua方便IOS提审

---
 Assets/XLua/Src/TypeExtensions.cs |   30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/Assets/XLua/Src/TypeExtensions.cs b/Assets/XLua/Src/TypeExtensions.cs
index f74b06d..33fa661 100644
--- a/Assets/XLua/Src/TypeExtensions.cs
+++ b/Assets/XLua/Src/TypeExtensions.cs
@@ -1,10 +1,10 @@
 锘縰sing System;
-using System.Reflection;
+using System.Linq;
 
 namespace XLua
 {
 
-    public static class TypeExtensions
+    internal static class TypeExtensions
     {
         public static bool IsValueType(this Type type)
         {
@@ -130,5 +130,31 @@
             return type.GetTypeInfo().IsPublic;
 #endif        
         }
+
+        public static string GetFriendlyName(this Type type)
+        {
+            if (type == typeof(int))
+                return "int";
+            else if (type == typeof(short))
+                return "short";
+            else if (type == typeof(byte))
+                return "byte";
+            else if (type == typeof(bool))
+                return "bool";
+            else if (type == typeof(long))
+                return "long";
+            else if (type == typeof(float))
+                return "float";
+            else if (type == typeof(double))
+                return "double";
+            else if (type == typeof(decimal))
+                return "decimal";
+            else if (type == typeof(string))
+                return "string";
+            else if (type.IsGenericType)
+                return type.FullName.Split('`')[0] + "<" + string.Join(", ", type.GetGenericArguments().Select(x => GetFriendlyName(x)).ToArray()) + ">";
+            else
+                return type.FullName;
+        }
     }
 }

--
Gitblit v1.8.0