local UIDragonArteryMain = UIViewClass() local HALF_COUNT_CELL = 6 local DEFAULT_FIELD_ID = 101 local OFFSET_BG = 600 local OFFSET_SELECT_SPEED = 0.5 local NORMAL_HEIGHT = 1080 local RATIO_EXPAND = 1.5 local DRAG_SPEED = 2 local OFFSET_UNIT = 5 local IMAGE_DESC = "" function UIDragonArteryMain:OnCreated() self.mainTransform = self.group_Main.transform self.oriPosX, self.oriPosY = self.mainTransform:GetLocalPosition() self:CalMoveParam() end --group_Main_Attach拖拽移动,group_Main_Attach需要跟着移动,且遵循一个正比关系,先求出比例系数slope function UIDragonArteryMain:CalMoveParam() local screenWidth, screenHeight = UIUtils.UIRoot:GetSizeDelta() local maxWidth = self.mainTransform:GetSizeDelta() if maxWidth / 2 > screenWidth then self.maxX = (maxWidth / 2 - screenWidth) + screenWidth / 2 - OFFSET_UNIT else self.maxX = maxWidth / 2 - screenWidth / 2 - OFFSET_UNIT end self.minX = -self.maxX self.horizontalAttachParamDict = {} local needExpand = screenHeight > NORMAL_HEIGHT for i, v in ipairs(self.group_Main_Attach) do local width, height = v.transform:GetSizeDelta() if needExpand then v.transform:SetSizeDelta(nil, height * RATIO_EXPAND) end local _, posY = v.transform:GetLocalPosition() local maxX if width / 2 > screenWidth then maxX = (width / 2 - screenWidth) + screenWidth / 2 - OFFSET_UNIT else maxX = width / 2 - screenWidth / 2 - OFFSET_UNIT end local slope = self.maxX / maxX self.horizontalAttachParamDict[i] = { slope = slope, oriPosY = posY, anim = nil } end end function UIDragonArteryMain:HorizontalAttachFollow(targetPosX, isAnim) for i, v in ipairs(self.group_Main_Attach) do local value = self.horizontalAttachParamDict[i] local posX = targetPosX / value.slope if isAnim then if value.anim == nil then value.anim = self:MoveToPos(v.transform, posX, value.oriPosY, OFFSET_SELECT_SPEED, false) else self:MoveToPos(value.anim, posX, value.oriPosY, OFFSET_SELECT_SPEED) end else v.transform:SetLocalPosition(posX) end end end function UIDragonArteryMain:OnOpened(context) self:RegistTriggerEvent(self.group_Main, UIEventTriggerType.Drag) for i, v in ipairs(self.group_Warfield) do self:RegistTriggerEvent(v.btn_Warfield, UIEventTriggerType.Drag) end self.countryName_wei = UTL.String.GetCountryName(LuaConst.Kingdom.Wei) self.countryName_shu = UTL.String.GetCountryName(LuaConst.Kingdom.Shu) self.countryName_wu = UTL.String.GetCountryName(LuaConst.Kingdom.Wu) self.countryName_qun = UTL.String.GetCountryName(LuaConst.Kingdom.Qun) self.maxPlayerNum = DataSheetManager.ConstData:GetDataByID("DragonArteryEnterNum").IntValue self.rewardArray = {} self.fieldMapping = {} --key:战场UI节点 value:战场id self.fieldNumDict = {} self:InitTabs() self:InitAllFields() self:InitStaticShow() self:RegistSystemEvent(EventID.UI_DragonArtery_SetFieldInfo, self.OnSetFieldInfo) self:RegistSystemEvent(EventID.UI_DragonArtery_RefreshFieldInfo, self.OnRefreshFieldInfo) self:RegistSystemEvent(EventID.UI_DragonArtery_UpdateSettingPower, self.UpdateSettingPower) UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_DragonArtery_FunctionName) --先默认选中第一个 self:MoveToFieldItem(self.group_Warfield[1], false) self:UpdateEntry() self:RefreshRedPoint() UIUtils.SetActive(self.UITemplateTitlePanel.fit_Right, false) MDL.FreeLineUp.FreeLineUpGetInfoRequest(MDL.FreeLineUp.FuncType.DragonArtery) end function UIDragonArteryMain:RefreshRedPoint() if MDL.Activities.GetRedPointByID(LuaConst.ActivityType.DragonArtery) then MDL.RedPoint.OneTimeRedPointRequest(MDL.RedPoint.RedPointType.DragonArtery, 1, true, LuaConst.ActivityType.DragonArtery) end self.btn_LineUp:SetRedPoint(CTL.RedPoint.GetRedPointActive(CTL.RedPoint.RedPointKey.DragonArteryLineUp)) end function UIDragonArteryMain:InitTabs() for i, v in DataSheetManager.DragonArtery:GetEnumerator() do local tabData = { isTypeTab = true, hasChildTab = false, config = v, } self.loop_Tab:AddData(tabData, 0) end end function UIDragonArteryMain:SwitchTabSelectState(cell, isSelect) if isSelect then UIUtils.SetActive(cell.img_Selected, true) UIUtils.SetActive(cell.img_UnSelected, false) else UIUtils.SetActive(cell.img_Selected, false) UIUtils.SetActive(cell.img_UnSelected, true) end end --返回移除的数量 function UIDragonArteryMain:UpdateChildTab(data, index, isAdd) if isAdd then local insertNum = 0 for i, v in DataSheetManager.DragonArteryWarfield:GetEnumerator() do if v.Belong == data.ID then insertNum = insertNum + 1 self.loop_Tab:InsertData(index + insertNum, v, 1) end end return 0 else local removeNum = 0 local warFieldNum = CTL.DragonArtery.GetWarFieldNum(data.ID) for i = index + warFieldNum, index + 1, -1 do removeNum = removeNum + 1 self.loop_Tab:RemoveIndex(i) end return removeNum end end function UIDragonArteryMain:InitStaticShow() local date, time = CTL.Activities.GetDetailsTimeDesc(DataSheetManager.ActivityData:GetDataByID(LuaConst.ActivityType.DragonArtery)) self.txt_info1.text = date .. time self.txt_info2.text = string.FormatByIdsId(Const_IDS.IDS_DragonArtery_WinCondition, UTL.Time.GetShowTimeBySeconds(DataSheetManager.ConstData:GetDataByID("DragonArteryWinTime").IntValue)) self.txt_rewardCondition.text = string.FormatByIdsId(Const_IDS.IDS_DragonArtery_RewardCondition, DataSheetManager.ConstData:GetDataByID("DragonArteryRewardPoint").IntValue) end function UIDragonArteryMain:InitAllFields() for i, v in DataSheetManager.DragonArteryWarfield:GetEnumerator() do if self.group_Warfield[i] then local mainData = DataSheetManager.DragonArtery:GetDataByID(v.Belong) self.group_Warfield[i].txt_Warfield.text = UIUtils.GetLocalizedTxt(Const_IDS[mainData.Title]) .. UIUtils.GetLocalizedTxt(Const_IDS[v.Name]) self.fieldMapping[self.group_Warfield[i]] = v.ID else logging.error(LTAG.ERROR, "fields num not match") end end end function UIDragonArteryMain:UpdateEntry() local activityState = CTL.Activities.GetState(LuaConst.ActivityType.DragonArtery) if activityState == CTL.Activities.ActivityState.NotOpen or activityState == CTL.Activities.ActivityState.End then self.btn_Enter:SetGray(true) local openTime = activityState == CTL.Activities.ActivityState.NotOpen and CTL.Activities.GetTimeToOpen(LuaConst.ActivityType.DragonArtery) or CTL.Activities.GetNextTimeToOpen(LuaConst.ActivityType.DragonArtery) self:StartRepeatFunc(self.UpdateEntry, openTime + 1, 1) else self.btn_Enter:SetGray(false) local closeTime = CTL.Activities.GetTimeToClose(LuaConst.ActivityType.DragonArtery) self:StartRepeatFunc(self.UpdateEntry, closeTime, 1) end if self.selectFieldId == nil then local curField = MDL.DragonArtery.GetCurEnterWarFieldID() if curField == nil then curField = DEFAULT_FIELD_ID end self:SelectFieldId(curField) else self:OnSelectFieldItem(self.selectFieldId) end end function UIDragonArteryMain:SelectFieldId(fieldId) local warFieldData = DataSheetManager.DragonArteryWarfield:GetDataByID(fieldId) if warFieldData == nil then logging.error(LTAG.ERROR, "can`t find warfild config", fieldId) return end local selectIndex = warFieldData.Belong - 1 if self.selectParentTabIndex == nil then self.loop_Tab:SelectIndex(selectIndex) else if self.selectParentTabData.hasChildTab then local lastTabId = self.selectParentTabData.config.ID if warFieldData.Belong == lastTabId then selectIndex = self.selectParentTabIndex elseif warFieldData.Belong > lastTabId then local warFieldNum = CTL.DragonArtery.GetWarFieldNum(lastTabId) selectIndex = self.selectParentTabIndex + warFieldNum + (warFieldData.Belong - lastTabId) end if self.selectParentTabIndex ~= selectIndex then self.loop_Tab:SelectIndex(selectIndex) end else if self.selectParentTabIndex ~= selectIndex then self.loop_Tab:SelectIndex(selectIndex) else self.selectParentTabData.hasChildTab = true self:SwitchTabSelectState(self.selectParentTabCell, true) self:OnSelectParentTab(selectIndex) end end end local index = 0 for i, v in DataSheetManager.DragonArteryWarfield:GetEnumerator() do if v.Belong == warFieldData.Belong then index = index + 1 end if v.ID == fieldId then break end end local selectChildIndex = warFieldData.Belong - 1 + index self.loop_Tab:SelectIndex(selectChildIndex) self:StartRepeatFunc(function() if selectChildIndex < HALF_COUNT_CELL then self.loop_Tab:MoveBegin() else self.loop_Tab:MoveEnd() end end, 0.1, 1) end function UIDragonArteryMain:SelectFieldItem(fieldData) local fieldItem for item, fieldId in pairs(self.fieldMapping) do if fieldId == fieldData.ID then fieldItem = item break end end if fieldItem then self:OnSelectFieldItemExp(fieldItem) self:OnSelectFieldItem(fieldData.ID) end end --获取视野内最终位置,防止拖拽到视野外 function UIDragonArteryMain:GetViewTargetPosX(posX) local targetPosX = math.min(math.max(posX, self.minX), self.maxX) return targetPosX end function UIDragonArteryMain:OnSelectFieldItemExp(fieldItem) CTL.Sound.PlayGameSound("UI_advanced") if self.selectFieldId then for item, fieldId in pairs(self.fieldMapping) do if fieldId == self.selectFieldId then item.Effect_2:StopUIEffect() break end end end fieldItem.Effect_2:PlayUIEffect() self:MoveToFieldItem(fieldItem, true) end function UIDragonArteryMain:MoveToFieldItem(fieldItem, isAnim) local posX = fieldItem.gameObject.transform:GetLocalPosition() local targetPosX = self:GetViewTargetPosX(-posX - OFFSET_BG) if isAnim then if self.mainMoveAnim == nil then self.mainMoveAnim = self:MoveToPos(self.mainTransform, targetPosX, self.oriPosY, OFFSET_SELECT_SPEED, false) else self:MoveToPos(self.mainMoveAnim, targetPosX, self.oriPosY, OFFSET_SELECT_SPEED) end else self.mainTransform:SetLocalPosition(targetPosX) end self:HorizontalAttachFollow(targetPosX, isAnim) end function UIDragonArteryMain:OnDrag(comp, eventData) local posX = self.mainTransform:GetLocalPosition() local offsetPosX = eventData.delta.x, eventData.delta.y local targetPosX = self:GetViewTargetPosX(posX + offsetPosX * DRAG_SPEED) self.mainTransform:SetLocalPosition(targetPosX) self:HorizontalAttachFollow(targetPosX) end function UIDragonArteryMain:OnSelectFieldItem(fieldId) self.selectFieldId = fieldId self:UpdateTitleTime() self:UpdateFirstEnterTime() self:UpdateReward() self:UpdateSelectFieldInfo(nil) local fieldData = DataSheetManager.DragonArteryWarfield:GetDataByID(fieldId) self.txt_entry.text = string.FormatByIdsId(Const_IDS.IDS_DragonArtery_ChooseWarfield, UIUtils.GetLocalizedTxt(Const_IDS[fieldData.Name])) MDL.DragonArtery.GetDragonArteryInfoReq(fieldId, true) end function UIDragonArteryMain:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.itemLoopScroll then UTL.Item.SetItemCell(cellTable.UIItem, data.ItemID, data.ItemNum, false) else if data.isTypeTab then UIUtils.SetLabelText(cellTable.txt_Name_Normal, Const_IDS[data.config.Name]) UIUtils.SetLabelText(cellTable.txt_Name_Selected, Const_IDS[data.config.Name]) cellTable.obj_state:SetState(data.config.ID - 1) if self.selectParentTabCell == cellTable then self:SwitchTabSelectState(cellTable, true) else self:SwitchTabSelectState(cellTable, false) end else cellTable.obj_state:SetState(data.Belong - 1) if MDL.DragonArtery.IsWarFieldTimeLimit(data) then UIUtils.SetLabelText(cellTable.txt_Name_Normal, Const_IDS[data.Name]) local curNum = self.fieldNumDict[data.ID] or 0 if curNum >= self.maxPlayerNum then cellTable.txt_Num.text = UTL.Color.FormatRedColor(string.format("(%d/%d)", curNum, self.maxPlayerNum)) else cellTable.txt_Num.text = string.format("(%d/%d)", curNum, self.maxPlayerNum) end else UIUtils.SetLabelText(cellTable.txt_Name_Normal, Const_IDS[data.Name]) cellTable.txt_Num.text = nil end if self.selectFieldId and self.selectFieldId == data.ID then self:SwitchTabSelectState(cellTable, true) self.selectChildTabCell = cellTable else self:SwitchTabSelectState(cellTable, false) end end end end --选中父页签 function UIDragonArteryMain:OnSelectParentTab(index) if self.selectParentTabData == nil then return end self:UpdateChildTab(self.selectParentTabData.config, index, self.selectParentTabData.hasChildTab) --如果是展开,且当前选中的子页签的类型不一致,默认选中第一个子页签 if self.selectParentTabData.hasChildTab then if self.selectFieldId == nil then self.loop_Tab:SelectIndex(index + 1) else local fieldData = DataSheetManager.DragonArteryWarfield:GetDataByID(self.selectFieldId) if fieldData.Belong ~= self.selectParentTabData.config.ID then self.loop_Tab:SelectIndex(index + 1) end end end end function UIDragonArteryMain:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.itemLoopScroll then UTL.ItemTips.ShowCommonTipsById(self.rewardArray[index + 1].ItemID) else if data.isTypeTab then local removeNum = 0 if self.selectParentTabData and self.selectParentTabData ~= data then if self.selectParentTabData.hasChildTab then self.selectChildTabCell = nil self.selectParentTabData.hasChildTab = false self:SwitchTabSelectState(self.selectParentTabCell, false) removeNum = self:UpdateChildTab(self.selectParentTabData.config, self.selectParentTabIndex, false) --如果是位于index上边的子标签被移除,会导致cell数量发生变化,这个cell的index应该减去移除的数量 if index > self.selectParentTabIndex then index = index - removeNum end end end self.selectParentTabCell = cellTable self.selectParentTabData = data self.selectParentTabIndex = index data.hasChildTab = not data.hasChildTab self:SwitchTabSelectState(cellTable, data.hasChildTab) self:OnSelectParentTab(index) else if self.selectChildTabCell then self:SwitchTabSelectState(self.selectChildTabCell, false) end self.selectChildTabCell = cellTable self:SwitchTabSelectState(cellTable, true) self:SelectFieldItem(data) end end end function UIDragonArteryMain:UpdateTitleTime() if self.selectParentTabData == nil then return end local data = self.selectParentTabData.config local allowTime = data.OfficerEnterTime + data.RatingEnterTime local passedTime = CTL.Activities.GetOpenedActivityPassedTime(LuaConst.ActivityType.DragonArtery) if passedTime and passedTime <= allowTime then UIUtils.SetActive(self.group_Middle, true) local offset = allowTime - passedTime self.timer_Entry:ResetAndBeginCustomTimer(false, offset, 0, "{0}:{1}", 1) self:StartRepeatFunc(self.UpdateTitleTime, offset, 1) else self.timer_Entry:EndTimer() UIUtils.SetActive(self.group_Middle, false) end end function UIDragonArteryMain:OnClosed() --离开界面,告知服务器不再主动推送界面变化 MDL.DragonArtery.GetDragonArteryInfoReq(0, false) UIUtils.SetActive(self.UITemplateTitlePanel.fit_Right, true) end function UIDragonArteryMain:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UIDragonArteryMain:OnButtonClicked(comp) if comp == self.event_Reward or comp == self.btn_Reward then UIManager.OpenView(Const_UI_Lua.UIEnum.UIDragonArteryRewardPrePanel) elseif comp == self.UITemplateTitlePanel.btn_close then self:CloseView(true) elseif comp == self.UITemplateTitlePanel.btn_Info then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, { id = LuaConst.NoteID.DragonArtery, params = { UTL.Time.GetShowTimeBySeconds(DataSheetManager.ConstData:GetDataByID("DragonArteryWinTime").IntValue) } }) elseif comp == self.btn_Setting then UIManager.OpenView(Const_UI_Lua.UIEnum.UIDragonArteryPowerSetting) elseif comp == self.btn_Enter then if MDL.FreeLineUp.IsLineUpHero(MDL.FreeLineUp.FuncType.DragonArtery) then MDL.DragonArtery.DragonArteryEnterReq(self.selectFieldId) else UTL.MessageBox.ShowOKCancelBox(nil, UIUtils.GetLocalizedTxt(Const_IDS["IDS_NationClimbTower_GoToSave"]), function() UIManager.OpenView(Const_UI_Lua.UIEnum.UIDragonArterySelectOfficer, { freeLineupFuncType = MDL.FreeLineUp.FuncType.DragonArtery, activityType = LuaConst.ActivityType.DragonArtery }, Const_UI_Lua.UIEnum.UIDemonGodSelectOfficer) end ) end elseif comp == self.btn_Salary then UIManager.OpenView(Const_UI_Lua.UIEnum.UICountrySalaryBase) elseif comp == self.btn_Report then local activityState = CTL.Activities.GetState(LuaConst.ActivityType.DragonArtery) if activityState == CTL.Activities.ActivityState.NotOpen or activityState == CTL.Activities.ActivityState.End then MDL.DragonArtery.DragonArteryCountryRankReq() else CTL.Tips.AddTipsMsg(Const_IDS.IDS_DragonArtey_WaitData) end elseif comp == self.btn_KingRight then UIManager.OpenView(Const_UI_Lua.UIEnum.UICountryKingRightPopUp) elseif comp == self.btn_LineUp then self.btn_LineUp:SetRedPoint(false) CTL.RedPoint.RemoveRedPoint(CTL.RedPoint.RedPointKey.DragonArteryLineUp) UIManager.OpenView(Const_UI_Lua.UIEnum.UIDragonArterySelectOfficer, { freeLineupFuncType = MDL.FreeLineUp.FuncType.DragonArtery, activityType = LuaConst.ActivityType.DragonArtery }, Const_UI_Lua.UIEnum.UIDemonGodSelectOfficer) else for item, fieldId in pairs(self.fieldMapping) do if comp == item.btn_Warfield then self:SelectFieldId(fieldId) break end end end end function UIDragonArteryMain:UpdateReward() if self.selectParentTabData == nil then return end local data = self.selectParentTabData.config self.txt_Bottom.text = string.FormatByIdsId(Const_IDS.IDS_DragonArtey_WfDragonSoul, UIUtils.GetLocalizedTxt(Const_IDS[data.Name]), data.DragonSoulNum, IMAGE_DESC) table.clearArray(self.rewardArray) local cfg = DataSheetManager.RewardClientShow:GetDataByClientShowID(data.RewardShow) local rewardData = DataSheetUtil.GetRewardClientShowItemTable(cfg) for i, v in ipairs(rewardData) do self.rewardArray[i] = v end self.itemLoopScroll:ReloadAll(self.rewardArray) end --官员优先进入的时间更新 function UIDragonArteryMain:UpdateFirstEnterTime() if self.selectParentTabData == nil then return end local data = self.selectParentTabData.config if data.OfficerEnterTime > 0 then local passedTime = CTL.Activities.GetOpenedActivityPassedTime(LuaConst.ActivityType.DragonArtery) if passedTime == nil then self.timer_enterFirst:EndTimer() self.timer_enterFirst:SetCDLabel(nil) else if passedTime <= data.OfficerEnterTime then --获取国家官员 local content = CTL.DragonArtery.GetEnterFirstJobContent(data) local offset = data.OfficerEnterTime - passedTime self.timer_enterFirst:ResetAndBeginCustomTimer(false, offset, 0, string.FormatByIdsId(Const_IDS.IDS_DragonArtery_EnterInAdvance, content), 1) self:StartRepeatFunc(self.UpdateFirstEnterTime, offset, 1) else self.timer_enterFirst:EndTimer() self.timer_enterFirst:SetCDLabel(UIUtils.GetLocalizedTxt(Const_IDS.IDS_DragonArtey_OverBRCanEnter)) end end else self.timer_enterFirst:EndTimer() self.timer_enterFirst:SetCDLabel(UIUtils.GetLocalizedTxt(Const_IDS.IDS_DragonArtey_LowChoseTip)) end self:UpdateSettingPower() end function UIDragonArteryMain:UpdateSettingPower() if self.selectParentTabData == nil then return end local data = self.selectParentTabData.config if data.IsSetRating == 1 then local passedTime = CTL.Activities.GetOpenedActivityPassedTime(LuaConst.ActivityType.DragonArtery) if passedTime and passedTime > data.OfficerEnterTime then local power = MDL.DragonArtery.GetSettingPowerByField(self.selectFieldId) if power > 0 then self.txt_PowerSetting.text = string.FormatByIdsId(Const_IDS.IDS_DragonArtey_Condition, MDL.DragonArtery.GetSettingPowerByField(self.selectFieldId)) else UIUtils.SetLabelText(self.txt_PowerSetting, Const_IDS.IDS_DragonArtey_NoBRLimitAll) end else self.txt_PowerSetting.text = nil end else self.txt_PowerSetting.text = nil end end function UIDragonArteryMain:UpdateSelectFieldInfo(numArray) if self.selectParentTabData == nil then return end local data = self.selectParentTabData.config if data.IsSetRating == 1 then local activityState = CTL.Activities.GetState(LuaConst.ActivityType.DragonArtery) if activityState ~= CTL.Activities.ActivityState.Opening then self.txt_CountryNum1.text = string.FormatByIdsId(Const_IDS.IDS_DragonArtery_EnterNum, self.countryName_wei, UIUtils.GetLocalizedTxt(Const_IDS.IDS_GuildBoss_NotOpen)) self.txt_CountryNum2.text = string.FormatByIdsId(Const_IDS.IDS_DragonArtery_EnterNum, self.countryName_shu, UIUtils.GetLocalizedTxt(Const_IDS.IDS_GuildBoss_NotOpen)) self.txt_CountryNum3.text = string.FormatByIdsId(Const_IDS.IDS_DragonArtery_EnterNum, self.countryName_wu, UIUtils.GetLocalizedTxt(Const_IDS.IDS_GuildBoss_NotOpen)) self.txt_CountryNum4.text = string.FormatByIdsId(Const_IDS.IDS_DragonArtery_EnterNum, self.countryName_qun, UIUtils.GetLocalizedTxt(Const_IDS.IDS_GuildBoss_NotOpen)) else if numArray and #numArray > 0 then self.txt_CountryNum1.text = string.FormatByIdsId(Const_IDS.IDS_DragonArtery_EnterNum, self.countryName_wei, numArray[LuaConst.Kingdom.Wei] .. "/" .. self.maxPlayerNum) self.txt_CountryNum2.text = string.FormatByIdsId(Const_IDS.IDS_DragonArtery_EnterNum, self.countryName_shu, numArray[LuaConst.Kingdom.Shu] .. "/" .. self.maxPlayerNum) self.txt_CountryNum3.text = string.FormatByIdsId(Const_IDS.IDS_DragonArtery_EnterNum, self.countryName_wu, numArray[LuaConst.Kingdom.Wu] .. "/" .. self.maxPlayerNum) self.txt_CountryNum4.text = string.FormatByIdsId(Const_IDS.IDS_DragonArtery_EnterNum, self.countryName_qun, numArray[LuaConst.Kingdom.Qun] .. "/" .. self.maxPlayerNum) end end UIUtils.SetActive(self.btn_Setting, true) else self.txt_CountryNum1.text = nil self.txt_CountryNum2.text = nil self.txt_CountryNum3.text = nil self.txt_CountryNum4.text = nil UIUtils.SetActive(self.btn_Setting, false) end end --fieldIds 所有的战场id --roomPlayerNums 所有战场的本国人数 function UIDragonArteryMain:OnSetFieldInfo(numArray, fieldIds, roomPlayerNums) if #fieldIds == #roomPlayerNums then for i, v in ipairs(fieldIds) do self.fieldNumDict[v] = roomPlayerNums[i] end self.loop_Tab:RefreshCells(false) else logging.error(LTAG.ERROR, "fieldIds not match roomPlayerNums", #fieldIds, #roomPlayerNums) end self:UpdateSelectFieldInfo(numArray) end function UIDragonArteryMain:OnRefreshFieldInfo(fieldId, numArray) self.fieldNumDict[fieldId] = numArray[MDL.Country.GetMyCountryId()] self.loop_Tab:RefreshCells(false) if fieldId == self.selectFieldId then self:UpdateSelectFieldInfo(numArray) end end return UIDragonArteryMain