static public int get_aspectMode(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.UI.AspectRatioFitter self = (UnityEngine.UI.AspectRatioFitter)checkSelf(l); pushValue(l, true); pushEnum(l, (int)self.aspectMode); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
public override void gaxb_init() { gameObject = new GameObject ("<AspectFit/>", typeof(RectTransform)); fitter = gameObject.AddComponent<AspectRatioFitter> (); if (mode != null) { switch (mode) { case PlanetUnity2.AspectFitMode.None: fitter.aspectMode = AspectRatioFitter.AspectMode.None; break; case PlanetUnity2.AspectFitMode.WidthControlsHeight: fitter.aspectMode = AspectRatioFitter.AspectMode.WidthControlsHeight; break; case PlanetUnity2.AspectFitMode.HeightControlsWidth: fitter.aspectMode = AspectRatioFitter.AspectMode.HeightControlsWidth; break; case PlanetUnity2.AspectFitMode.FitInParent: fitter.aspectMode = AspectRatioFitter.AspectMode.FitInParent; break; case PlanetUnity2.AspectFitMode.EnvelopeParent: fitter.aspectMode = AspectRatioFitter.AspectMode.EnvelopeParent; break; } } if (contentSize.Value.x > 0 && contentSize.Value.y > 0) { fitter.aspectRatio = contentSize.Value.x / contentSize.Value.y; } }
static void AnchorsToCorners() { RectTransform t = Selection.activeTransform as RectTransform; RectTransform pt = Selection.activeTransform.parent as RectTransform; UnityEngine.UI.AspectRatioFitter af = t.gameObject.GetComponent <UnityEngine.UI.AspectRatioFitter>(); bool oe = true; if (af != null) { oe = af.enabled; af.enabled = false; } if (t == null || pt == null) { return; } Vector2 newAnchorsMin = new Vector2(t.anchorMin.x + t.offsetMin.x / pt.rect.width, t.anchorMin.y + t.offsetMin.y / pt.rect.height); Vector2 newAnchorsMax = new Vector2(t.anchorMax.x + t.offsetMax.x / pt.rect.width, t.anchorMax.y + t.offsetMax.y / pt.rect.height); t.anchorMin = newAnchorsMin; t.anchorMax = newAnchorsMax; t.offsetMin = t.offsetMax = new Vector2(0, 0); if (af != null) { af.enabled = oe; } }
public override void OnEnter() { if (safeMode.Value == true && webCamTex != null){ if (webCamTex.isPlaying == true){ webCamTex.Stop (); } } if (autoAdjustRotation.Value == true && UiRawImage.Value != null) { _texture = UiRawImage.Value.GetComponent<UnityEngine.UI.RawImage>(); if (UiRawImage.Value.GetComponent<UnityEngine.UI.AspectRatioFitter>() != null){ setAspectRatio = UiRawImage.Value.GetComponent<UnityEngine.UI.AspectRatioFitter>(); } } if (useCustom.Value == true) { if (webcamName.Value.Length >= 1){ finalWebCamName = webcamName.Value; } else { finalWebCamName = WebCamTexture.devices[device.Value].name; } webCamTex = new WebCamTexture(finalWebCamName,webTextureWidth.Value,webTextureHeight.Value,setFps.Value); } else { webCamTex = new WebCamTexture(); } switch (filterModeselect) { case FilterModeSelect.Bilinear: webCamTex.filterMode = FilterMode.Bilinear; break; case FilterModeSelect.Point: webCamTex.filterMode = FilterMode.Point; break; case FilterModeSelect.Trilinear: webCamTex.filterMode = FilterMode.Trilinear;; break; } webcamMaterial.Value.SetTexture("_MainTex", webCamTex); PlayCam (); }
static public int set_aspectMode(IntPtr l) { UnityEngine.UI.AspectRatioFitter o = (UnityEngine.UI.AspectRatioFitter)checkSelf(l); UnityEngine.UI.AspectRatioFitter.AspectMode v; checkEnum(l, 2, out v); o.aspectMode = v; return(0); }
static public int set_aspectRatio(IntPtr l) { UnityEngine.UI.AspectRatioFitter o = (UnityEngine.UI.AspectRatioFitter)checkSelf(l); float v; checkType(l, 2, out v); o.aspectRatio = v; return(0); }
void Start () { wct = new WebCamTexture(); rawImage.texture = wct; wct.Play(); rawImageRT = (RectTransform) this.GetComponent<RectTransform>(); rawImageARF = (AspectRatioFitter) this.GetComponent<AspectRatioFitter>(); }
void Start () { rawImage = (RawImage)this.GetComponent<RawImage> (); rawImageRT = (RectTransform) this.GetComponent<RectTransform>(); rawImageARF = (AspectRatioFitter) this.GetComponent<AspectRatioFitter>(); // Get the webcam texture and put it on our rawImage wct = new WebCamTexture(); rawImage.texture = wct; wct.Play(); }
static public int get_aspectRatio(IntPtr l) { try { UnityEngine.UI.AspectRatioFitter self = (UnityEngine.UI.AspectRatioFitter)checkSelf(l); pushValue(l, self.aspectRatio); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int SetLayoutHorizontal(IntPtr l) { try { UnityEngine.UI.AspectRatioFitter self = (UnityEngine.UI.AspectRatioFitter)checkSelf(l); self.SetLayoutHorizontal(); return(0); } catch (Exception e) { return(error(l, e)); } }
static public int get_aspectMode(IntPtr l) { try { UnityEngine.UI.AspectRatioFitter self = (UnityEngine.UI.AspectRatioFitter)checkSelf(l); pushValue(l, true); pushEnum(l, (int)self.aspectMode); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int get_aspectMode(IntPtr l) { try { UnityEngine.UI.AspectRatioFitter self = (UnityEngine.UI.AspectRatioFitter)checkSelf(l); pushEnum(l, (int)self.aspectMode); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int SetLayoutVertical(IntPtr l) { try { UnityEngine.UI.AspectRatioFitter self = (UnityEngine.UI.AspectRatioFitter)checkSelf(l); self.SetLayoutVertical(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int SetLayoutVertical(IntPtr l) { try{ UnityEngine.UI.AspectRatioFitter self = (UnityEngine.UI.AspectRatioFitter)checkSelf(l); self.SetLayoutVertical(); return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
public void CreatedOrResizedRenderTexture(RenderTexture tex){ initedOnce = true; if(renderGO == null){ LayerMask layerMask = LayerMask.NameToLayer("UI"); renderGO = new GameObject(); renderGO.layer = layerMask; renderGO.name = "SyphonServerCustomRezUICanvas"; renderCanvas = renderGO.AddComponent<Canvas>(); renderCanvas.gameObject.AddComponent<CanvasScaler>(); renderCanvas.renderMode = RenderMode.ScreenSpaceCamera; renderCamera = new GameObject().AddComponent<Camera>(); renderCanvas.worldCamera = renderCamera; renderCamera.cullingMask = 1 << layerMask; renderCamera.depth = -100; renderCamera.name = "SyphonServerCustomRezCam"; GameObject blackImageGO = new GameObject(); blackImageGO.layer = layerMask; blackImageGO.name = "bg image as black"; blackImage = blackImageGO.AddComponent<RawImage>(); blackImage.color = Color.black; blackImage.transform.SetParent(renderCanvas.transform, false); rawImageGO = new GameObject(); rawImageGO.name = "SyphonServerCustomResolutionView"; rawImageGO.layer = layerMask; renderRawImage = rawImageGO.AddComponent<RawImage>(); renderRawImage.transform.SetParent(renderCanvas.transform, false); renderRawImage.texture = Camera.main.targetTexture; blackImageGO.transform.SetAsFirstSibling(); renderTrans = (RectTransform) rawImageGO.transform; renderTrans.anchorMin = new Vector2(0.5f, 0.5f); renderTrans.anchorMax = new Vector2(0.5f, 0.5f); } if(fitter == null){ fitter = rawImageGO.AddComponent<AspectRatioFitter>(); } renderRawImage.texture = tex; fitter.aspectRatio = tex.width/ (float)tex.height; texSize = new Vector2(tex.width, tex.height); UpdateScreenWH(); }
static public int set_aspectMode(IntPtr l) { try { UnityEngine.UI.AspectRatioFitter self = (UnityEngine.UI.AspectRatioFitter)checkSelf(l); UnityEngine.UI.AspectRatioFitter.AspectMode v; checkEnum(l, 2, out v); self.aspectMode = v; return(0); } catch (Exception e) { return(error(l, e)); } }
static public int set_aspectRatio(IntPtr l) { try { UnityEngine.UI.AspectRatioFitter self = (UnityEngine.UI.AspectRatioFitter)checkSelf(l); float v; checkType(l, 2, out v); self.aspectRatio = v; return(0); } catch (Exception e) { return(error(l, e)); } }
static int SetLayoutVertical(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UnityEngine.UI.AspectRatioFitter obj = (UnityEngine.UI.AspectRatioFitter)ToLua.CheckObject <UnityEngine.UI.AspectRatioFitter>(L, 1); obj.SetLayoutVertical(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_aspectMode(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.AspectRatioFitter obj = (UnityEngine.UI.AspectRatioFitter)o; UnityEngine.UI.AspectRatioFitter.AspectMode arg0 = (UnityEngine.UI.AspectRatioFitter.AspectMode)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.AspectRatioFitter.AspectMode)); obj.aspectMode = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index aspectMode on a nil value")); } }
static int set_aspectRatio(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.AspectRatioFitter obj = (UnityEngine.UI.AspectRatioFitter)o; float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.aspectRatio = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index aspectRatio on a nil value")); } }
static int get_aspectMode(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.AspectRatioFitter obj = (UnityEngine.UI.AspectRatioFitter)o; UnityEngine.UI.AspectRatioFitter.AspectMode ret = obj.aspectMode; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index aspectMode on a nil value")); } }
static int get_aspectRatio(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.UI.AspectRatioFitter obj = (UnityEngine.UI.AspectRatioFitter)o; float ret = obj.aspectRatio; LuaDLL.lua_pushnumber(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index aspectRatio on a nil value")); } }
static public int get_aspectRatio(IntPtr l) { UnityEngine.UI.AspectRatioFitter o = (UnityEngine.UI.AspectRatioFitter)checkSelf(l); pushValue(l, o.aspectRatio); return(1); }
static public int get_aspectMode(IntPtr l) { UnityEngine.UI.AspectRatioFitter o = (UnityEngine.UI.AspectRatioFitter)checkSelf(l); pushEnum(l, (int)o.aspectMode); return(1); }
// Use this for initialization void Awake() { aspectRatio = GetComponent<AspectRatioFitter>(); canvasGroup = GetComponent<CanvasGroup>(); Assert.IsTrue(canvasGroup.alpha == 0); layout = GetComponent<LayoutElement>(); background = GetComponent<Image>(); myMat = CharacterSprite.material = Instantiate(CharacterSprite.material); if (GameSelection.colorBounds) { visualsSelectSensitivity = 0; } }