-- 仇敌设置输入界面 local UIRivalslogan = UIViewClass() --[[ 仇人喊话设置 context = { parentView = self, 父节点view emptyHintText = IDS, Placeholder 中text为空时显示的提示字 inputText = XXX, obj_InputField 中默认显示的文字 parentComp = XXX, 父节点的触发按钮 contentStrLimit = XXX, 内容字数上限 titleText = IDS, 标题上显示的文字 tipText = IDS, 下方显示的提示文字 } 调用的地方需要添加接口: 1、ExcuteRivalSloganBack(缓存的全部数量数字, 参数) 2、CloseRivalSloganView() 两个界面尽量相互独立,不要用callback的方式传入 ]] -------------------- function UIRivalslogan:OnOpened(context) self.parentView = context.parentView self.obj_InputField.text = context.inputText self.parentComp = context.parentComp self.contentStrLimit = context.contentStrLimit UIUtils.SetLabelText(self.Placeholder, context.emptyHintText) UIUtils.SetLabelText(self.txt_Title, context.titleText) UIUtils.SetLabelText(self.txt_Tip, context.tipText) end function UIRivalslogan:OnButtonClicked(comp) if comp == self.event_Click or comp == self.btn_CloseTeam then self.parentView:CloseRivalSloganView() elseif comp == self.btn_Confirm then local rivalSloganStr = string.gsub(self.obj_InputField.text, "\n", "") if string.isNilOrEmpty(rivalSloganStr) then CTL.Tips.AddTipsMsg(Const_IDS.IDS_Chat_CantBlank) else self.parentView:ExcuteRivalSloganBack(self.parentComp, rivalSloganStr) end end end function UIRivalslogan:OnValueChanged(comp, value) if comp == self.obj_InputField then self.obj_InputField.text = UTL.String.CutStrByLength(self.obj_InputField.text, self.contentStrLimit) end end -------------------- return UIRivalslogan