2024-11-08 18:21:41 +08:00
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
2024-11-29 21:37:01 +08:00
|
|
|
using TMPro;
|
2024-12-18 11:12:52 +08:00
|
|
|
using TTSDK;
|
|
|
|
using TTSDK.UNBridgeLib.LitJson;
|
2024-11-08 18:21:41 +08:00
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
public class WinPanel : MonoBehaviour
|
|
|
|
{
|
|
|
|
[SerializeField] private Button nextButton;
|
|
|
|
|
|
|
|
[SerializeField] private Button closeButton;
|
2024-11-26 15:44:50 +08:00
|
|
|
|
|
|
|
[SerializeField] private List<TaskItem> _taskItems;
|
2024-11-29 21:37:01 +08:00
|
|
|
|
|
|
|
[SerializeField] private Slider _slider;
|
|
|
|
|
|
|
|
[SerializeField] private TextMeshProUGUI _points;
|
2024-11-08 18:21:41 +08:00
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-11-26 15:44:50 +08:00
|
|
|
public void SaveData(int id)
|
|
|
|
{
|
2024-12-18 11:12:52 +08:00
|
|
|
switch (id)
|
|
|
|
{
|
|
|
|
case 110011:
|
|
|
|
TT.ReportAnalytics<string>("10103");
|
2024-12-20 10:42:48 +08:00
|
|
|
DotData.ins.SendEvent("10103","");
|
2024-12-18 11:12:52 +08:00
|
|
|
break;
|
|
|
|
case 110012:
|
|
|
|
TT.ReportAnalytics<string>("10105");
|
2024-12-20 10:42:48 +08:00
|
|
|
DotData.ins.SendEvent("10105","");
|
2024-12-18 11:12:52 +08:00
|
|
|
break;
|
|
|
|
case 110013:
|
|
|
|
TT.ReportAnalytics<string>("10107");
|
2024-12-20 10:42:48 +08:00
|
|
|
DotData.ins.SendEvent("10107","");
|
2024-12-18 11:12:52 +08:00
|
|
|
break;
|
|
|
|
case 110015:
|
|
|
|
TT.ReportAnalytics<string>("10109");
|
2024-12-20 10:42:48 +08:00
|
|
|
DotData.ins.SendEvent("10109","");
|
2024-12-18 11:12:52 +08:00
|
|
|
break;
|
|
|
|
case 110025:
|
|
|
|
TT.ReportAnalytics<string>("10110");
|
2024-12-20 10:42:48 +08:00
|
|
|
DotData.ins.SendEvent("10110","");
|
2024-12-18 11:12:52 +08:00
|
|
|
break;
|
|
|
|
case 110045:
|
|
|
|
TT.ReportAnalytics<string>("10111");
|
2024-12-20 10:42:48 +08:00
|
|
|
DotData.ins.SendEvent("10111","");
|
2024-12-18 11:12:52 +08:00
|
|
|
break;
|
|
|
|
}
|
2024-11-26 15:44:50 +08:00
|
|
|
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]);
|
|
|
|
}
|
2024-11-29 21:37:01 +08:00
|
|
|
|
|
|
|
_points.text = DataManager.LastTimePoints(GameManager.ins.level).ToString();
|
|
|
|
_slider.value = GameManager.ins.NowLenght / data.Length;
|
2024-11-26 15:44:50 +08:00
|
|
|
}
|
|
|
|
|
2024-11-08 18:21:41 +08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
void NextEvent()
|
|
|
|
{
|
2024-12-18 11:12:52 +08:00
|
|
|
AdMgr.Instance.ShowAd((a) =>
|
|
|
|
{
|
|
|
|
var lastPoints=DataManager.LastTimePoints(GameManager.ins.level)*2;
|
|
|
|
DataManager.SetPointsData(GameManager.ins.level, lastPoints);
|
|
|
|
SaveTTEvent();
|
|
|
|
DataManager.STTAnalytics("Double",DataManager.GTTAnalytics("Double")+1);
|
|
|
|
switch (DataManager.GTTAnalytics("Double"))
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
TT.ReportAnalytics<string>("10136");
|
2024-12-20 10:42:48 +08:00
|
|
|
DotData.ins.SendEvent("10136","");
|
2024-12-18 11:12:52 +08:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
TT.ReportAnalytics<string>("10137");
|
2024-12-20 10:42:48 +08:00
|
|
|
DotData.ins.SendEvent("10137","");
|
2024-12-18 11:12:52 +08:00
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
TT.ReportAnalytics<string>("10138");
|
2024-12-20 10:42:48 +08:00
|
|
|
DotData.ins.SendEvent("10138","");
|
2024-12-18 11:12:52 +08:00
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
TT.ReportAnalytics<string>("10139");
|
2024-12-20 10:42:48 +08:00
|
|
|
DotData.ins.SendEvent("10139","");
|
2024-12-18 11:12:52 +08:00
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
TT.ReportAnalytics<string>("10140");
|
2024-12-20 10:42:48 +08:00
|
|
|
DotData.ins.SendEvent("10140","");
|
2024-12-18 11:12:52 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
MainPanel.ins.ClosePanelEvent();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
private void SaveTTEvent()
|
|
|
|
{
|
|
|
|
var paramJson = new JsonData
|
|
|
|
{
|
|
|
|
["level"] = GameManager.ins.level,
|
|
|
|
["value"] = DataManager.LastTimePoints(GameManager.ins.level),
|
|
|
|
};
|
|
|
|
TT.SetImRankData(paramJson, (b, s) =>
|
|
|
|
{
|
|
|
|
if (b)
|
|
|
|
{
|
|
|
|
Debug.Log("SetImRankData");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Debug.Log("SetImRankData");
|
|
|
|
}
|
|
|
|
});
|
2024-11-08 18:21:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void CloseEvent()
|
|
|
|
{
|
2024-11-26 15:44:50 +08:00
|
|
|
MainPanel.ins.ClosePanelEvent();
|
2024-12-18 11:12:52 +08:00
|
|
|
SaveTTEvent();
|
2024-11-08 18:21:41 +08:00
|
|
|
}
|
|
|
|
}
|