void Awake() { m_self_rtf = this.GetComponent <RectTransform>(); RectTransform[] rtfs = this.GetComponentsInChildren <RectTransform>(); foreach (RectTransform rtf in rtfs) { if (rtf.transform == this.transform) { continue; } DragAble da = rtf.GetComponent <DragAble>(); if (null != da) { m_child_icon_list.Add(da); } else { rtf.gameObject.name = this.gameObject.name; m_child_logic_rect_list.Add(rtf); } } }
public void DragBegin(int oldX, int oldY, DragAble component) { OldX = oldX; OldY = oldY; preX = currentX; preY = currentY; componentOnDrag = component; }
public void DragEnd() { componentOnDrag.DragReleased(preX, preY); OldX = 0; OldY = 0; preX = 0; preY = 0; componentOnDrag = null; }
void Start() { m_sqrt_straight_near_dis = (float)(m_straight_near_dis * m_straight_near_dis); m_sqrt_oblique_near_dis = (float)(m_oblique_near_dis * m_oblique_near_dis); canvasRectTrans = DragAble.FindInParents <Canvas>(this.gameObject).transform as RectTransform; foreach (var item in this.GetComponentsInChildren <DragAbleParent>()) { foreach (DragAble d in item.m_child_icon_list) { d.ReisterMoveEnd(JudgeCombine); } m_drag_able_parents_list.Add(item); } float r_w = m_drag_able_parents_list[0].m_child_logic_rect_list[0].rect.width; float r_h = m_drag_able_parents_list[0].m_child_logic_rect_list[0].rect.height; m_logic_rect_size = new Vector2(r_w, r_h); Dictionary <int, string> row0 = new Dictionary <int, string>(); row0[0] = "00"; row0[1] = "01"; row0[2] = "02"; row0[3] = "03"; Dictionary <int, string> row1 = new Dictionary <int, string>(); row0[0] = "10"; row0[1] = "11"; row0[2] = "12"; row0[3] = "13"; Dictionary <int, string> row2 = new Dictionary <int, string>(); row0[0] = "20"; row0[1] = "21"; row0[2] = "22"; row0[3] = "23"; Dictionary <int, string> row3 = new Dictionary <int, string>(); row0[0] = "30"; row0[1] = "31"; row0[2] = "32"; row0[3] = "33"; m_split_index_mx[0] = row0; m_split_index_mx[0] = row1; m_split_index_mx[0] = row2; m_split_index_mx[0] = row3; }