This commit is contained in:
HuangZiBo 2024-11-16 02:16:01 +08:00
commit b3ae3c096b
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:
cuteNo:
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
GameObject:
m_ObjectHideFlags: 0

View File

@ -5,6 +5,7 @@ using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Windows;
using static UnityEditor.Progress;
using static UnityEngine.UIElements.UxmlAttributeDescription;
@ -16,6 +17,7 @@ public class AllHouseContro : MonoBehaviour
public GameObject text;
public GameObject detailsText;
public HouseBtn house;
public List<GameObject> bossobj;
// Start is called before the first frame update
async void Start()
{
@ -41,7 +43,7 @@ public class AllHouseContro : MonoBehaviour
string response511 = await web.SendRequest(web.URL + "/snail/gameEscape/queryLatest", "POST", "{}", head511);
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;
int index = 0;
foreach (GameEscapeRoomResponseVo item in Global.global.response.data.gameEscapeRoomResponseVoList)
@ -73,7 +75,7 @@ public class AllHouseContro : MonoBehaviour
body.escapeId = escapeId;
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);
int index = 0;
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());
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) {
@ -114,6 +138,7 @@ public class AllHouseContro : MonoBehaviour
response = await web.SendRequest(web.URL + "/snail/gameEscape/queryUserBetResult", "POST", JsonUtility.ToJson(body), Global.global.CreateHeaders());
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()
+ text4.GetComponent<TextBox>().ReturnText() + text5.GetComponent<TextBox>().ReturnText() + text6.GetComponent<TextBox>().ReturnText();
switch (BossContro.instance.HouseId)
foreach (GameObject item in list)
{
case 1:
text1.GetComponent<TextBox>().PlayAni();
ControMoney(text1);
break;
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;
if (item.GetComponent<TextBox>().ParentHouse.GetComponent<HouseBtn>().roomNo == int.Parse(room_id))
{
item.GetComponent<TextBox>().PlayAni();
ControMoney(item);
}
}

View File

@ -8,7 +8,7 @@ public class BossContro : MonoBehaviour
public Transform Parent;
public Transform originalParent;
public Transform BoosStartPos;
public static BossContro instance;
//public static BossContro instance;
public Transform StartPos;
public Animator BossAni;//boos动画
@ -17,10 +17,11 @@ public class BossContro : MonoBehaviour
public Transform BoosHouse;//boos房间
public AllHouseContro allHouseContro;
public GameObject bg;
// Start is called before the first frame update
void Start()
{
instance = this;
//instance = this;
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);
switch (Index)
{
case 0:
GetComponent<PlayerMove>().EndPos = GetComponent<PlayerMove>().TypeEndPos1;
break;
case 1:
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;
Debug.Log("===========--------------");
foreach (HouseBtn item in allHouseContro.HouseBtnList)
{
Debug.Log(item.roomNo.ToString() + "|" + Index.ToString());
if (item.roomNo == Index)
{
GetComponent<PlayerMove>().EndPos = item.post.transform;
}
}
//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();
BossAni.SetInteger("State", 1); // 动画转为移动
GetComponent<PlayerMove>().StartMove(); // 开始移动

View File

@ -8,6 +8,7 @@ public class FailPanel : BasePanel
public Button ReturnBtn;
public GameObject moveObject;
public static FailPanel instance;
public GameObject bg;
public override void Start()
{
instance = this;
@ -33,6 +34,10 @@ public class FailPanel : BasePanel
public override void 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 RectTransform door;
public GameObject text;
public GameObject post;
//public selectLatest511.GameEscapeRoomResponseVo gameEscapeRoomResponseVo;
public bool DoorIsOpen;
// Start is called before the first frame update

View File

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

View File

@ -8,6 +8,7 @@ public class SucceePanel : BasePanel
public Button ReturnBtn;
public GameObject moveObject;
public static SucceePanel instance;
public GameObject bg;
public override void Start()
{
instance = this;
@ -33,6 +34,10 @@ public class SucceePanel : BasePanel
public override void 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 Response response;
public ServerResponse response;
public static Global global ;
// Start is called before the first frame update
@ -58,12 +58,43 @@ public class Data
public object gameEscapeUserModel; // 游戏逃亡用户模型 (目前未处理)
}
[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 string message; // 提示语
public Data data; // 数据对象
}
// 数据类
[Serializable]
@ -86,12 +117,3 @@ public class GameEscapeModel
public float beansCoinRank; // 排名奖励豆币
public float beansCoinDivide; // 分成豆币
}
[Serializable]
public class Response
{
public int code; // 状态码
public string message; // 返回信息
public Data data; // 数据对象
}