160 lines
4.9 KiB
C#
160 lines
4.9 KiB
C#
![]() |
using Newtonsoft.Json;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using TMPro;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System;
|
|||
|
public class DataVersionPanel : MonoBehaviour
|
|||
|
{
|
|||
|
public Date116 date116;
|
|||
|
[Header("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><D3BB><EFBFBD><EFBFBD><EFBFBD>")]
|
|||
|
public Image image;
|
|||
|
|
|||
|
public Text Usercount;
|
|||
|
public Sprite Up;
|
|||
|
public Sprite Down;
|
|||
|
|
|||
|
public TextMeshProUGUI count;
|
|||
|
|
|||
|
[Header("<22><><EFBFBD><EFBFBD>")] public WMG_Axis_Graph WmgAxisGraph;
|
|||
|
|
|||
|
public WMG_Series WmgSeries;
|
|||
|
// Start is called before the first frame update
|
|||
|
async void Start()
|
|||
|
{
|
|||
|
date116 = await OnClick116BpanelAsync();
|
|||
|
Debug.Log(date116.userRegisterDailyResponseVoList.Count);
|
|||
|
Init();
|
|||
|
SETGraph();
|
|||
|
}
|
|||
|
|
|||
|
public void Init()
|
|||
|
{
|
|||
|
count.text = "" + (int)date116.userVoluteCoinCount;
|
|||
|
if (date116.userRegisterDailyResponseVoList[date116.userRegisterDailyResponseVoList.Count-1].registerUser >=date116.userRegisterDailyResponseVoList[date116.userRegisterDailyResponseVoList.Count - 2].registerUser)
|
|||
|
{
|
|||
|
image.sprite= Up;
|
|||
|
Usercount.text = $"<color=red>{(int)date116.userRegisterDailyResponseVoList[date116.userRegisterDailyResponseVoList.Count-1].registerUser- (int)date116.userRegisterDailyResponseVoList[date116.userRegisterDailyResponseVoList.Count - 2].registerUser}</color>";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
image.sprite = Down;
|
|||
|
Usercount.text = $"<color=green>{(int)date116.userRegisterDailyResponseVoList[date116.userRegisterDailyResponseVoList.Count-2].registerUser - (int)date116.userRegisterDailyResponseVoList[date116.userRegisterDailyResponseVoList.Count-1].registerUser}</color>";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
long FindMinValue()
|
|||
|
{
|
|||
|
long minValue = date116.userRegisterDailyResponseVoList[0].registerUser;
|
|||
|
foreach (var num in date116.userRegisterDailyResponseVoList)
|
|||
|
{
|
|||
|
if (num.registerUser < minValue)
|
|||
|
{
|
|||
|
minValue = num.registerUser;
|
|||
|
}
|
|||
|
}
|
|||
|
return minValue;
|
|||
|
}
|
|||
|
|
|||
|
long FindMaxValue()
|
|||
|
{
|
|||
|
long maxValue = date116.userRegisterDailyResponseVoList[0].registerUser;
|
|||
|
foreach (var num in date116.userRegisterDailyResponseVoList)
|
|||
|
{
|
|||
|
if (num.registerUser > maxValue)
|
|||
|
{
|
|||
|
maxValue = num.registerUser;
|
|||
|
}
|
|||
|
}
|
|||
|
return maxValue;
|
|||
|
}
|
|||
|
|
|||
|
public void SETGraph()
|
|||
|
{
|
|||
|
|
|||
|
WmgAxisGraph.xAxis.AxisNumTicks = date116.userRegisterDailyResponseVoList.Count;//x<><78>\
|
|||
|
Debug.Log(WmgAxisGraph.xAxis.AxisNumTicks);
|
|||
|
WmgAxisGraph.xAxis.axisLabels.Clear();
|
|||
|
foreach (var datelist in date116.userRegisterDailyResponseVoList)
|
|||
|
{
|
|||
|
DateTime date = DateTime.Parse(datelist.registerDate);
|
|||
|
int month = date.Month;
|
|||
|
int day = date.Day;
|
|||
|
WmgAxisGraph.xAxis.axisLabels.Add($"{month}-{day}");
|
|||
|
}
|
|||
|
WmgAxisGraph.yAxis.AxisNumTicks = date116.userRegisterDailyResponseVoList.Count;//y
|
|||
|
Debug.Log(WmgAxisGraph.yAxis.AxisNumTicks);
|
|||
|
long minValue = FindMinValue();
|
|||
|
long maxValue = FindMaxValue();
|
|||
|
Debug.Log(minValue);
|
|||
|
Debug.Log(maxValue);
|
|||
|
WmgAxisGraph.yAxis.axisLabels.Clear();
|
|||
|
WmgAxisGraph.yAxis.axisLabels.Add($"{minValue}");
|
|||
|
WmgAxisGraph.yAxis.axisLabels.Add($"{minValue+(maxValue-minValue)*0.5}");
|
|||
|
WmgAxisGraph.yAxis.axisLabels.Add($"{maxValue}");
|
|||
|
//point
|
|||
|
for (int i = 0; i < date116.userRegisterDailyResponseVoList.Count; i++)
|
|||
|
{
|
|||
|
WmgSeries.pointValues.Add(new Vector2(0, date116.userRegisterDailyResponseVoList[i].registerUser));
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
// Update is called once per frame
|
|||
|
void Update()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
public async Task<Date116> OnClick116BpanelAsync()
|
|||
|
{
|
|||
|
// <><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
|||
|
Dictionary<string, string> head116 = new Dictionary<string, string>
|
|||
|
{
|
|||
|
{ "Authorization", Global.global.serverResponse.data.token }
|
|||
|
};
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// <20>첽<EFBFBD><ECB2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
string response118 = await web.SendRequest(web.URL + "/snail/data/queryDaily", "GET", "{}", head116);
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>Ӧ
|
|||
|
Debug.Log("1.16<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD> =====================" + response118);
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>Ϊ KnightRoomList <20><><EFBFBD><EFBFBD>
|
|||
|
Response116 directlist = JsonConvert.DeserializeObject<Response116>(response118);
|
|||
|
|
|||
|
// <20><><EFBFBD>鷴<EFBFBD><E9B7B4><EFBFBD>л<EFBFBD><D0BB>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD>
|
|||
|
if (directlist != null && directlist.data != null)
|
|||
|
{
|
|||
|
|
|||
|
Debug.Log("<22><>ȡ<EFBFBD>ɹ<EFBFBD>");
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Debug.LogError("directlist <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>");
|
|||
|
}
|
|||
|
|
|||
|
return directlist.data;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public class Response116 : Response
|
|||
|
{
|
|||
|
public Date116 data;
|
|||
|
}
|
|||
|
public class Date116
|
|||
|
{
|
|||
|
public List<datelist116> userRegisterDailyResponseVoList;
|
|||
|
public long userVoluteCoinCount;
|
|||
|
}
|
|||
|
|
|||
|
public class datelist116
|
|||
|
{
|
|||
|
public string registerDate;
|
|||
|
public long registerUser;
|
|||
|
}
|