public static OnEventInterruptCallback CreateDialogOnEventInterrupted(DialogType dialogType, TextResources textResources) { return((binderInstanceMap, interruptedData) => { var dialogModel = new DialogModel(); switch (dialogType) { case DialogType.OKCancel: dialogModel .AddButton("OK", "OK", new ModelIDList(DialogModel.DIALOG_OK_BUTTON_ID)) .AddButton("Cancel", "Cancel", new ModelIDList(DialogModel.DIALOG_CANCEL_BUTTON_ID)); break; case DialogType.YesNoCancel: dialogModel .AddButton("Yes", "Yes", new ModelIDList(DialogModel.DIALOG_YES_BUTTON_ID)) .AddButton("No", "No", new ModelIDList(DialogModel.DIALOG_NO_BUTTON_ID)) .AddButton("Cancel", "Cancel", new ModelIDList(DialogModel.DIALOG_CANCEL_BUTTON_ID)); break; } if (interruptedData.SenderModel is IHavingDialogData) { var dialogData = interruptedData.SenderModel as IHavingDialogData; dialogData.SetTexts(dialogModel, textResources); } return (dialogModel, false); }); }
public static void SetTexts(this IHavingDialogData data, DialogModel target, TextResources textResources) { if (textResources.Contains(data.DialogTitleTextResource)) { target.Title = textResources.Get(data.DialogTitleTextResource); } if (textResources.Contains(data.DialogTextTextResource)) { target.Text = textResources.Get(data.DialogTextTextResource); } //Debug.Log($"pass Title={target.Title} Text={target.Text}"); }