1
This commit is contained in:
parent
b859308d36
commit
33a7588733
@ -61,90 +61,85 @@ namespace GameLogic
|
|||||||
|
|
||||||
if (data == null)
|
if (data == null)
|
||||||
{
|
{
|
||||||
// 没有加入过阵营
|
if (protCustMessageData.content.Contains("加入"))
|
||||||
if (data.teamId == "-1")
|
|
||||||
{
|
{
|
||||||
// 指令集操作
|
var number = protCustMessageData.content.Where(c => char.IsDigit(c)).ToArray();
|
||||||
if (protCustMessageData.content.Contains("加入"))
|
|
||||||
|
if (number.Length == 0)
|
||||||
{
|
{
|
||||||
var number = protCustMessageData.content.Where(c => char.IsDigit(c)).ToArray();
|
// 检查是否输入姓氏
|
||||||
|
foreach (var surname in DataGameSceneManager.Instance.m_Strs)
|
||||||
if (number.Length == 0)
|
|
||||||
{
|
{
|
||||||
// 检查是否输入姓氏
|
if (protCustMessageData.content.Contains(surname))
|
||||||
foreach (var surname in DataGameSceneManager.Instance.m_Strs)
|
|
||||||
{
|
|
||||||
if (protCustMessageData.content.Contains(surname))
|
|
||||||
{
|
|
||||||
int index = DataGameSceneManager.Instance.m_Strs.IndexOf(surname);
|
|
||||||
var actor = DataGameSceneManager.Instance.GetTeamActor(index.ToString());
|
|
||||||
//actor.AddUnitPlayer(data);
|
|
||||||
data = DataGameSceneManager.Instance.CreateUnitPlayerData(protCustMessageData, index);
|
|
||||||
actor.AddPlayer(data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
int targetId = Random.Range(2, EventConts.MaxPlayerIds);
|
|
||||||
|
|
||||||
data = DataGameSceneManager.Instance.CreateUnitPlayerData(protCustMessageData, targetId - 1);
|
|
||||||
// 二次容错
|
|
||||||
if (data == null)
|
|
||||||
{
|
{
|
||||||
|
int index = DataGameSceneManager.Instance.m_Strs.IndexOf(surname);
|
||||||
|
var actor = DataGameSceneManager.Instance.GetTeamActor(index.ToString());
|
||||||
|
//actor.AddUnitPlayer(data);
|
||||||
|
data = DataGameSceneManager.Instance.CreateUnitPlayerData(protCustMessageData, index);
|
||||||
|
actor.AddPlayer(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var actor = DataGameSceneManager.Instance.GetTeamActor((targetId - 1).ToString());
|
|
||||||
actor.AddPlayer(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//else if (protCustMessageData.content.Contains("666"))
|
|
||||||
//{
|
|
||||||
// int targetId = Random.Range(1, EventConts.MaxPlayerIds);
|
|
||||||
// var actor = DataGameSceneManager.Instance.GetTeamActor((targetId - 1).ToString());
|
|
||||||
// if (actor == null)
|
|
||||||
// {
|
|
||||||
// Log.Error("没有获取到实体玩家,tid = {0}", targetId);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// //actor.AddUnitPlayer(data);
|
|
||||||
//}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
// 直接数字
|
int targetId = Random.Range(2, EventConts.MaxPlayerIds);
|
||||||
var number = protCustMessageData.content.Where(c => char.IsDigit(c)).ToArray();
|
|
||||||
|
|
||||||
if (number.Length == 0)
|
data = DataGameSceneManager.Instance.CreateUnitPlayerData(protCustMessageData, targetId - 1);
|
||||||
|
// 二次容错
|
||||||
|
if (data == null)
|
||||||
{
|
{
|
||||||
Log.Error("No digits found in content: {0}", protCustMessageData.content);
|
return;
|
||||||
return; // or handle the error as needed
|
|
||||||
}
|
}
|
||||||
int targetId = -1;
|
|
||||||
|
|
||||||
if (int.TryParse(new string(number), out targetId))
|
var actor = DataGameSceneManager.Instance.GetTeamActor((targetId - 1).ToString());
|
||||||
|
actor.AddPlayer(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//else if (protCustMessageData.content.Contains("666"))
|
||||||
|
//{
|
||||||
|
// int targetId = Random.Range(1, EventConts.MaxPlayerIds);
|
||||||
|
// var actor = DataGameSceneManager.Instance.GetTeamActor((targetId - 1).ToString());
|
||||||
|
// if (actor == null)
|
||||||
|
// {
|
||||||
|
// Log.Error("没有获取到实体玩家,tid = {0}", targetId);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// //actor.AddUnitPlayer(data);
|
||||||
|
//}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
// 直接数字
|
||||||
|
var number = protCustMessageData.content.Where(c => char.IsDigit(c)).ToArray();
|
||||||
|
|
||||||
|
if (number.Length == 0)
|
||||||
|
{
|
||||||
|
Log.Error("No digits found in content: {0}", protCustMessageData.content);
|
||||||
|
return; // or handle the error as needed
|
||||||
|
}
|
||||||
|
int targetId = -1;
|
||||||
|
|
||||||
|
if (int.TryParse(new string(number), out targetId))
|
||||||
|
{
|
||||||
|
// 超过最大数
|
||||||
|
if (targetId > EventConts.MaxPlayerIds)
|
||||||
{
|
{
|
||||||
// 超过最大数
|
targetId = Random.Range(2, EventConts.MaxPlayerIds);
|
||||||
if (targetId > EventConts.MaxPlayerIds)
|
|
||||||
{
|
|
||||||
targetId = Random.Range(2, EventConts.MaxPlayerIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
data = DataGameSceneManager.Instance.CreateUnitPlayerData(protCustMessageData, targetId - 1);
|
|
||||||
// 二次容错
|
|
||||||
if (data == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var actor = DataGameSceneManager.Instance.GetTeamActor((targetId - 1).ToString());
|
|
||||||
actor.AddPlayer(data);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data = DataGameSceneManager.Instance.CreateUnitPlayerData(protCustMessageData, targetId - 1);
|
||||||
|
// 二次容错
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var actor = DataGameSceneManager.Instance.GetTeamActor((targetId - 1).ToString());
|
||||||
|
actor.AddPlayer(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1350,6 +1350,7 @@ namespace GameLogic
|
|||||||
|
|
||||||
if (m_GameTimerLen <= 0)
|
if (m_GameTimerLen <= 0)
|
||||||
{
|
{
|
||||||
|
isGaunJunShiKe = false;
|
||||||
// 游戏结束
|
// 游戏结束
|
||||||
OnRestGame();
|
OnRestGame();
|
||||||
}
|
}
|
||||||
|
@ -456,11 +456,11 @@ namespace GameLogic
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_rectBgList.GetChild(teamId).gameObject.SetActive(true);
|
m_rectBgList.GetChild(teamId-1).gameObject.SetActive(true);
|
||||||
m_rectSdx.GetChild(teamId).gameObject.SetActive(true);
|
m_rectSdx.GetChild(teamId-1).gameObject.SetActive(true);
|
||||||
m_rectSceneFx.GetChild(teamId).gameObject.SetActive(true);
|
m_rectSceneFx.GetChild(teamId - 1).gameObject.SetActive(true);
|
||||||
m_rectSpeed.GetChild(teamId).gameObject.SetActive(true);
|
m_rectSpeed.GetChild(teamId - 1).gameObject.SetActive(true);
|
||||||
m_rectTopFx.GetChild(teamId).gameObject.SetActive(true);
|
m_rectTopFx.GetChild(teamId - 1).gameObject.SetActive(true);
|
||||||
|
|
||||||
|
|
||||||
// 替换UI图
|
// 替换UI图
|
||||||
@ -593,7 +593,7 @@ namespace GameLogic
|
|||||||
{
|
{
|
||||||
//m_img_BT.sprite = GameModule.Resource.LoadAsset<Sprite>(string.Format("zjm_{0}_BT", DataGameSceneManager.Instance.m_TeamId + 1));
|
//m_img_BT.sprite = GameModule.Resource.LoadAsset<Sprite>(string.Format("zjm_{0}_BT", DataGameSceneManager.Instance.m_TeamId + 1));
|
||||||
//m_img_BT.SetNativeSize();
|
//m_img_BT.SetNativeSize();
|
||||||
m_img_BT.material = GameModule.Resource.LoadAsset<Material>(string.Format("Main_UI_Top{0}", DataGameSceneManager.Instance.m_TeamId + 1));
|
m_img_BT.material = GameModule.Resource.LoadAsset<Material>(string.Format("Main_UI_Top{0}", DataGameSceneManager.Instance.m_TeamId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -50,7 +50,7 @@ namespace GameLogic
|
|||||||
switch (gameLenTiemrId)
|
switch (gameLenTiemrId)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
EventConts.gameLenTiemr = 10 * 60;
|
EventConts.gameLenTiemr = 2 * 60;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
EventConts.gameLenTiemr = 20 * 60;
|
EventConts.gameLenTiemr = 20 * 60;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user