Files
memory-manager-concurrent/games/mario/src/local-storage.js
Cola-Echo 6b80f1b755 feat: 支持 Lore-char 命名的总结世界书识别
- isSummaryBook 函数新增对 Lore-char/lore-char 的检测
- 修复启用记忆搜索助手时进度条重复显示总结世界书任务的问题
- 更新错误提示信息,说明支持的命名规则

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 00:49:28 +08:00

50 lines
1.2 KiB
JavaScript

(function() {
/**
*
* Backbone Game Engine - An elementary HTML5 canvas game engine using Backbone.
*
* Copyright (c) 2014 Martin Drapeau
* https://github.com/martindrapeau/backbone-game-engine
*
*/
// Load this file to persist in local storage.
// It will replace Backbone.World's save and fetch methods with
// naive implementations.
Backbone.World.prototype.fetch = function(options) {
options || (options = {});
var data = localStorage.getItem(this.id);
if (data) {
console.log("===== LOADING LOCAL STORAGE ====");
this.set(JSON.parse(data));
}
if (_.isFunction(options.success)) options.success();
return this;
};
Backbone.World.prototype.save = function(attributes, options) {
options || (options = {});
this.set({
state: "play",
sprites: this.sprites.map(function(sprite) {
return sprite.toSave.apply(sprite);
}),
savedOn: new Date().toJSON()
}, {silent: true});
console.log("===== SAVING LOCAL STORAGE ====");
localStorage.setItem(this.id, JSON.stringify(this.toJSON()));
if (_.isFunction(options.success)) options.success();
return this;
};
}).call(this);