_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/RacingPanel/AllManeger.cs
2024-11-28 01:09:32 +08:00

140 lines
4.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class AllManeger : MonoBehaviour
{
public queryClosestKnight521 queryClosestKnight521=new queryClosestKnight521();
public ClosestKnight closestKnight521 = new ClosestKnight();
public queryKnightRoomList522 queryKnightRoomList522 = new queryKnightRoomList522();
public KnightRoomBetList knightRoomBetList = new KnightRoomBetList();
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>();
// Start is called before the first frame update
async void Start()
{
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);
AllMove();
InvokeRepeating("Fuck522", 2, 2);
}
// Update is called once per frame
void Update()
{
}
void OnDestroy()
{
CancelInvoke("Fuck522");
}
public void Fuck522(List<GameKnightRoomResponseVo> GameKnightRoomResponseVoList)
{
foreach (GameKnightRoomResponseVo item in GameKnightRoomResponseVoList)
{
foreach (HorseInfo horse in horseInfos)
{
if (horse.HorseNo == item.HorseNo)
{
horse.numText.text = item.HorseBeansCoin.ToString();
}
}
}
}
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)//»ñÈ¡»÷ɱÂíÆ¥ÓëÁô´æÂíÆ¥
{
Debug.Log("»ñÈ¡»÷ɱÂíÆ¥ÓëÁô´æÂíÆ¥");
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()//ËùÓÐÎÏÅ£¿ªÅÜ
{
Debug.Log("×¼±¸");
foreach (snailRider snail in snailRiders)
{
Debug.Log("¿ªÅÚ");
snail.startMove();
}
}
}