摇奖5.3.1

This commit is contained in:
GL 2024-12-13 15:35:22 +08:00
parent 6e7020034b
commit a596e57efa
8 changed files with 1745 additions and 334 deletions

View File

@ -329,21 +329,29 @@ PrefabInstance:
propertyPath: AniPanel
value:
objectReference: {fileID: 2795579587960038890, guid: 99dd48b22ae2ab94e91528567537b3b8, type: 3}
- target: {fileID: 1836779079, guid: 125f28881155bef4680416fe0205cd50, type: 3}
propertyPath: MotherFuck531
value:
objectReference: {fileID: 2038721573}
- target: {fileID: 1836779079, guid: 125f28881155bef4680416fe0205cd50, type: 3}
propertyPath: MotherFuck532
value:
objectReference: {fileID: 2038721572}
- target: {fileID: 2677648104422926017, guid: 125f28881155bef4680416fe0205cd50, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2677648104422926017, guid: 125f28881155bef4680416fe0205cd50, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2677648104422926017, guid: 125f28881155bef4680416fe0205cd50, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 686
objectReference: {fileID: 0}
- target: {fileID: 2677648104422926017, guid: 125f28881155bef4680416fe0205cd50, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -600.844
objectReference: {fileID: 0}
- target: {fileID: 2677648104760152842, guid: 125f28881155bef4680416fe0205cd50, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
@ -503,19 +511,19 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2677648105923815896, guid: 125f28881155bef4680416fe0205cd50, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2677648105923815896, guid: 125f28881155bef4680416fe0205cd50, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2677648105923815896, guid: 125f28881155bef4680416fe0205cd50, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 686
objectReference: {fileID: 0}
- target: {fileID: 2677648105923815896, guid: 125f28881155bef4680416fe0205cd50, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -1442.5319
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 125f28881155bef4680416fe0205cd50, type: 3}
@ -613,12 +621,41 @@ MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 1836779079, guid: 125f28881155bef4680416fe0205cd50, type: 3}
m_PrefabInstance: {fileID: 748411801}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_GameObject: {fileID: 2038721569}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0ff7a0818be562645a2628accc267e42, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &2038721569 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2677648105853380896, guid: 125f28881155bef4680416fe0205cd50, type: 3}
m_PrefabInstance: {fileID: 748411801}
m_PrefabAsset: {fileID: 0}
--- !u!114 &2038721572
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2038721569}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fd1d731e1864a324ab2b237426843346, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &2038721573
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2038721569}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0e685e61edfafcc4b855c4325090a115, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &2110205790
GameObject:
m_ObjectHideFlags: 0

View File

@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class Anilottery : MonoBehaviour
{
@ -11,13 +12,28 @@ public class Anilottery : MonoBehaviour
public Animator PurpleAni;
public GameObject RewardPanel;
public Transform JumpStartPos;
public List<rewardSolt> rewardSolts = new List<rewardSolt>();//格子
public List<Sprite> sprites;//奖励图片精灵
public MotherFuck531 MotherFuck531;
public Lottery531 lottery531;
// Start is called before the first frame update
void Start()
{
RewardPanel.transform.DOScale(Vector3.zero, 0);
RewardPanel.SetActive(false);
}
public void ShowReward()
{
RewardPanel.transform.DOJump(JumpStartPos.position, 100 , 1,1.5f).SetEase(Ease.OutQuad) // 跳跃
.OnStart(() => RewardPanel.transform.DOScale(Vector3.one,1.5f).SetEase(Ease.OutBack)); // 放大到最终大小
RewardPanel.SetActive(true);
}
public void OpenBox(int id )//0Êǻƣ¬1ÊÇ×Ï
@ -26,15 +42,22 @@ public class Anilottery : MonoBehaviour
{
PurpleBox.SetActive(false);
YelloBox.SetActive(true);
GetRewardInfo531(1);
}
else
{
YelloBox.SetActive(false);
PurpleBox.SetActive(true);
GetRewardInfo531(2);
}
}
public async void GetRewardInfo531(int id)
{
lottery531 = await MotherFuck531.Result(id);
SetSoltInfo(lottery531.data);
}
public void OpenB(int id)//0Êǻƣ¬1ÊÇ×Ï
{
@ -57,4 +80,39 @@ public class Anilottery : MonoBehaviour
YelloAni.SetBool("IsOpen", false);
PurpleAni.SetBool("IsOpen", false);
}
public void SetSoltInfo(List<Lottery531Data> data)
{
int index = 0;
foreach (Lottery531Data item in data)
{
rewardSolts[index].Type = item.Type;
if (item.BeansCoin!=0)
{
rewardSolts[index].NumText.text = item.BeansCoin.ToString("F1");
}
index++;
}
SetImage();
}
public void SetImage()//奖品图片设置
{
foreach (rewardSolt item in rewardSolts)
{
if (item.Type==0)
{
item.RewardImage.sprite = sprites[0];
}
else if (item.Type == 1)
{
item.RewardImage.sprite = sprites[1];
}
else if (item.Type == 2)
{
item.RewardImage.sprite = sprites[2];
}
}
}
}

View File

@ -5,12 +5,28 @@ using UnityEngine;
public class LotteryPanel : Base
{
public GameObject AniPanel;
public MotherFuck532 MotherFuck532;
public Lottery532 lottery532;
private void Start()
{
GetRewardInfo532();
}
public void ShowAni(int id)
{
GameObject ani= Instantiate(AniPanel, transform);
ani.GetComponent<Anilottery>().OpenBox(id);
}
public async void GetRewardInfo532()
{
lottery532 = await MotherFuck532.Result();
}
}

View File

@ -0,0 +1,17 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class rewardSolt : MonoBehaviour
{
public int Type;//类型
public Image RewardImage;//奖品图片
public TextMeshProUGUI NumText;//奖励数量
}

View File

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

View File

@ -29,7 +29,7 @@ public class MotherFuck531 : MonoBehaviour
string response118 = await web.SendRequest(web.URL + "/snail/gameLottery/queryLotteryRewardList", "POST", JsonConvert.SerializeObject(Body), head118);
// 调试输出接收到的响应
Debug.Log("5.3.1查询摇奖机奖励列表 =====================" + response118);
Debug.Log("5.3.1查询摇奖机奖励列表 ====================="+"请求体:"+ JsonConvert.SerializeObject(Body)+"||返回数据" + response118);
// 将响应反序列化为 KnightRoomList 对象
Lottery531 directlist = JsonConvert.DeserializeObject<Lottery531>(response118);

View File

@ -1,18 +1,75 @@
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class MotherFuck532 : MonoBehaviour
{
// Start is called before the first frame update
void Start()
public async Task<Lottery532> Result() //
{
}
// 准备请求的头部信息,包含授权令牌
Dictionary<string, string> head118 = new Dictionary<string, string>
{
{ "Authorization", Global.global.serverResponse.data.token }
};
// 请求体
QueryLottery532Body Body = new QueryLottery532Body
{
userId = Global.global.serverResponse.data.userId
};
// Update is called once per frame
void Update()
{
// 异步发送请求
string response118 = await web.SendRequest(web.URL + "/snail/gameLottery/queryLotteryUserList", "POST", JsonConvert.SerializeObject(Body), head118);
// 调试输出接收到的响应
Debug.Log("5.3.2查询用户下的摇奖机 =====================" + "请求体:" + JsonConvert.SerializeObject(Body) + "||返回数据" + response118);
// 将响应反序列化为 KnightRoomList 对象
Lottery532 directlist = JsonConvert.DeserializeObject<Lottery532>(response118);
// 检查反序列化是否成功
if (directlist != null && directlist.data != null)
{
//Debug.Log("获取成功");
}
else
{
Debug.LogError("directlist 数据为空");
}
//Debug.Log(directlist.data.UserResponseVoList.Count);
return directlist;
}
}
public class QueryLottery532Body
{
public int userId { get; set; }
}
public class Lottery532 : Response
{
public List<Lottery531Data> data { get; set; }
}
public class Lottery532Data
{
public int Id { get; set; }
public int LotteryId { get; set; }
public int Type { get; set; }
public decimal BeansCoin { get; set; }
public int RateSurface { get; set; }
public int RateActual { get; set; }
public int Status { get; set; }
public DateTime CreateTime { get; set; }
public DateTime UpdateTime { get; set; }
}

File diff suppressed because it is too large Load Diff