2025-01-04 19:24:55 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Net.Mime;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
public class Islandpanel : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public Text gold;
|
|
|
|
|
public Text introtext;
|
|
|
|
|
public Text islandname;
|
|
|
|
|
public Text InvesttotalText;
|
|
|
|
|
public Button UpButton;
|
|
|
|
|
public Button DownButton;
|
|
|
|
|
public Button TouruButton;
|
|
|
|
|
public Text tourutext;
|
|
|
|
|
private int count=0;
|
|
|
|
|
public Text TimeText;
|
|
|
|
|
private float lastCallTime = 0f;
|
|
|
|
|
private float interval = 1f; // ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
|
|
|
|
public Image Dao;
|
|
|
|
|
float remainingTime = 0f;
|
|
|
|
|
public CertificatePanel Certificate;
|
|
|
|
|
public Sprite[] dao;
|
2025-01-06 16:53:51 +08:00
|
|
|
|
public Button zhengshu;
|
|
|
|
|
|
|
|
|
|
private async void OnEnable()
|
2025-01-04 19:24:55 +08:00
|
|
|
|
{
|
|
|
|
|
AuctionResponse response = await Scene_main_jiekou.instance.Auctioninformations();
|
|
|
|
|
//IslandResponse jinpairesponse = await Scene_main_jiekou.instance.Island(count);
|
2025-01-06 16:53:51 +08:00
|
|
|
|
gold.text = response.Data.gold.ToString();
|
2025-01-04 19:24:55 +08:00
|
|
|
|
introtext.text = response.Data.intro_text;
|
|
|
|
|
InvesttotalText.text = response.Data.invest_total.ToString();
|
|
|
|
|
remainingTime = response.Data.countdown;
|
2025-01-06 16:53:51 +08:00
|
|
|
|
if (response.Data.island_id == 0)
|
2025-01-06 09:15:44 +08:00
|
|
|
|
{
|
|
|
|
|
Dao.gameObject.SetActive(false);
|
|
|
|
|
islandname.gameObject.SetActive(false);
|
|
|
|
|
}
|
2025-01-06 16:53:51 +08:00
|
|
|
|
zhengshu.onClick.AddListener(async () =>
|
|
|
|
|
{
|
|
|
|
|
Certificate.response = await Scene_main_jiekou.instance.AuctionCertificate();
|
|
|
|
|
});
|
2025-01-04 19:24:55 +08:00
|
|
|
|
islandname.text = response.Data.island_name;
|
|
|
|
|
UpdateCountdownText(remainingTime);
|
|
|
|
|
Dao.sprite = dao[response.Data.island_id];
|
2025-01-06 16:53:51 +08:00
|
|
|
|
Certificate.response = await Scene_main_jiekou.instance.AuctionCertificate();
|
|
|
|
|
}
|
|
|
|
|
async void Start()
|
|
|
|
|
{
|
|
|
|
|
|
2025-01-04 19:24:55 +08:00
|
|
|
|
UpButton.onClick.AddListener(() =>
|
|
|
|
|
{
|
|
|
|
|
count += 1;
|
|
|
|
|
tourutext.text= count.ToString();
|
|
|
|
|
});
|
|
|
|
|
DownButton.onClick.AddListener(() =>
|
|
|
|
|
{
|
|
|
|
|
if(count<=0) return;
|
|
|
|
|
count -= 1;
|
|
|
|
|
tourutext.text = count.ToString();
|
|
|
|
|
});
|
|
|
|
|
TouruButton.onClick.AddListener(() =>
|
|
|
|
|
{
|
|
|
|
|
Toutu(count);
|
|
|
|
|
});
|
|
|
|
|
if (remainingTime == 0)
|
|
|
|
|
{
|
2025-01-06 16:53:51 +08:00
|
|
|
|
|
2025-01-04 19:24:55 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async void Toutu(int count1)
|
|
|
|
|
{
|
|
|
|
|
IslandResponse jinpairesponse = await Scene_main_jiekou.instance.Island(count1);
|
|
|
|
|
if (jinpairesponse.code == 200)
|
|
|
|
|
{
|
|
|
|
|
gold.text = jinpairesponse.Data.balance.ToString();
|
|
|
|
|
InvesttotalText.text = jinpairesponse.Data.invest_total.ToString();
|
|
|
|
|
count = 0;
|
|
|
|
|
tourutext.text = count.ToString();
|
|
|
|
|
Promptmgr.Instance.PromptBubble(jinpairesponse.message);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Promptmgr.Instance.PromptBubble(jinpairesponse.message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void UpdateCountdownText(float remainingTime)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// <20><>ʣ<EFBFBD><CAA3>ʱ<EFBFBD><CAB1>ת<EFBFBD><D7AA>ΪСʱ<D0A1><CAB1><EFBFBD><EFBFBD><EFBFBD>Ӻ<EFBFBD><D3BA><EFBFBD>
|
|
|
|
|
int hours = Mathf.FloorToInt(remainingTime / 3600);
|
|
|
|
|
int minutes = Mathf.FloorToInt((remainingTime % 3600) / 60);
|
|
|
|
|
int seconds = Mathf.FloorToInt(remainingTime % 60);
|
|
|
|
|
|
|
|
|
|
// ʹ<>ø<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>00:00:00<30><30>
|
|
|
|
|
TimeText.text = string.Format("{0:D2}:{1:D2}:{2:D2}", hours, minutes, seconds);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
{
|
|
|
|
|
if (Time.time - lastCallTime >= interval)
|
|
|
|
|
{
|
|
|
|
|
// ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>εĴ<CEB5><C4B4><EFBFBD>
|
|
|
|
|
if (remainingTime > 0)
|
|
|
|
|
{
|
|
|
|
|
remainingTime -= 1;
|
|
|
|
|
UpdateCountdownText(remainingTime);
|
|
|
|
|
Debug.Log("<22><><EFBFBD>뵹<EFBFBD><EBB5B9>ʱ");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ϴε<CFB4><CEB5><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
lastCallTime = Time.time;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|