您的位置:首页 > 新闻 > 会展 > 大数据营销心得体会_免费下载的视频网站_网站底部友情链接_东莞seo项目优化方法

大数据营销心得体会_免费下载的视频网站_网站底部友情链接_东莞seo项目优化方法

2025/5/24 15:30:25 来源:https://blog.csdn.net/weixin_45571150/article/details/147123967  浏览:    关键词:大数据营销心得体会_免费下载的视频网站_网站底部友情链接_东莞seo项目优化方法
大数据营销心得体会_免费下载的视频网站_网站底部友情链接_东莞seo项目优化方法
根据鼠标位于屏幕的区域,设置弹窗锚点以及位置
public static void TipsPos(Transform tf)
{//获取ui相机var uiCamera = GetUICamera();var popup = tf.GetComponent<RectTransform>();//获取鼠标位置Vector2 mousePos = Input.mousePosition;float screenWidth = Screen.width;float screenHeight = Screen.height;if (mousePos.x < screenWidth / 2 && mousePos.y > screenHeight / 2){// 左上角popup.anchorMin = new Vector2(0, 1);popup.anchorMax = new Vector2(0, 1);popup.pivot = new Vector2(0, 1);}else if (mousePos.x > screenWidth / 2 && mousePos.y > screenHeight / 2){// 右上角popup.anchorMin = new Vector2(1, 1);popup.anchorMax = new Vector2(1, 1);popup.pivot = new Vector2(1, 1);}else if (mousePos.x < screenWidth / 2 && mousePos.y < screenHeight / 2){// 左下角popup.anchorMin = new Vector2(0, 0);popup.anchorMax = new Vector2(0, 0);popup.pivot = new Vector2(0, 0);}else if (mousePos.x > screenWidth / 2 && mousePos.y < screenHeight / 2){// 右下角popup.anchorMin = new Vector2(1, 0);popup.anchorMax = new Vector2(1, 0);popup.pivot = new Vector2(1, 0);}Vector2 localPoint;RectTransformUtility.ScreenPointToLocalPointInRectangle(popup.GetComponent<RectTransform>(), mousePos, uiCamera, out localPoint);popup.anchoredPosition = localPoint;
}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com