예제 #1
0
 public void OnPointerUp(BaseEventData eventData)
 {
     if (!isAllowDrag)
     {
         return;
     }
     m_rect.localScale    = normalScale;
     m_rect.localPosition = itemOriginPos;
     dragPos       = itemOriginPos;
     m_image.color = ColorCollection.GetVecClear();
 }
예제 #2
0
 public void ChangeBindItem(CraftItem binditem, Sprite spr)
 {
     bindItem = binditem;
     try {
         //m_image.sprite = spr;
         UICollection.SetImage(bindItem.GetComponent <Image>().sprite, m_image);
         m_image.color = ColorCollection.GetVecClear();
     }
     catch (Exception e) {
         Debug.Log("这里的报错应该是因为Awake事件还未执行造成");
         Debug.Log(e);
     }
 }
예제 #3
0
 // Start is called before the first frame update
 void Awake()
 {
     //得到自己的必要组件
     m_rect  = GetComponent <RectTransform>();
     m_image = GetComponent <Image>();
     //设置拖动部件初始不可见
     //m_image.sprite = bindItem.GetComponent<Image>().sprite;
     UICollection.SetImage(bindItem.GetComponent <Image>().sprite, m_image);
     m_image.color = ColorCollection.GetVecClear();
     //设置用于拖动逻辑的坐标
     itemOriginPos = m_rect.localPosition;
     dragPos       = itemOriginPos;
 }