双人对局新界面
parent
8515e03703
commit
6c104ef0fd
|
|
@ -232,18 +232,21 @@ function M:InitView(url, isHideIpAdds)
|
|||
self._gamectr:PlayerReady()
|
||||
end)
|
||||
|
||||
-- local btn_xipai = _view:GetChild('btn_xipai')
|
||||
-- if btn_xipai then
|
||||
-- btn_xipai.onClick:Set(function()
|
||||
-- self._gamectr:PlayerXiPai()
|
||||
-- end)
|
||||
-- end
|
||||
if self._room.room_config.people_num ~= 2 then
|
||||
local btn_xipai = _view:GetChild('btn_xipai')
|
||||
if btn_xipai then
|
||||
btn_xipai.onClick:Set(function()
|
||||
self._gamectr:PlayerXiPai()
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
-- local btn_start = _view:GetChild('btn_start')
|
||||
-- btn_start.onClick:Set(function()
|
||||
-- self._gamectr:StartGame()
|
||||
-- end)
|
||||
local btn_start = _view:GetChild('btn_start')
|
||||
btn_start.onClick:Set(function()
|
||||
self._gamectr:StartGame()
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
local _btn_wxyqhy = _view:GetChild('btn_wxyqhy')
|
||||
if _btn_wxyqhy then
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
---
|
||||
|
||||
local PlayerInfoView = {
|
||||
_view = nil,
|
||||
_main_view = nil,
|
||||
|
|
@ -51,6 +49,7 @@ function M:init()
|
|||
self._ctr_room_owner = view:GetController('room_owner')
|
||||
self._ctr_mask_voice = view:GetController('mask_voice')
|
||||
self._ctr_dismiss_room = view:GetController('dismiss_room')
|
||||
self._ctr_site = view:GetController('site')
|
||||
|
||||
self.PlayerTGTips = view:GetChild('tuoguanTips')
|
||||
if self.PlayerTGTips and self.PlayerTGTips.displayObject.gameObject then
|
||||
|
|
@ -162,6 +161,23 @@ function M:FillData(player)
|
|||
end
|
||||
end
|
||||
|
||||
function M:SetStartType(peopleNum, seat)
|
||||
if peopleNum == 2 then
|
||||
if seat == 1 then
|
||||
self._ctr_site.selectedIndex = 1
|
||||
else
|
||||
self._ctr_site.selectedIndex = 2
|
||||
self._tex_player_name = 154
|
||||
end
|
||||
elseif peopleNum == 3 then
|
||||
self._ctr_site.selectedIndex = 2 + seat
|
||||
elseif peopleNum == 4 then
|
||||
self._ctr_site.selectedIndex = 5 + seat
|
||||
else
|
||||
self._ctr_site.selectedIndex = 0
|
||||
end
|
||||
end
|
||||
|
||||
function M:DismissRoom(state)
|
||||
state = state or false
|
||||
self._ctr_dismiss_room.selectedIndex = state == true and 1 or 0
|
||||
|
|
|
|||
|
|
@ -134,7 +134,6 @@ function ViewUtil.HandCardSort2(a,b)
|
|||
return a < b
|
||||
end
|
||||
|
||||
|
||||
function ViewUtil.HandCardSort3(a, b)
|
||||
local sort_a = a[1] or 101
|
||||
local sort_b = b[1] or 101
|
||||
|
|
@ -142,18 +141,15 @@ function ViewUtil.HandCardSort3(a,b)
|
|||
return sort_a < sort_b
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function ViewUtil.CardPos(obj, area, oder, index, offset,isAdd)
|
||||
function ViewUtil.CardPos(obj, area, oder, index, offset, isAdd, padding)
|
||||
offset = offset or 0
|
||||
padding = padding or 0
|
||||
if oder == AreaOderType.left_right then
|
||||
obj.x = index * obj.width + offset
|
||||
obj.x = index * (obj.width + padding) + offset
|
||||
elseif oder == AreaOderType.up_down then
|
||||
obj.y = index * obj.height + offset
|
||||
obj.y = index * (obj.height + padding) + offset
|
||||
elseif oder == AreaOderType.right_left then
|
||||
obj.x = (area.width - obj.width) - index * obj.width - offset
|
||||
obj.x = (area.width - obj.width) - index * (obj.width + padding) - offset
|
||||
elseif oder == AreaOderType.down_up then
|
||||
if isAdd then
|
||||
obj.y = area.height - obj.height - index * obj.height * 1.5 - offset
|
||||
|
|
@ -174,6 +170,7 @@ function ViewUtil.PlayMuisc(group, path)
|
|||
end
|
||||
GameApplication.Instance:PlayMuisc(group, path)
|
||||
end
|
||||
|
||||
function ViewUtil.PlaySound(group, path)
|
||||
if group ~= _current_group then
|
||||
if _current_group then
|
||||
|
|
@ -256,7 +253,6 @@ end
|
|||
|
||||
--依据宽度截断字符
|
||||
function ViewUtil.stringEllipsis(szText, size, full)
|
||||
|
||||
full = full or false
|
||||
size = size or 4
|
||||
--截断结果
|
||||
|
|
@ -282,9 +278,7 @@ function ViewUtil.stringEllipsis(szText,size,full)
|
|||
i = i + 3
|
||||
char_count = char_count + 1
|
||||
elseif byte ~= 32 then
|
||||
|
||||
if string.byte('A') <= byte and byte <= string.byte('Z') then
|
||||
|
||||
char_count = char_count + 1
|
||||
else
|
||||
char_count = char_count + 0.5
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@ function M:SendAction(id)
|
|||
_client:send(CS_Protocol.GAME_ACTION, _data)
|
||||
end
|
||||
|
||||
|
||||
function M:SendXiPaiAction(callBack)
|
||||
local _data = {}
|
||||
local _client = ControllerManager.GameNetClinet
|
||||
|
|
@ -97,11 +96,8 @@ function M:OnEventXiPai(evt_data)
|
|||
else
|
||||
ViewUtil.ErrorTip(1000000, "申请洗牌失败")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function M:OnEventXiPaiAnim(evt_data)
|
||||
printlog("洗牌动画===》》》》")
|
||||
pt(evt_data)
|
||||
|
|
@ -124,7 +120,6 @@ function M:OnEventXiPaiAnim(evt_data)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:OnEventSendCards(evt_data)
|
||||
if ViewManager.GetCurrenView().dview_class == LobbyView then
|
||||
self:ReturnToRoom()
|
||||
|
|
@ -178,7 +173,6 @@ function M:OnEventOutCard(evt_data)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
function M:OnEventTakeCard(evt_data)
|
||||
local _room = self._room
|
||||
local seat = evt_data["seat"]
|
||||
|
|
@ -301,7 +295,8 @@ function M:OnEventHu(evt_data)
|
|||
self._cacheEvent:Enqueue(function()
|
||||
win_p.card_list = cards
|
||||
table.sort(win_p.card_list, ViewUtil.HandCardSort)
|
||||
DispatchEvent(self._dispatcher,CS_GameEvent.ZPHuCard, evt_data["seat"], evt_data["from_seat"], win_card, cards, win_list)
|
||||
DispatchEvent(self._dispatcher, CS_GameEvent.ZPHuCard, evt_data["seat"], evt_data["from_seat"], win_card, cards,
|
||||
win_list)
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -46,8 +46,13 @@ function M:InitView(url)
|
|||
self._full = true
|
||||
-- self.Fix_Msg_Chat = Fix_Msg_Chat
|
||||
UIPackage.AddPackage("extend/majiang/changsha/ui/Extend_MJ_ChangSha")
|
||||
if self._room.room_config.people_num == 2 then
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_new_" .. room.room_config.people_num)
|
||||
-- MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
else
|
||||
MJMainView.InitView(self, "ui://Main_Majiang/Main_" .. room.room_config.people_num .. "_s2")
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -57,10 +62,10 @@ function M:InitView(url)
|
|||
self.LaiziBG.text = "鬼牌"
|
||||
self.LaiziBG.visible = false
|
||||
self.selectLaiziBtn = self._view:GetChild('selectlaizi')
|
||||
self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||
self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||
self.Laizi1Btn.visible = false
|
||||
self.Laizi2Btn.visible = false
|
||||
-- self.Laizi1Btn = self._view:GetChild('selectlaizi1')
|
||||
-- self.Laizi2Btn = self._view:GetChild('selectlaizi2')
|
||||
-- self.Laizi1Btn.visible = false
|
||||
-- self.Laizi2Btn.visible = false
|
||||
self.selectLaiziBtn.visible = false
|
||||
|
||||
self._hu_tip = HuTipView.new(self)
|
||||
|
|
@ -111,7 +116,7 @@ function M:EventInit()
|
|||
|
||||
_gamectr:AddEventListener(CS_GameEvent.SendCards, function(...)
|
||||
local arg = { ... }
|
||||
self._tex_LeftCard.text = arg[1]
|
||||
self._tex_LeftCard.text = string.format("剩余%d张牌", arg[1])
|
||||
local info = self._player_card_info[1]
|
||||
info._player.auto_out_card = false
|
||||
self:UpdateRound()
|
||||
|
|
@ -121,6 +126,7 @@ function M:EventInit()
|
|||
local p = list[i]
|
||||
local info = self._player_info[self:GetPos(p.seat)]
|
||||
info:FillData(p)
|
||||
info:SetStartType(_room.room_config.people_num, p.seat)
|
||||
info:MarkBank(p.seat == _room.banker_seat)
|
||||
info:Ready(false)
|
||||
local card_info = self._player_card_info[self:GetPos(p.seat)]
|
||||
|
|
@ -182,7 +188,7 @@ function M:EventInit()
|
|||
local arg = { ... }
|
||||
local seat = arg[1]
|
||||
local card = arg[2]
|
||||
self._tex_LeftCard.text = arg[3]
|
||||
self._tex_LeftCard.text = string.format("剩余%d张牌", arg[3])
|
||||
-- self:UpdateRoomInfo()
|
||||
local info = self._player_card_info[self:GetPos(seat)]
|
||||
info:UpdateHandCard(true)
|
||||
|
|
@ -450,7 +456,7 @@ function M:EventInit()
|
|||
|
||||
_gamectr:AddEventListener(CS_GameEvent.EvnetPiaoTip, function()
|
||||
self:UpdateRound()
|
||||
self._tex_LeftCard.text = "0"
|
||||
self._tex_LeftCard.text = "剩余0张牌"
|
||||
self._state.selectedIndex = 1
|
||||
if oldGameVersion == 1 then
|
||||
self:__PiaoNiaoTip()
|
||||
|
|
@ -514,8 +520,13 @@ function M:EventInit()
|
|||
end
|
||||
|
||||
function M:UpdateRound()
|
||||
if self._room.room_config.people_num == 2 then
|
||||
self._view:GetChild("text_round").text = string.format("当前局数:%d/%d", self._room.curren_round,
|
||||
self._room.room_config.round)
|
||||
else
|
||||
self._view:GetChild("tex_round1").text = self._room.curren_round
|
||||
self._view:GetChild("tex_round2").text = self._room.room_config.round
|
||||
end
|
||||
end
|
||||
|
||||
function M:InitPlayerInfoView()
|
||||
|
|
@ -851,7 +862,6 @@ function M:__KaiGang(data)
|
|||
self._view:AddChild(self.kg_card)
|
||||
self.kg_card:Center()
|
||||
info:UpdateOutCardList(nil, card, self._cursor)
|
||||
self._view:GetChild("remaining_card").text = string.format("剩余%d张牌", self._room.remain_cards)
|
||||
|
||||
coroutine.wait(1)
|
||||
self._popEvent = true
|
||||
|
|
@ -1105,7 +1115,7 @@ function M:ReloadRoom(bskip)
|
|||
|
||||
if bskip == nil or bskip == false then
|
||||
self:UpdateCardBox(self:GetPos(room.curren_outcard_seat))
|
||||
self._tex_LeftCard.text = room.left_count
|
||||
self._tex_LeftCard.text = string.format("剩余%d张牌", room.left_count)
|
||||
self:UpdateRound()
|
||||
end
|
||||
local me = room.self_player
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
local PlayerInfoView = require("Game.View.PlayerInfoView copy")
|
||||
local PlayerInfoView_copy = require("Game.View.PlayerInfoView copy")
|
||||
local PlayerInfoView = require("Game.View.PlayerInfoView")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.new(view, mainView)
|
||||
if mainView._room.room_config.people_num == 2 then
|
||||
setmetatable(M, { __index = PlayerInfoView_copy })
|
||||
else
|
||||
setmetatable(M, { __index = PlayerInfoView })
|
||||
end
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self._view = view
|
||||
self._main_view = mainView
|
||||
|
|
@ -12,7 +17,14 @@ function M.new(view, mainView)
|
|||
end
|
||||
|
||||
function M:init()
|
||||
if self._main_view._room.room_config.people_num ~= 2 then
|
||||
PlayerInfoView.init(self)
|
||||
self._tex_score = self._view:GetChild("info"):GetChild("tex_score1")
|
||||
self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2")
|
||||
self._ct_score = self._view:GetChild("info"):GetController("score")
|
||||
else
|
||||
PlayerInfoView_copy.init(self)
|
||||
end
|
||||
end
|
||||
|
||||
function M:ShowInteraction(type, str)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ local function CardPos(obj, area, oder, loc, offset)
|
|||
end
|
||||
|
||||
function M:UpdateHandCard(getcard, mp, opcard)
|
||||
print("nandaodaozhelil", getcard, mp, opcard)
|
||||
-- mp 是否明牌
|
||||
-- 如果不明牌,但是有 opcard 表示是起手胡
|
||||
getcard = getcard or false
|
||||
|
|
@ -56,7 +57,6 @@ function M:UpdateHandCard(getcard, mp, opcard)
|
|||
opnum = #opcard
|
||||
end
|
||||
local loc = 0
|
||||
print("===============================UpdateHandCard", getcard, mp, opcard, comp)
|
||||
if not mp then
|
||||
local comp_back = handcard_list["comp_back"]
|
||||
if self._current_card_type == 2 then
|
||||
|
|
@ -74,7 +74,8 @@ function M:UpdateHandCard(getcard, mp, opcard)
|
|||
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)
|
||||
print("=======zhihoudaizheli", oder)
|
||||
ViewUtil.CardPos(obj, self._area_handcard_list, oder, i, offset, nil, -12)
|
||||
end
|
||||
--改变左右两边的手牌的x值
|
||||
if self._current_card_type == 2 and (oder == AreaOderType.down_up or oder == AreaOderType.up_down) then
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ function M:setHandCardPos(btn_card, i, getcard)
|
|||
end
|
||||
|
||||
function M:UpdateHandCard(getcard, mp)
|
||||
print("======================onthisUpdateHandCard")
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
|
|
@ -113,7 +114,6 @@ function M:UpdateHandCard(getcard,mp)
|
|||
end
|
||||
else
|
||||
for i = 0, (#cards) - 1 do
|
||||
|
||||
local mp_card = UIPackage.CreateObject("Main_PokeMaJiang", "Mp_self_card" .. b3d)
|
||||
-- mp_card.icon = UIPackage.GetItemURL("Main_Majiang", "202_" .. cards[i+1])
|
||||
self:fillCard(mp_card, "201_", cards[i + 1])
|
||||
|
|
|
|||
|
|
@ -303,16 +303,20 @@ function M:UpdateOutCardList(outcard, card_item, cursor)
|
|||
col = ((i - num) % (num + 2))
|
||||
end
|
||||
end
|
||||
|
||||
if DataManager.CurrenRoom.room_config.people_num == 2 then
|
||||
ViewUtil.CardPos(obj, self._area_outcard_list, oder, col, nil, nil, -6)
|
||||
ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row, nil, nil, -12)
|
||||
else
|
||||
ViewUtil.CardPos(obj, self._area_outcard_list, oder, col)
|
||||
ViewUtil.CardPos(obj, self._area_outcard_list, multi_oder, row)
|
||||
end
|
||||
|
||||
|
||||
if self._current_card_type == 2 then
|
||||
self:adjust3dOutPut(obj, self._area_outcard_list, oder, num, i)
|
||||
end
|
||||
|
||||
self:fillCard(obj, card, outlist[i + 1])
|
||||
print("==============================thisout", obj, card, outlist[i + 1])
|
||||
-- 添加角标
|
||||
self:AddFlag(i + 1, outlist[i], obj)
|
||||
-- obj.icon = "ui://Main_Majiang/"..card .. outlist[i+1]
|
||||
|
|
|
|||
|
|
@ -55,11 +55,14 @@ function M:init()
|
|||
end
|
||||
|
||||
function M:setHandCardPos(btn_card, i, getcard)
|
||||
if DataManager.CurrenRoom.room_config.people_num == 2 then
|
||||
btn_card.x = i * (btn_card.width - 12) + (getcard and 20 or 0)
|
||||
else
|
||||
btn_card.x = i * btn_card.width * 1.05 + (getcard and 20 or 0)
|
||||
end
|
||||
end
|
||||
|
||||
function M:UpdateHandCard(getcard, mp)
|
||||
print("======================main", getcard, mp)
|
||||
if self.outcard_button then
|
||||
self.outcard_button:Dispose()
|
||||
self.outcard_button = nil
|
||||
|
|
@ -93,10 +96,15 @@ function M:UpdateHandCard(getcard, mp)
|
|||
if (not mp) then
|
||||
for i = 0, (#cards) - 1 do
|
||||
local tem_card = cards[i + 1]
|
||||
|
||||
|
||||
local btn_card = UIPackage.CreateObject(self:GetCardObjPack(), "Btn_Card" .. b3d)
|
||||
local btn_card = nil
|
||||
if DataManager.CurrenRoom.room_config.people_num == 2 then
|
||||
btn_card = UIPackage.CreateObject(self:GetCardObjPack(), "Btn_Card_jiangxi" .. b3d)
|
||||
else
|
||||
btn_card = UIPackage.CreateObject(self:GetCardObjPack(), "Btn_Card" .. b3d)
|
||||
btn_card:SetScale(1.05, 1.05)
|
||||
end
|
||||
|
||||
|
||||
-- btn_card.icon = UIPackage.GetItemURL("Main_Majiang", "201_" .. tem_card)
|
||||
self:fillCard(btn_card, "201_", tem_card)
|
||||
self:setHandCardPos(btn_card, i, i == #cards - 1 and getcard)
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue