From 6311df03d5d7b763770e435718c5e799f857f3fa Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期日, 21 十月 2018 16:14:50 +0800
Subject: [PATCH] 3335 更新lua库

---
 Lua/LuaWindow.cs              |    5 ++++-
 Utility/TransformExtension.cs |   17 +++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/Lua/LuaWindow.cs b/Lua/LuaWindow.cs
index 20c34cc..531842c 100644
--- a/Lua/LuaWindow.cs
+++ b/Lua/LuaWindow.cs
@@ -61,7 +61,10 @@
         onActived = null;
         onLateUpdate = null;
 
-        scriptEnv.Dispose();
+        if (scriptEnv != null)
+        {
+            scriptEnv.Dispose();
+        }
     }
 
     protected override void BindController()
diff --git a/Utility/TransformExtension.cs b/Utility/TransformExtension.cs
index dbfe89a..ad6fbd0 100644
--- a/Utility/TransformExtension.cs
+++ b/Utility/TransformExtension.cs
@@ -147,6 +147,23 @@
         return false;
     }
 
+    [XLua.LuaCallCSharp]
+    public static void SetPosition(this Transform transform, float x, float y, float z, bool isLocal = false)
+    {
+        if (transform == null)
+        {
+            return;
+        }
+
+        if (isLocal)
+        {
+            transform.localPosition = new Vector3(x, y, z);
+        }
+        else
+        {
+            transform.position = new Vector3(x, y, z);
+        }
+    }
 
     public static Transform GetRoot(this Transform transform)
     {

--
Gitblit v1.8.0