Commit 0a733229 authored by SherryChaos's avatar SherryChaos

bug fix

parent e7bd134c
......@@ -7,11 +7,14 @@
下载地址:
<link="https://pan.baidu.com/s/1fnbwSq5Y7vj680sfwHnpBg?pwd=2wc0"><#0080F8><u>百度云网盘(网友维护)</u></color></link>
<link="https://pan.baidu.com/s/1ZnxcE6BaY-VdyG_JGN3t4w?pwd=cznl"><#0080F8><u>百度云网盘(网友维护) 2</u></color></link>
<link="https://www.123pan.com/s/YRetVv-EwmnA.html"><#0080F8><u>123云盘</u></color></link>
<link="https://pan.quark.cn/s/ca2e4e7a8c63"><#0080F8><u>夸克网盘</u></color></link>
For overseas users:
<link="https://mega.nz/folder/yB8HhYaS#5dkbGXm19Kka1O0xtwWZCw"><#0080F8><u>MEGA</u></color></link>
<link="https://mega.nz/folder/KEw1QYTB#_bKxKDWIxIgbg6OBJrUsxQ"><#0080F8><u>MEGA 2</u></color></link>
<link="https://drive.google.com/drive/folders/1t-Ysw-8Ic7n4c0D7l2rLQVZuwbSyaXzE?usp=sharing"><#0080F8><u>Google Drive</u></color></link>
<link="https://drive.google.com/drive/folders/1ePZM1xQPuWqCLSau08bXMMmzDhgXuXMT?usp=drive_link"><#0080F8><u>Google Drive 2</u></color></link>
_END_
\ No newline at end of file
MDPro3 v1.3.9更新:
1.在[游戏设置-关于游戏-关于更新]中添加了新的网盘下载地址。
2.修复决斗中部分选择卡片时可以不选择卡片的场合,无法不选择卡片的错误;
3.修复决斗消息某些情况下显示了错误玩家名的错误;
4.修复在进入决斗的过渡画面中点击左上角能够退出决斗的错误;
MDPro3 v1.3.8更新:
1.非中文的卡片渲染的属性球添加了注音文字;
......
......@@ -112,7 +112,6 @@ namespace MDPro3.Servant
TcpHelper.CtosMessage_Response(buffer);
}
public bool RoomIsFull()
{
int playerSeats = 2;
......@@ -446,6 +445,8 @@ namespace MDPro3.Servant
if (showing)
Hide(0);
UIManager.HideExitButton(TransitionTime);
}
public void StocMessage_DuelEnd(BinaryReader r)
......@@ -465,12 +466,9 @@ namespace MDPro3.Servant
public void StocMessage_Chat(BinaryReader r)
{
int player = r.ReadInt16();
var length = r.BaseStream.Length - 3;
var content = r.ReadUnicode((int)length);
//Debug.Log("StocMessage_Chat: " + player + "-" + content);
Program.instance.ui_.chatPanel.AddChatItem(player, content);
}
......
......@@ -22,7 +22,12 @@ namespace MDPro3.UI
private GameObject chatItemOp;
private GameObject chatItemSystem;
private List<GameObject> chatItems = new();
private SortedDictionary<int, string> cachedDialog = new();
private struct ChatMessage
{
public int player;
public string content;
}
private readonly List<ChatMessage> cachedMessages = new();
protected override void Awake()
{
......@@ -118,7 +123,7 @@ namespace MDPro3.UI
MyTag,
Op,
OpTag,
WatchMe,
WatchMe, // 本机处于观战时的一号位
WatchMyTag,
WatchOp,
WatchOpTag,
......@@ -129,43 +134,25 @@ namespace MDPro3.UI
{
if (RoomServant.CoreShowing == 1)
{
cachedDialog.Add(player, content);
cachedMessages.Add(new ChatMessage
{
player = player,
content = content
});
return;
}
if (RoomServant.CoreShowing == 2 && cachedDialog.Count > 0)
if (RoomServant.CoreShowing == 2 && cachedMessages.Count > 0)
{
var players = new List<int>();
var contents = new List<string>();
foreach (var element in cachedDialog)
{
players.Add(element.Key);
contents.Add(element.Value);
}
cachedDialog.Clear();
for (int i = 0; i < players.Count; i++)
AddChatItem(players[i], contents[i]);
var cacehd = new List<ChatMessage>(cachedMessages);
cachedMessages.Clear();
for (int i = 0; i < cachedMessages.Count; i++)
AddChatItem(cacehd[i].player, cacehd[i].content);
}
if (player == -2)
return;
if (RoomServant.CoreShowing == 2 && player < 4)
{
if (RoomServant.Mode != 2)
{
if (OcgCore.isFirst && RoomServant.SelfType == 1
|| !OcgCore.isFirst && RoomServant.SelfType == 0)
player = (player + 1) % 2;
}
else
{
if (OcgCore.isFirst && RoomServant.SelfType > 1
|| !OcgCore.isFirst && RoomServant.SelfType < 2)
player = (player + 2) % 4;
}
}
var nickName = RoomServant.players[player]?.name;
var nickName = GetPlayerName(player);
GameObject item = null;
var position = GetPlayerPositon(player);
switch (position)
......@@ -229,9 +216,11 @@ namespace MDPro3.UI
scrollRect.content.sizeDelta = new Vector2(0, chatItems.Count * 150);
scrollRect.DOVerticalNormalizedPos(0, 0.2f);
var p = new Package();
p.Function = (int)GameMessage.sibyl_chat;
p.Data = new BinaryMaster();
var p = new Package
{
Function = (int)GameMessage.sibyl_chat,
Data = new BinaryMaster()
};
p.Data.writer.Write(player);
p.Data.writer.WriteUnicode(content, content.Length + 1);
TcpHelper.AddRecordLine(p);
......@@ -242,8 +231,35 @@ namespace MDPro3.UI
MessageManager.Cast(content);
}
private static int GetRoomPlayerIndex(int player)
{
if (!Program.instance.ocgcore.showing)
return player;
if(player > -1 && player < 4 && !OcgCore.isFirst)
return player ^ 2;
return player;
}
private static string GetPlayerConfigName(PlayerPosition position)
{
return position switch
{
PlayerPosition.Me => Config.Get("DuelPlayerName0", Config.EMPTY_STRING),
PlayerPosition.MyTag => Config.Get("DuelPlayerName0Tag", Config.EMPTY_STRING),
PlayerPosition.Op => Config.Get("DuelPlayerName1", Config.EMPTY_STRING),
PlayerPosition.OpTag => Config.Get("DuelPlayerName1Tag", Config.EMPTY_STRING),
PlayerPosition.WatchMe => Config.Get("WatchPlayerName0", Config.EMPTY_STRING),
PlayerPosition.WatchMyTag => Config.Get("WatchPlayerName0Tag", Config.EMPTY_STRING),
PlayerPosition.WatchOp => Config.Get("WatchPlayerName1", Config.EMPTY_STRING),
PlayerPosition.WatchOpTag => Config.Get("WatchPlayerName1Tag", Config.EMPTY_STRING),
_ => string.Empty,
};
}
public static string GetPlayerName(int player)
{
var playerPosition = GetPlayerPositon(player);
player = GetRoomPlayerIndex(player);
string nickName = "";
switch (player)
{
......@@ -255,7 +271,7 @@ namespace MDPro3.UI
case 2: //host tag
case 3: //client tag
nickName = RoomServant.players[player].name;
var configName = GetConfigPlayerName(GetPlayerPositon(player));
var configName = GetPlayerConfigName(playerPosition);
if (configName.Length > 0)
nickName = configName;
break;
......@@ -275,33 +291,9 @@ namespace MDPro3.UI
return nickName;
}
public static string GetConfigPlayerName(PlayerPosition position)
{
switch (position)
{
case PlayerPosition.Me:
return Config.Get("DuelPlayerName0", Config.EMPTY_STRING);
case PlayerPosition.MyTag:
return Config.Get("DuelPlayerName0Tag", Config.EMPTY_STRING);
case PlayerPosition.Op:
return Config.Get("DuelPlayerName1", Config.EMPTY_STRING);
case PlayerPosition.OpTag:
return Config.Get("DuelPlayerName1Tag", Config.EMPTY_STRING);
case PlayerPosition.WatchMe:
return Config.Get("WatchPlayerName0", Config.EMPTY_STRING);
case PlayerPosition.WatchMyTag:
return Config.Get("WatchPlayerName0Tag", Config.EMPTY_STRING);
case PlayerPosition.WatchOp:
return Config.Get("WatchPlayerName1", Config.EMPTY_STRING);
case PlayerPosition.WatchOpTag:
return Config.Get("WatchPlayerName1Tag", Config.EMPTY_STRING);
default:
return string.Empty;
}
}
public static PlayerPosition GetPlayerPositon(int player)
{
player = GetRoomPlayerIndex(player);
PlayerPosition position;
if (player < 4)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment