gitxsm 7 месяцев назад
Родитель
Сommit
e19fafe1ba

+ 3 - 1
script/common/ProtoID.lua

@@ -1638,4 +1638,6 @@ _ENV[1677]="GC_AREABATTLE_MATCHLIST_QUERY"
 _ENV[1678]="CG_AREABATTLE_COMBATVIDEO_QUERY"
 _ENV[1679]="GC_GODSAREA_QUERY_COMBATVIDEO"
 _ENV[1680]="CG_AREABATTLE_REWARD_QUERY"
-_ENV[1681]="GC_AREABATTLE_REWARD_QUERY"
+_ENV[1681]="GC_AREABATTLE_REWARD_QUERY"
+
+_ENV[1682]="GC_SKIN_DATA_QUERY"

+ 76 - 8
script/module/present/HeroSkinLogic.lua

@@ -55,18 +55,83 @@ local function genSkinUnit(human,id)
     }
 end
 
+
+local function populateMsg(human, net, id)
+    local cfg = HeroSkinExcel[id]
+    local skinId = cfg.content[1]
+    local skinCfg = SkinExcel[skinId]
+    local iconframeId = cfg.content[2]
+    local iconframeCfg = HeadFrameExcel[iconframeId]
+
+    net.id = id
+    net.skinId = skinId
+    net.headId = iconframeId
+    net.headDesc = iconframeCfg.desc or ""
+    net.headKeepTime = iconframeCfg.keepTime
+    net.headName = iconframeCfg.name or ""
+    net.headCamp = iconframeCfg.camp or 0
+
+    BuyLogic.fontBuyItem(human, net.buyItem, cfg.buyId)
+
+    net.skinAttr[0] = #skinCfg.attrs
+    for i, attrInfo in ipairs(skinCfg.attrs) do
+        net.skinAttr[i].key = attrInfo[1]
+        net.skinAttr[i].value = attrInfo[2]
+    end
+
+    net.headAttr[0] = #iconframeCfg.attrs
+    for i, attrInfo in ipairs(iconframeCfg.attrs) do
+        net.headAttr[i].key = attrInfo[1]
+        net.headAttr[i].value = attrInfo[2]
+    end
+end
+
+
+
 -----------------------------------------
 
 function query(human,panelId)
+    local retLen = 0
     local ret = {}
     for id,cfg in pairs(HeroSkinExcel) do
         if cfg.panelId == panelId then
-            ret[#ret+1] = genSkinUnit(human,id)
+            -- ret[#ret+1] = genSkinUnit(human,id)
+            retLen = retLen + 1
+            ret[retLen] = id
         end
     end
-    return {
-        list = ret
-    }
+    -- return {
+    --     list = ret
+    -- }
+
+    local msgRet = Msg.gc.GC_SKIN_DATA_QUERY
+    msgRet.ret = GC_SKIN_QUERY
+    msgRet.isEnd = 0
+    local len, msgMaxLen = 0, 20
+
+    for _, id in ipairs(ret) do
+        len = len + 1
+        populateMsg(human, msgRet.skinData[len], id)
+
+        if len >= msgMaxLen then
+            msgRet.skinData[0] = len
+            retLen = retLen -  len
+
+            if retLen <= 0 then
+                msgRet.isEnd = 1
+                return Msg.send(msgRet,human.fd)
+            end
+
+            len = 0
+        end
+    end
+
+    if len > 0 then
+        msgRet.skinData[0] = len
+        msgRet.isEnd = 1
+        Msg.send(msgRet,human.fd)
+    end
+
 end
 
 function buy(human,buyId)
@@ -82,10 +147,12 @@ function buy(human,buyId)
     SkinLogic.skinUnlock(human,skinCfg.content[1]) --BagLogic.addItemList(human,skinCfg.content,"skin_buy")
     RoleHeadLogic.active(human,RoleHeadLogic.HEAD_TYPE_2,skinCfg.content[2])
     --刷新
-    local data=query(human,skinCfg.panelId)
-    RefreshClient(human,GC_SKIN_QUERY,data)
+    -- local data=query(human,skinCfg.panelId)
+    -- RefreshClient(human,GC_SKIN_QUERY,data)
+    query(human,skinCfg.panelId)
 end
 
+
 function RefreshClient(human,type,data) 
     local msgRet = Msg.gc.GC_ROLE_CHANGE_BASEINFO
     msgRet.ret = type
@@ -135,8 +202,9 @@ function BuySkinBySuiPian(human, nSkinID, nItemID)
     SkinLogic.skinUnlock(human,skinCfg.content[1]) --BagLogic.addItemList(human,skinCfg.content,"skin_buy")
     RoleHeadLogic.active(human,RoleHeadLogic.HEAD_TYPE_2,skinCfg.content[2])
     --刷新
-    local data=query(human,skinCfg.panelId)
-    RefreshClient(human,GC_SKIN_QUERY,data)
+    -- local data=query(human,skinCfg.panelId)
+    -- RefreshClient(human,GC_SKIN_QUERY,data)
+    query(human,skinCfg.panelId)
 
     BagLogic.delItem(human, nItemID, 1, "item_use")
 end

+ 6 - 5
script/module/role/NewLogic.lua

@@ -213,11 +213,12 @@ local handler = {
     [CG_SKIN_QUREY] = function(human,param)
         local panelId = assert(tonumber(param),"invalid param")
         local heroSkinLogic = require"present.HeroSkinLogic"
-        local data = heroSkinLogic.query(human,panelId)
-        if not data then 
-            return
-        end
-        PushClient(human,GC_SKIN_QUERY,data)
+        -- local data = heroSkinLogic.query(human,panelId)
+        -- if not data then 
+        --     return
+        -- end
+        -- PushClient(human,GC_SKIN_QUERY,data)
+        heroSkinLogic.query(human,panelId)
     end,
 }
 

+ 22 - 0
script/module/role/Proto.lua

@@ -1,3 +1,4 @@
+local BuyItem = require("topup.Proto").BuyItem
 
 Attr = {
 	{"key",		1,	"short"},
@@ -94,6 +95,27 @@ GC_ROLE_CHANGE_BASEINFO = {
 	{"tip",			1,		"string"},
 }
 
+
+SKIN_DATA = {
+	{"id",				1,		"int"},
+	{"buyItem",     	1, 		BuyItem},
+	{"skinId",			1,		"int"},
+	{"skinAttr",		4,		Attr},
+	{"headId",			1,		"int"},
+	{"headDesc",		1,		"string"},
+	{"headKeepTime",	1,		"int"},
+	{"headName",		1,		"string"},
+	{"headCamp",		1,		"int"},
+	{"headAttr",		4,		Attr},
+}
+
+
+GC_SKIN_DATA_QUERY = {
+	{"ret",			1,		"byte"},
+	{"skinData",	20,		SKIN_DATA},
+	{"isEnd",		1,		"byte"},	-- 数据发完标识, 0 - 没有, 1 - 发完
+}
+
 -- 头像设置查询
 CG_ROLE_HEAD_QUERY = {
 	{"type",		1, "byte"},