local UIHeroMatch1v1SubtitleSetting = UIViewClass() function UIHeroMatch1v1SubtitleSetting:OnOpened(context) self.ColorButtonIndex = { [self.img_Color1] = { Color_Enum = CTL.WatchBattle.BulletColor.White, Img_Selected = self.img_Selected1 }, [self.img_Color2] = { Color_Enum = CTL.WatchBattle.BulletColor.Green, Img_Selected = self.img_Selected2 }, [self.img_Color3] = { Color_Enum = CTL.WatchBattle.BulletColor.Blue, Img_Selected = self.img_Selected3 }, [self.img_Color4] = { Color_Enum = CTL.WatchBattle.BulletColor.Purple, Img_Selected = self.img_Selected4 }, [self.img_Color5] = { Color_Enum = CTL.WatchBattle.BulletColor.Orange, Img_Selected = self.img_Selected5 }, } UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS["IDS_HeroMatch1v1_BulletSet"]) self.toggle_resolutionLow.isOn = CTL.WatchBattle.GetIsHideBulletName() self:UpdateColorButtons() end function UIHeroMatch1v1SubtitleSetting:UpdateColorButtons() local bulletColor = CTL.WatchBattle.GetBulletColor() for i, v in pairs(self.ColorButtonIndex) do UIUtils.SetActive(v.Img_Selected, v.Color_Enum == bulletColor) end end function UIHeroMatch1v1SubtitleSetting:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIHeroMatch1v1SubtitleSetting:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() elseif self.ColorButtonIndex[comp] then CTL.WatchBattle.SetBulletColor(self.ColorButtonIndex[comp].Color_Enum) self:UpdateColorButtons() end end function UIHeroMatch1v1SubtitleSetting:OnValueChanged(comp, state) if comp == self.toggle_resolutionLow then CTL.WatchBattle.SetIsHideBulletName(state) end end return UIHeroMatch1v1SubtitleSetting