|
@@ -199,19 +199,32 @@ namespace GFGGame
|
|
|
GObject obj = context.sender as GObject;
|
|
|
int index = (int)obj.data;
|
|
|
|
|
|
+ Vector2 size = Vector2.zero;
|
|
|
Vector2 pos = new Vector2();
|
|
|
- if (index % 2 == 0) {
|
|
|
- pos = _ui.m_ListTeaParty.LocalToGlobal(TeaPartyItemObj[index].position);
|
|
|
- pos.x = pos.x + TeaPartyItemObj[index].width;
|
|
|
- pos.y = pos.y + TeaPartyItemObj[index].height / 2;
|
|
|
+ UI_comTeaPartyItem itemObj = UI_comTeaPartyItem.Proxy(TeaPartyItemObj[index]);
|
|
|
+ if (itemObj.m_btnDetail != null)
|
|
|
+ {
|
|
|
+ pos = itemObj.m_btnDetail.LocalToRoot(Vector2.zero, GRoot.inst);
|
|
|
+ size = itemObj.m_btnDetail.LocalToRoot(itemObj.m_btnDetail.size, GRoot.inst) - pos;
|
|
|
}
|
|
|
- else {
|
|
|
- pos = _ui.m_ListTeaParty.LocalToGlobal(TeaPartyItemObj[index].position);
|
|
|
- pos.x = pos.x - TeaPartyItemObj[index].width;
|
|
|
- pos.y = pos.y + TeaPartyItemObj[index].height / 2;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pos = obj.GlobalToLocal(Stage.inst.touchPosition);
|
|
|
}
|
|
|
-
|
|
|
- _ui.m_teaPartyItemTips.m_window.position = pos;
|
|
|
+
|
|
|
+ float xx, yy;
|
|
|
+ xx = pos.x - size.x * 2;
|
|
|
+ if (xx + _ui.m_teaPartyItemTips.m_window.width > _ui.target.viewWidth)
|
|
|
+ xx = xx + size.x * 4 - _ui.m_teaPartyItemTips.m_window.width;
|
|
|
+ yy = pos.y + size.y;
|
|
|
+ if (yy + _ui.m_teaPartyItemTips.m_window.height > _ui.target.viewHeight)
|
|
|
+ {
|
|
|
+ yy = pos.y - _ui.m_teaPartyItemTips.m_window.height;
|
|
|
+ if (yy < 0)
|
|
|
+ yy = 0;
|
|
|
+ }
|
|
|
+ UI_comTeaPartyItem.ProxyEnd();
|
|
|
+ _ui.m_teaPartyItemTips.m_window.position = new Vector2(Mathf.RoundToInt(xx), Mathf.RoundToInt(yy));
|
|
|
|
|
|
_ui.m_teaPartyItemTips.target.visible = true;
|
|
|
_ui.m_teaPartyItemTips.m_txtName.text = teapartyRoleCfg[index].name;
|