291 lines
13 KiB
Lua
291 lines
13 KiB
Lua
-- MainViewNew
|
|
GameView = {}
|
|
|
|
local M = GameView
|
|
|
|
function GameView.new()
|
|
setmetatable(M, { __index = BaseView })
|
|
local self = setmetatable({}, { __index = M })
|
|
self.class = "GameView"
|
|
self._full = true
|
|
-- self:init()
|
|
return self
|
|
end
|
|
|
|
function M:init()
|
|
-- self:InitView("base/prefab/ViewGame.prefab", "base/prefab/ViewGame")
|
|
local view = self._view
|
|
|
|
self.option = view.transform:Find("imageList") --菜单
|
|
self.moneyInto = view.transform:Find("imageInto") --申请带入
|
|
self.moneyOut = view.transform:Find("imageOut") --申请带出
|
|
self.tableSet = view.transform:Find("imageSetTable") --设置牌桌
|
|
self.seeBattle = view.transform:Find("imageSeeBattle") --查看战报
|
|
self.roundSee = view.transform:Find("imageRoundSee") --牌局回放
|
|
self.share = view.transform:Find("imageShare") --分享
|
|
self.shuoming = view.transform:Find("imageShuoming") --说明
|
|
self.cardinformation = view.transform:Find("imageCardInformation") --牌型介绍
|
|
|
|
self.option.position = view.transform.position
|
|
self.moneyInto.position = view.transform.position
|
|
self.moneyOut.position = view.transform.position
|
|
self.tableSet.position = view.transform.position
|
|
self.seeBattle.position = view.transform.position
|
|
self.roundSee.position = view.transform.position
|
|
self.share.position = view.transform.position
|
|
|
|
self.option.gameObject:SetActive(false)
|
|
self.moneyInto.gameObject:SetActive(false)
|
|
self.moneyOut.gameObject:SetActive(false)
|
|
self.tableSet.gameObject:SetActive(false)
|
|
self.seeBattle.gameObject:SetActive(false)
|
|
self.roundSee.gameObject:SetActive(false)
|
|
self.share.gameObject:SetActive(false)
|
|
|
|
local btnOptionList = view.transform:Find("btnOptionList")
|
|
btnOptionList = btnOptionList:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(btnOptionList, function()
|
|
self.option.gameObject:SetActive(true)
|
|
end)
|
|
|
|
--菜单
|
|
-- --本手结束站起
|
|
local option_btnRoundOverStand = self.option:Find("imageCentre/btnRoundOverStand")
|
|
option_btnRoundOverStand = option_btnRoundOverStand:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(option_btnRoundOverStand, function()
|
|
|
|
end)
|
|
-- -- 牌桌设置
|
|
local option_btnSettingTable = self.option:Find("imageCentre/btnSettingTable")
|
|
option_btnSettingTable = option_btnSettingTable:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(option_btnSettingTable, function()
|
|
self.option.gameObject:SetActive(false)
|
|
self.tableSet.gameObject:SetActive(true)
|
|
end)
|
|
-- -- 保险说明
|
|
local option_btnSafetyInformation = self.option:Find("imageCentre/btnSafetyInformation")
|
|
option_btnSafetyInformation = option_btnSafetyInformation:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(option_btnSafetyInformation, function()
|
|
self.option.gameObject:SetActive(false)
|
|
self.shuoming.gameObject:SetActive(true)
|
|
self.textTitleShuoMing.text = "保险说明"
|
|
end)
|
|
-- -- 特色玩法说明
|
|
local option_btnTeSePlay = self.option:Find("imageCentre/btnTeSePlay")
|
|
option_btnTeSePlay = option_btnTeSePlay:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(option_btnTeSePlay, function()
|
|
self.option.gameObject:SetActive(false)
|
|
self.shuoming.gameObject:SetActive(true)
|
|
self.textTitleShuoMing.text = "特色玩法说明"
|
|
end)
|
|
-- -- 牌型介绍
|
|
local option_btnCardInformation = self.option:Find("imageCentre/btnCardInformation")
|
|
option_btnCardInformation = option_btnCardInformation:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(option_btnCardInformation, function()
|
|
|
|
end)
|
|
-- -- 游戏商城
|
|
local option_btnPlayShop = self.option:Find("imageCentre/btnPlayShop")
|
|
option_btnPlayShop = option_btnPlayShop:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(option_btnPlayShop, function()
|
|
|
|
end)
|
|
-- -- 申请带入
|
|
local option_btnMoneyInto = self.option:Find("imageCentre/btnMoneyInto")
|
|
option_btnMoneyInto = option_btnMoneyInto:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(option_btnMoneyInto, function()
|
|
|
|
end)
|
|
-- -- 申请带出
|
|
local option_btnMoneyOut = self.option:Find("imageCentre/btnMoneyOut")
|
|
option_btnMoneyOut = option_btnMoneyOut:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(option_btnMoneyOut, function()
|
|
|
|
end)
|
|
-- -- 站起围观
|
|
local option_btnStandSee = self.option:Find("imageCentre/btnStandSee")
|
|
option_btnStandSee = option_btnStandSee:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(option_btnStandSee, function()
|
|
|
|
end)
|
|
-- -- 留位离开
|
|
local option_btnLeaveTable = self.option:Find("imageCentre/btnLeaveTable")
|
|
option_btnLeaveTable = option_btnLeaveTable:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(option_btnLeaveTable, function()
|
|
|
|
end)
|
|
-- --退出牌桌
|
|
local option_btnExit = self.option:Find("imageCentre/btnExitTable")
|
|
option_btnExit = option_btnExit:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(option_btnExit, function()
|
|
UIManager.ShowUI(UIManager.LobbyView)
|
|
end)
|
|
-- --关闭
|
|
local option_btnClose = self.option:Find("imageCentre/btnClose")
|
|
option_btnClose = option_btnClose:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(option_btnClose, function()
|
|
self.option.gameObject:SetActive(false)
|
|
end)
|
|
|
|
--申请带入
|
|
local into_btnClose = self.moneyInto:Find("imageCentre/btnClose")
|
|
into_btnClose = into_btnClose:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(into_btnClose, function()
|
|
self.moneyInto.gameObject:SetActive(false)
|
|
end)
|
|
local into_btnEnter = self.moneyInto:Find("imageCentre/btnEnter")
|
|
into_btnEnter = into_btnEnter:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(into_btnEnter, function()
|
|
|
|
end)
|
|
|
|
--申请带出
|
|
local out_btnClose = self.moneyOut:Find("imageCentre/btnClose")
|
|
out_btnClose = out_btnClose:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(out_btnClose, function()
|
|
self.moneyOut.gameObject:SetActive(false)
|
|
end)
|
|
local out_btnCancel = self.moneyOut:Find("imageCentre/btnCancel")
|
|
out_btnCancel = out_btnCancel:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(out_btnCancel, function()
|
|
self.moneyOut.gameObject:SetActive(false)
|
|
end)
|
|
local out_btnConfirm = self.moneyOut:Find("imageCentre/btnConfirm")
|
|
out_btnConfirm = out_btnConfirm:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(out_btnConfirm, function()
|
|
|
|
end)
|
|
|
|
--牌桌设置
|
|
self.table_subTable = self.tableSet:Find("imageCentre/cardSet")
|
|
self.table_subMoneySet = self.tableSet:Find("imageCentre/moneySet")
|
|
self.table_subOnoff = self.tableSet:Find("imageCentre/onOffSet")
|
|
self.table_subMosterSet = self.tableSet:Find("imageCentre/mosterFunctionSet")
|
|
self.table_subTable.position = view.transform.position
|
|
self.table_subMoneySet.position = view.transform.position
|
|
self.table_subOnoff.position = view.transform.position
|
|
self.table_subMoneySet.position = view.transform.position
|
|
self.table_subTable.gameObject:SetActive(true)
|
|
self.table_subMoneySet.gameObject:SetActive(false)
|
|
self.table_subOnoff.gameObject:SetActive(false)
|
|
self.table_subMoneySet.gameObject:SetActive(false)
|
|
local setTable_btnClose = self.tableSet:Find("imageCentre/btnClose")
|
|
setTable_btnClose = setTable_btnClose:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(setTable_btnClose, function()
|
|
self.tableSet.gameObject:SetActive(false)
|
|
end)
|
|
local setTable_cardTable = self.tableSet:Find("imageCentre/btnTable") --牌桌
|
|
setTable_cardTable = setTable_cardTable:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(setTable_cardTable, function()
|
|
end)
|
|
local setTable_speedAdd = self.tableSet:Find("imageCentre/btnSpeedAdd") --快捷加注
|
|
setTable_speedAdd = setTable_speedAdd:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(setTable_speedAdd, function()
|
|
end)
|
|
local setTable_onoff = self.tableSet:Find("imageCentre/btnOnOff") --开关
|
|
setTable_onoff = setTable_onoff:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(setTable_onoff, function()
|
|
end)
|
|
local setTable_mosterFunction = self.tableSet:Find("imageCentre/btnMosterFunction") --房主功能
|
|
setTable_mosterFunction = setTable_mosterFunction:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(setTable_mosterFunction, function()
|
|
end)
|
|
|
|
--说明
|
|
self.textTitleShuoMing = self.shuoming:Find("imageCentre/textTitle")
|
|
self.textTitleShuoMing = self.textTitleShuoMing:GetComponent(typeof(UnityEngine.UI.Text))
|
|
|
|
local aar_cardinformation = {}
|
|
local aar_cardinformationIndex = 0
|
|
|
|
--牌型介绍
|
|
for i = 1, 10 do
|
|
local cardtypeinformationtemp = self.cardinformation:Find("imageCentre/imagebg/item" .. i)
|
|
for v = 1, 5 do
|
|
local cardTypeImageTemp = cardtypeinformationtemp:Find("imageCard" .. v)
|
|
cardTypeImageTemp = cardTypeImageTemp:GetComponent(typeof(UnityEngine.UI.Image))
|
|
aar_cardinformation[aar_cardinformationIndex] = cardTypeImageTemp
|
|
aar_cardinformationIndex = aar_cardinformationIndex + 1
|
|
end
|
|
end
|
|
local cardTypeInformationNames = GameUIText:GetText("cardinformation", "|")
|
|
for i = 0, cardTypeInformationNames.Length - 1 do
|
|
aar_cardinformation[i].sprite = GameCardSprite:GetSprite(cardTypeInformationNames[i])
|
|
end
|
|
|
|
--查看战报
|
|
local seeBattle_btnClose = self.seeBattle:Find("imageCentre/btnClose")
|
|
seeBattle_btnClose = seeBattle_btnClose:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(seeBattle_btnClose, function()
|
|
self.seeBattle.gameObject:SetActive(false)
|
|
end)
|
|
local seeBattle_btnYinKui = self.seeBattle:Find("imageCentre/btnYinKui")
|
|
seeBattle_btnYinKui = seeBattle_btnYinKui:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(seeBattle_btnYinKui, function()
|
|
self.moneyOut.gameObject:SetActive(false)
|
|
end)
|
|
local seeBattle_btnBaoXian = self.seeBattle:Find("imageCentre/btnBaoXian")
|
|
seeBattle_btnBaoXian = seeBattle_btnBaoXian:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(seeBattle_btnBaoXian, function()
|
|
self.moneyOut.gameObject:SetActive(false)
|
|
end)
|
|
|
|
--牌局回放
|
|
local round_btnClose = self.roundSee:Find("imageCentre/btnClose")
|
|
round_btnClose = round_btnClose:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(round_btnClose, function()
|
|
self.roundSee.gameObject:SetActive(false)
|
|
end)
|
|
local round_btnMe = self.roundSee:Find("imageCentre/btnMe")
|
|
round_btnMe = round_btnMe:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(round_btnMe, function()
|
|
end)
|
|
local round_btnKey = self.roundSee:Find("imageCentre/btnKey")
|
|
round_btnKey = round_btnKey:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(round_btnKey, function()
|
|
end)
|
|
local round_btnSave = self.roundSee:Find("imageCentre/btnSave")
|
|
round_btnSave = round_btnSave:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(round_btnSave, function()
|
|
end)
|
|
local round_btnShare = self.roundSee:Find("imageCentre/btnShare")
|
|
round_btnShare = round_btnShare:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(round_btnShare, function()
|
|
end)
|
|
local round_btnOther = self.roundSee:Find("imageCentre/btnOther")
|
|
round_btnOther = round_btnOther:GetComponent(typeof(UnityEngine.UI.Button))
|
|
LuaUIHelper:AddButtonClick(round_btnOther, function()
|
|
end)
|
|
|
|
--
|
|
|
|
self.arr_cardback = {}
|
|
for i = 1, 5 do
|
|
self.arr_cardback[i] = GameCardSprite:GetSprite("cardback" .. i .. "")
|
|
end
|
|
|
|
self.cardtype_enum = {
|
|
f = "f", --方块
|
|
h = "h", --黑桃
|
|
m = "m", --梅花
|
|
r = "r" --红桃
|
|
}
|
|
self.arr_cardface = {}
|
|
self.arr_cardface[1] = { cardtype = {} }
|
|
self.arr_cardface[2] = { cardtype = {} }
|
|
self.arr_cardface[3] = { cardtype = {} }
|
|
self.arr_cardface[4] = { cardtype = {} }
|
|
for index, value in ipairs(self.arr_cardface) do
|
|
value.cardtype[self.cardtype_enum.f] = { t = self.cardtype_enum.f }
|
|
value.cardtype[self.cardtype_enum.h] = { t = self.cardtype_enum.h }
|
|
value.cardtype[self.cardtype_enum.m] = { t = self.cardtype_enum.m }
|
|
value.cardtype[self.cardtype_enum.r] = { t = self.cardtype_enum.r }
|
|
local card_type_path = "cardtype" .. index .. "_"
|
|
for subIndex, subValue in ipairs(value.cardtype) do
|
|
for i = 1, 13 do
|
|
value.cardtype[subValue.t][i] = GameCardSprite:GetSprite(card_type_path .. subValue.t .. i)
|
|
end
|
|
end
|
|
end
|
|
end
|