yichael 4 years ago
commit
ace2b13673
100 changed files with 6910 additions and 0 deletions
  1. 2 0
      .gitattributes
  2. 54 0
      .gitignore
  3. 1 0
      README.md
  4. 12 0
      assets/Scene.meta
  5. 648 0
      assets/Scene/Ads.fire
  6. 7 0
      assets/Scene/Ads.fire.meta
  7. 434 0
      assets/Scene/MusicAlgorithm.fire
  8. 7 0
      assets/Scene/MusicAlgorithm.fire.meta
  9. 411 0
      assets/Scene/SandBagAlgorithm.fire
  10. 7 0
      assets/Scene/SandBagAlgorithm.fire.meta
  11. 411 0
      assets/Scene/SlitherIO.fire
  12. 7 0
      assets/Scene/SlitherIO.fire.meta
  13. 268 0
      assets/Scene/helloworld.fire
  14. 7 0
      assets/Scene/helloworld.fire.meta
  15. 12 0
      assets/Script.meta
  16. 379 0
      assets/Script/Menu.js
  17. 9 0
      assets/Script/Menu.js.meta
  18. 552 0
      assets/Script/MusicAlgorithm.js
  19. 9 0
      assets/Script/MusicAlgorithm.js.meta
  20. 379 0
      assets/Script/SandBagAlgorithmMain.js
  21. 9 0
      assets/Script/SandBagAlgorithmMain.js.meta
  22. 12 0
      assets/Script/Snake.meta
  23. 35 0
      assets/Script/Snake/RemoteSnake.js
  24. 9 0
      assets/Script/Snake/RemoteSnake.js.meta
  25. 78 0
      assets/Script/Snake/SkinSampleSnake.js
  26. 9 0
      assets/Script/Snake/SkinSampleSnake.js.meta
  27. 201 0
      assets/Script/Snake/Snake.js
  28. 9 0
      assets/Script/Snake/Snake.js.meta
  29. 12 0
      assets/Script/SnakeControl.meta
  30. 267 0
      assets/Script/SnakeControl/LocalControl.js
  31. 9 0
      assets/Script/SnakeControl/LocalControl.js.meta
  32. 63 0
      assets/Script/SnakeControl/RemoteControl.js
  33. 9 0
      assets/Script/SnakeControl/RemoteControl.js.meta
  34. 25 0
      assets/Script/SnakeControl/SkinSampleControl.js
  35. 9 0
      assets/Script/SnakeControl/SkinSampleControl.js.meta
  36. 12 0
      assets/Script/SnakeInput.meta
  37. 48 0
      assets/Script/SnakeInput/SnakeAIInput.js
  38. 9 0
      assets/Script/SnakeInput/SnakeAIInput.js.meta
  39. 50 0
      assets/Script/SnakeInput/SnakeAccelerometerInput.js
  40. 9 0
      assets/Script/SnakeInput/SnakeAccelerometerInput.js.meta
  41. 12 0
      assets/Script/SnakeInput/SnakeInputBasic.meta
  42. 36 0
      assets/Script/SnakeInput/SnakeInputBasic/SnakeDirectionInput.js
  43. 9 0
      assets/Script/SnakeInput/SnakeInputBasic/SnakeDirectionInput.js.meta
  44. 26 0
      assets/Script/SnakeInput/SnakeInputBasic/SnakePositionInput.js
  45. 9 0
      assets/Script/SnakeInput/SnakeInputBasic/SnakePositionInput.js.meta
  46. 20 0
      assets/Script/SnakeInput/SnakeInputBasic/SnakeSteeringControl.js
  47. 9 0
      assets/Script/SnakeInput/SnakeInputBasic/SnakeSteeringControl.js.meta
  48. 112 0
      assets/Script/SnakeInput/SnakeJoystickInput.js
  49. 9 0
      assets/Script/SnakeInput/SnakeJoystickInput.js.meta
  50. 66 0
      assets/Script/SnakeInput/SnakeKeyboardArrowkeyInput.js
  51. 9 0
      assets/Script/SnakeInput/SnakeKeyboardArrowkeyInput.js.meta
  52. 57 0
      assets/Script/SnakeInput/SnakeKeyboardSteeringInput.js
  53. 9 0
      assets/Script/SnakeInput/SnakeKeyboardSteeringInput.js.meta
  54. 40 0
      assets/Script/SnakeInput/SnakeMouseInput.js
  55. 9 0
      assets/Script/SnakeInput/SnakeMouseInput.js.meta
  56. 63 0
      assets/Script/SnakeInput/SnakeTouchInput.js
  57. 9 0
      assets/Script/SnakeInput/SnakeTouchInput.js.meta
  58. 12 0
      assets/Script/o0Lib.meta
  59. 457 0
      assets/Script/o0Lib/o0.js
  60. 9 0
      assets/Script/o0Lib/o0.js.meta
  61. 121 0
      assets/Script/o0Lib/o0CC.js
  62. 9 0
      assets/Script/o0Lib/o0CC.js.meta
  63. 74 0
      assets/Script/o0Lib/o0CCButton.js
  64. 9 0
      assets/Script/o0Lib/o0CCButton.js.meta
  65. 71 0
      assets/Script/o0Lib/o0CCButtonNoImage.js
  66. 9 0
      assets/Script/o0Lib/o0CCButtonNoImage.js.meta
  67. 93 0
      assets/Script/o0Lib/o0CCEditBox.js
  68. 9 0
      assets/Script/o0Lib/o0CCEditBox.js.meta
  69. 24 0
      assets/Script/o0Lib/o0CCLabel.js
  70. 9 0
      assets/Script/o0Lib/o0CCLabel.js.meta
  71. 245 0
      assets/Script/o0Lib/o0Game.js
  72. 9 0
      assets/Script/o0Lib/o0Game.js.meta
  73. 357 0
      assets/Script/o0Lib/o0Project.js
  74. 9 0
      assets/Script/o0Lib/o0Project.js.meta
  75. 12 0
      assets/Texture.meta
  76. BIN
      assets/Texture/singleColor.png
  77. 36 0
      assets/Texture/singleColor.png.meta
  78. BIN
      assets/background.psd
  79. 5 0
      assets/background.psd.meta
  80. BIN
      assets/background1.psd
  81. 5 0
      assets/background1.psd.meta
  82. BIN
      assets/food64-64.psd
  83. 5 0
      assets/food64-64.psd.meta
  84. 12 0
      assets/migration.meta
  85. 13 0
      assets/migration/use_reversed_rotateBy.js
  86. 9 0
      assets/migration/use_reversed_rotateBy.js.meta
  87. 13 0
      assets/migration/use_reversed_rotateTo.js
  88. 9 0
      assets/migration/use_reversed_rotateTo.js.meta
  89. 17 0
      assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js
  90. 9 0
      assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js.meta
  91. 12 0
      assets/resources.meta
  92. BIN
      assets/resources/Ads.jpg
  93. 36 0
      assets/resources/Ads.jpg.meta
  94. BIN
      assets/resources/Icon.png
  95. 36 0
      assets/resources/Icon.png.meta
  96. BIN
      assets/resources/ads03.png
  97. 36 0
      assets/resources/ads03.png.meta
  98. 110 0
      assets/resources/atom.plist
  99. 5 0
      assets/resources/atom.plist.meta
  100. BIN
      assets/resources/background.png

+ 2 - 0
.gitattributes

@@ -0,0 +1,2 @@
+# Auto detect text files and perform LF normalization
+* text=auto

+ 54 - 0
.gitignore

@@ -0,0 +1,54 @@
+#/
+# Fireball Projects
+#/
+
+/library/
+/temp/
+local/*
+!local/local.json
+/build/
+
+#/
+# npm files
+#/
+
+npm-debug.log
+node_modules/
+
+#/
+# Logs and databases
+#/
+
+*.log
+*.sql
+*.sqlite
+
+#/
+# files for debugger
+#/
+
+*.sln
+*.csproj
+*.pidb
+*.unityproj
+*.suo
+
+#/
+# OS generated files
+#/
+
+.DS_Store
+ehthumbs.db
+Thumbs.db
+
+#/
+# WebStorm files
+#/
+
+.idea/
+
+#//
+# VS Code files
+#//
+
+.vscode/

+ 1 - 0
README.md

@@ -0,0 +1 @@
+cocoscreator v2.0.3

+ 12 - 0
assets/Scene.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "e004a108-2f3b-4d7d-8d03-8780583532c3",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 648 - 0
assets/Scene/Ads.fire

@@ -0,0 +1,648 @@
+[
+  {
+    "__type__": "cc.SceneAsset",
+    "_name": "",
+    "_objFlags": 0,
+    "_native": "",
+    "scene": {
+      "__id__": 1
+    }
+  },
+  {
+    "__type__": "cc.Scene",
+    "_objFlags": 0,
+    "_parent": null,
+    "_children": [
+      {
+        "__id__": 2
+      },
+      {
+        "__id__": 13
+      },
+      {
+        "__id__": 9
+      }
+    ],
+    "_active": true,
+    "_level": 0,
+    "_components": [],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "autoReleaseAssets": true,
+    "_id": "742d9920-3a00-4f1e-a86a-1ce206e682e7",
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        0.58125,
+        0.58125,
+        1
+      ]
+    }
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Canvas",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [
+      {
+        "__id__": 3
+      }
+    ],
+    "_active": true,
+    "_level": 1,
+    "_components": [
+      {
+        "__id__": 5
+      },
+      {
+        "__id__": 6
+      },
+      {
+        "__id__": 15
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 960,
+      "height": 640
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "_id": "69Zt+P3uNNMqssTr1ZmnSv",
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        480,
+        320,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    }
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Main Camera",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [],
+    "_active": true,
+    "_level": 2,
+    "_components": [
+      {
+        "__id__": 4
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "_id": "df4ytUD2FCMZKdsSb/vGqS",
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    }
+  },
+  {
+    "__type__": "cc.Camera",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 3
+    },
+    "_enabled": true,
+    "_cullingMask": 4294967295,
+    "_clearFlags": 7,
+    "_backgroundColor": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_depth": -1,
+    "_zoomRatio": 1,
+    "_targetTexture": null,
+    "_id": "e9iQCtGupGS67Vl2uclRzm"
+  },
+  {
+    "__type__": "cc.Canvas",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "_designResolution": {
+      "__type__": "cc.Size",
+      "width": 960,
+      "height": 640
+    },
+    "_fitWidth": false,
+    "_fitHeight": true,
+    "_id": "bfYqYW2YZLko3B0XbXBZCy"
+  },
+  {
+    "__type__": "e21eaoSCVRKFI0ZqS4AKAJm",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "TXT": {
+      "__id__": 7
+    },
+    "Btn": {
+      "__id__": 9
+    },
+    "_id": "9aHB5r2jhEqbM8GTERTHwT"
+  },
+  {
+    "__type__": "cc.Label",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 8
+    },
+    "_enabled": true,
+    "_srcBlendFactor": 1,
+    "_dstBlendFactor": 771,
+    "_useOriginalSize": false,
+    "_string": "Close",
+    "_N$string": "Close",
+    "_fontSize": 20,
+    "_lineHeight": 40,
+    "_enableWrapText": false,
+    "_N$file": null,
+    "_isSystemFontUsed": true,
+    "_spacingX": 0,
+    "_N$horizontalAlign": 1,
+    "_N$verticalAlign": 1,
+    "_N$fontFamily": "Arial",
+    "_N$overflow": 1,
+    "_id": "ac2g/bwehBOptheM25naQE"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Click",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 9
+    },
+    "_children": [],
+    "_active": true,
+    "_level": 0,
+    "_components": [
+      {
+        "__id__": 7
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 100,
+      "height": 40
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "_id": "ddnTYNuoZIL7wKD+XPw+57",
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        -1,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    }
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "New Button",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [
+      {
+        "__id__": 8
+      }
+    ],
+    "_active": true,
+    "_level": 1,
+    "_components": [
+      {
+        "__id__": 10
+      },
+      {
+        "__id__": 11
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 100,
+      "height": 40
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "_id": "b5BUr/fmRGW7sZYeigcXto",
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        841,
+        57,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    }
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 9
+    },
+    "_enabled": true,
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_spriteFrame": {
+      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
+    },
+    "_type": 1,
+    "_sizeMode": 0,
+    "_fillType": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_state": 0,
+    "_atlas": null,
+    "_id": "5dleqKG4xHEbHoz/WwXs46"
+  },
+  {
+    "__type__": "cc.Button",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 9
+    },
+    "_enabled": true,
+    "transition": 2,
+    "pressedColor": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "hoverColor": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "duration": 0.1,
+    "zoomScale": 1.2,
+    "clickEvents": [
+      {
+        "__id__": 12
+      }
+    ],
+    "_N$interactable": true,
+    "_N$enableAutoGrayEffect": false,
+    "_N$normalColor": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_N$disabledColor": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_N$normalSprite": {
+      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
+    },
+    "_N$pressedSprite": {
+      "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
+    },
+    "pressedSprite": {
+      "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
+    },
+    "_N$hoverSprite": {
+      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
+    },
+    "hoverSprite": {
+      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
+    },
+    "_N$disabledSprite": {
+      "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
+    },
+    "_N$target": {
+      "__id__": 9
+    },
+    "_id": "8dgMzuVNJLEbnR4mv9Fg9p"
+  },
+  {
+    "__type__": "cc.ClickEvent",
+    "target": {
+      "__id__": 2
+    },
+    "component": "anyADs",
+    "handler": "btnClick",
+    "customEventData": ""
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "ads03",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_level": 1,
+    "_components": [
+      {
+        "__id__": 14
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 963,
+      "height": 647
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "_id": "59KOes4g5IkKOa8ZebusVG",
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        484,
+        308,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    }
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 13
+    },
+    "_enabled": true,
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_spriteFrame": {
+      "__uuid__": "7cf79631-c346-4539-9e21-7ff3665d4699"
+    },
+    "_type": 0,
+    "_sizeMode": 0,
+    "_fillType": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_state": 0,
+    "_atlas": null,
+    "_id": "5eJVt5bGxLuYkfo6yo1GyA"
+  },
+  {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "alignMode": 1,
+    "_target": null,
+    "_alignFlags": 45,
+    "_left": 0,
+    "_right": 0,
+    "_top": 0,
+    "_bottom": 0,
+    "_verticalCenter": 0,
+    "_horizontalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 0,
+    "_originalHeight": 0
+  }
+]

+ 7 - 0
assets/Scene/Ads.fire.meta

@@ -0,0 +1,7 @@
+{
+  "ver": "1.2.9",
+  "uuid": "742d9920-3a00-4f1e-a86a-1ce206e682e7",
+  "asyncLoadAssets": false,
+  "autoReleaseAssets": true,
+  "subMetas": {}
+}

+ 434 - 0
assets/Scene/MusicAlgorithm.fire

@@ -0,0 +1,434 @@
+[
+  {
+    "__type__": "cc.SceneAsset",
+    "_name": "",
+    "_objFlags": 0,
+    "_native": "",
+    "scene": {
+      "__id__": 1
+    }
+  },
+  {
+    "__type__": "cc.Scene",
+    "_objFlags": 0,
+    "_parent": null,
+    "_children": [
+      {
+        "__id__": 2
+      }
+    ],
+    "_active": true,
+    "_components": [],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_zIndex": 0,
+    "_is3DNode": true,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "autoReleaseAssets": false,
+    "_id": "2fff6cdc-b0d7-4941-a106-fd20ce1fca11"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Canvas",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [
+      {
+        "__id__": 3
+      },
+      {
+        "__id__": 5
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 7
+      },
+      {
+        "__id__": 8
+      },
+      {
+        "__id__": 9
+      },
+      {
+        "__id__": 10
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 3400,
+      "height": 1250
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        1700,
+        625,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "a5jO4w1exJsqv6F9tNul3I"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Main Camera",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 4
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        516.1511406555254,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "ebZfqNyAtHUap1n3iXxcuk"
+  },
+  {
+    "__type__": "cc.Camera",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 3
+    },
+    "_enabled": true,
+    "_cullingMask": -33,
+    "_clearFlags": 7,
+    "_backgroundColor": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_depth": 0,
+    "_zoomRatio": 1,
+    "_targetTexture": null,
+    "_fov": 60,
+    "_orthoSize": 10,
+    "_nearClip": 1,
+    "_farClip": 4096,
+    "_ortho": true,
+    "_rect": {
+      "__type__": "cc.Rect",
+      "x": 0,
+      "y": 0,
+      "width": 1,
+      "height": 1
+    },
+    "_renderStages": 1,
+    "_alignWithScreen": true,
+    "_id": "02GIRocxpA94kvUeaVjEng"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Main Camera",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 6
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        516.1511406555254,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "b1e3gSTlNCo4M4MC0XooMx"
+  },
+  {
+    "__type__": "cc.Camera",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 5
+    },
+    "_enabled": true,
+    "_cullingMask": -32,
+    "_clearFlags": 0,
+    "_backgroundColor": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_depth": 1,
+    "_zoomRatio": 1,
+    "_targetTexture": null,
+    "_fov": 60,
+    "_orthoSize": 10,
+    "_nearClip": 1,
+    "_farClip": 4096,
+    "_ortho": true,
+    "_rect": {
+      "__type__": "cc.Rect",
+      "x": 0,
+      "y": 0,
+      "width": 1,
+      "height": 1
+    },
+    "_renderStages": 1,
+    "_alignWithScreen": true,
+    "_id": "fdmowMtedHB7wkweWoKcxb"
+  },
+  {
+    "__type__": "cc.Canvas",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "_designResolution": {
+      "__type__": "cc.Size",
+      "width": 3400,
+      "height": 1250
+    },
+    "_fitWidth": false,
+    "_fitHeight": true,
+    "_id": "30op/O13JHIYbrJItyV4oX"
+  },
+  {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "alignMode": 1,
+    "_target": null,
+    "_alignFlags": 45,
+    "_left": 0,
+    "_right": 0,
+    "_top": 0,
+    "_bottom": 0,
+    "_verticalCenter": 0,
+    "_horizontalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 0,
+    "_originalHeight": 0,
+    "_id": "cbF1WpprNMEr/4nxMlVCdM"
+  },
+  {
+    "__type__": "cc.AudioSource",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "_clip": {
+      "__uuid__": "d3235e7b-e705-458b-8c2d-f4a0d7bec7f5"
+    },
+    "_volume": 1,
+    "_mute": false,
+    "_loop": true,
+    "_firstlyEnabled": true,
+    "playOnLoad": false,
+    "preload": true,
+    "_id": "0aS3oyJj5NdJdGq5wKcY/t"
+  },
+  {
+    "__type__": "67f24Gn565PgojLX2L6mHVD",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "canvas": {
+      "__id__": 7
+    },
+    "camera": {
+      "__id__": 4
+    },
+    "UICamera": {
+      "__id__": 6
+    },
+    "gameScene": null,
+    "menuNode": null,
+    "DeviceMs": 1,
+    "map": null,
+    "mapHit": null,
+    "mapRadius": 200,
+    "chart": null,
+    "TestButton": [],
+    "Filter": null,
+    "LastTime": 1608648856863,
+    "audioSource": null,
+    "_id": "76474fvcRDfatRWmQGKeqF"
+  }
+]

+ 7 - 0
assets/Scene/MusicAlgorithm.fire.meta

@@ -0,0 +1,7 @@
+{
+  "ver": "1.2.9",
+  "uuid": "2fff6cdc-b0d7-4941-a106-fd20ce1fca11",
+  "asyncLoadAssets": false,
+  "autoReleaseAssets": false,
+  "subMetas": {}
+}

+ 411 - 0
assets/Scene/SandBagAlgorithm.fire

@@ -0,0 +1,411 @@
+[
+  {
+    "__type__": "cc.SceneAsset",
+    "_name": "",
+    "_objFlags": 0,
+    "_native": "",
+    "scene": {
+      "__id__": 1
+    }
+  },
+  {
+    "__type__": "cc.Scene",
+    "_objFlags": 0,
+    "_parent": null,
+    "_children": [
+      {
+        "__id__": 2
+      }
+    ],
+    "_active": true,
+    "_components": [],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_zIndex": 0,
+    "_is3DNode": true,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "autoReleaseAssets": false,
+    "_id": "63860256-1ed3-43a9-8f5f-9c810abeb976"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Canvas",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [
+      {
+        "__id__": 3
+      },
+      {
+        "__id__": 5
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 7
+      },
+      {
+        "__id__": 8
+      },
+      {
+        "__id__": 9
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 960,
+      "height": 640
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        480,
+        320,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "a5jO4w1exJsqv6F9tNul3I"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Main Camera",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 4
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        515.285115251741,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "ebZfqNyAtHUap1n3iXxcuk"
+  },
+  {
+    "__type__": "cc.Camera",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 3
+    },
+    "_enabled": true,
+    "_cullingMask": -33,
+    "_clearFlags": 7,
+    "_backgroundColor": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_depth": 0,
+    "_zoomRatio": 1,
+    "_targetTexture": null,
+    "_fov": 60,
+    "_orthoSize": 10,
+    "_nearClip": 1,
+    "_farClip": 4096,
+    "_ortho": true,
+    "_rect": {
+      "__type__": "cc.Rect",
+      "x": 0,
+      "y": 0,
+      "width": 1,
+      "height": 1
+    },
+    "_renderStages": 1,
+    "_alignWithScreen": true,
+    "_id": "02GIRocxpA94kvUeaVjEng"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Main Camera",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 6
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        515.285115251741,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "b1e3gSTlNCo4M4MC0XooMx"
+  },
+  {
+    "__type__": "cc.Camera",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 5
+    },
+    "_enabled": true,
+    "_cullingMask": -32,
+    "_clearFlags": 0,
+    "_backgroundColor": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_depth": 1,
+    "_zoomRatio": 1,
+    "_targetTexture": null,
+    "_fov": 60,
+    "_orthoSize": 10,
+    "_nearClip": 1,
+    "_farClip": 4096,
+    "_ortho": true,
+    "_rect": {
+      "__type__": "cc.Rect",
+      "x": 0,
+      "y": 0,
+      "width": 1,
+      "height": 1
+    },
+    "_renderStages": 1,
+    "_alignWithScreen": true,
+    "_id": "fdmowMtedHB7wkweWoKcxb"
+  },
+  {
+    "__type__": "cc.Canvas",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "_designResolution": {
+      "__type__": "cc.Size",
+      "width": 960,
+      "height": 640
+    },
+    "_fitWidth": false,
+    "_fitHeight": true,
+    "_id": "30op/O13JHIYbrJItyV4oX"
+  },
+  {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "alignMode": 1,
+    "_target": null,
+    "_alignFlags": 45,
+    "_left": 0,
+    "_right": 0,
+    "_top": 0,
+    "_bottom": 0,
+    "_verticalCenter": 0,
+    "_horizontalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 0,
+    "_originalHeight": 0,
+    "_id": "cbF1WpprNMEr/4nxMlVCdM"
+  },
+  {
+    "__type__": "9a9e8G/Pi1HT4eNPMrq7j7m",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "canvas": {
+      "__id__": 7
+    },
+    "camera": {
+      "__id__": 4
+    },
+    "UICamera": {
+      "__id__": 6
+    },
+    "gameScene": null,
+    "menuNode": null,
+    "DeviceMs": 1,
+    "map": null,
+    "mapHit": null,
+    "mapRadius": 150,
+    "chart": null,
+    "TestButton": [],
+    "Filter": null,
+    "LastTime": 1608648621042,
+    "_id": "3ds2iwNslK4ZbPqGqtf3D8"
+  }
+]

+ 7 - 0
assets/Scene/SandBagAlgorithm.fire.meta

@@ -0,0 +1,7 @@
+{
+  "ver": "1.2.9",
+  "uuid": "63860256-1ed3-43a9-8f5f-9c810abeb976",
+  "asyncLoadAssets": false,
+  "autoReleaseAssets": false,
+  "subMetas": {}
+}

+ 411 - 0
assets/Scene/SlitherIO.fire

@@ -0,0 +1,411 @@
+[
+  {
+    "__type__": "cc.SceneAsset",
+    "_name": "",
+    "_objFlags": 0,
+    "_native": "",
+    "scene": {
+      "__id__": 1
+    }
+  },
+  {
+    "__type__": "cc.Scene",
+    "_objFlags": 0,
+    "_parent": null,
+    "_children": [
+      {
+        "__id__": 2
+      }
+    ],
+    "_active": true,
+    "_components": [],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_zIndex": 0,
+    "_is3DNode": true,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "autoReleaseAssets": true,
+    "_id": "972377f1-77c5-4802-b114-30b6df27a1c5"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Canvas",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [
+      {
+        "__id__": 3
+      },
+      {
+        "__id__": 5
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 7
+      },
+      {
+        "__id__": 8
+      },
+      {
+        "__id__": 9
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 960,
+      "height": 640
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        480,
+        320,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "a5jO4w1exJsqv6F9tNul3I"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Main Camera",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 4
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        516.1511406555254,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "ebZfqNyAtHUap1n3iXxcuk"
+  },
+  {
+    "__type__": "cc.Camera",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 3
+    },
+    "_enabled": true,
+    "_cullingMask": -33,
+    "_clearFlags": 7,
+    "_backgroundColor": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_depth": 0,
+    "_zoomRatio": 1,
+    "_targetTexture": null,
+    "_fov": 60,
+    "_orthoSize": 10,
+    "_nearClip": 1,
+    "_farClip": 4096,
+    "_ortho": true,
+    "_rect": {
+      "__type__": "cc.Rect",
+      "x": 0,
+      "y": 0,
+      "width": 1,
+      "height": 1
+    },
+    "_renderStages": 1,
+    "_alignWithScreen": true,
+    "_id": "02GIRocxpA94kvUeaVjEng"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Main Camera",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 6
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        516.1511406555254,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "b1e3gSTlNCo4M4MC0XooMx"
+  },
+  {
+    "__type__": "cc.Camera",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 5
+    },
+    "_enabled": true,
+    "_cullingMask": -32,
+    "_clearFlags": 0,
+    "_backgroundColor": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_depth": 1,
+    "_zoomRatio": 1,
+    "_targetTexture": null,
+    "_fov": 60,
+    "_orthoSize": 10,
+    "_nearClip": 1,
+    "_farClip": 4096,
+    "_ortho": true,
+    "_rect": {
+      "__type__": "cc.Rect",
+      "x": 0,
+      "y": 0,
+      "width": 1,
+      "height": 1
+    },
+    "_renderStages": 1,
+    "_alignWithScreen": true,
+    "_id": "fdmowMtedHB7wkweWoKcxb"
+  },
+  {
+    "__type__": "cc.Canvas",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "_designResolution": {
+      "__type__": "cc.Size",
+      "width": 960,
+      "height": 640
+    },
+    "_fitWidth": false,
+    "_fitHeight": true,
+    "_id": "30op/O13JHIYbrJItyV4oX"
+  },
+  {
+    "__type__": "9ca35CIzUhIx4zqA23EHC93",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "canvas": {
+      "__id__": 7
+    },
+    "camera": {
+      "__id__": 4
+    },
+    "UICamera": {
+      "__id__": 6
+    },
+    "gameScene": null,
+    "menuNode": null,
+    "DeviceMs": 0,
+    "map": null,
+    "mapHit": null,
+    "mapRadius": 150,
+    "chart": null,
+    "TestButton": [],
+    "Filter": null,
+    "LastTime": 1604466572437,
+    "_id": "9f9jiG0OFDF6oz9xeRcxy3"
+  },
+  {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "alignMode": 1,
+    "_target": null,
+    "_alignFlags": 45,
+    "_left": 0,
+    "_right": 0,
+    "_top": 0,
+    "_bottom": 0,
+    "_verticalCenter": 0,
+    "_horizontalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 0,
+    "_originalHeight": 0,
+    "_id": "cbF1WpprNMEr/4nxMlVCdM"
+  }
+]

+ 7 - 0
assets/Scene/SlitherIO.fire.meta

@@ -0,0 +1,7 @@
+{
+  "ver": "1.2.9",
+  "uuid": "972377f1-77c5-4802-b114-30b6df27a1c5",
+  "asyncLoadAssets": false,
+  "autoReleaseAssets": true,
+  "subMetas": {}
+}

+ 268 - 0
assets/Scene/helloworld.fire

@@ -0,0 +1,268 @@
+[
+  {
+    "__type__": "cc.SceneAsset",
+    "_name": "",
+    "_objFlags": 0,
+    "_native": "",
+    "scene": {
+      "__id__": 1
+    }
+  },
+  {
+    "__type__": "cc.Scene",
+    "_objFlags": 0,
+    "_parent": null,
+    "_children": [
+      {
+        "__id__": 2
+      }
+    ],
+    "_active": true,
+    "_level": 0,
+    "_components": [],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "autoReleaseAssets": true,
+    "_id": "a8e004bb-3c3e-4e02-9daf-5f0102acfae2",
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        0.853125,
+        0.853125,
+        1
+      ]
+    }
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Canvas",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [
+      {
+        "__id__": 3
+      }
+    ],
+    "_active": true,
+    "_level": 1,
+    "_components": [
+      {
+        "__id__": 5
+      },
+      {
+        "__id__": 6
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 960,
+      "height": 640
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "_id": "7a0SeUfgxHZptrszK5IO5f",
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        480,
+        320,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    }
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Main Camera",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [],
+    "_active": true,
+    "_level": 2,
+    "_components": [
+      {
+        "__id__": 4
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 0,
+      "height": 0
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_quat": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_zIndex": 0,
+    "groupIndex": 0,
+    "_id": "29DqczmhBIxICnDYnys5IG",
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    }
+  },
+  {
+    "__type__": "cc.Camera",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 3
+    },
+    "_enabled": true,
+    "_cullingMask": 4294967295,
+    "_clearFlags": 7,
+    "_backgroundColor": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_depth": -1,
+    "_zoomRatio": 1,
+    "_targetTexture": null,
+    "_id": "1cK65WCklJOaPSNKVn250x"
+  },
+  {
+    "__type__": "cc.Canvas",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "_designResolution": {
+      "__type__": "cc.Size",
+      "width": 960,
+      "height": 640
+    },
+    "_fitWidth": false,
+    "_fitHeight": true,
+    "_id": "a7DWwVIiVE4aYFTK5meTJT"
+  },
+  {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "alignMode": 1,
+    "_target": null,
+    "_alignFlags": 45,
+    "_left": 0,
+    "_right": 0,
+    "_top": 0,
+    "_bottom": 0,
+    "_verticalCenter": 0,
+    "_horizontalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 0,
+    "_originalHeight": 0
+  }
+]

+ 7 - 0
assets/Scene/helloworld.fire.meta

@@ -0,0 +1,7 @@
+{
+  "ver": "1.2.9",
+  "uuid": "a8e004bb-3c3e-4e02-9daf-5f0102acfae2",
+  "asyncLoadAssets": false,
+  "autoReleaseAssets": true,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "f8e0fb8b-613c-40e2-a957-43fe7a41888f",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 379 - 0
assets/Script/Menu.js

@@ -0,0 +1,379 @@
+
+var o0 = require('o0');
+var o0Project = require('o0Project');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+cc.Class({
+    extends: cc.Component,
+
+    properties: {
+        canvas: {
+            default: null,
+            type: cc.Canvas
+        },
+        camera: {
+            default: null,
+            type: cc.Camera
+        },
+        UICamera: {
+            default: null,
+            type: cc.Camera
+        },
+        gameScene:null,
+
+        menuNode:null,
+        
+        DeviceMs:1,
+
+        map:null,
+        mapHit:null,
+        mapRadius: 200,
+        chart:null,
+
+        TestButton:[],
+        Filter:null,
+        LastTime:new Date().getTime(),
+    },
+
+    // use this for initialization
+    onLoad: function () {
+        //cc.director.setAnimationInterval(1.0/30);
+        //cc.game.setFrameRate(30);//模拟器不能正常显示
+
+        var self = this;
+        //cc.director.getPhysicsManager().enabled = true;
+
+        //this.cocos.node.x;
+        //node.parent = this.canvas.node;
+        //this.label.node.parent = node;
+        //this.label.node.x = 0;
+        //this.label.node.y = 0;
+        //this.label.string = this.text;
+
+        //var Snake = require("Snake");
+        //cc.log("oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo "+Snake);
+
+        /*var snake = new cc.Node('snake');
+        snake.parent = this.camera.node;
+        snake.addComponent('Snake');/** */
+
+        //newSnake(this.camera.node);
+
+        this.menuNode = new cc.Node();
+        this.node.addChild(this.menuNode,1);
+        
+        this.map = o0CC.addScriptNode(this.node,'cc.Graphics',10);
+        this.mapHit = o0CC.addScriptNode(this.node,'cc.Graphics',10);
+        this.chart = o0CC.addScriptNode(this.node,'cc.Graphics',10);
+
+        var col = 1;
+        for(var i = 0;i<col;++i){
+            this.TestButton.push([]);
+            for(var j = 0;j<2;++j){
+                var testButton = o0CC.addScriptNode(this.menuNode,'o0CCButton',11);
+                o0CC.setGroup(testButton,o0Game.GroupIndex.UI);
+                testButton.node.x = (i-(col-1)/2)*this.canvas.node.width/col;
+                testButton.node.y = this.canvas.node.height/2 - 20 - j * 40;
+                testButton.node.width = this.canvas.node.width/col;
+                testButton.node.height = 40;/** */
+                testButton.name = "null";
+                this.TestButton[i].push(testButton);
+            }
+        }
+
+        
+
+        /*
+        this.gameScene = o0CC.addScriptNode(this.node,'GameScene',0);
+        this.gameScene.canvas = this.canvas;
+        this.gameScene.camera = this.camera;/** */
+        this.backgroundGraphic = this.menuNode.addComponent(cc.Graphics,0);
+        o0CC.setGroup(this.backgroundGraphic,o0Game.GroupIndex.UI);
+
+        cc.director.getScheduler().setTimeScale(50);
+
+        this.Filter = new o0Project.Filter();
+
+        cc.systemEvent.setAccelerometerEnabled(true);
+        cc.systemEvent.on(cc.SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
+        if(typeof(uni) != "undefined" && typeof(window) != "undefined" ){
+            uni.postMessage({
+                data: {
+                    funName: "addDeviceUpdateListener",
+                    gameData: {}
+        
+                }
+            });
+            var printed = false;
+            window.onWebViewMessage = function(data){
+                let name= data.funName;
+                if(name == "onDeviceUpdateData")
+                {
+                    if(printed == false){
+                        console.log(data.gameData);
+                        printed = true;
+                    }
+                    //webView.onDeviceUpdateData(data.gameData);
+                    let {min, s, ms} = data.gameData.data;
+                    var msGap = ms - self.DeviceMs;
+                    self.DeviceMs = ms;
+                    while(msGap < 0){
+                        msGap+=1000;
+                    }
+                    //console.log(data);
+                    let {ax,ay,az} = data.gameData.data.acc;
+                    let {gx,gy,gz} = data.gameData.data.gyro;
+                    self.Filter.Update(new o0.Vector3(ax,ay,az),msGap,new o0.Vector3(gx,gy,gz));//我自己的更新acc的函数
+                    cc.systemEvent.setAccelerometerEnabled(false);
+                }
+            };
+            uni.postMessage({
+                data: {
+                    funName: "writeBLEConnectionValue",
+                    gameData: {
+                        value: "3" //开启设备数据
+                    }
+                }
+            });
+            uni.postMessage({
+                data: {
+                    funName: "writeBLEConnectionValue",
+                    gameData: {
+                        value: "b" //60ms
+                    }
+                }
+            })
+        }
+        console.log("init finished");
+    },
+
+    onDeviceMotionEvent (event) {
+        let newTime = new Date().getTime();
+
+        var [acc,forceChanged,momentum] = this.Filter.Update(new o0.Vector3(event.acc),newTime - this.LastTime,new o0.Vector3(0,0,0));
+
+        this.LastTime = newTime;
+    },
+    // called every frame
+    update: function (dt) {
+        this.chart.node.x = this.canvas.node.width/2 - 100;
+        this.chart.node.y = -this.canvas.node.height/2 + 50;
+
+        this.chart.clear();
+        for(var i = 0;i< this.Filter.frame.length;++i){
+            var io = this.Filter.frame[i];
+            
+
+            this.chart.strokeColor = new cc.Color(255,255,255,255);
+            this.chart.moveTo(-i, 0);
+            this.chart.lineTo(-i, io.hit);
+            this.chart.stroke();/* */
+            
+            this.chart.strokeColor = new cc.Color(255,255,255,50);
+            this.chart.moveTo(-i, 200);
+            this.chart.lineTo(-i, 300);
+            this.chart.stroke();/** */
+
+            this.chart.strokeColor = new cc.Color(255,0,0,255);
+            this.chart.moveTo(-i, 200);
+            this.chart.lineTo(-i, 200+io.reliable*100);
+            this.chart.stroke();/** */
+            
+            this.chart.strokeColor = new cc.Color(0,255,0,255);
+            this.chart.moveTo(-i, 300);
+            this.chart.lineTo(-i, 300+io.shakeFixed);
+            this.chart.stroke();/** */
+
+            this.chart.strokeColor = new cc.Color(255,255,255,255);
+            this.chart.moveTo(-i, 300);
+            this.chart.lineTo(-i, 300+io.shake);
+            this.chart.stroke();/* */
+
+            this.chart.strokeColor = new cc.Color(255,0,0,255);
+            this.chart.moveTo(-i, 300);
+            this.chart.lineTo(-i, 300+io.shakeSlope);
+            this.chart.stroke();/* */
+            
+            /*
+            this.chart.strokeColor = new cc.Color(255,0,0,255);
+            this.chart.moveTo(-i, 0);
+            this.chart.lineTo(-i, io.slope);
+            this.chart.stroke();/** */
+
+            this.chart.strokeColor = new cc.Color(0,255,0,255);
+            this.chart.moveTo(-i, 400);
+            this.chart.lineTo(-i, 400+io.accFixed);
+            this.chart.stroke();
+
+            this.chart.strokeColor = new cc.Color(255,255,255,255);
+            this.chart.moveTo(-i, 400);
+            this.chart.lineTo(-i, 400+io.acc.length*100);
+            this.chart.stroke();
+            
+            this.chart.strokeColor = new cc.Color(255,0,0,255);
+            this.chart.moveTo(-i, 380);
+            this.chart.lineTo(-i, 380+io.accSlope);
+            this.chart.stroke();
+
+            /*
+            if(io.hit!=0){
+                this.chart.strokeColor = new cc.Color(255,0,0,255);
+                this.chart.moveTo(-i, 0);
+                this.chart.lineTo(-i, io.hit);
+                this.chart.stroke();
+            }/** */
+        }
+        //console.log(this.Filter.frame[0].shake);
+
+
+
+        this.map.node.x = this.canvas.node.width/2 - this.mapRadius - 10;
+        this.map.node.y = this.canvas.node.height/2 - this.mapRadius - 10;
+        this.map.clear();
+        this.map.circle(0, 0, this.mapRadius);
+        this.map.fillColor = new cc.Color(255,255,255,30);
+        this.map.fill();
+
+        this.mapHit.node.x = this.canvas.node.width/2 - this.mapRadius - 10;
+        this.mapHit.node.y = -this.canvas.node.height/2 + this.mapRadius - 10;
+        this.mapHit.clear();
+        this.mapHit.circle(0, 0, this.mapRadius);
+        this.mapHit.fillColor = new cc.Color(255,255,255,30);
+        this.mapHit.fill();
+
+        this.map.lineWidth = 1;
+        var lastFrame =  this.Filter.frame[this.Filter.frame.length-1];
+        var newestTime = lastFrame.time;
+        for(var i = this.Filter.frame.length-2;i>=0 && i>=this.Filter.frame.length-30;--i){
+            var io = this.Filter.frame[i];
+
+            var color = 255 - (newestTime - io.time) / 6;
+
+            
+            this.map.strokeColor = new cc.Color(255 - color,color,0,255);
+            this.map.moveTo(lastFrame.acc.x * this.mapRadius, lastFrame.acc.y * this.mapRadius);
+            this.map.lineTo(io.acc.x * this.mapRadius, io.acc.y * this.mapRadius);
+            this.map.stroke();
+            
+            this.map.strokeColor = new cc.Color(color,color,color,255);
+            this.map.moveTo(lastFrame.pos.x * this.mapRadius, lastFrame.pos.y * this.mapRadius);
+            this.map.lineTo(io.pos.x * this.mapRadius, io.pos.y * this.mapRadius);
+            this.map.stroke();
+
+            
+            this.map.strokeColor = new cc.Color(255,0,0,255);
+            this.map.moveTo(lastFrame.pos.x * this.mapRadius, lastFrame.pos.y * this.mapRadius);
+            this.map.lineTo(io.predict.x * this.mapRadius, io.predict.y * this.mapRadius);
+            this.map.stroke();/* */
+            
+            this.map.strokeColor = new cc.Color(255,255,255,255);
+            this.map.moveTo(lastFrame.gyr.x / 50 * this.mapRadius, lastFrame.gyr.y / 50  * this.mapRadius);
+            this.map.lineTo(io.gyr.x / 50  * this.mapRadius, io.gyr.y  / 50 * this.mapRadius);
+            this.map.stroke();
+            
+            this.mapHit.strokeColor = new cc.Color(255 - color,color,0,255);
+            this.mapHit.moveTo(lastFrame.speed.x * this.mapRadius, lastFrame.speed.y * this.mapRadius);
+            this.mapHit.lineTo(io.speed.x * this.mapRadius, io.speed.y * this.mapRadius);
+            this.mapHit.stroke();
+
+            lastFrame = io;
+        }
+
+
+        if(this.Filter.frameHit.length > 0){
+            var lastFrameHit =  this.Filter.frameHit[this.Filter.frameHit.length-1];
+            var firstFrameHit = this.Filter.frameHit[0];
+
+            this.mapHit.lineWidth = 2;
+
+
+            /*
+            this.mapHit.strokeColor = new cc.Color(255,0,0,255);
+            this.mapHit.moveTo(0,10);
+            this.mapHit.lineTo(lastFrameHit.pos.x* this.mapRadius,10+ lastFrameHit.pos.y* this.mapRadius);
+            this.mapHit.stroke();/** */
+            
+            var direction = new o0.Vector2(0,0);
+            var directionDistance = 0;
+            for(var fi = 1;fi<this.Filter.frameHit.length-1;++fi){
+                for(var li = fi+1;li<this.Filter.frameHit.length;++li){
+                    let firstGyr = this.Filter.frameHit[fi].gyr;
+                    let lastGyr = this.Filter.frameHit[li].gyr;
+                    let newDirectionDistance = o0.distance2(firstGyr, lastGyr);
+                    if(directionDistance < newDirectionDistance){
+                        directionDistance = newDirectionDistance;
+                        direction = lastGyr.minus(firstGyr);
+                    }
+                }
+            }
+
+            this.mapHit.strokeColor = new cc.Color(255,0,0,255);
+            this.mapHit.moveTo(0,0);
+            //this.mapHit.lineTo((lastFrameHit.gyr.x - firstFrameHit.gyr.x)*5,(lastFrameHit.gyr.y - firstFrameHit.gyr.y)*5);
+            this.mapHit.lineTo(direction.x*5,direction.y*5);
+            this.mapHit.stroke();/** */
+            
+            /*
+            this.mapHit.strokeColor = new cc.Color(0,255,0,255);
+            this.mapHit.moveTo(0,0);
+            this.mapHit.lineTo(this.Filter.frameSwing.acc.x* this.mapRadius, this.Filter.frameSwing.acc.y* this.mapRadius);
+            this.mapHit.stroke();/* */
+
+            var newestTime = lastFrameHit.time;
+            this.mapHit.lineWidth = 1;
+            for(var i = this.Filter.frameHit.length-2;i>=0;--i){
+                var io = this.Filter.frameHit[i];
+    
+                var color = 255 - (newestTime - io.time);
+    
+                /*
+                this.mapHit.strokeColor = new cc.Color(color,color,color,255);
+                this.mapHit.moveTo(lastFrameHit.pos.x * this.mapRadius, lastFrameHit.pos.y * this.mapRadius);
+                this.mapHit.lineTo(io.pos.x * this.mapRadius, io.pos.y * this.mapRadius);
+                this.mapHit.stroke();/* */
+
+                this.mapHit.strokeColor = new cc.Color(color,color,color,255);
+                this.mapHit.moveTo((lastFrameHit.gyr.x - firstFrameHit.gyr.x)*5,(lastFrameHit.gyr.y - firstFrameHit.gyr.y)*5);
+                this.mapHit.lineTo((io.gyr.x - firstFrameHit.gyr.x)*5,(io.gyr.y - firstFrameHit.gyr.y)*5);
+                this.mapHit.stroke();
+    
+                /*
+                this.mapHit.strokeColor = new cc.Color(255,0,0,255);
+                this.mapHit.moveTo(lastFrame.pos.x * this.mapRadius, lastFrame.pos.y * this.mapRadius);
+                this.mapHit.lineTo(io.predict.x * this.mapRadius, io.predict.y * this.mapRadius);
+                this.mapHit.stroke();/* */
+                /*
+                this.map.circle(lastFrame.pos.x * this.mapRadius, lastFrame.pos.z * this.mapRadius, 1);
+                this.map.fillColor = new cc.Color(255,0,0,255);
+                this.map.fill();/* */
+    
+                lastFrameHit = io;
+            }
+                
+
+        }
+
+
+        this.TestButton[0][0].name = "power";
+        for(var i = this.Filter.frame.length-1;i>=0;--i){
+            var io = this.Filter.frame[i];
+            if(io.hit != 0){
+                this.TestButton[0][1].name = io.hit;
+                break;
+            }
+        }
+        /*
+        this.TestButton[1][12].name = this.Filter.angle;
+        this.TestButton[3][12].name = this.Filter.punchCount;
+        this.TestButton[2][12].name = this.Filter.leftRight;
+        for(var i =0;i<this.TestButton.length;++i){
+            for(var j =10;j>=0;--j){
+                this.TestButton[i][j+1].name = this.TestButton[i][j].name;
+                this.TestButton[i][j+1].button.normalColor = this.TestButton[i][j].button.normalColor;
+            }
+        }/* */
+    }
+});
+
+

+ 9 - 0
assets/Script/Menu.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "9ca35088-cd48-48c7-8cea-036dc41c2f77",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 552 - 0
assets/Script/MusicAlgorithm.js

@@ -0,0 +1,552 @@
+
+var o0 = require('o0');
+var o0Project = require('o0Project');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+//var fft = require("fft");
+var jsfft = require("jsfft");
+//var webAudioAnalyser = require('web-audio-analyser');
+
+
+
+cc.Class({
+    extends: cc.Component,
+
+    properties: {
+        canvas: {
+            default: null,
+            type: cc.Canvas
+        },
+        camera: {
+            default: null,
+            type: cc.Camera
+        },
+        UICamera: {
+            default: null,
+            type: cc.Camera
+        },
+        gameScene:null,
+
+        menuNode:null,
+        
+        DeviceMs:1,
+
+        map:null,
+        mapHit:null,
+        mapRadius: 200,
+        chart:null,
+
+        TestButton:[],
+        Filter:null,
+        LastTime:new Date().getTime(),
+
+        audioSource:null,
+    },
+
+    // use this for initialization
+    onLoad: function () {
+        //cc.director.setAnimationInterval(1.0/30);
+        //cc.game.setFrameRate(30);//模拟器不能正常显示
+
+        var self = this;
+        this.audioSource = this.node.getComponent(cc.AudioSource);
+        //cc.resources.load("music/Pink ditong", cc.AudioClip, (err, clip)=>{
+        cc.resources.load("music/Pink Pineapple - PPAP Pen Pineapple Apple Pen", cc.AudioClip, (err, clip)=>{
+            if (err) {
+                cc.error(`AudioClip load error : ${err}`);
+                return;
+            }
+            self.audioSource.clip = clip;
+            self.audioBuffer = this.audioSource.clip._audio;
+            var channel = self.audioBuffer.getChannelData(0);
+            self.audioChannel = [];
+            for(var i in channel){
+                self.audioChannel.push(channel[i]);
+            }
+
+            self.audioSource.play();
+            self.audioSource.pause();
+
+            self.frequency = [];
+            var halfFFTSize = 2048;
+            for(var i = 0;i<self.audioChannel.length;i+=128){//step 采样率
+                const data = new jsfft.ComplexArray(halfFFTSize).map((value, j, n) => {
+                    var v = self.audioChannel[i - halfFFTSize / 2 + j];
+                    value.real = v ? v : 0;
+                });
+                const frequencies = data.FFT();
+                var mag = [];
+                
+                for(var j = 0;j<halfFFTSize;++j){
+                    mag.push(Math.sqrt(frequencies.real[j] * frequencies.real[j] + frequencies.imag[j] * frequencies.imag[j]));
+                    //mag.push(Math.abs(frequencies.imag[j]));
+                }/** */
+                self.frequency.push(mag);
+            }
+            console.log(self.frequency );
+            
+            var max = 0;
+            for(var i = 0;i<self.frequency.length;++i){
+                var freI = self.frequency[i];
+                for(var j =0;j<freI.length;++j){
+                    max = Math.max(max,freI[j]);
+                }
+            }
+
+            for(var i = 0;i<self.frequency.length;++i){
+                var freI = self.frequency[i];
+                for(var j =0;j<freI.length;++j){
+                    freI[j] /= max;
+                }
+            }
+
+            self.frequencyStacked = [];
+            for(var i = 0;i<self.frequency.length;++i){
+                var freI = self.frequency[i];
+                var v = 0;
+                for(var j =0;j<freI.length && j<100;++j){
+                    v += freI[j] * Math.pow(10,(50-j));
+                }
+                self.frequencyStacked.push(v);
+            }
+
+            max = 0;
+            for(var i = 0;i<self.frequencyStacked.length;++i){
+                max = Math.max(max,self.frequencyStacked[i]);
+            }
+            for(var i = 0;i<self.frequencyStacked.length;++i){
+                self.frequencyStacked[i] /= max;
+            }
+
+            /*
+            var testArray = [];
+
+            const data2 = new jsfft.ComplexArray(512).map((value, i, n) => {
+                testArray.push(i);
+                testArray.push(n);
+                testArray.push((i > n/3 && i < 2*n/3) ? 1 : 0);
+            });
+            console.log(testArray);
+
+            const data = new jsfft.ComplexArray(512).map((value, i, n) => {
+                value.real = (i > n/3 && i < 2*n/3) ? 1 : 0;
+            });
+            const frequencies = data.FFT();
+            console.log(data);
+            console.log(frequencies);/** */
+
+            console.log("o0o0o0o0o0o0o0o0o0o0o0o0o0            audioContext");
+            console.log(self.audioSource.clip);
+            
+            if(false && (window.OfflineAudioContext || window.webkitOfflineAudioContext)){
+                const {length, numberOfChannels, sampleRate} = self.audioBuffer;
+                const OfflineContext = (window.OfflineAudioContext || window.webkitOfflineAudioContext);
+                const context = new OfflineContext(numberOfChannels, length, sampleRate);
+                const source = context.createBufferSource();
+                source.buffer = self.audioBuffer;
+                self.audioChannel = source.buffer.getChannelData(0);
+
+                console.log(source.buffer.getChannelData(0));
+                var channel = source.buffer.getChannelData(0);
+
+                var max = 0;
+                var min = 1;
+                for(var i in channel){
+                    max = Math.max(channel[i],max);
+                    min = Math.min(channel[i],min);
+                }
+                console.log(max);
+                console.log(min);
+                //console.log(channel.min());
+            }
+
+
+
+            if(false && (window.OfflineAudioContext || window.webkitOfflineAudioContext)){
+                const {length, numberOfChannels, sampleRate} = self.audioBuffer;
+                var audioContext = new (window.OfflineAudioContext || window.webkitOfflineAudioContext)(numberOfChannels, length, sampleRate);
+
+                var audioBufferSourceNode = audioContext.createBufferSource();
+                audioBufferSourceNode.buffer = self.audioSource.clip._audio;
+
+                var webAudioAnalyser = webAudioAnalyser(audioBufferSourceNode);
+
+                //self.audioChannel = audioBufferSourceNode.buffer.getChannelData(0);
+                var analyser = audioContext.createAnalyser();
+                //analyser.fftSize = 256;
+                audioBufferSourceNode.connect(analyser);
+                analyser.connect(audioContext.destination);
+                audioBufferSourceNode.start(0);
+
+                self.analyser = analyser;
+                /** */
+
+
+                //analyser.getByteTimeDomainData(dataArray);
+                
+                var dataArray = new Uint8Array(analyser.frequencyBinCount);
+                analyser.getByteFrequencyData(dataArray);
+                console.log("dataArray");
+                console.log(dataArray);
+                /*
+                for(var i in dataArray){
+                    console.log(dataArray[i]);
+                }/** */
+                
+            }
+
+            
+            if(false && (window.AudioContext || window.webkitAudioContext)){
+                const {length, numberOfChannels, sampleRate} = self.audioBuffer;
+                //var audioContext = new (window.OfflineAudioContext || window.webkitOfflineAudioContext)(numberOfChannels, length, sampleRate);
+                var audioContext = new (window.AudioContext || window.webkitAudioContext)();
+                var audioBufferSourceNode = audioContext.createBufferSource();
+                audioBufferSourceNode.buffer = self.audioSource.clip._audio;
+
+                self.audioContext = audioContext;
+
+                //self.audioChannel = audioBufferSourceNode.buffer.getChannelData(0);
+                var analyser = audioContext.createAnalyser();
+                analyser.fftSize = 256;
+                audioBufferSourceNode.connect(analyser);
+                analyser.connect(audioContext.destination);
+                //audioBufferSourceNode.suspend();
+                audioBufferSourceNode.start(0,40,20);
+                //audioContext.startRendering();
+
+                self.webAudioSource = audioBufferSourceNode;
+                self.analyser = analyser;
+                /** */
+
+
+                //audioContext.currentTime = 10;
+                //analyser.getByteTimeDomainData(dataArray);
+                
+                var dataArray = new Uint8Array(analyser.frequencyBinCount);
+                analyser.getByteFrequencyData(dataArray);
+
+                
+                console.log("dataArray");
+                console.log(audioContext.currentTime);
+                console.log(dataArray);
+                /*
+                for(var i in dataArray){
+                    console.log(dataArray[i]);
+                }/** */
+                
+            }
+        });
+        //
+
+
+/*
+return getTopCandidate( 
+    groupByTempo(buffer.sampleRate)(
+        identifyIntervals( 
+            findPeaks(  
+                source.buffer.getChannelData(0) 
+            )  
+        ) 
+    ) 
+);/** */
+
+        /*
+        //var file = this.files[0];
+        var fr = new FileReader();
+    
+        fr.onload = function(e){
+            audioCtx.decodeAudioData(e.target.result,function(buffer){
+                console.log(buffer);
+                for(var i in buffer){
+                    console.log(i);
+                }
+                //playFun(buffer);  // 解码后返回的AudioBuffer对象作为播放函数的参数传入
+            },function(err){
+                console.log(err);
+            })
+        }
+        fr.readAsArrayBuffer(this.audioSource.clip._audio);/** */
+
+
+
+        //cc.director.getPhysicsManager().enabled = true;
+
+        //this.cocos.node.x;
+        //node.parent = this.canvas.node;
+        //this.label.node.parent = node;
+        //this.label.node.x = 0;
+        //this.label.node.y = 0;
+        //this.label.string = this.text;
+
+        //var Snake = require("Snake");
+        //cc.log("oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo "+Snake);
+
+        /*var snake = new cc.Node('snake');
+        snake.parent = this.camera.node;
+        snake.addComponent('Snake');/** */
+
+        //newSnake(this.camera.node);
+
+        this.menuNode = new cc.Node();
+        this.node.addChild(this.menuNode,1);
+        
+        this.map = o0CC.addScriptNode(this.node,'cc.Graphics',10);
+        this.mapHit = o0CC.addScriptNode(this.node,'cc.Graphics',10);
+        this.chart = o0CC.addScriptNode(this.node,'cc.Graphics',10);
+
+        var col = 3;
+        for(var i = 0;i<col;++i){
+            this.TestButton.push([]);
+            for(var j = 0;j<2;++j){
+                var testButton = o0CC.addScriptNode(this.menuNode,'o0CCButton',11);
+                o0CC.setGroup(testButton,o0Game.GroupIndex.UI);
+                testButton.node.x = (i-(col-1)/2)*this.canvas.node.width/col;
+                testButton.node.y = this.canvas.node.height/2 - 20 - j * 40;
+                testButton.node.width = this.canvas.node.width/col;
+                testButton.node.height = 40;/** */
+                testButton.name = "null";
+                this.TestButton[i].push(testButton);
+            }
+        }
+        this.TestButton[1][0].name = "resume";
+        this.TestButton[1][0].o0ClickEvent.push(function () {
+            if(self.TestButton[1][0].name == "play"){
+                self.TestButton[1][0].name = "pause";
+                self.audioSource.play();
+                //self.audioSource.resume();
+            }else if(self.TestButton[1][0].name == "resume"){
+                self.TestButton[1][0].name = "pause";
+                //self.audioSource.play();
+                self.audioSource.resume();
+            }else{
+                self.TestButton[1][0].name = "resume";
+                //self.audioSource.stop();
+                self.audioSource.pause();
+            }
+        });
+        
+        /*
+        this.dragLabel = o0CC.addScriptNode(this.menuNode,'o0CCLabel',11);
+        o0CC.setGroup(this.dragLabel,o0Game.GroupIndex.UI);
+        this.dragLabel.node.x = 0;
+        this.dragLabel.node.y = 0;
+        this.dragLabel.node.width = this.canvas.node.width/2;
+        this.dragLabel.node.height = this.canvas.node.height/2;/** */
+        
+        self.dragRate = 0;
+        self.mouseLocation = new o0.Vector2(0,0);
+        var listener = {
+            event: cc.EventListener.MOUSE,
+            onMouseDown: function (event) {
+                self.mouseLocation = event.getLocation();
+                if(self.mouseLocation.y > 1000)
+                    return;
+                self.dragRate = 0.005;
+                //console.log("onMouseDown");
+            },
+            onMouseUp: function (event) {
+                self.mouseLocation = event.getLocation();
+                self.dragRate = 0;
+                //console.log("onMouseUp");
+                //self.setTargetSpeeding(false);
+            },
+            onMouseMove: function (event) {
+                //console.log("onMouseMove");
+                if(self.audioSource != undefined && self.dragRate != 0){
+                    var newMouseLocation = event.getLocation();
+                    self.audioSource.setCurrentTime(self.audioSource.getCurrentTime() + (newMouseLocation.x - self.mouseLocation.x) * self.dragRate );
+                    //self.webAudioSource.setCurrentTime(self.webAudioSource.currentTime + (newMouseLocation.x - self.mouseLocation.x) * self.dragRate);
+                    self.mouseLocation = newMouseLocation;
+                    
+                    console.log(self.audioChannel);
+                }
+            },
+            onMouseScroll: function (event) {
+            }
+        }
+        cc.eventManager.addListener(listener, this.node);
+        //cc.EventTarget.addListener(listener, this.node);
+
+        /*
+        this.gameScene = o0CC.addScriptNode(this.node,'GameScene',0);
+        this.gameScene.canvas = this.canvas;
+        this.gameScene.camera = this.camera;/** */
+        this.backgroundGraphic = this.menuNode.addComponent(cc.Graphics,0);
+        o0CC.setGroup(this.backgroundGraphic,o0Game.GroupIndex.UI);
+
+        cc.director.getScheduler().setTimeScale(50);
+
+        this.Filter = new o0Project.Filter();
+
+        console.log("init finished");
+        
+    },
+
+    onDeviceMotionEvent (event) {
+        let newTime = new Date().getTime();
+
+        var [acc,forceChanged,momentum] = this.Filter.Update(new o0.Vector3(event.acc),newTime - this.LastTime,new o0.Vector3(0,0,0));
+
+        this.LastTime = newTime;
+    },
+    // called every frame
+    update: function (dt) {
+        var self = this;
+        
+        if(self.audioContext){
+            console.log(self.audioContext.currentTime);
+        }
+
+        if(false && this.analyser != undefined){
+            var dataArray = new Uint8Array(this.analyser.frequencyBinCount);
+            this.analyser.getByteFrequencyData(dataArray);
+            for(var i in dataArray){
+                if(dataArray[i] != 0){
+                    if(this.logCount == undefined){
+                        this.logCount = 10;
+                    }else if(this.logCount > 0){
+                        this.logCount--;
+                        console.log(dataArray);
+                    }
+                    break;
+                }
+            }
+        }
+
+
+        this.chart.node.x = -this.canvas.node.width/2;
+        this.chart.node.y = -this.canvas.node.height/2;
+
+        if(this.audioChannel){
+            this.audioChannelScaledLength = this.canvas.node.width - 20;
+            if(this.audioChannelScaled == undefined || this.audioChannelScaled.length != this.audioChannelScaledLength){
+                this.audioChannelScaled = [];
+                var step = Math.ceil(this.audioChannel.length / this.audioChannelScaledLength);
+                var k = 0;
+                for(var i=0;i<this.audioChannelScaledLength;++i){
+                    var max = 0;
+                    var min = 0;
+                    for(var j=0;j<step;++j){
+                        var v;
+                        if(k >= this.audioChannel.length){
+                            break;
+                        }else{
+                            v = this.audioChannel[k];
+                        }
+                        max = Math.max(max,v);
+                        min = Math.min(min,v);
+                        ++k;
+                    }
+                    this.audioChannelScaled.push([min,max]);
+                }
+                //console.log(this.audioChannelScaled);
+            }
+        }
+
+        this.chart.clear();
+
+        if(this.audioChannelScaled){
+            this.chart.strokeColor = new cc.Color(255,0,0,255);
+            this.chart.moveTo(this.canvas.node.width/2, 0);
+            this.chart.lineTo(this.canvas.node.width/2, 1000);
+            this.chart.stroke();/** */
+
+            var halfaudioChannelScaledLength = this.audioChannelScaled.length/2;
+            
+
+            var frequencyStackedDrawFrame = Math.floor(this.audioSource.getCurrentTime() / this.audioSource.getDuration() * this.frequencyStacked.length - halfaudioChannelScaledLength);
+            for(var i = 0;i< this.audioChannelScaled.length;i++){
+                var iFrequency = self.frequencyStacked[i+frequencyStackedDrawFrame];
+                if(iFrequency == undefined){
+                    continue;
+                }
+                this.chart.strokeColor = new cc.Color(255,255,255,255);
+                this.chart.moveTo(i+10, 750);
+                this.chart.lineTo(i+10, 750 + iFrequency * 100);
+                this.chart.stroke();
+            }
+
+
+            this.chart.lineWidth = 3;
+            var frequencyDrawStep = 50;
+            var frequencyStartDrawFrame = Math.floor(this.audioSource.getCurrentTime() / this.audioSource.getDuration() * this.frequency.length - halfaudioChannelScaledLength/frequencyDrawStep);
+            for(var i = 0;i< this.audioChannelScaled.length/frequencyDrawStep;i++){
+                var iFrequency = self.frequency[i+frequencyStartDrawFrame];
+                if(iFrequency == undefined){
+                    continue;
+                }
+                for(var j = 0;j<iFrequency.length && j<100;++j){
+                    var color = iFrequency[j] * 255;
+                    this.chart.strokeColor = new cc.Color(color,color,color,255);
+                    this.chart.moveTo(i * frequencyDrawStep +10, 500 + j*2);
+                    this.chart.lineTo((i+1) * frequencyDrawStep +10, 500 + j*2);
+                    this.chart.stroke();
+                }/** */
+            }
+            this.chart.lineWidth = 2;
+
+            this.chart.strokeColor = new cc.Color(255,255,255,255);
+            var currentFrame = Math.floor(this.audioSource.getCurrentTime() / this.audioSource.getDuration() * this.audioChannel.length);
+            for(var i = 0;i< halfaudioChannelScaledLength;++i){
+                this.chart.moveTo(-i+10 + halfaudioChannelScaledLength, 350);
+                this.chart.lineTo(-i+10 + halfaudioChannelScaledLength, 350 + this.audioChannel[currentFrame-i] * 100);
+                this.chart.stroke();
+
+                this.chart.moveTo(i+10 + halfaudioChannelScaledLength, 350);
+                this.chart.lineTo(i+10 + halfaudioChannelScaledLength, 350 + this.audioChannel[currentFrame+i] * 100);
+                this.chart.stroke();
+            }
+            
+            for(var i =0;i< this.audioChannelScaled.length;++i){
+                this.chart.moveTo(i+10, 100);
+                this.chart.lineTo(i+10, 100 + this.audioChannelScaled[i][0] * 100);
+                this.chart.stroke();
+                this.chart.moveTo(i+10, 100);
+                this.chart.lineTo(i+10, 100 + this.audioChannelScaled[i][1] * 100);
+                this.chart.stroke();
+            }
+            this.chart.strokeColor = new cc.Color(255,0,0,255);
+
+            this.chart.moveTo(10, 100);
+            this.chart.lineTo(10+this.audioChannelScaled.length, 100);
+            this.chart.stroke();
+            this.chart.moveTo(10, 499);
+            this.chart.lineTo(10+this.audioChannelScaled.length, 495);
+            this.chart.stroke();
+
+            //console.log(this.audioSource.getCurrentTime());
+            var seekX =  this.audioSource.getCurrentTime() / this.audioSource.getDuration() * this.audioChannelScaled.length;
+            this.chart.moveTo(10 + seekX, 0);
+            this.chart.lineTo(10 + seekX, 200);
+            this.chart.stroke();/** */
+
+            
+        }
+
+
+
+
+
+
+        this.TestButton[0][0].name = "power";
+        for(var i = this.Filter.frame.length-1;i>=0;--i){
+            var io = this.Filter.frame[i];
+            if(io.hit != 0){
+                this.TestButton[0][1].name = io.hit;
+                break;
+            }
+        }
+        /*
+        this.TestButton[1][12].name = this.Filter.angle;
+        this.TestButton[3][12].name = this.Filter.punchCount;
+        this.TestButton[2][12].name = this.Filter.leftRight;
+        for(var i =0;i<this.TestButton.length;++i){
+            for(var j =10;j>=0;--j){
+                this.TestButton[i][j+1].name = this.TestButton[i][j].name;
+                this.TestButton[i][j+1].button.normalColor = this.TestButton[i][j].button.normalColor;
+            }
+        }/* */
+    }
+});
+
+

+ 9 - 0
assets/Script/MusicAlgorithm.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "67f241a7-e7ae-4f82-88cb-5f62fa987543",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 379 - 0
assets/Script/SandBagAlgorithmMain.js

@@ -0,0 +1,379 @@
+
+var o0 = require('o0');
+var o0Project = require('o0Project');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+cc.Class({
+    extends: cc.Component,
+
+    properties: {
+        canvas: {
+            default: null,
+            type: cc.Canvas
+        },
+        camera: {
+            default: null,
+            type: cc.Camera
+        },
+        UICamera: {
+            default: null,
+            type: cc.Camera
+        },
+        gameScene:null,
+
+        menuNode:null,
+        
+        DeviceMs:1,
+
+        map:null,
+        mapHit:null,
+        mapRadius: 200,
+        chart:null,
+
+        TestButton:[],
+        Filter:null,
+        LastTime:new Date().getTime(),
+    },
+
+    // use this for initialization
+    onLoad: function () {
+        //cc.director.setAnimationInterval(1.0/30);
+        //cc.game.setFrameRate(30);//模拟器不能正常显示
+
+        var self = this;
+        //cc.director.getPhysicsManager().enabled = true;
+
+        //this.cocos.node.x;
+        //node.parent = this.canvas.node;
+        //this.label.node.parent = node;
+        //this.label.node.x = 0;
+        //this.label.node.y = 0;
+        //this.label.string = this.text;
+
+        //var Snake = require("Snake");
+        //cc.log("oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo "+Snake);
+
+        /*var snake = new cc.Node('snake');
+        snake.parent = this.camera.node;
+        snake.addComponent('Snake');/** */
+
+        //newSnake(this.camera.node);
+
+        this.menuNode = new cc.Node();
+        this.node.addChild(this.menuNode,1);
+        
+        this.map = o0CC.addScriptNode(this.node,'cc.Graphics',10);
+        this.mapHit = o0CC.addScriptNode(this.node,'cc.Graphics',10);
+        this.chart = o0CC.addScriptNode(this.node,'cc.Graphics',10);
+
+        var col = 1;
+        for(var i = 0;i<col;++i){
+            this.TestButton.push([]);
+            for(var j = 0;j<2;++j){
+                var testButton = o0CC.addScriptNode(this.menuNode,'o0CCButton',11);
+                o0CC.setGroup(testButton,o0Game.GroupIndex.UI);
+                testButton.node.x = (i-(col-1)/2)*this.canvas.node.width/col;
+                testButton.node.y = this.canvas.node.height/2 - 20 - j * 40;
+                testButton.node.width = this.canvas.node.width/col;
+                testButton.node.height = 40;/** */
+                testButton.name = "null";
+                this.TestButton[i].push(testButton);
+            }
+        }
+
+        
+
+        /*
+        this.gameScene = o0CC.addScriptNode(this.node,'GameScene',0);
+        this.gameScene.canvas = this.canvas;
+        this.gameScene.camera = this.camera;/** */
+        this.backgroundGraphic = this.menuNode.addComponent(cc.Graphics,0);
+        o0CC.setGroup(this.backgroundGraphic,o0Game.GroupIndex.UI);
+
+        cc.director.getScheduler().setTimeScale(50);
+
+        this.Filter = new o0Project.Filter();
+
+        cc.systemEvent.setAccelerometerEnabled(true);
+        cc.systemEvent.on(cc.SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
+        if(typeof(uni) != "undefined" && typeof(window) != "undefined" ){
+            uni.postMessage({
+                data: {
+                    funName: "addDeviceUpdateListener",
+                    gameData: {}
+        
+                }
+            });
+            var printed = false;
+            window.onWebViewMessage = function(data){
+                let name= data.funName;
+                if(name == "onDeviceUpdateData")
+                {
+                    if(printed == false){
+                        console.log(data.gameData);
+                        printed = true;
+                    }
+                    //webView.onDeviceUpdateData(data.gameData);
+                    let {min, s, ms} = data.gameData.data;
+                    var msGap = ms - self.DeviceMs;
+                    self.DeviceMs = ms;
+                    while(msGap < 0){
+                        msGap+=1000;
+                    }
+                    //console.log(data);
+                    let {ax,ay,az} = data.gameData.data.acc;
+                    let {gx,gy,gz} = data.gameData.data.gyro;
+                    self.Filter.Update(new o0.Vector3(ax,ay,az),msGap,new o0.Vector3(gx,gy,gz));//我自己的更新acc的函数
+                    cc.systemEvent.setAccelerometerEnabled(false);
+                }
+            };
+            uni.postMessage({
+                data: {
+                    funName: "writeBLEConnectionValue",
+                    gameData: {
+                        value: "3" //开启设备数据
+                    }
+                }
+            });
+            uni.postMessage({
+                data: {
+                    funName: "writeBLEConnectionValue",
+                    gameData: {
+                        value: "b" //60ms
+                    }
+                }
+            })
+        }
+        console.log("init finished");
+    },
+
+    onDeviceMotionEvent (event) {
+        let newTime = new Date().getTime();
+
+        var [acc,forceChanged,momentum] = this.Filter.Update(new o0.Vector3(event.acc),newTime - this.LastTime,new o0.Vector3(0,0,0));
+
+        this.LastTime = newTime;
+    },
+    // called every frame
+    update: function (dt) {
+        this.chart.node.x = this.canvas.node.width/2 - 100;
+        this.chart.node.y = -this.canvas.node.height/2 + 50;
+
+        this.chart.clear();
+        for(var i = 0;i< this.Filter.frame.length;++i){
+            var io = this.Filter.frame[i];
+            
+
+            this.chart.strokeColor = new cc.Color(255,255,255,255);
+            this.chart.moveTo(-i, 0);
+            this.chart.lineTo(-i, io.hit);
+            this.chart.stroke();/* */
+            
+            this.chart.strokeColor = new cc.Color(255,255,255,50);
+            this.chart.moveTo(-i, 200);
+            this.chart.lineTo(-i, 300);
+            this.chart.stroke();/** */
+
+            this.chart.strokeColor = new cc.Color(255,0,0,255);
+            this.chart.moveTo(-i, 200);
+            this.chart.lineTo(-i, 200+io.reliable*100);
+            this.chart.stroke();/** */
+            
+            this.chart.strokeColor = new cc.Color(0,255,0,255);
+            this.chart.moveTo(-i, 300);
+            this.chart.lineTo(-i, 300+io.shakeFixed);
+            this.chart.stroke();/** */
+
+            this.chart.strokeColor = new cc.Color(255,255,255,255);
+            this.chart.moveTo(-i, 300);
+            this.chart.lineTo(-i, 300+io.shake);
+            this.chart.stroke();/* */
+
+            this.chart.strokeColor = new cc.Color(255,0,0,255);
+            this.chart.moveTo(-i, 300);
+            this.chart.lineTo(-i, 300+io.shakeSlope);
+            this.chart.stroke();/* */
+            
+            /*
+            this.chart.strokeColor = new cc.Color(255,0,0,255);
+            this.chart.moveTo(-i, 0);
+            this.chart.lineTo(-i, io.slope);
+            this.chart.stroke();/** */
+
+            this.chart.strokeColor = new cc.Color(0,255,0,255);
+            this.chart.moveTo(-i, 400);
+            this.chart.lineTo(-i, 400+io.accFixed);
+            this.chart.stroke();
+
+            this.chart.strokeColor = new cc.Color(255,255,255,255);
+            this.chart.moveTo(-i, 400);
+            this.chart.lineTo(-i, 400+io.acc.length*100);
+            this.chart.stroke();
+            
+            this.chart.strokeColor = new cc.Color(255,0,0,255);
+            this.chart.moveTo(-i, 380);
+            this.chart.lineTo(-i, 380+io.accSlope);
+            this.chart.stroke();
+
+            /*
+            if(io.hit!=0){
+                this.chart.strokeColor = new cc.Color(255,0,0,255);
+                this.chart.moveTo(-i, 0);
+                this.chart.lineTo(-i, io.hit);
+                this.chart.stroke();
+            }/** */
+        }
+        //console.log(this.Filter.frame[0].shake);
+
+
+
+        this.map.node.x = this.canvas.node.width/2 - this.mapRadius - 10;
+        this.map.node.y = this.canvas.node.height/2 - this.mapRadius - 10;
+        this.map.clear();
+        this.map.circle(0, 0, this.mapRadius);
+        this.map.fillColor = new cc.Color(255,255,255,30);
+        this.map.fill();
+
+        this.mapHit.node.x = this.canvas.node.width/2 - this.mapRadius - 10;
+        this.mapHit.node.y = -this.canvas.node.height/2 + this.mapRadius - 10;
+        this.mapHit.clear();
+        this.mapHit.circle(0, 0, this.mapRadius);
+        this.mapHit.fillColor = new cc.Color(255,255,255,30);
+        this.mapHit.fill();
+
+        this.map.lineWidth = 1;
+        var lastFrame =  this.Filter.frame[this.Filter.frame.length-1];
+        var newestTime = lastFrame.time;
+        for(var i = this.Filter.frame.length-2;i>=0 && i>=this.Filter.frame.length-30;--i){
+            var io = this.Filter.frame[i];
+
+            var color = 255 - (newestTime - io.time) / 6;
+
+            
+            this.map.strokeColor = new cc.Color(255 - color,color,0,255);
+            this.map.moveTo(lastFrame.acc.x * this.mapRadius, lastFrame.acc.y * this.mapRadius);
+            this.map.lineTo(io.acc.x * this.mapRadius, io.acc.y * this.mapRadius);
+            this.map.stroke();
+            
+            this.map.strokeColor = new cc.Color(color,color,color,255);
+            this.map.moveTo(lastFrame.pos.x * this.mapRadius, lastFrame.pos.y * this.mapRadius);
+            this.map.lineTo(io.pos.x * this.mapRadius, io.pos.y * this.mapRadius);
+            this.map.stroke();
+
+            
+            this.map.strokeColor = new cc.Color(255,0,0,255);
+            this.map.moveTo(lastFrame.pos.x * this.mapRadius, lastFrame.pos.y * this.mapRadius);
+            this.map.lineTo(io.predict.x * this.mapRadius, io.predict.y * this.mapRadius);
+            this.map.stroke();/* */
+            
+            this.map.strokeColor = new cc.Color(255,255,255,255);
+            this.map.moveTo(lastFrame.gyr.x / 50 * this.mapRadius, lastFrame.gyr.y / 50  * this.mapRadius);
+            this.map.lineTo(io.gyr.x / 50  * this.mapRadius, io.gyr.y  / 50 * this.mapRadius);
+            this.map.stroke();
+            
+            this.mapHit.strokeColor = new cc.Color(255 - color,color,0,255);
+            this.mapHit.moveTo(lastFrame.speed.x * this.mapRadius, lastFrame.speed.y * this.mapRadius);
+            this.mapHit.lineTo(io.speed.x * this.mapRadius, io.speed.y * this.mapRadius);
+            this.mapHit.stroke();
+
+            lastFrame = io;
+        }
+
+
+        if(this.Filter.frameHit.length > 0){
+            var lastFrameHit =  this.Filter.frameHit[this.Filter.frameHit.length-1];
+            var firstFrameHit = this.Filter.frameHit[0];
+
+            this.mapHit.lineWidth = 2;
+
+
+            /*
+            this.mapHit.strokeColor = new cc.Color(255,0,0,255);
+            this.mapHit.moveTo(0,10);
+            this.mapHit.lineTo(lastFrameHit.pos.x* this.mapRadius,10+ lastFrameHit.pos.y* this.mapRadius);
+            this.mapHit.stroke();/** */
+            
+            var direction = new o0.Vector2(0,0);
+            var directionDistance = 0;
+            for(var fi = 1;fi<this.Filter.frameHit.length-1;++fi){
+                for(var li = fi+1;li<this.Filter.frameHit.length;++li){
+                    let firstGyr = this.Filter.frameHit[fi].gyr;
+                    let lastGyr = this.Filter.frameHit[li].gyr;
+                    let newDirectionDistance = o0.distance2(firstGyr, lastGyr);
+                    if(directionDistance < newDirectionDistance){
+                        directionDistance = newDirectionDistance;
+                        direction = lastGyr.minus(firstGyr);
+                    }
+                }
+            }
+
+            this.mapHit.strokeColor = new cc.Color(255,0,0,255);
+            this.mapHit.moveTo(0,0);
+            //this.mapHit.lineTo((lastFrameHit.gyr.x - firstFrameHit.gyr.x)*5,(lastFrameHit.gyr.y - firstFrameHit.gyr.y)*5);
+            this.mapHit.lineTo(direction.x*5,direction.y*5);
+            this.mapHit.stroke();/** */
+            
+            /*
+            this.mapHit.strokeColor = new cc.Color(0,255,0,255);
+            this.mapHit.moveTo(0,0);
+            this.mapHit.lineTo(this.Filter.frameSwing.acc.x* this.mapRadius, this.Filter.frameSwing.acc.y* this.mapRadius);
+            this.mapHit.stroke();/* */
+
+            var newestTime = lastFrameHit.time;
+            this.mapHit.lineWidth = 1;
+            for(var i = this.Filter.frameHit.length-2;i>=0;--i){
+                var io = this.Filter.frameHit[i];
+    
+                var color = 255 - (newestTime - io.time);
+    
+                /*
+                this.mapHit.strokeColor = new cc.Color(color,color,color,255);
+                this.mapHit.moveTo(lastFrameHit.pos.x * this.mapRadius, lastFrameHit.pos.y * this.mapRadius);
+                this.mapHit.lineTo(io.pos.x * this.mapRadius, io.pos.y * this.mapRadius);
+                this.mapHit.stroke();/* */
+
+                this.mapHit.strokeColor = new cc.Color(color,color,color,255);
+                this.mapHit.moveTo((lastFrameHit.gyr.x - firstFrameHit.gyr.x)*5,(lastFrameHit.gyr.y - firstFrameHit.gyr.y)*5);
+                this.mapHit.lineTo((io.gyr.x - firstFrameHit.gyr.x)*5,(io.gyr.y - firstFrameHit.gyr.y)*5);
+                this.mapHit.stroke();
+    
+                /*
+                this.mapHit.strokeColor = new cc.Color(255,0,0,255);
+                this.mapHit.moveTo(lastFrame.pos.x * this.mapRadius, lastFrame.pos.y * this.mapRadius);
+                this.mapHit.lineTo(io.predict.x * this.mapRadius, io.predict.y * this.mapRadius);
+                this.mapHit.stroke();/* */
+                /*
+                this.map.circle(lastFrame.pos.x * this.mapRadius, lastFrame.pos.z * this.mapRadius, 1);
+                this.map.fillColor = new cc.Color(255,0,0,255);
+                this.map.fill();/* */
+    
+                lastFrameHit = io;
+            }
+                
+
+        }
+
+
+        this.TestButton[0][0].name = "power";
+        for(var i = this.Filter.frame.length-1;i>=0;--i){
+            var io = this.Filter.frame[i];
+            if(io.hit != 0){
+                this.TestButton[0][1].name = io.hit;
+                break;
+            }
+        }
+        /*
+        this.TestButton[1][12].name = this.Filter.angle;
+        this.TestButton[3][12].name = this.Filter.punchCount;
+        this.TestButton[2][12].name = this.Filter.leftRight;
+        for(var i =0;i<this.TestButton.length;++i){
+            for(var j =10;j>=0;--j){
+                this.TestButton[i][j+1].name = this.TestButton[i][j].name;
+                this.TestButton[i][j+1].button.normalColor = this.TestButton[i][j].button.normalColor;
+            }
+        }/* */
+    }
+});
+
+

+ 9 - 0
assets/Script/SandBagAlgorithmMain.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "9a9e81bf-3e2d-474f-878d-3ccaeaee3ee6",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/Snake.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "cb3859bb-a093-444f-88be-a7506e2ad790",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 35 - 0
assets/Script/Snake/RemoteSnake.js

@@ -0,0 +1,35 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+
+cc.Class({
+    extends: require('Snake'),
+
+    properties: {
+    },/*
+    addHead:function(){
+
+        this.head = new cc.Node('head');
+        this.body.push(this.head);
+        this.head.parent = this.node;
+        this.head.rotation = Math.random() * 360;
+
+        //this.tag = o0Game.CollisionTag.Head;
+
+        this.addGraphic(this.head);
+    },
+    addBody:function(){
+        if(this.node.active == false)
+            return;
+        var i = this.body.length;
+        this.body.push(new cc.Node('body'+i));
+        this.node.addChild(this.body[i],-i);
+        this.body[i].x = this.body[i-1].x;
+        this.body[i].y = this.body[i-1].y;
+        this.body[i].rotation = this.body[i-1].rotation;
+
+        this.addGraphic2(this.body[i]);
+    },/** */
+});
+//module.exports = Snake;

+ 9 - 0
assets/Script/Snake/RemoteSnake.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "e83d6491-8fab-4142-8cc4-2b3867c67956",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 78 - 0
assets/Script/Snake/SkinSampleSnake.js

@@ -0,0 +1,78 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+
+cc.Class({
+    extends: require('Snake'),
+
+    addSkin:function(name){
+        if(this.skin == null){
+            this.skin = [];
+            this.skin.push(name);
+        }else if(this.skin.length >= 20){
+            return;
+        }else{
+            this.skin.push(name);
+            this.addBody();
+        }
+        var sprite = this.body[this.body.length-1].getComponent(cc.Sprite);
+        cc.loader.loadRes('snake/'+name, cc.SpriteFrame, function (err, spriteFrame) {
+            sprite.spriteFrame = spriteFrame;
+        });
+    },
+    clearSkin:function(){
+        this.skin = null;
+        this.removeAllBody();
+        var sprite = this.body[0].getComponent(cc.Sprite);
+        sprite.spriteFrame = null;
+    },
+
+    addHead:function(){
+        this.head = new cc.Node('head');
+        this.body.push(this.head);
+        this.head.parent = this.node;
+        this.head.rotation = Math.random() * 360;
+        //Graphic.
+
+        var sprite = this.body[this.body.length-1].addComponent(cc.Sprite,0);
+        sprite.trim = true;
+        sprite.type = cc.Sprite.Type.SLICED;
+        sprite.sizeMode = cc.Sprite.SizeMode.CUSTOM;
+        sprite.SrcBlendFactor = cc.macro.BlendFactor.SRC_ALPHA;
+        sprite.DstBlendFactor = cc.macro.BlendFactor.ONE_MINUS_SRC_ALPHA;        
+        o0CC.setGroup(sprite,o0Game.GroupIndex.UI);
+        sprite.node.width = this.size;
+        sprite.node.height = this.size;
+        
+        var eyeNode = new cc.Node();
+        eyeNode.parent = this.head;
+        var Graphic = this.addEyeGraphic(eyeNode);
+    },
+    addBody:function(){
+        if(this.node.active == false)
+            return;
+        var i = this.body.length;
+        this.body.push(new cc.Node('body'+i));
+        this.node.addChild(this.body[i],-i);
+        this.body[i].x = this.body[i-1].x;
+        this.body[i].y = this.body[i-1].y;
+        this.body[i].rotation = this.body[i-1].rotation;
+
+        var collider = this.body[i].addComponent('cc.CircleCollider');
+        //collider.tag = o0Game.CollisionTag.Body;
+        collider.radius = this.radius;
+
+        var sprite = this.body[this.body.length-1].addComponent(cc.Sprite,0);
+        sprite.trim = true;
+        sprite.type = cc.Sprite.Type.SLICED;
+        sprite.sizeMode = cc.Sprite.SizeMode.CUSTOM;
+        sprite.SrcBlendFactor = cc.macro.BlendFactor.SRC_ALPHA;
+        sprite.DstBlendFactor = cc.macro.BlendFactor.ONE_MINUS_SRC_ALPHA;
+        o0CC.setGroup(sprite,o0Game.GroupIndex.UI);
+        sprite.node.width = this.size;
+        sprite.node.height = this.size;
+    },
+    start: function () {
+    },//必须保留
+});

+ 9 - 0
assets/Script/Snake/SkinSampleSnake.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "c9acf3d2-82a7-41e3-99ae-b340070dbd91",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 201 - 0
assets/Script/Snake/Snake.js

@@ -0,0 +1,201 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+
+cc.Class({
+    extends: cc.CircleCollider,
+
+    properties: {
+        //bodyParentNode: null,
+        gameScene: null,
+        head:null,
+        body:[cc.Node],
+        size:40,//大小,直径
+        //bodySize: this.radius 子类CircleCollider的变量
+        score: 0,
+        color:null,
+        bodyLength: {
+            get: function (){
+                return this.score / Math.pow(this.body[0].scaleX * this.body[0].scaleY,1.5);
+            }
+        },
+        skin:null,
+        nameLabel:null,
+    },
+
+    setScore:function(score){
+        this.score = score;
+        this.updateScale();
+        var targetBodyLength = Math.ceil(this.bodyLength);
+        while(targetBodyLength > this.body.length){
+            this.addBody();
+        }
+        while(targetBodyLength < this.body.length && this.body.length > 1){
+            this.removeBody();
+        }
+    },
+    updateScale:function(){
+        var newScale = Math.pow(1+(this.score - 10)/50,1.0/3);
+        for(var i=0;i<this.body.length;++i){
+            this.body[i].scaleX = newScale;
+            this.body[i].scaleY = newScale;
+        }
+    },
+    addEyeGraphic:function(node){
+        var graphics = node.addComponent(cc.Graphics,10);
+        graphics.clear();
+        graphics.circle(12, 10, 10);
+        graphics.circle(12, -10, -10);
+        graphics.fillColor = cc.Color.WHITE;
+        graphics.fill();
+        graphics.circle(13, 9, 6);
+        graphics.circle(13, -9, 6);
+        graphics.fillColor = cc.Color.BLACK;
+        graphics.fill();
+        return graphics;
+    },
+    addGraphic:function(node){
+        var graphics = node.addComponent(cc.Graphics);
+        graphics.clear();
+        graphics.circle(0, 0, this.radius);
+        graphics.fillColor = cc.Color.YELLOW;
+        graphics.fill();
+        graphics.circle(15, 0, 5);
+        graphics.fillColor = cc.Color.RED;
+        graphics.fill();
+        return graphics;
+    },
+    addGraphic2:function(node){
+        var graphics = node.addComponent(cc.Graphics);
+        graphics.clear();
+        graphics.circle(0, 0, this.radius);
+        graphics.fillColor = cc.Color.YELLOW;
+        graphics.fill();
+        graphics.circle(-15, 0, 5);
+        graphics.fillColor = cc.Color.GRAY;
+        graphics.fill();
+    },    
+    addHead:function(){
+        this.head = new cc.Node('head');
+        this.body.push(this.head);
+        this.head.parent = this.node;
+        this.head.rotation = Math.random() * 360;
+        //Graphic.
+        var eyeNode = new cc.Node();
+        eyeNode.parent = this.head;
+        eyeNode.zIndex = 3;
+        var Graphic = this.addEyeGraphic(eyeNode);
+
+        this.nameLabel = o0CC.addScriptNode(this.head,'cc.Label',20);
+        this.nameLabel.horizontalAlign = cc.Label.HorizontalAlign.CENTER;
+        this.nameLabel.verticalAlign = cc.Label.VerticalAlign.TOP;
+        this.nameLabel.node.color = new cc.Color(255,255,255);
+        this.nameLabel.node.anchorX = 0;
+        this.nameLabel.node.anchorY = 0;
+        this.nameLabel.node.x = 0;
+        this.nameLabel.node.y = 0;
+        this.nameLabel.node.height = 300;
+        this.nameLabel.fontSize = 20;
+        this.nameLabel.node.anchorX = 0.5;
+        this.nameLabel.node.anchorY = 0.5;
+        
+        var graphics = this.head.addComponent('cc.Graphics');
+        o0CC.setGroup(graphics,o0Game.GroupIndex.Head);
+    },
+    addBody:function(){
+        if(this.node.active == false)
+            return;
+        var i = this.body.length;
+        this.body.push(new cc.Node('body'+i));
+        this.node.addChild(this.body[i],-i);
+        this.body[i].x = this.body[i-1].x;
+        this.body[i].y = this.body[i-1].y;
+        this.body[i].rotation = this.body[i-1].rotation;
+
+        var collider = this.body[i].addComponent('cc.CircleCollider');
+        //collider.tag = o0Game.CollisionTag.Body;
+        collider.radius = this.radius;
+
+        var sprite = o0CC.addScriptNode(this.body[this.body.length-1],'cc.Sprite',2);
+        //var sprite = this.body[this.body.length-1].addComponent(cc.Sprite,0);
+        sprite.trim = true;
+        sprite.type = cc.Sprite.Type.SLICED;
+        sprite.sizeMode = cc.Sprite.SizeMode.CUSTOM;
+        sprite.SrcBlendFactor = cc.macro.BlendFactor.SRC_ALPHA;
+        sprite.DstBlendFactor = cc.macro.BlendFactor.ONE_MINUS_SRC_ALPHA;
+        sprite.node.width = this.size;
+        sprite.node.height = this.size;
+        cc.loader.loadRes('snake/'+this.skin[(this.body.length-1)%this.skin.length], cc.SpriteFrame, function (err, spriteFrame) {
+            sprite.spriteFrame = spriteFrame;
+        });
+        
+        var graphics = this.body[i].addComponent('cc.Graphics');
+        o0CC.setGroup(graphics,o0Game.GroupIndex.Body);
+    },
+    removeBody:function(){
+        if(this.body.length == 1)
+            return;
+        //this.body[this.body.length-1].getComponent('cc.CircleCollider').destroy();
+        this.body[this.body.length-1].destroy();
+        this.body.pop();
+    },
+    removeAllBody:function(){
+        for(;this.body.length>1;){
+            this.removeBody();
+        }
+    },
+
+    // use this for initialization
+    onLoad: function () {
+        this.radius = 20;//圆碰撞体的局部变量
+        this.color = o0CC.randomBrightColor();
+        this.addHead();
+		//cc.log('snake log');
+    },
+    start: function () {
+
+        var sprite = o0CC.addScriptNode(this.head,cc.Sprite,1);
+        //var sprite = this.head.addComponent(cc.Sprite,0);
+        sprite.trim = true;
+        sprite.type = cc.Sprite.Type.SLICED;
+        sprite.sizeMode = cc.Sprite.SizeMode.CUSTOM;
+        sprite.SrcBlendFactor = cc.macro.BlendFactor.SRC_ALPHA;
+        sprite.DstBlendFactor = cc.macro.BlendFactor.ONE_MINUS_SRC_ALPHA;        
+        sprite.node.width = this.size;
+        sprite.node.height = this.size;
+
+        //var sprite = this.body[0].getComponent(cc.Sprite);
+        cc.loader.loadRes('snake/'+this.skin[0], cc.SpriteFrame, function (err, spriteFrame) {
+            sprite.spriteFrame = spriteFrame;
+        });
+    },
+
+    lateUpdate:function(){
+        if(this.nameLabel!=null){ 
+            if(this.nameLabel.string==null||this.nameLabel.string==''){
+                this.nameLabel.string = this.name+'\n\n';/** */
+            }
+            this.nameLabel.node.rotation = -this.head.rotation;
+        }
+    },
+/*
+    // called every frame
+    update: function (dt) {
+    },
+    onCollisionEnter:function(other,self){
+    },
+    onCollisionExit:function(other,self){
+    },/** */
+    _onPreDestroy:function(){
+        //cc.log('dsada');
+        /*
+        while(this.body.length > 1){
+            this.removeBody();
+        }/** */
+    },/*
+    test:function(){
+        cc.log('snake');
+    },/** */
+});
+//module.exports = Snake;

+ 9 - 0
assets/Script/Snake/Snake.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "c1ad1221-8a14-4b06-b596-074de7a8e2dd",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/SnakeControl.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "e361c5c1-afda-4d87-aa91-4f828651e26e",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 267 - 0
assets/Script/SnakeControl/LocalControl.js

@@ -0,0 +1,267 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+
+cc.Class({
+    extends: cc.CircleCollider,
+
+    properties: {
+        speed: 1,//per frame
+        turningSpeed: 6,//degree per frame
+        normalSpeedRate: 1,//加速时的速度比率
+        speedingSpeedRate: 3,//加速时的速度比率
+        targetSpeedRate: 1,//当前速度比率
+        isSpeeding: {
+            get: function (){
+                return this.targetSpeedRate != this.normalSpeedRate;
+            }
+        },
+
+        targetVector:null,
+        
+        bodySpacingRate: 0.4,//rate of size
+        bodySpacing: 0,
+
+        pulledScore: 0,
+        pullScoreThreshold: {
+            get: function (){
+                return Math.pow(this.snake.body[0].scaleX * this.snake.body[0].scaleY,1) * 2;
+            }
+        },
+        pullScoreRate:0.7,//the rate means remove 1 score from snake, and 0.5 score will come out to be food. 
+        speedingScoreCost: 0.1,//score cost per frame speeding 
+        minScore: 5,
+        snake:null,
+        fixedTimer:null,
+    },
+    updateSpeed:function(){
+        this.speed = 5 * Math.pow(this.snake.body[0].scaleX * this.snake.body[0].scaleY,1.0/3);
+    },
+    updateBodySpacing:function(){
+        this.bodySpacing = this.radius*2 * this.bodySpacingRate * Math.sqrt(this.snake.body[0].scaleX * this.snake.body[0].scaleY);
+    },
+    setTargetSpeeding:function(bool){
+        if(!bool)
+            this.targetSpeedRate = this.normalSpeedRate;
+        else
+            this.targetSpeedRate = this.speedingSpeedRate;
+    },
+    setTargetVector:function(vector){
+        this.targetVector = vector;
+    },
+    removeTargetVector:function(){
+        this.setTargetVector(o0CC.vectorFromRotation(this.snake.head.rotation));
+    },
+    addScore: function (score) {
+        if(this.snake == null){
+            return;
+        }
+           
+        this.snake.setScore(this.snake.score + score);
+        //this.snake.score += score;
+        //this.snake.updateScale();
+        this.updateBodySpacing();
+        this.updateSpeed();
+        /*var targetBodyLength = Math.ceil(this.snake.bodyLength);
+        while(targetBodyLength > this.snake.body.length){
+            this.snake.addBody();
+        }/** */
+    },
+    pullFood: function (score) {
+        var newFood = o0CC.addScriptNode(this.snake.gameScene.foodNode,'Food',-100);
+        var lastBody = this.snake.body[this.snake.body.length-1];
+        var foodPosition = o0.randomInCircle2(lastBody,(this.radius-newFood.radius)*2);
+        newFood.node.x = foodPosition.x;
+        newFood.node.y = foodPosition.y;
+        newFood.score = score;
+        newFood.node.name = ''+(this.snake.gameScene.foodIDcounter++);
+    },
+    pullAllFood: function () {
+        var pullScoreThreshold = this.pullScoreThreshold;
+        while(this.snake.score >= 1){
+            this.pullScore(1,pullScoreThreshold);
+        }
+    },
+    pullScore:function(score){  
+        this.snake.setScore(this.snake.score - score);      
+        //this.snake.score -= score;
+        //this.snake.updateScale();
+        this.updateBodySpacing();
+        this.updateSpeed();
+        this.pulledScore += score * this.pullScoreRate;
+
+        var pullScoreThreshold;
+        if(arguments.length < 2){
+            pullScoreThreshold = this.pullScoreThreshold;
+        }else{
+            pullScoreThreshold = arguments[1];
+        }
+
+        if(this.pulledScore >= pullScoreThreshold){
+            this.pulledScore -= pullScoreThreshold;
+            this.pullFood(pullScoreThreshold);
+        }/*
+        var targetBodyLength = Math.ceil(this.snake.bodyLength);
+        while(targetBodyLength < this.snake.body.length && this.snake.body.length > 1){
+            this.snake.removeBody();
+        }/** */
+    },
+    updateSnakeBody:function(){
+        //cc.log(this.getComponent('Snake').body.length);
+        for(var i = 0, j = 1;j<this.snake.body.length;++i, ++j){
+            var targetVector = new o0.Vector2(this.snake.body[i].x-this.snake.body[j].x,this.snake.body[i].y-this.snake.body[j].y);
+            var moveDistance = targetVector.length - this.bodySpacing;
+            if(j==this.snake.body.length-1)
+                moveDistance += this.bodySpacing * (Math.ceil(this.snake.bodyLength)-this.snake.bodyLength)
+            targetVector = targetVector.mod;
+            this.snake.body[j].rotation = o0CC.rotationFromVector(targetVector);
+            if(moveDistance <= 0)
+                continue;
+            this.snake.body[j].x += targetVector.x * moveDistance;
+            this.snake.body[j].y += targetVector.y * moveDistance;/** */
+        }
+    },/** */
+    /*
+    destroySnake: function(){
+        this.node.active = false;//防止destory之前body再增长
+        while(this.snake.score >= 1){
+            this.pullScore(1);
+        }
+        while(this.snake.body.length > 1){
+            this.removeBody();
+        }
+        //cc.log(this.snake.score);
+        //this.destroy();
+    },/** */
+    pulsatingFeedback:function(){
+        if(this.isSpeeding && this.snake.score > this.minScore){
+            for(var i =0;i<this.snake.body.length;++i){
+                var graphics = this.snake.body[i].getComponent(cc.Graphics);
+                if(graphics==null){
+                    return;
+                }
+                graphics.clear();
+                var timeRemainder = Math.abs(((new Date()).getTime()/10 - i*2)%40-20);
+                for(var j = 0;j<timeRemainder;++j){
+                    graphics.circle(0, 0, this.radius+j);
+                    graphics.strokeColor = new cc.Color(255,255,255,(timeRemainder-j)*5);
+                    graphics.stroke();
+                }
+            }
+        }else{
+            for(var i =0;i<this.snake.body.length;++i){
+                var graphics = this.snake.body[i].getComponent(cc.Graphics);
+                if(graphics==null){
+                    return;
+                }
+                graphics.clear();
+            }
+        }
+    },
+
+
+    // use this for initialization
+    onLoad: function () {
+        this.snake = this.node.parent.getComponent('Snake');
+        this.radius = this.snake.size/2;
+        this.removeTargetVector();
+
+        this.snake.updateScale();
+        this.updateBodySpacing();
+        this.updateSpeed();
+    },
+    start: function () {
+        this.addScore(10);
+        //cc.log(this.snake.body.length);
+
+        this.fixedTimer = new o0.FixedTimerDT(60);
+    },
+    
+    // called every frame
+    update: function (dt) {
+        if(this.node == null || this.node.isValid == false){
+            cc.log("Memory leak: Control");
+        }
+
+
+        if(this.isValid == false || this.node == null || this.node.isValid == false || this.snake == null){
+            return;
+        }
+        //for(var t = 0;t<this.fixedTimer.fixedUpdateTimes(dt);++t){
+        for(var t = 0;t<1;++t){
+    
+            var speedRate;
+            if(this.snake.score <= this.minScore)
+                speedRate = this.normalSpeedRate;
+            else{
+                speedRate = this.targetSpeedRate;
+                if(speedRate != this.normalSpeedRate && speedRate == this.speedingSpeedRate)
+                    this.pullScore(this.speedingScoreCost);
+            }
+            for(var i = 0;i<speedRate;++i){
+                //移动蛇头
+                this.targetRotation = o0CC.rotationFromVector(this.targetVector);
+                this.snake.head.rotation = o0CC.nextRotation(this.snake.head.rotation,this.targetRotation,this.turningSpeed);
+                var moveVector = o0CC.vectorFromRotation(this.snake.head.rotation);
+                this.snake.body[0].x += moveVector.x*this.speed;
+                this.snake.body[0].y += moveVector.y*this.speed;/** */
+                
+                //////////////下面是移动蛇身
+                this.updateSnakeBody();
+            }
+        }
+        this.pulsatingFeedback();
+    },
+    onCollisionEnter:function(other,self){
+        if(other.node == null || other.node.active == false || this.node == null || this.node.active == false){//貌似能解决两蛇对撞导致卡死的bug
+            return;
+        }
+        if(self != this){
+            return;
+        }
+        if(other.node.groupIndex == o0Game.GroupIndex.Body){
+            //cc.log("aaaaaaaaaaaaaaaaaaa");
+            var selfBody = false;
+            if(this.snake.body.length > 1)
+                for(var i = 1; i<this.snake.body.length;++i){
+                    if(other.node == this.snake.body[i]){
+                        selfBody = true;
+                        break;
+                    }
+                }
+            if(selfBody == false){
+                this.pullAllFood();
+                this.snake.node.destroy();
+            }
+        }
+        if(other.node.groupIndex == o0Game.GroupIndex.Food){
+            this.addScore(other.score);
+            other.node.destroy();
+            //other.destroy();
+        }/* */
+    },
+    onCollisionExit:function(other,self){
+        if(other.node == null || other.node.active == false || this.node == null || this.node.active == false){//貌似能解决两蛇对撞导致卡死的bug
+            return;
+        }
+        if(self != this){
+            return;
+        }
+        if(other.node.groupIndex == o0Game.GroupIndex.PlayGround){
+            //this.o0Destroy();
+            this.pullAllFood();
+            this.snake.node.destroy();
+        }/* */
+    },
+
+/*
+    o0Destroy:function(){
+        this.node.active = false;
+        //this.node.removeComponent(this);
+        this.destroy();
+        this.node.destroy();
+    },/** */
+    _onPreDestroy:function(){
+    },
+});

+ 9 - 0
assets/Script/SnakeControl/LocalControl.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "71788621-b441-4e3f-85cf-abf368f9261d",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 63 - 0
assets/Script/SnakeControl/RemoteControl.js

@@ -0,0 +1,63 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+
+cc.Class({
+    extends: require('LocalControl'),
+
+    properties: {
+        remotePosition:null,
+    },
+    update: function (dt) {  
+        if(this.node == null || this.node.isValid == false){
+            cc.log("Memory leak: Control");
+        }
+
+        if(this.isValid == false || this.node == null || this.node.isValid == false || this.snake == null){
+            return;
+        }
+        this.updateBodySpacing();
+        this.updateSpeed();
+        //for(var t = 0;t<this.fixedTimer.fixedUpdateTimes(dt);++t){
+
+
+        
+        for(var t = 0;t<1;++t){
+
+            var speedRate;
+            if(this.snake.score <= this.minScore)
+                speedRate = this.normalSpeedRate;
+            else{
+                speedRate = this.targetSpeedRate;
+            }
+
+            for(var i = 0;i<speedRate;++i){
+                this.targetRotation = o0CC.rotationFromVector(this.targetVector);
+                this.snake.head.rotation = o0CC.nextRotation(this.snake.head.rotation,this.targetRotation,this.turningSpeed);
+
+                if(this.remotePosition!=null){
+                    //this.snake.head.x = this.remotePosition.x;
+                    //this.snake.head.y = this.remotePosition.y;
+                    var maximumSynchronizationDistance = this.speed*1.1;
+                    var targetVector = this.remotePosition.minus(new o0.Vector2(this.snake.head.x,this.snake.head.y));
+                    if(targetVector.length<=maximumSynchronizationDistance){
+                        this.snake.head.x = this.remotePosition.x;
+                        this.snake.head.y = this.remotePosition.y;
+                    }else{
+                        targetVector = targetVector.toLength(maximumSynchronizationDistance+(targetVector.length-maximumSynchronizationDistance)*0.2);
+                        this.snake.head.x += targetVector.x;
+                        this.snake.head.y += targetVector.y;
+                    }
+                }
+
+                this.updateSnakeBody();
+            }
+        }
+        this.pulsatingFeedback();
+    },
+    onCollisionEnter:function(other,self){
+    },
+    onCollisionExit:function(other,self){
+    },//必须覆盖为空白
+});

+ 9 - 0
assets/Script/SnakeControl/RemoteControl.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "166f54e8-1030-4a8e-ba18-2a54225ec665",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 25 - 0
assets/Script/SnakeControl/SkinSampleControl.js

@@ -0,0 +1,25 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+
+cc.Class({
+    extends: require('LocalControl'),
+
+    properties: {
+        targetPosition:null,
+    },
+    start: function () {
+
+        //this.fixedTimer = new o0.FixedTimerDT(60);
+    },
+    update: function (dt) {
+        this._super();
+        
+        var transferVector = this.targetPosition.minus(this.snake.head);
+        for(var i = 0;i<this.snake.body.length;++i){
+            this.snake.body[i].x += transferVector.x;
+            this.snake.body[i].y += transferVector.y;
+        }/** */
+    },
+});

+ 9 - 0
assets/Script/SnakeControl/SkinSampleControl.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "9271605a-eebc-4948-91c2-dc9269ab0429",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/SnakeInput.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "0348b7de-242a-4117-aac2-0a1fd148003f",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 48 - 0
assets/Script/SnakeInput/SnakeAIInput.js

@@ -0,0 +1,48 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+
+cc.Class({
+    extends: require('SnakePositionInput'),
+    properties: {
+        viewRate:10,
+        patientTimer:null,
+        targetFoodNode:null,
+    },
+    // use this for initialization
+    onLoad: function () {
+        this._super();
+        this.setControllByPosition(true);
+        this.patientTimer = new o0.Timer(3);
+    },
+    update: function (dt) {
+        if(this.control == null || this.control.snake == null){
+            return;
+        }
+        this.radius = this.control.snake.radius*this.viewRate;
+
+        //可以修改的部分
+        //this.setTargetSpeeding(false);//设置是否加速
+        //this.setTargetVector();//设置目标方向
+
+        if(this.targetFoodNode == null || this.patientTimer.tryNextTiming()){
+            //this.setControllByPosition(false);
+            this.setTargetPosition(new o0.Vector2(0,0));
+            this.targetFoodNode = null;
+        }
+        this._super();
+    },
+    onCollisionStay:function(other,self){
+        if(other.node == null || other.node.active == false || this.node == null || this.node.active == false){//貌似能解决两蛇对撞导致卡死的bug
+            return;
+        }
+        if(this.targetFoodNode == null && other.node.groupIndex == o0Game.GroupIndex.Food){
+            //cc.log('dsadad');
+            this.targetFoodNode = other.node;
+            this.setTargetPosition(new o0.Vector2(this.targetFoodNode));
+            //this.setControllByPosition(true);
+            this.patientTimer.nextTiming();
+        }/* */
+    },
+});

+ 9 - 0
assets/Script/SnakeInput/SnakeAIInput.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "321b2fe1-083e-4186-9082-abc55873f901",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 50 - 0
assets/Script/SnakeInput/SnakeAccelerometerInput.js

@@ -0,0 +1,50 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+cc.Class({
+    extends: require('SnakeDirectionInput'),
+    properties: {
+    },
+    
+    onDeviceMotionEvent (event) {
+        this.setTargetVector(new o0.Vector2(event.acc).mod);
+        //cc.log(event.acc.x + "   " + event.acc.y);
+    },
+
+    // use this for initialization
+    onLoad: function () {
+        this._super();
+        var self = this;
+        
+        var listener = {
+            event: cc.EventListener.TOUCH_ONE_BY_ONE,
+            onTouchBegan: function (touch, event) {
+                self.setTargetSpeeding(true);
+                return true;
+            },
+            onTouchMoved: function (touch, event) {
+                return true;
+            },
+            onTouchEnded: function (touch, event) {
+                self.setTargetSpeeding(false);
+                return true;
+            },
+        }
+        cc.eventManager.addListener(listener, this.node);
+
+        cc.systemEvent.setAccelerometerEnabled(true);
+        cc.systemEvent.on(cc.SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
+    },
+    start: function (dt) {
+    },
+    update: function (dt) {
+    },/*
+    test:function(){
+        cc.log('mouse snake');
+    },/** */
+
+    onDestroy () {
+        cc.systemEvent.off(cc.SystemEvent.EventType.DEVICEMOTION, this.onDeviceMotionEvent, this);
+    },
+});

+ 9 - 0
assets/Script/SnakeInput/SnakeAccelerometerInput.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "3f22d33e-d675-4282-a3f1-f17ea22749b6",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/SnakeInput/SnakeInputBasic.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "66af5514-299e-4a2f-8df1-eaeb8ef759ba",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 36 - 0
assets/Script/SnakeInput/SnakeInputBasic/SnakeDirectionInput.js

@@ -0,0 +1,36 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+
+cc.Class({
+    extends: cc.CircleCollider,
+    properties: {
+        control:null,
+    },
+    setTargetSpeeding:function(bool){
+        if(this.control==null){
+            return;
+        }
+        this.control.setTargetSpeeding(bool);
+    },
+    setTargetVector:function(vector){
+        if(this.control==null){
+            return;
+        }
+        this.control.setTargetVector(vector);
+    },
+    removeTargetVector:function(vector){
+        if(this.control==null){
+            return;
+        }
+        this.control.removeTargetVector(vector);
+    },
+    // use this for initialization
+    onLoad: function () {
+        this.control = this.node.getComponent('LocalControl');
+    },
+    update: function (dt) {
+        if(this.node == null || this.node.isValid == false){
+            cc.log("Memory leak: Input");
+        }
+    },
+});

+ 9 - 0
assets/Script/SnakeInput/SnakeInputBasic/SnakeDirectionInput.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "18b9b185-dda7-4124-9598-b732317d1ec8",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 26 - 0
assets/Script/SnakeInput/SnakeInputBasic/SnakePositionInput.js

@@ -0,0 +1,26 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+
+cc.Class({
+    extends: require('SnakeDirectionInput'),
+    properties: {
+        targetPosition: null,
+        controllByPosition: true,
+    },
+    setTargetPosition:function(position){
+        this.targetPosition = position;
+    },
+    setControllByPosition:function(bool){
+        this.controllByPosition = bool;
+    },
+    // use this for initialization
+    onLoad: function () {
+        this.targetPosition = new o0.Vector2(1,0);
+        this._super();
+    },
+    update: function (dt) {
+        if(this.controllByPosition)
+            this.setTargetVector(this.targetPosition.minus(this.node).mod);
+        this._super();
+    },
+});

+ 9 - 0
assets/Script/SnakeInput/SnakeInputBasic/SnakePositionInput.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "63004849-b859-44ed-9cf3-e88c195ad300",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 20 - 0
assets/Script/SnakeInput/SnakeInputBasic/SnakeSteeringControl.js

@@ -0,0 +1,20 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+
+cc.Class({
+    extends: require('SnakeDirectionInput'),
+    properties: {
+        targetTurning: 0,
+    },
+    setTargetTurning:function(turning){
+        this.targetTurning = turning;
+    },
+    // use this for initialization
+    onLoad: function () {
+        this._super();
+    },
+    update: function (dt) {
+        this.control.setTargetVector(o0CC.vectorFromRotation(this.control.snake.head.rotation+this.targetTurning));
+        this._super();
+    },
+});

+ 9 - 0
assets/Script/SnakeInput/SnakeInputBasic/SnakeSteeringControl.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "6c2737ff-1793-4caa-a1ed-c81d1ca5a666",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 112 - 0
assets/Script/SnakeInput/SnakeJoystickInput.js

@@ -0,0 +1,112 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+cc.Class({
+    extends: require('SnakeDirectionInput'),
+    properties: {
+        touchLocation: null,
+        moveLocation: null,
+        speedingButton:null,
+    },
+    // use this for initialization
+    onLoad: function () {
+        this._super();
+        var self = this;
+        
+        this.speedingButton = o0CC.addScriptNode(this.control.snake.node,'o0CCButton',10);
+        o0CC.setGroup(this.speedingButton,o0Game.GroupIndex.UI);
+        this.speedingButton.node.x = this.control.snake.gameScene.canvas.node.width/2-150;
+        this.speedingButton.node.y = 0;
+        this.speedingButton.node.width = 80;
+        this.speedingButton.node.height = 80;/** */
+        this.speedingButton.name = 'Boost';
+        this.speedingButton.node.on(cc.Node.EventType.TOUCH_START, function (event) {
+            self.setTargetSpeeding(true);
+        }, this);
+        this.speedingButton.node.on(cc.Node.EventType.TOUCH_END, function (event) {
+            self.setTargetSpeeding(false);
+        }, this);/** */
+
+
+
+        var touchGraphic = o0CC.addScriptNode(this.control.snake.node,cc.Graphics,9);
+        o0CC.setGroup(touchGraphic,o0Game.GroupIndex.UI);
+        //touchGraphic.groupIndex = o0Game.GroupIndex.UI;
+        touchGraphic.clear();
+        touchGraphic.circle(0, 0, 25);
+        touchGraphic.fillColor = new cc.Color(255,255,255,200);
+        touchGraphic.fill();
+        touchGraphic.node.x = -this.control.snake.gameScene.canvas.node.width/2+200;
+        touchGraphic.node.y = -this.control.snake.gameScene.canvas.node.height/2+200;
+        var moveGraphic = o0CC.addScriptNode(this.control.snake.node,cc.Graphics,10);
+        o0CC.setGroup(moveGraphic,o0Game.GroupIndex.UI);
+        //moveGraphic.groupIndex = o0Game.GroupIndex.UI;
+        moveGraphic.clear();
+        moveGraphic.circle(0, 0, 20);
+        moveGraphic.fillColor = new cc.Color(255,255,255,150);
+        moveGraphic.fill();
+        moveGraphic.node.x = -this.control.snake.gameScene.canvas.node.width/2+200;
+        moveGraphic.node.y = -this.control.snake.gameScene.canvas.node.height/2+200;
+
+        this.touchLocation = new o0.Vector2(1,0);
+        //TOUCH_ONE_BY_ONE
+        //TOUCH_ALL_AT_ONCE
+        var listener = {
+            event: cc.EventListener.TOUCH_ONE_BY_ONE,
+            onTouchBegan: function (touch, event) {
+                if(self.control == null){
+                    return false;
+                }
+                self.touchLocation = touch.getLocation();
+                var localTouchLocation = self.control.snake.node.parent.convertToNodeSpaceAR(self.touchLocation);
+                touchGraphic.node.active = true;
+                touchGraphic.node.x = localTouchLocation.x;
+                touchGraphic.node.y = localTouchLocation.y;
+                return true;
+            },
+            onTouchMoved: function (touch, event) {
+                if(self.control == null){
+                    return false;
+                }
+
+                self.moveLocation = touch.getLocation();
+                var localTouchLocation = self.control.snake.node.parent.convertToNodeSpaceAR(self.touchLocation);
+                var localMoveLocation = self.control.snake.node.parent.convertToNodeSpaceAR(self.moveLocation);
+                var vector = new o0.Vector2(localMoveLocation).minus(localTouchLocation);
+                if(vector.length > 35){
+                    vector = vector.toLength(35);
+                }
+                moveGraphic.node.active = true;
+                moveGraphic.node.x = touchGraphic.node.x + vector.x;
+                moveGraphic.node.y = touchGraphic.node.y + vector.y;
+                return true;
+            },
+            onTouchEnded: function (touch, event) {
+                self.touchLocation = null;
+                if(touchGraphic.node!=null){
+                    touchGraphic.node.active = false;
+                }
+                if(moveGraphic.node!=null){
+                    moveGraphic.node.active = false;
+                }
+                return true;
+            },
+        }
+        cc.eventManager.addListener(listener, this.node);
+    },
+    start: function (dt) {
+    },
+    update: function (dt) {
+        this._super();
+        if(this.touchLocation == null || this.moveLocation == null){
+            return;
+        }
+        var localTouchLocation = this.node.parent.convertToNodeSpaceAR(this.touchLocation);
+        var localMoveLocation = this.node.parent.convertToNodeSpaceAR(this.moveLocation);
+        this.setTargetVector(new o0.Vector2(localMoveLocation).minus(localTouchLocation).mod);
+    },/*
+    test:function(){
+        cc.log('mouse snake');
+    },/** */
+});

+ 9 - 0
assets/Script/SnakeInput/SnakeJoystickInput.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "490c9af7-769e-4c48-9bdf-9498b74a8070",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 66 - 0
assets/Script/SnakeInput/SnakeKeyboardArrowkeyInput.js

@@ -0,0 +1,66 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+
+
+cc.Class({
+    extends: require('SnakeDirectionInput'),
+    properties: {
+        keyDirection:null,
+        key:null,
+        speedingKey:0,
+    },
+    onLoad: function () {
+        this._super();
+
+        cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this);
+        cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP, this.onKeyUp, this);
+
+        this.keyDirection = new Array();
+        this.keyDirection[cc.macro.KEY.right] = new o0.Vector2(1,0);
+        this.keyDirection[cc.macro.KEY.left] = new o0.Vector2(-1,0);
+        this.keyDirection[cc.macro.KEY.up] = new o0.Vector2(0,1);
+        this.keyDirection[cc.macro.KEY.down] = new o0.Vector2(0,-1);
+        this.keyDirection[cc.macro.KEY.d] = new o0.Vector2(1,0);
+        this.keyDirection[cc.macro.KEY.a] = new o0.Vector2(-1,0);
+        this.keyDirection[cc.macro.KEY.w] = new o0.Vector2(0,1);
+        this.keyDirection[cc.macro.KEY.s] = new o0.Vector2(0,-1);
+        this.key = new Array();
+        this.speedingKey = cc.macro.KEY.space;
+    },
+    onDestroy () {
+        cc.systemEvent.off(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this);
+        cc.systemEvent.off(cc.SystemEvent.EventType.KEY_UP, this.onKeyUp, this);      
+    },
+    update: function (dt) {
+        var targetVector = new o0.Vector2(0,0);
+        for(var _key in this.keyDirection){
+            if(this.key[_key] == true){
+                targetVector = targetVector.plus(this.keyDirection[_key]);
+            }
+        }
+        if(this.keyDirection.length != 0 && targetVector.length != 0){
+            this.setTargetVector(targetVector.mod);
+        }else{
+            this.removeTargetVector();
+        }
+        
+        this._super();
+    },
+
+    onKeyDown: function (event) {
+        if(this.keyDirection[event.keyCode] != null){
+            this.key[event.keyCode] = true;
+        }
+        if(event.keyCode == this.speedingKey){
+            this.setTargetSpeeding(true);   
+        }
+    },
+    onKeyUp: function (event) {
+        if(this.keyDirection[event.keyCode] != null){
+            this.key[event.keyCode] = false;
+        }
+        if(event.keyCode == this.speedingKey){
+            this.setTargetSpeeding(false);  
+        }
+    }
+});

+ 9 - 0
assets/Script/SnakeInput/SnakeKeyboardArrowkeyInput.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "7dfd599a-809e-4169-b7c0-3388bb65d145",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 57 - 0
assets/Script/SnakeInput/SnakeKeyboardSteeringInput.js

@@ -0,0 +1,57 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+
+
+cc.Class({
+    extends: require('SnakeSteeringControl'),
+    properties: {
+        keyTurning:null,
+        key:null,
+        speedingKey:0,
+    },
+    onLoad: function () {
+        this._super();
+
+        cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this);
+        cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP, this.onKeyUp, this);
+
+        this.keyTurning = new Array();
+        this.keyTurning[cc.macro.KEY.right] = 90;
+        this.keyTurning[cc.macro.KEY.left] = -90;
+        this.keyTurning[cc.macro.KEY.d] = 90;
+        this.keyTurning[cc.macro.KEY.a] = -90;
+        this.key = new Array();
+        this.speedingKey = cc.macro.KEY.space;
+    },
+    onDestroy () {
+        cc.systemEvent.off(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this);
+        cc.systemEvent.off(cc.SystemEvent.EventType.KEY_UP, this.onKeyUp, this);      
+    },
+    update: function (dt) {
+        var targetTurning = 0;
+        for(var _key in this.keyTurning){
+            if(this.key[_key] == true){
+                targetTurning+=this.keyTurning[_key];
+            }
+        }
+        this.setTargetTurning(targetTurning);
+        this._super();
+    },
+
+    onKeyDown: function (event) {
+        if(this.keyTurning[event.keyCode] != null){
+            this.key[event.keyCode] = true;
+        }
+        if(event.keyCode == this.speedingKey){
+            this.setTargetSpeeding(true);   
+        }
+    },
+    onKeyUp: function (event) {
+        if(this.keyTurning[event.keyCode] != null){
+            this.key[event.keyCode] = false;
+        }
+        if(event.keyCode == this.speedingKey){
+            this.setTargetSpeeding(false);  
+        }
+    }
+});

+ 9 - 0
assets/Script/SnakeInput/SnakeKeyboardSteeringInput.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "1bff49ca-82ef-4147-a9c9-6a47fe102cf2",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 40 - 0
assets/Script/SnakeInput/SnakeMouseInput.js

@@ -0,0 +1,40 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+
+cc.Class({
+    extends: require('SnakeDirectionInput'),
+    properties: {
+        mouseLocation: null,
+    },
+    // use this for initialization
+    onLoad: function () {
+        this._super();
+        var self = this;
+        
+        this.mouseLocation = new o0.Vector2(1,0);
+        
+        var listener = {
+            event: cc.EventListener.MOUSE,
+            onMouseDown: function (event) {
+                self.setTargetSpeeding(true);   
+            },
+            onMouseUp: function (event) {
+                self.setTargetSpeeding(false);
+            },
+            onMouseMove: function (event) {
+                self.mouseLocation = event.getLocation();
+            },
+            onMouseScroll: function (event) {
+            }
+        }
+        cc.eventManager.addListener(listener, this.node);
+    },
+    update: function (dt) {
+        this._super();
+        var localLocation = this.node.parent.convertToNodeSpaceAR(this.mouseLocation);
+        this.setTargetVector(new o0.Vector2(localLocation).mod);
+    },/*
+    test:function(){
+        cc.log('mouse snake');
+    },/** */
+});

+ 9 - 0
assets/Script/SnakeInput/SnakeMouseInput.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "b6b4347a-ad7c-4a99-b011-ce2201c83820",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 63 - 0
assets/Script/SnakeInput/SnakeTouchInput.js

@@ -0,0 +1,63 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+cc.Class({
+    extends: require('SnakeDirectionInput'),
+    properties: {
+        touchLocation: null,
+        speedingButton:null,
+    },
+    // use this for initialization
+    onLoad: function () {
+        this._super();
+        var self = this;
+        
+        this.speedingButton = o0CC.addScriptNode(this.control.snake.node,'o0CCButton',10);
+        o0CC.setGroup(this.speedingButton,o0Game.GroupIndex.UI);
+        this.speedingButton.node.x = this.control.snake.gameScene.canvas.node.width/2-150;
+        this.speedingButton.node.y = 0;
+        this.speedingButton.node.width = 80;
+        this.speedingButton.node.height = 80;/** */
+        this.speedingButton.name = 'Boost';
+        this.speedingButton.node.on(cc.Node.EventType.TOUCH_START, function (event) {
+            self.setTargetSpeeding(true);
+        }, this);
+        this.speedingButton.node.on(cc.Node.EventType.TOUCH_END, function (event) {
+            self.setTargetSpeeding(false);
+        }, this);/** */
+
+
+
+
+        this.touchLocation = new o0.Vector2(1,0);
+        //TOUCH_ONE_BY_ONE
+        //TOUCH_ALL_AT_ONCE
+        var listener = {
+            event: cc.EventListener.TOUCH_ONE_BY_ONE,
+            onTouchBegan: function (touch, event) {
+                self.touchLocation = touch.getLocation();
+                return true;
+            },
+            onTouchMoved: function (touch, event) {
+                self.touchLocation = touch.getLocation();
+                return true;
+            },
+            onTouchEnded: function (touch, event) {
+                self.touchLocation = touch.getLocation();
+                return true;
+            },
+        }
+        cc.eventManager.addListener(listener, this.node);
+    },
+    start: function (dt) {
+    },
+    update: function (dt) {
+        this._super();
+        var localLocation = this.node.parent.convertToNodeSpaceAR(this.touchLocation);
+        this.setTargetVector(new o0.Vector2(localLocation).mod);
+    },/*
+    test:function(){
+        cc.log('mouse snake');
+    },/** */
+});

+ 9 - 0
assets/Script/SnakeInput/SnakeTouchInput.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "69c5b716-53b7-4007-986f-d316a98cc392",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Script/o0Lib.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "80899f3a-27bb-4f14-9cf3-54bdc38f98cb",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 457 - 0
assets/Script/o0Lib/o0.js

@@ -0,0 +1,457 @@
+module.exports = {
+    Timer: class{
+        constructor(second) {
+            this.interval = second * 1000;
+            this.nextTiming();
+        }
+        get isDue(){
+            return new Date().getTime() - this.date.getTime() >= this.interval;
+        }
+        nextTiming(){
+            this.date = new Date();
+        }
+        tryNextTiming(){
+            if(!this.isDue){
+                return false;
+            }
+            this.nextTiming();
+            return true;
+        }
+    },
+    FixedTimer:class{
+        constructor(fps) {
+            this.fps = fps;
+            this.updateInterval = 1000.0/fps;
+            this.remainder = 0;
+            this.nextTiming();
+        }
+        nextTiming(){
+            this.date = new Date();
+        }
+        fixedUpdateTimes(){
+            var newTime = new Date();
+            var interval = newTime.getTime() - this.date.getTime() + this.remainder;
+            this.date = newTime;
+            this.remainder = interval % this.updateInterval;
+
+            return parseInt(interval / this.updateInterval);
+        }
+    },
+    FixedTimerDT:class{
+        constructor(fps) {
+            this.fps = fps;
+            this.updateInterval = 1000.0/fps;
+            this.remainder = 0;
+        }
+        fixedUpdateTimes(dt){//time in second
+            var interval = dt*1000 + this.remainder;
+            this.remainder = interval % this.updateInterval;
+
+            //cc.log(parseInt(interval / this.updateInterval));
+            return parseInt(interval / this.updateInterval);
+        }
+    },
+    QuadraticEquation: class{
+        constructor(x1,y1,x2,y2,x3,y3){
+            this.a = y1 / (x1 - x2) / (x1 - x3) + y2 / (x2 - x1) / (x2 - x3) + y3 / (x3 - x1) / (x3 - x2);
+            this.b = -y1 * (x2 + x3) / (x1 - x2) / (x1 - x3) - y2 * (x1 + x3) / (x2 - x1) / (x2 - x3) - y3 * (x1 + x2) / (x3 - x1) / (x3 - x2);
+            this.c = y1 * x2 * x3 / (x1 - x2) / (x1 - x3) + y2 * x1 * x3 / (x2 - x1) / (x2 - x3) + y3 * x1 * x2 / (x3 - x1) / (x3 - x2);
+        }
+        y(x){
+            //console.log(this.a+" "+this.b+" "+this.c);
+            return this.a*x*x +this.b*x +this.c;
+        }
+    },
+    Vector2: class{
+        constructor() {
+            switch(arguments.length) {
+                default:
+              case 1:
+              this.x = arguments[0].x;
+              this.y = arguments[0].y;
+                break;
+              case 2:
+              this.x = arguments[0];
+              this.y = arguments[1];
+                break;
+            }
+        }
+        get length(){
+            if(this.x == 0 && this.y == 0)
+                return 0;
+            return Math.sqrt(this.x*this.x+this.y*this.y);
+        }/** */
+        get mod(){
+            var length = this.length;
+            return new this.constructor(this.x/length,this.y/length);
+        }/**/
+        radian(anotherVector){//都必须是长度为1的vector
+            let thisMod = this.mod;
+            let anotherMod = anotherVector.mod;
+            return Math.asin(Math.sqrt(Math.pow(thisMod.x - anotherMod.x,2)+Math.pow(thisMod.y - anotherMod.y,2))/2)*2; 
+        }
+        angle(anotherModVector){
+            return this.radian(anotherModVector)/Math.PI*180; 
+        }
+        rotate(radian){
+            var cosRadian = Math.cos(radian);
+            var sinRadian = Math.sin(radian);
+            return new this.constructor(this.x * cosRadian + this.y * sinRadian, this.y * cosRadian - this.x * sinRadian);
+        }
+        rotateAngle(angle){
+            return this.rotate(angle / 180 * Math.PI);
+        }
+        plus(anotherVector){
+            return new this.constructor(this.x + anotherVector.x, this.y + anotherVector.y);
+        }
+        minus(anotherVector){
+            return new this.constructor(this.x - anotherVector.x, this.y - anotherVector.y);
+        }
+        multiply(num){
+            return new this.constructor(this.x * num, this.y * num);
+        }
+        toLength(length){
+            var mod = this.mod;
+            return new this.constructor(mod.x * length, mod.y * length);
+        }
+    },
+    Line2:class{
+        constructor() {
+            switch(arguments.length) {
+                default:
+              case 1:
+              this.a = arguments[0].a;
+              this.b = arguments[0].b;
+                break;
+              case 2:
+              this.a = arguments[0];
+              this.b = arguments[1];
+                break;
+              case 4:
+              this.a = new module.exports.Vector2(arguments[0],arguments[1]);
+              this.b = new module.exports.Vector2(arguments[2],arguments[3]);
+                break;
+            }
+        }
+        vertex(index){
+            switch(index){
+                default:
+                case 0:
+                    return this.a;
+                case 1:
+                    return this.b;
+            }
+        }
+        get vector(){
+            return this.b.minus(this.a);
+        }
+        get length(){
+            return this.vector.length;
+        }
+    },
+    Rect:class{
+        constructor() {
+            switch(arguments.length) {
+                default:
+              case 1:
+              this.position = arguments[0].position;
+              this.size = arguments[0].size;
+                break;
+              case 2:
+              this.position = arguments[0];
+              this.size = arguments[1];
+                break;
+              case 4:
+              this.position = new module.exports.Vector2(arguments[0],arguments[1]);
+              this.size = new module.exports.Vector2(arguments[2],arguments[3]);
+                break;
+            }
+        }
+        vertex(index){
+            switch(index){
+                default:
+                case 0:
+                    return this.position;
+                case 1:
+                    return new module.exports.Vector2(this.position.x,this.position.y+this.size.y);
+                case 2:
+                    return this.position.plus(this.size);
+                case 3:
+                    return new module.exports.Vector2(this.position.x+this.size.x,this.position.y);
+            }
+        }//Clockwise
+        edge(index){
+            switch(index){
+                default:
+                case 0:
+                    return new module.exports.Line2(this.vertex(0),this.vertex(1));
+                case 1:
+                    return new module.exports.Line2(this.vertex(1),this.vertex(2));
+                case 2:
+                    return new module.exports.Line2(this.vertex(2),this.vertex(3));
+                case 3:
+                    return new module.exports.Line2(this.vertex(3),this.vertex(0));
+            }
+        }//Clockwise
+        get vertexs(){
+            var edges = [];
+            for(var i = 0;i<4;++i){
+                edges.push(this.vertex(i));
+            }
+            return edges;
+        }
+        get edges(){
+            var edges = [];
+            for(var i = 0;i<4;++i){
+                edges.push(this.edge(i));
+            }
+            return edges;
+        }
+        get pos(){
+            return this.position;
+        }
+        set pos(value){
+            this.position = value;
+        }
+        get x(){
+            return this.position.x;
+        }
+        set x(value){
+            this.position.x = value;
+        }
+        get y(){
+            return this.position.y;
+        }
+        set y(value){
+            this.position.y = value;
+        }
+        get width(){
+            return this.size.x;
+        }
+        set width(value){
+            this.size.x = value;
+        }
+        get height(){
+            return this.size.y;
+        }
+        set height(value){
+            this.size.y = value;
+        }
+    },
+    Vector3: class{
+        constructor() {
+            switch(arguments.length) {
+                default:
+                case 1:
+                    this.x = arguments[0].x;
+                    this.y = arguments[0].y;
+                    this.z = arguments[0].z;
+                    break;
+                case 3:
+                    this.x = arguments[0];
+                    this.y = arguments[1];
+                    this.z = arguments[2];
+                    break;
+            }
+        }
+        get length(){
+            if(this.x == 0 && this.y == 0 && this.z == 0)
+                return 0;
+            return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);
+        }/** */
+        get mod(){
+            var length = this.length;
+            return new this.constructor(this.x/length,this.y/length,this.z/length);
+        }
+        plus(anotherVector){
+            return new this.constructor(this.x + anotherVector.x, this.y + anotherVector.y, this.z + anotherVector.z);
+        }
+        minus(anotherVector){
+            return new this.constructor(this.x - anotherVector.x, this.y - anotherVector.y, this.z - anotherVector.z);
+        }
+        multiply(num){
+            return new this.constructor(this.x * num, this.y * num, this.z * num);
+        }
+        toLength(length){
+            var mod = this.mod;
+            return new this.constructor(mod.x * length, mod.y * length, mod.z * length);
+        }
+    },
+    isSameSign:function(a,b){
+        if((a>=0&&b>=0)||(a<=0&&b<=0)){
+            return true;
+        }
+        return false;
+    },
+    distance2:function(a,b){
+        var distance = Math.sqrt(Math.pow(a.x-b.x,2)+Math.pow(a.y-b.y,2));
+        switch(arguments.length) {
+            default:
+            case 2:
+                return distance;
+            case 3:
+                var vector = arguments[2];//vector must be in same line with a b
+                if(module.exports.isSameSign(b.x - a.x,vector.x)&&module.exports.isSameSign(b.y - a.y,vector.y)){
+                    return distance;
+                }else{
+                    return -distance;
+                }
+        }
+    },
+    maxLengthLine2:function(vertexs){
+        if(vertexs.length==0){
+            return null;
+        }
+        if(vertexs.length==1){
+            return new module.exports.Line2(vertexs[0],vertexs[0]);
+        }
+        var maxLengthLine = null;
+        var maxLength = -1;
+        for(var i = 0;i<vertexs.length-1;++i){            
+            for(var j = i+1;j<vertexs.length;++j){
+                var newLine = new module.exports.Line2(vertexs[i],vertexs[j]);
+                var newLength = newLine.length;
+                if(maxLength < newLength){
+                    maxLength = newLength;
+                    maxLengthLine = newLine;
+                }
+            }
+        }
+        return maxLengthLine;
+    },
+    randomInCircle2:function(){
+        var center;//diameter
+        var size;//diameter
+        switch(arguments.length) {
+            default:
+            case 1:
+                center = new module.exports.Vector2(0,0);
+                size = arguments[0];
+                break;
+            case 2:
+                center = arguments[0];
+                size = arguments[1];
+                break;
+        }
+        return new module.exports.Vector2(1,0).rotate(Math.random() * Math.PI*2).toLength(Math.sqrt(Math.random()*Math.pow(size/2,2))).plus(center);
+    },
+    intersectionLineLine2:function(){//for 2D //https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection
+        var p11,p12,p21,p22;
+        switch(arguments.length) {
+            default:
+            case 4:
+                p11 = arguments[0];
+                p12 = arguments[1];
+                p21 = arguments[2];
+                p22 = arguments[3];
+                break;
+            case 2:
+                p11 = arguments[0].a;
+                p12 = arguments[0].b;
+                p21 = arguments[1].a;
+                p22 = arguments[1].b;
+                break;
+        }
+        var denominator = (p11.x-p12.x)*(p21.y-p22.y) - (p11.y-p12.y)*(p21.x-p22.x);
+        if(denominator == 0){
+            return null;
+        }
+        var t = ((p11.x-p21.x)*(p21.y-p22.y) - (p11.y-p21.y)*(p21.x-p22.x))/denominator;
+        var u = ((p11.x-p12.x)*(p11.y-p21.y) - (p11.y-p12.y)*(p11.x-p21.x))/denominator;
+        return new module.exports.Vector2(p11.x+t*(p12.x-p11.x),p11.y+t*(p12.y-p11.y));
+    },
+    arrangeInLine1:function(p1, p2, vector){//1维//vector为正,p1小于p2
+        var values = [];
+        for(var i =  Math.ceil(p1/vector)*vector;i<=p2;i+=vector){
+            values.push(i);
+        }
+        return values;
+    },
+    arrangeInLine2:function(){//3点必须在1线
+        //return [];
+        var p1, p2, origin, vector;
+        switch(arguments.length) {
+            default:
+            case 4:
+                p1 = arguments[0];
+                p2 = arguments[1];
+                origin = arguments[2];
+                vector = arguments[3];
+                break;
+            case 3:
+                if(arguments[0] == null){
+                    return [];
+                } 
+                p1 = arguments[0].a;
+                p2 = arguments[0].b;
+                origin = arguments[1];
+                vector = arguments[2];
+                break;
+        }
+        var begin,end;
+        if(module.exports.isSameSign(p2.x - p1.x,vector.x)&&module.exports.isSameSign(p2.y - p1.y,vector.y)){
+            begin = p1;
+            end = p2;
+        }else{
+            begin = p2;
+            end = p1;
+        }
+        if(module.exports.isSameSign(begin.x - origin.x,vector.x)&&module.exports.isSameSign(begin.y - origin.y,vector.y)){
+            begin = module.exports.distance2(origin,begin);
+        }else{
+            begin = -module.exports.distance2(origin,begin);
+        }
+        if(module.exports.isSameSign(end.x - origin.x,vector.x)&&module.exports.isSameSign(end.y - origin.y,vector.y)){
+            end = module.exports.distance2(origin,end);
+        }else{
+            end = -module.exports.distance2(origin,end);
+        }
+        var points = [];
+        var modVector = vector.mod;
+        var values = module.exports.arrangeInLine1(begin, end, vector.length);
+        for(var i = 0;i<values.length;++i){
+            points.push(origin.plus(modVector.multiply(values[i])));
+        }
+        return points;/** */        
+    },
+    pointOnLineSegment(line,point){
+        var acceptableError = line.length / 1000000;//存在计算误差
+        var v1 = line.a.minus(point);
+        var v2 = line.b.minus(point);
+        if(module.exports.isSameSign(v1.x,v2.x)&&module.exports.isSameSign(v1.y,v2.y)&&v1.length>=acceptableError&&v2.length>=acceptableError){//存在计算误差
+            return false;
+        }
+        return true;
+    },
+    lineSegmentInRect(rect,line){
+        var edge = rect.edges;
+        var ip = [];
+        for(var i = 0;i<edge.length;++i){
+            var newIp = module.exports.intersectionLineLine2(edge[i], line);
+            if(newIp != null &&module.exports.pointOnLineSegment(edge[i],newIp)){
+                ip.push(newIp);
+            }
+        }
+        return module.exports.maxLengthLine2(ip);/** */
+    },
+    arrangeInRect2:function(rect, origin, horizontalVector, verticalVector){
+        var ip = [];
+        for(var i = 0; i < 4;++i){
+            ip.push(module.exports.intersectionLineLine2(origin,origin.plus(verticalVector),rect.vertex(i),rect.vertex(i).plus(horizontalVector)));
+        }
+        if(module.exports.distance2(ip[0],ip[2]) > module.exports.distance2(ip[1],ip[3])){
+            ip = [ip[0],ip[2],ip[1],ip[3]];//verticalBegin;verticalEnd;horizontalBegin;horizontalEnd;
+        }else{
+            ip = [ip[1],ip[3],ip[0],ip[2]];//verticalBegin;verticalEnd;horizontalBegin;horizontalEnd;
+        }
+        var pos = [];
+        var verticalPoints = module.exports.arrangeInLine2(ip[0],ip[1],origin,verticalVector);
+        for(var i = 0; i<verticalPoints.length;++i){
+            var lineSegmentInRect = module.exports.lineSegmentInRect(rect,new module.exports.Line2(verticalPoints[i],verticalPoints[i].plus(horizontalVector)));//}/*
+            var horizontalPoints = module.exports.arrangeInLine2(lineSegmentInRect,verticalPoints[i],horizontalVector);
+            pos = pos.concat(horizontalPoints);
+        }
+        return pos;/** */
+        //return verticalPoints;
+    }
+};

+ 9 - 0
assets/Script/o0Lib/o0.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "895c0605-d91f-4eb4-ba5b-18365e541c6a",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 121 - 0
assets/Script/o0Lib/o0CC.js

@@ -0,0 +1,121 @@
+var o0 = require('o0');
+
+module.exports = {
+    /*
+    destroyNode: function(node) {
+        node.active = false;
+        var components = node.getComponents();
+        for(var i = 0;i<components.length;++i){
+            components[i].destroy();
+        }
+        node.destroy();
+    },/* */
+    addScriptNode: function(parentNode,script) {
+        var zIndex;
+        switch(arguments.length) {
+            default:
+            case 2:
+                zIndex = 0;
+                break;
+            case 3:
+                zIndex = arguments[2];
+                break;
+        }
+        var node = new cc.Node();
+        var scriptComponent = node.addComponent(script);
+        parentNode.addChild(node,zIndex);
+        return scriptComponent;
+    },
+    addSpriteNode: function(parentNode,imageNameInResourceFile) {
+        var zIndex;
+        switch(arguments.length) {
+            default:
+            case 2:
+                zIndex = 0;
+                break;
+            case 3:
+                zIndex = arguments[2];
+                break;
+        }
+        var node = new cc.Node();
+        parentNode.addChild(node,zIndex);
+        var sprite = node.addComponent(cc.Sprite);
+        cc.loader.loadRes(imageNameInResourceFile, cc.SpriteFrame, function (err, spriteFrame) {
+            sprite.spriteFrame = spriteFrame;
+        });
+        return sprite;
+    },
+    addGraphicNode: function(parentNode) {
+        var zIndex;
+        switch(arguments.length) {
+            default:
+            case 1:
+                zIndex = 0;
+                break;
+            case 2:
+                zIndex = arguments[1];
+                break;
+        }
+        var node = new cc.Node();
+        parentNode.addChild(node,zIndex);
+        var component = node.addComponent(cc.Graphics);
+        return component;
+    },
+    rotationFromVector: function(modVector){//rotation between 0-360 
+        var rotation = modVector.angle(new o0.Vector2(1,0));
+        if(modVector.y > 0)
+            rotation = 360-rotation;
+        return rotation;
+    },
+    vectorFromRotation: function(rotation){//rotation between 0-360 
+        var radian = rotation/180*Math.PI;
+        if(rotation<90)
+            return new o0.Vector2(Math.cos(radian),-Math.sin(radian));
+        if(rotation<180){
+            radian = Math.PI - radian;
+            return new o0.Vector2(-Math.cos(radian),-Math.sin(radian));
+        }
+        if(rotation<270){
+            radian -= Math.PI;
+            return new o0.Vector2(-Math.cos(radian),Math.sin(radian));
+        }
+        radian = Math.PI*2 - radian;/**/
+        return new o0.Vector2(Math.cos(radian),Math.sin(radian));
+    },
+    nextRotation: function(currentRotation, targetRotation, turningSpeed){//rotation between 0-360 
+        var rotationDifference = currentRotation - targetRotation;
+        if(Math.abs(rotationDifference) <= turningSpeed
+        ||Math.abs(rotationDifference+360) <= turningSpeed
+        ||Math.abs(rotationDifference-360) <= turningSpeed)
+            currentRotation = targetRotation;
+        else if((rotationDifference > 0 && rotationDifference < 180)
+        ||(rotationDifference > - 360 && rotationDifference < -180))
+            currentRotation -= turningSpeed;
+        else
+            currentRotation += turningSpeed;
+        if(currentRotation >= 360)
+            currentRotation -= 360;
+        if(currentRotation < 0)
+            currentRotation += 360;
+        return currentRotation;
+    },
+    setGroup:function(component,groupIndex){
+        if(component.node.groupIndex==groupIndex){
+            return;
+        }
+        component.node.active = false;
+        component.scheduleOnce(() => {
+            if(component!=null&&component.node!=null){
+                component.node.groupIndex = groupIndex;
+                component.node.active = true;
+            }
+        }, 0.1);/*用来解决cocos动态改变group的bug */
+    },
+    randomBrightColor:function(){
+        var c = new cc.Color(Math.random()*255, Math.random()*255, Math.random()*255, 255);
+        var rate = 255.0 / Math.max(c.getR(),c.getG(),c.getB(),c.getA());
+        return new cc.Color(c.getR()*rate,c.getG()*rate,c.getB()*rate,255);
+    },
+
+    
+};

+ 9 - 0
assets/Script/o0Lib/o0CC.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "ef7dc606-a1bc-4f19-b906-0e9ed4a3df93",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 74 - 0
assets/Script/o0Lib/o0CCButton.js

@@ -0,0 +1,74 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+cc.Class({
+    extends: cc.Sprite,    
+    properties: {
+        //background:null,
+        button:null,
+        sprite:null,
+        label:null,
+        o0ClickEvent:[],
+    }, 
+
+    o0OnClick:function(){
+        for(var i=0;i<this.o0ClickEvent.length;++i){
+            this.o0ClickEvent[i]();
+        }
+    },
+
+    // use this for initialization
+    onLoad: function () {    
+        this.sprite = this;     
+        var self = this;
+        cc.loader.loadRes('button', cc.SpriteFrame, function (err, spriteFrame) {
+            self.sprite.spriteFrame = spriteFrame;
+        });/** */
+        this.sprite.trim = true;
+        this.sprite.type = cc.Sprite.Type.SLICED;
+        this.sprite.sizeMode = cc.Sprite.SizeMode.CUSTOM;
+        this.sprite.SrcBlendFactor = cc.macro.BlendFactor.SRC_ALPHA;
+        this.sprite.DstBlendFactor = cc.macro.BlendFactor.ONE_MINUS_SRC_ALPHA;//精灵必须在button之前
+
+
+        this.button = this.node.addComponent('cc.Button'); 
+        //this.button = this;
+        this.button.target = this.node;
+        this.button.interactable = true;
+        this.button.duration = 0.1;
+        this.button.transition = cc.Button.Transition.COLOR;
+        this.button.normalColor = new cc.Color(200,200,200,255);
+        this.button.pressedColor = new cc.Color(100,100,100,255);
+        this.button.hoverColor = new cc.Color(150,150,150,255);
+        this.button.disabledColor = new cc.Color(50,50,50,255);/** */
+
+        var o0OnClickHandler = new cc.Component.EventHandler();
+        o0OnClickHandler.target = this.node;
+        o0OnClickHandler.component = "o0CCButton";
+        o0OnClickHandler.handler = "o0OnClick";
+        o0OnClickHandler.emit([]);
+        this.button.clickEvents.push(o0OnClickHandler);
+
+        this.label = o0CC.addScriptNode(this.node,'cc.Label',0);
+        this.label.horizontalAlign = cc.Label.HorizontalAlign.CENTER;
+        this.label.verticalAlign = cc.Label.VerticalAlign.CENTER;
+        //this.label.fontSize = 16;
+        //this.label.lineHeight = 20;
+        this.label.overflow = cc.Label.Overflow.SHRINK;
+        this.label.node.color = new cc.Color(0,0,0);
+        this.label.enableWrapText = false;/** */
+    },    
+    // called every frame
+    update: function (dt) {
+
+        this.label.node.anchorX = this.node.anchorX;
+        this.label.node.anchorY = this.node.anchorY;
+        this.label.node.x = 0;
+        this.label.node.y = 0;
+        this.label.node.width = this.node.width-5;
+        this.label.node.height = this.node.height;
+        this.label.fontSize = this.node.height - 0;
+        this.label.string = this.name;/** */
+    }
+})

+ 9 - 0
assets/Script/o0Lib/o0CCButton.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "7ab633e4-1a80-4065-9ec3-77b7f2cb76fb",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 71 - 0
assets/Script/o0Lib/o0CCButtonNoImage.js

@@ -0,0 +1,71 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+cc.Class({
+    extends: cc.Sprite,    
+    properties: {
+        //background:null,
+        button:null,
+        sprite:null,
+        label:null,
+        o0ClickEvent:[],
+    }, 
+
+    o0OnClick:function(){
+        for(var i=0;i<this.o0ClickEvent.length;++i){
+            this.o0ClickEvent[i]();
+        }
+    },
+
+    // use this for initialization
+    onLoad: function () {    
+        this.sprite = this;     
+        var self = this;
+        this.sprite.trim = true;
+        this.sprite.type = cc.Sprite.Type.SLICED;
+        this.sprite.sizeMode = cc.Sprite.SizeMode.CUSTOM;
+        this.sprite.SrcBlendFactor = cc.macro.BlendFactor.SRC_ALPHA;
+        this.sprite.DstBlendFactor = cc.macro.BlendFactor.ONE_MINUS_SRC_ALPHA;//精灵必须在button之前
+
+
+        this.button = this.node.addComponent('cc.Button'); 
+        //this.button = this;
+        this.button.target = this.node;
+        this.button.interactable = true;
+        this.button.duration = 0.1;
+        this.button.transition = cc.Button.Transition.COLOR;
+        this.button.normalColor = new cc.Color(200,200,200,255);
+        this.button.pressedColor = new cc.Color(100,100,100,255);
+        this.button.hoverColor = new cc.Color(150,150,150,255);
+        this.button.disabledColor = new cc.Color(50,50,50,255);/** */
+
+        var o0OnClickHandler = new cc.Component.EventHandler();
+        o0OnClickHandler.target = this.node;
+        o0OnClickHandler.component = "o0CCButtonNoImage";
+        o0OnClickHandler.handler = "o0OnClick";
+        o0OnClickHandler.emit([]);
+        this.button.clickEvents.push(o0OnClickHandler);
+
+        this.label = o0CC.addScriptNode(this.node,'cc.Label',0);
+        this.label.horizontalAlign = cc.Label.HorizontalAlign.CENTER;
+        this.label.verticalAlign = cc.Label.VerticalAlign.CENTER;
+        //this.label.fontSize = 16;
+        //this.label.lineHeight = 20;
+        this.label.overflow = cc.Label.Overflow.SHRINK;
+        this.label.node.color = new cc.Color(0,0,0);
+        this.label.enableWrapText = false;/** */
+    },    
+    // called every frame
+    update: function (dt) {
+
+        this.label.node.anchorX = this.node.anchorX;
+        this.label.node.anchorY = this.node.anchorY;
+        this.label.node.x = 0;
+        this.label.node.y = 0;
+        this.label.node.width = this.node.width-5;
+        this.label.node.height = this.node.height;
+        this.label.fontSize = this.node.height - 15;
+        this.label.string = this.name;/** */
+    }
+})

+ 9 - 0
assets/Script/o0Lib/o0CCButtonNoImage.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "50d51f66-565c-4f28-b46a-90db6bb5071a",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 93 - 0
assets/Script/o0Lib/o0CCEditBox.js

@@ -0,0 +1,93 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+cc.Class({
+    extends: cc.EditBox,
+
+    properties: {
+        //background:null,
+        label:null,
+    },
+
+    o0EditingDidBegan:function(){
+        this.label.node.active = true;
+        this.label.string = this.string;
+    },
+    o0TextChanged:function(){
+        this.label.string = this.string;
+    },
+    o0EditingDidEnded:function(){
+        this.label.node.active = false;
+    },/** */
+
+    // use this for initialization
+    onLoad: function () {    
+        var self = this;
+
+        cc.loader.loadRes('editbox', cc.SpriteFrame, function (err, spriteFrame) {
+            self.backgroundImage = spriteFrame;
+        });/** */
+
+        //this.background = o0CC.addScriptNode(this.node,'cc.Graphics',0);
+        
+        //this.fontColor = cc.c4b(255,255,255,255)
+        this.fontColor = new cc.color(255,255,255);
+
+        this.label = o0CC.addScriptNode(this.node,'cc.Label',2);
+        /*this.label.node.anchorX = 0;
+        this.label.node.anchorY = 0;/** */
+        //this.label.horizontalAlign = cc.Label.HorizontalAlign.CENTER;
+        //this.label.verticalAlign = cc.Label.VerticalAlign.CENTER;
+        //this.label.fontSize = 16;
+        //this.label.lineHeight = 20;
+        this.label.overflow = cc.Label.Overflow.SHRINK;
+        this.label.color = new cc.Color(155,155,155);
+        this.label.node.color = new cc.Color(155,155,155);
+        this.label.enableWrapText = false;
+        this.label.node.active = false;
+
+
+        var o0EditingDidBeganHandler = new cc.Component.EventHandler();
+        o0EditingDidBeganHandler.target = this.node;
+        o0EditingDidBeganHandler.component = "o0CCEditBox";
+        o0EditingDidBeganHandler.handler = "o0EditingDidBegan";
+        o0EditingDidBeganHandler.emit([]);
+        this.editingDidBegan.push(o0EditingDidBeganHandler);
+        
+        var o0TextChangedHandler = new cc.Component.EventHandler();
+        o0TextChangedHandler.target = this.node;
+        o0TextChangedHandler.component = "o0CCEditBox";
+        o0TextChangedHandler.handler = "o0TextChanged";
+        o0TextChangedHandler.emit([]);
+        this.textChanged.push(o0TextChangedHandler);
+        
+        var o0editingDidEndedHandler = new cc.Component.EventHandler();
+        o0editingDidEndedHandler.target = this.node;
+        o0editingDidEndedHandler.component = "o0CCEditBox";
+        o0editingDidEndedHandler.handler = "o0EditingDidEnded";
+        o0editingDidEndedHandler.emit([]);
+        this.editingDidEnded.push(o0editingDidEndedHandler);/** */
+
+        //this.background.enabled = false;
+    },    
+    // called every frame
+    update: function (dt) {
+        /*
+        this.background.clear();
+        this.background.roundRect(this.node.width*(-this.node.anchorX),this.node.height*(-this.node.anchorY), this.node.width, this.node.height,3);
+        this.background.fillColor = new cc.Color(50,50,50,250);
+        this.background.fill();
+        this.background.roundRect(this.node.width*(-this.node.anchorX), this.node.height*(-this.node.anchorY), this.node.width, this.node.height,3);
+        this.background.strokeColor = new cc.Color(255,255,255,155);
+        this.background.stroke();/** */
+
+        this.label.node.anchorX = this.node.anchorX;
+        this.label.node.anchorY = this.node.anchorY;
+        this.label.node.x = 0;
+        this.label.node.y = 0;
+        this.label.node.width = this.node.width - 5;
+        this.label.node.height = this.node.height;
+        this.label.fontSize = this.node.height - 15;
+    }
+})

+ 9 - 0
assets/Script/o0Lib/o0CCEditBox.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "0d700668-1219-4b3a-89d1-f296098cd096",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 24 - 0
assets/Script/o0Lib/o0CCLabel.js

@@ -0,0 +1,24 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+var o0Game = require('o0Game');
+
+cc.Class({
+    extends: cc.Label,
+    properties: {
+        label:null,
+    },
+    onLoad: function () {
+        this.label = this;
+        this.label.horizontalAlign = cc.Label.HorizontalAlign.CENTER;
+        this.label.verticalAlign = cc.Label.VerticalAlign.CENTER;
+        //this.label.fontSize = 16;
+        //this.label.lineHeight = 20;
+        this.label.overflow = cc.Label.Overflow.SHRINK;
+        this.label.color = new cc.Color(255,255,255);
+        this.label.enableWrapText = false;
+    }, 
+    // called every frame
+    update: function (dt) {
+        this.label.fontSize = this.node.height - 15;
+    }
+})

+ 9 - 0
assets/Script/o0Lib/o0CCLabel.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "44e79578-7ab3-4f6f-b691-8ef55cfd540b",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 245 - 0
assets/Script/o0Lib/o0Game.js

@@ -0,0 +1,245 @@
+var o0 = require('o0');
+var o0CC = require('o0CC');
+//for this game
+
+var GroupIndex = {
+    Default : 0,
+    Food : 1,
+    Head : 2,
+    Body : 3,
+    PlayGround : 4,
+    UI : 5,
+}
+
+class SnakeDirectionControl{
+    constructor(script) {
+        this.script = script;
+        this.speed = 1;
+        this.turningSpeed = 2;
+        this.normalSpeedRate = 1;
+        this.speedingSpeedRate = 3;
+        this.targetSpeedRate = 1;
+        this.targetVector = null;
+
+        this.bodySpacingRate = 0.3;
+        this.bodySpacing = 0;
+        
+        this.pulledScore = 0;
+        this.pullScoreRate = 0.7;//the rate means remove 1 score from snake, and 0.5 score will come out to be food.
+        this.speedingScoreCost = 0.02;//score cost per frame speeding
+        this.minScore = 5;     
+                   
+        this.addScore(10);
+        this.script.updateScale();
+        this.updateBodySpacing();
+        this.updateSpeed();
+        this.setTargetVector(new o0.Vector2(1,0));
+    }
+    get node(){
+        return this.script.node;
+    }
+    get radius(){
+        return this.script.radius;
+    }
+    set radius(_radius){
+        this.script.radius = _radius;
+    }
+
+    get bodyParentNode(){
+        return this.script.bodyParentNode;
+    }
+    get foodParentNode(){
+        return this.script.foodParentNode;
+    }
+    get body(){
+        return this.script.body;
+    }
+    get head(){
+        return this.script.head;
+    }
+    get score(){
+        return this.script.score;
+    }
+    set score(_score){
+        this.script.score = _score;
+    }
+
+    get pullScoreThreshold(){
+        return Math.pow(this.body[0].scaleX * this.body[0].scaleY,1) * 1.5;
+    }
+    get targetBodyLength(){
+        return this.score / Math.pow(this.body[0].scaleX * this.body[0].scaleY,1.5);
+    }
+    
+    updateSpeed(){
+        this.speed = 2 * Math.pow(this.body[0].scaleX * this.body[0].scaleY,1.0/3);
+    }
+    updateBodySpacing(){
+        this.bodySpacing = this.radius*2 * this.bodySpacingRate * Math.sqrt(this.body[0].scaleX * this.body[0].scaleY);
+    }
+    setTargetSpeeding(bool){
+        if(!bool)
+            this.targetSpeedRate = this.normalSpeedRate;
+        else
+            this.targetSpeedRate = this.speedingSpeedRate;
+    }
+    setTargetVector(vector){
+        this.targetVector = vector;
+    }
+    addScore(score) {
+        this.score += score;
+        this.script.updateScale();
+        this.updateBodySpacing();
+        this.updateSpeed();
+        var targetBodyLength = Math.ceil(this.bodyLength);
+        while(targetBodyLength > this.body.length){
+            this.script.addBody();
+        }
+    }
+    pullFood(score) {
+        var newFood = o0CC.addScriptNode(this.foodParentNode,'Food',-100);
+        var lastBody = this.body[this.body.length-1];
+        var foodPosition = o0.randomInCircle2(lastBody,(this.radius-newFood.radius)*2);
+        newFood.node.x = foodPosition.x;
+        newFood.node.y = foodPosition.y;
+        newFood.score = score;
+    }
+    pullScore(score){
+        this.score -= score;
+        this.script.updateScale();
+        this.updateBodySpacing();
+        this.updateSpeed();
+        this.pulledScore += score * this.pullScoreRate;
+        if(this.pulledScore >= this.pullScoreThreshold){
+            this.pulledScore -= this.pullScoreThreshold;
+            this.pullFood(this.pullScoreThreshold);
+        }
+        var targetBodyLength = Math.ceil(this.bodyLength);
+        while(targetBodyLength < this.body.length && this.body.length > 1){
+            this.script.removeBody();
+        }
+    }
+    updateSnakeBody(){
+        for(var i = 0, j = 1;j<this.body.length;++i, ++j){
+            var targetVector = new o0.Vector2(this.body[i].x-this.body[j].x,this.body[i].y-this.body[j].y);
+            var moveDistance = targetVector.length - this.bodySpacing;
+            if(j==this.body.length-1)
+                moveDistance += this.bodySpacing * (Math.ceil(this.bodyLength)-this.bodyLength)
+            targetVector = targetVector.mod;
+            this.body[j].rotation = o0CC.rotationFromVector(targetVector);
+            if(moveDistance <= 0)
+                continue;
+            this.body[j].x += targetVector.x * moveDistance;
+            this.body[j].y += targetVector.y * moveDistance;
+        }
+    }
+    destroySnake(){
+        this.node.active = false;//防止destory之前body再增长
+        while(this.score >= 1){
+            //cc.log("1");
+            this.pullScore(1);
+        }
+        while(this.body.length > 1){
+            //cc.log("2");
+            this.script.removeBody();
+        }
+        //cc.log(this.score);
+        this.node.destroy();
+        //this.destroy();
+    }
+
+    // called every frame
+    update (dt) {               
+        var speedRate;
+        if(this.score <= this.minScore)
+            speedRate = this.normalSpeedRate;
+        else{
+            speedRate = this.targetSpeedRate;
+            if(speedRate != this.normalSpeedRate && speedRate == this.speedingSpeedRate)
+                this.pullScore(this.speedingScoreCost);
+        }
+        for(var i = 0;i<speedRate;++i){
+            //移动蛇头
+            this.targetRotation = o0CC.rotationFromVector(this.targetVector);
+            this.head.rotation = o0CC.nextRotation(this.head.rotation,this.targetRotation,this.turningSpeed);
+            var moveVector = o0CC.vectorFromRotation(this.head.rotation);
+            this.body[0].x += moveVector.x*this.speed;
+            this.body[0].y += moveVector.y*this.speed;
+            
+            //////////////下面是移动蛇身
+            this.updateSnakeBody();
+        }
+    }
+    onCollisionEnter(other, self){
+        if(other.node.active == false || this.node.active == false){//貌似能解决两蛇对撞导致卡死的bug
+            return;
+        }
+        if(other.node.groupIndex == GroupIndex.Body){
+            //cc.log("aaaaaaaaaaaaaaaaaaa");
+            var selfBody = false;
+            if(this.body.length > 1)
+                for(var i = 1; i<this.body.length;++i){
+                    if(other.node == this.body[i]){
+                        selfBody = true;
+                        break;
+                    }
+                }
+            if(selfBody == false){
+                //cc.log("dsadasd");
+                this.destroySnake();
+            }
+        }
+        if(other.node.groupIndex == GroupIndex.Food){
+            this.addScore(other.score);
+            other.node.destroy();
+            //other.destroy();
+        }
+    }
+    onCollisionExit(other,self){
+        if(other.node.active == false || this.node.active == false){//貌似能解决两蛇对撞导致卡死的bug
+            return;
+        }
+        if(other.node.groupIndex == GroupIndex.PlayGround){
+            this.destroySnake();
+        }
+    }
+}
+
+
+class SnakeMouseControl extends SnakeDirectionControl{
+    constructor(script) {
+        super(script);
+        //module.exports.snakeDirectionControl.prototype.getName.call(this,);
+        
+        var self = this;
+        this.mouseLocation = new o0.Vector2(1,0);
+        
+        var listener = {
+            event: cc.EventListener.MOUSE,
+            onMouseDown: function (event) {
+                self.setTargetSpeeding(true);   
+            },
+            onMouseUp: function (event) {
+                self.setTargetSpeeding(false);
+            },
+            onMouseMove: function (event) {
+                self.mouseLocation = event.getLocation();
+            },
+            onMouseScroll: function (event) {
+            }
+        }
+        cc.eventManager.addListener(listener, this.node);
+    }
+    update(dt) {
+        var localLocation = this.node.parent.convertToNodeSpaceAR(this.mouseLocation);
+        this.setTargetVector(new o0.Vector2(localLocation).mod);
+        
+        SnakeDirectionControl.prototype.update(dt);
+    }
+}/** */
+
+module.exports = {
+    GroupIndex,
+    //SnakeDirectionControl,
+    //SnakeMouseControl,
+};

+ 9 - 0
assets/Script/o0Lib/o0Game.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "3ae88df0-7b83-412d-95e8-e5e6c242201e",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 357 - 0
assets/Script/o0Lib/o0Project.js

@@ -0,0 +1,357 @@
+var o0 = require('o0');
+
+module.exports = {
+    Filter: class{
+        constructor() {
+
+			this.stableAcceleration = null;
+			this.maxrecordCount = 999999;
+
+			this.frame = [];
+			this.frameHit = [];//打击后的n帧
+			for(var i = 0;i<200;++i){
+				var o = new Object();
+				o.time = new Date().getTime();
+				o.timeGap = 20;
+				o.acc = new o0.Vector2(0,0);
+				o.gyr = new o0.Vector2(0,0);
+				o.accFixed = 0;
+				o.accSlope = 0;
+				o.pos = new o0.Vector2(0,0);
+				o.predict = new o0.Vector2(0,0);
+				o.shake = 0;
+				o.shakeFixed = 1;
+				o.shakeSlope = 0;
+				o.reliable = 1;
+				o.speed = new o0.Vector2(0,0);
+				o.hit = 0;
+				this.frame.push(o);
+				//this.frameHit.push(o);
+			}
+			this.frameSwing = this.frame[0];
+			//this.frame = 0;
+
+			this.force = new o0.Vector2(0,0);
+			this.forceChanged = 0;
+			this.momentum = 999999;
+			this.momentunTime = 0;
+			this.momentunSeek = 0.1;
+			this.momentunPunch = false;
+			this.punchCount = 0;
+			this.leftRight = false;
+			
+			this.forceRecord = [];
+			for(var i = 0;i<1;++i){
+				this.forceRecord.push(new o0.Vector2(0,0));
+			}/** */
+			this.angle = 0;
+        }
+		Update(vector3,timeGap,gyr){
+			if(this.stableAcceleration == null){
+				this.stableAcceleration = vector3;
+				this.recordCount = 1;
+			}else{
+				this.recordCount += 1;
+				if(this.recordCount > this.maxrecordCount){
+					this.recordCount = this.maxrecordCount;
+				}
+				let recordCount = this.recordCount;
+				this.stableAcceleration = this.stableAcceleration.multiply((recordCount-1)/recordCount).plus(vector3.multiply(1/recordCount));
+			}
+
+			//++this.frame;
+
+			var newForce = vector3.minus(this.stableAcceleration);
+
+			var newFrame = new Object();
+			newFrame.time = new Date().getTime();
+			newFrame.timeGap = timeGap;
+			newFrame.acc = new o0.Vector2(newForce.x,newForce.z);
+			newFrame.gyr = new o0.Vector2(gyr.z,-gyr.x);
+			let lastFrame = this.frame[this.frame.length-1];
+			let last2Frame = this.frame[this.frame.length-2];
+			let last3Frame = this.frame[this.frame.length-3];
+			let last4Frame = this.frame[this.frame.length-4];
+			let last5Frame = this.frame[this.frame.length-5];
+			//////////////////////////////////////////////////////////////////////
+			newFrame.accFixed = newFrame.acc.length * 100;
+
+			if(newFrame.accFixed < lastFrame.accFixed * 0.85){
+				newFrame.accFixed = lastFrame.accFixed * 0.85;
+			}
+			lastFrame.accFixed = Math.max(lastFrame.accFixed, Math.min(newFrame.accFixed,last2Frame.accFixed), Math.min(newFrame.accFixed,last3Frame.accFixed));
+			///////////////////////////////////////////////////////////////////////
+			//newFrame.pos = lastFrame.pos.plus(lastFrame.acc.plus(newFrame.acc).multiply(timeGap/60)).multiply(Math.max(1-timeGap/200,0));
+			newFrame.pos = lastFrame.pos.plus(newFrame.acc.multiply(timeGap/30)).multiply(Math.max(1-timeGap/1000,0));
+			////////////////////////////////////////////
+			var accSlpoe1 = (newFrame.accFixed-lastFrame.accFixed);
+			var accSlpoe2 = (newFrame.accFixed-last2Frame.accFixed);
+			var accSlpoe3 = (newFrame.accFixed-last3Frame.accFixed);
+			//newFrame.accSlope = accSlpoe1;
+			//newFrame.accSlope = Math.min(accSlpoe1,accSlpoe2);
+			//newFrame.accSlope = Math.min(accSlpoe1,accSlpoe2,accSlpoe3);
+			newFrame.accSlope = Math.max(newFrame.accFixed-lastFrame.accFixed,0);
+
+			/*
+			if(newFrame.accSlope > 8){
+				newFrame.accSlope = 1; 
+			}else if(newFrame.accSlope <= 8){
+				newFrame.accSlope = 0;
+			}/** */
+			/////////////////////////////////////////////////
+
+			var lastI = this.frame.length-1;
+			var t2 = this.frame[lastI-1].timeGap;
+			var t3 = this.frame[lastI].timeGap + t2;
+			var t4 = newFrame.timeGap + t3;
+			
+			/*newFrame.predict = new o0.Vector2(
+				new o0.QuadraticEquation(0,this.frame[lastI-2].acc.x,t2,this.frame[lastI-1].acc.x,t3,this.frame[lastI].acc.x).y(t4),
+				new o0.QuadraticEquation(0,this.frame[lastI-2].acc.y,t2,this.frame[lastI-1].acc.y,t3,this.frame[lastI].acc.y).y(t4));/** */
+			/*
+			newFrame.predict = new o0.Vector2(
+				new o0.QuadraticEquation(0,this.frame[lastI-2].pos.x,t2,this.frame[lastI-1].pos.x,t3,this.frame[lastI].pos.x).y(t4),
+				new o0.QuadraticEquation(0,this.frame[lastI-2].pos.y,t2,this.frame[lastI-1].pos.y,t3,this.frame[lastI].pos.y).y(t4));/** */
+			
+			newFrame.predict = new o0.Vector2(
+				new o0.QuadraticEquation(0,this.frame[lastI-2].pos.x,t2,this.frame[lastI-1].pos.x,t3,this.frame[lastI].pos.x).y(t4),
+				new o0.QuadraticEquation(0,this.frame[lastI-2].pos.y,t2,this.frame[lastI-1].pos.y,t3,this.frame[lastI].pos.y).y(t4));/** */
+			//console.log(newFrame.pos);
+			//////////////////////////////////////////
+			//newFrame.shake = o0.distance2(newFrame.predict,newFrame.pos) * 500;
+			//console.log(newFrame.pos.minus(lastFrame.pos).mod.angle(newFrame.predict.minus(lastFrame.pos).mod));
+
+			//newFrame.shake = o0.distance2(newFrame.predict,newFrame.acc) * 100;
+			newFrame.shake = o0.distance2(newFrame.predict,newFrame.pos) * 100;
+
+
+			//newFrame.shake = o0.distance2(newFrame.predict,lastFrame.pos) * newFrame.acc.length / timeGap * 2000;
+			
+			if(isNaN(newFrame.shake)){
+				newFrame.shake = 0.0;
+			}/** */
+			//newFrame.shake = Math.pow(o0.distance2(newFrame.predict,newFrame.pos) * newFrame.acc.length / timeGap,0.5) * 500;
+			/////////////////////////////下面的代码有优化空间
+			//newFrame.shakeFixed = lastFrame.shakeFixed * 0.9;
+			//newFrame.shakeFixed = lastFrame.shakeFixed*(1.0+newFrame.shake)*0.9;
+			//newFrame.shakeFixed = Math.pow(lastFrame.shakeFixed*(1.0+newFrame.shake),0.5)+1;
+			//console.log(newFrame.shakeFixed+1);
+			//newFrame.shakeFixed = newFrame.shake;
+			
+			newFrame.shakeFixed = lastFrame.shakeFixed * 0.85;
+			if(newFrame.shake > newFrame.shakeFixed){
+				newFrame.shakeFixed = newFrame.shake;
+			}/* */
+			lastFrame.shakeFixed = Math.max(lastFrame.shakeFixed, Math.min(newFrame.shakeFixed,last2Frame.shakeFixed), Math.min(newFrame.shakeFixed,last3Frame.shakeFixed));
+			////////////////////////////////////////////////////////////////
+			/*
+			var shakeSlpoe1 = (newFrame.shakeFixed-lastFrame.shakeFixed);
+			var shakeSlpoe2 = (newFrame.shakeFixed-last2Frame.shakeFixed);
+			var shakeSlpoe3 = (newFrame.shakeFixed-last3Frame.shakeFixed);
+			//newFrame.accSlope = accSlpoe1;
+			//newFrame.accSlope = Math.min(accSlpoe1,accSlpoe2);
+			newFrame.shakeSlope = Math.min(shakeSlpoe1,shakeSlpoe2,shakeSlpoe3);
+			newFrame.shakeSlope = Math.max(newFrame.shakeSlope,0);/** */
+			newFrame.shakeSlope = Math.max(newFrame.shakeFixed-lastFrame.shakeFixed,0);
+			
+			/*
+			if(newFrame.shakeSlope > 40){
+				newFrame.shakeSlope = 1;
+			}else{
+				newFrame.shakeSlope = 0;
+			}/** */
+			//////////////////////////////////////////////
+			/*
+			var slopeChange = newFrame.shakeFixed - lastFrame.shakeFixed;
+			if(slopeChange < 0){
+				newFrame.slope = (lastFrame.slope + (newFrame.shakeFixed - lastFrame.shakeFixed) / timeGap * 100) * 0.8;
+			}else{
+				newFrame.slope = (lastFrame.slope + (newFrame.shakeFixed - lastFrame.shakeFixed) / timeGap * 20) * 0.8;
+			}
+			if(newFrame.slope<0){
+				newFrame.slope = 0;
+			}/** */
+			/////////////////////////////下面的代码有很大优化空间
+			if(lastFrame.hit==0
+				&& last2Frame.hit==0
+				&& last3Frame.hit==0
+				&& last4Frame.hit==0
+				&& last5Frame.hit==0
+				&& (newFrame.accSlope >= 15 || lastFrame.accSlope >= 20)
+				&& (newFrame.shakeSlope >= 20 || lastFrame.shakeSlope >= 40)){
+				newFrame.hit = newFrame.shake;
+				this.frameHit = [];
+
+				//this.frameSwing = last2Frame;
+				for(var i = this.frame.length-3;i>=1;--i){
+					let io = this.frame[i];
+					let pio = this.frame[i-1];
+					if(io.accFixed*0.85 <= pio.accFixed && io.accFixed >= pio.accFixed * 0.85){
+						this.frameSwing = io;
+					}
+				}
+
+
+			}else{
+				newFrame.hit = 0;
+			}
+
+
+			/*
+			if(lastFrame.hit == 0 
+				&& this.frame[this.frame.length-2].hit == 0
+				&& this.frame[this.frame.length-3].hit == 0
+				&& newFrame.shakeFixed > 150
+				&& newFrame.shakeFixed > lastFrame.shakeFixed * 2){
+				newFrame.hit = newFrame.shakeFixed;
+			}else{
+				newFrame.hit = 0;
+			}/** */
+			/////////////力量大小
+			if(lastFrame.hit!=0){
+				lastFrame.hit = lastFrame.hit + newFrame.shake;
+			}else if(last2Frame.hit!=0){
+				last2Frame.hit = last2Frame.hit + newFrame.shake;
+			}else if(last3Frame.hit!=0){
+				last3Frame.hit = last3Frame.hit + newFrame.shake;
+			}else if(last4Frame.hit!=0){
+				last4Frame.hit = last4Frame.hit + newFrame.shake;
+			}else if(last5Frame.hit!=0){
+				last5Frame.hit = last5Frame.hit + newFrame.shake;
+				console.log(last5Frame.hit);
+			}/** */
+			//newFrame.shake = o0.distance2(newFrame.predict,newFrame.pos) * o0.distance2(lastFrame.pos,newFrame.pos);
+			//////////////////////////////////////////////////////////////////////////////////
+			newFrame.reliable = Math.pow((Math.PI/2 - Math.atan(newFrame.shakeFixed/10000)) / (Math.PI/2),2000);
+
+			let lastFrameAddSpeed = lastFrame.acc.multiply(lastFrame.timeGap/20).multiply(lastFrame.reliable);
+			let newFrameAddSpeed = newFrame.acc.multiply(newFrame.timeGap/20).multiply(newFrame.reliable);
+			
+			newFrame.speed = lastFrame.speed.multiply(0.8);
+			var lastFrameAngle = newFrame.speed.angle(lastFrameAddSpeed);
+			if(isNaN(lastFrameAngle)){
+				lastFrameAngle = 180.0;
+			}
+			//newFrame.speed = newFrame.speed.plus(lastFrameAddSpeed.multiply(Math.max(1,lastFrameAngle/60.0 - 1)));
+			//newFrame.speed = newFrame.speed.multiply(1).plus(lastFrameAddSpeed.multiply(Math.max(1,lastFrameAngle/60.0 - 1)));
+			newFrame.speed = newFrame.speed.multiply(1-lastFrameAngle/360.0).plus(lastFrameAddSpeed.multiply(Math.max(1,lastFrameAngle/60.0-1)));
+			var newFrameAngle = newFrame.speed.angle(newFrameAddSpeed);
+			if(isNaN(newFrameAngle)){
+				newFrameAngle = 180.0;
+			}
+			//newFrame.speed = newFrame.speed.plus(newFrameAddSpeed.multiply(Math.min(1,newFrameAngle/60.0-1)));
+			newFrame.speed = newFrame.speed.multiply(1-newFrameAngle/360.0).plus(newFrameAddSpeed.multiply(Math.max(1,newFrameAngle/60.0-1)));
+
+
+			//////////////////////
+			this.frame.shift();
+			this.frame.push(newFrame);
+			if(this.frameHit.length <=10){
+				var o = new Object();
+				o.time = newFrame.time;
+				o.timeGap = newFrame.timeGap;
+				o.acc = newFrame.acc;
+				o.gyr = newFrame.gyr;
+
+				let frameHitLength = this.frameHit.length+1;
+				let lastFrameHit = this.frameHit[this.frameHit.length-1];
+				if(frameHitLength == 1){
+					o.allShakeLength = newFrame.shakeFixed;
+				}else{
+					o.allShakeLength = lastFrameHit.allShakeLength + newFrame.shakeFixed;
+				}
+
+				o.accFixed = o.acc.multiply(Math.pow(Math.max(0,1-newFrame.shakeFixed*frameHitLength / o.allShakeLength),5) * 20);//数字越大越忽略历史数据
+
+				if(frameHitLength == 1){
+					o.pos = o.accFixed.multiply(o.timeGap/60);
+				}else{
+					o.pos = lastFrameHit.pos.plus(lastFrameHit.accFixed.plus(o.accFixed).multiply(o.timeGap/60));
+				}
+				this.frameHit.push(o);
+			}
+			
+
+
+
+			var vectorChanged = newForce.minus(this.force);
+			var forceLength = this.force.length;
+			var ForceChanged = newForce.length - forceLength;
+			this.force = newForce;
+
+			var currentLeftRight;
+			if(Math.abs(newForce.x + newForce.z) > Math.abs(newForce.x - newForce.z)){
+				currentLeftRight = Math.abs(newForce.x + newForce.z);
+			}else{
+				currentLeftRight = -Math.abs(newForce.x - newForce.z);
+			}
+			this.forceRecord.shift();
+			this.forceRecord.push(newForce);
+			
+			if(this.forceChanged > 0 && ForceChanged < 0){// && forceLength > 0.1
+				//&& this.momentum * Math.pow(0.9,(new Date().getTime()-this.momentunTime)/1) < forceLength){
+				/*console.log(forceLength.toFixed(2));
+				if( forceLength > 0.1 && forceLength >= this.momentum * 1.5){
+					console.log(this.frame+" "+forceLength);
+				}/** */
+				if(forceLength > 0.1 && this.momentum != 999999){
+					if(!this.momentunPunch){//等待击打
+						if(this.momentunSeek > this.momentum){
+							this.momentunSeek = this.momentum;
+						}else{
+							if(this.momentunSeek < this.momentum * 0.8 - 0.1){
+								this.momentunPunch = !this.momentunPunch;
+								this.punchCount++;
+								//this.leftRight = (newForce.x+this.force.x) < 0;
+								
+								/*
+								var largestForce = new o0.Vector3(0,0,0)
+								for(var i = 0;i<this.forceRecord.length;++i){
+									var element = this.forceRecord[i];
+									if(largestForce.length < element.length){
+										largestForce = element;
+									}
+								}
+								if(Math.abs(largestForce.x + largestForce.z) > Math.abs(largestForce.x - largestForce.z)){
+									currentLeftRight = Math.abs(largestForce.x + largestForce.z);
+								}else{
+									currentLeftRight = -Math.abs(largestForce.x - largestForce.z);
+								}/** */
+								this.leftRight = currentLeftRight < 0 ? "Right" : "Left";
+								this.angle = new o0.Vector2(newForce.x,newForce.z).mod.angle(new o0.Vector2(0,1));
+								if(this.angle > 90){
+									this.angle = 180 -this.angle;
+								}
+								if(currentLeftRight > 0){
+									this.angle = -this.angle;
+								}/** */
+								//this.leftRight = (largestChange.x > 0 && largestChange.z > 0) || (largestChange.x < 0 && largestChange.z < 0);
+								/* */
+								//console.log(this.momentum);
+							}
+						}
+					}else{//打完了
+						if(this.momentunSeek < this.momentum){
+							this.momentunSeek = this.momentum;
+						}else if(this.momentunSeek > this.momentum * 1.2 + 0.1){
+							this.momentunPunch = !this.momentunPunch;
+						}
+					}
+				}
+
+				this.momentum = forceLength;
+				this.momentunTime = new Date().getTime();
+			}
+
+			this.forceChanged = ForceChanged;
+			
+
+
+			//console.log(vector3.x);
+			return [new o0.Vector3(newForce),currentLeftRight,this.momentum];
+		}
+        test(){
+            return "123123131";
+        }
+    }
+};

+ 9 - 0
assets/Script/o0Lib/o0Project.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "6f24fca9-9457-4ab5-b150-04d9ce02a333",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/Texture.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "91027dc6-f6da-47c8-986e-a171505e8d9e",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

BIN
assets/Texture/singleColor.png


+ 36 - 0
assets/Texture/singleColor.png.meta

@@ -0,0 +1,36 @@
+{
+  "ver": "2.3.5",
+  "uuid": "cb6b161e-bc63-497e-9657-18c75ff149f5",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "width": 2,
+  "height": 2,
+  "platformSettings": {},
+  "subMetas": {
+    "singleColor": {
+      "ver": "1.0.4",
+      "uuid": "7c48fca0-3972-4e0c-a6bd-269e54ab88ca",
+      "rawTextureUuid": "cb6b161e-bc63-497e-9657-18c75ff149f5",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 2,
+      "height": 2,
+      "rawWidth": 2,
+      "rawHeight": 2,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

BIN
assets/background.psd


+ 5 - 0
assets/background.psd.meta

@@ -0,0 +1,5 @@
+{
+  "ver": "1.0.1",
+  "uuid": "c256f241-3d10-4e9e-9a79-86fb17beee04",
+  "subMetas": {}
+}

BIN
assets/background1.psd


+ 5 - 0
assets/background1.psd.meta

@@ -0,0 +1,5 @@
+{
+  "ver": "1.0.1",
+  "uuid": "2cf22220-1534-4725-a152-cdeb09965e0b",
+  "subMetas": {}
+}

BIN
assets/food64-64.psd


+ 5 - 0
assets/food64-64.psd.meta

@@ -0,0 +1,5 @@
+{
+  "ver": "1.0.1",
+  "uuid": "67ac6bbb-21c2-446a-889b-2bf002224ed4",
+  "subMetas": {}
+}

+ 12 - 0
assets/migration.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "1373fb3a-e4e9-47b4-ab97-37aa9274a061",
+  "isBundle": false,
+  "bundleName": "",
+  "priority": 1,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

+ 13 - 0
assets/migration/use_reversed_rotateBy.js

@@ -0,0 +1,13 @@
+/*
+ * This script is automatically generated by Cocos Creator and is only used for projects compatible with v2.1.0/v2.1.1/v2.3.0/v2.3.1/v2.3.2 versions.
+ * You do not need to manually add this script in any other project.
+ * If you don't use cc.Action in your project, you can delete this script directly.
+ * If your project is hosted in VCS such as git, submit this script together.
+ *
+ * 此脚本由 Cocos Creator 自动生成,仅用于兼容 v2.1.0/v2.1.1/v2.3.0/v2.3.1/v2.3.2 版本的工程,
+ * 你无需在任何其它项目中手动添加此脚本。
+ * 如果你的项目中没用到 Action,可直接删除该脚本。
+ * 如果你的项目有托管于 git 等版本库,请将此脚本一并上传。
+ */
+
+cc.RotateBy._reverse = true;

+ 9 - 0
assets/migration/use_reversed_rotateBy.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "3df5d077-5a93-41e3-b92b-96b4f5e2da38",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 13 - 0
assets/migration/use_reversed_rotateTo.js

@@ -0,0 +1,13 @@
+/*
+ * This script is automatically generated by Cocos Creator and is only used for projects compatible with v2.1.0/v2.1.1/v2.2.1/v2.2.2 versions.
+ * You do not need to manually add this script in any other project.
+ * If you don't use cc.Action in your project, you can delete this script directly.
+ * If your project is hosted in VCS such as git, submit this script together.
+ *
+ * 此脚本由 Cocos Creator 自动生成,仅用于兼容 v2.1.0/v2.1.1/v2.2.1/v2.2.2 版本的工程,
+ * 你无需在任何其它项目中手动添加此脚本。
+ * 如果你的项目中没用到 Action,可直接删除该脚本。
+ * 如果你的项目有托管于 git 等版本库,请将此脚本一并上传。
+ */
+
+cc.RotateTo._reverse = true;

+ 9 - 0
assets/migration/use_reversed_rotateTo.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "2cd0d739-f44e-4fcb-9f31-4e07d35042e0",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 17 - 0
assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js

@@ -0,0 +1,17 @@
+/*
+ * This script is automatically generated by Cocos Creator and is only used for projects compatible with the v2.1.0 ~ 2.2.1 version.
+ * You do not need to manually add this script in any other project.
+ * If you don't use cc.Toggle in your project, you can delete this script directly.
+ * If your project is hosted in VCS such as git, submit this script together.
+ *
+ * 此脚本由 Cocos Creator 自动生成,仅用于兼容 v2.1.0 ~ 2.2.1 版本的工程,
+ * 你无需在任何其它项目中手动添加此脚本。
+ * 如果你的项目中没用到 Toggle,可直接删除该脚本。
+ * 如果你的项目有托管于 git 等版本库,请将此脚本一并上传。
+ */
+
+if (cc.Toggle) {
+    // Whether to trigger 'toggle' and 'checkEvents' events when modifying 'toggle.isChecked' in the code
+    // 在代码中修改 'toggle.isChecked' 时是否触发 'toggle' 与 'checkEvents' 事件
+    cc.Toggle._triggerEventInScript_isChecked = true;
+}

+ 9 - 0
assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "65a5d9c4-e553-4f8d-b514-87e66fc80b7d",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 12 - 0
assets/resources.meta

@@ -0,0 +1,12 @@
+{
+  "ver": "1.1.2",
+  "uuid": "601763f1-c0bf-4477-9893-1e8be4f2abd7",
+  "isBundle": true,
+  "bundleName": "resources",
+  "priority": 8,
+  "compressionType": {},
+  "optimizeHotUpdate": {},
+  "inlineSpriteFrames": {},
+  "isRemoteBundle": {},
+  "subMetas": {}
+}

BIN
assets/resources/Ads.jpg


+ 36 - 0
assets/resources/Ads.jpg.meta

@@ -0,0 +1,36 @@
+{
+  "ver": "2.3.5",
+  "uuid": "4943c67b-e6dd-40b5-9c30-d3364a67cb33",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "width": 750,
+  "height": 1334,
+  "platformSettings": {},
+  "subMetas": {
+    "Ads": {
+      "ver": "1.0.4",
+      "uuid": "0a4489c5-f5d2-41de-bc66-f4fcd9d22c5e",
+      "rawTextureUuid": "4943c67b-e6dd-40b5-9c30-d3364a67cb33",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 750,
+      "height": 1334,
+      "rawWidth": 750,
+      "rawHeight": 1334,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

BIN
assets/resources/Icon.png


+ 36 - 0
assets/resources/Icon.png.meta

@@ -0,0 +1,36 @@
+{
+  "ver": "2.3.5",
+  "uuid": "660d6db4-612e-4eb0-aa5e-4a652dc97ab4",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "width": 512,
+  "height": 512,
+  "platformSettings": {},
+  "subMetas": {
+    "Icon": {
+      "ver": "1.0.4",
+      "uuid": "48a44888-bf8d-4b0e-bc15-f79fdd535a15",
+      "rawTextureUuid": "660d6db4-612e-4eb0-aa5e-4a652dc97ab4",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 512,
+      "height": 512,
+      "rawWidth": 512,
+      "rawHeight": 512,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

BIN
assets/resources/ads03.png


+ 36 - 0
assets/resources/ads03.png.meta

@@ -0,0 +1,36 @@
+{
+  "ver": "2.3.5",
+  "uuid": "e38ddbff-1b98-49a5-a7d5-91a22f4c4f22",
+  "type": "sprite",
+  "wrapMode": "clamp",
+  "filterMode": "bilinear",
+  "premultiplyAlpha": false,
+  "genMipmaps": false,
+  "packable": true,
+  "width": 750,
+  "height": 750,
+  "platformSettings": {},
+  "subMetas": {
+    "ads03": {
+      "ver": "1.0.4",
+      "uuid": "7cf79631-c346-4539-9e21-7ff3665d4699",
+      "rawTextureUuid": "e38ddbff-1b98-49a5-a7d5-91a22f4c4f22",
+      "trimType": "auto",
+      "trimThreshold": 1,
+      "rotated": false,
+      "offsetX": 0,
+      "offsetY": 0,
+      "trimX": 0,
+      "trimY": 0,
+      "width": 750,
+      "height": 750,
+      "rawWidth": 750,
+      "rawHeight": 750,
+      "borderTop": 0,
+      "borderBottom": 0,
+      "borderLeft": 0,
+      "borderRight": 0,
+      "subMetas": {}
+    }
+  }
+}

+ 110 - 0
assets/resources/atom.plist

@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>angle</key>
+	<real>360</real>
+	<key>angleVariance</key>
+	<real>360</real>
+	<key>blendFuncDestination</key>
+	<integer>1</integer>
+	<key>blendFuncSource</key>
+	<integer>770</integer>
+	<key>duration</key>
+	<real>-1</real>
+	<key>emitterType</key>
+	<real>0.0</real>
+	<key>finishColorAlpha</key>
+	<real>0.8399999737739563</real>
+	<key>finishColorBlue</key>
+	<real>0.0771484375</real>
+	<key>finishColorGreen</key>
+	<real>0.63492840528488159</real>
+	<key>finishColorRed</key>
+	<real>0.68082684278488159</real>
+	<key>finishColorVarianceAlpha</key>
+	<real>0.74000000953674316</real>
+	<key>finishColorVarianceBlue</key>
+	<real>0.98000001907348633</real>
+	<key>finishColorVarianceGreen</key>
+	<real>0.98000001907348633</real>
+	<key>finishColorVarianceRed</key>
+	<real>0.41999998688697815</real>
+	<key>finishParticleSize</key>
+	<real>30.319999694824219</real>
+	<key>finishParticleSizeVariance</key>
+	<real>0.0</real>
+	<key>gravityx</key>
+	<real>0.25</real>
+	<key>gravityy</key>
+	<real>0.86000001430511475</real>
+	<key>maxParticles</key>
+	<real>200</real>
+	<key>maxRadius</key>
+	<real>100</real>
+	<key>maxRadiusVariance</key>
+	<real>0.0</real>
+	<key>minRadius</key>
+	<real>0.0</real>
+	<key>particleLifespan</key>
+	<real>0.20000000298023224</real>
+	<key>particleLifespanVariance</key>
+	<real>0.5</real>
+	<key>radialAccelVariance</key>
+	<real>65.790000915527344</real>
+	<key>radialAcceleration</key>
+	<real>-671.04998779296875</real>
+	<key>rotatePerSecond</key>
+	<real>0.0</real>
+	<key>rotatePerSecondVariance</key>
+	<real>0.0</real>
+	<key>rotationEnd</key>
+	<real>-47.369998931884766</real>
+	<key>rotationEndVariance</key>
+	<real>-142.11000061035156</real>
+	<key>rotationStart</key>
+	<real>-47.369998931884766</real>
+	<key>rotationStartVariance</key>
+	<real>0.0</real>
+	<key>sourcePositionVariancex</key>
+	<real>7</real>
+	<key>sourcePositionVariancey</key>
+	<real>7</real>
+	<key>sourcePositionx</key>
+	<real>373.72775268554688</real>
+	<key>sourcePositiony</key>
+	<real>478.40472412109375</real>
+	<key>speed</key>
+	<real>0.0</real>
+	<key>speedVariance</key>
+	<real>190.78999328613281</real>
+	<key>startColorAlpha</key>
+	<real>0.63999998569488525</real>
+	<key>startColorBlue</key>
+	<real>0.3375650942325592</real>
+	<key>startColorGreen</key>
+	<real>0.78792315721511841</real>
+	<key>startColorRed</key>
+	<real>0.794921875</real>
+	<key>startColorVarianceAlpha</key>
+	<real>0.77999997138977051</real>
+	<key>startColorVarianceBlue</key>
+	<real>0.68000000715255737</real>
+	<key>startColorVarianceGreen</key>
+	<real>1</real>
+	<key>startColorVarianceRed</key>
+	<real>0.89999997615814209</real>
+	<key>startParticleSize</key>
+	<real>3.369999885559082</real>
+	<key>startParticleSizeVariance</key>
+	<real>50</real>
+	<key>tangentialAccelVariance</key>
+	<real>65.790000915527344</real>
+	<key>tangentialAcceleration</key>
+	<real>-92.110000610351562</real>
+	<key>textureFileName</key>
+	<string></string>
+	<key>textureImageData</key>
+	<string>H4sIAAAAAAAAA+sM8HPn5ZLiYmBg4PX0cAkC0vIgzMEMJDUKnnEDKZZ0R19HBoaN/dx/ElmBfIVkjyBfBoYqNQaGhhYGhl9AoYYXDAylBgwMrxIYGKxmMDCIF8zZFWjDwMDYE+AT4vo/QHMIo0Ag0vofrAUikcWDtP5nm/6f4Pp/rs//Tpf/qSb/w3VRFKQa/V8d+P9k8v8bef/PpP2f5fs/3giL+bW2//dF/79X/P9N/f/7Zf/Xh/2PNUSxq8Tq/76Y/3eL/z+v+n8l9/9EdxTZGP3/s7z+74v9fzjx/9KA/8lGKC6P0PmfZ/4/1/x/jB5I5P9/ruhLl4AR1lwS5BfMwMTMysLIzsbFzcPJwccvKCQgLCbKKyIuKSMrJSEtr6iirKqkIKemZaCroWNkaWvvaGruHhzq72qlaeIbm5qdnRburmftGZPXsW77zLxwJ327lMaLH3+8XZDqYaZu45c06cXn3x/2ZHtbeCV23P7688PCRG+X8IKVN+9vLYtw84nLa2zI13772UES6BzGJG93l+Y/W86D3MZe4unryv6ITVZMmTN1a9UZBgamRk8XxxCN86XB6eG3HQSuhE6dnPIyxVOv6OC2nhyrFhbmlSpLnKuaFPda7J0od+nH08jZnxRaan8tMq/enJommqot0MSfzLLwj7qAG4uwi+FSkX//XEXbNJ62rNB6OuEDP9+cllWz8jJ2qVmol5Tz9miYmyZGlJ0qjHWeobYwJ53tKcOuoKp506dpnjYIbdouPKFp58vdRhzGN2P05vuzb1tf3CR4e1G4732+RU4bQ96tDsm+6bHrwIbQxsSsqLwJnau//lPxlDq7L0cj1pfBkT+tg9t+bqc2c7PzYeXFh5N7iw4W855dMps3ILh80Y47EvIzLQwsKz9cuOKwVUG3efVePgHVQ3yfll778uLMm4fK7v2y9ob3upyvi+9xP7BB845B9Dzryqx/X2Zufn4ufseODRFnvcPDOTWY3ldO3zcvZtbOmqevtr42z7sXlaWfflkzgyFZwyHEXlT09clTb63L39+t//Dh4mP1uWkyVm0Kd5k4Vu+brB82aeXy8/P2V/x89XX29vdWf49e+Lh1HheHsHNa11O3339ftffPt6v/+evt7wjtb0v0r7xjk1Ct0joTFn3yw63++fvr/s+MjZ6p/dxp+e5H9351vmMP3LjnntzcyLlz58dEec4qdIuysnnP67Ezsb01aO/uBUs7W88lbZ72PeZ0yEU1P5Not9ZbRcm7jK/I5YQ82vM8omm1NJPSjAsFqVO0w6KYX6+tMu27tO49941zbQd6EtfdNmKp9b4apSdtpRl/P1HgyAGGtrmf9tQsnMDJzP4msahrO+8xgQiHH+sen3A4lOz8eMFZPmYjtntih7brnDbg8X08xSB1uqPgooSasyIfVrK03Cx2PsAuzhTusDvZuPVtWyLHi8lMHVNr+QRyN5QUT61N0v8gznrD/V/MWeVCYPpULXGNKElJLEm1Si5KBVIMRgaGFroGZrpGliGGJlbGplYGltoGFlYGBqoflsegaMjNT8lMq8StIWSt/AOgBgZPVz+XdU4JTQDQtqKonwUAAA==</string>
+</dict>
+</plist>

+ 5 - 0
assets/resources/atom.plist.meta

@@ -0,0 +1,5 @@
+{
+  "ver": "2.0.1",
+  "uuid": "274a2b8a-c3f1-4237-9d18-da8d66b6f87a",
+  "subMetas": {}
+}

BIN
assets/resources/background.png


Some files were not shown because too many files changed in this diff