添加游戏通用提示与确认窗口

This commit is contained in:
donggang
2024-02-29 10:13:01 +08:00
parent 7b7919c2c4
commit 52788892e2
15 changed files with 1157 additions and 339 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "51127053-183b-41dc-b9d5-de54f6774526",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "alert"
}
}

View File

@@ -1,7 +1,7 @@
[
{
"__type__": "cc.Prefab",
"_name": "window",
"_name": "confirm",
"_objFlags": 0,
"_native": "",
"data": {
@@ -13,7 +13,7 @@
},
{
"__type__": "cc.Node",
"_name": "window",
"_name": "confirm",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,

View File

@@ -1,13 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "2501cdfd-ca13-49a6-9c23-ea51586c54c4",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "window"
}
}
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "2501cdfd-ca13-49a6-9c23-ea51586c54c4",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "confirm"
}
}

View File

@@ -1,24 +1,6 @@
{
"common_prompt_ok": "ok",
"common_prompt_cancal": "cancal",
"common_prompt_title_sys": "System Prompt",
"common_prompt_content": "System Prompt Cpmtemt",
"common_prompt": "common_prompt",
"notify_show": "notify_show",
"btn_rich_text": "<color=#00ff00>Rich</color><color=#0fffff>Text</color>",
"btn_demo_lang": "English",
"btn_common_prompt": "Public Pop",
"btn_notify_show": "Prompt",
"netInstableOpen": "Waiting ",
"btn_audio_open1": "Music",
"btn_audio_open2": "Effect",
"loading_load_json": "Load Json",
"loading_load_game": "Load Content",
"loading_load_player": "Get user information",
"role_name": "Name",
"role_lv": "Level",
"role_hp": "HP",
"role_power": "Power",
"role_physical": "Physical",
"role_agile": "Agile"
"common_prompt_title": "System Prompt",
"common_prompt_content": "System Prompt Cpmtemt"
}

View File

@@ -1,34 +1,6 @@
{
"common_prompt_ok": "确定",
"common_prompt_cancal": "取消",
"common_prompt_title_sys": "系统提示",
"common_prompt_content": "系统提示内容",
"common_prompt": "公共弹窗",
"notify_show": "信息显示",
"update_tips_force": "当前版本过旧,需要下载新的安装包才能进行游戏,是否更新?",
"update_tips_load_config": "加载配置中",
"update_tips_load_game": "加载游戏中",
"update_tips_check_update": "检查更新中",
"update_tips_new_version": "发现新版本资源",
"update_tips_success": "更新完成,点击确定重启游戏",
"update_tips_update": "更新中:",
"update_tips_update_fail": "更新失败",
"update_tips_update_fail_click_retry": "更新失败,点击重试",
"update_tips_update_success": "更新成功",
"btn_rich_text": "<color=#00ff00>富</color><color=#0fffff>文本</color>",
"btn_demo_lang": "中文",
"btn_common_prompt": "公共弹窗",
"btn_notify_show": "提示信息",
"netInstableOpen": "等待动画",
"btn_audio_open1": "音乐播放",
"btn_audio_open2": "音效播放",
"loading_load_json": "加载游戏本地数据",
"loading_load_game": "加载游戏内容",
"loading_load_player": "获取用户信息",
"role_name": "名字",
"role_lv": "等级",
"role_hp": "生命",
"role_power": "力量",
"role_physical": "体质",
"role_agile": "敏捷"
"common_prompt_title": "系统提示",
"common_prompt_content": "系统提示内容"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,134 +0,0 @@
{
"ver": "1.0.26",
"importer": "image",
"imported": true,
"uuid": "3d5b607a-face-426b-8200-acf8384108db",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "3d5b607a-face-426b-8200-acf8384108db@6c48a",
"displayName": "image",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "3d5b607a-face-426b-8200-acf8384108db",
"visible": false
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "3d5b607a-face-426b-8200-acf8384108db@f9941",
"displayName": "image",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 110,
"height": 50,
"rawWidth": 110,
"rawHeight": 50,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "3d5b607a-face-426b-8200-acf8384108db@6c48a",
"atlasUuid": "",
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-55,
-25,
0,
55,
-25,
0,
-55,
25,
0,
55,
25,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
50,
110,
50,
0,
0,
110,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-55,
-25,
0
],
"maxPos": [
55,
25,
0
]
}
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "sprite-frame",
"redirect": "3d5b607a-face-426b-8200-acf8384108db@f9941",
"fixAlphaTransparencyArtifacts": false
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -1,134 +0,0 @@
{
"ver": "1.0.26",
"importer": "image",
"imported": true,
"uuid": "a65eaaec-d315-4134-a79e-23bb817d1939",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "a65eaaec-d315-4134-a79e-23bb817d1939@6c48a",
"displayName": "image",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "a65eaaec-d315-4134-a79e-23bb817d1939",
"visible": false
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "a65eaaec-d315-4134-a79e-23bb817d1939@f9941",
"displayName": "image",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 110,
"height": 50,
"rawWidth": 110,
"rawHeight": 50,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "a65eaaec-d315-4134-a79e-23bb817d1939@6c48a",
"atlasUuid": "",
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-55,
-25,
0,
55,
-25,
0,
-55,
25,
0,
55,
25,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
50,
110,
50,
0,
0,
110,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-55,
-25,
0
],
"maxPos": [
55,
25,
0
]
}
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "sprite-frame",
"redirect": "a65eaaec-d315-4134-a79e-23bb817d1939@f9941",
"fixAlphaTransparencyArtifacts": false
}
}

View File

@@ -10,8 +10,10 @@ import { LayerType, UIConfig } from "../../../../../extensions/oops-plugin-frame
export enum UIID {
/** 资源加载界面 */
Loading = 1,
/** 弹窗界面 */
Window,
/** 提示弹出窗口 */
Alert,
/** 确认弹出窗口 */
Confirm,
/** 加载与延时提示界面 */
Netinstable,
/** DEMO */
@@ -22,6 +24,7 @@ export enum UIID {
export var UIConfigData: { [key: number]: UIConfig } = {
[UIID.Loading]: { layer: LayerType.UI, prefab: "gui/loading/loading" },
[UIID.Netinstable]: { layer: LayerType.PopUp, prefab: "common/prefab/netinstable" },
[UIID.Window]: { layer: LayerType.Dialog, prefab: "common/prefab/window" },
[UIID.Alert]: { layer: LayerType.Dialog, prefab: "common/prefab/alert" },
[UIID.Confirm]: { layer: LayerType.Dialog, prefab: "common/prefab/confirm" },
[UIID.Demo]: { layer: LayerType.UI, prefab: "gui/demo/demo" },
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "81682c8d-13b2-408a-bafc-c7adf1fb2cd5",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,99 @@
/*
* @Author: dgflash
* @Date: 2021-07-03 16:13:17
* @LastEditors: dgflash
* @LastEditTime: 2022-08-05 10:13:47
*/
import { Node, tween, Vec3 } from "cc";
import { PopViewParams } from "../../../../../extensions/oops-plugin-framework/assets/core/gui/layer/Defines";
import { oops } from "../../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { UIID } from "../config/GameUIConfig";
/** 提示窗口管理 */
class TipsManager {
/**
* 提示弹出窗口
* @param content 提示内容文本或多语言关键字
* @param onOk 确认回调
* @param title 窗口标题文本或多语言关键字
* @param okWord 确认按钮文本或多语言关键字
*/
alert(content: string, onOk?: Function, title?: string, okWord?: string) {
let operate: any = {
title: title ? title : 'common_prompt_title',
content: content,
okWord: okWord ? okWord : 'common_prompt_ok',
okFunc: onOk,
needCancel: false
};
oops.gui.open(UIID.Alert, operate, tips.getPopCommonEffect());
}
/**
* 确认弹出窗口
* @param content 提示内容文本或多语言关键字
* @param onOk 确认回调
* @param onCancel 取消回调
* @param title 窗口标题文本或多语言关键字
* @param okWord 确认按钮文本或多语言关键字
*/
confirm(content: string, onOk?: Function, onCancel?: Function, title?: string, okWord?: string) {
let operate: any = {
title: title ? title : 'common_prompt_title',
content: content,
okWord: okWord ? okWord : 'common_prompt_ok',
cancelWord: 'common_prompt_cancal',
okFunc: onOk,
cancelFunc: onCancel,
needCancel: true
};
oops.gui.open(UIID.Confirm, operate, tips.getPopCommonEffect());
}
/** 自定义弹窗动画 */
private getPopCommonEffect(callbacks?: PopViewParams) {
let newCallbacks: PopViewParams = {
// 节点添加动画
onAdded: (node, params) => {
node.setScale(0.1, 0.1, 0.1);
tween(node)
.to(0.2, { scale: new Vec3(1, 1, 1) })
.start();
},
// 节点删除动画
onBeforeRemove: (node, next) => {
tween(node)
.to(0.2, { scale: new Vec3(0.1, 0.1, 0.1) })
.call(next)
.start();
},
}
if (callbacks) {
if (callbacks && callbacks.onAdded) {
let onAdded = callbacks.onAdded;
callbacks.onAdded = (node: Node, params: any) => {
onAdded(node, params);
// @ts-ignore
newCallbacks.onAdded(node, params);
};
}
if (callbacks && callbacks.onBeforeRemove) {
let onBeforeRemove = callbacks.onBeforeRemove;
callbacks.onBeforeRemove = (node, params) => {
onBeforeRemove(node, params);
// @ts-ignore
newCallbacks.onBeforeRemove(node, params);
};
}
return callbacks;
}
return newCallbacks;
}
}
export var tips = new TipsManager();

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "9748eae2-11c2-4ea7-a392-76767faa1b39",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,9 +1,8 @@
{
/* Base configuration. Do not edit this field. */
"extends": "./temp/tsconfig.cocos.json",
/* Add your custom configuration here. */
"compilerOptions": {
"strict": false
"strict": true
}
}
}