Pop-up window operation of FairyGUI editor [plug-in]

Previously, in the FairyGUI editor menu extension, I used App . Alert ( " Copy failed " ) to prompt whether the operation was successful. This article will talk about the pop-up prompts we can use, as well as the "publish successfully" pop-up window when similar resources are successfully published.

Open the API script of the APP and you can see that there are many public methods. Here we only introduce the used pop-up windows.

Message window: Alert

Confirmation window: Confirm

Input window: Input

Waiting window: ShowWaiting and CloseWaiting.

Note: ShowWaiting in the waiting window will block interface operations, so it should be used together with the CloseWaiting method and add the CloseWaiting method at the appropriate time.

The above windows can be accessed directly through the App. There is another window that requires some effort, which is the yellow window that automatically disappears after a few seconds when the release is successful.

Instructions

Message window: CS.FairyEditor.App.Alert(msg, err, callback), where parameter two and parameter three can be empty. The types of the three parameters are: s tring  msgException  errAction  callback .

App.Alert("这是消息框")

Confirmation window: CS.FairyEditor.App.Confirm(msg, callback), the parameters can be empty, the types of the two parameters are: string  msgAction < string >  The callback method has parameters, this parameter can be used to distinguish Button click.

App.Confirm("这是确认框")
App.Confirm("这是确认框1",function(val)
    ---val:yes/no
    fprint(val)
end)

 Input window: CS.FairyEditor.App.Input(msg, text, callback), the parameters can be empty, the parameter types are: string  msgstring  textAction < string callback The callback method has parameters. The callback method only takes effect when confirmation is clicked, and the default parameter value is equal to the incoming parameter two.

App.Input()
App.Input("这是输入框2","输入框消息")
App.Input("这是输入框3","输入框消息",function(val)
    ---点击确认后执行回调
    ---默认情况下,val == text
    fprint(val) 
end)

Next, you need to go around a bit to get the yellow prompt window of "Published Successfully", which is referred to as the bay window.

First, obtain the generic method GetDialog in the App through the xlua built-in method

Secondly, declare the window type to be obtained: typeof(CS.FairyEditor.Dialog.PromptDialog)

Finally, call the window type method: Open()

---取得App中的泛型方法GetDialog App为命名空间CS.FairyEditor.App,FairyGUI官方内置了App = CS.FairyEditor.App
local getDialog = xlua.get_generic_method(App,"GetDialog")
---声明弹窗类型
local promptDlgType = typeof(CS.FairyEditor.Dialog.PromptDialog)
--为泛型方法指定类型,并获取对应的类型窗口脚本类
local promptDlgClass = getDialog(promptDlgType)
--调用 若泛型方法为静态,则无需传第一个实例参数
promptDlgClass():Open("这是一个会自动关闭的提示窗口")

 The above is the content of this article, if it is helpful to you, that’s great! If you have any questions, you can leave a message! grateful!

Guess you like

Origin blog.csdn.net/u012433546/article/details/132447756