UIFruit:增加聊天协议

This commit is contained in:
fatiao 2025-11-19 13:13:28 +08:00
parent 6865942403
commit c9f0f3ff16
10 changed files with 143 additions and 18 deletions

View File

@ -1,8 +1,8 @@
key,内容
key,Language
string,string
system,系统
player,玩家
system,系统
actor_nvshen,女神
actor_weier,薇儿
actor_xifu,希芙
@ -32,12 +32,14 @@ ST3011,哇,这么会说话!
ST3012,说真的,打完架看到这么美的枫叶林,突然觉得要是有人陪着散步该多好
ST3013,没想到救世主还挺浪漫的嘛!不过现在还是专心打巨人比较重要哦
ST3014,知道啦。不过和你聊天特别放松,下次打架前能想想你提提神吗?
ST3015,诶?!你、你这人怎么这样……随便你啦!
ST3015,[heart-301]
ST3021,现在就去吗?我们才刚认识诶……不过你倒是挺会挑地方的
ST3022,那我姑且期待一下好了~
ST3023,[gift-303]
ST3031,喂喂!怎么突然说这个!我、我还没谈过恋爱呢!
ST3032,你的反应好可爱
ST3033,喂!不许说这种话啦!
ST3034,[gift-303]
ST401,冥界的彼岸花又开了一季,依旧无人欣赏
ST402,这些花的美丽,终究只有亡魂能看见
ST403,或许……有个活人愿意去看看?
@ -2324,3 +2326,34 @@ ST105025,(约会邀请)
ST105031,它们的口水会腐蚀金属光泽
ST105032,不过……
ST105033,看你被追着跑的样子应该很有趣
NPCLoc3,阿斯加德
NPCNation3,神族
NPCMarry3,单身
NPCLoc4,阿斯加德
NPCNation4,神族
NPCMarry4,单身
NPCLoc5,阿斯加德
NPCNation5,神族
NPCMarry5,单身
NPCSign5,我是托尔的妻子
NPCPost5,诸神黄昏了,晒个照片
NPCLoc6,阿斯加德
NPCNation6,神族
NPCMarry6,单身
NPCSign6,真正的女神
NPCPost6,喝酒了
NPCLoc7,阿斯加德
NPCNation7,神族
NPCMarry7,单身
NPCSign7,天气真好
NPCPost7,"Love, Love, Love!"
NPCLoc8,阿斯加德
NPCNation8,神族
NPCMarry8,单身
NPCSign8,感受伤痛吧
NPCPost8,喜欢吗?
NPCLoc9,阿斯加德
NPCNation9,神族
NPCMarry9,单身
NPCSign9,战斗是一种享受
NPCPost9,战斗状态

1 key 内容
2 key Language
3 string string
system 系统
4 player 玩家
5 system 系统
6 actor_nvshen 女神
7 actor_weier 薇儿
8 actor_xifu 希芙
32 ST3012 说真的,打完架看到这么美的枫叶林,突然觉得要是有人陪着散步该多好
33 ST3013 没想到救世主还挺浪漫的嘛!不过现在还是专心打巨人比较重要哦
34 ST3014 知道啦。不过和你聊天特别放松,下次打架前能想想你提提神吗?
35 ST3015 诶?!你、你这人怎么这样……随便你啦! [heart-301]
36 ST3021 现在就去吗?我们才刚认识诶……不过你倒是挺会挑地方的
37 ST3022 那我姑且期待一下好了~
38 ST3023 [gift-303]
39 ST3031 喂喂!怎么突然说这个!我、我还没谈过恋爱呢!
40 ST3032 你的反应好可爱
41 ST3033 喂!不许说这种话啦!
42 ST3034 [gift-303]
43 ST401 冥界的彼岸花又开了一季,依旧无人欣赏
44 ST402 这些花的美丽,终究只有亡魂能看见
45 ST403 或许……有个活人愿意去看看?
2326 ST105031 它们的口水会腐蚀金属光泽
2327 ST105032 不过……
2328 ST105033 看你被追着跑的样子应该很有趣
2329 NPCLoc3 阿斯加德
2330 NPCNation3 神族
2331 NPCMarry3 单身
2332 NPCLoc4 阿斯加德
2333 NPCNation4 神族
2334 NPCMarry4 单身
2335 NPCLoc5 阿斯加德
2336 NPCNation5 神族
2337 NPCMarry5 单身
2338 NPCSign5 我是托尔的妻子
2339 NPCPost5 诸神黄昏了,晒个照片
2340 NPCLoc6 阿斯加德
2341 NPCNation6 神族
2342 NPCMarry6 单身
2343 NPCSign6 真正的女神
2344 NPCPost6 喝酒了
2345 NPCLoc7 阿斯加德
2346 NPCNation7 神族
2347 NPCMarry7 单身
2348 NPCSign7 天气真好
2349 NPCPost7 Love, Love, Love!
2350 NPCLoc8 阿斯加德
2351 NPCNation8 神族
2352 NPCMarry8 单身
2353 NPCSign8 感受伤痛吧
2354 NPCPost8 喜欢吗?
2355 NPCLoc9 阿斯加德
2356 NPCNation9 神族
2357 NPCMarry9 单身
2358 NPCSign9 战斗是一种享受
2359 NPCPost9 战斗状态

View File

@ -720,6 +720,8 @@
SC_FRUIT_START_BET_NTF = 1763, -- SCFruitStartBetNtf **SCFruitStartBetNtf **login.proto **game,fruit [SCFruitStartBetNtf]
CS_ROLE_STORY_NPC_REQ = 1764, -- 剧情NPC好感度 **CSRoleStoryNpcReq **login.proto **game [CSRoleStoryNpcReq]
SC_ROLE_STORY_NPC_ACK = 1765, -- SCRoleStoryNpcAck **SCRoleStoryNpcAck **login.proto ** [SCRoleStoryNpcAck]
CS_FRUIT_CHAT_REQ = 1766, -- CSFruitChatReq **CSFruitChatReq **login.proto **game,fruit [CSFruitChatReq]
SC_FRUIT_CHAT_NTF = 1767, -- SCFruitChatNtf **SCFruitChatNtf **login.proto **game,fruit [SCFruitChatNtf]
}
return ProtoMsgId

View File

@ -590,10 +590,11 @@ local UIEventNames = {
EID_FRUIT_BET_SUCCESS = id(),
EID_FRUIT_PLAYER_AWARD_RANK = id(),
EID_FRUIT_SETTLE = id(),
EID_FRUIT_CHAT_NTF = id(),
EID_DANMU_INPUT_NTF = id(),
EID_CHAT_STORY_REWARD = id(),
EID_CHAT_STORY_ADD_HEART_NTF = id()
EID_CHAT_STORY_ADD_HEART_NTF = id(),
}
return UIEventNames

View File

@ -1,8 +1,12 @@
local FruitData = class("FruitData", require("DataBase"))
local BitUtil = require("BitUtil")
local CONST_MAX_CHAT_DATA_NUM = 30
function FruitData:ctor()
self.data = {}
self.data.chatData = {}
self.chatDataSN = 0
end
function FruitData:Join()
@ -19,6 +23,10 @@ function FruitData:Bet(bet_info)
})
end
function FruitData:SendChat(content)
ManagerContainer.NetManager:SendMessage(ProtoMsgId.CS_FRUIT_CHAT_REQ, {chat_content=content})
end
function FruitData:GetData()
return self.data
end
@ -86,6 +94,26 @@ function FruitData:RegisterNetEvents()
self.data.award_rank = data.player_award_rank
ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.EID_FRUIT_PLAYER_AWARD_RANK, true)
end)
ManagerContainer.NetManager:NetRegister(ProtoMsgId.SC_FRUIT_CHAT_NTF, function(data)
self.chatDataSN = data.SN
local idx = self.chatDataSN % CONST_MAX_CHAT_DATA_NUM + 1
self.data.chatData = self.data.chatData or {}
self.data.chatData[idx] = {uid=data.uid, nickName=data.nickname, level=data.level, headId = data.head_id, content=data.chat_content}
ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.EID_FRUIT_CHAT_NTF, true)
end)
end
function FruitData:GetChatData()
local chatData = {}
local sn = self.chatDataSN
for i = 1, CONST_MAX_CHAT_DATA_NUM do
local idx = sn % CONST_MAX_CHAT_DATA_NUM + 1
if self.data.chatData[idx] then
table.insert(chatData, self.data.chatData[idx])
end
sn = sn - 1
end
return chatData
end
function FruitData:Clear()

View File

@ -1,5 +1,5 @@
´Ý
êß
login.proto serverproto
user.proto"0
@ -2682,11 +2682,14 @@ rewardList"M
exp (Rexp
group (Rgroup"O
SCLevelupSummonStartupNtf2
info ( 2.serverproto.LevelupSummonInfoRinfo"V
info ( 2.serverproto.LevelupSummonInfoRinfo"¡
CSFruitJoinReq
uid (Ruid
room_no (RroomNo
chip_num (RchipNum"ì
chip_num (RchipNum
nickname ( Rnickname
level (Rlevel
head_id ( RheadId"ì
SCFruitJoinAck
uid (Ruid
error (Rerror
@ -2744,4 +2747,14 @@ targetSlot(
uid (Ruid
award_type (R awardTypeM
player_award_rank ( 2!.serverproto.FruitPlayerAwardInfoRplayerAwardRankbproto3
player_award_rank ( 2!.serverproto.FruitPlayerAwardInfoRplayerAwardRank"E
CSFruitChatReq
uid (Ruid!
chat_content ( R chatContent" 
SCFruitChatNtf
SN (RSN
uid (Ruid
nickname ( Rnickname
level (Rlevel
head_id ( RheadId!
chat_content ( R chatContentbproto3

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
ŕ<EFBFBD>
ň‘
protocal.proto serverproto common.protocrossserver.protoerror_code.proto login.protomessagedef.proto
user.proto"Ăć
user.proto"Śç
Request7
CS_PING_REQè ( 2.serverproto.CSPingReqR CSPINGREQ:
CS_LOGIN_REQê ( 2.serverproto.CSLoginReqR
@ -371,7 +371,8 @@ $CS_G_CROSS_PLAYER_MAP_SYNC_PARAM_REQ
CS_FRUIT_JOIN_REQÚ ( 2.serverproto.CSFruitJoinReqRCSFRUITJOINREQJ
CS_FRUIT_LEAVE_REQÜ ( 2.serverproto.CSFruitLeaveReqRCSFRUITLEAVEREQD
CS_FRUIT_BET_REQÞ ( 2.serverproto.CSFruitBetReqR CSFRUITBETREQQ
CS_ROLE_STORY_NPC_REQä ( 2.serverproto.CSRoleStoryNpcReqRCSROLESTORYNPCREQ"’©
CS_ROLE_STORY_NPC_REQä ( 2.serverproto.CSRoleStoryNpcReqRCSROLESTORYNPCREQG
CS_FRUIT_CHAT_REQć ( 2.serverproto.CSFruitChatReqRCSFRUITCHATREQ"Ű©
Response7
SC_PING_ACKé ( 2.serverproto.SCPingAckR SCPINGACK:
SC_LOGIN_ACKë ( 2.serverproto.SCLoginAckR
@ -855,4 +856,5 @@ SCMUJOYNTFG
SC_FRUIT_SEC_TICK_NTFá ( 2.serverproto.SCFruitSecTickNtfRSCFRUITSECTICKNTFj
SC_FRUIT_PLAYER_AWARD_RANK_NTFâ ( 2&.serverproto.SCFruitPlayerAwardRankNtfRSCFRUITPLAYERAWARDRANKNTFT
SC_FRUIT_START_BET_NTFã ( 2.serverproto.SCFruitStartBetNtfRSCFRUITSTARTBETNTFQ
SC_ROLE_STORY_NPC_ACKĺ ( 2.serverproto.SCRoleStoryNpcAckRSCROLESTORYNPCACKbproto3
SC_ROLE_STORY_NPC_ACKĺ ( 2.serverproto.SCRoleStoryNpcAckRSCROLESTORYNPCACKG
SC_FRUIT_CHAT_NTFç ( 2.serverproto.SCFruitChatNtfRSCFRUITCHATNTFbproto3

View File

@ -1,5 +1,5 @@
ěň
ϗ
user.proto serverproto"¸
AccountRole
@ -1663,9 +1663,11 @@ fightPower"
exp (Rexp"5
FruitSlotInfo
slot (Rslot
num (Rnum"v
num (Rnum"¥
FruitPlayerAwardInfo
uid (Ruid
name ( Rname$
award_chip_num (R awardChipNum
rank (Rrankbproto3
name ( Rname
level (Rlevel
head_id ( RheadId$
award_chip_num (R awardChipNum
rank (Rrankbproto3

View File

@ -360,7 +360,49 @@ public class ConfigMgr : Singleton<ConfigMgr>
}
m_bInitCSVFinished = true;
}
string[] ManualCsvParse(string csvLine)
{
var fields = new List<string>();
var currentField = new StringBuilder();
bool insideQuotes = false;
for (int i = 0; i < csvLine.Length; i++)
{
char currentChar = csvLine[i];
switch (currentChar)
{
case '"':
if (insideQuotes && i + 1 < csvLine.Length && csvLine[i + 1] == '"')
{
// 遇到转义引号 ("")
currentField.Append('"');
i++; // 跳过下一个引号
}
else
{
// 进入或退出引号区域
insideQuotes = !insideQuotes;
}
break;
case ',' when !insideQuotes:
// 遇到不在引号内的逗号,结束当前字段
fields.Add(currentField.ToString());
currentField.Clear();
break;
default:
// 普通字符,添加到当前字段
currentField.Append(currentChar);
break;
}
}
// 添加最后一个字段
fields.Add(currentField.ToString());
return fields.ToArray();
}
private Dictionary<string, Dictionary<string, string>> getData(string name, string content)
{
string[] lineArray;
@ -377,12 +419,14 @@ public class ConfigMgr : Singleton<ConfigMgr>
}
lineArray = tempList.ToArray();
//DebugHelper.LogWarning("[TableName: {0}]lineArray {1}",name, lineArray[0]);
string[] indexname = lineArray[1].Split(splitword[0]);
//string[] indexname = lineArray[1].Split(splitword[0]);
string[] indexname = ManualCsvParse(lineArray[1]);
Dictionary<string, Dictionary<string, string>> Table = new Dictionary<string, Dictionary<string, string>>(lineArray.Length);
int linelength = 0;
for (int i = linestart; i < lineArray.Length; ++i)
{
charArray = lineArray[i].Split(splitword[0]);
//charArray = lineArray[i].Split(splitword[0]);
charArray = ManualCsvParse(lineArray[i]);
linelength = charArray.Length;
if (linelength > 0 && charArray[0] == string.Empty)
{