蜗牛骑士

This commit is contained in:
GL 2024-11-28 07:16:11 +08:00
parent b52fca37d3
commit 891680a539
6 changed files with 316 additions and 46 deletions

View File

@ -2759,7 +2759,7 @@ MonoBehaviour:
- {fileID: 21300000, guid: a216c97a06e5b2c4a950c2302197bed8, type: 3} - {fileID: 21300000, guid: a216c97a06e5b2c4a950c2302197bed8, type: 3}
startingPoint: {fileID: 532751784} startingPoint: {fileID: 532751784}
end: {fileID: 98816691} end: {fileID: 98816691}
is_victory: 1 is_victory: 0
is_die: 0 is_die: 0
--- !u!61 &219934845 --- !u!61 &219934845
BoxCollider2D: BoxCollider2D:
@ -5161,6 +5161,55 @@ MonoBehaviour:
queryClosestKnight521: {fileID: 771005324} queryClosestKnight521: {fileID: 771005324}
queryKnightRoomList522: {fileID: 771005325} queryKnightRoomList522: {fileID: 771005325}
snailKnightBet523: {fileID: 771005327} snailKnightBet523: {fileID: 771005327}
queryKnightKill524: {fileID: 771005326}
queryPlayerInfo: {fileID: 771005328}
realPlayerInfo:
code: 0
message:
data:
userId: 0
userName: 0
token:
nickName:
headImg:
gender: 0
birthday:
voluteCoin: 0
beansCoin: 0
ichorCoin: 0
idCard:
bank:
realName:
isCert: 0
inviteCodeMy:
inviteCodeBind:
bindTime:
station: 0
cuteNo:
memberTime:
isMember: 0
unionId: 0
queryKnightBetResult525: {fileID: 771005329}
knightBetResult:
code: 0
message:
data:
id: 0
gameNo:
gameSession: 0
startTime:
betTime:
countTime:
settleTime:
status: 0
horseNoAll:
horseNoKill:
horseNoRemain:
beansCoinAll: 0
beansCoinKill: 0
beansCoinRemain: 0
beansCoinFee: 0
beansCoinDivide: 0
id: 0 id: 0
gameNo: gameNo:
GameSession: 0 GameSession: 0
@ -5185,7 +5234,10 @@ MonoBehaviour:
KillNos: KillNos:
WinNos: WinNos:
timeText: {fileID: 1109017570} timeText: {fileID: 1109017570}
isStart: 0 coinText: {fileID: 1927887918}
is_jisha: 0
is_jieshuan: 0
is_Reflash: 0
--- !u!1 &402443204 --- !u!1 &402443204
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -6947,7 +6999,7 @@ MonoBehaviour:
- {fileID: 21300000, guid: 88694b39d369de8449d049848c8440f0, type: 3} - {fileID: 21300000, guid: 88694b39d369de8449d049848c8440f0, type: 3}
startingPoint: {fileID: 1363431408} startingPoint: {fileID: 1363431408}
end: {fileID: 869027439} end: {fileID: 869027439}
is_victory: 1 is_victory: 0
is_die: 0 is_die: 0
--- !u!61 &540447345 --- !u!61 &540447345
BoxCollider2D: BoxCollider2D:
@ -7242,6 +7294,7 @@ GameObject:
- component: {fileID: 572945334} - component: {fileID: 572945334}
- component: {fileID: 572945333} - component: {fileID: 572945333}
- component: {fileID: 572945332} - component: {fileID: 572945332}
- component: {fileID: 572945335}
m_Layer: 5 m_Layer: 5
m_Name: btnClose m_Name: btnClose
m_TagString: Untagged m_TagString: Untagged
@ -7352,6 +7405,19 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 572945330} m_GameObject: {fileID: 572945330}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!114 &572945335
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 572945330}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 933a8e3d9e688a04f8054a2b11d68a21, type: 3}
m_Name:
m_EditorClassIdentifier:
Button: {fileID: 0}
--- !u!1 &601459103 --- !u!1 &601459103
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -9120,6 +9186,8 @@ GameObject:
- component: {fileID: 771005325} - component: {fileID: 771005325}
- component: {fileID: 771005327} - component: {fileID: 771005327}
- component: {fileID: 771005326} - component: {fileID: 771005326}
- component: {fileID: 771005328}
- component: {fileID: 771005329}
m_Layer: 5 m_Layer: 5
m_Name: INFO m_Name: INFO
m_TagString: Untagged m_TagString: Untagged
@ -9197,6 +9265,50 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
retbutton: {fileID: 0} retbutton: {fileID: 0}
ClosureObj: {fileID: 0} ClosureObj: {fileID: 0}
--- !u!114 &771005328
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 771005322}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 75a8a937e34eefd4db409d066f0ae0ad, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &771005329
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 771005322}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 295cf647a60c88f439ecebe50ce259f3, type: 3}
m_Name:
m_EditorClassIdentifier:
knightBetResult:
code: 0
message:
data:
id: 0
gameNo:
gameSession: 0
startTime:
betTime:
countTime:
settleTime:
status: 0
horseNoAll:
horseNoKill:
horseNoRemain:
beansCoinAll: 0
beansCoinKill: 0
beansCoinRemain: 0
beansCoinFee: 0
beansCoinDivide: 0
--- !u!1 &779183957 --- !u!1 &779183957
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -12249,7 +12361,7 @@ MonoBehaviour:
- {fileID: 21300000, guid: b23b969c1b8111a46bf8c790edb8bfbe, type: 3} - {fileID: 21300000, guid: b23b969c1b8111a46bf8c790edb8bfbe, type: 3}
startingPoint: {fileID: 238215576} startingPoint: {fileID: 238215576}
end: {fileID: 1291160958} end: {fileID: 1291160958}
is_victory: 1 is_victory: 0
is_die: 0 is_die: 0
--- !u!61 &1039706607 --- !u!61 &1039706607
BoxCollider2D: BoxCollider2D:
@ -13689,7 +13801,7 @@ MonoBehaviour:
- {fileID: 21300000, guid: 5916a485993b1654b878f2e8a4061602, type: 3} - {fileID: 21300000, guid: 5916a485993b1654b878f2e8a4061602, type: 3}
startingPoint: {fileID: 2137823193} startingPoint: {fileID: 2137823193}
end: {fileID: 302264171} end: {fileID: 302264171}
is_victory: 1 is_victory: 0
is_die: 0 is_die: 0
--- !u!61 &1112535303 --- !u!61 &1112535303
BoxCollider2D: BoxCollider2D:
@ -23441,7 +23553,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_Sprite: {fileID: 21300000, guid: 2cebf90f83f8ec646b51e16d0cbd4d86, type: 3} m_Sprite: {fileID: 21300000, guid: c2fbb34ffa198be44bfbddd54c7478a6, type: 3}
m_Type: 0 m_Type: 0
m_PreserveAspect: 0 m_PreserveAspect: 0
m_FillCenter: 1 m_FillCenter: 1
@ -23858,8 +23970,8 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: 999999 m_text: 999999
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_fontAsset: {fileID: 11400000, guid: 5214a01544a3d6744bbbe3653d4662f3, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} m_sharedMaterial: {fileID: -5950493476346735654, guid: 5214a01544a3d6744bbbe3653d4662f3, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
m_fontMaterials: [] m_fontMaterials: []

View File

@ -5,7 +5,7 @@ using System.Threading.Tasks;
using UnityEditor.PackageManager.UI; using UnityEditor.PackageManager.UI;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using TMPro;
public class AllManeger : MonoBehaviour public class AllManeger : MonoBehaviour
{ {
public static AllManeger instance; public static AllManeger instance;
@ -17,6 +17,14 @@ public class AllManeger : MonoBehaviour
public SnailKnightBet523 snailKnightBet523=new SnailKnightBet523(); public SnailKnightBet523 snailKnightBet523=new SnailKnightBet523();
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();
public int id;//游戏id public int id;//游戏id
public string gameNo;//游戏编号 public string gameNo;//游戏编号
@ -28,14 +36,22 @@ public class AllManeger : MonoBehaviour
public List<int> KillNos=new List<int>(); public List<int> KillNos=new List<int>();
public List<int> WinNos = new List<int>(); public List<int> WinNos = new List<int>();
//public List<int> allNos=new List<int>();//留下的马
public Text timeText; public Text timeText;
public bool isStart;
public TextMeshProUGUI coinText;//蜗牛蛋
public bool is_jisha;//是否击杀
public bool is_jieshuan;//是否结算
public bool is_Reflash;//是否获取最新游戏
// Start is called before the first frame update // Start is called before the first frame update
async void Start() async void Start()
{ {
instance = this; instance = this;
Fuck521(); Fuck521();
InvokeRepeating("Fuck522", 2, 2); InvokeRepeating("Fuck522", 2, 2);
GetSelfInfo();
} }
// Update is called once per frame // Update is called once per frame
@ -55,7 +71,11 @@ public class AllManeger : MonoBehaviour
GameSession = closestKnight521.Data.GameKnightModel.GameSession; GameSession = closestKnight521.Data.GameKnightModel.GameSession;
GetHorseInfo521(closestKnight521.Data.GameKnightRoomResponseVoList); GetHorseInfo521(closestKnight521.Data.GameKnightRoomResponseVoList);
GetKillInfo521(closestKnight521.Data.GameKnightModel); GetKillInfo521(closestKnight521.Data.GameKnightModel);
LoadPanel.instance.HidePanel(); LoadPanel.instance.HidePanel();
is_jieshuan = false;
is_jisha = false;
} }
public async void Fuck522() public async void Fuck522()
@ -83,23 +103,43 @@ public class AllManeger : MonoBehaviour
LoadPanel.instance.ShowPanel(); LoadPanel.instance.ShowPanel();
Allreturn(); Allreturn();
ClearAllHouseBet();//清空本地投注 ClearAllHouseBet();//清空本地投注
Fuck521();
isStart = false; Fuck521();//获取最新游戏
//LoadPanel.instance.HidePanel();
} }
else if(knightRoomBetList522.Data.CarrySeconds<45) else if(knightRoomBetList522.Data.CarrySeconds<45)//倒计时
{ {
timeText.text = (45 - knightRoomBetList522.Data.CarrySeconds).ToString(); timeText.text = (45 - knightRoomBetList522.Data.CarrySeconds).ToString();
await Task.Delay(1000); await Task.Delay(1000);
timeText.text = (45 - knightRoomBetList522.Data.CarrySeconds - 1).ToString(); timeText.text = (45 - knightRoomBetList522.Data.CarrySeconds - 1).ToString();
} }
else if (knightRoomBetList522.Data.CarrySeconds>45) else if (knightRoomBetList522.Data.CarrySeconds>45&& knightRoomBetList522.Data.CarrySeconds<50)//击杀开跑
{ {
if (!isStart) if (!is_jisha)
{ {
Fuck524();
AllMove(); AllMove();
isStart = true; is_jisha = true;
} }
}
else if (knightRoomBetList522.Data.CarrySeconds > 50)//结算
{
if (!is_jieshuan)
{
Fuck525();
is_jieshuan = true;
}
} }
} }
@ -109,6 +149,60 @@ public class AllManeger : MonoBehaviour
} }
public async void Fuck524()
{
knightKill524 = await queryKnightKill524.queryKnightKill(id);
//if (knightKill524.data.horseNoKill!="")
//{
// string[] parts = knightKill524.data.horseNoKill.Split(","); // 根据 ',' 分割字符串d
// KillNos = parts.Select(int.Parse).ToList();
// foreach (int killno in KillNos)
// {
// Debug.Log("击杀蜗牛"+killno);
// foreach (HorseInfo horse in horseInfos)
// {
// if (horse.HorseNo == killno)
// {
// Debug.Log("wwwww" + horse.HorseNo);
// horse.snail.is_die = true;
// }
// }
// }
//}
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;
}
}
}
}
}
public async void Fuck525()
{
knightBetResult = await queryKnightBetResult525.queryKnightBetResult(id);
GetSelfInfo();
}
public async void GetSelfInfo()
{
realPlayerInfo = await queryPlayerInfo.QueryPlayerInfoPro();//玩家信息
coinText.text=realPlayerInfo.data.beansCoin.ToString("F1");
}
public void GetHorseInfo521(List<GameKnightRoomResponseVo> GameKnightRoomResponseVoList)//获得马匹的信息 public void GetHorseInfo521(List<GameKnightRoomResponseVo> GameKnightRoomResponseVoList)//获得马匹的信息
{ {
foreach (GameKnightRoomResponseVo item in GameKnightRoomResponseVoList) foreach (GameKnightRoomResponseVo item in GameKnightRoomResponseVoList)
@ -134,40 +228,64 @@ public class AllManeger : MonoBehaviour
public void GetKillInfo521(GameKnightModel GameKnightModel)//获取击杀马匹与留存马匹 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) if (GameKnightModel.HorseNoAll!="")
{
string[] parts = GameKnightModel.HorseNoAll.Split(",");
List<int> allNos= parts.Select(int.Parse).ToList();
HashSet<int> allNosSet = new HashSet<int>(allNos);
// 遍历 horseInfos检查每个 HorseNo 是否存在于 allNos 中
foreach (HorseInfo horse in horseInfos)
{ {
foreach (HorseInfo horse in horseInfos) if (!allNosSet.Contains(horse.HorseNo))
{ {
if (horse.HorseNo == killno) horse.snail.is_die = true;
{ horse.snail.killsnail(); // 如果不存在于 allNos 中,设置 is_die 为 true
horse.snail.is_die = true; }
} else
{
horse.snail.is_die = false;
horse.snail.killsnail();// 如果存在于 allNos 中,设置 is_die 为 false
} }
} }
} }
//if (GameKnightModel.HorseNoKill!="")
//{
// string[] parts = GameKnightModel.HorseNoKill.Split(","); // 根据 ',' 分割字符串d
// KillNos = parts.Select(int.Parse).ToList();
if (GameKnightModel.HorseNoRemain!="") // foreach (int killno in KillNos)
{ // {
string[] parts_2 = GameKnightModel.HorseNoRemain.Split(","); // foreach (HorseInfo horse in horseInfos)
WinNos = parts_2.Select(int.Parse).ToList(); // {
// 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 (int winno in WinNos)
{ // {
foreach (HorseInfo horse in horseInfos) // foreach (HorseInfo horse in horseInfos)
{ // {
if (horse.HorseNo == winno) // if (horse.HorseNo == winno)
{ // {
horse.snail.is_victory = true; // horse.snail.is_victory = true;
} // }
} // }
} // }
} //}
} }
public void AllMove()//所有蜗牛开跑 public void AllMove()//所有蜗牛开跑
@ -184,7 +302,7 @@ public class AllManeger : MonoBehaviour
foreach (snailRider snail in snailRiders) foreach (snailRider snail in snailRiders)
{ {
snail.startMove(); snail.returnStart();
} }
} }
public void ClearAllHouseBet()//清空投注 public void ClearAllHouseBet()//清空投注

View File

@ -44,6 +44,7 @@ public class BetBtn : MonoBehaviour
horse.BetCoins += BetValue; horse.BetCoins += BetValue;
} }
} }
AllManeger.instance.GetSelfInfo();
AllManeger.instance.Fuck522(); AllManeger.instance.Fuck522();
} }

View File

@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class ReturnBtn : MonoBehaviour
{
public Button Button;
// Start is called before the first frame update
void Start()
{
Button=GetComponent<Button>();
Button.onClick.AddListener(OnClickBtn);
}
public void OnClickBtn()
{
SceneManager.LoadScene(1);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 933a8e3d9e688a04f8054a2b11d68a21
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -15,6 +15,7 @@ public class snailRider : MonoBehaviour
public bool is_victory = false;//这只蜗牛是否在本回合比赛胜利 public bool is_victory = false;//这只蜗牛是否在本回合比赛胜利
public bool is_die = false;//这个蜗牛死了没 public bool is_die = false;//这个蜗牛死了没
float offset = 0; float offset = 0;
public Sequence mySequence = DOTween.Sequence();
// Start is called before the first frame update // Start is called before the first frame update
async void Start() async void Start()
{ {
@ -37,9 +38,14 @@ public class snailRider : MonoBehaviour
{ {
LightSprite = null; LightSprite = null;
} }
public void startMove()
public void killsnail()
{ {
obj.SetActive(!is_die); obj.SetActive(!is_die);
}
public void startMove()
{
//palye.enabled = !is_die; //palye.enabled = !is_die;
if (!is_die) if (!is_die)
{ {
@ -52,7 +58,7 @@ public class snailRider : MonoBehaviour
{ {
suiji = UnityEngine.Random.Range(1f, 5f); suiji = UnityEngine.Random.Range(1f, 5f);
} }
Sequence mySequence = DOTween.Sequence();
mySequence.Append(transform.DOMove(startingPoint.transform.position, 0.01f)) mySequence.Append(transform.DOMove(startingPoint.transform.position, 0.01f))
.Append(transform.DOMove(end.transform.position, 10f + suiji)) .Append(transform.DOMove(end.transform.position, 10f + suiji))
; ;
@ -61,6 +67,7 @@ public class snailRider : MonoBehaviour
public void returnStart() public void returnStart()
{ {
mySequence.Kill(); // 停止并销毁动画
transform.position=startingPoint.transform.position; transform.position=startingPoint.transform.position;
} }
private void Update() private void Update()