Files
MinFt/Client/Assets/Scripts/UI/Setting/SurveyPanel.cs
2026-04-27 12:07:32 +08:00

58 lines
1.8 KiB
C#

using asap.core;
using GameCore;
using System;
using UnityEngine;
using UnityEngine.UI;
public class SurveyPanel : MonoBehaviour
{
Button btn_close;
RectTransform RectPos;
WebView webView;
int left; int top; int right; int bottom;
DateTime startTime;
private void Awake()
{
webView = GetComponent<WebView>();
btn_close = transform.Find("root/btn_close").GetComponent<Button>();
RectPos = transform.Find("content").GetComponent<RectTransform>();
}
private void Start()
{
startTime = ZZTimeHelper.UtcNow();
UIManager.Instance.DestroyUI(UITypes.FishingMorePanel);
#if UNITY_EDITOR
string Url = "";
Application.OpenURL(Url);
#else
Vector2 anchoredPosition1 = GetComponent<RectTransform>().anchoredPosition;
Vector2 anchoredPosition = anchoredPosition1 + RectPos.anchoredPosition;
var rect = RectPos.rect;
var rectparent = UIManager.Instance.RectTrans.rect;
int width = (int)rectparent.width / 2;
int height = (int)rectparent.height / 2;
left = width + (int)(rect.xMin + anchoredPosition.x);
right = width - (int)(rect.xMax + anchoredPosition.x);
top = height - (int)(rect.yMax + anchoredPosition.y);
bottom = height + (int)(rect.yMin + anchoredPosition.y);
string Url = "";
webView.OnOpen(Url, left, top, right, bottom);
#endif
btn_close.onClick.AddListener(Close);
}
void Close()
{
if ((ZZTimeHelper.UtcNow() - startTime).TotalSeconds >= 10)
{
// GContext.container.Resolve<SurveyService>().GetSurveyCheckAnswer();
}
UIManager.Instance.DestroyUI(UITypes.SurveyPanel);
}
private void OnDisable()
{
webView.OnClose();
}
}