_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/RacingPanel/AllManeger.cs

202 lines
5.7 KiB
C#
Raw Normal View History

2024-11-27 23:40:28 +08:00
using System.Collections;
using System.Collections.Generic;
2024-11-28 01:09:32 +08:00
using System.Linq;
2024-11-28 03:35:20 +08:00
using System.Threading.Tasks;
2024-11-28 04:40:30 +08:00
using UnityEditor.PackageManager.UI;
2024-11-27 23:40:28 +08:00
using UnityEngine;
2024-11-28 03:35:20 +08:00
using UnityEngine.UI;
2024-11-27 23:40:28 +08:00
public class AllManeger : MonoBehaviour
{
2024-11-28 03:35:20 +08:00
public static AllManeger instance;
2024-11-27 23:40:28 +08:00
public queryClosestKnight521 queryClosestKnight521=new queryClosestKnight521();
public ClosestKnight closestKnight521 = new ClosestKnight();
2024-11-28 01:09:32 +08:00
public queryKnightRoomList522 queryKnightRoomList522 = new queryKnightRoomList522();
2024-11-28 03:35:20 +08:00
public KnightRoomBetList knightRoomBetList522 = new KnightRoomBetList();
public SnailKnightBet523 snailKnightBet523=new SnailKnightBet523();
2024-11-28 01:09:32 +08:00
2024-11-27 23:40:28 +08:00
public int id;//<2F><>Ϸid
public string gameNo;//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
public int GameSession;//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
2024-11-28 03:35:20 +08:00
2024-11-27 23:40:28 +08:00
public List<HorseInfo> horseInfos = new List<HorseInfo>();
2024-11-28 01:09:32 +08:00
public List<snailRider> snailRiders = new List<snailRider>();
2024-11-27 23:40:28 +08:00
2024-11-28 01:09:32 +08:00
public List<int> KillNos=new List<int>();
public List<int> WinNos = new List<int>();
2024-11-28 03:35:20 +08:00
public Text timeText;
public bool isStart;
2024-11-27 23:40:28 +08:00
// Start is called before the first frame update
async void Start()
{
2024-11-28 03:35:20 +08:00
instance = this;
Fuck521();
2024-11-28 01:09:32 +08:00
InvokeRepeating("Fuck522", 2, 2);
2024-11-27 23:40:28 +08:00
}
// Update is called once per frame
void Update()
{
}
2024-11-28 01:09:32 +08:00
void OnDestroy()
{
CancelInvoke("Fuck522");
}
2024-11-28 03:35:20 +08:00
public async void Fuck521()
{
closestKnight521 = await queryClosestKnight521.queryClosestKnight();
id = closestKnight521.Data.GameKnightModel.Id;
gameNo = closestKnight521.Data.GameKnightModel.GameNo;
GameSession = closestKnight521.Data.GameKnightModel.GameSession;
GetHorseInfo521(closestKnight521.Data.GameKnightRoomResponseVoList);
GetKillInfo521(closestKnight521.Data.GameKnightModel);
LoadPanel.instance.HidePanel();
}
2024-11-28 01:09:32 +08:00
2024-11-28 03:35:20 +08:00
public async void Fuck522()
2024-11-28 01:09:32 +08:00
{
2024-11-28 03:35:20 +08:00
knightRoomBetList522 = await queryKnightRoomList522.queryKnightRoomLis(id);
foreach (GameKnightRoomResponseVo item in knightRoomBetList522.Data.GameKnightRoomResponseVoList)
2024-11-28 01:09:32 +08:00
{
foreach (HorseInfo horse in horseInfos)
{
if (horse.HorseNo == item.HorseNo)
{
2024-11-28 04:40:30 +08:00
StartCoroutine(Tools.AnimateText(float.Parse(horse.numText.text), item.HorseBeansCoin, 0.5f, horse.numText));
//horse.numText.text = item.HorseBeansCoin.ToString();
2024-11-28 01:09:32 +08:00
}
}
}
2024-11-28 03:35:20 +08:00
if (knightRoomBetList522.Data.CarrySeconds==-1)
{
LoadPanel.instance.ShowPanel();
Allreturn();
2024-11-28 04:40:30 +08:00
ClearAllHouseBet();//<2F><><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD>Ͷע
2024-11-28 03:35:20 +08:00
Fuck521();
isStart = false;
}
else if(knightRoomBetList522.Data.CarrySeconds<45)
{
timeText.text = (45 - knightRoomBetList522.Data.CarrySeconds).ToString();
await Task.Delay(1000);
timeText.text = (45 - knightRoomBetList522.Data.CarrySeconds - 1).ToString();
}
else if (knightRoomBetList522.Data.CarrySeconds>45)
{
if (!isStart)
{
AllMove();
isStart = true;
}
}
2024-11-28 01:09:32 +08:00
}
2024-11-28 03:35:20 +08:00
public async void Fuck523()
{
2024-11-28 04:40:30 +08:00
await snailKnightBet523.SnailKnightBet(id, BetBtn.instance.BetValue, BetBtn.instance.BetHorseId);
2024-11-28 03:35:20 +08:00
}
2024-11-28 01:09:32 +08:00
public void GetHorseInfo521(List<GameKnightRoomResponseVo> GameKnightRoomResponseVoList)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD>Ϣ
2024-11-27 23:40:28 +08:00
{
foreach (GameKnightRoomResponseVo item in GameKnightRoomResponseVoList)
{
2024-11-28 01:09:32 +08:00
2024-11-27 23:40:28 +08:00
foreach (HorseInfo horse in horseInfos)
{
2024-11-28 01:09:32 +08:00
if (horse.HorseNo==item.HorseNo)
{
horse.KnightId = item.KnightId;
horse.HorseUserNo = item.HorseUserNo;
horse.HorseBeansCoin = item.HorseBeansCoin;
horse.numText.text = item.HorseBeansCoin.ToString();
}
2024-11-27 23:40:28 +08:00
}
}
}
2024-11-28 01:09:32 +08:00
public void GetKillInfo521(GameKnightModel GameKnightModel)//<2F><>ȡ<EFBFBD><C8A1>ɱ<EFBFBD><C9B1>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ
{
2024-11-28 03:35:20 +08:00
2024-11-28 01:09:32 +08:00
if (GameKnightModel.HorseNoKill!="")
{
string[] parts = GameKnightModel.HorseNoKill.Split(","); // <20><><EFBFBD><EFBFBD> ',' <20>ָ<EFBFBD><D6B8>ַ<EFBFBD><D6B7><EFBFBD>d
KillNos = parts.Select(int.Parse).ToList();
foreach (int killno in KillNos)
{
foreach (HorseInfo horse in horseInfos)
{
if (horse.HorseNo == killno)
{
horse.snail.is_die = true;
}
}
}
}
if (GameKnightModel.HorseNoRemain!="")
{
string[] parts_2 = GameKnightModel.HorseNoRemain.Split(",");
WinNos = parts_2.Select(int.Parse).ToList();
foreach (int winno in WinNos)
{
foreach (HorseInfo horse in horseInfos)
{
if (horse.HorseNo == winno)
{
horse.snail.is_victory = true;
}
}
}
}
}
public void AllMove()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD>
{
2024-11-28 03:35:20 +08:00
2024-11-28 01:09:32 +08:00
foreach (snailRider snail in snailRiders)
{
2024-11-28 03:35:20 +08:00
snail.startMove();
}
}
public void Allreturn()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3>ȥ
{
foreach (snailRider snail in snailRiders)
{
2024-11-28 01:09:32 +08:00
snail.startMove();
}
}
2024-11-28 04:40:30 +08:00
public void ClearAllHouseBet()//<2F><><EFBFBD><EFBFBD>Ͷע
{
foreach (HorseInfo horse in horseInfos)
{
horse.BetCoins=0;
horse.betText.text = horse.BetCoins.ToString();
2024-11-28 01:09:32 +08:00
2024-11-28 04:40:30 +08:00
}
}
2024-11-27 23:40:28 +08:00
}