S5 finish
This commit is contained in:
@@ -152,7 +152,7 @@ namespace GeometryTD.UI
|
||||
TypeText = seed.TypeText,
|
||||
Description = seed.Description ?? string.Empty,
|
||||
Price = 0,
|
||||
TargetPos = args.TargetPos,
|
||||
ScreenPosition = args.ScreenPosition,
|
||||
Tags = CloneTags(seed.Tags),
|
||||
TagRuntimes = CloneTagRuntimes(seed.TagRuntimes)
|
||||
});
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace GeometryTD.UI
|
||||
return;
|
||||
}
|
||||
|
||||
GameEntry.Event.Fire(this, RepoItemClickedEventArgs.Create(_context.InstanceId, transform.position));
|
||||
GameEntry.Event.Fire(this, RepoItemClickedEventArgs.Create(_context.InstanceId, ResolveScreenPosition()));
|
||||
}
|
||||
|
||||
public void OnBeginDrag(PointerEventData eventData)
|
||||
@@ -239,6 +239,25 @@ namespace GeometryTD.UI
|
||||
}
|
||||
}
|
||||
|
||||
private Vector2 ResolveScreenPosition()
|
||||
{
|
||||
RectTransform rectTransform = transform as RectTransform;
|
||||
if (rectTransform == null)
|
||||
{
|
||||
return Vector2.zero;
|
||||
}
|
||||
|
||||
Canvas canvas = GetComponentInParent<Canvas>();
|
||||
Canvas rootCanvas = canvas != null ? canvas.rootCanvas : null;
|
||||
Camera uiCamera = null;
|
||||
if (rootCanvas != null && rootCanvas.renderMode != RenderMode.ScreenSpaceOverlay)
|
||||
{
|
||||
uiCamera = rootCanvas.worldCamera != null ? rootCanvas.worldCamera : Camera.main;
|
||||
}
|
||||
|
||||
return RectTransformUtility.WorldToScreenPoint(uiCamera, rectTransform.position);
|
||||
}
|
||||
|
||||
private RectTransform ResolveDragRoot()
|
||||
{
|
||||
Canvas canvas = GetComponentInParent<Canvas>();
|
||||
@@ -348,4 +367,3 @@ namespace GeometryTD.UI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user