Ejemplo n.º 1
0
    public void SetAnnouncement(Transform bind, Color c, string message)
    {
        worldPosition = bind.position;

        text = GetComponent <Text> ();

        Vector2 offset = new Vector2(UnityEngine.Random.Range(-1.5f, 1.5f), UnityEngine.Random.Range(-1.5f, 1.5f));

        worldPosition += (Vector3)offset;

        text.fontSize = text.fontSize + UnityEngine.Random.Range(-5, 5);

        CachedRectTransform.AlignToWorldPosition(worldPosition, TrashUIManager.Instance.uiCanvas.planeDistance);

        Vector3 rotation = bind.root.eulerAngles;

        rotation.z += UnityEngine.Random.Range(-20f, 20f);

        CachedTransform.rotation = Quaternion.Euler(rotation);

        text.color = c;

        startAlpha = text.color.a;

        text.text = message;
    }
		public override void ResetDefault()
		{
			if (defaultSetting == null) return;

			CachedRectTransform.anchoredPosition = defaultSetting.anchoredPosition;
			CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, defaultSetting.size.x);
			CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, defaultSetting.size.y);
		}
Ejemplo n.º 3
0
        public void DoReposition()
        {
            mNeedReposition = false;
            int count = mTreeItemList.Count;

            mContentTotalHeight = 0;
            mContentTotalWidth  = 0;
            CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0);
            if (IsRootTree == false)
            {
                CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, TreeListMaxWidth);
            }
            if (count == 0)
            {
                return;
            }
            float itemPadding = 0;

            if (ParentTreeItem != null)
            {
                itemPadding = ParentTreeItem.ChildTreeItemPadding;
            }
            else
            {
                itemPadding = RootTreeView.ItemPadding;
            }
            float curY = 0;

            if (ParentTreeItem != null)
            {
                curY = -ParentTreeItem.ChildTreeListPadding;
            }
            for (int i = 0; i < count; ++i)
            {
                TreeViewItem tItem = mTreeItemList[i];
                tItem.CachedRectTransform.localPosition = new Vector3(0, curY, 0);
                tItem.Reposition();

                curY = curY - tItem.TotalHeight - itemPadding;
                if (tItem.MaxWidth > mContentTotalWidth)
                {
                    mContentTotalWidth = tItem.MaxWidth;
                }
            }
            mContentTotalHeight = -curY - itemPadding;
            CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, mContentTotalHeight);
            if (IsRootTree)
            {
                CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, mContentTotalWidth);
            }
        }
Ejemplo n.º 4
0
        public List <GameObject> AddChildrenFromPrefab(int count, GameObject prefab, System.Action <GameObject, int> callcackCreateItem)
        {
            List <GameObject> goList = new List <GameObject> ();

            for (int i = 0; i < count; ++i)
            {
                GameObject go = CachedRectTransform.AddChildPrefab(prefab);
                goList.Add(go);
                if (callcackCreateItem != null)
                {
                    callcackCreateItem(go, i);
                }
            }
            return(goList);
        }
		void Update()
		{
			if (defaultSetting==null)
			{
				InitDefaultSetting();
			}
			if (HasChanged)
			{
				Setting setting = settingList.Find(x => x.language == currentLanguage);
				if (setting == null)
				{
					setting = defaultSetting;
				}
				if (setting == null) return;

				CachedRectTransform.anchoredPosition = setting.anchoredPosition;
				CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, setting.size.x);
				CachedRectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, setting.size.y);
			}
		}
Ejemplo n.º 6
0
 void LateUpdate()
 {
     CachedRectTransform.AlignToWorldPosition(worldPosition, TrashUIManager.Instance.uiCanvas.planeDistance);
 }
Ejemplo n.º 7
0
 public void DestroyAllChildren()
 {
     CachedRectTransform.DestroyChildren();
 }
 public void AlignToWorldObject(Transform worldTransform)
 {
     CachedRectTransform.AlignToWorldTransform(worldTransform);
 }
 public void AlignToWorldPosition(Vector3 worldPosition)
 {
     CachedRectTransform.AlignToWorldPosition(worldPosition);
 }