UIChat:聊天剧情奖励

This commit is contained in:
fatiao 2025-11-05 18:34:10 +08:00
parent 430ef3c6d7
commit e206da8ffc
6 changed files with 113 additions and 14 deletions

View File

@ -592,6 +592,7 @@ local UIEventNames = {
EID_FRUIT_SETTLE = id(),
EID_DANMU_INPUT_NTF = id(),
EID_CHAT_STORY_REWARD = id()
}
return UIEventNames

View File

@ -53,6 +53,9 @@ function StoryData:RegisterNetEvents()
ManagerContainer.NetManager:NetRegister(ProtoMsgId.SC_ROLE_STORY_ACK, function(data)
if data.error == Enum.NetErrorCode.ERROR_OK then
self:RefreshStoryData(data.story_id)
if data.story_rewards and #data.story_rewards > 0 then
ManagerContainer.LuaEventMgr:Dispatch(UIEventNames.EID_CHAT_STORY_REWARD, data.story_rewards)
end
end
end)
ManagerContainer.NetManager:NetRegister(ProtoMsgId.SC_NEW_MAP_CARTOON_ACK, function(data)
@ -126,15 +129,30 @@ function StoryData:GetStateStoryChapterId(id)
end
function StoryData:IsRecord(storyId)
if self.data.storyDatas[storyId] and self.data.storyDatas[storyId]==1 then
if self.data.storyDatas[storyId] and self.data.storyDatas[storyId] > 0 then
return true
end
return false
end
function StoryData:Record(storyId, idx)
self.data.storyDatas[storyId] = idx
ManagerContainer.NetManager:SendMessage(ProtoMsgId.CS_ROLE_STORY_REQ, {story_id = {key = storyId, value = idx or 0}})
local STORY_GET_REWARD_TAG = 8
function StoryData:IsGetReward(storyId)
if self.data.storyDatas[storyId] and self.data.storyDatas[storyId] == STORY_GET_REWARD_TAG then
return true
end
return false
end
function StoryData:RecordGetReward(storyId)
self:Record(storyId, STORY_GET_REWARD_TAG)
end
function StoryData:Record(storyId, val)
if self.data.storyDatas[storyId] and val < self.data.storyDatas[storyId] then
return
end
self.data.storyDatas[storyId] = val
ManagerContainer.NetManager:SendMessage(ProtoMsgId.CS_ROLE_STORY_REQ, {story_id = {key = storyId, value = val or 0}})
end

View File

@ -1,5 +1,5 @@
äÌ
ÞÛ
login.proto serverproto
user.proto"0
@ -701,14 +701,15 @@ param_list ( R paramList"o
SCPlayerBattleRecordAck
error (Rerror>
record_list ( 2.serverproto.BattleRecordInfoR
recordList"Ž
recordList"É
SCPlayerBattleDataChangeNtf(
last_income_time (RlastIncomeTime
map_level ( RmapLevel
map_id ( RmapId&
max_income_time (R maxIncomeTime?
quick_battle ( 2.serverproto.QuickBattleDataR quickBattle(
reward_map_count ( RrewardMapCount"
reward_map_count ( RrewardMapCount9
fruit_income_reward_point ( RfruitIncomeRewardPoint"
CSGetMapRankReq"¨
SCGetMapRankAck
error (Rerror
@ -982,10 +983,11 @@ targetName"u
Story (RStory4
map_cart ( 2.serverproto.KeyValueTypeRmapCart"F
CSRoleStoryReq4
story_id ( 2.serverproto.KeyValueTypeRstoryId"\
story_id ( 2.serverproto.KeyValueTypeRstoryId"œ
SCRoleStoryAck
error (Rerror4
story_id ( 2.serverproto.KeyValueTypeRstoryId"J
story_id ( 2.serverproto.KeyValueTypeRstoryId>
story_rewards ( 2.serverproto.KeyValueTypeR storyRewards"J
CSNewMapCartoonReq4
map_cart ( 2.serverproto.KeyValueTypeRmapCart"`
SCNewMapCartoonAck
@ -2672,4 +2674,66 @@ rewardList"M
exp (Rexp
group (Rgroup"O
SCLevelupSummonStartupNtf2
info ( 2.serverproto.LevelupSummonInfoRinfobproto3
info ( 2.serverproto.LevelupSummonInfoRinfo"V
CSFruitJoinReq
uid (Ruid
room_no (RroomNo
chip_num (RchipNum"ì
SCFruitJoinAck
uid (Ruid
error (Rerror
stage (Rstage
sec (Rsec
my_chip_num (R myChipNum"
pool_chip_num (R poolChipNum@
total_bet_info ( 2.serverproto.FruitSlotInfoR totalBetInfo:
my_bet_info ( 2.serverproto.FruitSlotInfoR myBetInfo%
settle_history (R settleHistory(
curr_award_slots
(RcurrAwardSlots(
curr_target_slot (RcurrTargetSlotM
player_award_rank ( 2!.serverproto.FruitPlayerAwardInfoRplayerAwardRank"<
CSFruitLeaveReq
uid (Ruid
room_no (RroomNo"9
SCFruitLeaveAck
uid (Ruid
error (Rerror"X
CSFruitBetReq
uid (Ruid5
bet_info ( 2.serverproto.FruitSlotInfoRbetInfo"ù
SCFruitBetAck
uid (Ruid
error (Rerror
my_chip_num (R myChipNum"
pool_chip_num ( R poolChipNum@
total_bet_info ( 2.serverproto.FruitSlotInfoR totalBetInfo:
my_bet_info ( 2.serverproto.FruitSlotInfoR myBetInfo"ÿ
SCFruitSettleNtf
uid (Ruid
my_chip_num (R myChipNum
award_type (R awardType$
award_chip_num (R awardChipNum
award_slots (R
awardSlotsB
award_chip_info ( 2.serverproto.FruitSlotInfoR awardChipInfo%
settle_history (R settleHistory
start_slot (R startSlot
target_slot (R
targetSlot(
add_reward_point
( RaddRewardPoint"&
SCFruitStartBetNtf
uid (Ruid"<22>
SCFruitSecTickNtf
uid (Ruid
sec (Rsec"
pool_chip_num ( R poolChipNum@
total_bet_info ( 2.serverproto.FruitSlotInfoR totalBetInfo"
SCFruitPlayerAwardRankNtf
uid (Ruid
award_type (R awardTypeM
player_award_rank ( 2!.serverproto.FruitPlayerAwardInfoRplayerAwardRankbproto3

View File

@ -1,5 +1,5 @@
<EFBFBD>Û
ÞÛ
login.proto serverproto
user.proto"0
@ -983,10 +983,11 @@ targetName"u
Story (RStory4
map_cart ( 2.serverproto.KeyValueTypeRmapCart"F
CSRoleStoryReq4
story_id ( 2.serverproto.KeyValueTypeRstoryId"\
story_id ( 2.serverproto.KeyValueTypeRstoryId"œ
SCRoleStoryAck
error (Rerror4
story_id ( 2.serverproto.KeyValueTypeRstoryId"J
story_id ( 2.serverproto.KeyValueTypeRstoryId>
story_rewards ( 2.serverproto.KeyValueTypeR storyRewards"J
CSNewMapCartoonReq4
map_cart ( 2.serverproto.KeyValueTypeRmapCart"`
SCNewMapCartoonAck

View File

@ -239,6 +239,10 @@ function UIChatCtr:OnStoryChatFinish()
-- end
end
function UIChatCtr:GetStoryChatReward(storyId)
ManagerContainer.DataMgr.StoryData:Record(storyId, 8)
end
function UIChatCtr:GetCurrStoryPerformCfgId(storyId)
return self.currStoryPerformCfgId
end

View File

@ -57,6 +57,13 @@ function UIChatView:AddEventListener()
self:RefreshMessageTab()
self:RefreshChatLayer2(channelId)
end)
ManagerContainer.LuaEventMgr:RegisterUIEvent(self.uiData.name, UIEventNames.EID_CHAT_STORY_REWARD, function(story_rewards)
local rewards = {}
for k, v in pairs(story_rewards) do
table.insert(rewards,{cfgId = v.key, num = v.value})
end
ManagerContainer.LuaUIMgr:Open(Enum.UIPageName.UIPOPGot, {rewards = rewards})
end)
end
function UIChatView:FillContent(data, uiBase)
@ -721,7 +728,7 @@ function UIChatView:RefreshMessageTab()
local worldTitle = "世界"
local worldSubTitle = "给世界发一条消息吧!"
if #worldHeadIcons > 0 then
if #worldHeadIcons > 0 and worldChats[#worldChats].fromData then
worldSubTitle = worldChats[#worldChats].fromData.nickname..": "..worldChats[#worldChats].message.message
else
worldHeadIcons = {"Heads/head_100102"}
@ -768,6 +775,7 @@ function UIChatView:RefreshMessageTab()
for i = 1, #storyChatDatas do
local storyCfg = storyChatDatas[i]
local firstStoryPerformCfg = ManagerContainer.CfgMgr:GetFirstStoryPerformCfg(storyCfg.StoryId)
LogError("firstStoryPerformCfg: "..Inspect(firstStoryPerformCfg))
local headImg, name
if firstStoryPerformCfg.SpeakSite == 1 then
headImg = firstStoryPerformCfg.LeftImg
@ -1011,6 +1019,7 @@ function UIChatView:EnterChatLayer2(channelId, storyData)
self.chatLayer2.titleBarReturnBtn.button.interactable = true
end
local storyRecordDatas = ManagerContainer.DataMgr.StoryData:GetStoryDatas()
LogError("storyRecordDatas: "..Inspect(storyRecordDatas))
if true or not storyRecordDatas[storyData.StoryId] then
self:SetUIStoryMode(true)
self.controller:StartStoryChat(storyData.Id, newMessageNtfFunc, chatInputNtfFunc, storyPlayFinishNtfFunc, true)
@ -1019,6 +1028,8 @@ function UIChatView:EnterChatLayer2(channelId, storyData)
self:SetUIStoryMode(false)
end
self:RefreshChatLayer2(channelId, storyData)
self.controller:GetStoryChatReward(storyData.StoryId)
else
self:SetUIStoryMode(false)
self:RefreshChatLayer2(channelId, storyData)