Browse Source

添加音效

master
song 4 years ago
parent
commit
9e91fa9578
  1. 2
      gulpfile.js
  2. 1011
      package-lock.json
  3. BIN
      public/images/Bitmap1.png
  4. BIN
      public/images/Bitmap2.png
  5. BIN
      public/images/Bitmap3.png
  6. BIN
      public/images/Bitmap4.png
  7. BIN
      public/images/Bitmap5.png
  8. BIN
      public/images/level.png
  9. BIN
      public/images/stopDemo.png
  10. BIN
      public/images/suspend.png
  11. BIN
      public/images/tomato_right_atlas_1.png
  12. BIN
      public/images/tomato_right_atlas_10.png
  13. BIN
      public/images/tomato_right_atlas_11.png
  14. BIN
      public/images/tomato_right_atlas_12.png
  15. BIN
      public/images/tomato_right_atlas_2.png
  16. BIN
      public/images/tomato_right_atlas_3.png
  17. BIN
      public/images/tomato_right_atlas_4.png
  18. BIN
      public/images/tomato_right_atlas_5.png
  19. BIN
      public/images/tomato_right_atlas_6.png
  20. BIN
      public/images/tomato_right_atlas_7.png
  21. BIN
      public/images/tomato_right_atlas_8.png
  22. BIN
      public/images/tomato_right_atlas_9.png
  23. BIN
      public/images/任务完成_.png
  24. BIN
      public/images/位图28.png
  25. BIN
      public/images/倒计时_.png
  26. BIN
      public/images/再来一次_.png
  27. BIN
      public/images/计时_.png
  28. BIN
      public/images/返回按钮_.png
  29. 13
      public/index.html
  30. BIN
      public/sounds/amazing.mp3
  31. BIN
      public/sounds/audio1.mp3
  32. BIN
      public/sounds/audio2.mp3
  33. BIN
      public/sounds/audio3.mp3
  34. BIN
      public/sounds/excitationMusic.mp3
  35. BIN
      public/sounds/unbelievable.mp3
  36. BIN
      public/source-code.fla
  37. 6
      public/source-code.html
  38. 2630
      public/source-code.js
  39. 2044
      public/tomato-right.js
  40. BIN
      public/恢复_source-code.fla
  41. 6
      src/classes/suspend.js
  42. 3
      src/index.js
  43. 1
      src/message.js
  44. 19
      src/test.js

2
gulpfile.js

@ -20,7 +20,7 @@ const script = function () {
const copy = function () {
src('./public/index.html').pipe(dest('dist/'));
src('./public/tomato-right.js').pipe(dest('dist/'));
src('./public/source-code.js').pipe(dest('dist/'));
src('./public/images/*').pipe(dest('dist/images'));
src('./public/libs/**/*').pipe(dest('dist/libs'));
src('./public/sounds/*').pipe(dest('dist/sounds'));

1011
package-lock.json

File diff suppressed because it is too large

BIN
public/images/Bitmap1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
public/images/Bitmap2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
public/images/Bitmap3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
public/images/Bitmap4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
public/images/Bitmap5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
public/images/level.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
public/images/stopDemo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
public/images/suspend.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

BIN
public/images/tomato_right_atlas_1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

BIN
public/images/tomato_right_atlas_10.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

BIN
public/images/tomato_right_atlas_11.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

BIN
public/images/tomato_right_atlas_12.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 KiB

BIN
public/images/tomato_right_atlas_2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

BIN
public/images/tomato_right_atlas_3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

BIN
public/images/tomato_right_atlas_4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

BIN
public/images/tomato_right_atlas_5.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

BIN
public/images/tomato_right_atlas_6.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

BIN
public/images/tomato_right_atlas_7.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

BIN
public/images/tomato_right_atlas_8.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

BIN
public/images/tomato_right_atlas_9.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

BIN
public/images/任务完成_.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
public/images/位图28.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 KiB

BIN
public/images/倒计时_.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
public/images/再来一次_.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
public/images/计时_.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
public/images/返回按钮_.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

13
public/index.html

@ -11,7 +11,7 @@
<head>
<meta charset="UTF-8">
<meta name="authoring-tool" content="Adobe_Animate_CC">
<title>tomato-right</title>
<title>source-code</title>
<!-- write your code here -->
<style>
#animation_container, #_preload_div_ {
@ -22,7 +22,7 @@
}
</style>
<script src="libs/1.0.0/createjs.min.js"></script>
<script src="tomato-right.js"></script>
<script src="source-code.js"></script>
<script src="main.js"></script>
<!-- write your code here -->
</head>
@ -32,6 +32,13 @@
<div id="dom_overlay_container" style="pointer-events:none; overflow:hidden; width:1280px; height:720px; position: absolute; left: 0px; top: 0px; display: none;">
</div>
</div>
<div id='_preload_div_' style='position:absolute; top:0; left:0; display: inline-block; height:720px; width: 1280px; text-align: center;'> <span style='display: inline-block; height: 100%; vertical-align: middle;'></span> <img src=images/_preloader.gif style='vertical-align: middle; max-height: 100%'/></div>
<div id='_preload_div_' style='position:absolute; top:0; left:0; display: inline-block; height:720px; width: 1280px; text-align: center;'>
<span style='display: inline-block; height: 100%; vertical-align: middle;'></span>
<img src=images/_preloader.gif style='vertical-align: middle; max-height: 100%'/>
</div>
<!-- 音频 -->
<audio src="sounds/audio1.mp3" id="audio1" controls="controls" hidden="true"></audio>
<audio src="sounds/audio2.mp3" id="audio2" controls="controls" hidden="true"></audio>
<audio src="sounds/audio3.mp3" id="audio3" controls="controls" hidden="true"></audio>
</body>
</html>

BIN
public/sounds/amazing.mp3

Binary file not shown.

BIN
public/sounds/audio1.mp3

Binary file not shown.

BIN
public/sounds/audio2.mp3

Binary file not shown.

BIN
public/sounds/audio3.mp3

Binary file not shown.

BIN
public/sounds/excitationMusic.mp3

Binary file not shown.

BIN
public/sounds/unbelievable.mp3

Binary file not shown.

BIN
public/tomato-right.fla → public/source-code.fla

Binary file not shown.

6
public/tomato-right.html → public/source-code.html

@ -11,7 +11,7 @@
<head>
<meta charset="UTF-8">
<meta name="authoring-tool" content="Adobe_Animate_CC">
<title>tomato-right</title>
<title>source-code</title>
<!-- write your code here -->
<style>
#animation_container, #_preload_div_ {
@ -22,7 +22,7 @@
}
</style>
<script src="libs/1.0.0/createjs.min.js"></script>
<script src="tomato-right.js"></script>
<script src="source-code.js"></script>
<script>
var canvas, stage, exportRoot, anim_container, dom_overlay_container, fnStartAnimation;
function init() {
@ -53,7 +53,7 @@ function handleComplete(evt,comp) {
var preloaderDiv = document.getElementById("_preload_div_");
preloaderDiv.style.display = 'none';
canvas.style.display = 'block';
exportRoot = new lib.tomatoright();
exportRoot = new lib.sourcecode();
stage = new lib.Stage(canvas);
//Registers the "tick" event listener.
fnStartAnimation = function() {

2630
public/source-code.js

File diff suppressed because one or more lines are too long

2044
public/tomato-right.js

File diff suppressed because it is too large

BIN
public/恢复_source-code.fla

Binary file not shown.

6
src/classes/suspend.js

@ -27,10 +27,10 @@ Suspend.prototype.init = function () {
// 暂停游戏按钮
Suspend.prototype.suspendGame = function () {
// const lib = this.lib;
const suspend = new this.lib.suspend();
const lib = this.lib;
const suspend = new lib.suspend();
suspend.x = 50;
suspend.y = this.lib.properties.height - 100;
suspend.y = lib.properties.height - 100;
this.suspend = suspend;
const _this = this;
// 继续游戏

3
src/index.js

@ -24,7 +24,6 @@ function handleFileLoad(evt, comp) {
function handleComplete(evt, comp) {
//This function is always called, irrespective of the content. You can use the variable "stage" after it is created in token create_stage.
var lib = comp.getLibrary();
var ss = comp.getSpriteSheet();
var queue = evt.target;
var ssMetadata = lib.ssMetadata;
@ -34,7 +33,7 @@ function handleComplete(evt, comp) {
var preloaderDiv = document.getElementById('_preload_div_');
preloaderDiv.style.display = 'none';
canvas.style.display = 'block';
exportRoot = new lib.tomatoright();
exportRoot = new lib.sourcecode();
stage = new lib.Stage(canvas);
//Registers the "tick" event listener.
fnStartAnimation = function () {

1
src/message.js

@ -48,7 +48,6 @@ window.addEventListener(
function playGame(data) {
if (state !== 1) return;
const { status, param } = data;
console.log('param: ', param);
// config.currentScore = score;
// config.currentTimes = times;
state = status;

19
src/test.js

@ -51,7 +51,24 @@ function addHash() {
function test() {
document.addEventListener('click', () => {
if (!isDemo) return;
main.play(config.config.directions[config.currentTimes]);
const code = config.config.directions[config.currentTimes];
main.play(code);
setMusic(code);
});
}
test();
function setMusic(code) {
var audio1 = document.getElementById('audio1');
var audio2 = document.getElementById('audio2');
var audio3 = document.getElementById('audio3');
if (code === 0) {
audio1.play();
}
if (code === 1) {
audio2.play();
}
if (code === 2) {
audio3.play();
}
}

Loading…
Cancel
Save