|
@@ -60,8 +60,6 @@ namespace GFGGame
|
|
|
_ui.m_btnBg.onClick.Add(OnClickBtnBg);
|
|
|
_ui.m_btnChoose.onClick.Add(OnClickBtnChoose);
|
|
|
_ui.m_btnBack.onClick.Add(OnClickBtnBack);
|
|
|
- _ui.m_comSelectBox.m_btnDelete.onClick.Add(OnClickBtnDelete);
|
|
|
- _ui.m_comSelectBox.m_btnFlip.onClick.Add(OnClickBtnFlip);
|
|
|
_ui.m_btnPhotograph.onClick.Add(OnClickBtnPhotograph);
|
|
|
|
|
|
_ui.m_ComSelectRes.m_list.itemRenderer = RenderListItem;
|
|
@@ -77,6 +75,13 @@ namespace GFGGame
|
|
|
_ui.m_comSelectBox.m_btnSize.onTouchBegin.Add(OnClickBtnSizeBegin);
|
|
|
_ui.m_comSelectBox.m_btnSize.onTouchMove.Add(OnClickBtnSizeMove);
|
|
|
_ui.m_comSelectBox.m_btnSize.onTouchEnd.Add(OnClickBtnSizeEnd);
|
|
|
+
|
|
|
+ _ui.m_comSelectBox.m_btnFlip.onTouchBegin.Add(OnClickBtnFlip);
|
|
|
+ _ui.m_comSelectBox.m_btnFlip.onTouchEnd.Add(OnClickBtnFlipEnd);
|
|
|
+
|
|
|
+ _ui.m_comSelectBox.m_btnDelete.onTouchBegin.Add(OnClickBtnDelete);
|
|
|
+ _ui.m_comSelectBox.m_btnDelete.onTouchEnd.Add(OnClickBtnDeleteEnd);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
@@ -190,35 +195,30 @@ namespace GFGGame
|
|
|
RaycastHit2D[] hit2Ds = Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
|
|
|
if (hit2Ds.Length > 0)
|
|
|
{
|
|
|
- hitParentGameObj = SceneController.GetFirstHitObj(hit2Ds);
|
|
|
maxLayer++;
|
|
|
+ hitParentGameObj = SceneController.GetFirstHitObj(hit2Ds);
|
|
|
+ _ui.m_comSelectBox.target.visible = false;
|
|
|
if (hitParentGameObj.name != "BgRes")
|
|
|
{
|
|
|
hitParentGameObj.GetComponent<SpriteRenderer>().sortingOrder = maxLayer;
|
|
|
hitParentGameObj = hitParentGameObj.transform.parent.gameObject;
|
|
|
- }
|
|
|
+ _ui.m_comSelectBox.target.visible = true;
|
|
|
|
|
|
+ }
|
|
|
+ _ui.m_comSelectBox.m_btnDelete.visible = true;
|
|
|
+ if (hitParentGameObj == bodyParent)
|
|
|
+ {
|
|
|
+ _ui.m_comSelectBox.m_btnDelete.visible = false;
|
|
|
+ }
|
|
|
|
|
|
- // hitParentGameObj = hitParentGameObj.name == "BgRes" ? hitParentGameObj :
|
|
|
distance = Input.mousePosition - Camera.main.WorldToScreenPoint(hitParentGameObj.transform.position);
|
|
|
|
|
|
|
|
|
-
|
|
|
- _ui.m_comSelectBox.target.visible = hitParentGameObj.transform.parent.gameObject == bgParent ? false : true;
|
|
|
if (_ui.m_comSelectBox.target.data == null || _ui.m_comSelectBox.target.data as GameObject != hitParentGameObj)
|
|
|
{
|
|
|
lastPos = Vector2.zero;
|
|
|
- // _ui.m_comSelectBox.target.SetScale(1, 1);
|
|
|
_ui.m_comSelectBox.target.rotation = -hitParentGameObj.transform.eulerAngles.z;
|
|
|
_ui.m_comSelectBox.target.size = SceneController.GetGameObjectSize(hitParentGameObj);
|
|
|
- // _ui.m_comSelectBox.target.SetScale(hitParentGameObj.transform.localScale.x, hitParentGameObj.transform.localScale.y);
|
|
|
-
|
|
|
- }
|
|
|
- _ui.m_comSelectBox.m_btnDelete.visible = true;
|
|
|
- if (hitParentGameObj == bodyParent)
|
|
|
- {
|
|
|
- _ui.m_comSelectBox.m_btnDelete.visible = false;
|
|
|
-
|
|
|
}
|
|
|
_ui.m_comSelectBox.target.data = hitParentGameObj;
|
|
|
|
|
@@ -297,19 +297,16 @@ namespace GFGGame
|
|
|
|
|
|
Vector2 screenPos = this.viewCom.GlobalToLocal(_ui.m_comSelectBox.m_btnSize.LocalToGlobal(Vector2.zero));
|
|
|
Vector2 pt = new Vector2(screenPos.x, screenPos.y);
|
|
|
- // Vector2 pt1 = this.viewCom.GlobalToLocal(new Vector2(inputEvent.x, inputEvent.y));
|
|
|
- Vector2 pt2 = this.viewCom.GlobalToLocal(new Vector2(_ui.m_comSelectBox.target.x, _ui.m_comSelectBox.target.y));
|
|
|
- // Debug.Log("pt1" + pt1 + " pt2:" + pt2 + " pt:" + pt);
|
|
|
+ Vector2 pt1 = this.viewCom.GlobalToLocal(new Vector2(inputEvent.x, inputEvent.y));
|
|
|
+ Vector2 pt2 = new Vector2(_ui.m_comSelectBox.target.x, _ui.m_comSelectBox.target.y);
|
|
|
+ Debug.Log("pt1" + pt1 + " pt2:" + pt2 + " pt:" + pt);
|
|
|
|
|
|
if (!_equipDistance.ContainsKey(gameObject))
|
|
|
{
|
|
|
- float distance = Vector2.Distance(pt, pt2);
|
|
|
+ float distance = Vector2.Distance(pt1, pt2);
|
|
|
_equipDistance.Add(gameObject, distance);
|
|
|
}
|
|
|
_startDistance = _equipDistance[gameObject];
|
|
|
- // _startDistance = Vector2.Distance(pt1, pt2);
|
|
|
- // Vector2 pt1 = _ui.m_comSelectBox.target.size;// this.viewCom.GlobalToLocal(screenPos); ;
|
|
|
- // _startDistance = Vector2.Distance(pt, pt2);
|
|
|
Debug.Log("_startDistance:" + _startDistance);
|
|
|
|
|
|
}
|
|
@@ -319,7 +316,7 @@ namespace GFGGame
|
|
|
if (gameObject == null) return;
|
|
|
InputEvent inputEvent = (InputEvent)context.data;
|
|
|
Vector2 pt1 = this.viewCom.GlobalToLocal(new Vector2(inputEvent.x, inputEvent.y));
|
|
|
- Vector2 pt2 = this.viewCom.GlobalToLocal(new Vector2(_ui.m_comSelectBox.target.x, _ui.m_comSelectBox.target.y));
|
|
|
+ Vector2 pt2 = new Vector2(_ui.m_comSelectBox.target.x, _ui.m_comSelectBox.target.y);
|
|
|
Vector2 curPos = pt1 - pt2;
|
|
|
Debug.Log("pt1" + pt1 + " pt2:" + pt2 + " curPos:" + curPos + " lastPos:" + lastPos);
|
|
|
float angle = Vector3.Angle(lastPos, curPos); //求出两向量之间的夹角
|
|
@@ -365,7 +362,7 @@ namespace GFGGame
|
|
|
gameObject.transform.localScale = new Vector3(value, value, value);
|
|
|
|
|
|
Vector2 size = SceneController.GetGameObjectSize(gameObject);
|
|
|
- _ui.m_comSelectBox.target.SetSize(size.x * value, size.y * value);
|
|
|
+ _ui.m_comSelectBox.target.SetSize(size.x, size.y);
|
|
|
}
|
|
|
|
|
|
private void OnRotate(EventContext context)
|
|
@@ -465,13 +462,21 @@ namespace GFGGame
|
|
|
}
|
|
|
private void OnClickBtnFlip()
|
|
|
{
|
|
|
- GameObject gameObject = _ui.m_comSelectBox.target.data as GameObject;
|
|
|
- gameObject.transform.GetChild(0).Rotate(Vector3.up, 180, Space.World);
|
|
|
-
|
|
|
- // gameObject.transform.rotation.x = 180;
|
|
|
+ isTouchUI = true;
|
|
|
+ Transform transform = (_ui.m_comSelectBox.target.data as GameObject).transform;
|
|
|
+ for (int i = 0; i < transform.childCount; i++)
|
|
|
+ {
|
|
|
+ transform.GetChild(i).Rotate(Vector3.up, 180, Space.World);
|
|
|
+ }
|
|
|
}
|
|
|
+ private void OnClickBtnFlipEnd()
|
|
|
+ {
|
|
|
+ isTouchUI = false;
|
|
|
+ }
|
|
|
+
|
|
|
private void OnClickBtnDelete()
|
|
|
{
|
|
|
+ isTouchUI = true;
|
|
|
GameObject gameObject = _ui.m_comSelectBox.target.data as GameObject;
|
|
|
if (gameObject.transform.gameObject == bodyParent)
|
|
|
{
|
|
@@ -492,6 +497,10 @@ namespace GFGGame
|
|
|
_ui.m_comSelectBox.target.visible = false;
|
|
|
|
|
|
}
|
|
|
+ private void OnClickBtnDeleteEnd()
|
|
|
+ {
|
|
|
+ isTouchUI = false;
|
|
|
+ }
|
|
|
private void OnClickBtnPhotograph()
|
|
|
{
|
|
|
_ui.target.visible = false;
|