static public int CreateObject(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 2) { FairyGUI.UIPackage self = (FairyGUI.UIPackage)checkSelf(l); System.String a1; checkType(l, 2, out a1); var ret = self.CreateObject(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 3) { FairyGUI.UIPackage self = (FairyGUI.UIPackage)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Type a2; checkType(l, 3, out a2); var ret = self.CreateObject(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
static int CreateObject(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes <FairyGUI.UIPackage, string>(L, 1)) { FairyGUI.UIPackage obj = (FairyGUI.UIPackage)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); FairyGUI.GObject o = obj.CreateObject(arg0); ToLua.PushObject(L, o); return(1); } else if (count == 2 && TypeChecker.CheckTypes <string, string>(L, 1)) { string arg0 = ToLua.ToString(L, 1); string arg1 = ToLua.ToString(L, 2); FairyGUI.GObject o = FairyGUI.UIPackage.CreateObject(arg0, arg1); ToLua.PushObject(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes <FairyGUI.UIPackage, string, System.Type>(L, 1)) { FairyGUI.UIPackage obj = (FairyGUI.UIPackage)ToLua.ToObject(L, 1); string arg0 = ToLua.ToString(L, 2); System.Type arg1 = (System.Type)ToLua.ToObject(L, 3); FairyGUI.GObject o = obj.CreateObject(arg0, arg1); ToLua.PushObject(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes <string, string, System.Type>(L, 1)) { string arg0 = ToLua.ToString(L, 1); string arg1 = ToLua.ToString(L, 2); System.Type arg2 = (System.Type)ToLua.ToObject(L, 3); FairyGUI.GObject o = FairyGUI.UIPackage.CreateObject(arg0, arg1, arg2); ToLua.PushObject(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: FairyGUI.UIPackage.CreateObject")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void CaptureInEditMode() { if (!EMRenderSupport.packageListReady || UIPackage.GetByName(packageName) == null) { return; } _captured = true; UIObjectFactory.packageItemExtensions.Clear(); UIObjectFactory.loaderConstructor = null; DisplayOptions.SetEditModeHideFlags(); GComponent view = (GComponent)UIPackage.CreateObject(packageName, componentName); if (view != null) { DestroyTexture(); _texture = CaptureCamera.CreateRenderTexture(Mathf.RoundToInt(view.width), Mathf.RoundToInt(view.height), false); Container root = (Container)view.displayObject; root.layer = CaptureCamera.layer; root.SetChildrenLayer(CaptureCamera.layer); root.gameObject.hideFlags = HideFlags.None; root.gameObject.SetActive(true); GameObject cameraObject = new GameObject("Temp Capture Camera"); Camera camera = cameraObject.AddComponent <Camera>(); camera.depth = 0; camera.cullingMask = 1 << CaptureCamera.layer; camera.clearFlags = CameraClearFlags.Depth; camera.orthographic = true; camera.nearClipPlane = -30; camera.farClipPlane = 30; camera.enabled = false; camera.targetTexture = _texture; float halfHeight = (float)_texture.height / 2; camera.orthographicSize = halfHeight; cameraObject.transform.localPosition = root.cachedTransform.TransformPoint(halfHeight * camera.aspect, -halfHeight, 0); UpdateContext context = new UpdateContext(); //run two times context.Begin(); view.displayObject.Update(context); context.End(); context.Begin(); view.displayObject.Update(context); context.End(); RenderTexture old = RenderTexture.active; RenderTexture.active = _texture; GL.Clear(true, true, Color.clear); camera.Render(); RenderTexture.active = old; camera.targetTexture = null; view.Dispose(); GameObject.DestroyImmediate(cameraObject); if (_renderer != null) { _renderer.sharedMaterial.mainTexture = _texture; } } }
void CaptureInEditMode() { if (!packageListReady || UIPackage.GetByName(packageName) == null) { return; } _captured = true; GameObject tempGo = new GameObject("Temp Object"); tempGo.layer = CaptureCamera.layer; UIObjectFactory.packageItemExtensions.Clear(); UIObjectFactory.loaderConstructor = null; DisplayOptions.SetEditModeHideFlags(); DisplayOptions.defaultRoot = new Transform[] { tempGo.transform }; GComponent view = (GComponent)UIPackage.CreateObject(packageName, componentName); DisplayOptions.defaultRoot = null; if (view != null) { if (texture != null) { DestroyTexture(); } CreateTexture(Mathf.CeilToInt(view.width), Mathf.CeilToInt(view.height)); Container root = (Container)view.displayObject; root.layer = CaptureCamera.layer; root.SetChildrenLayer(CaptureCamera.layer); root.gameObject.hideFlags = HideFlags.None; root.gameObject.SetActive(true); GameObject cameraObject = new GameObject("Temp Capture Camera"); Camera camera = cameraObject.AddComponent <Camera>(); camera.depth = 0; camera.cullingMask = 1 << CaptureCamera.layer; camera.clearFlags = CameraClearFlags.Depth; camera.orthographic = true; camera.orthographicSize = view.height / 2; camera.nearClipPlane = -30; camera.farClipPlane = 30; camera.enabled = false; camera.targetTexture = texture; Vector3 pos = root.cachedTransform.position; pos.x += camera.orthographicSize * camera.aspect; pos.y -= camera.orthographicSize; pos.z = 0; cameraObject.transform.localPosition = pos; UpdateContext context = new UpdateContext(); //run two times context.Begin(); view.displayObject.Update(context); context.End(); context.Begin(); view.displayObject.Update(context); context.End(); RenderTexture old = RenderTexture.active; RenderTexture.active = texture; GL.Clear(true, true, Color.clear); camera.Render(); RenderTexture.active = old; camera.targetTexture = null; view.Dispose(); GameObject.DestroyImmediate(cameraObject); GameObject.DestroyImmediate(tempGo); this.GetComponent <Renderer>().sharedMaterial.mainTexture = texture; } }