You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.7 KiB
54 lines
1.7 KiB
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using UnityEngine.UI; |
|
|
|
|
|
/// <summary> |
|
/// 负责删除、编辑、添加脚本的位置匹配 |
|
/// </summary> |
|
public class AdjustIcon : MonoBehaviour { |
|
|
|
RectTransform rectEdit; |
|
RectTransform rectAdd; |
|
RectTransform rectDel; |
|
TreeViewItem__ treeView; |
|
|
|
// Use this for initialization |
|
void Start () { |
|
rectEdit=TransformHelper.FindChild(transform,"TreeViewButtonEdit").GetComponent<RectTransform>(); |
|
rectAdd = TransformHelper.FindChild(transform, "TreeViewButtonAdd").GetComponent<RectTransform>(); |
|
rectDel = TransformHelper.FindChild(transform, "TreeViewButtonDelete").GetComponent<RectTransform>(); |
|
treeView = GetComponent<TreeViewItem__>(); |
|
InitOrigPos(); |
|
} |
|
|
|
void InitOrigPos() |
|
{ |
|
switch (treeView.GetHierarchy()) |
|
{ |
|
case 1: |
|
SetPos(new Vector2(101.5f,0.2f),new Vector2(119,0.2f),new Vector2(136.5f,0.2f)); |
|
break; |
|
case 2: |
|
SetPos(new Vector2(87.4f,0), new Vector2(104.9f, 0), new Vector2(122.4f, 0)); |
|
break; |
|
case 3: |
|
SetPos(new Vector2(73.41f,0), new Vector2(90.91f,0), new Vector2(107.9f,0)); |
|
break; |
|
case 4: |
|
SetPos(new Vector2(59.41f, 0), new Vector2(76.91f, 0), new Vector2(93.9f, 0)); |
|
break; |
|
default: |
|
break; |
|
} |
|
} |
|
|
|
void SetPos(Vector2 vecEdit, Vector2 vecAdd, Vector2 vecDel) |
|
{ |
|
rectEdit.anchoredPosition = vecEdit; |
|
rectAdd.anchoredPosition = vecAdd; |
|
rectDel.anchoredPosition = vecDel; |
|
} |
|
|
|
}
|
|
|