local UIGuildChangeFrame = UIViewClass() local LENGTH_INPUT = 2 function UIGuildChangeFrame:OnOpened(context) local costType = DataSheetManager.ConstData:GetDataByID("GuildEmblemCoin").IntValue UTL.Item.SetCurrencyImageIcon(self.img_Cost, costType) local costValue = DataSheetManager.ConstData:GetDataByID("GuildEmblemPay").IntValue self.txt_Number.text = costValue for i,v in DataSheetManager.GuildEmblem:GetEnumerator() do self.uint_Scroll:AddData(v,0) if v.ID == tonumber(MDL.Guild.GetGuildMemberInfo().listInfo.emblemFrame) then self.uint_Scroll:SelectIndex(i-1, true) end end self.oriEmblemContent = MDL.Guild.GetGuildMemberInfo().listInfo.emblemContent self.txt_TitleGuildName.text = self.oriEmblemContent self.obj_InputField.text = self.oriEmblemContent UIUtils.SetActive(self.obj_Cost, false) end function UIGuildChangeFrame:OnBackButtonPressed() self:OnButtonClicked(self.Btn_Close) end function UIGuildChangeFrame:OnButtonClicked(comp) if self.Btn_Close == comp or self.btn_2 == comp then self:CloseView() elseif self.btn_1 == comp then local content = self.obj_InputField.text if string.isNilOrEmpty(content) then CTL.Tips.AddTipsMsg(Const_IDS["IDS_Chat_CantBlank"]) return end if not self.curSelectUnlock then CTL.Sound.PlayGameSound("UI_invalid") CTL.Tips.AddTipsMsg(Const_IDS.IDS_GuildCreate_Fail7) return end --徽记字有变更要判断花费 if self.obj_InputField.text ~= self.oriEmblemContent then local costType = DataSheetManager.ConstData:GetDataByID("GuildEmblemCoin").IntValue local costValue = DataSheetManager.ConstData:GetDataByID("GuildEmblemPay").IntValue if MDL.Currency.IsMoneyEnough(costType, costValue) == false then CTL.Sound.PlayGameSound("UI_invalid") local itemData = DataSheetManager.ItemData:GetDataByID(costType) CTL.Tips.AddTipsMsg(Const_IDS["IDS_Guild_CommonFail1"], UIUtils.GetLocalizedTxt(Const_IDS[itemData.Name])) return end end if GameAppInfo.IsJapanesePackage() and self.obj_InputField.text ~= self.oriEmblemContent then --日本地区消耗龙玉需要有对应的提示 --日本消耗龙玉需要二次弹窗+特殊增加文字说明 local costDragonSuffix = "\n" .. UIUtils.GetLocalizedTxt(Const_IDS.IDS_JP_MoneyConsumption_Pay) .. "\n" .. UIUtils.GetLocalizedTxt(Const_IDS.IDS_JP_MoneyConsumption_Time) .. "\n" .. UIUtils.GetLocalizedTxt(Const_IDS.IDS_JP_MoneyConsumption_CannotCancel) UTL.MessageBox.ShowOKCancelBox(Const_IDS.IDS_EmblemCharacter_Title, string.FormatByIdsId(Const_IDS.IDS_EmblemCharacter_Des, content) .. costDragonSuffix, function() MDL.Guild.GuildSetupReq(MDL.Guild.GuildUpdateType.EmblemContent_EmblemFrame, content, self.curSelectImage) end) else MDL.Guild.GuildSetupReq(MDL.Guild.GuildUpdateType.EmblemContent_EmblemFrame, content, self.curSelectImage) end elseif self.btn_Refresh == comp then self.obj_InputField.text = self.oriEmblemContent self.txt_TitleGuildName.text = self.oriEmblemContent UIUtils.SetActive(self.obj_Cost, false) end end function UIGuildChangeFrame:OnEndEdit(comp, value) if comp == self.obj_InputField then if string.len(value) > 0 then local content = UTL.String.CutStrByLength(value, LENGTH_INPUT) self.obj_InputField.text = content self.txt_TitleGuildName.text = content if content ~= self.oriEmblemContent then UIUtils.SetActive(self.obj_Cost, true) MDL.Guild.GuildSetupCheckReq(MDL.Guild.GuildUpdateType.EmblemContent, content) else UIUtils.SetActive(self.obj_Cost, false) end end end end function UIGuildChangeFrame:OnCellSelect(scrollRect, index, cellTable, data) UTL.Item.SetAtlasSprite(self.ico_GuildBg, "UI_Guild", data.Image) self.curSelectImage = data.ID UIUtils.SetLabelText(self.txt_title2,Const_IDS[data.Name]) UIUtils.SetLabelText(self.txt_Info,Const_IDS[data.DescText]) self.curSelectUnlock = MDL.Unlock.IsComplete(data.UnlockCondition,data.UnlockConditionParam) end function UIGuildChangeFrame:OnCellInit(scrollRect, index, cellTable, data) UTL.Item.SetAtlasSprite(cellTable.ico_GuildBg, "UI_Guild", data.Image) if MDL.Unlock.IsComplete(data.UnlockCondition,data.UnlockConditionParam) then cellTable.group_Lock.gameObject:SetActive(false) else cellTable.group_Lock.gameObject:SetActive(true) end end return UIGuildChangeFrame