local UIOfficialPositionZhaoshu = UIViewClass() function UIOfficialPositionZhaoshu:OnOpened(context) UIUtils.SetActive(self.btn_Jiezhi, false) self.title = context.officialTitle local titleData = DataSheetManager.OfficialPosition:GetDataByID(self.title) CTL.Sound.PlayGameSound("UI_shengzhi") if titleData then --加个换行符,防止点跟字体在同一行显示 local titleTxt local remindTxt local txtEN local txtremind --英文、印尼语特殊显示 if Localization.IsEnglish() or Localization.IsIndonesian() or Localization.IsThailand() or GameAppInfo.IsVietnamPackage() then --titleTxt = UIUtils.GetLocalizedTxt(Const_IDS[titleData.Name1]) .. "·" .. UIUtils.GetLocalizedTxt(Const_IDS[titleData.Name2]) txtEN = UIUtils.GetLocalizedTxt(Const_IDS[titleData.Name1]) .. "·" .. UIUtils.GetLocalizedTxt(Const_IDS[titleData.Name2]) txtremind = UTL.Color.FormatQualityText(txtEN, titleData.QualityColor) if titleData.PromotionInterface == 3 then titleTxt = UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPosition_ImperialEdict1) remindTxt = string.format(UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPosition_ImperialEdictDes1),txtremind) self:CommonShow(titleTxt,remindTxt) self:PlayUIAnimation("zhaoshu", true) self:PlayUIAnimation("A") elseif titleData.PromotionInterface == 2 then titleTxt = UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPosition_ImperialEdict1) remindTxt = string.format(UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPosition_ImperialEdictDes2),txtremind) self:CommonShow(titleTxt,remindTxt) self:PlayUIAnimation("zhaoshu", true) self:PlayUIAnimation("B") elseif titleData.PromotionInterface == 1 then titleTxt = UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPosition_ImperialEdict2) remindTxt = string.format(UIUtils.GetLocalizedTxt(Const_IDS.IDS_OfficialPosition_ImperialEdictDes3),txtremind) self:CommonShow(titleTxt,remindTxt) self:PlayUIAnimation("zhaoshu", true) self:PlayUIAnimation("C") end return else titleTxt = UIUtils.GetLocalizedTxt(Const_IDS[titleData.Name1]) .. "\n·\n" .. UIUtils.GetLocalizedTxt(Const_IDS[titleData.Name2]) end local txt = UTL.Color.FormatQualityText(titleTxt, titleData.QualityColor) local type = titleData.PromotionInterface --self.lab_Remind.text = string.format(UIUtils.GetLocalizedTxt(Const_IDS["IDS_OfficialPosition_HaveBeenPromoted"]), txt) if type == 1 then self.obj_MainState:SetState(2) UIUtils.SetLocalizationImage(self.img_Ceshu, "zs_msz_cs.png") self.txt_C_OfficialPosition.text = txt UIUtils.SetLocalizationImage(self.img_Txt_C, "UI_ImperialEdict/zs_msz_csxx.png"); UIUtils.SetActive(self.section_C_OfficialPosition, self.loc_OfficalPosition.CurState ~= 1) UIUtils.SetActive(self.lab_Remind, self.loc_OfficalPosition.CurState == 1) self:PlayUIAnimation("zhaoshu", true) self:PlayUIAnimation("C") elseif type == 2 then self.obj_MainState:SetState(1) UIUtils.SetLocalizationImage(self.img_Zhaoshu_B, "zs_msz_zs.png") self.txt_B_OfficialPosition.text = txt UIUtils.SetLocalizationImage(self.img_Txt_B, "UI_ImperialEdict/zs_msz_zsxx.png"); UIUtils.SetActive(self.section_B_OfficialPosition, self.loc_OfficalPosition.CurState ~= 1) UIUtils.SetActive(self.lab_Remind, self.loc_OfficalPosition.CurState == 1) self:PlayUIAnimation("zhaoshu", true) self:PlayUIAnimation("B") else self.obj_MainState:SetState(0) UIUtils.SetLocalizationImage(self.img_Zhaoshu_A, "zs_msz_zs.png") self.txt_A_OfficialPosition.text = txt UIUtils.SetLocalizationImage(self.img_Txt_A, "UI_ImperialEdict/zs_msz_djxx.png"); UIUtils.SetActive(self.section_A_OfficialPosition, self.loc_OfficalPosition.CurState ~= 1) UIUtils.SetActive(self.lab_Remind, self.loc_OfficalPosition.CurState == 1) self:PlayUIAnimation("zhaoshu", true) self:PlayUIAnimation("A") end end end function UIOfficialPositionZhaoshu:OnUIAnimationStoped(playingID) UIUtils.SetActive(self.btn_Jiezhi, true) end function UIOfficialPositionZhaoshu:OnBackButtonPressed() self:OnButtonClicked(self.btn_Jiezhi) end function UIOfficialPositionZhaoshu:OnButtonClicked(comp) if comp == self.btn_Jiezhi then self:CloseView(true) end end --节省代码空间 function UIOfficialPositionZhaoshu:CommonShow(titleTxt,remindTxt) UIUtils.SetActive(self.txt_Name,true) UIUtils.SetActive(self.txt_Remind,true) self.txt_Name.text = titleTxt self.txt_Remind.text = remindTxt end return UIOfficialPositionZhaoshu