单击双击设置
parent
40301d2f4e
commit
e5d1240726
|
|
@ -36,6 +36,16 @@ local function GetPlayer(self, playerId)
|
|||
return nil
|
||||
end
|
||||
|
||||
local function LoadClickData()
|
||||
local json_data = Utils.LoadLocalFile("clickMode")
|
||||
|
||||
if json_data == "null" then
|
||||
return "double"
|
||||
end
|
||||
|
||||
return json.decode(json_data)
|
||||
end
|
||||
|
||||
|
||||
--lingmeng新全局标记
|
||||
lingmengxin = false
|
||||
|
|
@ -96,6 +106,9 @@ function M:InitView(url, isHideIpAdds)
|
|||
---- print(url)
|
||||
---- print(debug.traceback())
|
||||
BaseView.InitView(self, url)
|
||||
|
||||
self.clickMode = LoadClickData()
|
||||
|
||||
--
|
||||
|
||||
--[[ 多语言切换(适用于设置界面使用Main_Majiang中SettingView2的游戏)
|
||||
|
|
|
|||
|
|
@ -243,14 +243,26 @@ function M:__OnClickHandCard(context)
|
|||
self._ctr_seletedGet.selectedIndex = 1
|
||||
self._flag_seletedGet = 0
|
||||
local button = context.data
|
||||
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
if _room.curren_outcard_seat == _room.self_player.seat then
|
||||
if self._mainView.clickMode == "single" or Utils.IsDoubleClick(context) or self._click_index == self._view_handCardList.selectedIndex then
|
||||
local card = button.data
|
||||
self._mainView:OutCard(card.card_item)
|
||||
self:ClearChoose()
|
||||
return
|
||||
end
|
||||
end
|
||||
self._click_index = self._view_handCardList.selectedIndex
|
||||
|
||||
--[[
|
||||
if ((Utils.IsDoubleClick(context) or self._click_index == self._view_handCardList.selectedIndex) and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||
local card = button.data
|
||||
self._mainView:OutCard(card.card_item)
|
||||
self:ClearChoose()
|
||||
end
|
||||
self._click_index = self._view_handCardList.selectedIndex
|
||||
]]
|
||||
end
|
||||
|
||||
function M:__OnClickGetCard(context, flag)
|
||||
|
|
@ -258,13 +270,25 @@ function M:__OnClickGetCard(context, flag)
|
|||
self._click_index = self._view_handCardList.selectedIndex
|
||||
local button = context.sender
|
||||
local _room = DataManager.CurrenRoom
|
||||
|
||||
if _room.curren_outcard_seat == _room.self_player.seat then
|
||||
if self._mainView.clickMode == "single" or Utils.IsDoubleClick(context) or self._flag_seletedGet == 1 then
|
||||
local card = button.data
|
||||
self._mainView:OutCard(card.card_item)
|
||||
self:ClearChoose()
|
||||
return
|
||||
end
|
||||
end
|
||||
self._flag_seletedGet = 1
|
||||
|
||||
--[[
|
||||
if ((Utils.IsDoubleClick(context) or self._flag_seletedGet == 1) and _room.curren_outcard_seat == _room.self_player.seat) then
|
||||
local card = button.data
|
||||
self._mainView:OutCard(card.card_item)
|
||||
self:ClearChoose()
|
||||
return
|
||||
end
|
||||
self._flag_seletedGet = 1
|
||||
]]
|
||||
end
|
||||
|
||||
function M:ChooseHand(index)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ local function IsRoomOwer()
|
|||
return roomOwner == DataManager.SelfUser.account_id
|
||||
end
|
||||
|
||||
local function SaveClickMode(self)
|
||||
Utils.SaveLocalFile("clickMode", json.encode(self._mainView.clickMode))
|
||||
end
|
||||
|
||||
function M:Reflash()
|
||||
if IsRoomOwer() then
|
||||
self.cBtn.selectedIndex = 1
|
||||
|
|
@ -24,6 +28,12 @@ function M:Reflash()
|
|||
if self.flag_witness then
|
||||
self.cBtn.selectedIndex = 0
|
||||
end
|
||||
|
||||
if self._mainView.clickMode == "single" then
|
||||
self.cBtnSelect.selectedIndex = 0
|
||||
elseif self._mainView.clickMode == "double" then
|
||||
self.cBtnSelect.selectedIndex = 1
|
||||
end
|
||||
end
|
||||
|
||||
function M:Show()
|
||||
|
|
@ -31,6 +41,11 @@ function M:Show()
|
|||
self:Reflash()
|
||||
end
|
||||
|
||||
function M:Close()
|
||||
SaveClickMode(self)
|
||||
BaseWindow.Close(self)
|
||||
end
|
||||
|
||||
-- show_dialect是否显示'切换方言'选项
|
||||
function MJSettingViewNew.new(blur_view, flag_witness)
|
||||
setmetatable(SettingView, { __index = BaseWindow })
|
||||
|
|
@ -74,15 +89,21 @@ function M:init(url)
|
|||
self.btn_cancelRoom = self._view:GetChild("btn_cancelRoom")
|
||||
self.btn_closeRoom = self._view:GetChild("btn_closeRoom")
|
||||
|
||||
self.cBtnSelect = self._view:GetController("cBtnSelect")
|
||||
|
||||
self.cBtn = self._view:GetController('cBtn')
|
||||
|
||||
|
||||
self.btn_singleClick.onChanged:Set(function()
|
||||
|
||||
if self.btn_singleClick.selected then
|
||||
self._mainView.clickMode = "single"
|
||||
end
|
||||
end)
|
||||
|
||||
self.btn_doubleClick.onChanged:Set(function()
|
||||
|
||||
if self.btn_doubleClick.selected then
|
||||
self._mainView.clickMode = "double"
|
||||
end
|
||||
end)
|
||||
|
||||
self.slider_music.onChanged:Add(function()
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
<Button checked="true" title="单击" controller="cBtnSelect" page="0"/>
|
||||
</component>
|
||||
<component id="n23_xblm" name="btn_doubleClick" src="xblm1ad" fileName="checkbtn_click.xml" xy="646,285" group="n24_xblm" customData="n2.text = "双击"">
|
||||
<Button title="单击" controller="cBtnSelect" page="1"/>
|
||||
<Button title="双击" controller="cBtnSelect" page="1"/>
|
||||
</component>
|
||||
<group id="n24_xblm" name="click" xy="205,263" size="491,94"/>
|
||||
<text id="n25_xblm" name="title_sound" xy="205,397" size="151,94" group="n28_xblm" font="ui://27vd145bh35o7ilb" fontSize="72" color="#695741" leading="0" letterSpacing="5" text="音效"/>
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue