Merge pull request #1243 from universe-st/PR-Branch
为《富甲天下》扩展金币变化增加 TOAST 提示。
This commit is contained in:
commit
84439e93fd
Binary file not shown.
Binary file not shown.
|
@ -131,8 +131,21 @@ game.import("play", function () {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
game: {
|
game: {
|
||||||
changeCoin: function (num) {
|
changeCoin: function (num, toast, audio) {
|
||||||
if (typeof num == "number" && ui.coin) {
|
if (typeof num == "number" && ui.coin) {
|
||||||
|
if (num != 0 && toast !== false) {
|
||||||
|
ui.create.toast(
|
||||||
|
`${num > 0 ? "获得" : "花费"} ${Math.abs(
|
||||||
|
num
|
||||||
|
)} 金币`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (audio !== false) {
|
||||||
|
game.playAudio(
|
||||||
|
"effect",
|
||||||
|
num > 0 ? "coin" : "coin_cost"
|
||||||
|
);
|
||||||
|
}
|
||||||
game.saveConfig("coin", lib.config.coin + num);
|
game.saveConfig("coin", lib.config.coin + num);
|
||||||
var str;
|
var str;
|
||||||
if (lib.config.coin_display_playpackconfig == "text") {
|
if (lib.config.coin_display_playpackconfig == "text") {
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
.toast-container {
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
top: 15%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
z-index: 9999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toast {
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
background-color: rgba(255, 165, 0, 0.7);
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
|
||||||
|
color: white;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 10px 20px;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
width: max-content;
|
||||||
|
animation: fadeInOut 1500ms ease-in-out forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeInOut {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
20% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
80% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1718,7 +1718,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
|
||||||
ui.cheat2 = ui.create.control("自由选将", function () {
|
ui.cheat2 = ui.create.control("自由选将", function () {
|
||||||
if (this.dialog == _status.event.dialog) {
|
if (this.dialog == _status.event.dialog) {
|
||||||
if (game.changeCoin) {
|
if (game.changeCoin) {
|
||||||
game.changeCoin(50);
|
game.changeCoin(10);
|
||||||
}
|
}
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
_status.event.dialog = this.backup;
|
_status.event.dialog = this.backup;
|
||||||
|
|
|
@ -3420,7 +3420,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
|
||||||
ui.cheat2 = ui.create.control("自由选将", function () {
|
ui.cheat2 = ui.create.control("自由选将", function () {
|
||||||
if (this.dialog == _status.event.dialog) {
|
if (this.dialog == _status.event.dialog) {
|
||||||
if (game.changeCoin) {
|
if (game.changeCoin) {
|
||||||
game.changeCoin(50);
|
game.changeCoin(10);
|
||||||
}
|
}
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
_status.event.dialog = this.backup;
|
_status.event.dialog = this.backup;
|
||||||
|
|
|
@ -4306,7 +4306,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
|
||||||
ui.cheat2 = ui.create.control("自由选将", function () {
|
ui.cheat2 = ui.create.control("自由选将", function () {
|
||||||
if (this.dialog == _status.event.dialog) {
|
if (this.dialog == _status.event.dialog) {
|
||||||
if (game.changeCoin) {
|
if (game.changeCoin) {
|
||||||
game.changeCoin(50);
|
game.changeCoin(10);
|
||||||
}
|
}
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
_status.event.dialog = this.backup;
|
_status.event.dialog = this.backup;
|
||||||
|
|
|
@ -1094,7 +1094,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
|
||||||
ui.cheat2 = ui.create.control("自由选将", function () {
|
ui.cheat2 = ui.create.control("自由选将", function () {
|
||||||
if (this.dialog == _status.event.dialog) {
|
if (this.dialog == _status.event.dialog) {
|
||||||
if (game.changeCoin) {
|
if (game.changeCoin) {
|
||||||
game.changeCoin(50);
|
game.changeCoin(10);
|
||||||
}
|
}
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
_status.event.dialog = this.backup;
|
_status.event.dialog = this.backup;
|
||||||
|
|
|
@ -22429,7 +22429,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
|
||||||
ui.cheat2 = ui.create.control("自由选将", function () {
|
ui.cheat2 = ui.create.control("自由选将", function () {
|
||||||
if (this.dialog == _status.event.dialog) {
|
if (this.dialog == _status.event.dialog) {
|
||||||
if (game.changeCoin) {
|
if (game.changeCoin) {
|
||||||
game.changeCoin(50);
|
game.changeCoin(10);
|
||||||
}
|
}
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
_status.event.dialog = this.backup;
|
_status.event.dialog = this.backup;
|
||||||
|
|
|
@ -2303,7 +2303,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
|
||||||
ui.cheat2 = ui.create.control("自由选将", function () {
|
ui.cheat2 = ui.create.control("自由选将", function () {
|
||||||
if (this.dialog == _status.event.dialog) {
|
if (this.dialog == _status.event.dialog) {
|
||||||
if (game.changeCoin) {
|
if (game.changeCoin) {
|
||||||
game.changeCoin(50);
|
game.changeCoin(10);
|
||||||
}
|
}
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
_status.event.dialog = this.backup;
|
_status.event.dialog = this.backup;
|
||||||
|
|
|
@ -2486,7 +2486,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
|
||||||
ui.cheat2 = ui.create.control("自由选将", function () {
|
ui.cheat2 = ui.create.control("自由选将", function () {
|
||||||
if (this.dialog == _status.event.dialog) {
|
if (this.dialog == _status.event.dialog) {
|
||||||
if (game.changeCoin) {
|
if (game.changeCoin) {
|
||||||
game.changeCoin(50);
|
game.changeCoin(10);
|
||||||
}
|
}
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
_status.event.dialog = this.backup;
|
_status.event.dialog = this.backup;
|
||||||
|
|
|
@ -841,7 +841,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
|
||||||
ui.cheat2 = ui.create.control("自由选将", function () {
|
ui.cheat2 = ui.create.control("自由选将", function () {
|
||||||
if (this.dialog == _status.event.dialog) {
|
if (this.dialog == _status.event.dialog) {
|
||||||
if (game.changeCoin) {
|
if (game.changeCoin) {
|
||||||
game.changeCoin(50);
|
game.changeCoin(10);
|
||||||
}
|
}
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
_status.event.dialog = this.backup;
|
_status.event.dialog = this.backup;
|
||||||
|
@ -1115,7 +1115,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
|
||||||
ui.cheat2 = ui.create.control("自由选将", function () {
|
ui.cheat2 = ui.create.control("自由选将", function () {
|
||||||
if (this.dialog == _status.event.dialog) {
|
if (this.dialog == _status.event.dialog) {
|
||||||
if (game.changeCoin) {
|
if (game.changeCoin) {
|
||||||
game.changeCoin(50);
|
game.changeCoin(10);
|
||||||
}
|
}
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
_status.event.dialog = this.backup;
|
_status.event.dialog = this.backup;
|
||||||
|
@ -1446,7 +1446,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
|
||||||
ui.cheat2 = ui.create.control("自由选将", function () {
|
ui.cheat2 = ui.create.control("自由选将", function () {
|
||||||
if (this.dialog == _status.event.dialog) {
|
if (this.dialog == _status.event.dialog) {
|
||||||
if (game.changeCoin) {
|
if (game.changeCoin) {
|
||||||
game.changeCoin(50);
|
game.changeCoin(10);
|
||||||
}
|
}
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
_status.event.dialog = this.backup;
|
_status.event.dialog = this.backup;
|
||||||
|
@ -1637,7 +1637,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
|
||||||
ui.cheat2 = ui.create.control("自由选将", function () {
|
ui.cheat2 = ui.create.control("自由选将", function () {
|
||||||
if (this.dialog == _status.event.dialog) {
|
if (this.dialog == _status.event.dialog) {
|
||||||
if (game.changeCoin) {
|
if (game.changeCoin) {
|
||||||
game.changeCoin(50);
|
game.changeCoin(10);
|
||||||
}
|
}
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
_status.event.dialog = this.backup;
|
_status.event.dialog = this.backup;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -137,6 +137,10 @@ export class UI {
|
||||||
*/
|
*/
|
||||||
tempnowuxie;
|
tempnowuxie;
|
||||||
/**
|
/**
|
||||||
|
* @type {HTMLDivElement[]}
|
||||||
|
*/
|
||||||
|
toastQueue = [];
|
||||||
|
|
||||||
* @type {HTMLDivElement}
|
* @type {HTMLDivElement}
|
||||||
*/
|
*/
|
||||||
cardPile;
|
cardPile;
|
||||||
|
|
Loading…
Reference in New Issue