public static void DefineConfirm() { ActionArgs actionArgs = new ActionArgs(); actionArgs.With <string>(Constants.Args.MESSAGE, "Confirm message"); actionArgs.With <string>(Constants.Args.ACCEPT_TEXT, "Accept"); actionArgs.With <string>(Constants.Args.CANCEL_TEXT, "Cancel"); actionArgs.WithAction <object>(Constants.Args.ACCEPT_ACTION, null) .WithAction <object>(Constants.Args.CANCEL_ACTION, null); ActionContext.ActionResponder responder = new ActionContext.ActionResponder((context) => { if (EditorUtility.DisplayDialog(Constants.Args.CONFIRM_NAME, context.GetStringNamed(Constants.Args.MESSAGE), context.GetStringNamed(Constants.Args.ACCEPT_TEXT), context.GetStringNamed(Constants.Args.CANCEL_TEXT))) { context.RunTrackedActionNamed(Constants.Args.ACCEPT_ACTION); } else { context.RunActionNamed(Constants.Args.CANCEL_ACTION); } }); Leanplum.DefineAction(Constants.Args.CONFIRM_NAME, Constants.ActionKind.MESSAGE, actionArgs, null, responder); }
public static void DefineOpenURL() { ActionArgs actionArgs = new ActionArgs(); actionArgs.With <string>(Constants.Args.URL, "https://www.example.com"); ActionContext.ActionResponder responder = new ActionContext.ActionResponder((context) => { string url = context.GetStringNamed(Constants.Args.URL); if (!string.IsNullOrEmpty(url)) { Application.OpenURL(url); } }); Leanplum.DefineAction(Constants.Args.OPEN_URL, Constants.ActionKind.ACTION, actionArgs, null, responder); }