202 lines
5.7 KiB
C#
202 lines
5.7 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Threading.Tasks;
|
||
using UnityEditor.PackageManager.UI;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
|
||
public class AllManeger : MonoBehaviour
|
||
{
|
||
public static AllManeger instance;
|
||
public queryClosestKnight521 queryClosestKnight521=new queryClosestKnight521();
|
||
public ClosestKnight closestKnight521 = new ClosestKnight();
|
||
|
||
public queryKnightRoomList522 queryKnightRoomList522 = new queryKnightRoomList522();
|
||
public KnightRoomBetList knightRoomBetList522 = new KnightRoomBetList();
|
||
|
||
public SnailKnightBet523 snailKnightBet523=new SnailKnightBet523();
|
||
|
||
|
||
public int id;//ÓÎÏ·id
|
||
public string gameNo;//ÓÎÏ·±àºÅ
|
||
public int GameSession;//ÓÎÏ·³¡´Î
|
||
|
||
public List<HorseInfo> horseInfos = new List<HorseInfo>();
|
||
public List<snailRider> snailRiders = new List<snailRider>();
|
||
|
||
public List<int> KillNos=new List<int>();
|
||
public List<int> WinNos = new List<int>();
|
||
|
||
public Text timeText;
|
||
public bool isStart;
|
||
// Start is called before the first frame update
|
||
async void Start()
|
||
{
|
||
instance = this;
|
||
Fuck521();
|
||
InvokeRepeating("Fuck522", 2, 2);
|
||
}
|
||
|
||
// Update is called once per frame
|
||
void Update()
|
||
{
|
||
|
||
}
|
||
void OnDestroy()
|
||
{
|
||
CancelInvoke("Fuck522");
|
||
}
|
||
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();
|
||
}
|
||
|
||
public async void Fuck522()
|
||
{
|
||
knightRoomBetList522 = await queryKnightRoomList522.queryKnightRoomLis(id);
|
||
foreach (GameKnightRoomResponseVo item in knightRoomBetList522.Data.GameKnightRoomResponseVoList)
|
||
{
|
||
|
||
foreach (HorseInfo horse in horseInfos)
|
||
{
|
||
|
||
if (horse.HorseNo == item.HorseNo)
|
||
{
|
||
|
||
StartCoroutine(Tools.AnimateText(float.Parse(horse.numText.text), item.HorseBeansCoin, 0.5f, horse.numText));
|
||
//horse.numText.text = item.HorseBeansCoin.ToString();
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
if (knightRoomBetList522.Data.CarrySeconds==-1)
|
||
{
|
||
LoadPanel.instance.ShowPanel();
|
||
Allreturn();
|
||
ClearAllHouseBet();//Çå¿Õ±¾µØͶע
|
||
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;
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
public async void Fuck523()
|
||
{
|
||
await snailKnightBet523.SnailKnightBet(id, BetBtn.instance.BetValue, BetBtn.instance.BetHorseId);
|
||
|
||
}
|
||
|
||
public void GetHorseInfo521(List<GameKnightRoomResponseVo> GameKnightRoomResponseVoList)//»ñµÃÂíÆ¥µÄÐÅÏ¢
|
||
{
|
||
foreach (GameKnightRoomResponseVo item in GameKnightRoomResponseVoList)
|
||
{
|
||
|
||
foreach (HorseInfo horse in horseInfos)
|
||
{
|
||
|
||
if (horse.HorseNo==item.HorseNo)
|
||
{
|
||
|
||
horse.KnightId = item.KnightId;
|
||
horse.HorseUserNo = item.HorseUserNo;
|
||
horse.HorseBeansCoin = item.HorseBeansCoin;
|
||
horse.numText.text = item.HorseBeansCoin.ToString();
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
public void GetKillInfo521(GameKnightModel GameKnightModel)//»ñÈ¡»÷ɱÂíÆ¥ÓëÁô´æÂíÆ¥
|
||
{
|
||
|
||
if (GameKnightModel.HorseNoKill!="")
|
||
{
|
||
string[] parts = GameKnightModel.HorseNoKill.Split(","); // ¸ù¾Ý ',' ·Ö¸î×Ö·û´®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()//ËùÓÐÎÏÅ£¿ªÅÜ
|
||
{
|
||
|
||
foreach (snailRider snail in snailRiders)
|
||
{
|
||
|
||
snail.startMove();
|
||
}
|
||
}
|
||
public void Allreturn()//ËùÓÐÎÏÅ£»ØÈ¥
|
||
{
|
||
foreach (snailRider snail in snailRiders)
|
||
{
|
||
|
||
snail.startMove();
|
||
}
|
||
}
|
||
public void ClearAllHouseBet()//Çå¿ÕͶע
|
||
{
|
||
foreach (HorseInfo horse in horseInfos)
|
||
{
|
||
horse.BetCoins=0;
|
||
horse.betText.text = horse.BetCoins.ToString();
|
||
|
||
|
||
}
|
||
}
|
||
}
|
||
|