Compare commits

...

2 Commits

Author SHA1 Message Date
GL
fe7569ee48 Merge branch 'main' of http://shu.sheziwanglo.cn:3000/hyskai/_TheStrongestSnail
# Conflicts:
#	TheStrongestSnail/Assets/Scenes/Battle_Royale.unity
2024-11-16 02:08:20 +08:00
GL
e11cfe8951 add 2024-11-16 02:05:07 +08:00
10 changed files with 918 additions and 723 deletions

File diff suppressed because it is too large Load Diff

View File

@ -4044,6 +4044,29 @@ MonoBehaviour:
station: station:
cuteNo: cuteNo:
memberTime: memberTime:
response:
code: 0
message:
data:
carrySeconds: 0
gameEscapeRoomResponseVoList: []
gameEscapeModel:
id: 0
gameNo:
demonMode: 0
startTime:
betTime:
countTime:
settleTime:
status: 0
roomNoKill:
roomNoRemain:
beansCoinAll: 0
beansCoinKill: 0
beansCoinRemain: 0
beansCoinFee: 0
beansCoinRank: 0
beansCoinDivide: 0
--- !u!1 &1358692575 --- !u!1 &1358692575
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -5,6 +5,7 @@ using System.Threading.Tasks;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using UnityEngine.Windows;
using static UnityEditor.Progress; using static UnityEditor.Progress;
using static UnityEngine.UIElements.UxmlAttributeDescription; using static UnityEngine.UIElements.UxmlAttributeDescription;
@ -16,6 +17,7 @@ public class AllHouseContro : MonoBehaviour
public GameObject text; public GameObject text;
public GameObject detailsText; public GameObject detailsText;
public HouseBtn house; public HouseBtn house;
public List<GameObject> bossobj;
// Start is called before the first frame update // Start is called before the first frame update
async void Start() async void Start()
{ {
@ -41,7 +43,7 @@ public class AllHouseContro : MonoBehaviour
string response511 = await web.SendRequest(web.URL + "/snail/gameEscape/queryLatest", "POST", "{}", head511); string response511 = await web.SendRequest(web.URL + "/snail/gameEscape/queryLatest", "POST", "{}", head511);
Debug.Log("5.1.1查询最近一场大屠杀" + response511); Debug.Log("5.1.1查询最近一场大屠杀" + response511);
// 解析服务器返回的数据 // 解析服务器返回的数据
Global.global.response = JsonConvert.DeserializeObject<Response>(response511); Global.global.response = JsonConvert.DeserializeObject<ServerResponse>(response511);
escapeId = Global.global.response.data.gameEscapeModel.id; escapeId = Global.global.response.data.gameEscapeModel.id;
int index = 0; int index = 0;
foreach (GameEscapeRoomResponseVo item in Global.global.response.data.gameEscapeRoomResponseVoList) foreach (GameEscapeRoomResponseVo item in Global.global.response.data.gameEscapeRoomResponseVoList)
@ -73,7 +75,7 @@ public class AllHouseContro : MonoBehaviour
body.escapeId = escapeId; body.escapeId = escapeId;
string response = await web.SendRequest(web.URL+"/snail/gameEscape/queryEscapeRoomList", "POST", JsonUtility.ToJson(body), Global.global.CreateHeaders()); string response = await web.SendRequest(web.URL+"/snail/gameEscape/queryEscapeRoomList", "POST", JsonUtility.ToJson(body), Global.global.CreateHeaders());
//Debug.Log("5.1.2²éѯÌÓÍö·¿¼äÏêÇéÏìÓ¦: " + response); Debug.Log("5.1.2查询逃亡房间详情响应: " + response);
ServerResponse serverResponse = JsonConvert.DeserializeObject<ServerResponse>(response); ServerResponse serverResponse = JsonConvert.DeserializeObject<ServerResponse>(response);
int index = 0; int index = 0;
foreach (var item in serverResponse.data.gameEscapeRoomResponseVoList){ foreach (var item in serverResponse.data.gameEscapeRoomResponseVoList){
@ -102,7 +104,29 @@ public class AllHouseContro : MonoBehaviour
response = await web.SendRequest(web.URL + "/snail/gameEscape/queryKill", "POST", JsonUtility.ToJson(body), Global.global.CreateHeaders()); response = await web.SendRequest(web.URL + "/snail/gameEscape/queryKill", "POST", JsonUtility.ToJson(body), Global.global.CreateHeaders());
Debug.Log("5.1.4: " + response); Debug.Log("5.1.4: " + response);
ServerResponse514 serverResponse_514 = JsonConvert.DeserializeObject<ServerResponse514>(response);
string[] parts = serverResponse_514.data.roomNoKill.Split(","); // 根据 ',' 分割字符串d
int index_ = 0;
foreach (string part in parts) {
if (parts.Length > index_)
{
int a = 0;
foreach (HouseBtn item in HouseBtnList)
{
if (a == int.Parse(parts[index_])) {
bossobj[index_].GetComponent<BossContro>().BossMove(int.Parse(parts[index_]));
bossobj[index_].GetComponent<PlayerMove>().room_id = parts[index_];
}
a++;
}
index_++;
}
}
} }
} }
else if (serverResponse.data.carrySeconds > 50) { else if (serverResponse.data.carrySeconds > 50) {
@ -114,6 +138,7 @@ public class AllHouseContro : MonoBehaviour
response = await web.SendRequest(web.URL + "/snail/gameEscape/queryUserBetResult", "POST", JsonUtility.ToJson(body), Global.global.CreateHeaders()); response = await web.SendRequest(web.URL + "/snail/gameEscape/queryUserBetResult", "POST", JsonUtility.ToJson(body), Global.global.CreateHeaders());
Debug.Log("5.1.5: " + response); Debug.Log("5.1.5: " + response);
} }
} }
} }

View File

@ -84,39 +84,20 @@ public class BettingBtn : MonoBehaviour
} }
} }
public void GiveMoney() public void GiveMoney(string room_id)
{ {
float AllMoney = text1.GetComponent<TextBox>().ReturnText() + text2.GetComponent<TextBox>().ReturnText() + text3.GetComponent<TextBox>().ReturnText() float AllMoney = text1.GetComponent<TextBox>().ReturnText() + text2.GetComponent<TextBox>().ReturnText() + text3.GetComponent<TextBox>().ReturnText()
+ text4.GetComponent<TextBox>().ReturnText() + text5.GetComponent<TextBox>().ReturnText() + text6.GetComponent<TextBox>().ReturnText(); + text4.GetComponent<TextBox>().ReturnText() + text5.GetComponent<TextBox>().ReturnText() + text6.GetComponent<TextBox>().ReturnText();
switch (BossContro.instance.HouseId) foreach (GameObject item in list)
{ {
case 1: if (item.GetComponent<TextBox>().ParentHouse.GetComponent<HouseBtn>().roomNo == int.Parse(room_id))
text1.GetComponent<TextBox>().PlayAni(); {
ControMoney(text1); item.GetComponent<TextBox>().PlayAni();
break; ControMoney(item);
case 2: }
text2.GetComponent<TextBox>().PlayAni();
ControMoney(text2);
break;
case 3:
text3.GetComponent<TextBox>().PlayAni();
ControMoney(text3);
break;
case 4:
text4.GetComponent<TextBox>().PlayAni();
ControMoney(text4);
break;
case 5:
text5.GetComponent<TextBox>().PlayAni();
ControMoney(text5);
break;
case 6:
text6.GetComponent<TextBox>().PlayAni();
ControMoney(text6);
break;
} }

View File

@ -8,7 +8,7 @@ public class BossContro : MonoBehaviour
public Transform Parent; public Transform Parent;
public Transform originalParent; public Transform originalParent;
public Transform BoosStartPos; public Transform BoosStartPos;
public static BossContro instance; //public static BossContro instance;
public Transform StartPos; public Transform StartPos;
public Animator BossAni;//boos动画 public Animator BossAni;//boos动画
@ -17,10 +17,11 @@ public class BossContro : MonoBehaviour
public Transform BoosHouse;//boos房间 public Transform BoosHouse;//boos房间
public AllHouseContro allHouseContro; public AllHouseContro allHouseContro;
public GameObject bg;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
instance = this; //instance = this;
originalParent = transform.parent; originalParent = transform.parent;
} }
@ -52,30 +53,42 @@ public class BossContro : MonoBehaviour
public void BossMove() public void BossMove(int Index)
{ {
int Index=Random.Range(0,5); Debug.Log("===========--------------");
switch (Index) foreach (HouseBtn item in allHouseContro.HouseBtnList)
{ {
case 0: Debug.Log(item.roomNo.ToString() + "|" + Index.ToString());
GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos1; if (item.roomNo == Index)
break; {
case 1: GetComponent<PlayerMove>().EndPos = item.post.transform;
GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos2; }
break;
case 2:
GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos3;
break;
case 3:
GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos4;
break;
case 4:
GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos5;
break;
case 5:
GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos6;
break;
} }
//GetComponent<PlayerMove>().TypeEndPos1
//switch (Index)
//{
// case 1:
// GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos1;
// break;
// case 2:
// GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos2;
// break;
// case 3:
// GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos3;
// break;
// case 4:
// GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos4;
// break;
// case 5:
// GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos5;
// break;
// case 6:
// GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos6;
// break;
// case 0:
// GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos0;
// break;
//}
//MoveParent(); //MoveParent();
BossAni.SetInteger("State", 1); // 动画转为移动 BossAni.SetInteger("State", 1); // 动画转为移动
GetComponent<PlayerMove>().StartMove(); // 开始移动 GetComponent<PlayerMove>().StartMove(); // 开始移动

View File

@ -8,6 +8,7 @@ public class FailPanel : BasePanel
public Button ReturnBtn; public Button ReturnBtn;
public GameObject moveObject; public GameObject moveObject;
public static FailPanel instance; public static FailPanel instance;
public GameObject bg;
public override void Start() public override void Start()
{ {
instance = this; instance = this;
@ -33,6 +34,10 @@ public class FailPanel : BasePanel
public override void ShowPanel() public override void ShowPanel()
{ {
base.ShowPanel(); base.ShowPanel();
BossContro.instance.ReturnParent(); foreach (GameObject item in bg.GetComponent<AllHouseContro>().bossobj)
{
item.GetComponent<BossContro>().ReturnParent();
}
//dic[room_id].GetComponent<BossContro>().ReturnParent();
} }
} }

View File

@ -12,6 +12,7 @@ public class HouseBtn : MonoBehaviour
public GameObject Mask; public GameObject Mask;
public RectTransform door; public RectTransform door;
public GameObject text; public GameObject text;
public GameObject post;
//public selectLatest511.GameEscapeRoomResponseVo gameEscapeRoomResponseVo; //public selectLatest511.GameEscapeRoomResponseVo gameEscapeRoomResponseVo;
public bool DoorIsOpen; public bool DoorIsOpen;
// Start is called before the first frame update // Start is called before the first frame update

View File

@ -11,10 +11,11 @@ public class PlayerMove : MonoBehaviour
public bool isLooping = false; // 是否循环路径 public bool isLooping = false; // 是否循环路径
int startIndex = 0; int startIndex = 0;
int endIndex = 0; int endIndex = 0;
public string room_id;
public float Speed; public float Speed;
public Transform EndPos; public Transform EndPos;
public Transform TypeEndPos0;
public Transform TypeEndPos1; public Transform TypeEndPos1;
public Transform TypeEndPos2; public Transform TypeEndPos2;
public Transform TypeEndPos3; public Transform TypeEndPos3;
@ -74,7 +75,7 @@ public class PlayerMove : MonoBehaviour
} }
else else
{ {
BossContro.instance.HouseId = 1; GetComponent<BossContro>().HouseId = 1;
} }
} }
else if (EndPos == TypeEndPos2) else if (EndPos == TypeEndPos2)
@ -87,7 +88,7 @@ public class PlayerMove : MonoBehaviour
} }
else else
{ {
BossContro.instance.HouseId = 2; GetComponent<BossContro>().HouseId = 2;
} }
} }
else if(EndPos == TypeEndPos3) else if(EndPos == TypeEndPos3)
@ -99,7 +100,7 @@ public class PlayerMove : MonoBehaviour
} }
else else
{ {
BossContro.instance.HouseId = 3; GetComponent<BossContro>().HouseId = 3;
} }
} }
else if (EndPos == TypeEndPos4) else if (EndPos == TypeEndPos4)
@ -111,7 +112,7 @@ public class PlayerMove : MonoBehaviour
} }
else else
{ {
BossContro.instance.HouseId = 4; GetComponent<BossContro>().HouseId = 4;
} }
} }
else if (EndPos == TypeEndPos5) else if (EndPos == TypeEndPos5)
@ -123,7 +124,7 @@ public class PlayerMove : MonoBehaviour
} }
else else
{ {
BossContro.instance.HouseId = 5; GetComponent<BossContro>().HouseId = 5;
} }
} }
else if (EndPos == TypeEndPos6) else if (EndPos == TypeEndPos6)
@ -135,7 +136,7 @@ public class PlayerMove : MonoBehaviour
} }
else else
{ {
BossContro.instance.HouseId = 6; GetComponent<BossContro>().HouseId = 6;
} }
} }
@ -211,7 +212,7 @@ public class PlayerMove : MonoBehaviour
Debug.Log("Startindex"+i); Debug.Log("Startindex"+i);
} }
else if (IsBoos && BossContro.instance.BoosStartPos== pathPoints[i]) else if (IsBoos && GetComponent<BossContro>().BoosStartPos== pathPoints[i])
{ {
startIndex = i; startIndex = i;
Debug.Log("Startindex" + i); Debug.Log("Startindex" + i);
@ -290,17 +291,17 @@ public class PlayerMove : MonoBehaviour
else else
{ {
JudgeEnd(); JudgeEnd();
BossContro.instance.BossAni.SetInteger("State", 0);//Í£Ö¹Òƶ¯ GetComponent<BossContro>().BossAni.SetInteger("State", 0);//Í£Ö¹Òƶ¯
allHouseContro.ControOneDoorOpen(BossContro.instance.HouseId,() => {//¿ªÃÅ allHouseContro.ControOneDoorOpen(GetComponent<BossContro>().HouseId,() => {//¿ªÃÅ
BossContro.instance.BossAni.SetInteger("State", 1); GetComponent<BossContro>().BossAni.SetInteger("State", 1);
objectToMove.DOMoveY(objectToMove.position.y + 100, 0.5f).OnComplete(() => {//进房间 objectToMove.DOMoveY(objectToMove.position.y + 100, 0.5f).OnComplete(() => {//进房间
SetParentToHouse(); SetParentToHouse();
StartCoroutine(BoosAttack()); StartCoroutine(BoosAttack());
BossContro.instance.BoosStartPos = EndPos; GetComponent<BossContro>().BoosStartPos = EndPos;
//JudgeSuccOrFail(); //JudgeSuccOrFail();
}); });
@ -324,11 +325,11 @@ public class PlayerMove : MonoBehaviour
IEnumerator BoosAttack() IEnumerator BoosAttack()
{ {
BossContro.instance.BossAni.SetInteger("State", 2); GetComponent<BossContro>().BossAni.SetInteger("State", 2);
yield return new WaitForSeconds(3f); yield return new WaitForSeconds(3f);
BossContro.instance.BossAni.SetInteger("State", 0); GetComponent<BossContro>().BossAni.SetInteger("State", 0);
BettingBtn.instance.GiveMoney(); BettingBtn.instance.GiveMoney(room_id);
yield return new WaitForSeconds(2f); yield return new WaitForSeconds(2f);
JudgeSuccOrFail(); JudgeSuccOrFail();
} }
@ -336,13 +337,14 @@ public class PlayerMove : MonoBehaviour
public void JudgeSuccOrFail() public void JudgeSuccOrFail()
{ {
if (BossContro.instance.BoosStartPos == PlayerMovePos.instance.StartPos && PlayerMovePos.instance.HadChoise) Debug.Log("=000000000000000000000000000000000000000000000000");
if (GetComponent<BossContro>().BoosStartPos == PlayerMovePos.instance.StartPos && PlayerMovePos.instance.HadChoise)
{ {
//BossContro.instance.BossAni.SetInteger("State", 2);//boos攻击 //BossContro.instance.BossAni.SetInteger("State", 2);//boos攻击
Debug.Log("失败");//失败 Debug.Log("失败");//失败
FailPanel.instance.ShowPanel(); FailPanel.instance.ShowPanel();
} }
else if (BossContro.instance.BoosStartPos != PlayerMovePos.instance.StartPos && PlayerMovePos.instance.HadChoise) else if (GetComponent<BossContro>().BoosStartPos != PlayerMovePos.instance.StartPos && PlayerMovePos.instance.HadChoise)
{ {
Debug.Log("胜利");//胜利 Debug.Log("胜利");//胜利
SucceePanel.instance.ShowPanel(); SucceePanel.instance.ShowPanel();
@ -350,7 +352,10 @@ public class PlayerMove : MonoBehaviour
else else
{ {
Debug.Log("没有失败和胜利");//胜利 Debug.Log("没有失败和胜利");//胜利
foreach (GameObject item in allHouseContro.bossobj)
{
item.GetComponent<BossContro>().ReturnParent();
}
} }
//HegemonTime.instance.StartCoroutine(HegemonTime.instance.StartGame());//重新计算时间 //HegemonTime.instance.StartCoroutine(HegemonTime.instance.StartGame());//重新计算时间
} }
@ -383,15 +388,15 @@ public class PlayerMove : MonoBehaviour
Vector3 nextWaypoint = waypoints[index + 1]; Vector3 nextWaypoint = waypoints[index + 1];
if (IsBoos) if (IsBoos)
{ {
if (nextWaypoint.x < currentWaypoint.x && !BossContro.instance.IsLeft) if (nextWaypoint.x < currentWaypoint.x && !GetComponent<BossContro>().IsLeft)
{ {
BossContro.instance.IsLeft = true; GetComponent<BossContro>().IsLeft = true;
// 旋转物体使其面向左侧绕Y轴旋转180度 // 旋转物体使其面向左侧绕Y轴旋转180度
Rotate(); Rotate();
} }
else if (nextWaypoint.x > currentWaypoint.x && BossContro.instance.IsLeft) else if (nextWaypoint.x > currentWaypoint.x && GetComponent<BossContro>().IsLeft)
{ {
BossContro.instance.IsLeft = false; GetComponent<BossContro>().IsLeft = false;
Rotate(); Rotate();
} }
} }

View File

@ -8,6 +8,7 @@ public class SucceePanel : BasePanel
public Button ReturnBtn; public Button ReturnBtn;
public GameObject moveObject; public GameObject moveObject;
public static SucceePanel instance; public static SucceePanel instance;
public GameObject bg;
public override void Start() public override void Start()
{ {
instance = this; instance = this;
@ -33,6 +34,10 @@ public class SucceePanel : BasePanel
public override void ShowPanel() public override void ShowPanel()
{ {
base.ShowPanel(); base.ShowPanel();
BossContro.instance.ReturnParent(); foreach (GameObject item in bg.GetComponent<AllHouseContro>().bossobj)
{
item.GetComponent<BossContro>().ReturnParent();
}
//FailPanel.instance.dic[room_id].GetComponent<BossContro>().ReturnParent();
} }
} }

View File

@ -7,7 +7,7 @@ public class Global : MonoBehaviour
{ {
public logoPanel.ServerResponse serverResponse; public logoPanel.ServerResponse serverResponse;
public Response response; public ServerResponse response;
public static Global global ; public static Global global ;
// Start is called before the first frame update // Start is called before the first frame update
@ -58,12 +58,43 @@ public class Data
public object gameEscapeUserModel; // 游戏逃亡用户模型 (目前未处理) public object gameEscapeUserModel; // 游戏逃亡用户模型 (目前未处理)
} }
[Serializable] [Serializable]
public class ServerResponse public class Data514
{
public int id;
public string gameNo;
public int demonMode;
public string startTime;
public string betTime;
public string countTime;
public string settleTime;
public int status;
public string roomNoKill;
public string roomNoRemain;
public float beansCoinAll;
public float beansCoinKill;
public float beansCoinRemain;
public float beansCoinFee;
public float beansCoinRank;
public float beansCoinDivide;
}
[Serializable]
public class ServerResponse: Response
{
public Data data; // Êý¾Ý¶ÔÏó
}
[Serializable]
public class ServerResponse514: Response
{
public Data514 data; // Êý¾Ý¶ÔÏó
}
public class Response
{ {
public int code; // 响应状态码 public int code; // 响应状态码
public string message; // 提示语 public string message; // 提示语
public Data data; // 数据对象
} }
// 数据类 // 数据类
[Serializable] [Serializable]
@ -86,12 +117,3 @@ public class GameEscapeModel
public float beansCoinRank; // 排名奖励豆币 public float beansCoinRank; // 排名奖励豆币
public float beansCoinDivide; // 分成豆币 public float beansCoinDivide; // 分成豆币
} }
[Serializable]
public class Response
{
public int code; // 状态码
public string message; // 返回信息
public Data data; // 数据对象
}