Commit a608cccb384d2a9f7713cdb6e5c3a23466c3fb16

Authored by chenyueqi
1 parent 19d3f079

引导服务端记录

src/actions/RoleAction.lua
@@ -116,14 +116,14 @@ function _M.loginRpc( agent, data ) @@ -116,14 +116,14 @@ function _M.loginRpc( agent, data )
116 end 116 end
117 if msg.deviceMode then 117 if msg.deviceMode then
118 local deviceMode = tostring(msg.deviceMode) 118 local deviceMode = tostring(msg.deviceMode)
119 - if self:getProperty("dmode") ~= deviceMode then  
120 - self:setProperty("dmode", deviceMode) 119 + if role:getProperty("dmode") ~= deviceMode then
  120 + role:setProperty("dmode", deviceMode)
121 end 121 end
122 end 122 end
123 if msg.device then 123 if msg.device then
124 local device = tostring(msg.device) 124 local device = tostring(msg.device)
125 - if self:getProperty("device") ~= device then  
126 - self:setProperty("device", device) 125 + if role:getProperty("device") ~= device then
  126 + role:setProperty("device", device)
127 end 127 end
128 end 128 end
129 129
@@ -299,7 +299,7 @@ function _M.createRpc(agent, data) @@ -299,7 +299,7 @@ function _M.createRpc(agent, data)
299 sid = msg.subId or 0, 299 sid = msg.subId or 0,
300 name = roleName, 300 name = roleName,
301 uname = msg.uname or "", 301 uname = msg.uname or "",
302 - device = tostring(msg.device) 302 + device = tostring(msg.device),
303 dmode = msg.deviceMode and tostring(msg.deviceMode) or nil 303 dmode = msg.deviceMode and tostring(msg.deviceMode) or nil
304 }) 304 })
305 305
@@ -1002,17 +1002,17 @@ function _M.guideRpc(agent, data) @@ -1002,17 +1002,17 @@ function _M.guideRpc(agent, data)
1002 local cmdType = msg.cmdType 1002 local cmdType = msg.cmdType
1003 1003
1004 local funcGuide = role:getProperty("funcGuide") 1004 local funcGuide = role:getProperty("funcGuide")
1005 - local newerGuide = role:getProperty("newerGuide")  
1006 if cmdType == 1 then 1005 if cmdType == 1 then
1007 -- 新手引导 1006 -- 新手引导
1008 local master = msg.master or -1 1007 local master = msg.master or -1
1009 local slave = msg.slave or -1 1008 local slave = msg.slave or -1
1010 if master < 0 or slave < 0 then return end 1009 if master < 0 or slave < 0 then return end
1011 - newerGuide = string.format("%d=%d",master,slave)  
1012 - role:updateProperty({field = "newerGuide", value = newerGuide})  
1013 - role:log("guide", {desc = "guide_new",int1 = master*1000+slave}) 1010 +
  1011 + role:saveGuide(master, slave)
  1012 + funcGuide = funcGuide:setv(master * 1000 + slave, 1)
  1013 + role:updateProperty({field = "funcGuide", value = funcGuide})
1014 elseif cmdType == 2 then 1014 elseif cmdType == 2 then
1015 - -- 系统引导 1015 + -- 系统引导(玩家可选择是否进行)
1016 if not msg.skip then return end 1016 if not msg.skip then return end
1017 local new = math.min(funcGuide:getv(0, 0), msg.skip) 1017 local new = math.min(funcGuide:getv(0, 0), msg.skip)
1018 if new < 0 then 1018 if new < 0 then
@@ -1023,15 +1023,23 @@ function _M.guideRpc(agent, data) @@ -1023,15 +1023,23 @@ function _M.guideRpc(agent, data)
1023 1023
1024 if msg.funcType then 1024 if msg.funcType then
1025 funcGuide = funcGuide:setv(msg.funcType, 1) 1025 funcGuide = funcGuide:setv(msg.funcType, 1)
1026 - role:log("guide", {desc = "guide_sys", int1 = msg.funcType}) 1026 + role:log("guide", {desc = "guide_weak", int1 = msg.funcType})
1027 end 1027 end
1028 role:updateProperty({field = "funcGuide", value = funcGuide}) 1028 role:updateProperty({field = "funcGuide", value = funcGuide})
1029 elseif cmdType == 3 then 1029 elseif cmdType == 3 then
1030 - -- 弱引导 1030 + -- 系统引导(强制进行)
  1031 + if msg.funcType and csvdb["guide_unlockCsv"][msg.funcType] then
  1032 + role:saveGuide(csvdb["guide_unlockCsv"][msg.funcType].guideId,1)
  1033 + funcGuide = funcGuide:setv(msg.funcType, 1)
  1034 + role:updateProperty({field = "funcGuide", value = funcGuide})
  1035 + role:log("guide", {desc = "guide_sys", int1 = funcIdx})
  1036 + end
  1037 + elseif cmdType == 4 then
  1038 + -- 弹出一个tips(进入功能界面也许要自动弹说明,value要区分1、2)
1031 if msg.funcType then 1039 if msg.funcType then
1032 local value = msg.value or 1 1040 local value = msg.value or 1
1033 for _, funcIdx in pairs(msg.funcType:toArray(true,"=")) do 1041 for _, funcIdx in pairs(msg.funcType:toArray(true,"=")) do
1034 - role:log("guide", {desc = "guide_weak", int1 = funcIdx}) 1042 + role:log("guide", {desc = "guide_tips", int1 = funcIdx})
1035 funcGuide = funcGuide:setv(funcIdx, value) 1043 funcGuide = funcGuide:setv(funcIdx, value)
1036 end 1044 end
1037 role:updateProperty({field = "funcGuide", value = funcGuide}) 1045 role:updateProperty({field = "funcGuide", value = funcGuide})
src/models/Role.lua
@@ -39,7 +39,7 @@ Role.schema = { @@ -39,7 +39,7 @@ Role.schema = {
39 sid = {"number", 0}, 39 sid = {"number", 0},
40 device = {"string", ""}, 40 device = {"string", ""},
41 dmode = {"string", ""}, 41 dmode = {"string", ""},
42 - lday = {"string", 0}, 42 + lday = {"number", 0},
43 banTime = {"number", 0}, 43 banTime = {"number", 0},
44 banType = {"number", 0}, 44 banType = {"number", 0},
45 heartWarning = {"number", 0}, 45 heartWarning = {"number", 0},
src/models/RolePlugin.lua
@@ -1601,6 +1601,36 @@ function RolePlugin.bind(Role) @@ -1601,6 +1601,36 @@ function RolePlugin.bind(Role)
1601 self.sendMailFlag = true 1601 self.sendMailFlag = true
1602 end 1602 end
1603 1603
  1604 + -- 保存引导步骤
  1605 + function Role:saveGuide(master,slave)
  1606 + local newerGuide = self:getProperty("newerGuide")
  1607 + local guide = newerGuide:toArray(true,"=")
  1608 + local sMaster, sSlave = guide[1], guide[2]
  1609 +
  1610 + if master < sMaster and slave < sSlave then return end
  1611 +
  1612 + local guideCsv = csvdb["guide_mainCsv"]
  1613 + if not guideCsv[master] or not guideCsv[master][slave] then return end
  1614 + self:log("guide", {desc = "guide_new",int1 = master*1000+slave})
  1615 +
  1616 + newerGuide = string.format("%d=%d",master,slave)
  1617 + self:updateProperty({field = "newerGuide", value = newerGuide})
  1618 + end
  1619 +
  1620 + -- 引导大步骤结束
  1621 + function Role:finishGuide(master)
  1622 + local newerGuide = self:getProperty("newerGuide")
  1623 + local guide = newerGuide:toArray(true,"=")
  1624 + if guide[1] > master then return end
  1625 +
  1626 + local guideCsv = csvdb["guide_mainCsv"]
  1627 + local lastStep = guideCsv[master][#guideCsv[master]]
  1628 + if guideCsv[master + 1] then
  1629 + self:updateProperty({field = "newerGuide", value = string.format("%d=%d",master + 1,1)})
  1630 + else
  1631 + self:updateProperty({field = "newerGuide", value = "9999=1"})
  1632 + end
  1633 + end
1604 end 1634 end
1605 1635
1606 return RolePlugin 1636 return RolePlugin
1607 \ No newline at end of file 1637 \ No newline at end of file