|
@@ -16,6 +16,13 @@ export class TipsData {
|
|
|
singleName: string = "";
|
|
|
link: string = null;
|
|
|
shareLink: string = null;
|
|
|
+
|
|
|
+ constructor(content: string) {
|
|
|
+ this.content = content;
|
|
|
+ }
|
|
|
+ async show(): Promise<TipsLayer> {
|
|
|
+ return await TipsLayer.show(this);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
export interface OnConfirm {
|
|
@@ -24,26 +31,26 @@ export interface OnConfirm {
|
|
|
|
|
|
@ccclass("TipsLayer")
|
|
|
export class TipsLayer extends BaseUI {
|
|
|
- static confirm(
|
|
|
+ static build(content: string): TipsData {
|
|
|
+ let tipsData: TipsData = new TipsData(content);
|
|
|
+ return tipsData;
|
|
|
+ }
|
|
|
+
|
|
|
+ static forceConfirm(
|
|
|
title: string,
|
|
|
content: string,
|
|
|
shareLink: string = null
|
|
|
): Promise<boolean> {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- let tipsData: TipsData = {
|
|
|
- title: title,
|
|
|
- onCancel: () => {
|
|
|
- console.warn("onCancel2222");
|
|
|
- resolve(false);
|
|
|
- },
|
|
|
- link: null,
|
|
|
- content: content,
|
|
|
- onConfirm: () => {
|
|
|
- resolve(true);
|
|
|
- },
|
|
|
- forceConfirm: true,
|
|
|
- singleName: null,
|
|
|
- shareLink: shareLink,
|
|
|
+ let tipsData: TipsData = TipsLayer.build(content);
|
|
|
+ tipsData.title = title;
|
|
|
+ tipsData.shareLink = shareLink;
|
|
|
+ tipsData.forceConfirm = true;
|
|
|
+ tipsData.onConfirm = () => {
|
|
|
+ resolve(true);
|
|
|
+ };
|
|
|
+ tipsData.onCancel = () => {
|
|
|
+ resolve(false);
|
|
|
};
|
|
|
TipsLayer.show(tipsData);
|
|
|
});
|
|
@@ -67,9 +74,8 @@ export class TipsLayer extends BaseUI {
|
|
|
|
|
|
static async showConfirm(title: string, content: string): Promise<boolean> {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- let tipsData: TipsData = new TipsData();
|
|
|
+ let tipsData: TipsData = TipsLayer.build(content);
|
|
|
tipsData.title = title;
|
|
|
- tipsData.content = content;
|
|
|
tipsData.onConfirm = () => {
|
|
|
resolve(true);
|
|
|
};
|