备份CatanBuilding瘦身独立工程
This commit is contained in:
46
Assets/Scripts/UI/Setting/SurveyPanel.cs
Normal file
46
Assets/Scripts/UI/Setting/SurveyPanel.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using asap.core;
|
||||
using GameCore;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SurveyPanel : MonoBehaviour
|
||||
{
|
||||
Button btn_close;
|
||||
RectTransform RectPos;
|
||||
WebView webView;
|
||||
int left; int top; int right; int bottom;
|
||||
private void Awake()
|
||||
{
|
||||
webView = GetComponent<WebView>();
|
||||
btn_close = transform.Find("root/btn_close").GetComponent<Button>();
|
||||
RectPos = transform.Find("content").GetComponent<RectTransform>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.FishingMorePanel);
|
||||
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 = GContext.container.Resolve<SurveyService>().GetSurveyAnswer();
|
||||
webView.OnOpen(Url, left, top, right, bottom);
|
||||
btn_close.onClick.AddListener(Close);
|
||||
}
|
||||
void Close()
|
||||
{
|
||||
GContext.container.Resolve<SurveyService>().GetSurveyCheckAnswer();
|
||||
UIManager.Instance.DestroyUI(UITypes.SurveyPanel);
|
||||
}
|
||||
private void OnDisable()
|
||||
{
|
||||
webView.OnClose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user