93 lines
2.7 KiB
C#
93 lines
2.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using TTSDK;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class LosePanel : MonoBehaviour
|
|
{
|
|
[SerializeField] private Button nextButton;
|
|
|
|
[SerializeField] private Button closeButton;
|
|
[SerializeField] private List<TaskItem> _taskItems;
|
|
[SerializeField] private Slider _slider;
|
|
|
|
[SerializeField] private TextMeshProUGUI _points;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
private void OnEnable()
|
|
{
|
|
nextButton.onClick.AddListener(NextEvent);
|
|
closeButton.onClick.AddListener(CloseEvent);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
nextButton.onClick.RemoveListener(NextEvent);
|
|
closeButton.onClick.RemoveListener(CloseEvent);
|
|
}
|
|
public void SaveData(int id)
|
|
{
|
|
var data=JsonTab.Instance.tables.Level.Get(id);
|
|
_taskItems[0].InitData(id, data.Maintasks);
|
|
for (int i = 1; i < _taskItems.Count; i++)
|
|
{
|
|
_taskItems[i].gameObject.SetActive(false);
|
|
}
|
|
for (int i = 0; i < data.Additionaltasks.Count; i++)
|
|
{
|
|
_taskItems[i+1].gameObject.SetActive(true);
|
|
_taskItems[i+1].InitData(id,data.Additionaltasks[i]);
|
|
}
|
|
_points.text = DataManager.LastTimePoints(GameManager.ins.level).ToString();
|
|
_slider.value = GameManager.ins.NowLenght / data.Length;
|
|
}
|
|
void NextEvent()
|
|
{
|
|
AdMgr.Instance.ShowAd((a) =>
|
|
{
|
|
DataManager.STTAnalytics("AddTime",DataManager.GTTAnalytics("AddTime")+1);
|
|
switch (DataManager.GTTAnalytics("AddTime"))
|
|
{
|
|
case 1:
|
|
TT.ReportAnalytics<string>("a10131");
|
|
DotData.ins.SendEvent("a10131","");
|
|
break;
|
|
case 2:
|
|
TT.ReportAnalytics<string>("a10132");
|
|
DotData.ins.SendEvent("a10132","");
|
|
break;
|
|
case 3:
|
|
TT.ReportAnalytics<string>("a10133");
|
|
DotData.ins.SendEvent("a10133","");
|
|
break;
|
|
case 5:
|
|
TT.ReportAnalytics<string>("a10134");
|
|
DotData.ins.SendEvent("a10134","");
|
|
break;
|
|
case 10:
|
|
TT.ReportAnalytics<string>("a10135");
|
|
DotData.ins.SendEvent("a10135","");
|
|
break;
|
|
}
|
|
MainPanel.ins.AddTourPanel(10);
|
|
gameObject.SetActive(false);
|
|
},1);
|
|
}
|
|
|
|
void CloseEvent()
|
|
{
|
|
MainPanel.ins.ClosePanelEvent();
|
|
}
|
|
}
|