diff --git a/lua_probject/base_project/Game/View/Common/tipsWindow.lua b/lua_probject/base_project/Game/View/Common/tipsWindow.lua new file mode 100644 index 00000000..707f1697 --- /dev/null +++ b/lua_probject/base_project/Game/View/Common/tipsWindow.lua @@ -0,0 +1,47 @@ +local tipsWindow = {} + +function tipsWindow.New() + setmetatable(tipsWindow, { __index = BaseWindow}) + local inst = setmetatable({}, { __index = tipsWindow }) + inst._scale = true + inst._animation = true + inst._close_destroy = true + BaseWindow.init(inst, "ui://Common/tips") + inst:Init() + return inst +end + +function tipsWindow:Show(title, textTips, callback) + self:Refalsh(title, textTips, callback) + BaseWindow.Show(self) +end + +function tipsWindow:Refalsh(title, textTips, callback) + self.tex_changeTitle.text = title + self.input_text.promptText = textTips + self.callback = callback +end + +function tipsWindow:Init() + self.btn_bg = self._view:GetChild("btn_bg") + self.btn_quit = self._view:GetChild("btn_quit") + self.btn_confirm = self._view:GetChild("btn_confirm") + + self.input_text = self._view:GetChild("input_text") + self.tex_changeTitle = self._view:GetChild("tex_changeTitle") + + self.btn_bg.onClick:Set(function() + self:Close() + end) + + self.btn_quit.onClick:Set(function() + self:Close() + end) + + self.btn_confirm.onClick:Set(function() + self.callback(self.input_text.text) + self:Close() + end) +end + +return tipsWindow \ No newline at end of file