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

388 lines
11 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-27 23:40:28 +08:00
using UnityEngine;
2024-11-28 03:35:20 +08:00
using UnityEngine.UI;
using DG.Tweening;
2024-11-28 07:16:11 +08:00
using TMPro;
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-28 07:16:11 +08:00
public queryKnightKill524 queryKnightKill524 = new queryKnightKill524();
public KnightKill knightKill524=new KnightKill();
public queryPlayerInfo queryPlayerInfo = new queryPlayerInfo();
public RealPlayerInfo realPlayerInfo = new RealPlayerInfo();
public queryKnightBetResult525 queryKnightBetResult525=new queryKnightBetResult525();
public KnightBetResult knightBetResult=new KnightBetResult();
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
2024-11-28 07:16:11 +08:00
//public List<int> allNos=new List<int>();//<2F><><EFBFBD>µ<EFBFBD><C2B5><EFBFBD>
public TextMeshProUGUI TextMPtime;
public Text wordText;//<2F><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>
2024-11-28 07:16:11 +08:00
public TextMeshProUGUI coinText;//<2F><>ţ<EFBFBD><C5A3>
public bool is_jisha;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>ɱ
public bool is_jieshuan;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
public bool is_Reflash;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ
public bool is_NOneedReflash;//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫˢ<D2AA><CBA2>
public int snailMoveNum;//<2F><>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-12-05 17:00:41 +08:00
public RacingPanel racingPanel;
public int WinNum;//<2F><><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD>ţ<EFBFBD><C5A3><EFBFBD><EFBFBD>
public int gameSession;//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
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-28 07:16:11 +08:00
GetSelfInfo();
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);
2024-11-28 07:16:11 +08:00
is_jieshuan = false;
2024-11-28 07:16:11 +08:00
is_jisha = false;
is_Reflash = true;
2024-11-28 03:35:20 +08:00
}
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<0|| knightRoomBetList522.Data.CarrySeconds>59)
2024-11-28 03:35:20 +08:00
{
NewLoadPanel.instance.ShowPanel();
is_Reflash = false;
2024-11-28 03:35:20 +08:00
Allreturn();
2024-11-28 04:40:30 +08:00
ClearAllHouseBet();//<2F><><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD>Ͷע
ToolsManager.instance.ShowTools();//ˢ<><CBA2>һ<EFBFBD>µ<EFBFBD><C2B5><EFBFBD>
ToolsManager.instance.RamgeTools();
Fuck521();//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϸ
2024-11-28 07:16:11 +08:00
2024-11-28 07:16:11 +08:00
//LoadPanel.instance.HidePanel();
2024-11-28 03:35:20 +08:00
}
2024-11-28 07:16:11 +08:00
else if(knightRoomBetList522.Data.CarrySeconds<45)//<2F><><EFBFBD><EFBFBD>ʱ
2024-11-28 03:35:20 +08:00
{
2024-12-05 15:48:55 +08:00
MoveBg.instance.ReturnPos();
if (is_Reflash)
{
NewLoadPanel.instance.HidePanel();//ˢ<><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC>ؽ<EFBFBD><D8BD><EFBFBD>
is_Reflash = false;
Allreturn();
}
wordText.text = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ";
TextMPtime.text = (45 - knightRoomBetList522.Data.CarrySeconds).ToString();
2024-11-28 03:35:20 +08:00
await Task.Delay(1000);
TextMPtime.text = (45 - knightRoomBetList522.Data.CarrySeconds - 1).ToString();
2024-11-28 03:35:20 +08:00
}
else if (knightRoomBetList522.Data.CarrySeconds>=45&& knightRoomBetList522.Data.CarrySeconds<50)//<2F><>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD>
2024-11-28 03:35:20 +08:00
{
2024-11-28 07:16:11 +08:00
if (!is_jisha)
2024-11-28 03:35:20 +08:00
{
TextMPtime.text = "GO!";
wordText.text = "";
2024-11-28 07:16:11 +08:00
Fuck524();
2024-11-28 07:16:11 +08:00
is_jisha = true;
2024-11-28 03:35:20 +08:00
}
2024-11-28 07:16:11 +08:00
}
else if (knightRoomBetList522.Data.CarrySeconds >=56)//<2F><><EFBFBD><EFBFBD>
2024-11-28 07:16:11 +08:00
{
if (!is_jieshuan)
{
TextMPtime.text = "";
wordText.text = "";
if (WinNos.Count>0)
{
RacingSuccessPanel.instance.ShowImage();
RacingSuccessPanel.instance.ShowPanel();
}
2024-12-05 15:48:55 +08:00
//RacingSuccessPanel.instance.textSnailEggs.text = knightBetResult.data[0].win.ToString("F1");
2024-11-28 07:16:11 +08:00
is_jieshuan = true;
Fuck525();
2024-12-04 14:42:07 +08:00
2024-11-28 07:16:11 +08:00
}
2024-11-28 03:35:20 +08:00
}
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
2024-12-05 17:00:41 +08:00
2024-11-28 07:16:11 +08:00
public async void Fuck524()
{
knightKill524 = await queryKnightKill524.queryKnightKill(id);
2024-12-05 17:00:41 +08:00
if (knightKill524.data.horseNoKill != "")
{
string[] parts = knightKill524.data.horseNoKill.Split(","); // <20><><EFBFBD><EFBFBD> ',' <20>ָ<EFBFBD><D6B8>ַ<EFBFBD><D6B7><EFBFBD>d
KillNos = parts.Select(int.Parse).ToList();
2024-11-28 07:16:11 +08:00
2024-12-05 17:00:41 +08:00
foreach (int killno in KillNos)
{
Debug.Log("<22><>ɱ<EFBFBD><C9B1>ţ" + killno);
foreach (HorseInfo horse in horseInfos)
{
if (horse.HorseNo == killno)
{
Debug.Log("wwwww" + horse.HorseNo);
horse.snail.is_die = true;
}
}
}
}
2024-11-28 07:16:11 +08:00
if (knightKill524.data.horseNoRemain!= "")
{
string[] parts_2 = knightKill524.data.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;
}
}
}
}
AllMove();
2024-11-28 07:16:11 +08:00
}
public async void Fuck525()
{
knightBetResult = await queryKnightBetResult525.queryKnightBetResult(id);
GetSelfInfo();
2024-12-04 17:12:02 +08:00
//if (knightBetResult.data[0].outcome==1)//ʤ<><CAA4>
//{
// Debug.Log("ʤ<><CAA4>");
//
//}
//else if (knightBetResult.data[0].outcome == 2)//ʧ<><CAA7>
//{
// Debug.Log("ʧ<><CAA7>");
// FailPanel.instance.ShowPanel();
//}
2024-12-04 14:42:07 +08:00
2024-11-28 07:16:11 +08:00
}
public async void GetSelfInfo()
{
realPlayerInfo = await queryPlayerInfo.QueryPlayerInfoPro();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
coinText.text=realPlayerInfo.data.beansCoin.ToString("F1");
}
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 07:16:11 +08:00
gameSession = GameKnightModel.GameSession;//<2F><>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD>
2024-11-28 07:16:11 +08:00
if (gameSession==1)
{
WinNum = 4;//8<><38>4
}
else if (gameSession == 2)
{
WinNum = 2;//4<><34>2
}
else if (gameSession == 3)
{
WinNum = 1;//2<><32>1
}
2024-11-28 07:16:11 +08:00
if (GameKnightModel.HorseNoAll!="")
2024-11-28 01:09:32 +08:00
{
string[] parts = GameKnightModel.HorseNoAll.Split(",");
2024-11-28 07:16:11 +08:00
List<int> allNos= parts.Select(int.Parse).ToList();
HashSet<int> allNosSet = new HashSet<int>(allNos);
2024-11-28 01:09:32 +08:00
2024-11-28 07:16:11 +08:00
// <20><><EFBFBD><EFBFBD> horseInfos<6F><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF> HorseNo <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> allNos <20><>
foreach (HorseInfo horse in horseInfos)
2024-11-28 01:09:32 +08:00
{
2024-11-28 07:16:11 +08:00
if (!allNosSet.Contains(horse.HorseNo))
2024-11-28 01:09:32 +08:00
{
2024-11-28 07:16:11 +08:00
horse.snail.is_die = true;
horse.snail.killsnail(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> allNos <20>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD> is_die Ϊ true
2024-12-05 17:00:41 +08:00
horse.gameObject.SetActive(false);//<2F><><EFBFBD>ð<EFBFBD>ť
2024-11-28 07:16:11 +08:00
}
else
{
horse.snail.is_die = false;
horse.snail.killsnail();// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> allNos <20>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD> is_die Ϊ false
2024-12-05 17:00:41 +08:00
horse.gameObject.SetActive(true);//<2F><><EFBFBD>ð<EFBFBD>ť
2024-11-28 01:09:32 +08:00
}
}
2024-11-28 07:16:11 +08:00
2024-11-28 01:09:32 +08:00
}
2024-12-05 17:00:41 +08:00
//if (GameKnightModel.HorseNoKill != "")//<2F><><EFBFBD>ð<EFBFBD>ť
2024-11-28 07:16:11 +08:00
//{
// string[] parts = GameKnightModel.HorseNoKill.Split(","); // <20><><EFBFBD><EFBFBD> ',' <20>ָ<EFBFBD><D6B8>ַ<EFBFBD><D6B7><EFBFBD>d
// KillNos = parts.Select(int.Parse).ToList();
2024-11-28 01:09:32 +08:00
2024-11-28 07:16:11 +08:00
// foreach (int killno in KillNos)
// {
2024-12-05 17:00:41 +08:00
// SetBtnHide(killno);
2024-11-28 07:16:11 +08:00
// }
//}
2024-11-28 01:09:32 +08:00
2024-12-05 17:00:41 +08:00
//if (GameKnightModel.HorseNoRemain != "")//<2F><><EFBFBD>Ű<EFBFBD>ť
2024-11-28 07:16:11 +08:00
//{
// string[] parts_2 = GameKnightModel.HorseNoRemain.Split(",");
// WinNos = parts_2.Select(int.Parse).ToList();
2024-11-28 01:09:32 +08:00
2024-11-28 07:16:11 +08:00
// foreach (int winno in WinNos)
// {
2024-12-05 17:00:41 +08:00
// SetBtnShow(winno);
2024-11-28 07:16:11 +08:00
// }
//}
2024-12-05 17:00:41 +08:00
2024-11-28 01:09:32 +08:00
}
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();
}
MoveBg.instance.StartMove();
2024-11-28 03:35:20 +08:00
}
public void Allreturn()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD><C5A3>ȥ
{
2024-11-28 03:35:20 +08:00
foreach (snailRider snail in snailRiders)
{
2024-11-28 07:16:11 +08:00
snail.returnStart();
2024-11-28 01:09:32 +08:00
}
}
public void ClearAllHouseBet()//<2F><><EFBFBD><EFBFBD>Ͷע//˳<><CBB3>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ״̬
2024-11-28 04:40:30 +08:00
{
2024-11-28 04:40:30 +08:00
foreach (HorseInfo horse in horseInfos)
{
horse.BetCoins=0;
horse.betText.text = horse.BetCoins.ToString();
horse.snail.is_victory = false;
2024-11-28 04:40:30 +08:00
}
}
public void StopAllSanil()//ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ţ
{
DOTween.KillAll(); // ֹͣ<CDA3><D6B9><EFBFBD>е<EFBFBD> DOTween <20><><EFBFBD><EFBFBD>
foreach (snailRider snail in snailRiders)
{
snail.animator.SetInteger("State", 0);
}
}
2024-11-27 23:40:28 +08:00
}