蜗牛骑士用户下注

This commit is contained in:
GL 2024-11-28 04:40:30 +08:00
parent cf3e3b01b6
commit b52fca37d3
5 changed files with 86 additions and 15 deletions

View File

@ -1414,6 +1414,7 @@ MonoBehaviour:
numText: {fileID: 1106311626}
snail: {fileID: 1112535302}
betText: {fileID: 686858939}
BetCoins: 0
--- !u!1 &67925951
GameObject:
m_ObjectHideFlags: 0
@ -1644,6 +1645,7 @@ MonoBehaviour:
numText: {fileID: 46327288}
snail: {fileID: 219934844}
betText: {fileID: 1756588178}
BetCoins: 0
--- !u!1 &91150040
GameObject:
m_ObjectHideFlags: 0
@ -5158,7 +5160,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
queryClosestKnight521: {fileID: 771005324}
queryKnightRoomList522: {fileID: 771005325}
snailKnightBet523: {fileID: 0}
snailKnightBet523: {fileID: 771005327}
id: 0
gameNo:
GameSession: 0
@ -9193,6 +9195,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 6e896077188de3f47b0e618eb84a8fd9, type: 3}
m_Name:
m_EditorClassIdentifier:
retbutton: {fileID: 0}
ClosureObj: {fileID: 0}
--- !u!1 &779183957
GameObject:
m_ObjectHideFlags: 0
@ -12503,6 +12507,7 @@ MonoBehaviour:
numText: {fileID: 1702042055}
snail: {fileID: 540447344}
betText: {fileID: 1594174904}
BetCoins: 0
--- !u!1 &1050191267
GameObject:
m_ObjectHideFlags: 0
@ -14970,6 +14975,7 @@ MonoBehaviour:
numText: {fileID: 1413792591}
snail: {fileID: 1591901237}
betText: {fileID: 10458501}
BetCoins: 0
--- !u!1 &1215198963
GameObject:
m_ObjectHideFlags: 0
@ -18644,7 +18650,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4936081174741538048, guid: ca890c8fc56ec5447bffb4df7172807c, type: 3}
propertyPath: m_IsActive
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4936081174741538049, guid: ca890c8fc56ec5447bffb4df7172807c, type: 3}
propertyPath: m_Pivot.x
@ -18730,6 +18736,26 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4936081176505558907, guid: ca890c8fc56ec5447bffb4df7172807c, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4936081176505558907, guid: ca890c8fc56ec5447bffb4df7172807c, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4936081176505558907, guid: ca890c8fc56ec5447bffb4df7172807c, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 11500000, guid: f9a6dd727fa0d0341a230e5f9ad4f394, type: 3}
- target: {fileID: 4936081176505558907, guid: ca890c8fc56ec5447bffb4df7172807c, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value:
objectReference: {fileID: 0}
- target: {fileID: 4936081176505558907, guid: ca890c8fc56ec5447bffb4df7172807c, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
value: UnityEngine.Object, UnityEngine
objectReference: {fileID: 0}
m_RemovedComponents:
- {fileID: 4936081174741538060, guid: ca890c8fc56ec5447bffb4df7172807c, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: ca890c8fc56ec5447bffb4df7172807c, type: 3}
@ -18757,6 +18783,7 @@ MonoBehaviour:
BetValue: 0
AllBetValue: 0
BetButton: {fileID: 1764245271}
snailKnightBet523: {fileID: 771005327}
--- !u!1 &1531847264
GameObject:
m_ObjectHideFlags: 0
@ -19736,6 +19763,7 @@ MonoBehaviour:
numText: {fileID: 1235189134}
snail: {fileID: 884765245}
betText: {fileID: 934375347}
BetCoins: 0
--- !u!1 &1561496398
GameObject:
m_ObjectHideFlags: 0
@ -20795,6 +20823,7 @@ MonoBehaviour:
numText: {fileID: 1186497993}
snail: {fileID: 1039706606}
betText: {fileID: 1195815655}
BetCoins: 0
--- !u!1 &1656185141
GameObject:
m_ObjectHideFlags: 0
@ -23110,6 +23139,7 @@ MonoBehaviour:
numText: {fileID: 1931260878}
snail: {fileID: 890850301}
betText: {fileID: 939421158}
BetCoins: 0
--- !u!1 &1843981063
GameObject:
m_ObjectHideFlags: 0
@ -24351,6 +24381,7 @@ MonoBehaviour:
numText: {fileID: 1553476819}
snail: {fileID: 435022346}
betText: {fileID: 1561496402}
BetCoins: 0
--- !u!1001 &1946384137
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -2,6 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using UnityEditor.PackageManager.UI;
using UnityEngine;
using UnityEngine.UI;
@ -69,8 +70,8 @@ public class AllManeger : MonoBehaviour
if (horse.HorseNo == item.HorseNo)
{
horse.numText.text = item.HorseBeansCoin.ToString();
StartCoroutine(Tools.AnimateText(float.Parse(horse.numText.text), item.HorseBeansCoin, 0.5f, horse.numText));
//horse.numText.text = item.HorseBeansCoin.ToString();
}
}
@ -81,7 +82,7 @@ public class AllManeger : MonoBehaviour
{
LoadPanel.instance.ShowPanel();
Allreturn();
ClearAllHouseBet();//Çå¿Õ±¾µØͶע
Fuck521();
isStart = false;
}
@ -104,7 +105,8 @@ public class AllManeger : MonoBehaviour
public async void Fuck523()
{
await snailKnightBet523.SnailKnightBet(id, BetBtn.instance.BetValue, BetBtn.instance.BetHorseId);
await snailKnightBet523.SnailKnightBet(id, BetBtn.instance.BetValue, BetBtn.instance.BetHorseId);
}
public void GetHorseInfo521(List<GameKnightRoomResponseVo> GameKnightRoomResponseVoList)//»ñµÃÂíÆ¥µÄÐÅÏ¢
@ -185,6 +187,15 @@ public class AllManeger : MonoBehaviour
snail.startMove();
}
}
public void ClearAllHouseBet()//Çå¿ÕͶע
{
foreach (HorseInfo horse in horseInfos)
{
horse.BetCoins=0;
horse.betText.text = horse.BetCoins.ToString();
}
}
}

View File

@ -14,12 +14,14 @@ public class BetBtn : MonoBehaviour
public float AllBetValue;//投注总值
public Button BetButton;//投注的按钮
public SnailKnightBet523 snailKnightBet523 = new SnailKnightBet523();
// Start is called before the first frame update
void Start()
{
instance = this;
BetList.SetActive(false);
NumBtn.onClick.AddListener(OnClickNumBtn);
BetButton.onClick.AddListener(BetOnClick);
BetValue = 50;//默认50
SetBet();
}
@ -29,13 +31,22 @@ public class BetBtn : MonoBehaviour
{
}
void BetOnClick()//点击投注
async void BetOnClick()//µã»÷Ͷע
{
AllManeger.instance.Fuck523();
foreach (HorseInfo house in AllManeger.instance.horseInfos)
bool flag= await snailKnightBet523.SnailKnightBet(AllManeger.instance.id, BetValue, BetHorseId);
if (flag)
{
foreach (HorseInfo horse in AllManeger.instance.horseInfos)
{
if (BetHorseId == horse.HorseNo)
{
StartCoroutine(Tools.AnimateText(horse.BetCoins, horse.BetCoins + BetValue, 0.5f, horse.betText));
horse.BetCoins += BetValue;
}
}
AllManeger.instance.Fuck522();
}
}
void OnClickNumBtn()

View File

@ -13,6 +13,11 @@ public class HorseInfo : MonoBehaviour
public Text numText;
public snailRider snail;
public Text betText;
public float BetCoins=0;//我投注的数
private void Start()
{
betText.text = BetCoins.ToString();
}
}

View File

@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
//5.2.3下注
public class SnailKnightBet523 : MonoBehaviour
public class SnailKnightBet523 : Base
{
//返回的(解析后)====================
//public KnightRoomBetList knightRoomBetList;
@ -15,7 +15,7 @@ public class SnailKnightBet523 : MonoBehaviour
// await SnailKnightBet(39592, 1, 3); // =============================== 示例,仅供测试
//}
public async Task<KnightRoomBetList> SnailKnightBet(int KnightId,float bet,int horseNo)
public async Task<bool> SnailKnightBet(int KnightId,float bet,int horseNo)
{
// 准备请求的头部信息,包含授权令牌
Dictionary<string, string> head523 = new Dictionary<string, string>
@ -37,19 +37,32 @@ public class SnailKnightBet523 : MonoBehaviour
// 调试输出接收到的响应
Debug.Log("入参"+ JsonConvert.SerializeObject(knightBetBody) + "5.2.3下注: " + response523);
KnightBetResponse knightResponse = new KnightBetResponse();
// 将响应反序列化为对象
try
{
// knightRoomBetList = JsonConvert.DeserializeObject<KnightRoomBetList>(response522);
knightResponse = JsonConvert.DeserializeObject<KnightBetResponse>(response523);
}
catch (Exception ex)
{
Debug.LogError("反序列化响应失败: " + ex.Message);
}
bool isSucceed;
if (knightResponse.code == 200)
{
isSucceed = true;
addEventPopUp(knightResponse.message);
}
else
{
isSucceed = false;
addEventPopUp(knightResponse.message);
}
// 返回解析后的 KnightRoomBetList 对象
return null;
return isSucceed;
}
}