梭哈同步修复资源引用跑得快
parent
a61888e8dd
commit
c5e9fa47fd
|
|
@ -56,6 +56,7 @@ function M:FillList(numbers)
|
|||
|
||||
self._viewList_allNumbers:SetVirtual()
|
||||
self.familyType.selectedIndex = 4
|
||||
self.lastType = 1
|
||||
self._viewList_allNumbers.itemRenderer = function(index, obj)
|
||||
local i = index + 1
|
||||
obj:GetController('lev').selectedIndex = numbers[i].lev - 1
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
local FamilyNumberRecord = {}
|
||||
|
||||
local M = FamilyNumberRecord
|
||||
|
||||
function FamilyNumberRecord.New(root)
|
||||
setmetatable(M, { __index = root })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
|
||||
self.familyType.selectedIndex = 5
|
||||
self.lastType = 1
|
||||
return self
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
@ -4,6 +4,7 @@ local GroupGameSettingView = import(".NewGroup.MngView.GroupGameSettingView_jain
|
|||
|
||||
---无窗口
|
||||
local FamilyAllNumbers = import(".Family.FamilyAllNumbers")
|
||||
local FamilyNumberRecord = import(".Family.FamilyNumberRecord")
|
||||
---
|
||||
FamilyView = {}
|
||||
|
||||
|
|
@ -102,6 +103,10 @@ function M:init(url)
|
|||
end)
|
||||
end)
|
||||
end)
|
||||
-------绑定成员战绩按钮
|
||||
view:GetChild('btn_family_record').onClick:Set(function()
|
||||
self._child_familyNumberRecord = FamilyNumberRecord.New(self)
|
||||
end)
|
||||
end
|
||||
|
||||
function M:ShareWx()
|
||||
|
|
@ -128,7 +133,7 @@ end
|
|||
|
||||
function M:AllNumber()
|
||||
self.lastType = 1
|
||||
local familyAllNumbers = FamilyAllNumbers.new(self)
|
||||
self._child_familyAllNumbers = FamilyAllNumbers.new(self)
|
||||
end
|
||||
|
||||
function M:ChangeNumber(fgCtr, group_id, limit, num, minus_only, sort_type)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
local MainRightPanelView = import('.MainRightPanelView')
|
||||
local PlayerInfoView = import('.PlayerInfoView_copy')
|
||||
local PlayerInfoView = import('.PlayerInfoView')
|
||||
local ChatView = import('.ChatView')
|
||||
local DismissRoomWindow = import('.DismissRoomWindow')
|
||||
local SettingView = import('.SettingView')
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ local TableBG = import 'Game.Data.TableBG'
|
|||
local SettingView = {}
|
||||
|
||||
local M = SettingView
|
||||
setmetatable(M, { __index = BaseWindow })
|
||||
setmetatable(M, {__index = BaseWindow})
|
||||
|
||||
function SettingView.new(blur_view)
|
||||
local self = setmetatable({}, { __index = M })
|
||||
local self = setmetatable({}, {__index = M})
|
||||
self.class = 'SettingView'
|
||||
self._currenIndex = 0
|
||||
self._blur_view = blur_view
|
||||
|
|
@ -24,46 +24,182 @@ function SettingView.new(blur_view)
|
|||
end
|
||||
|
||||
function M:init(url)
|
||||
|
||||
BaseWindow.init(self, url)
|
||||
|
||||
local view = self._view
|
||||
local slider_sound = view:GetChild('slider_vedio_sound')
|
||||
local slider_music = view:GetChild('slider_vedio_music')
|
||||
local btn_music = view:GetChild('btn_vedio_music')
|
||||
local btn_sound = view:GetChild('btn_vedio_sound')
|
||||
local slider_sound = view:GetChild('slider_sound')
|
||||
local slider_music = view:GetChild('slider_music')
|
||||
-- local btn_music = view:GetChild('btn_music')
|
||||
-- local btn_sound = view:GetChild('btn_sound')
|
||||
|
||||
-- slider_sound.value = GameApplication.Instance.SoundValue
|
||||
-- slider_music.value = GameApplication.Instance.MusicValue
|
||||
-- btn_music.selected = (GameApplication.Instance.MusicValue < 5 and false or true)
|
||||
slider_sound.value = GameApplication.Instance.SoundValue
|
||||
slider_music.value = GameApplication.Instance.MusicValue
|
||||
-- btn_sound.selected = GameApplication.Instance.SoundValue < 5 and false or true
|
||||
|
||||
slider_music.onChanged:Add(function()
|
||||
-- GameApplication.Instance.MusicValue = slider_music.value
|
||||
-- btn_music.selected = false
|
||||
-- GameApplication.Instance.MusicMute = false;
|
||||
end)
|
||||
|
||||
slider_sound.onChanged:Add(function()
|
||||
-- GameApplication.Instance.SoundValue = slider_sound.value
|
||||
-- btn_sound.selected = false
|
||||
-- GameApplication.Instance.SoundMute = false;
|
||||
end)
|
||||
|
||||
btn_sound.onClick:Add(function()
|
||||
-- GameApplication.Instance.SoundMute = btn_sound.selected;
|
||||
end)
|
||||
|
||||
btn_music.onClick:Add(function()
|
||||
-- GameApplication.Instance.MusicMute = btn_music.selected;
|
||||
end)
|
||||
|
||||
local _btn_logout = self._view:GetChild('btn_closeRoom')
|
||||
_btn_logout.onClick:Set(function()
|
||||
if self._blur_view.dismiss_room_cd_time > 0 then
|
||||
ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!")
|
||||
else
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
_gamectr:AskDismissRoom()
|
||||
slider_music.onChanged:Add(
|
||||
function()
|
||||
GameApplication.Instance.MusicValue = slider_music.value
|
||||
-- btn_music.selected = GameApplication.Instance.MusicValue < 5 and false or true
|
||||
end
|
||||
end)
|
||||
)
|
||||
|
||||
slider_sound.onChanged:Add(
|
||||
function()
|
||||
GameApplication.Instance.SoundValue = slider_sound.value
|
||||
-- btn_sound.selected = GameApplication.Instance.SoundValue < 5 and false or true
|
||||
end
|
||||
)
|
||||
|
||||
-- btn_sound.onChanged:Add(
|
||||
-- function()
|
||||
-- GameApplication.Instance.SoundValue = btn_sound.selected and 50 or 0
|
||||
-- slider_sound.value = GameApplication.Instance.SoundValue
|
||||
-- end
|
||||
-- )
|
||||
|
||||
-- btn_music.onChanged:Add(
|
||||
-- function()
|
||||
-- GameApplication.Instance.MusicValue = btn_music.selected and 50 or 0
|
||||
-- slider_music.value = GameApplication.Instance.MusicValue
|
||||
-- end
|
||||
-- )
|
||||
|
||||
self._stateController = view:GetController('state')
|
||||
self.cd_time_text = view:GetChild('n35')
|
||||
|
||||
local _btn_quit = view:GetChild('btn_quit')
|
||||
if _btn_quit then
|
||||
_btn_quit.onClick:Set(
|
||||
function()
|
||||
local _curren_msg = MsgWindow.new(self._root_view, '您是否退出游戏?', MsgWindow.MsgMode.OkAndCancel)
|
||||
_curren_msg.onOk:Add(
|
||||
function()
|
||||
Application.Quit()
|
||||
end
|
||||
)
|
||||
_curren_msg:Show()
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
local _btn_logout = view:GetChild('btn_logout')
|
||||
if _btn_logout then
|
||||
_btn_logout.onClick:Add(
|
||||
function()
|
||||
local _curren_msg = MsgWindow.new(self._root_view, '您是否退出当前账号?', MsgWindow.MsgMode.OkAndCancel)
|
||||
_curren_msg.onOk:Add(
|
||||
function()
|
||||
PlayerPrefs.DeleteKey('session_id')
|
||||
PlayerPrefs.Save()
|
||||
RestartGame()
|
||||
end
|
||||
)
|
||||
_curren_msg:Show()
|
||||
end
|
||||
)
|
||||
end
|
||||
local _btn_dismiss_room = view:GetChild('btn_dismiss_room')
|
||||
self._btn_dismiss_room = _btn_dismiss_room
|
||||
if _btn_dismiss_room then
|
||||
_btn_dismiss_room.onClick:Add(
|
||||
function()
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
_gamectr:AskDismissRoom()
|
||||
self:Destroy()
|
||||
end
|
||||
)
|
||||
end
|
||||
-- local btn_close = self._view:GetChild("btn_close")
|
||||
-- if btn_close then
|
||||
-- btn_close.onClick:Add(function( ... )
|
||||
|
||||
-- end)
|
||||
-- end
|
||||
end
|
||||
|
||||
--赋值bg_config
|
||||
function M:GetBGConfig()
|
||||
return TableBG.GetBGConfig()
|
||||
end
|
||||
--获得背景
|
||||
function M:GetBgByGameId(game_id)
|
||||
return TableBG.GetTableBG(game_id)
|
||||
end
|
||||
--显示背景选项,并加载背景
|
||||
function M:FillBgSection(cb, game_id, default_bg, bg_config)
|
||||
local view = self._view
|
||||
local lst_bg = view:GetChild('lst_bg')
|
||||
local ctr_bg = view:GetController('bg')
|
||||
bg_config = bg_config or self:GetBGConfig()
|
||||
for i = 1, #bg_config do
|
||||
local config = bg_config[i]
|
||||
local item = lst_bg:AddItemFromPool()
|
||||
item.icon = config.thumb
|
||||
--printlog("显示背景选项,并加载背景",item.icon)
|
||||
item.data = config
|
||||
if i > 6 then
|
||||
ctr_bg:AddPage(i - 1)
|
||||
end
|
||||
item.onClick:Add(
|
||||
function(index)
|
||||
cb(config.url,i)
|
||||
end
|
||||
)
|
||||
end
|
||||
self._game_id = game_id
|
||||
self._default_bg = default_bg
|
||||
self._bg = self:GetBgByGameId(game_id)
|
||||
if self._bg > 0 then
|
||||
lst_bg.selectedIndex = self._bg - 1
|
||||
else
|
||||
lst_bg.selectedIndex = default_bg - 1
|
||||
end
|
||||
end
|
||||
|
||||
function M:Show()
|
||||
self._stateController.selectedIndex = self.stateIndex
|
||||
BaseWindow.Show(self)
|
||||
if self.cd_coroutine ~= nil then
|
||||
coroutine.stop(self.cd_coroutine)
|
||||
end
|
||||
if self._stateController.selectedIndex == 2 and self.cd_time_text ~= nil then
|
||||
self.cd_coroutine =
|
||||
coroutine.start(
|
||||
function()
|
||||
while (self.cd_time > 0) do
|
||||
self:SetCanDissroom(false)
|
||||
self.cd_time = self.cd_time - 1
|
||||
self.cd_time = math.max(0, self.cd_time)
|
||||
self.cd_time_text.text = tostring(math.ceil(self.cd_time))
|
||||
if self.cd_time > 0 then
|
||||
coroutine.wait(1)
|
||||
end
|
||||
end
|
||||
self:SetCanDissroom(self._btn_dismiss_room_enable)
|
||||
self.cd_time_text.text = ''
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
function M:Destroy()
|
||||
local bg_id = self._view:GetController('bg').selectedIndex + 1
|
||||
if self._bg ~= bg_id then
|
||||
self._bg = bg_id
|
||||
TableBG.SaveTableBG(self._game_id, self._bg)
|
||||
end
|
||||
BaseWindow.Destroy(self)
|
||||
end
|
||||
|
||||
function M:SetCanDissroom(enable)
|
||||
self._btn_dismiss_room.enabled = enable
|
||||
end
|
||||
|
||||
function M:SetBtnDismissRoomEnable(enable)
|
||||
self._btn_dismiss_room_enable = enable
|
||||
self:SetCanDissroom(enable)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -1367,6 +1367,16 @@ function M:UpdateRound(round)
|
|||
self._text_maxRound.text = string.format("/%s局", total_round)
|
||||
end
|
||||
|
||||
-- function M:InitPlayerInfoView()
|
||||
-- self._player_info = {}
|
||||
-- local _player_info = self._player_info
|
||||
-- for i = 1, self._room.room_config.people_num do
|
||||
-- local tem = self._view:GetChild(string.format("player_info%d_%d", i, (self._state.selectedIndex % 2) + 1))
|
||||
-- _player_info[i] = PlayerInfoView.new(tem, self)
|
||||
-- tem.visible = false
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- function M:GetSoundFileName(type, num, isNewBout)
|
||||
-- local fileName
|
||||
-- if isNewBout then
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
--local EXMainView = import(".EXMainView")
|
||||
-- local EXMainView = import(".EXMainView")
|
||||
|
||||
local SettingView = require('Game.View.SettingView')
|
||||
local PKSettingView = {
|
||||
|
|
@ -10,6 +10,7 @@ local M = PKSettingView
|
|||
function PKSettingView.new(blur_view, show_type, isjiesan, url, cardSizeHandle)
|
||||
setmetatable(SettingView, { __index = BaseWindow })
|
||||
setmetatable(M, { __index = SettingView })
|
||||
-- setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = 'PKSettingView'
|
||||
self._currenIndex = 0
|
||||
|
|
@ -74,10 +75,15 @@ function M:init(url)
|
|||
end)
|
||||
end
|
||||
|
||||
-- function M:Show()
|
||||
-- SettingView.Show(self)
|
||||
-- -- self:showSettingOption()
|
||||
-- end
|
||||
function M:Show()
|
||||
BaseWindow.Show(self)
|
||||
-- self:showSettingOption()
|
||||
end
|
||||
|
||||
function M:Destroy()
|
||||
BaseWindow.Destroy(self)
|
||||
-- self:showSettingOption()
|
||||
end
|
||||
|
||||
-- 显示设置界面按钮
|
||||
function M:showSettingOption()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
--local EXMainView = import(".EXMainView")
|
||||
-- local EXMainView = import(".EXMainView")
|
||||
|
||||
local SettingView = require('Game.View.SettingView')
|
||||
local PKSettingView = {
|
||||
|
|
@ -10,6 +10,7 @@ local M = PKSettingView
|
|||
function PKSettingView.new(blur_view, show_type, isjiesan, url, cardSizeHandle)
|
||||
setmetatable(SettingView, { __index = BaseWindow })
|
||||
setmetatable(M, { __index = SettingView })
|
||||
-- setmetatable(M, { __index = BaseWindow })
|
||||
local self = setmetatable({}, { __index = M })
|
||||
self.class = 'PKSettingView'
|
||||
self._currenIndex = 0
|
||||
|
|
@ -32,82 +33,57 @@ function PKSettingView.new(blur_view, show_type, isjiesan, url, cardSizeHandle)
|
|||
end
|
||||
|
||||
function M:init(url)
|
||||
SettingView.init(self, url)
|
||||
-- -- show_type:1隐藏所有 2隐藏解散和换牌 3隐藏返回和换牌
|
||||
-- -- 设置界面有换牌功能的,需要在mainview中重写方法UpdateCard
|
||||
-- self._view:GetController('type').selectedIndex = self._show_type
|
||||
-- -- show_type1玩法的换牌功能
|
||||
-- if self._show_type == 1 then
|
||||
-- local room = DataManager.CurrenRoom
|
||||
-- local c1 = self._view:GetController('paimian')
|
||||
-- local user_id = DataManager.SelfUser.account_id
|
||||
-- local json_data = Utils.LoadLocalFile(user_id .. room.game_id .. 'pai')
|
||||
-- if json_data == nil then
|
||||
-- local _gamectr = self._gamectr
|
||||
-- c1.selectedIndex = 0
|
||||
-- else
|
||||
-- local _data = json.decode(json_data)
|
||||
-- local pai = _data['pai']
|
||||
BaseWindow.init(self, url)
|
||||
|
||||
-- c1.selectedIndex = pai
|
||||
-- end
|
||||
local view = self._view
|
||||
local slider_sound = view:GetChild('slider_vedio_sound')
|
||||
local slider_music = view:GetChild('slider_vedio_music')
|
||||
local btn_music = view:GetChild('btn_vedio_music')
|
||||
local btn_sound = view:GetChild('btn_vedio_sound')
|
||||
|
||||
-- slider_sound.value = GameApplication.Instance.SoundValue
|
||||
-- slider_music.value = GameApplication.Instance.MusicValue
|
||||
|
||||
-- c1.onChanged:Set(
|
||||
-- function()
|
||||
-- if self.__changePokerCallBack then
|
||||
-- self.__changePokerCallBack(c1.selectedIndex)
|
||||
-- end
|
||||
-- --点击换牌按钮后保存当前游戏的牌
|
||||
-- local user_id = DataManager.SelfUser.account_id
|
||||
-- local _data = {}
|
||||
-- _data['pai'] = c1.selectedIndex
|
||||
-- local key = user_id .. room.game_id .. 'pai'
|
||||
-- Utils.SaveLocalFile(key, json.encode(_data))
|
||||
-- end
|
||||
-- )
|
||||
slider_music.onChanged:Add(function()
|
||||
-- GameApplication.Instance.MusicValue = slider_music.value
|
||||
-- btn_music.selected = false
|
||||
-- GameApplication.Instance.MusicMute = false;
|
||||
end)
|
||||
|
||||
-- local card_size = self._view:GetController('card_size')
|
||||
-- json_data = Utils.LoadLocalFile(user_id .. room.game_id .. 'cardsize')
|
||||
-- if json_data == nil then
|
||||
-- local _gamectr = self._gamectr
|
||||
-- card_size.selectedIndex = 1
|
||||
-- else
|
||||
-- local _data = json.decode(json_data)
|
||||
-- local cardsize = _data['cardsize']
|
||||
slider_sound.onChanged:Add(function()
|
||||
-- GameApplication.Instance.SoundValue = slider_sound.value
|
||||
-- btn_sound.selected = false
|
||||
-- GameApplication.Instance.SoundMute = false;
|
||||
end)
|
||||
|
||||
-- card_size.selectedIndex = cardsize
|
||||
-- end
|
||||
btn_sound.onClick:Add(function()
|
||||
-- GameApplication.Instance.SoundMute = btn_sound.selected;
|
||||
end)
|
||||
|
||||
-- card_size.onChanged:Set(
|
||||
-- function()
|
||||
-- if self.__changePokerSizeCallBack then
|
||||
-- self.__changePokerSizeCallBack(card_size.selectedIndex)
|
||||
-- end
|
||||
-- --点击换牌按钮后保存当前游戏的牌
|
||||
-- local user_id = DataManager.SelfUser.account_id
|
||||
-- local _data = {}
|
||||
-- _data['cardsize'] = card_size.selectedIndex
|
||||
-- local key = user_id .. room.game_id .. 'cardsize'
|
||||
-- Utils.SaveLocalFile(key, json.encode(_data))
|
||||
-- end
|
||||
-- )
|
||||
btn_music.onClick:Add(function()
|
||||
-- GameApplication.Instance.MusicMute = btn_music.selected;
|
||||
end)
|
||||
|
||||
-- self._view:GetChild('btn_close').onClick:Add(
|
||||
-- function(...)
|
||||
-- self:Destroy()
|
||||
-- end
|
||||
-- )
|
||||
-- end
|
||||
-- if self.isjiesan then
|
||||
-- self._view:GetChild('n82').visible = false
|
||||
-- end
|
||||
local _btn_logout = self._view:GetChild('btn_closeRoom')
|
||||
_btn_logout.onClick:Set(function()
|
||||
if self._blur_view.dismiss_room_cd_time > 0 then
|
||||
ViewUtil.ErrorTip(nil, "您还处于解散冷却时间当中,请稍后重试!")
|
||||
else
|
||||
local _gamectr = ControllerManager.GetController(GameController)
|
||||
_gamectr:AskDismissRoom()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- function M:Show()
|
||||
-- SettingView.Show(self)
|
||||
-- -- self:showSettingOption()
|
||||
-- end
|
||||
function M:Show()
|
||||
BaseWindow.Show(self)
|
||||
-- self:showSettingOption()
|
||||
end
|
||||
|
||||
function M:Destroy()
|
||||
BaseWindow.Destroy(self)
|
||||
-- self:showSettingOption()
|
||||
end
|
||||
|
||||
-- 显示设置界面按钮
|
||||
function M:showSettingOption()
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 331 KiB After Width: | Height: | Size: 333 KiB |
Binary file not shown.
Loading…
Reference in New Issue