local UISettingInitial = UIViewClass() local EventSystem = require 'Event/EventSystem' function UISettingInitial:OnOpened(context) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_InitialSetting_Hint_2) -- 弹窗标题 -- 视角模式 self.CameraCtrl = CameraController.Instance self.group_ViewMode:SelectIndex(self.CameraCtrl:GetViewMode()) self.viewType = self.CameraCtrl:GetViewMode() -- 推荐画质 local deviceLevel = SettingAPI.deviceLevel if SettingAPI.deviceLevel > 2 then deviceLevel = 2 end local parentTrans = self.group_Quality:GetToggle(deviceLevel).gameObject.transform self.img_Recommended.transform:SetParent(parentTrans, false) self.img_Recommended.transform:SetAnchoredPosition(22, 55) -- 画质等级 self.group_Quality:SelectIndex(deviceLevel) end function UISettingInitial:OnClosed() local guideData = DataSheetManager.GuideData:GetDataByID_ChildID(100000, 1) CTL.PlayerGuide.FinishGuide(guideData, false) end function UISettingInitial:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UISettingInitial:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then -- 关闭界面 self:CloseView() elseif comp == self.btn_Confirm then -- 确认按钮 self.CameraCtrl:SetViewMode(self.viewType) self.CameraCtrl:ChangeFreePattern(true) self.CameraCtrl:SetRecordFreeInfo() MDL.Setting.SetKeyValue(LuaConst.SettingKeyEnum.SettingQuality, self.qualityIndex) EventSystem.Dispatch(EventID.BI_SwitchLod,BIManager.BIType.SwitchLod, MDL.Setting.SwitchLodType.Manual, SettingAPI.lodLevel,self.qualityIndex) EventSystem.Dispatch(EventID.BI_ViewClick, BIManager.ViewBIEvent.UISettingInitial_btn_Confirm) SettingAPI.lodLevel = self.qualityIndex self:CloseView() end end function UISettingInitial:OnValueChanged(comp, state) if comp == self.group_ViewMode then -- 视角模式 self.viewType = state elseif comp == self.group_Quality then self.qualityIndex = state end end return UISettingInitial