备份CatanBuilding瘦身独立工程
This commit is contained in:
47
Assets/Scripts/UI/Setting/SurveyPopupPanel.cs
Normal file
47
Assets/Scripts/UI/Setting/SurveyPopupPanel.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SurveyPopupPanel : MonoBehaviour
|
||||
{
|
||||
Button btn_close;
|
||||
Button btn_go;
|
||||
RewardItemNew itemNew;
|
||||
private void Awake()
|
||||
{
|
||||
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
||||
btn_go = transform.Find("root/btn_go/btn_green").GetComponent<Button>();
|
||||
itemNew = transform.Find("root/reward").GetComponent<RewardItemNew>();
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
btn_close.onClick.AddListener(Close);
|
||||
btn_go.onClick.AddListener(OnGo);
|
||||
SetReward();
|
||||
}
|
||||
void SetReward()
|
||||
{
|
||||
SurveyService surveyService = GContext.container.Resolve<SurveyService>();
|
||||
var SurveyReward = GContext.container.Resolve<Tables>().TbGlobalConfig.SurveyReward;
|
||||
int award = surveyService.Award;
|
||||
if (!SurveyReward.Contains(award))
|
||||
{
|
||||
Debug.LogError("问卷奖励错误: " + award);
|
||||
award = SurveyReward[0];
|
||||
}
|
||||
ItemData itemData = GContext.container.Resolve<PlayerItemData>().GetItemDataOne(award);
|
||||
itemNew.SetData(itemData);
|
||||
}
|
||||
async void OnGo()
|
||||
{
|
||||
await UIManager.Instance.ShowUI(UITypes.SurveyPanel);
|
||||
Close();
|
||||
}
|
||||
void Close()
|
||||
{
|
||||
UIManager.Instance.DestroyUI(UITypes.SurveyPopupPanel);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user