Inheritance: UnityEngine.EventSystems.UIBehaviour, ILayoutSelfController, ILayoutController
コード例 #1
0
 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
 }
コード例 #2
0
    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;
        }
    }
コード例 #3
0
    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 ();
			
			
		}
コード例 #5
0
 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);
 }
コード例 #6
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);
    }
コード例 #7
0
		void Start () 
		{
			wct = new WebCamTexture();

			rawImage.texture = wct;
			wct.Play();


			rawImageRT = (RectTransform) this.GetComponent<RectTransform>();
			rawImageARF = (AspectRatioFitter) this.GetComponent<AspectRatioFitter>();
		}
コード例 #8
0
		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();
		}
コード例 #9
0
 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));
     }
 }
コード例 #10
0
 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));
     }
 }
コード例 #12
0
 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));
     }
 }
コード例 #14
0
 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);
     }
 }
コード例 #15
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();
	}
コード例 #16
0
 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));
     }
 }
コード例 #17
0
 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));
     }
 }
コード例 #18
0
 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));
     }
 }
コード例 #19
0
    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"));
        }
    }
コード例 #20
0
    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"));
        }
    }
コード例 #21
0
    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"));
        }
    }
コード例 #22
0
    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"));
        }
    }
コード例 #23
0
 static public int get_aspectRatio(IntPtr l)
 {
     UnityEngine.UI.AspectRatioFitter o = (UnityEngine.UI.AspectRatioFitter)checkSelf(l);
     pushValue(l, o.aspectRatio);
     return(1);
 }
コード例 #24
0
 static public int get_aspectMode(IntPtr l)
 {
     UnityEngine.UI.AspectRatioFitter o = (UnityEngine.UI.AspectRatioFitter)checkSelf(l);
     pushEnum(l, (int)o.aspectMode);
     return(1);
 }
コード例 #25
0
    // 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;
        }
    }