diff --git a/lua_probject/extend_project/extend/majiang/changsha/EXClearingView.lua b/lua_probject/extend_project/extend/majiang/changsha/EXClearingView.lua index aa59ffac..fe464984 100644 --- a/lua_probject/extend_project/extend/majiang/changsha/EXClearingView.lua +++ b/lua_probject/extend_project/extend/majiang/changsha/EXClearingView.lua @@ -8,7 +8,7 @@ local M = CS_ClearingView function CS_ClearingView.new(blur_view) setmetatable(M, {__index = ResultView}) local self = setmetatable({}, {__index = M}) - self._full = true + -- self._full = true ResultView.init(self, "ui://Main_Majiang/clearing") self._currenIndex = 0 @@ -322,11 +322,11 @@ function M:FillItemData(room, data, item, active_player) -- local total_score = data["total_score"] if total >= 0 then - item:GetChild("score2").text = "+"..total - item:GetChild("score2").grayed = false + item:GetChild("score2win").text = "+" .. total + -- item:GetChild("score2win").grayed = false else - item:GetChild("score2").text = total - item:GetChild("score2").grayed = true + item:GetChild("score2lose").text = total + -- item:GetChild("score2win").grayed = true end local hp_nonnegative = room:checkHpNonnegative() diff --git a/lua_probject/extend_project/extend/majiang/changsha/EXGameInfo.lua b/lua_probject/extend_project/extend/majiang/changsha/EXGameInfo.lua index c4f1e4d4..6ca17db7 100644 --- a/lua_probject/extend_project/extend/majiang/changsha/EXGameInfo.lua +++ b/lua_probject/extend_project/extend/majiang/changsha/EXGameInfo.lua @@ -4,332 +4,351 @@ local M = EXGameInfo function EXGameInfo.new(blur_view) - setmetatable(M, { __index = IGameInfo }) - local self = setmetatable({}, { __index = M }) - self.class = "EXGameInfo" - - UIPackage.AddPackage("extend/majiang/changsha/ui/Info_MJ_ChangSha") - return self + setmetatable(M, {__index = IGameInfo}) + local self = setmetatable({}, {__index = M}) + self.class = "EXGameInfo" + + UIPackage.AddPackage("extend/majiang/changsha/ui/Info_MJ_ChangSha") + return self end function M:FillData() - self._maxPlayer = 4 -- 默认玩家人数 - self._roundChoice = 4 -- 回合选项数 - if oldGameVersion == 1 then + self._maxPlayer = 4 -- 默认玩家人数 + self._roundChoice = 4 -- 回合选项数 + if oldGameVersion==1 then self._config = UIPackage.CreateObjectFromURL("ui://Info_MJ_ChangSha/Cgm_create_room") else self._config = UIPackage.CreateObjectFromURL("ui://Info_MJ_ChangSha/Cgm_create_room_yueyang") end - - if oldGameVersion == 2 then - self._config:GetController("xipai").selectedIndex = 0 - - self.xipaiValueText = self._config:GetChild('xipaifen') - self.xipaiValueText.text = 1 - self.xipaiValue = 1 - - self.anchouValueText = self._config:GetChild('anchoufen') - self.anchouValueText.text = 1 - self.anchouValue = 1 + + if oldGameVersion==2 then + self._config:GetController("xipai").selectedIndex=0 + + self.xipaiValueText=self._config:GetChild('xipaifen') + self.xipaiValueText.text=1 + self.xipaiValue=1 + + self.anchouValueText=self._config:GetChild('anchoufen') + self.anchouValueText.text=1 + self.anchouValue=1 local btn_cr = self._config:GetChild('sdsrbtn') - btn_cr.onClick:Set( - function() - local gniv = GroupNumberInputView_Game.new(nil, function(num) - local value = limit - if otype == 1 then - value = value + ad2d(num) - elseif otype == -1 then - value = value - ad2d(num) - else - value = ad2d(num) - end - - if value < 0 then - ViewUtil.ErrorTip(1, "输入数据异常!") - end - - self.xipaiValueText.text = value / 100 - self.xipaiValue = value / 100 - end, 3, nil) - gniv:Show() - end - ) + btn_cr.onClick:Set( + function() + + local gniv = GroupNumberInputView_Game.new(nil, function(num) + + local value = limit + if otype == 1 then + value = value + ad2d(num) + elseif otype == - 1 then + value = value - ad2d(num) + else + value = ad2d(num) + end + + if value < 0 then + ViewUtil.ErrorTip(1,"输入数据异常!") + end + + self.xipaiValueText.text=value/d2ad + self.xipaiValue=value/d2ad + + end, 3, nil) + gniv:Show() + + + end + ) - local btn_cr2 = self._config:GetChild('anchoubtn') - btn_cr2.onClick:Set( - function() - local gniv = GroupNumberInputView_Game.new(nil, function(num) - local value = limit - if otype == 1 then - value = value + ad2d(num) - elseif otype == -1 then - value = value - ad2d(num) - else - value = ad2d(num) - end - - if value < 0 then - ViewUtil.ErrorTip(1, "输入数据异常!") - end - - self.anchouValueText.text = value / 100 - self.anchouValue = value / 100 - end, 3, nil) - gniv:Show() - end - ) + local btn_cr2 = self._config:GetChild('anchoubtn') + btn_cr2.onClick:Set( + function() + + local gniv = GroupNumberInputView_Game.new(nil, function(num) + + local value = limit + if otype == 1 then + value = value + ad2d(num) + elseif otype == - 1 then + value = value - ad2d(num) + else + value = ad2d(num) + end + + if value < 0 then + ViewUtil.ErrorTip(1,"输入数据异常!") + end + + self.anchouValueText.text=value/d2ad + self.anchouValue=value/d2ad + + end, 3, nil) + gniv:Show() + + + end + ) + end -end + +end -local _help_url = "ui://Info_MJ_ChangSha/Com_help" +local _help_url= "ui://Info_MJ_ChangSha/Com_help" function M:GetHelpUrl() - return _help_url + return _help_url end local _icon_url = "ui://Info_MJ_ChangSha/icon" function M:GetIconUrl() - return _icon_url + return _icon_url end local _icon_url1 = "ui://Info_MJ_ChangSha/icon1" function M:GetIconUrl1() - return _icon_url1 + return _icon_url1 end -local _play_list = {} --{"长沙麻将","三人长沙","二人长沙"} +local _play_list ={} --{"长沙麻将","三人长沙","二人长沙"} function M:GetPlayList() - return _play_list + return _play_list end function M:SelectedConfigData() - local _config = self._config - local round = _config:GetController("round").selectedIndex + 1 --== 0 and 1 or 2 - self._maxPlayer = _config:GetController("play_list").selectedIndex + 2 + local _config = self._config + local round = _config:GetController("round").selectedIndex + 1 --== 0 and 1 or 2 + self._maxPlayer = _config:GetController("play_list").selectedIndex+2 - local zhuangxian = _config:GetChild("btn_zhuangxian").selected and true or false - -- local piaofen = _config:GetChild("btn_piaofen").selected and true or false - local zimo = _config:GetChild("btn_zimo").selected and true or false - local AA = _config:GetController("Cost").selectedIndex - -- local liuliushun = _config:GetChild("btn_liuliushun").selected and true or false - -- local queyise = _config:GetChild("btn_queyise").selected and true or false - -- local banbanhu = _config:GetChild("btn_banbanhu").selected and true or false - -- local dasixi = _config:GetChild("btn_dasixi").selected and true or false - local jiejiegao = _config:GetChild("btn_jiejiegao").selected and true or false - local santong = _config:GetChild("btn_santong").selected and true or false - local yizhihua = _config:GetChild("btn_yizhihua").selected and true or false - local zhongtusixi = _config:GetChild("btn_zhongtusixi").selected and true or false - local zhongtuliuliushun = _config:GetChild("btn_zhongtuliuliushun").selected and true or false + local zhuangxian = _config:GetChild("btn_zhuangxian").selected and true or false + -- local piaofen = _config:GetChild("btn_piaofen").selected and true or false + local zimo = _config:GetChild("btn_zimo").selected and true or false + local AA = _config:GetController("Cost").selectedIndex + -- local liuliushun = _config:GetChild("btn_liuliushun").selected and true or false + -- local queyise = _config:GetChild("btn_queyise").selected and true or false + -- local banbanhu = _config:GetChild("btn_banbanhu").selected and true or false + -- local dasixi = _config:GetChild("btn_dasixi").selected and true or false + local jiejiegao = _config:GetChild("btn_jiejiegao").selected and true or false + local santong = _config:GetChild("btn_santong").selected and true or false + local yizhihua = _config:GetChild("btn_yizhihua").selected and true or false + local zhongtusixi = _config:GetChild("btn_zhongtusixi").selected and true or false + local zhongtuliuliushun = _config:GetChild("btn_zhongtuliuliushun").selected and true or false - local niao_type = _config:GetController("niao").selectedIndex - local niao_num = _config:GetController("niao_num").selectedIndex - local niao_db_num = _config:GetController("niao_db_num").selectedIndex - local niao = niao_type == 1 and (niao_db_num == 0 and 1 or 2) or - (niao_type == 0 and (niao_num == 0 and 2 or (niao_num == 1 and 4 or 6)) or 2) - local piao_niao = _config:GetChild("btn_piao_niao").selected - local two_pair = _config:GetChild("btn_two_pair").selected - local no_jiang = _config:GetChild("btn_no_jiang").selected - local four_win = _config:GetChild("btn_four_win").selected - local native_hu = _config:GetChild("btn_native_hu").selected - local queyimen = _config:GetChild("btn_queyimen").selected - local fengding = _config:GetChild("btn_fengding").selected - local banyiquan = _config:GetChild("btn_banyiquan").selected - local menqing = _config:GetChild("btn_menqing").selected + local niao_type = _config:GetController("niao").selectedIndex + local niao_num = _config:GetController("niao_num").selectedIndex + local niao_db_num = _config:GetController("niao_db_num").selectedIndex + local niao = niao_type == 1 and (niao_db_num == 0 and 1 or 2) or (niao_type == 0 and (niao_num == 0 and 2 or (niao_num == 1 and 4 or 6)) or 2) + local piao_niao = _config:GetChild("btn_piao_niao").selected + local two_pair = _config:GetChild("btn_two_pair").selected + local no_jiang = _config:GetChild("btn_no_jiang").selected + local four_win = _config:GetChild("btn_four_win").selected + local native_hu = _config:GetChild("btn_native_hu").selected + local queyimen = _config:GetChild("btn_queyimen").selected + + --获取封顶控制器状态 + local fengding_score = 0 + local fengding = false - local fengding_score = 0 if _config:GetController("fengding") then - fengding_score = _config:GetController("fengding").selectedIndex + fengding_score=_config:GetController("fengding").selectedIndex + -- 判断:0 为 false,1/2/3 等为 true + fengding = (fengding_score > 0) end - local piao_niao1 = 0 + local banyiquan = _config:GetChild("btn_banyiquan").selected + local menqing = _config:GetChild("btn_menqing").selected + local piao_niao1=0 if _config:GetController('piao') then - piao_niao1 = _config:GetController('piao').selectedIndex + piao_niao1=_config:GetController('piao').selectedIndex + end + local piao1=false + local piao2=false + local piao3=false + local piao_niao_opt=0 + if piao_niao1==2 then + piao_niao_opt=_config:GetController("piaofen").selectedIndex end - local piao1 = false - local piao2 = false - local piao3 = false - local piao_niao_opt = 0 - if piao_niao1 == 2 then - piao_niao_opt = _config:GetController("piaofen").selectedIndex - end - - local xi_pai = false - local xi_paifen = 0 + + local xi_pai=false + local xi_paifen=0 if _config:GetChild("xipai") then - xi_pai = _config:GetChild("xipai").selected + xi_pai=_config:GetChild("xipai").selected end - - local niaofen_opt = 0 - local niaofen_score = 1 - local difen_score = 1 - local kai_gong = 0 - if oldGameVersion == 2 then - niaofen_opt = _config:GetController("niaoadd").selectedIndex - niaofen_score = tonumber(_config:GetController("niaodf").selectedPage) - difen_score = tonumber(_config:GetController("jcdifen").selectedPage) - kai_gong = _config:GetController("kaigang").selectedIndex + + local niaofen_opt=0 + local niaofen_score=1 + local difen_score=1 + local kai_gong=0 + if oldGameVersion==2 then + niaofen_opt=_config:GetController("niaoadd").selectedIndex + niaofen_score= tonumber(_config:GetController("niaodf").selectedPage) + difen_score= tonumber(_config:GetController("jcdifen").selectedPage) + kai_gong=_config:GetController("kaigang").selectedIndex end + +--------- + local _data = {} + _data["opt"] = round + _data["maxPlayers"] = self._maxPlayer - --------- - local _data = {} - _data["opt"] = round - _data["maxPlayers"] = self._maxPlayer + _data["zhuangxian"] = zhuangxian + _data["zimo"] = zimo + _data["AA"] = AA + -- _data["piaofen"] = piaofen + -- _data["liuliushun"] = liuliushun + -- _data["queyise"] = queyise + -- _data["banbanhu"] = banbanhu + -- _data["dasixi"] = dasixi + _data["jiejiegao"] = jiejiegao + _data["santong"] = santong + _data["yizhihua"] = yizhihua + _data["zhongtusixi"] = zhongtusixi + _data["zhongtuliuliushun"] = zhongtuliuliushun - _data["zhuangxian"] = zhuangxian - _data["zimo"] = zimo - _data["AA"] = AA - -- _data["piaofen"] = piaofen - -- _data["liuliushun"] = liuliushun - -- _data["queyise"] = queyise - -- _data["banbanhu"] = banbanhu - -- _data["dasixi"] = dasixi - _data["jiejiegao"] = jiejiegao - _data["santong"] = santong - _data["yizhihua"] = yizhihua - _data["zhongtusixi"] = zhongtusixi - _data["zhongtuliuliushun"] = zhongtuliuliushun - - _data["niao_type"] = niao_type - - - if oldGameVersion == 1 then + _data["niao_type"] = niao_type + + + if oldGameVersion==1 then _data["niao"] = niao else _data["niao"] = tonumber(_config:GetController("niao_num").selectedPage) end - - - if oldGameVersion == 1 then + + + if oldGameVersion==1 then _data["piao_niao"] = piao_niao else _data["piao_niao"] = piao_niao1 end - _data["two_pair"] = two_pair - _data["no_jiang"] = no_jiang - _data["four_win"] = four_win - _data["native_hu"] = native_hu - _data["queyimen"] = queyimen - _data["fengding"] = fengding - _data["banyiquan"] = banyiquan - _data["menqing"] = menqing + _data["two_pair"] = two_pair + _data["no_jiang"] = no_jiang + _data["four_win"] = four_win + _data["native_hu"] = native_hu + _data["queyimen"] = queyimen + _data["fengding"] = fengding + _data["banyiquan"] = banyiquan + _data["menqing"] = menqing _data["fengding_score"] = fengding_score --_data['piao'] = piao _data['piao1'] = piao1 _data['piao2'] = piao2 _data['piao3'] = piao3 - - auto_piao = false - if piao_niao1 == 2 then + + auto_piao=false + if piao_niao1==2 then if piao1 or piao2 or piao3 then - auto_piao = true + auto_piao=true end end - - if oldGameVersion == 2 then + + if oldGameVersion==2 then _data['auto_piao'] = auto_piao end - + _data['xi_pai'] = xi_pai _data['piao_niao_opt'] = piao_niao_opt - - local xi_pai_score = 0 - local an_chou_score = 0 - if oldGameVersion == 2 then - xi_pai_score = self.xipaiValue - an_chou_score = self.anchouValue + + local xi_pai_score=0 + local an_chou_score=0 + if oldGameVersion==2 then + xi_pai_score=self.xipaiValue + an_chou_score=self.anchouValue end - - _data['xi_pai_score'] = xi_pai_score * 100 - _data['an_chou_score'] = an_chou_score * 100 - - if oldGameVersion == 2 then + + _data['xi_pai_score'] = ad2d(xi_pai_score) + _data['an_chou_score'] = ad2d(an_chou_score) + + if oldGameVersion==2 then _data['niaofen_opt'] = niaofen_opt _data['niaofen_score'] = niaofen_score _data['difen_score'] = difen_score _data['kai_gong'] = kai_gong + end - + pt(_data) - return _data -end + return _data +end + + function M:LoadConfigData(data) pt(data) - local _config = self._config - _config:GetController("round").selectedIndex = data.opt - 1 -- == 1 and 0 or 1 - _config:GetController("play_list").selectedIndex = data.maxPlayers - 2 + local _config = self._config + _config:GetController("round").selectedIndex = data.opt - 1 -- == 1 and 0 or 1 + _config:GetController("play_list").selectedIndex = data.maxPlayers-2 - _config:GetChild("btn_zhuangxian").selected = data.zhuangxian - _config:GetChild("btn_zimo").selected = data.zimo - _config:GetController("Cost").selectedIndex = data.AA - -- _config:GetChild("btn_piaofen").selected = data.piaofen - -- _config:GetChild("btn_liuliushun").selected = data.liuliushun - -- _config:GetChild("btn_queyise").selected = data.queyise - -- _config:GetChild("btn_banbanhu").selected = data.banbanhu - -- _config:GetChild("btn_dasixi").selected = data.dasixi - _config:GetChild("btn_jiejiegao").selected = data.jiejiegao - _config:GetChild("btn_santong").selected = data.santong - _config:GetChild("btn_yizhihua").selected = data.yizhihua - _config:GetChild("btn_zhongtusixi").selected = data.zhongtusixi - _config:GetChild("btn_zhongtuliuliushun").selected = data.zhongtuliuliushun + _config:GetChild("btn_zhuangxian").selected = data.zhuangxian + _config:GetChild("btn_zimo").selected = data.zimo + _config:GetController("Cost").selectedIndex = data.AA + -- _config:GetChild("btn_piaofen").selected = data.piaofen + -- _config:GetChild("btn_liuliushun").selected = data.liuliushun + -- _config:GetChild("btn_queyise").selected = data.queyise + -- _config:GetChild("btn_banbanhu").selected = data.banbanhu + -- _config:GetChild("btn_dasixi").selected = data.dasixi + _config:GetChild("btn_jiejiegao").selected = data.jiejiegao + _config:GetChild("btn_santong").selected = data.santong + _config:GetChild("btn_yizhihua").selected = data.yizhihua + _config:GetChild("btn_zhongtusixi").selected = data.zhongtusixi + _config:GetChild("btn_zhongtuliuliushun").selected = data.zhongtuliuliushun - _config:GetController("niao").selectedIndex = data.niao_type - - if oldGameVersion == 1 then - _config:GetController("niao_num").selectedIndex = data.niao_type ~= 0 and 0 or - (data.niao == 4 and 1 or (data.niao == 6 and 2 or 0)) + _config:GetController("niao").selectedIndex = data.niao_type + + if oldGameVersion==1 then + _config:GetController("niao_num").selectedIndex = data.niao_type ~= 0 and 0 or (data.niao == 4 and 1 or (data.niao == 6 and 2 or 0)) else - _config:GetController("niao_num").selectedIndex = data.niao / 2 - 1 + _config:GetController("niao_num").selectedIndex=data.niao/2-1 end - _config:GetController("niao_db_num").selectedIndex = data.niao_type ~= 1 and 0 or (data.niao == 1 and 0 or 1) - if oldGameVersion == 1 then + _config:GetController("niao_db_num").selectedIndex = data.niao_type ~= 1 and 0 or (data.niao == 1 and 0 or 1) + if oldGameVersion==1 then _config:GetChild("btn_piao_niao").selected = data.piao_niao end - _config:GetChild("btn_two_pair").selected = data.two_pair - _config:GetChild("btn_no_jiang").selected = data.no_jiang - _config:GetChild("btn_four_win").selected = data.four_win - _config:GetChild("btn_native_hu").selected = data.native_hu - _config:GetChild("btn_queyimen").selected = data.queyimen - _config:GetChild("btn_fengding").selected = data.fengding or false - _config:GetChild("btn_banyiquan").selected = data.banyiquan or false - _config:GetChild("btn_menqing").selected = data.menqing or false - - if _config:GetController("fengding") then - _config:GetController("fengding").selectedIndex = data.fengding_score + _config:GetChild("btn_two_pair").selected = data.two_pair + _config:GetChild("btn_no_jiang").selected = data.no_jiang + _config:GetChild("btn_four_win").selected = data.four_win + _config:GetChild("btn_native_hu").selected = data.native_hu + _config:GetChild("btn_queyimen").selected = data.queyimen + _config:GetChild("btn_fengding").selected = data.fengding or false + _config:GetChild("btn_banyiquan").selected = data.banyiquan or false + _config:GetChild("btn_menqing").selected = data.menqing or false + + if _config:GetController("fengding") then + _config:GetController("fengding").selectedIndex=data.fengding_score end - - if _config:GetController("piao") then - _config:GetController("piao").selectedIndex = data.piao_niao - _config:GetChild('pf1').selected = data.piao1 - _config:GetChild('pf2').selected = data.piao2 - _config:GetChild('pf3').selected = data.piao3 + + if _config:GetController("piao") then + _config:GetController("piao").selectedIndex=data.piao_niao + _config:GetChild('pf1').selected=data.piao1 + _config:GetChild('pf2').selected=data.piao2 + _config:GetChild('pf3').selected=data.piao3 end - - if _config:GetChild("xipai") then - _config:GetChild("xipai").selected = data.xi_pai + + if _config:GetChild("xipai") then + _config:GetChild("xipai").selected=data.xi_pai end - - if _config:GetController("piaofen") then - _config:GetController("piaofen").selectedIndex = data.piao_niao_opt + + if _config:GetController("piaofen") then + _config:GetController("piaofen").selectedIndex=data.piao_niao_opt end + + if oldGameVersion==2 then + self.xipaiValueText.text=data.xi_pai_score/d2ad(1000) + self.xipaiValue=data.xi_pai_score/d2ad(1000) - if oldGameVersion == 2 then - self.xipaiValueText.text = data.xi_pai_score / 100 - self.xipaiValue = data.xi_pai_score / 100 - - self.anchouValueText.text = data.an_chou_score / 100 - self.anchouValue = data.an_chou_score / 100 + self.anchouValueText.text=data.an_chou_score/d2ad(1000) + self.anchouValue=data.an_chou_score/d2ad(1000) end - - if oldGameVersion == 2 then - _config:GetController("niaoadd").selectedIndex = data.niaofen_opt or 0 - _config:GetController("niaodf").selectedIndex = data.niaofen_score - 1 - _config:GetController("jcdifen").selectedIndex = data.difen_score - 1 - _config:GetController("kaigang").selectedIndex = data.kai_gong + + if oldGameVersion==2 then + _config:GetController("niaoadd").selectedIndex=data.niaofen_opt or 0 + _config:GetController("niaodf").selectedIndex=data.niaofen_score-1 + _config:GetController("jcdifen").selectedIndex=data.difen_score-1 + _config:GetController("kaigang").selectedIndex=data.kai_gong end -end - -return M + + end + +return M + \ No newline at end of file diff --git a/lua_probject/extend_project/extend/majiang/changsha/EXMainView.lua b/lua_probject/extend_project/extend/majiang/changsha/EXMainView.lua index 2dd89b30..8aaf92a0 100644 --- a/lua_probject/extend_project/extend/majiang/changsha/EXMainView.lua +++ b/lua_probject/extend_project/extend/majiang/changsha/EXMainView.lua @@ -428,7 +428,7 @@ function M:EventInit() end) self._view:AddChild(tip_qishou) tip_qishou:Center() - self._com_qishou = tip_qishou + self._com_qishou = tip_qishou end) _gamectr:AddEventListener(CS_GameEvent.EvnetQSAction, function(...) @@ -671,6 +671,7 @@ function M:_ChiView(tiplist, callback) item_choose:GetChild("card2").icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "202_"..tem[2]) item_choose:GetChild("card4").icon = UIPackage.GetItemURL("Main_Majiang", self:GetPrefix() .. "202_"..tem[3]) local cardpos = tem[2] > tcard and 1 or (tem[2] < tcard and 4 or 2) + item_choose:GetChild("card" .. cardpos):GetController("color").selectedIndex = 1 end item_choose.onClick:Add(function() @@ -765,17 +766,54 @@ function M:__QsHu(data) local pNode = info._mask_liangpai self.QSHList={} coroutine.start(function() + -- 获取父节点的中心坐标,作为基准点 + local centerX = pNode.width * 0.5 + local centerY = pNode.height * 0.5 + + -- 计算所有提示框的总宽度,以便整体居中显示 + local totalWidth = 0 + local tipsTemp = {} -- 临时存储创建的对象,用于第二次遍历设置位置 + + -- 第一次遍历:创建对象并计算总宽度 for i, v in pairs(types) do local show_tip = UIPackage.CreateObject("Extend_MJ_ChangSha", "Tip_qishou") show_tip:GetChild("icon").url = "ui://Extend_MJ_ChangSha/qs" .. i show_tip:GetChild("num").text = v + + -- 先添加到父节点,确保 width/height 可用(如果UI包中已定义大小则可直接用,否则需添加后获取) pNode:AddChild(show_tip) - show_tip:Center() - table.insert(self.QSHList,show_tip) - --coroutine.wait(4) - --show_tip:Dispose() + + table.insert(tipsTemp, {obj = show_tip, type = i, value = v}) + totalWidth = totalWidth + show_tip.width end - end) + + -- 定义间距 + local spacing = 10 -- 两个提示框之间的间隙 + + -- 计算起始 X 坐标,使整排提示框在父节点中水平居中 + -- 起始X = 中心X - (总宽度 + 总间距) / 2 + local totalSpacing = spacing * (#tipsTemp - 1) + local startX = centerX - (totalWidth + totalSpacing) * 0.5 + + local currentX = startX + + -- 第二次遍历:设置每个提示框的具体位置 + for k, data in ipairs(tipsTemp) do + local show_tip = data.obj + + -- 设置 Y 轴位置:保持在父节点垂直居中 (或者你可以固定一个值,如 centerY - show_tip.height * 0.5) + show_tip.y = centerY - show_tip.height * 0.5 + + -- 设置 X 轴位置:从 startX 开始,依次累加宽度和间距 + show_tip.x = currentX + + -- 更新下一个对象的 X 坐标 + currentX = currentX + show_tip.width + spacing + + -- 加入销毁列表 + table.insert(self.QSHList, show_tip) + end + end) table.sort(allShowCards, ViewUtil.HandCardSort) info:UpdateHandCard(false, false, allShowCards) coroutine.start(function() @@ -810,8 +848,7 @@ function M:__KaiGang(data) local info = self._player_card_info[self:GetPos(seat)] local p = self._room:GetPlayerBySeat(seat) local card = p.outcard_list[#p.outcard_list] - printlog("jefe kai_gang",dice1) - printlog("jefe kai_gang",dice2) + local shaizi = UIPackage.CreateObject("Extend_MJ_ChangSha", "Ani_shaizi") shaizi:GetChild("shaizi1").icon = UIPackage.GetItemURL("Extend_MJ_ChangSha", "shaizi" .. dice1) shaizi:GetChild("shaizi2").icon = UIPackage.GetItemURL("Extend_MJ_ChangSha", "shaizi" .. dice2) diff --git a/lua_probject/extend_project/extend/majiang/changsha/MJPlayerCardInfoView.lua b/lua_probject/extend_project/extend/majiang/changsha/MJPlayerCardInfoView.lua index e1ca7fcc..fcde11b9 100644 --- a/lua_probject/extend_project/extend/majiang/changsha/MJPlayerCardInfoView.lua +++ b/lua_probject/extend_project/extend/majiang/changsha/MJPlayerCardInfoView.lua @@ -1,5 +1,5 @@ local MJPlayerCardInfoView = require("main.majiang.MJPlayerCardInfoView") - +local ViewUtil = require("Game.View.ViewUtil") local M = {} function M.new(view,mainView) @@ -31,86 +31,86 @@ local function CardPos(obj, area, oder, loc, offset) return location end -function M:UpdateHandCard(getcard, mp, opcard) - -- mp 是否明牌 - -- 如果不明牌,但是有 opcard 表示是起手胡 - getcard = getcard or false - mp = mp or false - local handcard_list = self._mask_data["handcard_list"] - local oder = handcard_list["oder"] - local _player = self._player - local comp_back = handcard_list["comp_back"] - local comp = handcard_list["comp"] - local outcard_list = self._mask_data["outcard_list"] - local card = outcard_list["card"] +-- function M:UpdateHandCard(getcard, mp, opcard) +-- -- mp 是否明牌 +-- -- 如果不明牌,但是有 opcard 表示是起手胡 +-- getcard = getcard or false +-- mp = mp or false +-- local handcard_list = self._mask_data["handcard_list"] +-- local oder = handcard_list["oder"] +-- local _player = self._player +-- local comp_back = handcard_list["comp_back"] +-- local comp = handcard_list["comp"] +-- local outcard_list = self._mask_data["outcard_list"] +-- local card = outcard_list["card"] - self._area_handcard_list:RemoveChildren(0, -1, true) - local opnum = opcard and #opcard or -1 - if not mp and opnum > -1 then - -- 起手胡板牌记录,手牌变化两次后,板牌收回 - self.__show_qs_hu_times = 1 - self.__qs_hu_cards = opcard - elseif self.__qs_hu_cards and opnum == -1 and self.__show_qs_hu_times > 0 then - self.__show_qs_hu_times = self.__show_qs_hu_times - 1 - opcard = self.__qs_hu_cards - opnum = #opcard - end - local loc = 0 - if not mp then - local comp_back = handcard_list["comp_back"] - if self._current_card_type == 2 then - comp_back = comp_back.."_3d" - end - for i = 0, _player.hand_left_count -1 do - local obj - local offset = getcard and (i == _player.hand_left_count - 1 and 15 or 0) - if i < opnum then - obj = UIPackage.CreateObject("Main_Majiang", comp) - self:fillCard(obj, card, opcard[i + 1]) - else - obj = UIPackage.CreateObject("Main_Majiang", comp_back) - end - if opnum ~= -1 then - loc = CardPos(obj, self._area_handcard_list, oder, loc, offset) - else - ViewUtil.CardPos(obj, self._area_handcard_list, oder, i, {offset=offset}) - end - --改变左右两边的手牌的x值 - if self._current_card_type == 2 and (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then - obj.x = i * -7.0 - end - if (oder == AreaOderType.down_up) then - self._area_handcard_list:AddChildAt(obj, 0) - else - self._area_handcard_list:AddChild(obj) - end - end - else - local outcard_list = self._mask_data["outcard_list"] - local comp = handcard_list["comp"] - local card = outcard_list["card"] - --print("comp"..comp) - -- print(vardump(_player.card_list)) +-- self._area_handcard_list:RemoveChildren(0, -1, true) +-- local opnum = opcard and #opcard or -1 +-- if not mp and opnum > -1 then +-- -- 起手胡板牌记录,手牌变化两次后,板牌收回 +-- self.__show_qs_hu_times = 1 +-- self.__qs_hu_cards = opcard +-- elseif self.__qs_hu_cards and opnum == -1 and self.__show_qs_hu_times > 0 then +-- self.__show_qs_hu_times = self.__show_qs_hu_times - 1 +-- opcard = self.__qs_hu_cards +-- opnum = #opcard +-- end +-- local loc = 0 +-- if not mp then +-- local comp_back = handcard_list["comp_back"] +-- if self._current_card_type == 2 then +-- comp_back = comp_back.."_3d" +-- end +-- for i = 0, _player.hand_left_count -1 do +-- local obj +-- local offset = (getcard and i == _player.hand_left_count - 1) and 15 or 0 +-- if i < opnum then +-- obj = UIPackage.CreateObject("Main_Majiang", comp) +-- self:fillCard(obj, card, opcard[i + 1]) +-- else +-- obj = UIPackage.CreateObject("Main_Majiang", comp_back) +-- end +-- if opnum ~= -1 then +-- loc = CardPos(obj, self._area_handcard_list, oder, loc, offset) +-- else +-- ViewUtil.CardPos(obj, self._area_handcard_list, oder, i, offset) +-- end +-- --改变左右两边的手牌的x值 +-- if self._current_card_type == 2 and (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then +-- obj.x = i * -7.0 +-- end +-- if (oder == AreaOderType.down_up) then +-- self._area_handcard_list:AddChildAt(obj, 0) +-- else +-- self._area_handcard_list:AddChild(obj) +-- end +-- end +-- else +-- local outcard_list = self._mask_data["outcard_list"] +-- local comp = handcard_list["comp"] +-- local card = outcard_list["card"] +-- --print("comp"..comp) +-- -- print(vardump(_player.card_list)) - if self._current_card_type == 2 then - comp = comp.."_3d" - end - for i = 0, #_player.card_list -1 do - local obj = UIPackage.CreateObject("Main_Majiang", comp) - self:fillCard(obj,card,_player.card_list[i+1]) - local offset = getcard and (i == _player.hand_left_count - 1 and 15 or 0) - ViewUtil.CardPos(obj, self._area_handcard_list, oder, i, {offset=offset}) - --改变左右两边的手牌的x值 - if self._current_card_type == 2 and (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then - obj.x = i * -7 - end - if (oder == AreaOderType.down_up) then - self._area_handcard_list:AddChildAt(obj, 0) - else - self._area_handcard_list:AddChild(obj) - end - end - end -end +-- if self._current_card_type == 2 then +-- comp = comp.."_3d" +-- end +-- for i = 0, #_player.card_list -1 do +-- local obj = UIPackage.CreateObject("Main_Majiang", comp) +-- self:fillCard(obj,card,_player.card_list[i+1]) +-- local offset = getcard and (i == _player.hand_left_count - 1 and 15 or 0) +-- ViewUtil.CardPos(obj, self._area_handcard_list, oder, i, offset) +-- --改变左右两边的手牌的x值 +-- if self._current_card_type == 2 and (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then +-- obj.x = i * -7 +-- end +-- if (oder == AreaOderType.down_up) then +-- self._area_handcard_list:AddChildAt(obj, 0) +-- else +-- self._area_handcard_list:AddChild(obj) +-- end +-- end +-- end +-- end return M \ No newline at end of file diff --git a/lua_probject/extend_project/extend/zipai/changdepaohuzi/EXGameInfo.lua b/lua_probject/extend_project/extend/zipai/changdepaohuzi/EXGameInfo.lua index db365d29..207f2abc 100644 --- a/lua_probject/extend_project/extend/zipai/changdepaohuzi/EXGameInfo.lua +++ b/lua_probject/extend_project/extend/zipai/changdepaohuzi/EXGameInfo.lua @@ -3,8 +3,8 @@ local EXGameInfo = {} local M = EXGameInfo function EXGameInfo.new(blur_view) - setmetatable(M, { __index = IGameInfo }) - local self = setmetatable({}, { __index = M }) + setmetatable(M, {__index = IGameInfo}) + local self = setmetatable({}, {__index = M}) self.class = 'EXGameInfo' UIPackage.AddPackage('extend/zipai/changdepaohuzi/ui/Extend_Poker_ChangdeWHZ') UIPackage.AddPackage('extend/zipai/changdepaohuzi/ui/Info_Poker_ChangdeWHZ') @@ -12,83 +12,93 @@ function EXGameInfo.new(blur_view) end function M:FillData() - self._maxPlayer = 3 -- 默认玩家人数 + self._maxPlayer = 3 -- 默认玩家人数 self._roundChoice = 3 -- 回合选项数 self._config = UIPackage.CreateObjectFromURL('ui://Extend_Poker_ChangdeWHZ/Cgm_create_room') + + if oldGameVersion ==1 then + self._config:GetChild("xipai").visible=false + end - if oldGameVersion == 1 then - self._config:GetChild("xipai").visible = false - end + if oldGameVersion==2 then + self._config:GetController("xipai").selectedIndex=1 + self.xipaiValueText=self._config:GetChild('xipaifen') + self.xipaiValueText.text=1 + self.xipaiValue=1 - if oldGameVersion == 2 then - self._config:GetController("xipai").selectedIndex = 1 - self.xipaiValueText = self._config:GetChild('xipaifen') - self.xipaiValueText.text = 1 - self.xipaiValue = 1 - - self.anchouValueText = self._config:GetChild('anchoufen') - self.anchouValueText.text = 1 - self.anchouValue = 1 - - local btn_cr = self._config:GetChild('sdsrbtn') - btn_cr.onClick:Set( - function() - local gniv = GroupNumberInputView_Game.new(nil, function(num) - local value = limit - if otype == 1 then - value = value + ad2d(num) - elseif otype == -1 then - value = value - ad2d(num) - else - value = ad2d(num) + self.anchouValueText=self._config:GetChild('anchoufen') + self.anchouValueText.text=1 + self.anchouValue=1 + + local btn_cr = self._config:GetChild('sdsrbtn') + btn_cr.onClick:Set( + function() + + local gniv = GroupNumberInputView_Game.new(nil, function(num) + + local value = limit + if otype == 1 then + value = value + ad2d(num) + elseif otype == - 1 then + value = value - ad2d(num) + else + value = ad2d(num) + end + + if value < 0 then + ViewUtil.ErrorTip(1,"输入数据异常!") + end + + self.xipaiValueText.text=d2ad(value) + self.xipaiValue=d2ad(value) + + end, 3, nil) + gniv:Show() + + end - - if value < 0 then - ViewUtil.ErrorTip(1, "输入数据异常!") + ) + local btn_cr2 = self._config:GetChild('anchoubtn') + btn_cr2.onClick:Set( + function() + + local gniv = GroupNumberInputView_Game.new(nil, function(num) + + local value = limit + if otype == 1 then + value = value + ad2d(num) + elseif otype == - 1 then + value = value - ad2d(num) + else + value = ad2d(num) + end + + if value < 0 then + ViewUtil.ErrorTip(1,"输入数据异常!") + end + + self.anchouValueText.text=d2ad(value) + self.anchouValue=d2ad(value) + + end, 3, nil) + gniv:Show() + + end - - self.xipaiValueText.text = value / 100 - self.xipaiValue = value / 100 - end, 3, nil) - gniv:Show() - end - ) - local btn_cr2 = self._config:GetChild('anchoubtn') - btn_cr2.onClick:Set( - function() - local gniv = GroupNumberInputView_Game.new(nil, function(num) - local value = limit - if otype == 1 then - value = value + ad2d(num) - elseif otype == -1 then - value = value - ad2d(num) - else - value = ad2d(num) - end - - if value < 0 then - ViewUtil.ErrorTip(1, "输入数据异常!") - end - - self.anchouValueText.text = value / 100 - self.anchouValue = value / 100 - end, 3, nil) - gniv:Show() - end - ) - end - - + ) + end + + local btn_jia = self._config:GetChild('btn_jia') local btn_jian = self._config:GetChild('btn_jian') local btn_jia1 = self._config:GetChild('btn_jia1') local btn_jian1 = self._config:GetChild('btn_jian1') local btn_jia2 = self._config:GetChild('btn_jia2') local btn_jian2 = self._config:GetChild('btn_jian2') - -- local fS=self._config:GetChild('btn_round8'):GetChild("title") - -- fS.text="1局" - -- fS=self._config:GetChild('btn_round16'):GetChild("title") - -- fS.text="8局" + -- local fS=self._config:GetChild('btn_round8'):GetChild("title") + -- fS.text="1局" + -- fS=self._config:GetChild('btn_round16'):GetChild("title") + -- fS.text="8局" btn_jia.onClick:Set( function() if self._config:GetController('tun').selectedIndex ~= 5 then @@ -181,7 +191,6 @@ function M:FillData() end ) end - local _help_url = 'ui://Info_Poker_ChangdeWHZ/Com_help' function M:GetHelpUrl() return _help_url @@ -197,7 +206,7 @@ function M:GetIconUrl1() return _icon_url1 end -local _play_list = { "全名堂", "红黑点", "多红多番" } +local _play_list = {"全名堂","红黑点","多红多番"} function M:GetPlayList() return _play_list end @@ -205,7 +214,7 @@ end function M:SelectedConfigData() local _config = self._config local wanfa_C = _config:GetController('btn_Controller').selectedIndex - local round = _config:GetController('round').selectedIndex + 1 --== 0 and 1 or 2 + local round = _config:GetController('round').selectedIndex+1 --== 0 and 1 or 2 local Cost = _config:GetController('Cost').selectedIndex local tun = _config:GetController('tun').selectedIndex local fengding = _config:GetController('fengding').selectedIndex @@ -223,30 +232,30 @@ function M:SelectedConfigData() local dihu = _config:GetController('dihu').selectedIndex local haihu = _config:GetController('haihu').selectedIndex local renshu = _config:GetController('renshu').selectedIndex == 0 and 2 or 3 - -- local qupai = _config:GetController('qupai').selectedIndex == 1 and true or false + -- local qupai = _config:GetController('qupai').selectedIndex == 1 and true or false local _data = {} - _data['opt'] = round -- 1 2 8局 16 局 + _data['opt'] = round -- 1 2 8局 16 局 _data['mode'] = wanfa_C + 1 -- 1 全名堂 2 红黑点 3 多红多番 _data['AA'] = Cost _data['maxPlayers'] = renshu if wanfa_C == 0 then - _data['tun'] = tun -- 充囤 0 1 2 3 4 分别是 1 2 3 4 5 - _data['fengding'] = fengding -- 封顶 0 1 2 全名堂分别是 不封顶 100封顶 200封顶 - _data['tuanyuan'] = tuanyuan -- 大团圆 0 不选 1 选 - _data['hanghangxi'] = hanghangxi -- 行行息 0 不选 1 选 - _data['shuahou'] = shuahou -- 耍猴 0 不选 1 选 - _data['huangfan'] = huangfan -- 黄番 0 不选 1 选 + _data['tun'] = tun -- 充囤 0 1 2 3 4 分别是 1 2 3 4 5 + _data['fengding'] = fengding -- 封顶 0 1 2 全名堂分别是 不封顶 100封顶 200封顶 + _data['tuanyuan'] = tuanyuan -- 大团圆 0 不选 1 选 + _data['hanghangxi'] = hanghangxi -- 行行息 0 不选 1 选 + _data['shuahou'] = shuahou -- 耍猴 0 不选 1 选 + _data['huangfan'] = huangfan -- 黄番 0 不选 1 选 _data['jiaxingxing'] = jiaxingxing -- 假行行 0 不选 1 选 - _data['tinghu'] = tinghu -- 听胡 0 不选 1 选 - _data['siqi'] = siqi -- 四七红 0 不选 1 选 - _data['back'] = back -- 四七红 0 不选 1 选 - _data['yuan'] = yuan -- 四七红 0 不选 1 选 + _data['tinghu'] = tinghu -- 听胡 0 不选 1 选 + _data['siqi'] = siqi -- 四七红 0 不选 1 选 + _data['back'] = back -- 四七红 0 不选 1 选 + _data['yuan'] = yuan -- 四七红 0 不选 1 选 elseif wanfa_C == 1 then - _data['tun'] = tun -- 充囤 0 1 2 3 4 5 分别是 0 1 2 3 4 5 - _data['fengding'] = fengding -- 封顶 0 1 2 红黑点分别是 不封顶 单局20封顶 单局 40封顶 - _data['duizifu'] = duizifu -- 对子胡 0 不选 1 选 + _data['tun'] = tun -- 充囤 0 1 2 3 4 5 分别是 0 1 2 3 4 5 + _data['fengding'] = fengding -- 封顶 0 1 2 红黑点分别是 不封顶 单局20封顶 单局 40封顶 + _data['duizifu'] = duizifu -- 对子胡 0 不选 1 选 elseif wanfa_C == 2 then - _data['tun'] = tun -- 充囤 0 1 2 3 4 5 分别是 0 1 2 3 4 5 + _data['tun'] = tun -- 充囤 0 1 2 3 4 5 分别是 0 1 2 3 4 5 _data['tianhu'] = tianhu _data['dihu'] = dihu _data['haihu'] = haihu @@ -257,28 +266,28 @@ function M:SelectedConfigData() if renshu == 2 then _data['qupai'] = false end + + local xi_pai=false + if oldGameVersion ==2 then + if _config:GetChild("xipai") then + xi_pai = _config:GetChild("xipai").selected + end + end - local xi_pai = false - if oldGameVersion == 2 then - if _config:GetChild("xipai") then - xi_pai = _config:GetChild("xipai").selected - end - end + _data['xi_pai'] = xi_pai - _data['xi_pai'] = xi_pai + local xi_pai_score=0 + local an_chou_score=0 - local xi_pai_score = 0 - local an_chou_score = 0 + if oldGameVersion==2 then + xi_pai_score=self.xipaiValue + an_chou_score=self.anchouValue + end + + _data['xi_pai_score'] = ad2d(xi_pai_score) + _data['an_chou_score'] = ad2d(an_chou_score) - if oldGameVersion == 2 then - xi_pai_score = self.xipaiValue - an_chou_score = self.anchouValue - end - - _data['xi_pai_score'] = xi_pai_score * 100 - _data['an_chou_score'] = an_chou_score * 100 - - _data['xi_pai'] = xi_pai + _data['xi_pai'] = xi_pai return _data end @@ -316,21 +325,21 @@ function M:LoadConfigData(data) if data.maxPlayers == 2 then --_config:GetController('qupai').selectedIndex = data.qupai == true and 1 or 0 end + + if _config:GetChild("xipai") then + _config:GetChild("xipai").selected=data.xi_pai + end + - if _config:GetChild("xipai") then - _config:GetChild("xipai").selected = data.xi_pai - end + if oldGameVersion==2 then + self.xipaiValueText.text=d2ad(data.xi_pai_score) + self.xipaiValue=d2ad(data.xi_pai_score) - - if oldGameVersion == 2 then - self.xipaiValueText.text = data.xi_pai_score / 100 - self.xipaiValue = data.xi_pai_score / 100 - - self.anchouValueText.text = data.an_chou_score / 100 - self.anchouValue = data.an_chou_score / 100 - end + self.anchouValueText.text=d2ad(data.an_chou_score) + self.anchouValue=d2ad(data.an_chou_score) + end + end - function M:OnChangeOption(ctype) IGameInfo.OnChangeOption(self, ctype) local people = self._config:GetController('renshu') @@ -341,5 +350,4 @@ function M:OnChangeOption(ctype) end ) end - return M diff --git a/lua_probject/extend_project/extend/zipai/changdepaohuzi/EXPlayBackView.lua b/lua_probject/extend_project/extend/zipai/changdepaohuzi/EXPlayBackView.lua index 4ec205fc..be8a9390 100644 --- a/lua_probject/extend_project/extend/zipai/changdepaohuzi/EXPlayBackView.lua +++ b/lua_probject/extend_project/extend/zipai/changdepaohuzi/EXPlayBackView.lua @@ -114,9 +114,21 @@ function M:FillRoomData(data) self._currentStep = 0 local room = DataManager.CurrenRoom local _player_card_info = self._player_card_info - local roominfo_panel = self._view:GetChild('roominfo_panel1') - roominfo_panel:GetChild('tex_roomid').text = room.room_id - roominfo_panel:GetChild('tex_gametype').text = room.room_config:GetGameName() + -- 在 d:\Gitlj\robot_client\fk101\lua_probject\extend_project\extend\zipai\yueyangwaihuzi\EXPlayBackView.lua 中 + +local roominfo_panel = self._view:GetChild("roominfo_panel") +if roominfo_panel then + local tex_roomid = roominfo_panel:GetChild("tex_roomid") + local tex_gametype = roominfo_panel:GetChild("tex_gametype") -- 如果有的话 + + if tex_roomid then + tex_roomid.text = room.room_id + end + + if tex_gametype then + tex_gametype.text = room.room_config:GetGameName() + end +end for i = 1, #room.player_list do local p = room.player_list[i] local card_info = _player_card_info[self:GetPos(p.seat)] diff --git a/lua_probject/extend_project/extend/zipai/changdepaohuzi/PlayerCardInfoView.lua b/lua_probject/extend_project/extend/zipai/changdepaohuzi/PlayerCardInfoView.lua index 93083b03..243b0bb7 100644 --- a/lua_probject/extend_project/extend/zipai/changdepaohuzi/PlayerCardInfoView.lua +++ b/lua_probject/extend_project/extend/zipai/changdepaohuzi/PlayerCardInfoView.lua @@ -181,7 +181,9 @@ function M:UpdateOutCardList(outcard,isShow,isMopai,seat) self._area_outcard_list:RemoveChildren(0,-1,true) local outcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Gcm_OutCard") - + outcards.onClick:Set(function() + outcards.alpha = 1.1 - outcards.alpha + end) if outcard==0 then outcards:GetChild("icon").icon ="ui://Main_RunBeard/202_1_300" else @@ -228,7 +230,7 @@ end function M:UpdateQiPai( qi_list,ispaly,seat) self._area_qipai_list:RemoveChildren(0,-1,true) for i=1,#qi_list do - local qicards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Qipai") + local qicards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Qipais") qicards:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/202_",qi_list[i]) if(ispaly)then if(i == #qi_list) then diff --git a/lua_probject/extend_project/extend/zipai/changdepaohuzi/PlayerSelfCardInfoView.lua b/lua_probject/extend_project/extend/zipai/changdepaohuzi/PlayerSelfCardInfoView.lua index 0d2e1884..4a441833 100644 --- a/lua_probject/extend_project/extend/zipai/changdepaohuzi/PlayerSelfCardInfoView.lua +++ b/lua_probject/extend_project/extend/zipai/changdepaohuzi/PlayerSelfCardInfoView.lua @@ -1,10 +1,10 @@ local PlayerSelfCardInfoView = require("main.zipai.ZPPlayerSelfCardInfoView") local CardCheck = require("main.zipai.CardCheck") local M = {} --- -function M.new(view, mainView) - setmetatable(M, { __index = PlayerSelfCardInfoView }) - local self = setmetatable({}, { __index = M }) +-- +function M.new(view,mainView) + setmetatable(M, {__index = PlayerSelfCardInfoView}) + local self = setmetatable({},{__index = M}) self.class = "PlayerSelfCardInfoView" self._view = view self._mainView = mainView @@ -13,37 +13,40 @@ function M.new(view, mainView) return self end + function M:onTouchBegin(context) - if DataManager.CurrenRoom == nil or DataManager.CurrenRoom.self_player == nil then + if DataManager.CurrenRoom ==nil or DataManager.CurrenRoom.self_player ==nil then return end local button = context.sender local card = button.data - if DataManager.CurrenRoom.curren_outcard_seat == DataManager.CurrenRoom.self_player.seat then + if DataManager.CurrenRoom.curren_outcard_seat == DataManager.CurrenRoom.self_player.seat then self:ShowHuTip(card.card_item) end - card.btn_card:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/203_", card.card_item) + card.btn_card:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/203_",card.card_item) + card.btn_card.height = card.btn_card.width/97*287 card.btn_card.sortingOrder = 100 - local xy = self._area_handcard_list:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y)) - card.btn_card.xy = Vector2.New(card.btn_card.x + 20, card.btn_card.y - 50) + local xy = self._area_handcard_list:GlobalToLocal(Vector2.New(context.inputEvent.x,context.inputEvent.y)) + card.btn_card.xy = Vector2.New(card.btn_card.x+20 ,card.btn_card.y-50) card.touch_pos = xy - button.xy + end function M:__OnDragEnd(context) - if DataManager.CurrenRoom == nil or DataManager.CurrenRoom.self_player == nil then + if DataManager.CurrenRoom ==nil or DataManager.CurrenRoom.self_player ==nil then return end if self.outcard_button then self.outcard_button = nil end local button = context.sender - + local xy = self._area_handcard_list:GlobalToLocal(Vector2.New(context.inputEvent.x, context.inputEvent.y)) local card = button.data - + local _room = DataManager.CurrenRoom card.btn_card.sortingOrder = 0 - -- print("button.y"..button.y .. "_room.curren_outcard_seat".._room.curren_outcard_seat) - if (button.y < -380 and _room.curren_outcard_seat == _room.self_player.seat) then + card.btn_card.height = card.btn_card.width/95*119 + if (button.y < self._data_outLinePos - self.card_hight * 0.66 and _room.curren_outcard_seat == _room.self_player.seat) then button.touchable = false self.outcard_button = card self:UpdateIsOnClick(false) @@ -51,7 +54,7 @@ function M:__OnDragEnd(context) else local isChangeCard = false self.outcard_button = nil - card.btn_card:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/201_", card.card_item) + card.btn_card:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/201_",card.card_item) self._area_handcard_list:AddChild(button) if #self.card_list == 1 then isChangeCard = false @@ -59,120 +62,123 @@ function M:__OnDragEnd(context) return end local CountCards = {} - for i = 1, #self.card_list do + for i=1,#self.card_list do local lists = {} if CountCards[self.card_list[i].index_X] == nil then - lists[#lists + 1] = self.card_list[i] - CountCards[self.card_list[i].index_X] = lists + lists[#lists+1] = self.card_list[i] + CountCards[self.card_list[i].index_X]= lists else - CountCards[self.card_list[i].index_X][#CountCards[self.card_list[i].index_X] + 1] = self.card_list[i] + CountCards[self.card_list[i].index_X][#CountCards[self.card_list[i].index_X]+1] =self.card_list[i] end end local minmark = 1 local maxmark = #self.card_list - if card == self.card_list[1] or card == self.card_list[#self.card_list] then + if card == self.card_list[1] or card == self.card_list[#self.card_list] then if self.card_list[1].index_X == self.card_list[2].index_X then - minmark = 2 + minmark =2 end - if self.card_list[#self.card_list].index_X == self.card_list[#self.card_list - 1].index_X then - maxmark = #self.card_list - 1 + if self.card_list[#self.card_list].index_X == self.card_list[#self.card_list-1].index_X then + maxmark =#self.card_list-1 end end - if button.x + button.width / 2 < self.card_list[minmark].btn_card.x and #CountCards < 10 then + if xy.x < self.card_list[minmark].btn_card.x and #CountCards < 10 and xy.y > self._data_outLinePos - self.card_hight * 0.66 then list_remove(self.card_list, card) local num = 0 - for i = 1, #self.card_list do + for i=1,#self.card_list do if card.index_X == self.card_list[i].index_X and card.index_Y < self.card_list[i].index_Y then - self.card_list[i].index_Y = self.card_list[i].index_Y - 1 + self.card_list[i].index_Y = self.card_list[i].index_Y - 1 end if card.index_X == self.card_list[i].index_X then - num = num + 1 + num = num+1 end end - if num == 0 then - for i = 1, #self.card_list do - if self.card_list[i].index_X < card.index_X then - self.card_list[i].index_X = self.card_list[i].index_X + 1 - end + if num ==0 then + for i=1,#self.card_list do + if self.card_list[i].index_X < card.index_X then + self.card_list[i].index_X = self.card_list[i].index_X + 1 + end end else - for i = 1, #self.card_list do - self.card_list[i].index_X = self.card_list[i].index_X + 1 + for i=1,#self.card_list do + self.card_list[i].index_X = self.card_list[i].index_X + 1 end end - card.index_X = 1 - card.index_Y = 1 - table.insert(self.card_list, 1, card) + card.index_X =1 + card.index_Y =1 + table.insert(self.card_list,1,card) isChangeCard = true - elseif button.x + button.width / 2 > (self.card_list[maxmark].btn_card.x + button.width) and #CountCards < 10 then + elseif xy.x > (self.card_list[maxmark].btn_card.x + self.card_width) and #CountCards < 10 and xy.y > self._data_outLinePos - self.card_hight * 0.66 then list_remove(self.card_list, card) local num = 0 - for i = 1, #self.card_list do + for i=1,#self.card_list do if card.index_X == self.card_list[i].index_X then - num = num + 1 + num = num+1 end if card.index_X == self.card_list[i].index_X and card.index_Y < self.card_list[i].index_Y then - self.card_list[i].index_Y = self.card_list[i].index_Y - 1 + self.card_list[i].index_Y = self.card_list[i].index_Y - 1 end end - if num == 0 then - for i = 1, #self.card_list do - if self.card_list[i].index_X > card.index_X then - self.card_list[i].index_X = self.card_list[i].index_X - 1 - end + if num ==0 then + for i=1,#self.card_list do + if self.card_list[i].index_X > card.index_X then + self.card_list[i].index_X = self.card_list[i].index_X - 1 + end end end - card.index_X = self.card_list[#self.card_list].index_X + 1 - card.index_Y = 1 - self.card_list[#self.card_list + 1] = card + card.index_X =self.card_list[#self.card_list].index_X+1 + card.index_Y =1 + self.card_list[#self.card_list+1] =card isChangeCard = true - else + else local MoveCard = false local MoveCardPos = 0 local MoveCardY = 0 - for i = 1, #CountCards do + for i=1,#CountCards do local card_view = CountCards[i][1] if card_view ~= nil then - if button.x + button.width / 2 > card_view.old_postion.x and button.x + button.width / 2 < (card_view.old_postion.x + button.width) then + if xy.x > card_view.old_postion.x and xy.x < (card_view.old_postion.x + self.card_width) and xy.y > self._data_outLinePos - self.card_hight * 0.66 then if card ~= card_view and #CountCards[i] < 4 and card.index_X ~= card_view.index_X then MoveCardPos = i - MoveCardY = #CountCards[i] + 1 + MoveCardY = #CountCards[i]+1 MoveCard = true - list_remove(self.card_list, card) + list_remove(self.card_list,card) end end end end local MoveCardindex = 0 -- local MoveCardY = 0 - if button.x + button.width / 2 > card.old_postion.x and button.x + button.width / 2 < (card.old_postion.x + button.width) then + -- print("lingmeng end", button.y, MoveCard, button.y > self._data_outLinePos, + -- button.x + button.width / 2 > card.old_postion.x and + -- button.x + button.width / 2 < (card.old_postion.x + button.width) and button.y > self._data_outLinePos) + if xy.x > card.old_postion.x and xy.x < (card.old_postion.x + self.card_width) and button.y > self._data_outLinePos - self.card_hight * 0.66 then if #CountCards[card.index_X] > 1 then for i = 1, #CountCards[card.index_X] do local _cv = CountCards[card.index_X][i] if _cv ~= card then - if button.y + button.height / 2 > _cv.btn_card.y and button.y + button.height / 2 < (_cv.btn_card.y + button.height) then + if xy.y > _cv.btn_card.y and xy.y < (_cv.btn_card.y + self.card_hight) then --向下移動 - if ((button.y + button.height / 2) + 20) > (card.old_postion.y + button.height) then + if i < card.index_Y then MoveCardindex = -1 MoveCardPos = card.index_X MoveCardY = _cv.index_Y MoveCard = true list_remove(self.card_list, card) --向上移動 - elseif ((button.y + button.height / 2) - 20) < card.old_postion.y then + elseif i > card.index_Y then MoveCardindex = 1 MoveCardPos = card.index_X MoveCardY = _cv.index_Y MoveCard = true list_remove(self.card_list, card) end - elseif i == #CountCards[card.index_X] and button.y + button.height / 2 < _cv.btn_card.y then + elseif i == #CountCards[card.index_X] and button.y + self.card_hight / 2 < _cv.btn_card.y then MoveCardindex = 1 MoveCardPos = card.index_X MoveCardY = _cv.index_Y MoveCard = true list_remove(self.card_list, card) - elseif i == 1 and button.y + button.height / 2 > (_cv.btn_card.y + button.width) then + elseif i == 1 and button.y + self.card_hight / 2 > (_cv.btn_card.y + button.width * 2) then MoveCardindex = -1 MoveCardPos = card.index_X MoveCardY = _cv.index_Y @@ -182,61 +188,64 @@ function M:__OnDragEnd(context) end end end + end - if MoveCard == true and MoveCardindex == 0 then + if MoveCard ==true and MoveCardindex ==0 then local num = 0 - for i = 1, #self.card_list do + for i=1,#self.card_list do if card.index_X == self.card_list[i].index_X and card.index_Y < self.card_list[i].index_Y then - self.card_list[i].index_Y = self.card_list[i].index_Y - 1 + self.card_list[i].index_Y = self.card_list[i].index_Y - 1 end if card.index_X == self.card_list[i].index_X then - num = num + 1 + num = num+1 end end - if num == 0 then - for i = 1, #self.card_list do - if self.card_list[i].index_X > card.index_X then - self.card_list[i].index_X = self.card_list[i].index_X - 1 - end + if num ==0 then + for i=1,#self.card_list do + if self.card_list[i].index_X > card.index_X then + self.card_list[i].index_X = self.card_list[i].index_X - 1 + end end if MoveCardPos > card.index_X then - MoveCardPos = MoveCardPos - 1 + MoveCardPos = MoveCardPos-1 end end - card.index_X = MoveCardPos - card.index_Y = MoveCardY - for i = #self.card_list, 1, -1 do + card.index_X =MoveCardPos + card.index_Y =MoveCardY + for i=#self.card_list,1,-1 do if MoveCardPos == self.card_list[i].index_X then - table.insert(self.card_list, (i + 1), card) + table.insert(self.card_list,(i+1),card) break end end isChangeCard = true - --上下移动 - elseif MoveCard == true and MoveCardindex ~= 0 then - for i = 1, #self.card_list do - if card.index_X == self.card_list[i].index_X then + --上下移动 + elseif MoveCard ==true and MoveCardindex ~= 0 then + for i=1,#self.card_list do + if card.index_X == self.card_list[i].index_X then --向下移动 if MoveCardindex == -1 then - if self.card_list[i].index_Y < card.index_Y and self.card_list[i].index_Y >= MoveCardY then + if self.card_list[i].index_Y < card.index_Y and self.card_list[i].index_Y >= MoveCardY then self.card_list[i].index_Y = self.card_list[i].index_Y + 1 + end - --向上移动 + --向上移动 else - if self.card_list[i].index_Y > card.index_Y and self.card_list[i].index_Y <= MoveCardY then - self.card_list[i].index_Y = self.card_list[i].index_Y - 1 + if self.card_list[i].index_Y > card.index_Y and self.card_list[i].index_Y <= MoveCardY then + self.card_list[i].index_Y = self.card_list[i].index_Y - 1 + end end end end - card.index_X = MoveCardPos - card.index_Y = MoveCardY - for i = #self.card_list, 1, -1 do - if MoveCardPos == self.card_list[i].index_X and self.card_list[i].index_Y == (MoveCardY - 1) then - table.insert(self.card_list, (i + 1), card) + card.index_X =MoveCardPos + card.index_Y =MoveCardY + for i=#self.card_list,1,-1 do + if MoveCardPos == self.card_list[i].index_X and self.card_list[i].index_Y == (MoveCardY-1) then + table.insert(self.card_list,(i+1),card) break - elseif MoveCardPos == self.card_list[i].index_X and self.card_list[i].index_Y == (MoveCardY + 1) then - table.insert(self.card_list, i, card) + elseif MoveCardPos == self.card_list[i].index_X and self.card_list[i].index_Y == (MoveCardY+1) then + table.insert(self.card_list,i,card) break end end @@ -245,162 +254,178 @@ function M:__OnDragEnd(context) isChangeCard = false self._area_handcard_list:AddChild(button) end - end + + end self:UpdateHandCardsPos() - if isChangeCard == true then + if isChangeCard ==true then self:SendChangeCard() end end end -function M:UpdateOutCardList(outcard, isShow, isMopai, seat) - if (isShow == nil) then - isShow = false +function M:UpdateOutCardList(outcard,isShow,isMopai,seat) + if(isShow == nil) then + isShow = false end - if (isMopai == nil) then - isMopai = false + if(isMopai == nil) then + isMopai = false end - self._area_outcard_list:RemoveChildren(0, -1, true) - local outcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Gcm_OutCard") - - if outcard == 0 then - outcards:GetChild("icon").icon = "ui://Main_RunBeard/202_1_300" + self._area_outcard_list:RemoveChildren(0,-1,true) + local outcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Gcm_OutCard") + outcards.onClick:Set(function() + outcards.alpha = 1.3 - outcards.alpha + end) + if outcard==0 then + outcards:GetChild("icon").icon ="ui://Main_RunBeard/202_1_300" else - outcards:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/203_", outcard) + outcards:GetChild("icon").icon =self:getCardItem("ui://Main_RunBeard/203_",outcard) end - outcards.x, outcards.y = 0, 0 - local show_di_bg = outcards:GetChild("show_di_bg") + outcards.x,outcards.y = 0,0 + local show_di_bg = outcards:GetChild("show_di_bg") --show_di_bg.visible = true - if (isShow) then - if outcard == 0 then - show_di_bg.visible = false - end - if (seat ~= nil and outcards ~= nil) then - if (isMopai) then - if outcard ~= 0 then - outcards:GetTransition("mopai" .. seat):Play(function() - -- show_di_bg.visible = true - end) - end - else - show_di_bg.visible = false - outcards:GetTransition("cpai" .. seat):Play() + if(isShow)then + if outcard == 0 then + show_di_bg.visible = false end - else - --show_di_bg.visible = true - end + if(seat ~= nil and outcards~=nil)then + if(isMopai)then + if outcard ~= 0 then + outcards:GetTransition("mopai"..seat):Play(function( ) + -- show_di_bg.visible = true + + end) + end + else + show_di_bg.visible = false + outcards:GetTransition("cpai"..seat):Play() + end + else + --show_di_bg.visible = true + end else - show_di_bg.visible = false + show_di_bg.visible = false end self._area_outcard_list:AddChild(outcards) end --弃牌 -function M:UpdateQiPai(qi_list, isplay) - self._area_qipai_list:RemoveChildren(0, -1, true) - for i = 1, #qi_list do - local qicards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Qipai") - qicards:GetChild("icon").icon = self:getCardItem("ui://Main_RunBeard/202_", qi_list[i]) - if (isplay) then - if (i == #qi_list) then - qicards:GetTransition("t0"):Play() +function M:UpdateQiPai( qi_list,isplay) + self._area_qipai_list:RemoveChildren(0,-1,true) + for i=1,#qi_list do + local qicards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Qipai") + qicards:GetChild("icon").icon =self:getCardItem("ui://Main_RunBeard/202_",qi_list[i]) + if(isplay)then + if(i == #qi_list) then + qicards:GetTransition("t0"):Play() end - end - self._area_qipai_list:AddChild(qicards) - end + end + self._area_qipai_list:AddChild(qicards) + end end --摸牌动画 -function M:PlayingOutCardAnima(card) +function M:PlayingOutCardAnima( card) coroutine.start(function() - coroutine.wait(0.1) + coroutine.wait(0.1) self:ClearOutCard() end) end -function M:UpdateFzList(fz_list, ispaly) - self._area_fz_list:RemoveChildren(0, -1, true) - for i = 1, #fz_list do - local fzitem = nil +function M:UpdateFzList( fz_list ,ispaly) + self._area_fz_list:RemoveChildren(0,-1,true) + for i = 1,#fz_list do + local fzitem=nil if fz_list[i].type ~= RB_FZType.Kan then - fzitem = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/ComponentNew") - if (ispaly == false) then - fzitem:RemoveChildren(0, -1, true) + fzitem =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/ComponentNew") + if(ispaly == false)then + fzitem:RemoveChildren(0,-1,true) end end if fz_list[i].type == RB_FZType.Chi or fz_list[i].type == RB_FZType.Bi then - local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3") - fzcards:GetChild("card_" .. 1).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].active_card) + + local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3") + fzcards:GetChild("card_"..1).icon = self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].active_card) fzcards:GetController("c2").selectedIndex = 1 - fzcards:GetChild("card_" .. 2).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].opcard[1]) - fzcards:GetChild("card_" .. 3).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].opcard[2]) - fzcards.x, fzcards.y = 0, 0 - self:playAnim(fzitem, fzcards, #fz_list, i, ispaly) + fzcards:GetChild("card_"..2).icon = self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].opcard[1]) + fzcards:GetChild("card_"..3).icon = self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].opcard[2]) + fzcards.x,fzcards.y = 0,0 + self:playAnim(fzitem,fzcards,#fz_list,i,ispaly) + elseif fz_list[i].type == RB_FZType.Peng then - local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3") - for j = 1, 3 do - fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card) + + local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3") + for j=1,3 do + fzcards:GetChild("card_"..j).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card) end - fzcards.x, fzcards.y = 0, 0 - self:playAnim(fzitem, fzcards, #fz_list, i, ispaly) + fzcards.x,fzcards.y = 0,0 + self:playAnim(fzitem,fzcards,#fz_list,i,ispaly) + elseif fz_list[i].type == RB_FZType.Wei then - local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3") - fzcards:GetController("c1").selectedIndex = 1 - for j = 1, 3 do - fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card) + + local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3") + fzcards:GetController("c1").selectedIndex=1 + for j=1,3 do + fzcards:GetChild("card_"..j).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card) end - fzcards.x, fzcards.y = 0, 0 - self:playAnim(fzitem, fzcards, #fz_list, i, ispaly) + fzcards.x,fzcards.y = 0,0 + self:playAnim(fzitem,fzcards,#fz_list,i,ispaly) elseif fz_list[i].type == RB_FZType.ChouWei then - local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3") - for j = 1, 2 do - fzcards:GetChild("card_" .. j).icon = "ui://Main_RunBeard/202_1_300" + local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_3") + for j=1,2 do + fzcards:GetChild("card_"..j).icon ="ui://Main_RunBeard/202_1_300" end - fzcards:GetChild("card_" .. 3).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card) - fzcards.x, fzcards.y = 0, 0 - self:playAnim(fzitem, fzcards, #fz_list, i, ispaly) + fzcards:GetChild("card_"..3).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card) + fzcards.x,fzcards.y = 0,0 + self:playAnim(fzitem,fzcards,#fz_list,i,ispaly) + elseif fz_list[i].type == RB_FZType.Pao then - local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4") - for j = 1, 4 do - fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card) + + local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4") + for j=1,4 do + fzcards:GetChild("card_"..j).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card) end - fzcards.x, fzcards.y = 0, 0 - self:playAnim(fzitem, fzcards, #fz_list, i, ispaly) + fzcards.x,fzcards.y = 0,0 + self:playAnim(fzitem,fzcards,#fz_list,i,ispaly) + elseif fz_list[i].type == RB_FZType.Ti then - local fzcards = UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4") - for j = 1, 4 do - if j == 4 then - fzcards:GetChild("card_" .. j).icon = self:getCardItem("ui://Main_RunBeard/202_", fz_list[i].card) + + local fzcards =UIPackage.CreateObjectFromURL("ui://Main_RunBeard/Fz_0_4") + for j=1,4 do + if j==4 then + fzcards:GetChild("card_"..j).icon =self:getCardItem("ui://Main_RunBeard/202_",fz_list[i].card) else - fzcards:GetChild("card_" .. j).icon = "ui://Main_RunBeard/202_1_300" + fzcards:GetChild("card_"..j).icon ="ui://Main_RunBeard/202_1_300" end end - fzcards.x, fzcards.y = 0, 0 - self:playAnim(fzitem, fzcards, #fz_list, i, ispaly) + fzcards.x,fzcards.y = 0,0 + self:playAnim(fzitem,fzcards,#fz_list,i,ispaly) + end end end -function M:playAnim(fzitem, fzcards, size, i, ispaly) - if (ispaly == nil) then - ispaly = false - end - if (ispaly and i == size) then - local faArray = fzitem:GetChild("chiwei") - if (faArray ~= nil) then - faArray:AddChild(fzcards) - else - fzitem:AddChild(fzcards) - end - else - fzitem:AddChild(fzcards) - end - self._area_fz_list:AddChild(fzitem) + +function M:playAnim( fzitem,fzcards, size,i,ispaly ) + if(ispaly == nil)then + ispaly =false + end + if(ispaly and i == size)then + local faArray= fzitem:GetChild("chiwei") + if(faArray~=nil)then + faArray:AddChild(fzcards) + else + fzitem:AddChild(fzcards) + end + else + fzitem:AddChild(fzcards) + end + self._area_fz_list:AddChild(fzitem) end ---出牌提示动画 -function M:ChuPaiTiShi() - if DataManager.CurrenRoom == nil or DataManager.CurrenRoom.self_player == nil then + + --出牌提示动画 + function M:ChuPaiTiShi() + if DataManager.CurrenRoom ==nil or DataManager.CurrenRoom.self_player ==nil then return end local chu_player = DataManager.CurrenRoom.self_player @@ -411,31 +436,32 @@ function M:ChuPaiTiShi() selfplayeTable.paoCount = chu_player.paoCount selfplayeTable.hu_xi = chu_player.hu_xi local player = membe_deep_clone(selfplayeTable) - local mark_ting = {} - for i = 1, #DataManager.CurrenRoom.self_player.handcard_list do - local card = DataManager.CurrenRoom.self_player.handcard_list[i] + local mark_ting= {} + for i=1,#DataManager.CurrenRoom.self_player.handcard_list do + local card = DataManager.CurrenRoom.self_player.handcard_list[i] list_remove(player.handcard_list, card) local _player = membe_deep_clone(player) - local tingList = CardCheck.tingPai(_player, DataManager.CurrenRoom) + local tingList = CardCheck.tingPai(_player,DataManager.CurrenRoom) local isKan = false - for j = 1, #player.fz_list do + for j=1,#player.fz_list do if card == player.fz_list[j].card and player.fz_list[j].type == RB_FZType.Kan then - isKan = true + isKan =true end end if #tingList > 0 and isKan == false then - mark_ting[#mark_ting + 1] = card + + mark_ting[#mark_ting+1] = card end table.insert(player.handcard_list, card) - table.sort(player.handcard_list, ViewUtil.HandCardSort) + table.sort( player.handcard_list, ViewUtil.HandCardSort) end -- print("ChuPaiTiShi",#mark_ting,vardump(player)) - if DataManager.CurrenRoom.curren_outcard_seat == DataManager.CurrenRoom.self_player.seat then - self._view:GetController("chupai").selectedIndex = 1 - if #mark_ting > 0 then - for i = 1, #mark_ting do - for k = 1, #self.card_list do - local card_view = self.card_list[k] + if DataManager.CurrenRoom.curren_outcard_seat == DataManager.CurrenRoom.self_player.seat then + self._view :GetController("chupai").selectedIndex =1 + if #mark_ting>0 then + for i=1,#mark_ting do + for k=1,#self.card_list do + local card_view= self.card_list[k] if card_view.card_item == mark_ting[i] then card_view.btn_card:GetController("mark_ting").selectedIndex = 1 end @@ -443,12 +469,13 @@ function M:ChuPaiTiShi() end end else - self._view:GetController("chupai").selectedIndex = 0 - for k = 1, #self.card_list do - local card_view = self.card_list[k] + self._view :GetController("chupai").selectedIndex =0 + for k=1,#self.card_list do + local card_view= self.card_list[k] card_view.btn_card:GetController("mark_ting").selectedIndex = 0 + end end end -return M +return M \ No newline at end of file diff --git a/lua_probject/extend_project/extend/zipai/changdepaohuzi/RunBeard_ResultView.lua b/lua_probject/extend_project/extend/zipai/changdepaohuzi/RunBeard_ResultView.lua index c709555b..e261d2be 100644 --- a/lua_probject/extend_project/extend/zipai/changdepaohuzi/RunBeard_ResultView.lua +++ b/lua_probject/extend_project/extend/zipai/changdepaohuzi/RunBeard_ResultView.lua @@ -7,6 +7,7 @@ local M = RunBeard_ResultView function RunBeard_ResultView.new(blur_view, index) setmetatable(M, {__index = ResultView}) local self = setmetatable({}, {__index = M}) + -- self._full=true self.class = 'RunBeard_ResultView' self._currenIndex = 0 if index ~= 1 then @@ -21,6 +22,7 @@ end function M:init(url) ResultView.init(self, url) + local btn_share = self._view:GetChild('btn_share') btn_share.onClick:Set( function() diff --git a/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPMainView.lua b/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPMainView.lua index 8f55bc57..478660f8 100644 --- a/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPMainView.lua +++ b/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPMainView.lua @@ -86,11 +86,11 @@ function M:InitView(url, isdisplay, open_social, change_card_size, qihu) local typeface = _data['game_cardsize'] local _gamectr = self._gamectr if typeface == 0 then - self._room.change_card_size = 1.2 + self._room.change_card_size = 1.03 elseif typeface == 1 then self._room.change_card_size = 1 elseif typeface == 2 then - self._room.change_card_size = 0.8 + self._room.change_card_size = 1 end else self._room.change_card_size = change_card_size @@ -189,6 +189,7 @@ function M:InitXiPai() self._xipaiPanel.width = GRoot.inst.width - (offset * 2) self._xipaiPanel.height = GRoot.inst.height self._xipaiPanel.x = offset + self._xipaiPanel.y = 414 self._xipaiPanel.visible=false --self:PlayXiPai() @@ -300,11 +301,11 @@ end -- 设置 更新 手牌大小 function M:UpdateCardSize(index) if index == 0 then - self._room.change_card_size = 1.2 + self._room.change_card_size = 1.03 elseif index == 1 then self._room.change_card_size = 1 elseif index == 2 then - self._room.change_card_size = 0.8 + self._room.change_card_size = 1 end local info = self._player_card_info[1] info:UpdateCardSize() diff --git a/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPPlayerCardInfoView.lua b/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPPlayerCardInfoView.lua index dfab2634..25535256 100644 --- a/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPPlayerCardInfoView.lua +++ b/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPPlayerCardInfoView.lua @@ -229,11 +229,11 @@ end --牌位置 function M:GetHandCardPos(cards_view,cards) local x,y = 0,0 - local card_width = 42 -- 牌的宽度 + local card_width = 80 -- 牌的宽度 local middle_x = self._area_handcard_list.width / 2 local start_x = middle_x - (cards / 2 * (card_width)) x = start_x + (card_width) * (cards_view.index_X - 1) - y = 0 - (42*cards_view.index_Y) + y = 0 - (80*cards_view.index_Y) return Vector2.New(x,y) end diff --git a/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPPlayerSelfCardInfoView.lua b/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPPlayerSelfCardInfoView.lua index 80e92dfd..5bf0c66e 100644 --- a/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPPlayerSelfCardInfoView.lua +++ b/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPPlayerSelfCardInfoView.lua @@ -214,8 +214,8 @@ function M:InitHandCard(isPlayAni, index) btn_card:GetChild('icon').icon = self:getCardItem('ui://Main_RunBeard/201_', card_code) btn_card:GetChild('icon'):SetScale(self:getCardSize(), self:getCardSize()) btn_card:GetChild('n6'):SetScale(self:getCardSize(), self:getCardSize()) - self.card_width = 95 * self:getCardSize() - self.card_hight = 123 * self:getCardSize() + self.card_width = btn_card.width * self:getCardSize() + self.card_hight = btn_card.height * self:getCardSize() local x, y = 500, (j * 85) - 500 btn_card:SetXY(x, y) self._area_handcard_list:AddChild(btn_card) @@ -262,8 +262,8 @@ function M:InitHandCard(isPlayAni, index) btn_card:GetChild('icon').icon = self:getCardItem('ui://Main_RunBeard/201_', card_code) btn_card:GetChild('icon'):SetScale(self:getCardSize(), self:getCardSize()) btn_card:GetChild('n6'):SetScale(self:getCardSize(), self:getCardSize()) - self.card_width = 95 * self:getCardSize() - self.card_hight = 123 * self:getCardSize() + self.card_width = btn_card.width * self:getCardSize() + self.card_hight = btn_card.height * self:getCardSize() self._area_handcard_list:AddChild(btn_card) self._area_handcard_list:SetChildIndex(btn_card, 5 - j) local card_view = NewCardView(btn_card, card_code, i, j) @@ -309,8 +309,8 @@ function M:UpdateHandCards(list) btn_card:GetChild('icon').icon = self:getCardItem('ui://Main_RunBeard/201_', card_code) btn_card:GetChild('icon'):SetScale(self:getCardSize(), self:getCardSize()) btn_card:GetChild('n6'):SetScale(self:getCardSize(), self:getCardSize()) - self.card_width = 87 * self:getCardSize() - self.card_hight = 110 * self:getCardSize() + self.card_width = btn_card.width * self:getCardSize() + self.card_hight = btn_card.height * self:getCardSize() local card_view = NewCardView(btn_card, card_code, list[i].index_X, list[i].index_Y) --存牌堆 self.card_list[#self.card_list + 1] = card_view @@ -436,7 +436,7 @@ function M:UpdateHandCardsPos() card_view.btn_card:RemoveFromParent() self._area_handcard_list:AddChild(card_view.btn_card) card_view.old_postion = self:GetHandCardPos(card_view, #CountCards) - card_view.btn_card:TweenMove(card_view.old_postion, 0.3) + card_view.btn_card:TweenMove(card_view.old_postion, 0.2) end self:ShowHuTip() end @@ -452,9 +452,13 @@ function M:UpdateCardDisplay() local card_view = self.card_list[i] card_view.btn_card:RemoveFromParent() card_view.btn_card:GetChild('icon').icon = self:getCardItem('ui://Main_RunBeard/201_', card_view.card_item) + self.card_width = card_view.btn_card.width * self:getCardSize() + self.card_hight = card_view.btn_card.height * self:getCardSize() self._area_handcard_list:AddChild(card_view.btn_card) - card_view.btn_card:TweenMove(self:GetHandCardPos(card_view, #CountCards), 0.3) + -- card_view.btn_card:TweenMove(self:GetHandCardPos(card_view, #CountCards), 0.3) end + self:UpdateOutLine() + self:UpdateHandCardsPos() end --更新手牌大小 function M:UpdateCardSize() @@ -469,11 +473,13 @@ function M:UpdateCardSize() card_view.btn_card:GetChild('icon').icon = self:getCardItem('ui://Main_RunBeard/201_', card_view.card_item) card_view.btn_card:GetChild('icon'):SetScale(self:getCardSize(), self:getCardSize()) card_view.btn_card:GetChild('n6'):SetScale(self:getCardSize(), self:getCardSize()) - self.card_width = 87 * self:getCardSize() - self.card_hight = 110 * self:getCardSize() + self.card_width = card_view.btn_card.width * self:getCardSize() + self.card_hight = card_view.btn_card.height * self:getCardSize() self._area_handcard_list:AddChild(card_view.btn_card) - card_view.btn_card:TweenMove(self:GetHandCardPos(card_view, #CountCards), 0.3) + -- card_view.btn_card:TweenMove(self:GetHandCardPos(card_view, #CountCards), 0.3) end + self:UpdateOutLine() + self:UpdateHandCardsPos() end function M:UpdateIsOnClick(isOut) @@ -738,20 +744,29 @@ function M:GetHandCardPos(cards_view, cards) local start_x = middle_x - (cards / 2 * (card_width)) x = start_x + (card_width) * (cards_view.index_X - 1) - if self:getCardSize() == 1 then - y = 90 - (85 * cards_view.index_Y) + -- local card_height = self.card_hight + -- y = 90 - card_height * 0.66 * cards_view.index_Y + if self:getCardSize() == 1.3 then + y = 100 - (119 * cards_view.index_Y) elseif self:getCardSize() == 1.2 then - y = 70 - (110 * cards_view.index_Y) + y = 100 - (110 * cards_view.index_Y) elseif self:getCardSize() == 0.8 then - y = 100 - (65 * cards_view.index_Y) + y = 100 - (85 * cards_view.index_Y) + elseif self:getCardSize() == 1.5 then + y = 100 - (137 * cards_view.index_Y) + elseif self:getCardSize() == 1.6 then + y = 100 - (147 * cards_view.index_Y) + elseif self:getCardSize() == 1.8 then + y = 105 - (162 * cards_view.index_Y) + elseif self:getCardSize() == 2 then + y = 105 - (180 * cards_view.index_Y) end return Vector2.New(x, y) end --更新 吃碰 function M:UpdateFzList(fz_list) - printlog("jefe self UpdateFzList=======") - pt(fz_list) + --printlog("UpdateFzList area_fz_list1") self._area_fz_list:RemoveChildren(0, -1, true) for i = 1, #fz_list do local fzitem = nil @@ -872,7 +887,16 @@ function M:getCardSize() if self._room.change_card_size ~= nil then return self._room.change_card_size else - return 1 + return 1.6 + end +end + +function M:GetFzMove() + if #self.card_list then + local fristCard = self.card_list[1].btn_card + return self._area_handcard_list:LocalToGlobal(fristCard.xy) + else + return self._area_fz_list:LocalToGlobal(Vector2.New(0, self._area_fz_list.height / 2)) end end diff --git a/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPSettingView.lua b/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPSettingView.lua index 58080559..f6ccb824 100644 --- a/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPSettingView.lua +++ b/lua_probject/extend_project/extend/zipai/changdepaohuzi/main/ZPSettingView.lua @@ -27,9 +27,9 @@ function ZPSettingView.new(blur_view, index, open_social,cardIndex) self.cd_time = 0 self._btn_dismiss_room_enable = false self._close_destroy = true - self.bigSize = 1.2 + self.bigSize = 1.03 self.mediumSize = 1 - self.smallSize = 0.8 + self.smallSize = 1 self._full = true self._anim_pop = 2 self._open_social = open_social @@ -84,7 +84,7 @@ function M:init(url) elseif room.change_card_size == self.mediumSize then size.selectedIndex = 1 elseif room.change_card_size == self.smallSize then - size.selectedIndex = 2 + size.selectedIndex = 1 end else room.change_card_size = 0 @@ -94,14 +94,14 @@ function M:init(url) if room.change_card_display ~= nil then local _str = string.sub(room.change_card_display, 1, 1) local n = tonumber(_str) - if n == 1 then + if n == 6 then c1.selectedIndex = 1 - elseif n == 2 then + elseif n == 1 then c1.selectedIndex = 0 elseif n == 8 then c1.selectedIndex = 3 else - c1.selectedIndex = 2 + c1.selectedIndex = 0 end end if self._open_social then @@ -245,16 +245,16 @@ function M:UpdateIndex() local _str = string.sub(room.change_card_display, 1, 1) local n = tonumber(_str) if n == 7 then - n = 2 + n = 6 end - if n == 1 then + if n == 6 then c1.selectedIndex = 1 - elseif n == 2 then + elseif n == 1 then c1.selectedIndex = 0 elseif n == 8 then c1.selectedIndex = 3 else - c1.selectedIndex = 2 + c1.selectedIndex = 0 end end end @@ -267,7 +267,7 @@ function M:UpdateCardSizeIndex() elseif room.change_card_size == self.mediumSize then size.selectedIndex = 1 elseif room.change_card_size == self.smallSize then - size.selectedIndex = 2 + size.selectedIndex = 1 end else size.selectedIndex = 0 @@ -299,7 +299,6 @@ function M:FillBgSection(cb, game_id, default_bg, room, qihu) cb(config.url) ctr_bg.selectedIndex = i - 1 if qihu ~= nil then - -- self._blur_view:GetChild('di_text').text = room.room_config:GetGameName() .. ' ' .. qihu .. '胡息起' self._blur_view:GetController('bg_state').selectedIndex = i - 1 end end @@ -316,7 +315,6 @@ function M:FillBgSection(cb, game_id, default_bg, room, qihu) index = ctr_bg.selectedIndex end if qihu ~= nil then - -- self._blur_view:GetChild('di_text').text = room.room_config:GetGameName() .. ' ' .. qihu .. '胡息起' if index < 3 then self._blur_view:GetController('bg_state').selectedIndex = index else @@ -324,6 +322,7 @@ function M:FillBgSection(cb, game_id, default_bg, room, qihu) end end end + function M:Destroy() local bg_id = self._view:GetController('bg').selectedIndex + 1 if self._bg ~= bg_id then diff --git a/wb_new_ui/.objs/cache/9n9stu2e/prgz94.info b/wb_new_ui/.objs/cache/9n9stu2e/prgz94.info deleted file mode 100644 index 48c4e4e9..00000000 --- a/wb_new_ui/.objs/cache/9n9stu2e/prgz94.info +++ /dev/null @@ -1,3 +0,0 @@ -{ - "modificationDate": 1630347590100 -} \ No newline at end of file diff --git a/wb_new_ui/.objs/cache/9n9stu2e/prgz94.wav b/wb_new_ui/.objs/cache/9n9stu2e/prgz94.wav deleted file mode 100644 index 58fb9fca..00000000 Binary files a/wb_new_ui/.objs/cache/9n9stu2e/prgz94.wav and /dev/null differ diff --git a/wb_new_ui/.objs/cache/9n9stu2e/prgz97.info b/wb_new_ui/.objs/cache/9n9stu2e/prgz97.info deleted file mode 100644 index d4322197..00000000 --- a/wb_new_ui/.objs/cache/9n9stu2e/prgz97.info +++ /dev/null @@ -1,3 +0,0 @@ -{ - "modificationDate": 1629947131815 -} \ No newline at end of file diff --git a/wb_new_ui/.objs/cache/9n9stu2e/prgz97.wav b/wb_new_ui/.objs/cache/9n9stu2e/prgz97.wav deleted file mode 100644 index badab3e1..00000000 Binary files a/wb_new_ui/.objs/cache/9n9stu2e/prgz97.wav and /dev/null differ diff --git a/wb_new_ui/assets/Extend_MJ_ChangSha/Btn_chat.xml b/wb_new_ui/assets/Extend_MJ_ChangSha/Btn_chat.xml new file mode 100644 index 00000000..5eca9e0b --- /dev/null +++ b/wb_new_ui/assets/Extend_MJ_ChangSha/Btn_chat.xml @@ -0,0 +1,11 @@ + + + + + + + + + +