48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
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);
|
|
}
|
|
}
|