From 7907a7ec98bbc5bc457616fe105dc6598fc30310 Mon Sep 17 00:00:00 2001 From: SuCicada Date: Sat, 16 Nov 2019 00:13:59 +0800 Subject: [PATCH] a --- docs/api/APG.Assets.html | 1201 +++++++++++++++ docs/api/APG.Bag.html | 1997 +++++++++++++++++++++++++ docs/api/APG.Game.html | 1432 ++++++++++++++++++ docs/api/APG.Group.html | 1026 +++++++++++++ docs/api/APG.Sprite.html | 2210 ++++++++++++++++++++++++++++ docs/api/APG.Target.html | 1182 +++++++++++++++ docs/api/APG.Update.collision.html | 1810 +++++++++++++++++++++++ docs/api/APG.Update.listenKey.html | 1251 ++++++++++++++++ docs/api/Assets.js.html | 285 ++++ docs/api/Bag.js.html | 436 ++++++ docs/api/Game.js.html | 412 ++++++ docs/api/Group.js.html | 197 +++ docs/api/Sprite.js.html | 313 ++++ docs/api/Target.js.html | 289 ++++ docs/api/Update.js.html | 453 ++++++ docs/api/classes.list.html | 251 ++++ docs/api/index.html | 178 +++ lib/jsdoc/jsdoc.sh | 1 + 18 files changed, 14924 insertions(+) create mode 100644 docs/api/APG.Assets.html create mode 100644 docs/api/APG.Bag.html create mode 100644 docs/api/APG.Game.html create mode 100644 docs/api/APG.Group.html create mode 100644 docs/api/APG.Sprite.html create mode 100644 docs/api/APG.Target.html create mode 100644 docs/api/APG.Update.collision.html create mode 100644 docs/api/APG.Update.listenKey.html create mode 100644 docs/api/Assets.js.html create mode 100644 docs/api/Bag.js.html create mode 100644 docs/api/Game.js.html create mode 100644 docs/api/Group.js.html create mode 100644 docs/api/Sprite.js.html create mode 100644 docs/api/Target.js.html create mode 100644 docs/api/Update.js.html create mode 100644 docs/api/classes.list.html create mode 100644 docs/api/index.html create mode 100644 lib/jsdoc/jsdoc.sh diff --git a/docs/api/APG.Assets.html b/docs/api/APG.Assets.html new file mode 100644 index 0000000..8e9269d --- /dev/null +++ b/docs/api/APG.Assets.html @@ -0,0 +1,1201 @@ + + + + + + + + Algorithm PlayGround Class: Assets + + + + + + + + + +
+
+ +
+ +
+ +

Class: Assets

+
+ +
+ +

+ Assets +

+ + +
+ + +
+
+ + +
+

+ new Assets() + +

+ +
+
+ + +
+

Assets(资源):游戏需要加载的资源,也是接口的一个分类。

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +

Methods

+ +
+ +
+

+ playMusic(keyName) + +

+ +
+
+ + +
+

播放音乐

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
keyName + + +string + + + + +

音乐名

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ stopMusic(keyName) + +

+ +
+
+ + +
+

停止音乐。如果没有传入名称,则全部停止

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
keyName + + +string + + + + +

音乐名

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ setAnimations(obj, name, frames [, frameRate] [, loop]) + +

+ +
+
+ + +
+

添加动画, 并播放.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
obj + + +Phaser.Group +| + +Phaser.Sprite + + + + + + + + + + + + +

要设置的对象

name + + +string + + + + + + + + + + + + +

动作名

frames + + +Array + + + + + + + + + + + + +

帧id

frameRate + + +integer + + + + + + + <optional>
+ + + + + +
+ + 1 + +

帧动画速度

loop + + +boolean + + + + + + + <optional>
+ + + + + +
+ + false + +

循环否

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ playerMoveAnimations(playerG, obj) + +

+ +
+
+ + +
+

设置玩家移动动画

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
playerG + + +Phaser.Group +| + +Phaser.Sprite + + + + +

玩家对象

obj + + +object + + + + +

方向(大写,或小写 -> frames 或单个数字,比如
+{
+right: 0,
+LEFT: [1],
+d own: [2],
+up: 3,
+}

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ getFrame(obj) → {Array|number} + +

+ +
+
+ + +
+

根据传入的精灵或组,返回此精灵当前的动画的frameId

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
obj + + +Phaser.Group +| + +Phaser.Sprite + + + + +

精灵或组或精灵列表

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

如果传入组或精灵列表,返回frameId 列表

+
+ + + +
+
+ Type +
+
+ +Array +| + +number + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ + + + +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/api/APG.Bag.html b/docs/api/APG.Bag.html new file mode 100644 index 0000000..4f0b92d --- /dev/null +++ b/docs/api/APG.Bag.html @@ -0,0 +1,1997 @@ + + + + + + + + Algorithm PlayGround Class: Bag + + + + + + + + + +
+
+ +
+ +
+ +

Class: Bag

+
+ +
+ +

+ Bag +

+ + +
+ + +
+
+ + +
+

+ new Bag() + +

+ +
+
+ + +
+

背包系统,用于模拟栈和堆,默认放入背包,拿出背包采用后入先出的栈式操作

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +

Methods

+ +
+ +
+

+ showBagBar() + +

+ +
+
+ + +
+

显示背包

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ hiddenBagBar() + +

+ +
+
+ + +
+

隐藏背包,可通过 showBagBar 再次显示

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ destroyBagBar() + +

+ +
+
+ + +
+

摧毁背包,不可再生

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ addItem(sprite, number) + +

+ +
+
+ + +
+

在背包中增加物品

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sprite + + +Phaser.Sprite + + + + +

添加的物品对象,作为样品显示

number + + +integer + + + + +

添加的数量

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ putItem(x, y, group) + +

+ +
+
+ + +
+

从背包里把第一个东西拿出去

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + +

相对坐标x

y + +

相对坐标y

group + + +Phaser.Group + + + + +

放置的精灵的所属的组

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ getItem(spriteList) + +

+ +
+
+ + +
+

把东西放到背包里,按照对象的keyName分组,如果是新东西,就放在第一个

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
spriteList + + +Array + + + + +

放入背包的列表

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ dropItem() + +

+ +
+
+ + +
+

把第一个位置的东西丢掉,计数减一,如果物品丢完,就从侧边栏去掉这个物品

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ getItemNum(itemName) → {Integer} + +

+ +
+
+ + +
+

得到物品的数量

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
itemName + + +string + + + + +

物品名

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Integer + + + +
+
+ + + + + +
+ + + +
+

+ setBagCapacity(n) + +

+ +
+
+ + +
+

设置背包最大容量

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
n + + +integer + + + + +

最大容量

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ getBagCapacity() → {integer} + +

+ +
+
+ + +
+

得到背包最大容量

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +integer + + + +
+
+ + + + + +
+ + + +
+

+ getBagSize() → {integer} + +

+ +
+
+ + +
+

得到背包当前容量

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +integer + + + +
+
+ + + + + +
+ + + +
+

+ getBagFirst() → {Array} + +

+ +
+
+ + +
+

得到当前背包第一个物品组

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array + + + +
+
+ + + + + +
+ + + +
+

+ goDownItems() + +

+ +
+
+ + +
+

背包物品组向后(下)移动

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ goUpItems() + +

+ +
+
+ + +
+

背包物品组向前(上)移动

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ updateBag() + +

+ +
+
+ + +
+

更新背包中的物品信息, 和数量对应

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + + + +
+ +
+ + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ + + + +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/api/APG.Game.html b/docs/api/APG.Game.html new file mode 100644 index 0000000..945ca5d --- /dev/null +++ b/docs/api/APG.Game.html @@ -0,0 +1,1432 @@ + + + + + + + + Algorithm PlayGround Class: Game + + + + + + + + + +
+
+ +
+ +
+ +

Class: Game

+
+ +
+ +

+ Game +

+ + +
+ + +
+
+ + +
+

+ new Game() + +

+ +
+
+ + +
+

Game(游戏属性):游戏全局控制,界面,大小,全屏,重启游戏等操作。

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +

Methods

+ +
+ +
+

+ getGameWIDTH() → {*|number|Window.screen.width} + +

+ +
+
+ + +
+

得到游戏宽。

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +* +| + +number +| + +Window.screen.width + + + +
+
+ + + + + +
+ + + +
+

+ getGameHEIGHT() → {*|number|Window.screen.height} + +

+ +
+
+ + +
+

得到游戏高。

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +* +| + +number +| + +Window.screen.height + + + +
+
+ + + + + +
+ + + +
+

+ getGameMODE() → {*|string} + +

+ +
+
+ + +
+

得到游戏渲染模式。

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +* +| + +string + + + +
+
+ + + + + +
+ + + +
+

+ README() + +

+ +
+
+ + +
+

显示游戏开始界面,根据配置文件中配置自动显示。

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ WIN(str, func [, that]) + +

+ +
+
+ + +
+

显示胜利界面

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
str + + +string + + + + + + + + + + + + +

自定义显示的文字

func + + +function + + + + + + + + + + + + +

点击界面后执行的函数

that + + +Object + + + + + + + <optional>
+ + + + + +
+ + APG.DeveloperModel + +

回调上下文

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ LOST(str, func [, that]) + +

+ +
+
+ + +
+

显示失败界面

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
str + + +string + + + + + + + + + + + + +

自定义显示的文字

func + + +function + + + + + + + + + + + + +

点击界面后执行的函数

that + + +Object + + + + + + + <optional>
+ + + + + +
+ + APG.DeveloperModel + +

回调上下文

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ fullScreen() + +

+ +
+
+ + +
+

游戏全屏

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ exitFullscreen() + +

+ +
+
+ + +
+

游戏退出全屏

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ restartGame() + +

+ +
+
+ + +
+

游戏重启,无需重新加载资源

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + + + +
+ +
+ + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ + + + +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/api/APG.Group.html b/docs/api/APG.Group.html new file mode 100644 index 0000000..9b444d8 --- /dev/null +++ b/docs/api/APG.Group.html @@ -0,0 +1,1026 @@ + + + + + + + + Algorithm PlayGround Class: Group + + + + + + + + + +
+
+ +
+ +
+ +

Class: Group

+
+ +
+ +

+ Group +

+ + +
+ + +
+
+ + +
+

+ new Group() + +

+ +
+
+ + +
+

Group(组):概念取自phaser,指代框架中多个的元素对象组合而来的组形式的对象。也是接口的一个分类。

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +

Methods

+ +
+ +
+

+ setGroup() → {Phaser.Group} + +

+ +
+
+ + +
+

创建一个组,
+默认存在0个精灵, 默认key 为spritesheet, index 从1开始。

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Phaser.Group + + + +
+
+ + + + + +
+ + + +
+

+ moveGroupUpTo(groupUp, groupDown) + +

+ +
+
+ + +
+

移动 groupUp 对象到 groupDown 对象上面。

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
groupUp + + +Phaser.Group + + + + +
groupDown + + +Phaser.Group + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ moveGroupDownTo(groupDown, groupUp) + +

+ +
+
+ + +
+

移动 groupDown 对象到 groupUp 对象下面。

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
groupDown + + +Phaser.Group + + + + +
groupUp + + +Phaser.Group + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ getTargetGroup(name) → {Phaser.Group} + +

+ +
+
+ + +
+

得到 target组对象,target 是设置在游戏配置文件中的。

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + +

Target组名

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Phaser.Group + + + +
+
+ + + + + +
+ + + +
+

+ getCharacterGroup(name) → {Phaser.Group} + +

+ +
+
+ + +
+

得到 Character 组对象,Character 是设置在游戏配置文件中的。

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + +

Character组名

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Phaser.Group + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ + + + +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/api/APG.Sprite.html b/docs/api/APG.Sprite.html new file mode 100644 index 0000000..eb3a195 --- /dev/null +++ b/docs/api/APG.Sprite.html @@ -0,0 +1,2210 @@ + + + + + + + + Algorithm PlayGround Class: Sprite + + + + + + + + + +
+
+ +
+ +
+ +

Class: Sprite

+
+ +
+ +

+ Sprite +

+ + +
+ + +
+
+ + +
+

+ new Sprite() + +

+ +
+
+ + +
+

Sprite(精灵):概念取自phaser,指代框架中一个单一的元素对象,可以是角色,也可以是交互对象。也是接口的一个分类。

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +

Methods

+ +
+ +
+

+ addSprite(x, y, imgKey, frame [, group] [, keyName]) → {*} + +

+ +
+
+ + +
+

新增一个精灵在组中。

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
x + + +integer + + + + + + + + + + + + +

相对坐标x

y + + +integer + + + + + + + + + + + + +

相对坐标y

imgKey + + +string + + + + + + + + + + + + +

对象贴图名

frame + + +integer + + + + + + + + + + + + +

贴图块id (begin with 1)

group + + +Phaser.Group + + + + + + + <optional>
+ + + + + +
+ +

如果传入组,就将精灵加入这个组中

keyName + + +string + + + + + + + <optional>
+ + + + + +
+ + imgKey + +

设置的精灵的名,如果没有就和 imgKey 一样

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +* + + + +
+
+ + + + + +
+ + + +
+

+ setSpriteSite(s, x, y) + +

+ +
+
+ + +
+

设置精灵的位置相对坐标。

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
s + + +Phaser.Sprite + + + + +

精灵对象

x + + +integer + + + + +

相对坐标x

y + + +integer + + + + +

相对坐标y

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ <static> getSpriteList(group) → {Array} + +

+ +
+
+ + +
+

得到组中的精灵列表。

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
group + + +Phaser.Group + + + + +

组对象

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array + + + +
+
+ + + + + +
+ + + +
+

+ <static> getSpriteListFromSite(x, y [, group] [, recursive] [, safe]) → {Array} + +

+ +
+
+ + +
+

从一个组里, 且在这个位置上, 拿精灵, 返回列表。
+如果指定了所属组,便从指定组中寻找, 如果没有便从世界开始查找

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
x + + +integer + + + + + + + + + + + + +

相对坐标x

y + + +integer + + + + + + + + + + + + +

相对坐标y

group + + + + <optional>
+ + + + + +
+ + game.world + +

寻找的范围,不给则为全部世界,可以是group对象, 也可以是数组

recursive + + +boolean + + + + + + + <optional>
+ + + + + +
+ + false + +

是否递归查找

safe + + +integer + + + + + + + <optional>
+ + + + + +
+ + 5 + +

递归深度,为0则为无限.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Array + + + +
+
+ + + + + +
+ + + +
+

+ <static> destroySprite(sprite) + +

+ +
+
+ + +
+

摧毁一个精灵对象。

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sprite + + +Phaser.Sprite + + + + +

要摧毁的精灵对象

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ <static> getSpriteSite(sprite) → {Object|Object} + +

+ +
+
+ + +
+

得到一个精灵的相对于地图Area的相对坐标,。

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sprite + + +Phaser.Sprite + + + + +

精灵对象

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object +| + +Object + + + +
+
+ + + + + +
+ + + +
+

+ <static> siteDecode(x, y) → {Object} + +

+ +
+
+ + +
+

将相对地址变成绝对地址

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +integer + + + + +

相对坐标x

y + + +integer + + + + +

相对坐标y

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object + + + +
+
+ + + + + +
+ + + +
+

+ <static> siteCode(x, y) → {Object} + +

+ +
+
+ + +
+

将绝对地址变成相对地址

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + +

绝对坐标x

y + + +number + + + + +

绝对坐标y

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object + + + +
+
+ + + + + +
+ + + +
+

+ <static> setBody(s, ratew, rateh, ratex, ratey) + +

+ +
+
+ + +
+

设置对象的物理检测体

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
s + + +Phaser.Sprite +| + +Phaser.Group + + + + +

对象

ratew + + +number + + + + +

宽比例

rateh + + +number + + + + +

高比例

ratex + + +number + + + + +

相对坐标x比例

ratey + + +number + + + + +

相对坐标y比例

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + + + +
+ +
+ + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ + + + +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/api/APG.Target.html b/docs/api/APG.Target.html new file mode 100644 index 0000000..ccdb3ad --- /dev/null +++ b/docs/api/APG.Target.html @@ -0,0 +1,1182 @@ + + + + + + + + Algorithm PlayGround Class: Target + + + + + + + + + +
+
+ +
+ +
+ +

Class: Target

+
+ +
+ +

+ Target +

+ + +
+ + +
+
+ + +
+

+ new Target() + +

+ +
+
+ + +
+

Target(元素):用于在地图表面上层显示的对象,具有定制的属性,可自定义。也是接口的一个分类。
+主要用于对 TextBitMap 文字块对象的操作。

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +

Methods

+ +
+ +
+

+ <static> addTextBitMap(x, y, text, bg) → {Phaser.Sprite} + +

+ +
+
+ + +
+

创建一个 TextBitMap

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +integer + + + + +

相对坐标x。

y + + +integer + + + + +

相对坐标y

text + + +string + + + + +

TextBitMap上的文字

bg + + +string + + + + +

TextBitMap的颜色

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

TextBitMap

+
+ + + +
+
+ Type +
+
+ +Phaser.Sprite + + + +
+
+ + + + + +
+ + + +
+

+ <static> aboutTextBitMap(sprite) → {Object} + +

+ +
+
+ + +
+

得到TextBitMap的信息。
+如果传入一个非 TextBitMap 精灵, 保证能返回一致的格式。

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sprite + + +Phaser.Sprite + + + + +

传入的TextBitMap对象

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Object + + + +
+
+ + + + + +
+ + + +
+

+ <static> loadTextBitMap(sprite, text, bg) → {Phaser.Sprite} + +

+ +
+
+ + +
+

将一个对象的贴图换做 TextBitMap, 如果未传入对象, 则创建一个。
+会先清除之前的绑定文本 以及背景。
+参考 https://photonstorm.github.io/phaser-ce/Phaser.Text.html#alignTo

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sprite + + +Phaser.Sprite + + + + +

传入的要转换的精灵对象

text + + +string + + + + +

TextBitMap上的文字

bg + + +string + + + + +

TextBitMap的颜色

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

TextBitMap

+
+ + + +
+
+ Type +
+
+ +Phaser.Sprite + + + +
+
+ + + + + +
+ + + +
+

+ <static> loadTextBitMapBetween(group, texts, bgs [, start] [, end]) + +

+ +
+
+ + +
+

对一个组中的 TextBitMap对象批量load

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
group + + + + + + + + + +
texts + + +Array + + + + + + + + + + + + +

TextBitMap 文字们

bgs + + +Array + + + + + + + + + + + + +

TextBitMap 颜色们

start + + +integer + + + + + + + <optional>
+ + + + + +
+ + 0 + +

组中开始编号,从0开始

end + + +integer + + + + + + + <optional>
+ + + + + +
+ + group.children.length + +

组中结束编号,未指定 end 就按最后一个

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + + + +
+ +
+ + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ + + + +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/api/APG.Update.collision.html b/docs/api/APG.Update.collision.html new file mode 100644 index 0000000..c2ed979 --- /dev/null +++ b/docs/api/APG.Update.collision.html @@ -0,0 +1,1810 @@ + + + + + + + + Algorithm PlayGround Class: collision + + + + + + + + + +
+
+ +
+ +
+ +

Class: collision

+
+ +
+ +

+ collision +

+ + +
+ + +
+
+ + +
+

+ new collision() + +

+ +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +

Methods

+ +
+ +
+

+ setCollideWorldBounds( [f]) + +

+ +
+
+ + +
+

边界碰撞,默认不开,用于玩家移动检测。

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
f + + +boolean + + + + + + + <optional>
+ + + + + +
+ + false + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ blockTileOverlap(group, tileIndex [, feedback], context [, that]) + +

+ +
+
+ + +
+

设置组对象和瓷砖的阻挡碰撞

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
group + + +Phaser.Group + + + + + + + + + + + + +
tileIndex + + +integer + + + + + + + + + + + + +

瓷砖id

feedback + + +function + + + + + + + <optional>
+ + + + + +
+ +

碰撞后的触发函数

context + + +Array + + + + + + + + + + + + +

函数参数

that + + +Object + + + + + + + <optional>
+ + + + + +
+ + APG.DeveloperModel + +

回调上下文

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ blockGroupOverlap(group1, group2 [, feedback], context [, that]) + +

+ +
+
+ + +
+

设置组对象和组对象的阻挡碰撞

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
group1 + + +Phaser.Group + + + + + + + + + + + + +
group2 + + +Phaser.Group + + + + + + + + + + + + +
feedback + + +function + + + + + + + <optional>
+ + + + + +
+ +

碰撞后的触发函数

context + + +Array + + + + + + + + + + + + +

函数参数

that + + +Object + + + + + + + <optional>
+ + + + + +
+ + APG.DeveloperModel + +

回调上下文

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ activeGroupOverlap(group1, group2 [, feedback], context [, that]) + +

+ +
+
+ + +
+

设置组对象和组对象的重叠检测

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
group1 + + +Phaser.Group + + + + + + + + + + + + +
group2 + + +Phaser.Group + + + + + + + + + + + + +
feedback + + +function + + + + + + + <optional>
+ + + + + +
+ +

碰撞后的触发函数

context + + +Array + + + + + + + + + + + + +

函数参数

that + + +Object + + + + + + + <optional>
+ + + + + +
+ + APG.DeveloperModel + +

回调上下文

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ activeTileOverlap(group, tileIndex [, feedback], context [, that]) + +

+ +
+
+ + +
+

设置组对象和瓷砖对象的重叠检测

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
group + + +Phaser.Group + + + + + + + + + + + + +
tileIndex + + +integer + + + + + + + + + + + + +

瓷砖id

feedback + + +function + + + + + + + <optional>
+ + + + + +
+ +

碰撞后的触发函数

context + + +Array + + + + + + + + + + + + +

函数参数

that + + +Object + + + + + + + <optional>
+ + + + + +
+ + APG.DeveloperModel + +

回调上下文 * @param group

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ isCollided(group1, group2) + +

+ +
+
+ + +
+

检测两个对象是否碰撞【未完成】

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
group1 + + +Phaser.Group + + + + +
group2 + + +Phaser.Group + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + + + +
+ +
+ + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ + + + +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/api/APG.Update.listenKey.html b/docs/api/APG.Update.listenKey.html new file mode 100644 index 0000000..a99c043 --- /dev/null +++ b/docs/api/APG.Update.listenKey.html @@ -0,0 +1,1251 @@ + + + + + + + + Algorithm PlayGround Class: listenKey + + + + + + + + + +
+
+ +
+ +
+ +

Class: listenKey

+
+ +
+ +

+ listenKey +

+ + +
+ + +
+
+ + +
+

+ new listenKey() + +

+ +
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +

Methods

+ +
+ +
+

+ stopListenKey() + +

+ +
+
+ + +
+

按键无效

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ startListenKey() + +

+ +
+
+ + +
+

开启按键监听功能

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ setMoveKey(direction, key) + +

+ +
+
+ + +
+

修改移动按键

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
direction + + +string + + + + +

方向updownleftright

key + + +string + + + + +

按键

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ addKeyEvent(key, feedback, context [, that]) + +

+ +
+
+ + +
+

添加按键功能

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
key + + +string + + + + + + + + + + + + +

按键

feedback + + +function + + + + + + + + + + + + +

功能函数

context + + +Array + + + + + + + + + + + + +

函数传入的参数

that + + +Object + + + + + + + <optional>
+ + + + + +
+ + APG.DeveloperModel + +

回调上下文

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+

+ characterMoveEvent(playerG, role, resolve, resolveContext, reject, rejectContext [, that]) + +

+ +
+
+ + +
+

角色移动相关事件。

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
playerG + + +Phaser.Group + + + + + + + + + + + + +

角色组

role + + +function + + + + + + + + + + + + +

移动判断函数

resolve + + +function + + + + + + + + + + + + +

移动成功执行函数,

resolveContext + + +Array + + + + + + + + + + + + +

成功函数传入的参数

reject + + +function + + + + + + + + + + + + +

移动失败执行函数

rejectContext + + +Array + + + + + + + + + + + + +

失败函数传入的参数

that + + +Object + + + + + + + <optional>
+ + + + + +
+ + APG.DeveloperModel + +

回调上下文

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + + + +
+ +
+ + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ + + + +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/api/Assets.js.html b/docs/api/Assets.js.html new file mode 100644 index 0000000..91ca27f --- /dev/null +++ b/docs/api/Assets.js.html @@ -0,0 +1,285 @@ + + + + + + + + Algorithm PlayGround Source: Assets.js + + + + + + + + + +
+
+ +
+ +
+ +

Source: Assets.js

+ +
+
+
console.log("Assets.js has been loaded successfully.")
+/* ==========    Assets ====================  */
+/**
+ * Assets(资源):游戏需要加载的资源,也是接口的一个分类。
+ * @class APG.Assets
+ */
+APG.Assets;
+APG.Assets.virtualButton;
+
+/**
+ * 播放音乐
+ * @method APG.Assets#playMusic
+ * @param {string} keyName - 音乐名
+ */
+APG.Assets.playMusic = function (keyName) {
+    APG.Assets.music[keyName].play('', 0, 1, true);
+    console.log("Play music: " + keyName);
+};
+
+/**
+ * 停止音乐。如果没有传入名称,则全部停止
+ * @method APG.Assets#stopMusic
+ * @param {string} keyName - 音乐名
+ */
+APG.Assets.stopMusic = function(keyName){
+    let musics = keyName? {keyName:APG.Assets.music[keyName]}: APG.Assets.music;
+    for(m in musics){
+        APG.Assets.music[m].stop();
+        console.log("Stop music: "+keyName);
+    }
+};
+
+/**
+ * 添加动画, 并播放.
+ * @method APG.Assets#setAnimations
+ * @param {Phaser.Group|Phaser.Sprite} obj - 要设置的对象
+ * @param {string} name - 动作名
+ * @param {Array} frames - 帧id
+ * @param {integer} [frameRate = 1] - 帧动画速度
+ * @param {boolean} [loop = false] - 循环否
+ */
+APG.Assets.setAnimations = function(obj, name, frames, frameRate=1, loop=false){
+    /*
+    * */
+    if(typeof frames == "number"){
+        frames = [frames]
+    }
+    if(!obj.forEach){
+        let s = obj;
+        if(frames){
+        }
+        if(!s.animations.getAnimation(name)){
+            s.animations.add(name,frames);
+        }
+        s.animations.play(name, frameRate, loop);
+    }else{
+        let group = obj;
+        group.forEach(function(s){
+            if(!s.animations.getAnimation(name)) {
+                s.animations.add(name, frames);
+            }
+            s.animations.play(name, frameRate, loop);
+        });
+    }
+};
+
+/**
+ * 设置玩家移动动画
+ * @method APG.Assets#playerMoveAnimations
+ * @param {Phaser.Group|Phaser.Sprite} playerG - 玩家对象
+ * @param {object} obj - 方向(大写,或小写 -> frames 或单个数字,比如
+ *   {
+ *       right: 0,
+ *       LEFT: [1],
+ *       d own: [2],
+ *       up: 3,
+ *   }
+ */
+APG.Assets.playerMoveAnimations = function(playerG, obj){
+    var move = {};
+    for(var i in obj){
+        var I = i.toUpperCase()
+        move[I] = typeof obj[i] == 'number'?[obj[i]]: obj[i];
+
+    }
+    if(playerG.animations){
+        playerG.animations.add(I, move[I], 1);
+        playerG.Assets.move = move;
+    }else{
+        playerG.forEach(function(s){
+            s.animations.add(I, move[I], 1);
+            s.Assets = {};
+            s.Assets.move = move;
+        });
+        playerG.Assets = {};
+        playerG.Assets.move = move;
+    }
+};
+
+/**
+ * 根据传入的精灵或组,返回此精灵当前的动画的frameId
+ * @method APG.Assets#getFrame
+ * @param {Phaser.Group|Phaser.Sprite} obj - 精灵或组或精灵列表
+ * @returns {Array|number} 如果传入组或精灵列表,返回frameId 列表
+ */
+APG.Assets.getFrame = function(obj){
+    if(obj.animations){
+        /* sprite */
+        return obj.animations.frame;
+    }else{
+        /* group or sprite List*/
+        var frames = [];
+        obj.forEach(function(s){
+            frames.push(s.animations.frame);
+        });
+        return frames;
+    }
+
+};
+
+
+APG.Assets.setVirtualButton = function(name, x, y, func){
+    // APG.Assets.virtualButton["button"] = button;
+    APG.Assets.virtualButton.push({
+        "name": name,
+        "x": x,
+        "y": y,
+        "func": func,
+        "buttonObj": null, // 会由APG-core进行赋值
+    })
+};
+
+APG.Assets.deleteVirtualButton = function(name){
+    for(i = 0;i<APG.Assets.virtualButton.length;i++) {
+        if (APG.Assets.virtualButton[i].name = name) {
+            var obj = APG.Assets.virtualButton[i].buttonObj;
+            if (obj) {
+                obj.destroy()
+            }
+            APG.Assets.virtualButton.pop(i)
+            break;
+        }
+    }
+}
+
+APG.Assets.changeVirtualButton = function(name,newName){
+    var bnt = APG.Assets.virtualButton.find(function(b){
+        return b.name==name;
+    })
+    if(bnt && game.cache.checkImageKey(newName)){
+        bnt.name = newName;
+        bnt.buttonObj.loadTexture(newName)
+    }
+}
+
+
+ + + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ +
+
+ + + + + + + diff --git a/docs/api/Bag.js.html b/docs/api/Bag.js.html new file mode 100644 index 0000000..e9d10f5 --- /dev/null +++ b/docs/api/Bag.js.html @@ -0,0 +1,436 @@ + + + + + + + + Algorithm PlayGround Source: Bag.js + + + + + + + + + +
+
+ +
+ +
+ +

Source: Bag.js

+ +
+
+
console.log("Bag.js has been loaded successfully.")
+
+/*APG.Bag.views = [];*/
+
+/**
+ * 背包系统,用于模拟栈和堆,默认放入背包,拿出背包采用后入先出的栈式操作
+ * @class APG.Bag
+ */
+APG.Bag;
+
+/**
+ * 显示背包
+ * @method APG.Bag#showBagBar
+ */
+APG.Bag.showBagBar = function(){
+    let w = APG.Bag.BagBar.w;
+    let h = APG.Bag.BagBar.h;
+    let x = (WIDTH - w);
+    let y = 0;
+    var bar = game.add.graphics();
+    bar.beginFill('0x'+'#87df00'.slice(1), 0.8);
+    bar.drawRect(x, y, w, h);
+    APG.Bag.views.push(bar);
+    console.log(APG.Bag.BagBar)
+
+
+    var style = { font: "bold "+APG.WIDTH/40+"px Arial", fill: "#00124f",
+        boundsAlignH: "center",
+        wordWrap: true,
+        wordWrapWidth: w * 0.8
+    };
+    var text = game.add.text(x,y, "背包系统\n", style);
+    APG.Bag.views.push(text);
+
+    // text.anchor.set(0.5,0);
+
+    /* 默认最大容量是初始化的1倍 */
+    // APG.Bag.capcity = APG.Bag.size;
+};
+
+/**
+ * 隐藏背包,可通过 `showBagBar` 再次显示
+ * @method APG.Bag#hiddenBagBar
+ */
+APG.Bag.hiddenBagBar = function(){
+    APG.Bag.views.forEach(function(s){
+        s.destroy();
+    });
+};
+
+/**
+ * 摧毁背包,不可再生
+ * @method APG.Bag#destroyBagBar
+ */
+APG.Bag.destroyBagBar = function() {
+    APG.Bag.hiddenBagBar();
+    APG.Bag.items.forEach(function(s){
+        console.log(s)
+        s.imgObj.destroy();
+        s.textObj.destroy();
+    });
+    APG.Bag.capcity = 0;
+    APG.Bag.size = 0;
+    APG.Bag.items = [];
+    APG.Bag.views = [];
+};
+
+/**
+ * 在背包中增加物品
+ * @method APG.Bag#addItem
+ * @param {Phaser.Sprite} sprite - 添加的物品对象,作为样品显示
+ * @param {integer} number - 添加的数量
+ */
+APG.Bag.addItem = function(sprite, number) {
+
+    var number = number? number: 1;
+    let text = game.add.text(0,0, number);
+    sprite.kill();
+    text.kill();
+
+    console.log(sprite)
+    APG.Bag.items.unshift({
+        imgObj: sprite,
+        textObj: text,
+        itemName: sprite[0].keyName, /* 物品名字,用于查找*/
+        imgMode: sprite[0].imgMode,
+        imgKey: sprite[0].imgKey,    /*  图片名*/
+        frameId: sprite[0].frameId? sprite[0].frameId: sprite.frame,  /* 如果是帧动画, 帧的id */
+        number: number,    /*  初始数量*/
+    });
+    APG.Bag.size += number;
+};
+
+
+/**
+ * 从背包里把第一个东西拿出去
+ * @method APG.Bag#putItem
+ * @param x 相对坐标x
+ * @param y 相对坐标y
+ * @param {Phaser.Group} group - 放置的精灵的所属的组
+ */
+APG.Bag.putItem = function(x, y, group) {
+    console.log(APG.Bag.size);
+    if(APG.Bag.size){
+        let item = APG.Bag.items[0];
+        let imgObj = item.imgObj[0];
+        let sprite;
+        if(item.imgMode == "textbitmap") {
+            sprite = APG.Target.addTextBitMap(x, y, imgObj.text, imgObj.bgColor);
+            if(group) {
+                group.add(sprite);
+            }
+        }else{
+            sprite = APG.Sprite.addSprite(x,y,imgObj.imgKey, imgObj.frameId, group, imgObj.keyName);
+        }
+        if(!group){
+            var group = APG.Group.getTargetGroup(imgObj.keyName);
+            console.log(group)
+            if(group){
+                group.add(sprite);
+            }
+        }
+        if(0 == --item.number){
+            APG.Bag.items[0].imgObj.destroy();
+            APG.Bag.items[0].textObj.destroy();
+            APG.Bag.items.splice(0,1);
+        }
+
+        APG.Bag.size --;
+        console.log(sprite)
+        return sprite;
+    }
+};
+
+/**
+ * 把东西放到背包里,按照对象的keyName分组,如果是新东西,就放在第一个
+ * @method APG.Bag#getItem
+ * @param {Array} spriteList - 放入背包的列表
+ */
+APG.Bag.getItem = function(spriteList) {
+    if(!spriteList.forEach){
+        var spriteList = [spriteList];
+    }
+    spriteList.forEach(function(sprite){
+        /* 确保容量够用 */
+        // console.log(APG.Bag.size)
+        // console.log(APG.Bag.capcity)
+        if(APG.Bag.size < APG.Bag.capcity) {
+            var item = APG.Bag.items.find(function(b){
+                return b.itemName == sprite[0].keyName;
+            });
+            /* 如果背包中存在,并且不是 textbitmap*/
+            if(item && sprite[0].imgMode != 'textbitmap'){
+                item.number ++;
+                APG.Bag.size ++;
+            }else if(!item || sprite[0].imgMode == 'textbitmap'){
+                let s;
+                if(sprite[0].imgMode == 'textbitmap'){
+                    s = APG.Target.addTextBitMap(0,0,sprite[0].text, sprite[0].bgColor);
+                }else{
+                    s = APG.Sprite.addSprite(0,0,sprite[0].imgKey,sprite[0].frameId,null,sprite[0].keyName);
+                }
+
+                s[0] = JSON.parse(JSON.stringify(sprite[0]));
+                APG.Bag.addItem(s,1);
+            }
+
+            sprite.destroy();    /* 地面上没有物品了 */
+        }
+    });
+};
+
+
+/**
+ * 把第一个位置的东西丢掉,计数减一,如果物品丢完,就从侧边栏去掉这个物品
+ * @method APG.Bag#dropItem
+ */
+APG.Bag.dropItem = function(){
+    if(APG.Bag.size) {
+        let item = APG.Bag.items[0];
+        if (--item.number == 0) {
+            APG.Bag.items[0].imgObj.destroy();
+            APG.Bag.items[0].textObj.destroy();
+            APG.Bag.items.splice(0, 1);
+        }
+        APG.Bag.size--;
+    }
+};
+
+/**
+ * 得到物品的数量
+ * @method APG.Bag#getItemNum
+ * @param {string} itemName - 物品名
+ * @returns {Integer}
+ */
+APG.Bag.getItemNum = function(itemName){
+    let item = APG.Bag.items.find(function(b){
+        return b.itemName == itemName;
+    });
+    return item? item.number: 0;
+};
+
+/**
+ * 设置背包最大容量
+ * @method APG.Bag#setBagCapacity
+ * @param {integer} n - 最大容量
+ */
+APG.Bag.setBagCapacity = function(n){
+    APG.Bag.capcity = n;
+};
+
+/**
+ * 得到背包最大容量
+ * @method APG.Bag#getBagCapacity
+ * @returns {integer}
+ */
+APG.Bag.getBagCapacity = function(){
+    return APG.Bag.capcity;
+};
+
+/**
+ * 得到背包当前容量
+ * @method APG.Bag#getBagSize
+ * @returns {integer}
+ */
+APG.Bag.getBagSize = function(){
+    return APG.Bag.size;
+};
+
+/**
+ * 得到当前背包第一个物品组
+ * @method APG.Bag#getBagFirst
+ * @returns {Array}
+ */
+APG.Bag.getBagFirst = function(){
+    if(items.length){
+        return APG.Bag.items[0];
+    }
+};
+
+/**
+ * 背包物品组向后(下)移动
+ * @method APG.Bag#goDownItems
+ */
+APG.Bag.goDownItems = function(){
+    if(APG.Bag.items.length){
+        APG.Bag.items = APG.Bag.items.concat(APG.Bag.items.splice(0,1));
+    }
+};
+
+/**
+ * 背包物品组向前(上)移动
+ * @method APG.Bag#goUpItems
+ */
+APG.Bag.goUpItems = function() {
+    if(APG.Bag.items.length) {
+        APG.Bag.items = APG.Bag.items.splice(APG.Bag.items.length-1,1).concat(APG.Bag.items);
+    }
+};
+
+/**
+ * 更新背包中的物品信息, 和数量对应
+ * @method APG.Bag#updateBag
+ */
+APG.Bag.updateBag = function(){
+    let w = APG.Bag.BagBar.w;
+    let h = APG.Bag.BagBar.h;
+    let x = (WIDTH - w);
+    let y = 0;
+
+    var items = APG.Bag.items;
+    var barX = x + w*0.1;
+    var barY = y + h*0.1;
+    var barSide = Math.min((APG.Bag.BagBar.h - barY -  APG.Tile.height/2) / (items.length*1.1),
+        APG.Bag.BagBar.w /2.5);
+    var styleOfNum = {
+        font: "bold "+barSide*0.8+"px Arial",
+        fill: "#00124f",
+        boundsAlignH: "center",
+    };
+
+
+    for(i = 0;i<items.length;i++){
+            // game.add.sprite(barX,barY,items[i].imgKey, items[i].frameId);
+        var img = items[i].imgObj;
+        img.x = barX;
+        img.y = barY;
+        img.height = barSide;
+        img.width = barSide;
+        img.revive();
+        // APG.Bag.views.push(img);
+            // game.add.text(barX+barSide*1.1,barY, items[i].number, styleOfNum);
+        var text = items[i].textObj;
+        text.setText(items[i].number);
+        text.setStyle(styleOfNum);
+        text.x = barX + barSide * 1.3;
+        text.y = barY;
+        text.revive();
+        // APG.Bag.views.push(text);
+
+        // console.log (APG.Bag.views)
+        barY += barSide*1.1;
+    }
+};
+
+
+
+ + + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ +
+
+ + + + + + + diff --git a/docs/api/Game.js.html b/docs/api/Game.js.html new file mode 100644 index 0000000..b0efb86 --- /dev/null +++ b/docs/api/Game.js.html @@ -0,0 +1,412 @@ + + + + + + + + Algorithm PlayGround Source: Game.js + + + + + + + + + +
+
+ +
+ +
+ +

Source: Game.js

+ +
+
+
console.log("Game.js has been loaded successfully.")
+
+/* 界面 */
+
+/**
+ * Game(游戏属性):游戏全局控制,界面,大小,全屏,重启游戏等操作。
+ * @class APG.Game
+ */
+APG.Game;
+
+/**
+ * 得到游戏宽。
+ * @method APG.Game#getGameWIDTH
+ * @returns {*|number|Window.screen.width}
+ */
+APG.Game.getGameWIDTH = function(){
+    return APG.WIDTH;
+};
+
+/**
+ * 得到游戏高。
+ * @method APG.Game#getGameHEIGHT
+ * @returns {*|number|Window.screen.height}
+ */
+APG.Game.getGameHEIGHT = function(){
+    return APG.HEIGHT;
+};
+
+/**
+ * 得到游戏渲染模式。
+ * @method APG.Game#getGameMODE
+ * @returns {*|string}
+ */
+APG.Game.getGameMODE = function(){
+    return APG.MODE;
+};
+
+/**
+ * 显示游戏开始界面,根据配置文件中配置自动显示。
+ * @method APG.Game#README
+ */
+APG.Game.README = function(){
+    let config = globalConfig.README;
+    config.font.size = WIDTH/(Math.sqrt(config.text.length/2))/5
+
+
+    APG.Update.listenKey.stopListenKey();
+
+    let w = WIDTH * 0.8;
+    let h = HEIGHT * 0.8;
+    let x = (WIDTH - w) / 2;
+    let y = (HEIGHT - h) / 2;
+    let  bar = game.add.graphics();
+    bar.beginFill('0x'+config.bgColor.slice(1), 0.9);
+    bar.drawRect(x, y, w, h);
+
+    let style = { font: "bold "+config.font.size+"px Arial",
+        fill: config.font.color,
+        boundsAlignH: "center",
+        wordWrap: true,
+        wordWrapWidth: w * 0.8
+    };
+    let style2 = { font: "bold "+config.font.size/2+"px Arial",
+        fill: 'rgb(1,1,1)'
+    };
+
+    let str = '';
+    let columnCount = parseInt(style.wordWrapWidth / config.font.size);
+    let index = 1;
+    for(let i=0;i<config.text.length;i++){
+        if(config.text[i]=='\n'){
+            index = 1;
+        }
+        if((index) % (columnCount+1) == 0){
+            str += '\n';
+        }
+        str += config.text[i];
+        index++;
+    }
+
+    config.text = str;
+    let text = game.add.text(WIDTH/2, y*1.2, config.text, style);
+    text.anchor.set(0.5,0);
+    let text2 = game.add.text(x+w-APG.Tile.width/2, y+h-APG.Tile.height/2, "click to continue", style2);
+    text2.anchor.set(1,1);
+
+    bar.inputEnabled = true;
+    // bar.input.useHandCursor = true;
+    game.input.onTap.addOnce(function(){
+        bar.destroy();
+        text.destroy();
+        text2.destroy();
+        APG.Update.listenKey.startListenKey();
+    });
+};
+
+/**
+ * 显示胜利界面
+ * @method APG.Game#WIN
+ * @param {string} str - 自定义显示的文字
+ * @param {function} func - 点击界面后执行的函数
+ * @param {{}} [that = APG.DeveloperModel] - 回调上下文
+ */
+APG.Game.WIN = function(str, func, that=APG.DeveloperModel){
+    game.input.keyboard.stop();
+
+    let w = WIDTH * 0.8;
+    let h = HEIGHT * 0.8;
+    let x = (WIDTH - w) / 2;
+    let y = (HEIGHT - h) / 2;
+    let  bar = game.add.graphics();
+    bar.beginFill('0x'+'#dfc9c8'.slice(1), 0.8);
+    bar.drawRect(x, y, w, h);
+
+    let  style = { font: "bold "+globalConfig.README.font.size+"px Arial", fill: "#0037f1",
+        boundsAlignH: "center",
+        wordWrap: true,
+        wordWrapWidth: w * 0.8
+    };
+    let text = game.add.text(WIDTH/2, y*1.2, "You Win\n"+str, style);
+    text.anchor.set(0.5,0);
+
+    bar.inputEnabled = true;
+    bar.input.useHandCursor = true;
+    if(func){
+        game.input.onTap.addOnce(func,that)
+        // bar.events.onInputDown.add(func,that);
+    }
+};
+
+/**
+ * 显示失败界面
+ * @method APG.Game#LOST
+ * @param {string} str - 自定义显示的文字
+ * @param {function} func - 点击界面后执行的函数
+ * @param {{}} [that = APG.DeveloperModel] - 回调上下文
+ */
+APG.Game.LOST = function(str, func, that=APG.DeveloperModel){
+    game.input.keyboard.stop();
+
+    let w = APG.WIDTH * 0.8;
+    let h = APG.HEIGHT * 0.8;
+    let x = (APG.WIDTH - w) / 2;
+    let y = (APG.HEIGHT - h) / 2;
+    let  bar = game.add.graphics();
+    bar.beginFill('0x'+'#dfc9c8'.slice(1), 0.8);
+    bar.drawRect(x, y, w, h);
+
+    let  style = { font: "bold "+globalConfig.README.font.size+"px Arial", fill: "#0037f1",
+        boundsAlignH: "center",
+        wordWrap: true,
+        wordWrapWidth: w * 0.8
+    };
+    let text = game.add.text(WIDTH/2, y*1.2, "You LOST\n"+str, style);
+    text.anchor.set(0.5,0);
+
+    bar.inputEnabled = true;
+    bar.input.useHandCursor = true;
+    if(func){
+        game.input.onTap.addOnce(func,that)
+        // bar.events.onInputDown.add(func,that);
+    }
+};
+
+/**
+ * 游戏全屏
+ * @method APG.Game#fullScreen
+ */
+APG.Game.fullScreen = function(){
+    var element = document.documentElement;
+    if (element.requestFullscreen) {
+        // W3C
+        element.requestFullscreen();
+    } else if (element.msRequestFullscreen) {
+        // msie
+        element.msRequestFullscreen();
+    } else if (element.mozRequestFullScreen) {
+        // firefox
+        element.mozRequestFullScreen();
+    } else if (element.webkitRequestFullscreen) {
+        // chrome
+        element.webkitRequestFullscreen();
+    }
+};
+
+/**
+ * 游戏退出全屏
+ * @method APG.Game#exitFullscreen
+ */
+APG.Game.exitFullscreen = function(){
+    if (document.exitFullscreen) {
+        document.exitFullscreen();
+    } else if (document.msExitFullscreen) {
+        document.msExitFullscreen();
+    } else if (document.mozCancelFullScreen) {
+        document.mozCancelFullScreen();
+    } else if (document.webkitExitFullscreen) {
+        document.webkitExitFullscreen();
+    }
+};
+
+/**
+ * 游戏重启,无需重新加载资源
+ * @method APG.Game#restartGame
+ */
+APG.Game.restartGame = function(){
+    APG.Bag.destroyBagBar();
+    APG.Assets.stopMusic();
+    APG.Tilemap.destroy();
+    APG.Layer.destroy();
+
+    for(m in APG.CharacterGroups) {
+        APG.CharacterGroups[m].destroy();
+        APG.CharacterGroups[m].removeAll();
+    }
+    for(m in APG.TargetGroups) {
+        APG.TargetGroups[m].removeAll();
+        APG.TargetGroups[m].destroy();
+    }
+    for(b of APG.Assets.virtualButton){
+        b.buttonObj.destroy();
+    }
+    APG.Assets.virtualButton = [];
+    game.state.restart();
+};
+
+
+APG.Game.fireKeyEvent = function(el, evtType, keyCode){
+    var doc = el.ownerDocument;
+    var win = doc.defaultView || doc.parentWindow,
+        evtObj;
+    if(doc.createEvent){
+        if(win.KeyEvent) {
+            evtObj = doc.createEvent('KeyEvents');
+            evtObj.initKeyEvent( evtType, true, true, win, false, false, false, false, keyCode, 0 );
+        }
+        else {
+            evtObj = doc.createEvent('UIEvents');
+            Object.defineProperty(evtObj, 'keyCode', {
+                get : function() { return this.keyCodeVal; }
+            });
+            Object.defineProperty(evtObj, 'which', {
+                get : function() { return this.keyCodeVal; }
+            });
+            evtObj.initUIEvent( evtType, true, true, win, 1 );
+            evtObj.keyCodeVal = keyCode;
+            if (evtObj.keyCode !== keyCode) {
+                console.log("keyCode " + evtObj.keyCode + " 和 (" + evtObj.which + ") 不匹配");
+            }
+        }
+        el.dispatchEvent(evtObj);
+    }
+    else if(doc.createEventObject){
+        evtObj = doc.createEventObject();
+        evtObj.keyCode = keyCode;
+        el.fireEvent('on' + evtType, evtObj);
+    }
+}
+
+APG.Game.isInner =function(sprite, x,y){
+    s = {}
+    s.x = sprite.x
+    s.y = sprite.y
+    s.width = sprite.width
+    s.height = sprite.height
+    if(isvertical){
+        s.x = APG.HEIGHT-sprite.y-sprite.height;
+        s.y = sprite.x
+    }
+    console.log(s)
+    console.log(x,y)
+
+    if(x>=s.x && x<=s.x+s.width &&
+        y>=s.y && y<=s.y+s.height){
+        return true;
+    }
+    return false;
+}
+
+
+
+
+
+ + + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ +
+
+ + + + + + + diff --git a/docs/api/Group.js.html b/docs/api/Group.js.html new file mode 100644 index 0000000..7caf529 --- /dev/null +++ b/docs/api/Group.js.html @@ -0,0 +1,197 @@ + + + + + + + + Algorithm PlayGround Source: Group.js + + + + + + + + + +
+
+ +
+ +
+ +

Source: Group.js

+ +
+
+
console.log("Group.js has been loaded successfully.")
+
+/**
+ * Group(组):概念取自phaser,指代框架中多个的元素对象组合而来的组形式的对象。也是接口的一个分类。
+ * @class APG.Group
+ */
+APG.Group;
+
+
+/**
+ * 创建一个组,
+ * 默认存在0个精灵, 默认key 为spritesheet, index 从1开始。
+ * @method APG.Group#setGroup
+ * @returns {Phaser.Group}
+ */
+APG.Group.setGroup = function(){
+    var group = game.add.group();
+    group.enableBody = true;
+    game.physics.arcade.enable(group);
+    return group;
+};
+
+/**
+ * 移动 groupUp 对象到 groupDown 对象上面。
+ * @method APG.Group#moveGroupUpTo
+ * @param {Phaser.Group} groupUp
+ * @param {Phaser.Group} groupDown
+ */
+APG.Group.moveGroupUpTo = function(groupUp, groupDown){
+    while(groupUp.z<=groupDown.z){
+        game.world.moveUp(groupUp);
+        console.log(groupUp.z, groupDown.z)
+    }
+};
+/**
+ * 移动 groupDown 对象到 groupUp 对象下面。
+ * @method APG.Group#moveGroupDownTo
+ * @param {Phaser.Group} groupDown
+ * @param {Phaser.Group} groupUp
+ */
+APG.Group.moveGroupDownTo = function(groupDown, groupUp){
+    while(groupDown.z >= groupUp.z){
+        game.world.moveDown(groupDown);
+    }
+};
+
+/**
+ * 得到 `target `组对象,`target` 是设置在游戏配置文件中的。
+ * @method APG.Group#getTargetGroup
+ * @param {string} name - Target组名
+ * @returns {Phaser.Group}
+ */
+APG.Group.getTargetGroup = function(name){
+    return APG.TargetGroups[name];
+};
+
+/**
+ * 得到 `Character` 组对象,`Character` 是设置在游戏配置文件中的。
+ * @method APG.Group#getCharacterGroup
+ * @param {string} name - Character组名
+ * @returns {Phaser.Group}
+ */
+APG.Group.getCharacterGroup = function(name){
+    return APG.CharacterGroups[name];
+};
+
+
+
+ + + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ +
+
+ + + + + + + diff --git a/docs/api/Sprite.js.html b/docs/api/Sprite.js.html new file mode 100644 index 0000000..c6bbfcd --- /dev/null +++ b/docs/api/Sprite.js.html @@ -0,0 +1,313 @@ + + + + + + + + Algorithm PlayGround Source: Sprite.js + + + + + + + + + +
+
+ +
+ +
+ +

Source: Sprite.js

+ +
+
+
console.log("Sprite.js has been loaded successfully.")
+
+/**
+ * Sprite(精灵):概念取自phaser,指代框架中一个单一的元素对象,可以是角色,也可以是交互对象。也是接口的一个分类。
+ * @class APG.Sprite
+ */
+APG.Sprite;
+
+/**
+ * 新增一个精灵在组中。
+ * @method APG.Sprite#addSprite
+ * @param {integer} x - 相对坐标x
+ * @param {integer} y - 相对坐标y
+ * @param {string} imgKey - 对象贴图名
+ * @param {integer} frame - 贴图块id (begin with 1)
+ * @param {Phaser.Group} [group] - 如果传入组,就将精灵加入这个组中
+ * @param {string} [keyName = imgKey]- 设置的精灵的名,如果没有就和 `imgKey` 一样
+ * @returns {*}
+ */
+APG.Sprite.addSprite = function(x, y, imgKey, frame, group, keyName){
+    var site = APG.Sprite.siteDecode(x,y);
+    var s = game.add.sprite(site.x, site.y, imgKey, frame-1);
+    // s.x += APG.MapArea.x;
+    // s.y += APG.MapAre    a.y;
+    s.scale.setTo(1);
+    s.scale.setTo(Math.min(APG.Tile.width / s.width,
+        APG.Tile.height / s.height));
+    game.physics.enable(s, Phaser.Physics.ARCADE);
+    APG.Sprite.setBody(s,0.6,0.6,0.2,0.2);
+    s[0] = {
+        keyName: keyName? keyName: imgKey,
+        imgKey: imgKey,
+        frameId: frame
+    };
+    if(group){
+        group.add(s);
+    }
+    return s;
+};
+
+/**
+ * 设置精灵的位置相对坐标。
+ * @method APG.Sprite#setSpriteSite
+ * @param {Phaser.Sprite} s - 精灵对象
+ * @param {integer} x - 相对坐标x
+ * @param {integer} y - 相对坐标y
+ */
+APG.Sprite.setSpriteSite = function(s, x, y){
+    var site = APG.Sprite.siteDecode(x,y);
+    s.x = site.x;
+    s.y = site.y;
+};
+
+/**
+ * 得到组中的精灵列表。
+ * @param {Phaser.Group} group - 组对象
+ * @returns {Array}
+ */
+APG.Sprite.getSpriteList = function(group){
+    return group.children;
+};
+
+/**
+ * 从一个组里, 且在这个位置上, 拿精灵, 返回列表。
+ * 如果指定了所属组,便从指定组中寻找, 如果没有便从世界开始查找
+ * @param {integer} x - 相对坐标x
+ * @param {integer} y - 相对坐标y
+ * @param [group = game.world] - 寻找的范围,不给则为全部世界,可以是group对象, 也可以是数组
+ * @param {boolean} [recursive = false] - 是否递归查找
+ * @param {integer} [safe = 5] - 递归深度,为0则为无限.
+ * @returns {Array}
+ */
+APG.Sprite.getSpriteListFromSite = function(x, y, group=game.world, recursive=false, safe=5){
+    if(safe > 0){
+        var newsafe = safe-1 == 0? -1: safe-1;
+    }else if(safe < 0){
+        return [];
+    }else if(safe == 0){
+        var newsafe = safe;
+    }
+    var sprites = [];
+    if(group){
+        group.forEach(function(s){
+            if(!s.alive){
+                return;
+            }
+            // console.log(s.x,s.y)
+            if(s.children.length && recursive){
+                var ss = APG.Sprite.getSpritesFromSite(x,y,s,true,newsafe);
+                sprite = sprite.concat(ss);
+            }
+            var site = APG.Sprite.getSpriteSite(s);
+            if(site.x == x && site.y == y){
+                /* or
+                *     s.relx == x && s.rely == y
+                * */
+                sprites.push(s);
+            }
+        });
+    }
+    return sprites;
+};
+
+/**
+ * 摧毁一个精灵对象。
+ * @param {Phaser.Sprite} sprite - 要摧毁的精灵对象
+ */
+APG.Sprite.destroySprite = function(sprite){
+    if(sprite){
+        sprite.destroy();
+    }
+};
+
+/**
+ * 得到一个精灵的相对于地图Area的相对坐标,。
+ * @param {Phaser.Sprite} sprite - 精灵对象
+ * @returns {{x: number, y: number}|{x, y}}
+ */
+APG.Sprite.getSpriteSite = function(sprite){
+    return APG.Sprite.siteCode(sprite.x,sprite.y);
+};
+
+/**
+ * 将相对地址变成绝对地址
+ * @param {integer} x - 相对坐标x
+ * @param {integer} y - 相对坐标y
+ * @returns {{x: number, y: number}}
+ */
+APG.Sprite.siteDecode = function(x, y){
+    /* 将相对地址变成绝对地址  */
+    if(typeof x == "object"){
+        var y = x.y;
+        var x = x.x;
+    }
+    return {
+        x: x * APG.Tile.width  + APG.MapArea.offsetX,
+        y: y * APG.Tile.height + APG.MapArea.offsetY,
+    }
+};
+
+/**
+ * 将绝对地址变成相对地址
+ * @param {number} x - 绝对坐标x
+ * @param {number} y - 绝对坐标y
+ * @returns {{x: integer, y: integer}}
+ */
+APG.Sprite.siteCode = function(x, y){
+    if(typeof x == "object"){
+        var y = x.y;
+        var x = x.x;
+    }
+
+    let site = {
+        x: (x - APG.MapArea.offsetX) / APG.Tile.width,
+        y: (y - APG.MapArea.offsetY) / APG.Tile.height,
+    };
+    let about = function(num){
+        return (num - Math.floor(num)) < (Math.ceil(num) - num)? Math.floor(num): Math.ceil(num);
+    };
+
+    site.x = about(site.x);
+    site.y = about(site.y);
+    return site;
+};
+
+/**
+ * 设置对象的物理检测体
+ * @param {Phaser.Sprite|Phaser.Group} s - 对象
+ * @param {number} ratew - 宽比例
+ * @param {number} rateh - 高比例
+ * @param {number} ratex - 相对坐标x比例
+ * @param {number} ratey - 相对坐标y比例
+ */
+APG.Sprite.setBody = function(s, ratew, rateh, ratex, ratey){
+    s.body.setSize(
+        s.width  / s.scale.x * ratew,
+        s.height / s.scale.y * rateh,
+        s.width  / s.scale.x * ratex,
+        s.height / s.scale.y * ratey);
+};
+
+
+
+
+ + + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ +
+
+ + + + + + + diff --git a/docs/api/Target.js.html b/docs/api/Target.js.html new file mode 100644 index 0000000..2226b5a --- /dev/null +++ b/docs/api/Target.js.html @@ -0,0 +1,289 @@ + + + + + + + + Algorithm PlayGround Source: Target.js + + + + + + + + + +
+
+ +
+ +
+ +

Source: Target.js

+ +
+
+
console.log("Target.js has been loaded successfully.")
+/* Target.js */
+
+/**
+ * Target(元素):用于在地图表面上层显示的对象,具有定制的属性,可自定义。也是接口的一个分类。
+ * 主要用于对 `TextBitMap 文字块对象`的操作。
+ * @class APG.Target
+ */
+APG.Target;
+
+/**
+ * 创建一个 TextBitMap
+ * @param {integer} x - 相对坐标x。
+ * @param {integer} y - 相对坐标y
+ * @param {string} text - `TextBitMap`上的文字
+ * @param {string} bg - `TextBitMap`的颜色
+ * @returns {Phaser.Sprite} TextBitMap
+ */
+APG.Target.addTextBitMap = function(x,y, text, bg, fontColor, fontAlpha){
+    /* 创建一个 TextBitMap */
+    let sprite = APG.Sprite.addSprite(x,y);
+    sprite[0].imgMode = "textbitmap";
+    return APG.Target.loadTextBitMap(sprite,text,bg, fontColor, fontAlpha);
+};
+
+/**
+ * 得到`TextBitMap`的信息。
+ * 如果传入一个非 TextBitMap 精灵, 保证能返回一致的格式。
+ * @param {Phaser.Sprite} sprite - 传入的`TextBitMap`对象
+ * @returns {{bgColor: (string), text: (string)}}
+ */
+APG.Target.aboutTextBitMap = function(sprite){
+    let s = sprite[0]? sprite[0]: {};
+    return {
+        text: s.text,
+        bgColor: s.bgColor,
+    }
+};
+
+/**
+ * 将一个对象的贴图换做 TextBitMap, 如果未传入对象, 则创建一个。
+ * 会先清除之前的绑定文本 以及背景。
+ * 参考 https://photonstorm.github.io/phaser-ce/Phaser.Text.html#alignTo
+ * @param {Phaser.Sprite} sprite - 传入的要转换的精灵对象
+ * @param {string} text - `TextBitMap`上的文字
+ * @param {string} bg - `TextBitMap`的颜色
+ * @returns {Phaser.Sprite} TextBitMap
+ */
+APG.Target.loadTextBitMap = function(sprite, text, bgColor, fontColor, fontAlpha) {
+    if(sprite){
+        var info = APG.Target.aboutTextBitMap(sprite);
+    }else{
+        var sprite = APG.Sprite.addSprite(0,0);
+        var info = {};
+    }
+
+    if(info.text && !text){
+        var text = info.text;
+    }else if(!text){
+        var text = "";
+    }
+    // console.log(bgColor )
+    if(info.bgColor && !bgColor){
+        var bgColor = info.bgColor;
+    }else if(!bgColor){
+        var bgColor = "#ffffff";
+    }
+
+    let bmd = game.add.bitmapData(APG.Tile.width, APG.Tile.height);
+    bmd.ctx.beginPath();
+    bmd.ctx.rect(0,0,APG.Tile.width, APG.Tile.height);
+    bmd.ctx.fillStyle = bgColor;
+    bmd.ctx.fill();
+    bmd.name = "bgColor";
+
+    let rect = game.add.graphics(0, 0);
+    var color;
+
+    if(fontColor && fontColor.length){
+        color = fontColor;
+    }else{
+        color = '0x'+bgColor.slice(1);
+        color = 0xffffff - parseInt(color);
+    }
+    rect.lineStyle(APG.Tile.width/20, color, fontAlpha?fontAlpha:1);
+    rect.drawRect(0,0,APG.Tile.width,APG.Tile.height);
+    rect.name = "rect";
+
+    let oldWidth = sprite.width;
+    let oldHeight = sprite.height;
+
+    if(!sprite){
+        var sprite = game.add.sprite(0,0, bmd);
+    }else{
+        sprite.loadTexture(bmd);
+    }
+
+    let textColor = '#'+parseInt(color).toString(16);
+    if(fontAlpha){
+        textColor += parseInt(0x100 * fontAlpha).toString(16)
+    }
+    // console.log(textColor)
+
+    let style = {
+        font: "bold "+APG.Tile.width/Math.max(2,text.toString().length)+"px Arial",
+        fill: textColor,
+        boundsAlignH: "center",
+        wordWrap: true,
+        wordWrapWidth: APG.Tile.width * 0.8
+    };
+
+    var textObj = game.add.text(0, 0, text,style);
+    textObj.name = "text";
+    textObj.x = (APG.Tile.width - textObj.width) / 2;
+    textObj.y = (APG.Tile.height - textObj.height) / 2;
+    /* 删除原来的文本, 加入新的*/
+    let crash = [];
+    sprite.children.forEach(function(s){
+        if(s.name == "text" || s.name == "rect"){
+            crash.push(s);
+        }
+    });
+    crash.forEach(function(s){
+        s.destroy();
+        sprite.removeChild(s);
+    });
+    crash = null;
+
+    sprite.addChild(rect);
+    sprite.addChild(textObj);
+    sprite.scale.setTo(1);
+    sprite.scale.setTo(oldWidth / sprite.width, oldHeight / sprite.height);
+    /* 更新属性 */
+    sprite[0].text = text;
+    sprite[0].bgColor = bgColor;
+    return sprite;
+};
+
+/**
+ * 对一个组中的 `TextBitMap`对象批量load
+ * @param group
+ * @param {Array} texts - TextBitMap 文字们
+ * @param {Array} bgs - TextBitMap 颜色们
+ * @param {integer} [start = 0] - 组中开始编号,从0开始
+ * @param {integer} [end = group.children.length] - 组中结束编号,未指定 end 就按最后一个
+ */
+APG.Target.loadTextBitMapBetween = function(group, texts, bgs, start, end){
+    var start = start? start: 0;
+    var end = end? end: group.children.length;
+    for(let i = start;i<end;i++){
+        let text = typeof texts == 'object'? texts[i]: texts;
+        let bg = typeof bgs == 'object'? bgs[i]: bgs;
+        text = text? text: null;
+        bg = bg? bg : null;
+        APG.Target.loadTextBitMap(group.children[i], text, bg);
+    }
+};
+
+
+
+ + + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ +
+
+ + + + + + + diff --git a/docs/api/Update.js.html b/docs/api/Update.js.html new file mode 100644 index 0000000..bba06ad --- /dev/null +++ b/docs/api/Update.js.html @@ -0,0 +1,453 @@ + + + + + + + + Algorithm PlayGround Source: Update.js + + + + + + + + + +
+
+ +
+ +
+ +

Source: Update.js

+ +
+
+
console.log("Update.js has been loaded successfully.")
+
+/* ================ update ==============================*/
+/**
+ * @class APG.Update.listenKey
+ */
+APG.Update.listenKey;
+
+/**
+ * 按键无效
+ * @method APG.Update.listenKey#stopListenKey
+ */
+APG.Update.listenKey.stopListenKey = function(){
+    game.input.keyboard.stop();
+};
+
+/**
+ * 开启按键监听功能
+ * @method APG.Update.listenKey#startListenKey
+ */
+APG.Update.listenKey.startListenKey = function(){
+    game.input.keyboard.start();
+};
+
+/**
+ * 修改移动按键
+ * @method APG.Update.listenKey#setMoveKey
+ * @param {string} direction - 方向`up`,`down`,`left`,`right`
+ * @param {string} key - 按键
+ */
+APG.Update.listenKey.setMoveKey = function(direction, key){
+    var direction = direction.toUpperCase();
+    var key = key.toUpperCase();
+    APG.Keys.move[direction] = key;
+};
+
+/**
+ * 添加按键功能
+ * @method APG.Update.listenKey#addKeyEvent
+ * @param {string} key - 按键
+ * @param {function} feedback - 功能函数
+ * @param {Array} context - 函数传入的参数
+ * @param {{}} [that = APG.DeveloperModel] - 回调上下文
+ */
+APG.Update.listenKey.addKeyEvent = function(key, feedback, context, that=APG.DeveloperModel){
+    APG.Update.listenKey.keyEventList.push({
+        key: key,
+        feedback: feedback,
+        context: context,
+        that: that,
+    });
+};
+
+APG.Update.listenKey.addTouchKey = function(imgKey,x,y, func){
+    buttonTool1 = game.add.button(x, y, imgKey);
+    game.input.onTap.add(function(){
+        var clickX = game.input.activePointer.clientX;
+        var clickY = game.input.activePointer.clientY;
+        if(APG.Game.isInner(buttonTool1,clickX, clickY)){
+            that=APG.DeveloperModel
+            func.apply(that)
+        }
+    },this)
+}
+
+/**
+ * 角色移动相关事件。
+ * @method APG.Update.listenKey#characterMoveEvent
+ * @param {Phaser.Group} playerG - 角色组
+ * @param {function} role - 移动判断函数
+ * @param {function} resolve - 移动成功执行函数,
+ * @param {Array} resolveContext - 成功函数传入的参数
+ * @param {function} reject - 移动失败执行函数
+ * @param {Array} rejectContext - 失败函数传入的参数
+ * @param {{}} [that = APG.DeveloperModel] - 回调上下文
+ */
+APG.Update.listenKey.characterMoveEvent = function(playerG, role, resolve, resolveContext, reject, rejectContext, that=APG.DeveloperModel) {
+    var secretKey = APG.currentClickKey;
+    APG.currentClickKey = '';
+    for (var k in APG.Keys.move) {
+        if (APG.Keys[APG.Keys.move[k]].justDown || k == secretKey) {
+            console.log(k+" is justDown.")
+            var playerGroup = playerG;
+            var player = APG.Character.getCharacterSprite(playerGroup);
+
+            /* 设置方向 */
+            player.direction.x = APG.UDLRDir[k].x;
+            player.direction.y = APG.UDLRDir[k].y;
+
+            var nowSite = APG.Character.getCharacterSite(player);
+
+            /* 预设新的相对坐标 */
+            var newX = nowSite.x + player.direction.x;
+            var newY = nowSite.y + player.direction.y;
+            let newSite = {x:newX, y:newY};
+            {
+                //  ====== 检测玩家是否可走 =====
+                var canMove = true;
+                /* 地图超出 */
+                if (APG.Update.collideWorldBounds) {
+                    if (newX < 0 || newY < 0 || newX >= APG.MapArea.rows || newY >= APG.MapArea.columns) {
+                        canMove = false;
+                    }
+                }
+                /* 检测组碰撞 */
+                APG.Update.collision.block.playerGroupList.forEach(
+                    function (object) {
+                        if (object.group) {
+                            object.group.forEach(function (sprite) {
+                                let site = APG.Sprite.getSpriteSite(sprite);
+                                if (site.x == newSite.x && site.y == newSite.y) {
+                                    canMove = false;
+                                    if (object.feedback) {
+                                        object.feedback.apply(that, [playerGroup, sprite]);
+                                    }
+                                }
+                            })
+                        }
+                    });
+
+                /* 检测砖块碰撞 */
+                APG.Update.collision.block.playerTileList.forEach(
+                    function (object) {
+                        var tile = APG.Tile.getTileFromSite(newX, newY);
+                        if ((tile && tile.index == object.tileIndex) ||
+                            (!tile && object.tileIndex == 0)) {
+                            canMove = false;
+                            if (object.feedback) {
+                                object.feedback.apply(that, [playerGroup, sprite]);
+                            }
+                        }
+                    });
+
+                /* 调用用户自定义规则,根据返回值判断能否走,
+                 * 可以覆盖以上规则 (?合适不)
+                 * 如果没有返回值, 则canMove不变
+                 */
+                if (role) {
+                    var flag = role.apply(that,[newX, newY]);
+                    canMove = flag == undefined ? canMove : flag;
+                }
+
+                /* 无论能不能走, 都变化方向动画 */
+                if(playerGroup.Assets && playerGroup.Assets.move[k]){
+                    APG.Assets.setAnimations(playerGroup, k,playerGroup.Assets.move[k], 1);
+                }
+                if (canMove) {
+                    console.log('player move from ' + nowSite.x + ", " + nowSite.y + " to " + newX + ", " + newY);
+                    APG.Character.setCharacterSite(playerGroup, newX, newY);
+                    if (resolve) {
+                        resolve.apply(that, resolveContext);
+                    }
+                } else {
+                    console.log('player can\'t move.');
+                    if (reject) {
+                        reject.apply(that, rejectContext);
+                    }
+                }
+            }
+        }
+    }
+};
+
+
+/*APG.Update.collideWorldBounds = false;*/
+/**
+ * @class APG.Update.collision
+ */
+APG.Update.collision;
+
+/**
+ * 边界碰撞,默认不开,用于玩家移动检测。
+ * @method APG.Update.collision#setCollideWorldBounds
+ * @param {boolean} [f = false]
+ */
+APG.Update.collision.setCollideWorldBounds = function(f){
+    APG.Update.collideWorldBounds = f;
+};
+
+/*APG.Update.collision = {};*/
+/* 碰撞检测之禁止覆盖 */
+APG.Update.collision.block = {
+    GroupList: [],        /* 需要检测的团队列表 */
+    TileList: [],         /* 需要检测的瓷砖列表 */
+    playerGroupList: [],  /* 需要检测的团队列表(对于玩家) */
+    playerTileList: [],   /* 需要检测的瓷砖列表(对于玩家) */
+};
+
+/* 碰撞检测之覆盖后果 */
+APG.Update.collision.active = {
+    GroupList: [],        /* 需要检测的团队列表 */
+    TileList: [],         /* 需要检测的瓷砖列表 */
+    playerGroupList: [],  /* 需要检测的团队列表(对于玩家) */
+    playerTileList: [],   /* 需要检测的瓷砖列表(对于玩家) */
+};
+
+/**
+ * 设置组对象和瓷砖的阻挡碰撞
+ * @method APG.Update.collision#blockTileOverlap
+ * @param {Phaser.Group} group
+ * @param {integer} tileIndex - 瓷砖id
+ * @param {function} [feedback] - 碰撞后的触发函数
+ * @param {Array} context - 函数参数
+ * @param {{}} [that = APG.DeveloperModel] - 回调上下文
+ */
+APG.Update.collision.blockTileOverlap = function(group, tileIndex, feedback, context, that=APG.DeveloperModel){
+    if(group == APG.CharacterGroups.player){
+        APG.Update.collision.block.playerTileList.push({
+            tileIndex: tileIndex,
+            feedback: feedback,
+            context: context,
+            that: that,
+        });
+    }else{
+        APG.Update.collision.block.TileList.push({
+            group: group,
+            tileIndex: tileIndex,
+            feedback: feedback,
+            context: context,
+            that: that,
+        });
+    }
+};
+
+/**
+ * 设置组对象和组对象的阻挡碰撞
+ * @method APG.Update.collision#blockGroupOverlap
+ * @param {Phaser.Group} group1
+ * @param {Phaser.Group} group2
+ * @param {function} [feedback] - 碰撞后的触发函数
+ * @param {Array} context - 函数参数
+ * @param {{}} [that = APG.DeveloperModel] - 回调上下文
+ */
+APG.Update.collision.blockGroupOverlap = function(group1, group2, feedback, context, that=APG.DeveloperModel) {
+    if (group1 == APG.CharacterGroups.player) {
+        APG.Update.collision.block.playerGroupList.push({
+            group: group2,
+            feedback: feedback,
+            context: context,
+            that: that,
+        });
+    }else{
+        APG.Update.collision.block.GroupList.push({
+            group1: group1,
+            group2: group2,
+            feedback: feedback,
+            // isCollided: false,
+            context: context,
+            that: that,
+        });
+    }
+};
+
+/**
+ * 设置组对象和组对象的重叠检测
+ * @method APG.Update.collision#activeGroupOverlap
+ * @param {Phaser.Group} group1
+ * @param {Phaser.Group} group2
+ * @param {function} [feedback] - 碰撞后的触发函数
+ * @param {Array} context - 函数参数
+ * @param {{}} [that = APG.DeveloperModel] - 回调上下文
+ */
+APG.Update.collision.activeGroupOverlap = function(group1, group2, feedback, context, that=APG.DeveloperModel){
+    var obj = {
+        actor: "",
+        feedback: feedback,
+        // isCollided: false,
+        context: context,
+        that: that,
+    };
+    obj.group1 = group1;
+    obj.group2 = group2;
+    if (group1 == APG.CharacterGroups.player) {
+        obj.actor = "player";
+    }
+    APG.Update.collision.active.GroupList.push(obj);
+};
+
+/**
+ * 设置组对象和瓷砖对象的重叠检测
+ * @method APG.Update.collision#activeTileOverlap
+ * @param {Phaser.Group} group
+ * @param {integer} tileIndex - 瓷砖id
+ * @param {function} [feedback] - 碰撞后的触发函数
+ * @param {Array} context - 函数参数
+ * @param {{}} [that = APG.DeveloperModel] - 回调上下文 * @param group
+ */
+APG.Update.collision.activeTileOverlap = function(group, tileIndex, feedback, context, that=APG.DeveloperModel){
+    if(group == APG.CharacterGroups.player){
+        APG.Update.collision.active.TileList.push({
+            tileIndex: tileIndex,
+            feedback: feedback,
+            // isCollided: false,
+            context: context,
+            that: that,
+        });
+    }else{
+        APG.Update.collision.active.TileList.push({
+            group: group,
+            tileIndex: tileIndex,
+            feedback: feedback,
+            // isCollided: false,
+            context: context,
+            that: that,
+        });
+    }
+};
+
+// =========================
+// ========= 施工中 ==========
+
+/**
+ * 检测两个对象是否碰撞【未完成】
+ * @method APG.Update.collision#isCollided
+ * @param {Phaser.Group} group1
+ * @param {Phaser.Group} group2
+ */
+APG.Update.collision.isCollided = function(group1, group2){
+
+};
+
+
+
+
+ + + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ +
+
+ + + + + + + diff --git a/docs/api/classes.list.html b/docs/api/classes.list.html new file mode 100644 index 0000000..8df3ed8 --- /dev/null +++ b/docs/api/classes.list.html @@ -0,0 +1,251 @@ + + + + + + + + Algorithm PlayGround Classes + + + + + + + + + +
+
+ +
+ +
+ +

Classes

+
+ +
+ +

+ +

+ + +
+ + +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + +

Classes

+ +
+
Assets
+
+ +
Bag
+
+ +
Game
+
+ +
Group
+
+ +
Sprite
+
+ +
Target
+
+ +
listenKey
+
+ +
collision
+
+
+ + + + + + + + + + + + + +
+ +
+ + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ + + + +
+
+ + + + + + + \ No newline at end of file diff --git a/docs/api/index.html b/docs/api/index.html new file mode 100644 index 0000000..0b116f7 --- /dev/null +++ b/docs/api/index.html @@ -0,0 +1,178 @@ + + + + + + + + Algorithm PlayGround Index + + + + + + + + + +
+
+ +
+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+
+ + + + + + + + + + + +

+ Documentation generated by JSDoc 3.6.3 + + on 2019-11-Fr + + using Tomorrow. +

+ +
+ +
+ + + + +
+
+ + + + + + + \ No newline at end of file diff --git a/lib/jsdoc/jsdoc.sh b/lib/jsdoc/jsdoc.sh new file mode 100644 index 0000000..13bd6c9 --- /dev/null +++ b/lib/jsdoc/jsdoc.sh @@ -0,0 +1 @@ +node_modules/jsdoc/jsdoc.js -c ./config.json