Authored by 陈轩

save

... ... @@ -22,7 +22,7 @@ app.engine('.hbs', hbs({
extname: '.hbs',
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: ['./views/partial', `${doraemon}/partial`],
partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`],
helpers: global.yoho.helpers
}));
... ...
<canvas id="stage"></canvas>
\ No newline at end of file
<div class="vipday-game game-luck">
{{> vip_day/game-header}}
{{> vip_day/game-main}}
{{> vip_day/game-footer}}
</div>
\ No newline at end of file
... ...
<div class="info">
</div>
<div class="explain">
<div class="explain-txt"></div>
</div>
\ No newline at end of file
... ...
<div class="header">
</div>
\ No newline at end of file
... ...
<div class="game">
</div>
\ No newline at end of file
... ...

3.55 KB | W: | H:

13.7 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
var Game = function(canvas, option) {
canvas.style.backgroundColor = option.background;
this.canvas = canvas;
this.context = canvas.getContext('2d');
this.w = canvas.width = option.width;
this.h = canvas.height = option.height;
this.itemW = option.width / 3;
this.itemH = option.height / 3;
};
Game.prototype = {
_supportTouch: function() { },
start: function() { },
pause: function() { },
addItem: function() {},
addEvent: function() { }
};
Game.Button = function() {
};
Game.Button.prototype = {
addEventListener: function(type, handle) {
}
};
Game.Cursor = function() {
};
document.addEventListener('DOMContentLoaded', function() {
var canvas = document.querySelector('#stage');
var width = 500;
var height = 400;
var itemW = width / 3;
var itemH = height / 3;
var game = new Game(canvas, {
width: width,
height: height,
background: '#32212c'
});
var button = new Game.Button();
var cursor = new Game.Cursor();
var context = game.context;
button.addEventListener('click', function() {
});
function drawLine(c) {
var i, j;
var action = function(begin, end) {
c.lineWidth = 1;
c.strokeStyle = 'black';
c.beginPath();
c.moveTo(begin.x, begin.y);
c.lineTo(end.x, end.y);
c.stroke();
};
for (i = itemH; i < height; i = i + itemH) {
action({ x: 0, y: i }, { x: width, y: i });
}
for (j = itemW; j < width; j = j + itemW) {
action({ x: j, y: 0 }, { x: j, y: height });
}
}
function drawStage(c) {
drawLine(c);
}
drawStage(context);
game.addItem(button);
game.addItem(cursor);
game.start();
});
// var Game = function(canvas, option) {
// canvas.style.backgroundColor = option.background;
// this.canvas = canvas;
// this.context = canvas.getContext('2d');
// this.w = canvas.width = option.width;
// this.h = canvas.height = option.height;
// this.itemW = option.width / 3;
// this.itemH = option.height / 3;
// };
// Game.prototype = {
// _supportTouch: function() { },
// start: function() { },
// pause: function() { },
// addItem: function() {},
// addEvent: function() { }
// };
// Game.Button = function() {
// };
// Game.Button.prototype = {
// addEventListener: function(type, handle) {
// }
// };
// Game.Cursor = function() {
// };
// document.addEventListener('DOMContentLoaded', function() {
// var canvas = document.querySelector('#stage');
// var width = 500;
// var height = 400;
// var itemW = width / 3;
// var itemH = height / 3;
// var game = new Game(canvas, {
// width: width,
// height: height,
// background: '#32212c'
// });
// var button = new Game.Button();
// var cursor = new Game.Cursor();
// var context = game.context;
// button.addEventListener('click', function() {
// });
// function drawLine(c) {
// var i, j;
// var action = function(begin, end) {
// c.lineWidth = 1;
// c.strokeStyle = 'black';
// c.beginPath();
// c.moveTo(begin.x, begin.y);
// c.lineTo(end.x, end.y);
// c.stroke();
// };
// for (i = itemH; i < height; i = i + itemH) {
// action({ x: 0, y: i }, { x: width, y: i });
// }
// for (j = itemW; j < width; j = j + itemW) {
// action({ x: j, y: 0 }, { x: j, y: height });
// }
// }
// function drawStage(c) {
// drawLine(c);
// }
// drawStage(context);
// game.addItem(button);
// game.addItem(cursor);
// game.start();
// });
... ...
@import "live/index";
@import "vip_day/index";
.receive-coupon-page {
* {
margin: 0;
... ...
$color1: #c03729;
.vipday-game {
width: 750px;
border-top: 1PX solid #27272b;
.header {
height: 142px;
background-color: $color1;
}
.game {
height: 536px;
background: resolve('activity/vip_day/stage@2x.png');
background-size: 750px 536px;
}
.info {
position: relative;
padding-bottom: 40px;
background-color: $color1;
}
.explain {
width: 708px;
margin-left: auto;
margin-right: auto;
&:before {
display: block;
content: '';
height: 40px;
background: url('/activity/vip_day/sprite2.png');
background-size: contain;
}
&:after {
}
}
.explain-txt {
width: 680px;
height: 297px;
margin-left: auto;
margin-right: auto;
}
}
\ No newline at end of file
... ...
@import "game";
\ No newline at end of file
... ...
... ... @@ -52,6 +52,10 @@ a {
width: 100%;
}
.width750 .main-wrap {
max-width: 750px;
}
@font-face {
font-family: "iconfont";
src: resolve("iconfont.eot"); /* IE9 */
... ...