Position, size, anchor and pivot information for a rectangle.

Inheritance: Transform
				public State(RectTransform rect) {

					this.anchorMin = rect.anchorMin;
					this.anchorMax = rect.anchorMax;
					this.to = rect.anchoredPosition;

				}
Exemple #2
1
        void Awake()
        {
            _resizedPanel = (ResizeParent ? transform.parent : transform) as RectTransform;

            var maximalSizeMargin = 10;
            _maximalSize = new Vector2(Screen.width - maximalSizeMargin, Screen.height - maximalSizeMargin);
        }
Exemple #3
0
    static public void FastSetter(this UnityEngine.RectTransform o, string propertyName, UnityEngine.Vector2 value)
    {
        switch (propertyName)
        {
        case "anchorMin":
            o.anchorMin = value; return;

        case "anchorMax":
            o.anchorMax = value; return;

        case "anchoredPosition":
            o.anchoredPosition = value; return;

        case "sizeDelta":
            o.sizeDelta = value; return;

        case "pivot":
            o.pivot = value; return;

        case "offsetMin":
            o.offsetMin = value; return;

        case "offsetMax":
            o.offsetMax = value; return;
        }
        LBoot.LogUtil.Error("UnityEngine.RectTransform no Setter Found : " + propertyName);
    }
Exemple #4
0
    static public void FastSetter(this UnityEngine.RectTransform o, string propertyName, object value)
    {
        switch (propertyName)
        {
        case "anchorMin":
            o.anchorMin = (UnityEngine.Vector2)value; return;

        case "anchorMax":
            o.anchorMax = (UnityEngine.Vector2)value; return;

        case "anchoredPosition3D":
            o.anchoredPosition3D = (UnityEngine.Vector3)value; return;

        case "anchoredPosition":
            o.anchoredPosition = (UnityEngine.Vector2)value; return;

        case "sizeDelta":
            o.sizeDelta = (UnityEngine.Vector2)value; return;

        case "pivot":
            o.pivot = (UnityEngine.Vector2)value; return;

        case "offsetMin":
            o.offsetMin = (UnityEngine.Vector2)value; return;

        case "offsetMax":
            o.offsetMax = (UnityEngine.Vector2)value; return;

        case "tag":
            o.tag = (System.String)value; return;
        }
        LBoot.LogUtil.Error("UnityEngine.RectTransform no Setter Found : " + propertyName);
    }
Exemple #5
0
 public static void AnchorMM(this RT src, float minX, float minY, float maxX, float maxY)
 {
     // 点で指定     => Min = Max
     // ストレッチ   => Min = 0, Max = 1
     src.anchorMin = new Vector2(minX, minY);
     src.anchorMax = new Vector2(maxX, maxY);
 }
 void Awake()
 {
     m_SliderTrans = m_SliderButton.rectTransform;
     m_MaxPower = m_SliderTrans.rect.height - 10;
     if(!m_Animator)
         m_Animator = GetComponent<Animator>();
 }
 public void Start()
 {
     this.rectTransform = this.GetComponent<RectTransform>();
     if (this.rectTransform == null) {
         Debug.LogError("Cannot obtain RectTransform. Please check.");
     }
 }
	void Start ()
	{
		if(canvas != null){
			scaleFactor = canvas.scaleFactor;
		}
		rect_transform = GetComponent<RectTransform>();
	}
 protected override void ClearUIComponents()
 {
     UICompletedTodoitem = null;
     Content             = null;
     BtnBack             = null;
     mData = null;
 }
    // Use this for initialization
    void Start()
    {
        timescaleButtonImage = GameObject.Find("Timescale Button").GetComponent<Image>();
        buttonTargetColor = Color.white;
        timescaleInfoTransform = transform.GetComponent<RectTransform>();

        hiddenPos = timescaleInfoTransform.position;
        visiblePos = timescaleInfoTransform.position + new Vector3(340,0,0);
        timescaleInfoTransform.position = hiddenPos;

        activeColor = Color.white;
        inactiveColor = new Color(1,1,1,0.1f);

        nextUpgradeColorVisible 	= new Color(0,1,0,1);
        nextUpgradeColorTransparent = new Color(0,1,0,0.05f);

        timescaleImages = new RawImage[9];
        timescaleImages[0] = transform.Find("Current Timescale").Find("Timescale Bar").Find("1").GetComponent<RawImage>();
        timescaleImages[1] = transform.Find("Current Timescale").Find("Timescale Bar").Find("2").GetComponent<RawImage>();
        timescaleImages[2] = transform.Find("Current Timescale").Find("Timescale Bar").Find("3").GetComponent<RawImage>();
        timescaleImages[3] = transform.Find("Current Timescale").Find("Timescale Bar").Find("4").GetComponent<RawImage>();
        timescaleImages[4] = transform.Find("Current Timescale").Find("Timescale Bar").Find("5").GetComponent<RawImage>();
        timescaleImages[5] = transform.Find("Current Timescale").Find("Timescale Bar").Find("6").GetComponent<RawImage>();
        timescaleImages[6] = transform.Find("Current Timescale").Find("Timescale Bar").Find("7").GetComponent<RawImage>();
        timescaleImages[7] = transform.Find("Current Timescale").Find("Timescale Bar").Find("8").GetComponent<RawImage>();
        timescaleImages[8] = transform.Find("Current Timescale").Find("Timescale Bar").Find("9").GetComponent<RawImage>();

        ClearTimescale();
    }
    public virtual void CreateLayout()
    {
        allSlots = new List<GameObject>();
        emptySlots = slots;

        int rows = (int)Mathf.Ceil((float)slots / columns);

        inventoryWidth = columns * (slotSize + slotPaddingLeft) + slotPaddingLeft;
        inventoryHeight = rows * (slotSize + slotPaddingTop) + slotPaddingTop;

        inventoryRect = m_slotContainer.GetComponent<RectTransform>();

        for (int i = 0; i < slots; i++) {
            GameObject newSlot = Instantiate(PanelManager.Instance.slotPrefab) as GameObject;
            newSlot.transform.SetParent(m_slotContainer.transform, false);
            newSlot.name = "Slot[" + (i / 4) + "][" + (i % 4) + "]";

            RectTransform slotRect = newSlot.GetComponent<RectTransform>();
            slotRect.localPosition = new Vector3(slotPaddingLeft * ((i % 4) + 1) + (slotSize * (i % 4)), - slotPaddingTop * ((i / 4) + 1) - (slotSize * (i / 4)));
            slotRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, slotSize);
            slotRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, slotSize);

            allSlots.Add(newSlot);
        }
    }
Exemple #12
0
	// Use this for initialization
	void Start () {
        ThisRect = GetComponent<RectTransform>();
        if (ThisRect == null) return;

        gotoX = ThisRect.rect.x;
        gotoY = ThisRect.rect.y;
    }
Exemple #13
0
 /// <summary>
 /// Write the specified value using the writer.
 /// </summary>
 /// <param name="value">Value.</param>
 /// <param name="writer">Writer.</param>
 public override void Write(object value, ISaveGameWriter writer)
 {
     UnityEngine.RectTransform rectTransform = (UnityEngine.RectTransform)value;
     writer.WriteProperty("anchorMin", rectTransform.anchorMin);
     writer.WriteProperty("anchorMax", rectTransform.anchorMax);
     writer.WriteProperty("anchoredPosition3D", rectTransform.anchoredPosition3D);
     writer.WriteProperty("anchoredPosition", rectTransform.anchoredPosition);
     writer.WriteProperty("sizeDelta", rectTransform.sizeDelta);
     writer.WriteProperty("pivot", rectTransform.pivot);
     writer.WriteProperty("offsetMin", rectTransform.offsetMin);
     writer.WriteProperty("offsetMax", rectTransform.offsetMax);
     writer.WriteProperty("position", rectTransform.position);
     writer.WriteProperty("localPosition", rectTransform.localPosition);
     writer.WriteProperty("eulerAngles", rectTransform.eulerAngles);
     writer.WriteProperty("localEulerAngles", rectTransform.localEulerAngles);
     writer.WriteProperty("right", rectTransform.right);
     writer.WriteProperty("up", rectTransform.up);
     writer.WriteProperty("forward", rectTransform.forward);
     writer.WriteProperty("rotation", rectTransform.rotation);
     writer.WriteProperty("localRotation", rectTransform.localRotation);
     writer.WriteProperty("localScale", rectTransform.localScale);
     writer.WriteProperty("parent", rectTransform.parent);
     writer.WriteProperty("hasChanged", rectTransform.hasChanged);
     writer.WriteProperty("hierarchyCapacity", rectTransform.hierarchyCapacity);
     writer.WriteProperty("tag", rectTransform.tag);
     writer.WriteProperty("name", rectTransform.name);
     writer.WriteProperty("hideFlags", rectTransform.hideFlags);
 }
        public void ChangeTo(RectTransform newPanel)
        {
            if (currentPanel != null)
            {
                currentPanel.gameObject.SetActive(false);
            }

            if (newPanel != null)
            {
                newPanel.gameObject.SetActive(true);
            }

            currentPanel = newPanel;

            if (currentPanel != mainMenuPanel)
            {
                backButton.gameObject.SetActive(true);
            }
            else
            {
                backButton.gameObject.SetActive(false);
                SetServerInfo("Offline", "None");
                isMatchmaking = false;
            }
        }
Exemple #15
0
    public void UpdatePosition(RectTransform goToObject)
    {
        if (goToObject == null) return;

        gotoX = goToObject.rect.xMin - (goToObject.rect.width / 2);
        gotoY = goToObject.position.y + 0.2f;
    }
 private void Awake()
 {
     canvas                = go.Find("Canvas");
     objectsControlArea    = go.Find("ObjectsControlArea");
     propertiesControlArea = go.Find("PropertiesControlArea");
     objectsControlAreaRTM = objectsControlArea.GetComponent <rtm>();
 }
 void Start()
 {
     rect = GetComponent<RectTransform>();
     canvas = transform.parent.GetComponentInParent<Canvas>();
     camToUse = canvas.worldCamera;
     SetLocation();
 }
 void Awake()
 {
     m_Trans = transform as RectTransform;
     m_ScaleVector = Vector3.one * m_Scale;
     m_ScaleVector.z = 1;
     m_ScrollRect.onValueChanged.AddListener(OnScrollValueChange);
 }
Exemple #19
0
    public bool Add(RectTransform child, bool forceAdd = false)
    {
        bool canAdd = child.rect.width <= AvailableWidth;

        if (!canAdd && !forceAdd)
        {
            return false;
        }

        UpdateHeightForChild(child);

        if (canAdd)
        {
            child.SetParent(transform, false);
            child.SetAsLastSibling();

            CurrentWidth += child.rect.width;
        }
        else
        {
            GameObject containerObject = new GameObject("LineForceContainer");
            RectTransform containerTransformRect = containerObject.AddComponent<RectTransform>();
            containerTransformRect.SetParent(transform, false);
            containerTransformRect.SetAsLastSibling();

            LayoutElement containerLayoutElement = containerObject.AddComponent<LayoutElement>();
            containerLayoutElement.preferredWidth = AvailableWidth;
            containerLayoutElement.preferredHeight = child.rect.height;

            CurrentWidth += containerLayoutElement.preferredWidth;
        }
        return true;
    }
 protected override void ClearUIComponents()
 {
     BtnBack          = null;
     Meteors          = null;
     BtnDetermineWiFi = null;
     mData            = null;
 }
 protected override void ClearUIComponents()
 {
     ImgCloud1     = null;
     ImgCloud2     = null;
     ImgCloud3     = null;
     ImgHyrogen    = null;
     BtnBack       = null;
     PhonePanel    = null;
     InputPhone    = null;
     BtnClearPhone = null;
     CodePanel     = null;
     TextTip       = null;
     InputCode     = null;
     BtnCode       = null;
     TextBtnCode   = null;
     PwdPanel      = null;
     TextPwdTitle  = null;
     InputPwd      = null;
     BtnClearPwd   = null;
     BtnHideOrShow = null;
     ImgHideOrShow = null;
     BtnForget     = null;
     BtnConfirm    = null;
     mData         = null;
 }
 internal static void CalculateAnchorSnapValues(Transform parentSpace, Transform self, RectTransform gui, int minmaxX, int minmaxY)
 {
   for (int mainAxis = 0; mainAxis < 2; ++mainAxis)
   {
     RectTransformSnapping.s_SnapGuides[mainAxis].Clear();
     parentSpace.GetComponent<RectTransform>().GetWorldCorners(RectTransformSnapping.s_Corners);
     for (int index = 0; index < RectTransformSnapping.kSidesAndMiddle.Length; ++index)
     {
       float alongMainAxis = RectTransformSnapping.kSidesAndMiddle[index];
       RectTransformSnapping.s_SnapGuides[mainAxis].AddGuide(new SnapGuide(alongMainAxis, new Vector3[2]
       {
         RectTransformSnapping.GetInterpolatedCorner(RectTransformSnapping.s_Corners, mainAxis, alongMainAxis, 0.0f),
         RectTransformSnapping.GetInterpolatedCorner(RectTransformSnapping.s_Corners, mainAxis, alongMainAxis, 1f)
       }));
     }
     foreach (Transform transform in parentSpace)
     {
       if (!((Object) transform == (Object) self))
       {
         RectTransform component = transform.GetComponent<RectTransform>();
         if ((bool) ((Object) component))
         {
           RectTransformSnapping.s_SnapGuides[mainAxis].AddGuide(new SnapGuide(component.anchorMin[mainAxis], new Vector3[0]));
           RectTransformSnapping.s_SnapGuides[mainAxis].AddGuide(new SnapGuide(component.anchorMax[mainAxis], new Vector3[0]));
         }
       }
     }
     int num = mainAxis != 0 ? minmaxY : minmaxX;
     if (num == 0)
       RectTransformSnapping.s_SnapGuides[mainAxis].AddGuide(new SnapGuide(gui.anchorMax[mainAxis], new Vector3[0]));
     if (num == 1)
       RectTransformSnapping.s_SnapGuides[mainAxis].AddGuide(new SnapGuide(gui.anchorMin[mainAxis], new Vector3[0]));
   }
 }
        protected override void Awake()
        {
            _rectTransform = GetComponent<RectTransform>();
            _rectTransformWrapper = new RectTransformUtils(_rectTransform);

            base.Awake();
        }
Exemple #24
0
    void Awake()
    {
        timeLastEnemyHitted = Time.time;
        trigger = GetComponentInChildren<BoxCollider>();
        sprite = transform.GetComponentInChildren<SpriteRenderer>();

        glitchPartPool = new ObjectPool(glitchPart);
        lives = 3;
        items = 0;

        //Instantiate the glitch fragments to avoid lag later in the game
        GameObject[] parts = new GameObject[100];
        for (int i = 0; i < 100; i++)
        {
            parts[i] = glitchPartPool.getObject();
        }
        for (int i = 0; i < 100; i++)
        {
            parts[i].SetActive(false);
        }

        boxUIActivatedRectTransform = boxUIActivated.GetComponent<RectTransform>();
        exclamationSize = boxUIActivatedRectTransform.sizeDelta;
        boxUIActivated.SetActive(false);
        guiRectTrans = gui.GetComponent<RectTransform>();
        slowFPSScript = transform.FindChild("Powers").GetComponentInChildren<SlowFPS>();
    }
	public void OnBeginDrag (PointerEventData eventData)
	{
		originPos = rt.position;
		fatherRT = rt.parent.GetComponent<RectTransform>();
		cg.blocksRaycasts = false;
		isDrag = true;
	}
 void Awake()
 {
     background = transform.Find("Background").gameObject;
     dialogue = transform.Find("Dialogue").gameObject;
     backgroundTransform = background.GetComponent<RectTransform>();
     dialogueTransform = dialogue.GetComponent<RectTransform>();
 }
    	void Start()
    	{
		colRectTransform = itemPrefab.GetComponent<RectTransform> ();
		containerRectTransform = gameObject.GetComponent<RectTransform> ();
		cardHeight = containerRectTransform.rect.height;
		cardWidth = colRectTransform.rect.width;
    	}
Exemple #28
0
 // Use this for initialization
 void Start()
 {
     SilhouetteBG = gameObject.transform.GetChild(0).GetComponent<RectTransform>();
     Boat = GameObject.Find("Boat");
     mGame = GameObject.FindGameObjectWithTag("Manager").GetComponent<GameManager>();
     //SilhouetteCanvas = SilhouetteCanvasObj.GetComponent<
 }
//--------------------------------------------------------------------------------------------

	void Start ()
	{
		// get handle on player script
		playerScript = GetComponent<Player> ();
		if(playerScript.chassisQuick) 
		{
			rechargeRate *= playerScript.cooldownBoost;
		}

		energyBar = GameObject.Find("EnergyBar").GetComponent<RectTransform>();
		origin = energyBar.localPosition;

		energySprites = Resources.LoadAll<Sprite>("GUI_Assets/EnergyIcons");
		energyImg = GameObject.Find("EnergyImg").GetComponent<Image>();
		blinkCoroutine = null;

		//init emp area prefab
		empAreaPrefab = Resources.Load<GameObject>("PlayerBullets/EMPArea");

		currEnergy = maxEnergy;
		isOnCooldown = false;

		//get handle on audio source for secondary ready
		readyAudio = GetComponents<AudioSource>()[1];
	}
Exemple #30
0
 public static void SetRectAsFullScreen(ref RectTransform targetTrans)
 {
     targetTrans.anchorMin = Vector2.zero;
     targetTrans.anchorMax = Vector2.one;
     targetTrans.offsetMin = Vector2.zero;
     targetTrans.offsetMax = Vector2.zero;
 }
	// Use this for initialization
	void Start () {
        trans = gameObject.GetComponent<RectTransform>();
        homePos = trans.localPosition;
        currentPos = homePos;
        delta = trans.rect.width / phs.max;
        trans.localPosition = GetTarget();
	}
		public void OnHover(RectTransform uiElement) {
			
			this.uiElement = uiElement;

			if (this.tempHud != null) this.tempHud.enabled = false;

			if (this.animationRoot != null) this.animationRoot.SetInState();

			var canvas = uiElement.root.GetComponentsInChildren<Canvas>()[0];
			uiElement.root.GetComponentInChildren<Canvas>();
			this.uiElementCanvas = canvas;

			this.ApplyPosition();

			if (this.animationRoot != null) this.animationRoot.SetResetState();

			if (this.layoutRoot != null) {

				this.CheckPivot(uiElement.rect.size, canvas.transform as RectTransform);

			} else {
				
				var anchor = this.root.anchoredPosition3D;
				anchor.z = 0f;
				this.root.anchoredPosition3D = anchor + Vector3.up * uiElement.rect.size.y * 0.5f;

			}

		}
Exemple #33
0
    // Use this for initialization
    void Start()
    {
        //general setup
        menu = GetComponentInParent<Menu>();
        options = new List<MenuViewOptionBasic>();
        GetComponentsInChildren<MenuViewOptionBasic>(options);
        toDraw = true;
        if(options == null) options = new List<MenuViewOptionBasic>();
        //Setup view
        viewObject = new GameObject("MenuViewBasic");
        viewObject.transform.SetParent(transform);
        canvas = viewObject.AddComponent<Canvas>();
        canvas.renderMode = RenderMode.ScreenSpaceCamera;
        canvas.worldCamera = drawCamera;
        canvas.planeDistance = 1f;
        viewObject.AddComponent<CanvasScaler>();
        viewObject.AddComponent<GraphicRaycaster>();
        //Setup textbox
        textbox = new GameObject("TextBox");
        textPosition = textbox.AddComponent<RectTransform>();
        textPosition.SetParent(viewObject.transform);
        textPosition.localPosition = new Vector3(position.x,position.y, 0);
        textbox.AddComponent<CanvasRenderer>();

        text = textbox.AddComponent<Text>();
        text.font = textFont;
        text.alignment = TextAnchor.MiddleCenter;
        text.color = new Color(color.r, color.g, color.b);
        if(options.Count > 0) text.text = options[menu.CurOption].optionText;
    }
 void Start()
 {
     introText = GetComponent<Text>();
     introText.text = introTextFile.text;
     trans = GetComponent<RectTransform>();
     y = trans.anchoredPosition.y;
 }
        public void AddInlineGraphicsChild()
        {
            if (m_inlineGraphic != null)
            {
                //Debug.LogWarning("A child Inline Graphics object already exists.");
                return;
            }

            GameObject inlineGraphicObj = new GameObject("Inline Graphic");

            m_inlineGraphic = inlineGraphicObj.AddComponent<InlineGraphic>();

            m_inlineGraphicRectTransform = inlineGraphicObj.GetComponent<RectTransform>();
            m_inlineGraphicCanvasRenderer = inlineGraphicObj.GetComponent<CanvasRenderer>();

            m_inlineGraphicRectTransform.SetParent(transform, false);
            m_inlineGraphicRectTransform.localPosition = Vector3.zero;
            m_inlineGraphicRectTransform.anchoredPosition3D = Vector3.zero;
            m_inlineGraphicRectTransform.sizeDelta = Vector2.zero;
            m_inlineGraphicRectTransform.anchorMin = Vector2.zero;
            m_inlineGraphicRectTransform.anchorMax = Vector2.one;

            m_TextMeshPro = gameObject.GetComponent<TextMeshPro>();
            m_TextMeshProUI = gameObject.GetComponent<TextMeshProUGUI>();
        }
Exemple #36
0
    // Use this for initialization
    void Start()
    {
        Invoke("ShowContinueText", 5);

        startTime = Time.realtimeSinceStartup;

        tScaler = GameObject.Find("Time Manager").GetComponent<TimeScaler>();

        boxTransform 			= GetComponent<RectTransform>();
        backgroundTransform 	= transform.parent.GetComponent<RectTransform>();
        gradientTransform 		= transform.Find("Background Gradient").GetComponent<RectTransform>();
        topBorder			 	= transform.Find("Top Border").GetComponent<RectTransform>();
        bottomBorder 			= transform.Find("Bottom Border").GetComponent<RectTransform>();

        boxImage 				= GetComponent<RawImage>();
        backgroundImage 		= transform.parent.GetComponent<RawImage>();
        gradientImage 			= transform.Find("Background Gradient").GetComponent<RawImage>();
        topImage			 	= transform.Find("Top Border").GetComponent<RawImage>();
        bottomImage 			= transform.Find("Bottom Border").GetComponent<RawImage>();
        iconImage				= transform.Find("Info Icon").GetComponent<RawImage>();

        tutorialText			= transform.Find("Tutorial Text").GetComponent<Text>();
        continueText			= transform.Find("Continue Text").GetComponent<Text>();

        SetStartingColors();

        i = 0;
    }
 static public int constructor(IntPtr l)
 {
     UnityEngine.RectTransform o;
     o = new UnityEngine.RectTransform();
     pushObject(l, o);
     return(1);
 }
 protected override void ClearUIComponents()
 {
     BtnBack      = null;
     ImgWaterMask = null;
     TextAttendanceScoreConfig = null;
     BtnAttendance             = null;
     ImageAttendanceDone       = null;
     TextPunchScoreConfig      = null;
     TextPunchScoreShareConfig = null;
     BtnPunch              = null;
     TextSignInDayNum      = null;
     TextClockNum          = null;
     TextTaskShareNum      = null;
     BtnTaskRule           = null;
     MedalScrollView       = null;
     TextMedalStudyDaysNum = null;
     TextMedalNum          = null;
     TextMedalShareNum     = null;
     BtnMedalRule          = null;
     ToggleDailyTask       = null;
     ToggleDailyMedal      = null;
     BtnIntegralRule       = null;
     BtnIntegral           = null;
     TextIntegralNum       = null;
     BtnExchange           = null;
     mData = null;
 }
	void Awake()
	{
		foodSprites = new Sprite[foodNum];
		orderedName = new string[foodNum];
		panelRT = GameObject.FindWithTag ("Panel").GetComponent<RectTransform>() ;
		cells = new GameObject[foodNum];
	}
Exemple #40
0
 void Start()
 {
     tran = GetComponent <RectTransform> ();
     sizelength = Mathf.Min (tran.rect.width, tran.rect.height);
     Init ();
     print (tran.rect);
 }
Exemple #41
0
        Entity ConstructScreenSpaceCamera(Entity e, UnityEngine.RectTransform urc)
        {
            SceneSection sceneSection = DstEntityManager.GetSharedComponentData <SceneSection>(e);
            Entity       eCam         = DstEntityManager.CreateEntity();

            DstEntityManager.AddSharedComponentData(eCam, sceneSection);

            var sizeDelta = urc.sizeDelta;

            var camera = new Unity.Tiny.Rendering.Camera
            {
                clearFlags      = Tiny.Rendering.CameraClearFlags.DepthOnly,
                backgroundColor = new Unity.Tiny.Color(0, 0, 0, 0),
                viewportRect    = new Tiny.Rect(0, 0, 1, 1),
                depth           = 0.0f,
                fov             = sizeDelta.y * 0.5f,
                mode            = ProjectionMode.Orthographic,
                clipZNear       = 0,
                clipZFar        = 102,
                aspect          = sizeDelta.x / sizeDelta.y
            };

            DstEntityManager.AddComponentData(eCam, camera);
            DstEntityManager.AddComponentData(eCam,
                                              new Unity.Tiny.Rendering.CameraMask {
                mask = (ulong)(1 << urc.gameObject.layer)
            });

            // For CameraSettings2D
            float3 customSortAxisSetting = new float3(0, 0, 1.0f);

            if (UnityEngine.Rendering.GraphicsSettings.transparencySortMode ==
                UnityEngine.TransparencySortMode.CustomAxis)
            {
                customSortAxisSetting = UnityEngine.Rendering.GraphicsSettings.transparencySortAxis;
            }
            DstEntityManager.AddComponentData(eCam, new Unity.Tiny.Rendering.CameraSettings2D
            {
                customSortAxis = customSortAxisSetting
            });

            // tag the camera as auto aspect
            DstEntityManager.AddComponentData(eCam, new CameraAutoAspectFromNode {
                Node = Entity.Null
            });

            DstEntityManager.AddComponentData(eCam, new LocalToWorld {
                Value = float4x4.identity
            });
            DstEntityManager.AddComponentData(eCam,
                                              new Translation {
                Value = new float3(sizeDelta.x / 2, sizeDelta.y / 2, -10)
            });
            DstEntityManager.AddComponentData(eCam, new Rotation {
                Value = quaternion.identity
            });
            DstEntityManager.AddComponent <UICamera>(eCam);
            return(eCam);
        }
 protected override void ClearUIComponents()
 {
     AddNewTodo = null;
     UITodoitem = null;
     Content    = null;
     BtnHave    = null;
     mData      = null;
 }
Exemple #43
0
 void ClearBinds()
 {
     BtnCreateA         = null;
     BtnCreateB         = null;
     BtnCreateC         = null;
     ItemRoot           = null;
     UITimeTickTaskItem = null;
 }
Exemple #44
0
 void SetupBinds()
 {
     BtnCreateA         = transform.Find("BtnCreateA").GetComponent <UnityEngine.UI.Button>();
     BtnCreateB         = transform.Find("BtnCreateB").GetComponent <UnityEngine.UI.Button>();
     BtnCreateC         = transform.Find("BtnCreateC").GetComponent <UnityEngine.UI.Button>();
     ItemRoot           = transform.Find("Scroll View/Viewport/ItemRoot").GetComponent <UnityEngine.RectTransform>();
     UITimeTickTaskItem = transform.Find("UITimeTickTaskItem").GetComponent <QFramework.ILKitBehaviour>();
 }
 static public int set_sizeDelta(IntPtr l)
 {
     UnityEngine.RectTransform o = (UnityEngine.RectTransform)checkSelf(l);
     UnityEngine.Vector2       v;
     checkType(l, 2, out v);
     o.sizeDelta = v;
     return(0);
 }
 static public int set_offsetMax(IntPtr l)
 {
     UnityEngine.RectTransform o = (UnityEngine.RectTransform)checkSelf(l);
     UnityEngine.Vector2       v;
     checkType(l, 2, out v);
     o.offsetMax = v;
     return(0);
 }
Exemple #47
0
 protected override void ClearUIComponents()
 {
     BtnBack      = null;
     Meteors      = null;
     ButtonGuide  = null;
     BtnSkipGuide = null;
     mData        = null;
 }
 static public int set_anchoredPosition(IntPtr l)
 {
     UnityEngine.RectTransform o = (UnityEngine.RectTransform)checkSelf(l);
     UnityEngine.Vector2       v;
     checkType(l, 2, out v);
     o.anchoredPosition = v;
     return(0);
 }
Exemple #49
0
 protected override void ClearUIComponents()
 {
     BtnBack     = null;
     Panel       = null;
     BtnConfirm  = null;
     Text        = null;
     InputMobile = null;
     mData       = null;
 }
Exemple #50
0
 static public void FastSetter(this UnityEngine.RectTransform o, string propertyName, UnityEngine.Vector3 value)
 {
     switch (propertyName)
     {
     case "anchoredPosition3D":
         o.anchoredPosition3D = value; return;
     }
     LBoot.LogUtil.Error("UnityEngine.RectTransform no Setter Found : " + propertyName);
 }
Exemple #51
0
        public static void ScreenPointToRectPosition(this UnityEngine.RectTransform rectTransform, Vector2 screenPosition, float screenRatio = 1f)
        {
            int width  = Screen.width / 2;
            int height = Screen.height / 2;

            float xPos = (screenPosition.x - (float)width) / screenRatio;
            float yPos = (screenPosition.y - (float)height) / screenRatio;

            rectTransform.anchoredPosition = new Vector2(xPos, yPos);
        }
Exemple #52
0
    void test()
    {
        Image      image;
        GameObject go = new GameObject("go");

        go.transform.SetParent(go.transform);
        UnityEngine.RectTransform ret = go.GetComponent <UnityEngine.RectTransform>();
        ret.sizeDelta = new Vector2(34, 22);
        var child = go.transform.Find("");
    }
 public void Set(RectTransform follow, float xOff = 0, float yOff = 0, position myPos = position.NULL)
 {
     following = follow;
     xOffset   = xOff;
     yOffset   = yOff;
     if (myPos != position.NULL)
     {
         myPosition = myPos;
     }
 }
 protected override void ClearUIComponents()
 {
     Meteors           = null;
     ConnectingContent = null;
     BtnCheckWiFi      = null;
     ConnectIngImage   = null;
     TextConnect       = null;
     BtnBack           = null;
     mData             = null;
 }
Exemple #55
0
 protected override void ClearUIComponents()
 {
     Content       = null;
     TvTitle       = null;
     ImgDay        = null;
     TvDayNum      = null;
     BtnAttendance = null;
     BtnBack       = null;
     mData         = null;
 }
Exemple #56
0
 void SetupBinds()
 {
     MainCamera = transform.Find("MainCamera").GetComponent <UnityEngine.Camera>();
     LogoName   = transform.Find("LogoName").GetComponent <UnityEngine.RectTransform>();
     MenuUI     = transform.Find("MenuUI").GetComponent <QFramework.ILKitBehaviour>();
     GameUI     = transform.Find("GameUI").GetComponent <QFramework.ILKitBehaviour>();
     SettingUI  = transform.Find("SettingUI").GetComponent <QFramework.ILKitBehaviour>();
     RankUI     = transform.Find("RankUI").GetComponent <QFramework.ILKitBehaviour>();
     GameOverUI = transform.Find("GameOverUI").GetComponent <QFramework.ILKitBehaviour>();
 }
Exemple #57
0
 void ClearBinds()
 {
     MainCamera = null;
     LogoName   = null;
     MenuUI     = null;
     GameUI     = null;
     SettingUI  = null;
     RankUI     = null;
     GameOverUI = null;
 }
 static public int get_anchoredPosition(IntPtr l)
 {
     try {
         UnityEngine.RectTransform self = (UnityEngine.RectTransform)checkSelf(l);
         pushValue(l, self.anchoredPosition);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_offsetMax(IntPtr l)
 {
     try {
         UnityEngine.RectTransform self = (UnityEngine.RectTransform)checkSelf(l);
         pushValue(l, self.offsetMax);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int ForceUpdateRectTransforms(IntPtr l)
 {
     try {
         UnityEngine.RectTransform self = (UnityEngine.RectTransform)checkSelf(l);
         self.ForceUpdateRectTransforms();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }