This commit is contained in:
Vick Scarlet
2021-10-31 00:13:22 +08:00
parent e38daf3ebb
commit f40698d63e
99 changed files with 291269 additions and 2158 deletions
+8
View File
@@ -0,0 +1,8 @@
{
"configurations": [
{
"source": "../../data",
"target": "../../public/data"
}
]
}
+12
View File
@@ -0,0 +1,12 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=759670
// for the documentation about the jsconfig.json format
"compilerOptions": {
"target": "es5"
},
"exclude": [
"node_modules",
"public",
"view"
]
}
+37
View File
@@ -0,0 +1,37 @@
<project version="0.9.8">
<asynRes>img,temp,sound </asynRes>
<unDealRes>embed </unDealRes>
<resTypes>png,jpg </resTypes>
<resExportPath>public/images/atlas </resExportPath>
<asynResExportPath>public </asynResExportPath>
<codeExportPath>src/ui </codeExportPath>
<codeImports><![CDATA[import laya.ui.*;
import laya.display.*; ]]> </codeImports>
<codeImportsJS><![CDATA[var View=laya.ui.View;
var Dialog=laya.ui.Dialog;]]> </codeImportsJS>
<uiType>0 </uiType>
<uiExportPath>public/ui.json </uiExportPath>
<boxTypes>Box,List,Tab,RadioGroup,ViewStack,Panel,HBox,VBox,Tree,Sprite </boxTypes>
<pageTypes>View,Dialog </pageTypes>
<shareResPath/>
<codeType>2 </codeType>
<resCanCompress/>
<resPublishQuality>80 </resPublishQuality>
<langPath/>
<defaultFont/>
<codeImportsTS><![CDATA[import View=laya.ui.View;
import Dialog=laya.ui.Dialog;]]> </codeImportsTS>
<textureWidth>2048 </textureWidth>
<textureHeight>2048 </textureHeight>
<picWidth>512 </picWidth>
<picHeight>512 </picHeight>
<power2>false </power2>
<trimempty>false </trimempty>
<codeViewExportPath>src/view </codeViewExportPath>
<picType>0 </picType>
<atlasType>1 </atlasType>
<atlasScale/>
<copyRes>true </copyRes>
<dataCompact>true </dataCompact>
<ver>0.9.9 beta </ver>
</project>
-2
View File
File diff suppressed because one or more lines are too long
-2
View File
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
{"proName":"lifeRestart","engineType":0,"proType":2,"layaProType":0}
+3 -4
View File
@@ -5,19 +5,18 @@
"scripts": {
"test": "node test",
"xlsxTransform": "vt transform data",
"xlsx2json": "vt transform jobs/xlsx2json/config.json",
"dev": "webpack serve --open /view/index.html",
"build": "webpack --mode production"
},
"dependencies": {
"devDependencies": {
"@babel/core": "^7.15.4",
"@babel/preset-env": "^7.15.4",
"babel-loader": "^8.2.2",
"core-js": "^3.17.2",
"v-transform": "^1.0.1",
"webpack": "^5.51.2",
"webpack-cli": "^4.8.0",
"webpack-dev-server": "^4.1.0"
},
"devDependencies": {
"webpack-cli": "^4.8.0"
}
}
File diff suppressed because it is too large Load Diff
+71808
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

+13
View File
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="やり直すんだ。そして、次はうまくやる。"/>
<meta name="keywords" content="人生重开模拟器 liferestart life restart remake 人生重来"/>
<title>Life Restart</title>
</head>
<body>
</body>
</html>
+425
View File
@@ -0,0 +1,425 @@
/**
* Matter.js 渲染器在 LayaAir 的实现。
*/
(function()
{
var LayaRender = {};
var Common = Matter.Common;
var Composite = Matter.Composite;
var Bounds = Matter.Bounds;
var Events = Matter.Events;
var Grid = Matter.Grid;
var Vector = Matter.Vector;
/**
* 创建新的渲染器。
* @param {object} options 所有属性都有默认值,options中的属性会覆盖默认属性。
* @return {render} 返回创建的旋绕器
*/
LayaRender.create = function(options)
{
var defaults = {
controller: LayaRender,
engine: null,
element: null,
canvas: null,
mouse: null,
frameRequestId: null,
options:
{
width: 800,
height: 600,
pixelRatio: 1,
background: '#fafafa',
wireframeBackground: '#222222',
hasBounds: !!options.bounds,
enabled: true,
wireframes: true,
showSleeping: true,
showDebug: false,
showBroadphase: false,
showBounds: false,
showVelocity: false,
showCollisions: false,
showSeparations: false,
showAxes: false,
showPositions: false,
showAngleIndicator: false,
showIds: false,
showShadows: false,
showVertexNumbers: false,
showConvexHulls: false,
showInternalEdges: false,
showMousePosition: false
}
};
var render = Common.extend(defaults, options);
render.mouse = options.mouse;
render.engine = options.engine;
// 如果用户没有指定contaienr,默认使用stage
render.container = render.container || Laya.stage;
render.bounds = render.bounds ||
{
min:
{
x: 0,
y: 0
},
max:
{
x: render.width,
y: render.height
}
};
return render;
}
/**
* 运行渲染器。
* @param {render} render 渲染的目标是LayaRender.create()返回的对象
* @return {void}
*/
LayaRender.run = function(render)
{
Laya.timer.frameLoop(1, this, LayaRender.world, [render]);
Events.on(render.engine.world, 'afterRemove', LayaRender.onRemoveSprite);
};
/**
* 停止渲染器。
* @param {render} LayaRender.create()返回的对象
* @return {void}
*/
LayaRender.stop = function(render)
{
Laya.timer.clear(this, LayaRender.world);
Events.off(render.engine.world, 'afterRemove', LayaRender.onRemoveSprite);
}
LayaRender.onRemoveSprite = function(args)
{
var sprite = args.object.layaSprite;
if (sprite && sprite.parent)
sprite.parent.removeChild(sprite);
}
/**
* 渲染给定的 engine 的 Matter.World 对象。
* 这是渲染的入口,每次场景改变时都应该被调用。
* @param {render} render
* @return {void}
*/
LayaRender.world = function(render)
{
var engine = render.engine,
world = engine.world,
renderer = render.renderer,
container = render.container,
options = render.options,
bodies = Composite.allBodies(world),
allConstraints = Composite.allConstraints(world),
constraints = [],
i;
if (options.wireframes)
{
LayaRender.setBackground(render, options.wireframeBackground);
}
else
{
LayaRender.setBackground(render, options.background);
}
// 处理 bounds
var boundsWidth = render.bounds.max.x - render.bounds.min.x,
boundsHeight = render.bounds.max.y - render.bounds.min.y,
boundsScaleX = boundsWidth / render.options.width,
boundsScaleY = boundsHeight / render.options.height;
if (options.hasBounds)
{
// 隐藏不在视口内的bodies
for (i = 0; i < bodies.length; i++)
{
var body = bodies[i];
body.render.sprite.visible = Bounds.overlaps(body.bounds, render.bounds);
}
// 过滤掉不在视口内的 constraints
for (i = 0; i < allConstraints.length; i++)
{
var constraint = allConstraints[i],
bodyA = constraint.bodyA,
bodyB = constraint.bodyB,
pointAWorld = constraint.pointA,
pointBWorld = constraint.pointB;
if (bodyA) pointAWorld = Vector.add(bodyA.position, constraint.pointA);
if (bodyB) pointBWorld = Vector.add(bodyB.position, constraint.pointB);
if (!pointAWorld || !pointBWorld)
continue;
if (Bounds.contains(render.bounds, pointAWorld) || Bounds.contains(render.bounds, pointBWorld))
constraints.push(constraint);
}
// 改变视口
container.scale(1 / boundsScaleX, 1 / boundsScaleY);
container.pos(-render.bounds.min.x * (1 / boundsScaleX), -render.bounds.min.y * (1 / boundsScaleY));
}
else
{
constraints = allConstraints;
}
for (i = 0; i < bodies.length; i++)
LayaRender.body(render, bodies[i]);
for (i = 0; i < constraints.length; i++)
LayaRender.constraint(render, constraints[i]);
};
/**
* 设置背景色或者背景图片。
* @param {render} render
* @param {string} background 16进制颜色字符串或者图片路径
*/
LayaRender.setBackground = function(render, background)
{
if (render.currentBackground !== background)
{
var isColor = background.indexOf && background.indexOf('#') !== -1;
render.container.graphics.clear();
if (isColor)
{
// 使用纯色背景
render.container.bgColor = background;
}
else
{
render.container.loadImage(background);
// 使用背景图片时把背景色设置为白色
render.container.bgColor = "#FFFFFF";
}
render.currentBackground = background;
}
}
/**
* 渲染 body
* @param {render} render
* @param {body} body
* @return {void}
*/
LayaRender.body = function(render, body)
{
var engine = render.engine,
bodyRender = body.render;
if (!bodyRender.visible)
return;
// 有纹理的body
if (bodyRender.sprite && bodyRender.sprite.texture)
{
var spriteId = 'b-' + body.id,
sprite = body.layaSprite,
container = render.container;
// 如果sprite不存在,则初始化一个
if (!sprite)
sprite = body.layaSprite = _createBodySprite(render, body);
// 如果sprite未在显示列表,则添加至显示列表
if (!container.contains(sprite))
container.addChild(sprite);
// 更新sprite位置
sprite.x = body.position.x;
sprite.y = body.position.y;
sprite.rotation = body.angle * 180 / Math.PI;
sprite.scaleX = bodyRender.sprite.xScale || 1;
sprite.scaleY = bodyRender.sprite.yScale || 1;
}
else // 没有纹理的body
{
var primitiveId = 'b-' + body.id,
sprite = body.layaSprite,
container = render.container;
// 如果sprite不存在,则初始化一个
if (!sprite)
{
sprite = body.layaSprite = _createBodyPrimitive(render, body);
sprite.initialAngle = body.angle;
}
// 如果sprite未在显示列表,则添加至显示列表
if (!container.contains(sprite))
container.addChild(sprite);
// 更新sprite位置
sprite.x = body.position.x;
sprite.y = body.position.y;
sprite.rotation = (body.angle - sprite.initialAngle) * 180 / Math.PI;
}
};
/**
* 创建使用纹理的Sprite对象。
* @param {render} render
* @param {body} body
* @return {void}
*/
var _createBodySprite = function(render, body)
{
var bodyRender = body.render,
texturePath = bodyRender.sprite.texture,
sprite = new Laya.Sprite();
sprite.loadImage(texturePath);
sprite.pivotX = body.render.sprite.xOffset;
sprite.pivotY = body.render.sprite.yOffset;
return sprite;
};
/**
* 创建使用矢量绘图的Sprite对象。
* @param {render} render
* @param {body} body
* @return {void}
*/
var _createBodyPrimitive = function(render, body)
{
var bodyRender = body.render,
options = render.options,
sprite = new Laya.Sprite(),
fillStyle, strokeStyle, lineWidth,
part, points = [];
var primitive = sprite.graphics;
primitive.clear();
// 处理 compound parts
for (var k = body.parts.length > 1 ? 1 : 0; k < body.parts.length; k++)
{
part = body.parts[k];
if (!options.wireframes)
{
fillStyle = bodyRender.fillStyle;
strokeStyle = bodyRender.strokeStyle;
lineWidth = bodyRender.lineWidth;
}
else
{
fillStyle = null;
strokeStyle = '#bbbbbb';
lineWidth = 1;
}
points.push(part.vertices[0].x - body.position.x, part.vertices[0].y - body.position.y);
for (var j = 1; j < part.vertices.length; j++)
{
points.push(part.vertices[j].x - body.position.x, part.vertices[j].y - body.position.y);
}
points.push(part.vertices[0].x - body.position.x, part.vertices[0].y - body.position.y);
primitive.drawPoly(0, 0, points, fillStyle, strokeStyle, lineWidth);
// 角度指示器
if (options.showAngleIndicator || options.showAxes)
{
lineWidth = 1;
if (options.wireframes)
{
strokeStyle = '#CD5C5C';
}
else
{
strokeStyle = bodyRender.strokeStyle;
}
primitive.drawLine(part.position.x - body.position.x, part.position.y - body.position.y,
((part.vertices[0].x + part.vertices[part.vertices.length - 1].x) / 2 - body.position.x),
((part.vertices[0].y + part.vertices[part.vertices.length - 1].y) / 2 - body.position.y));
}
}
return sprite;
};
/**
* 绘制 constraint。
* @param {render} render
* @param {constraint} constraint
* @return {void}
*/
LayaRender.constraint = function(render, constraint)
{
var engine = render.engine,
bodyA = constraint.bodyA,
bodyB = constraint.bodyB,
pointA = constraint.pointA,
pointB = constraint.pointB,
container = render.container,
constraintRender = constraint.render,
primitiveId = 'c-' + constraint.id,
sprite = constraint.layaSprite;
// 如果sprite不存在,则初始化一个
if (!sprite)
sprite = constraint.layaSprite = new Laya.Sprite();
var primitive = sprite.graphics;
// constraint 没有两个终点时不渲染
if (!constraintRender.visible || !constraint.pointA || !constraint.pointB)
{
primitive.clear();
return;
}
// 如果sprite未在显示列表,则添加至显示列表
if (!container.contains(sprite))
container.addChild(sprite);
// 渲染 constraint
primitive.clear();
var fromX, fromY, toX, toY;
if (bodyA)
{
fromX = bodyA.position.x + pointA.x;
fromY = bodyA.position.y + pointA.y;
}
else
{
fromX = pointA.x;
fromY = pointA.y;
}
if (bodyB)
{
toX = bodyB.position.x + pointB.x;
toY = bodyB.position.y + pointB.y;
}
else
{
toX = pointB.x;
toY = pointB.y;
}
primitive.drawLine(fromX, fromY, toX, toY, constraintRender.strokeStyle, constraintRender.lineWidth);
};
window.LayaRender = LayaRender;
})();
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+117
View File
@@ -0,0 +1,117 @@
(function(window,document,Laya){
var __un=Laya.un,__uns=Laya.uns,__static=Laya.static,__class=Laya.class,__getset=Laya.getset,__newvec=Laya.__newvec;
var Component3D=laya.d3.component.Component3D,ComponentNode=laya.d3.core.ComponentNode,MeshTerrainSprite3D=laya.d3.core.MeshTerrainSprite3D;
var Sprite3D=laya.d3.core.Sprite3D;
/**
*<code>PathFinding</code>
*/
//class laya.d3.component.PathFind extends laya.d3.component.Component3D
var PathFind=(function(_super){
function PathFind(){
/**@private */
this._meshTerrainSprite3D=null;
/**@private */
this._finder=null;
/**@private */
this._setting=null;
/**寻路网格。*/
this.grid=null;
PathFind.__super.call(this);
}
__class(PathFind,'laya.d3.component.PathFind',_super);
var __proto=PathFind.prototype;
/**
*@private
*初始化载入蒙皮动画组件
*@param owner 所属精灵对象
*/
__proto._load=function(owner){
if (! (owner instanceof laya.d3.core.MeshTerrainSprite3D ))
throw new Error("PathFinding: The owner must MeshTerrainSprite3D!");
_super.prototype._load.call(this,owner);
this._meshTerrainSprite3D=owner;
}
/**
*寻找路径
*@param startX 开始X
*@param startZ 开始Z
*@param endX 结束X
*@param endZ 结束Z
*@return 路径
*/
__proto.findPath=function(startX,startZ,endX,endZ){
var minX=this._meshTerrainSprite3D.minX;
var minZ=this._meshTerrainSprite3D.minZ;
var cellX=this._meshTerrainSprite3D.width / this.grid.width;
var cellZ=this._meshTerrainSprite3D.depth / this.grid.height;
var halfCellX=cellX / 2;
var halfCellZ=cellZ / 2;
var gridStartX=Math.floor((startX-minX)/ cellX);
var gridStartZ=Math.floor((startZ-minZ)/ cellZ);
var gridEndX=Math.floor((endX-minX)/ cellX);
var gridEndZ=Math.floor((endZ-minZ)/ cellZ);
var boundWidth=this.grid.width-1;
var boundHeight=this.grid.height-1;
(gridStartX > boundWidth)&& (gridStartX=boundWidth);
(gridStartZ > boundHeight)&& (gridStartZ=boundHeight);
(gridStartX < 0)&& (gridStartX=0);
(gridStartZ < 0)&& (gridStartZ=0);
(gridEndX > boundWidth)&& (gridEndX=boundWidth);
(gridEndZ > boundHeight)&& (gridEndZ=boundHeight);
(gridEndX < 0)&& (gridEndX=0);
(gridEndZ < 0)&& (gridEndZ=0);
var path=this._finder.findPath(gridStartX,gridStartZ,gridEndX,gridEndZ,this.grid);
this.grid.reset();
for (var i=1;i < path.length-1;i++){
var gridPos=path[i];
gridPos[0]=gridPos[0] *cellX+halfCellX+minX;
gridPos[1]=gridPos[1] *cellZ+halfCellZ+minZ;
}
if (path.length==1){
path[0][0]=endX;
path[0][1]=endX;
}else if (path.length > 1){
path[0][0]=startX;
path[0][1]=startZ;
path[path.length-1][0]=endX;
path[path.length-1][1]=endZ;
}
return path;
}
/**
*设置寻路设置
*@param value 寻路设置
*/
/**
*获取寻路设置
*@return 寻路设置
*/
__getset(0,__proto,'setting',function(){
return this._setting;
},function(value){
(value)&& (this._finder=new PathFinding.finders.AStarFinder(value));
this._setting=value;
});
return PathFind;
})(Component3D)
})(window,document,Laya);
if (typeof define === 'function' && define.amd){
define('laya.core', ['require', "exports"], function(require, exports) {
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
for (var i in Laya) {
var o = Laya[i];
o && o.__isclass && (exports[i] = o);
}
});
}
File diff suppressed because one or more lines are too long
+974
View File
@@ -0,0 +1,974 @@
(function(window,document,Laya){
var __un=Laya.un,__uns=Laya.uns,__static=Laya.static,__class=Laya.class,__getset=Laya.getset,__newvec=Laya.__newvec;
var Bitmap=laya.resource.Bitmap,Browser=laya.utils.Browser,Event=laya.events.Event,EventDispatcher=laya.events.EventDispatcher;
var Handler=laya.utils.Handler,Rectangle=laya.maths.Rectangle,Render=laya.renders.Render,Sprite=laya.display.Sprite;
var Stage=laya.display.Stage,Texture=laya.resource.Texture,Utils=laya.utils.Utils,WebGL=laya.webgl.WebGL;
var WebGLContext=laya.webgl.WebGLContext;
/**
*使用前可用<code>supported</code>
*/
//class laya.device.geolocation.Geolocation
var Geolocation=(function(){
function Geolocation(){}
__class(Geolocation,'laya.device.geolocation.Geolocation');
Geolocation.getCurrentPosition=function(onSuccess,onError){
Geolocation.navigator.geolocation.getCurrentPosition(function(pos){
Geolocation.position.setPosition(pos);
onSuccess.runWith(Geolocation.position);
},
function(error){
onError.runWith(error);
},{
enableHighAccuracy :laya.device.geolocation.Geolocation.enableHighAccuracy,
timeout :laya.device.geolocation.Geolocation.timeout,
maximumAge :laya.device.geolocation.Geolocation.maximumAge
});
}
Geolocation.watchPosition=function(onSuccess,onError){
return Geolocation.navigator.geolocation.watchPosition(function(pos){
Geolocation.position.setPosition(pos);
onSuccess.runWith(Geolocation.position);
},
function(error){
onError.runWith(error);
},{
enableHighAccuracy :Geolocation.enableHighAccuracy,
timeout :Geolocation.timeout,
maximumAge :Geolocation.maximumAge
});
}
Geolocation.clearWatch=function(id){
Geolocation.navigator.geolocation.clearWatch(id);
}
Geolocation.PERMISSION_DENIED=1;
Geolocation.POSITION_UNAVAILABLE=2;
Geolocation.TIMEOUT=3;
Geolocation.enableHighAccuracy=false;
Geolocation.maximumAge=0;
__static(Geolocation,
['navigator',function(){return this.navigator=Browser.window.navigator;},'position',function(){return this.position=new GeolocationInfo();},'supported',function(){return this.supported=!!Geolocation.navigator.geolocation;},'timeout',function(){return this.timeout=1E10;}
]);
return Geolocation;
})()
//class laya.device.geolocation.GeolocationInfo
var GeolocationInfo=(function(){
function GeolocationInfo(){
this.pos=null;
this.coords=null;
}
__class(GeolocationInfo,'laya.device.geolocation.GeolocationInfo');
var __proto=GeolocationInfo.prototype;
__proto.setPosition=function(pos){
this.pos=pos;
this.coords=pos.coords;
}
__getset(0,__proto,'heading',function(){
return this.coords.heading;
});
__getset(0,__proto,'latitude',function(){
return this.coords.latitude;
});
__getset(0,__proto,'altitudeAccuracy',function(){
return this.coords.altitudeAccuracy;
});
__getset(0,__proto,'longitude',function(){
return this.coords.longitude;
});
__getset(0,__proto,'altitude',function(){
return this.coords.altitude;
});
__getset(0,__proto,'accuracy',function(){
return this.coords.accuracy;
});
__getset(0,__proto,'speed',function(){
return this.coords.speed;
});
__getset(0,__proto,'timestamp',function(){
return this.pos.timestamp;
});
return GeolocationInfo;
})()
/**
*Media用于捕捉摄像头和麦克风可以捕捉任意之一或者同时捕捉两者<code>getCamera</code>使<code>supported()</code>
*<b>NOTE:</b>
*<p>目前Media在移动平台只支持Android不支持IOS只可在FireFox完整地使用Chrome测试时无法捕捉视频</p>
*/
//class laya.device.media.Media
var Media=(function(){
function Media(){}
__class(Media,'laya.device.media.Media');
Media.supported=function(){
return !!Browser.window.navigator.getUserMedia;
}
Media.getMedia=function(options,onSuccess,onError){
if (Browser.window.navigator.getUserMedia){
Browser.window.navigator.getUserMedia(options,function(stream){
onSuccess.runWith(Browser.window.URL.createObjectURL(stream));
},function(err){
onError.runWith(err);
});
}
}
Media.__init$=function(){
/*__JS__ */navigator.getUserMedia=navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;;
}
return Media;
})()
/**
*加速度x/y/z的单位均为m/
*在硬件陀螺仪不支持的情况下alphabeta和gamma值为null
*
*@author Survivor
*/
//class laya.device.motion.AccelerationInfo
var AccelerationInfo=(function(){
function AccelerationInfo(){
/**
*x轴上的加速度值
*/
this.x=NaN;
/**
*y轴上的加速度值
*/
this.y=NaN;
/**
*z轴上的加速度值
*/
this.z=NaN;
}
__class(AccelerationInfo,'laya.device.motion.AccelerationInfo');
return AccelerationInfo;
})()
/**
*保存旋转信息的类请勿修改本类的属性
*@author Survivor
*/
//class laya.device.motion.RotationInfo
var RotationInfo=(function(){
function RotationInfo(){
/**
*<p>
*指示设备是否可以提供绝对方位数据指向地球坐标系或者设备决定的任意坐标系
*关于坐标系参见<i>https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Orientation_and_motion_data_explained</i>。
*</p>
*需要注意的是IOS环境下该值始终为false即使如此你依旧可以从<code>alpha</code>
*/
this.absolute=false;
/**
*Z轴旋转角度其值范围从0至360
*<code>absolute</code>trueIOSalpha
*/
this.alpha=NaN;
/**
*X轴旋转角度,其值范围从-180至180代表设备从前至后的运动
*/
this.beta=NaN;
/**
*Y轴旋转角度其值范围从-90至90代表设备从左至右的运动
*/
this.gamma=NaN;
/**
*罗盘数据的精确度角度仅IOS可用
*/
this.compassAccuracy=NaN;
}
__class(RotationInfo,'laya.device.motion.RotationInfo');
return RotationInfo;
})()
/**
*Accelerator.instance获取唯一的Accelerator引用请勿调用构造函数
*
*<p>
*listen()的回调处理器接受四个参数
*<ol>
*<li><b>acceleration</b>:</li>
*<li><b>accelerationIncludingGravity</b>:</li>
*<li><b>rotationRate</b>:</li>
*<li><b>interval</b>:</li>
*</ol>
*</p>
*<p>
*<b>NOTE</b><br/>
*rotationRate的alpha在apple和moz文档中都是z轴旋转角度但是实测是x轴旋转角度为了使各属性表示的值与文档所述相同实际值与其他属性进行了对调
*其中
*<ul>
*<li>alpha使用gamma值</li>
*<li>beta使用alpha值</li>
*<li>gamma使用beta</li>
*</ul>
*目前孰是孰非尚未可知以此为注
*</p>
*/
//class laya.device.motion.Accelerator extends laya.events.EventDispatcher
var Accelerator=(function(_super){
function Accelerator(singleton){
Accelerator.__super.call(this);
/*__JS__ */this.onDeviceOrientationChange=this.onDeviceOrientationChange.bind(this);
}
__class(Accelerator,'laya.device.motion.Accelerator',_super);
var __proto=Accelerator.prototype;
/**
*侦听加速器运动
*@param observer 回调函数接受4个参数见类说明
*/
__proto.on=function(type,caller,listener,args){
_super.prototype.on.call(this,type,caller,listener,args);
Browser.window.addEventListener('devicemotion',this.onDeviceOrientationChange);
return this;
}
/**
*取消侦听加速器
*@param handle 侦听加速器所用处理器
*/
__proto.off=function(type,caller,listener,onceOnly){
(onceOnly===void 0)&& (onceOnly=false);
if (!this.hasListener(type))
Browser.window.removeEventListener('devicemotion',this.onDeviceOrientationChange)
return _super.prototype.off.call(this,type,caller,listener,onceOnly);
}
__proto.onDeviceOrientationChange=function(e){
var interval=e.interval;
Accelerator.acceleration.x=e.acceleration.x;
Accelerator.acceleration.y=e.acceleration.y;
Accelerator.acceleration.z=e.acceleration.z;
Accelerator.accelerationIncludingGravity.x=e.accelerationIncludingGravity.x;
Accelerator.accelerationIncludingGravity.y=e.accelerationIncludingGravity.y;
Accelerator.accelerationIncludingGravity.z=e.accelerationIncludingGravity.z;
Accelerator.rotationRate.alpha=e.rotationRate.gamma *-1;
Accelerator.rotationRate.beta=e.rotationRate.alpha *-1;
Accelerator.rotationRate.gamma=e.rotationRate.beta;
if (Browser.onAndroid){
if (Accelerator.onChrome){
Accelerator.rotationRate.alpha *=180 / Math.PI;
Accelerator.rotationRate.beta *=180 / Math.PI;
Accelerator.rotationRate.gamma *=180 / Math.PI;
}
Accelerator.acceleration.x *=-1;
Accelerator.accelerationIncludingGravity.x *=-1;
}
else if (Browser.onIOS){
Accelerator.acceleration.y *=-1;
Accelerator.acceleration.z *=-1;
Accelerator.accelerationIncludingGravity.y *=-1;
Accelerator.accelerationIncludingGravity.z *=-1;
interval *=1000;
}
this.event(/*laya.events.Event.CHANGE*/"change",[Accelerator.acceleration,Accelerator.accelerationIncludingGravity,Accelerator.rotationRate,interval]);
}
__getset(1,Accelerator,'instance',function(){Accelerator._instance=Accelerator._instance|| new Accelerator(0)
return Accelerator._instance;
},laya.events.EventDispatcher._$SET_instance);
Accelerator.getTransformedAcceleration=function(acceleration){Accelerator.transformedAcceleration=Accelerator.transformedAcceleration|| new AccelerationInfo();
Accelerator.transformedAcceleration.z=acceleration.z;
if (Browser.window.orientation==90){
Accelerator.transformedAcceleration.x=acceleration.y;
Accelerator.transformedAcceleration.y=-acceleration.x;
}
else if (Browser.window.orientation==-90){
Accelerator.transformedAcceleration.x=-acceleration.y;
Accelerator.transformedAcceleration.y=acceleration.x;
}
else if (!Browser.window.orientation){
Accelerator.transformedAcceleration.x=acceleration.x;
Accelerator.transformedAcceleration.y=acceleration.y;
}
else if (Browser.window.orientation==180){
Accelerator.transformedAcceleration.x=-acceleration.x;
Accelerator.transformedAcceleration.y=-acceleration.y;
};
var tx=NaN;
if (Laya.stage.canvasDegree==-90){
tx=Accelerator.transformedAcceleration.x;
Accelerator.transformedAcceleration.x=-Accelerator.transformedAcceleration.y;
Accelerator.transformedAcceleration.y=tx;
}
else if (Laya.stage.canvasDegree==90){
tx=Accelerator.transformedAcceleration.x;
Accelerator.transformedAcceleration.x=Accelerator.transformedAcceleration.y;
Accelerator.transformedAcceleration.y=-tx;
}
return Accelerator.transformedAcceleration;
}
Accelerator._instance=null;
Accelerator.transformedAcceleration=null;
__static(Accelerator,
['acceleration',function(){return this.acceleration=new AccelerationInfo();},'accelerationIncludingGravity',function(){return this.accelerationIncludingGravity=new AccelerationInfo();},'rotationRate',function(){return this.rotationRate=new RotationInfo();},'onChrome',function(){return this.onChrome=(Browser.userAgent.indexOf("Chrome")>-1);}
]);
return Accelerator;
})(EventDispatcher)
/**
*使用Gyroscope.instance获取唯一的Gyroscope引用请勿调用构造函数
*
*<p>
*listen()的回调处理器接受两个参数
*<code>function onOrientationChange(absolute:Boolean,info:RotationInfo):void</code>
*<ol>
*<li><b>absolute</b>:指示设备是否可以提供绝对方位数据(指向地球坐标系),或者设备决定的任意坐标系。关于坐标系参见<i>https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Orientation_and_motion_data_explained</i></li>
*<li><b>info</b>:<code>RotationInfo</code></li>
*</ol>
*</p>
*
*<p>
*浏览器兼容性参见<i>http://caniuse.com/#search=deviceorientation</i>
*</p>
*/
//class laya.device.motion.Gyroscope extends laya.events.EventDispatcher
var Gyroscope=(function(_super){
function Gyroscope(singleton){
Gyroscope.__super.call(this);
/*__JS__ */this.onDeviceOrientationChange=this.onDeviceOrientationChange.bind(this);
}
__class(Gyroscope,'laya.device.motion.Gyroscope',_super);
var __proto=Gyroscope.prototype;
/**
*监视陀螺仪运动
*@param observer 回调函数接受一个Boolean类型的<code>absolute</code><code>GyroscopeInfo</code>
*/
__proto.on=function(type,caller,listener,args){
_super.prototype.on.call(this,type,caller,listener,args);
Browser.window.addEventListener('deviceorientation',this.onDeviceOrientationChange);
return this;
}
/**
*取消指定处理器对陀螺仪的监视
*@param observer
*/
__proto.off=function(type,caller,listener,onceOnly){
(onceOnly===void 0)&& (onceOnly=false);
if (!this.hasListener(type))
Browser.window.removeEventListener('deviceorientation',this.onDeviceOrientationChange);
return _super.prototype.off.call(this,type,caller,listener,onceOnly);
}
__proto.onDeviceOrientationChange=function(e){
Gyroscope.info.alpha=e.alpha;
Gyroscope.info.beta=e.beta;
Gyroscope.info.gamma=e.gamma;
if (e.webkitCompassHeading){
Gyroscope.info.alpha=e.webkitCompassHeading *-1;
Gyroscope.info.compassAccuracy=e.webkitCompassAccuracy;
}
this.event(/*laya.events.Event.CHANGE*/"change",[e.absolute,Gyroscope.info]);
}
__getset(1,Gyroscope,'instance',function(){Gyroscope._instance=Gyroscope._instance|| new Gyroscope(0);
return Gyroscope._instance;
},laya.events.EventDispatcher._$SET_instance);
Gyroscope._instance=null;
__static(Gyroscope,
['info',function(){return this.info=new RotationInfo();}
]);
return Gyroscope;
})(EventDispatcher)
/**
*Shake只能在支持此操作的设备上有效
*
*@author Survivor
*/
//class laya.device.Shake extends laya.events.EventDispatcher
var Shake=(function(_super){
function Shake(){
this.throushold=0;
this.shakeInterval=0;
this.callback=null;
this.lastX=NaN;
this.lastY=NaN;
this.lastZ=NaN;
this.lastMillSecond=NaN;
Shake.__super.call(this);
}
__class(Shake,'laya.device.Shake',_super);
var __proto=Shake.prototype;
/**
*开始响应设备摇晃
*@param throushold 响应的瞬时速度阈值轻度摇晃的值约在5~10
*@param timeout 设备摇晃的响应间隔时间
*@param callback 在设备摇晃触发时调用的处理器
*/
__proto.start=function(throushold,interval){
this.throushold=throushold;
this.shakeInterval=interval;
this.lastX=this.lastY=this.lastZ=NaN;
Accelerator.instance.on(/*laya.events.Event.CHANGE*/"change",this,this.onShake);
}
/**
*停止响应设备摇晃
*/
__proto.stop=function(){
Accelerator.instance.off(/*laya.events.Event.CHANGE*/"change",this,this.onShake);
}
__proto.onShake=function(acceleration,accelerationIncludingGravity,rotationRate,interval){
if(isNaN(this.lastX)){
this.lastX=accelerationIncludingGravity.x;
this.lastY=accelerationIncludingGravity.y;
this.lastZ=accelerationIncludingGravity.z;
this.lastMillSecond=Browser.now();
return;
};
var deltaX=Math.abs(this.lastX-accelerationIncludingGravity.x);
var deltaY=Math.abs(this.lastY-accelerationIncludingGravity.y);
var deltaZ=Math.abs(this.lastZ-accelerationIncludingGravity.z);
if(this.isShaked(deltaX,deltaY,deltaZ)){
var deltaMillSecond=Browser.now()-this.lastMillSecond;
if (deltaMillSecond > this.shakeInterval){
this.event(/*laya.events.Event.CHANGE*/"change");
this.lastMillSecond=Browser.now();
}
}
this.lastX=accelerationIncludingGravity.x;
this.lastY=accelerationIncludingGravity.y;
this.lastZ=accelerationIncludingGravity.z;
}
// 通过任意两个分量判断是否满足摇晃设定。
__proto.isShaked=function(deltaX,deltaY,deltaZ){
return (deltaX > this.throushold && deltaY > this.throushold)||
(deltaX > this.throushold && deltaZ > this.throushold)||
(deltaY > this.throushold && deltaZ > this.throushold)
}
__getset(1,Shake,'instance',function(){Shake._instance=Shake._instance|| new Shake();
return Shake._instance;
},laya.events.EventDispatcher._$SET_instance);
Shake._instance=null;
return Shake;
})(EventDispatcher)
/**
*<code>Video</code>Canvas<code>Video</code>
*<p>关于Video支持的所有事件参见<i>http://www.w3school.com.cn/tags/html_ref_audio_video_dom.asp</i>。</p>
*<p>
*<b>注意</b><br/>
*在PC端可以在任何时机调用<code>play()</code>使Videoplay()Video
*</p>
*
*<p>MDN Video链接 <i>https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video</i></p>
*/
//class laya.device.media.Video extends laya.display.Sprite
var Video=(function(_super){
function Video(width,height){
this.htmlVideo=null;
this.videoElement=null;
this.internalTexture=null;
(width===void 0)&& (width=320);
(height===void 0)&& (height=240);
Video.__super.call(this);
if (Render.isWebGL)
this.htmlVideo=new WebGLVideo();
else
this.htmlVideo=new HtmlVideo();
this.videoElement=this.htmlVideo.getVideo();
this.videoElement.layaTarget=this;
this.internalTexture=new Texture(this.htmlVideo);
this.videoElement.addEventListener("abort",Video.onAbort);
this.videoElement.addEventListener("canplay",Video.onCanplay);
this.videoElement.addEventListener("canplaythrough",Video.onCanplaythrough);
this.videoElement.addEventListener("durationchange",Video.onDurationchange);
this.videoElement.addEventListener("emptied",Video.onEmptied);
this.videoElement.addEventListener("error",Video.onError);
this.videoElement.addEventListener("loadeddata",Video.onLoadeddata);
this.videoElement.addEventListener("loadedmetadata",Video.onLoadedmetadata);
this.videoElement.addEventListener("loadstart",Video.onLoadstart);
this.videoElement.addEventListener("pause",Video.onPause);
this.videoElement.addEventListener("play",Video.onPlay);
this.videoElement.addEventListener("playing",Video.onPlaying);
this.videoElement.addEventListener("progress",Video.onProgress);
this.videoElement.addEventListener("ratechange",Video.onRatechange);
this.videoElement.addEventListener("seeked",Video.onSeeked);
this.videoElement.addEventListener("seeking",Video.onSeeking);
this.videoElement.addEventListener("stalled",Video.onStalled);
this.videoElement.addEventListener("suspend",Video.onSuspend);
this.videoElement.addEventListener("timeupdate",Video.onTimeupdate);
this.videoElement.addEventListener("volumechange",Video.onVolumechange);
this.videoElement.addEventListener("waiting",Video.onWaiting);
this.videoElement.addEventListener("ended",this.onPlayComplete['bind'](this));
this.size(width,height);
if (Browser.onMobile){
/*__JS__ */this.onDocumentClick=this.onDocumentClick.bind(this);
Browser.document.addEventListener("touchend",this.onDocumentClick);
}
}
__class(Video,'laya.device.media.Video',_super);
var __proto=Video.prototype;
__proto.onPlayComplete=function(e){
Laya.timer.clear(this,this.renderCanvas);
this.event("ended");
}
/**
*设置播放源
*@param url 播放源路径
*/
__proto.load=function(url){
if (url.indexOf("blob:")==0)
this.videoElement.src=url;
else
this.htmlVideo.setSource(url,laya.device.media.Video.MP4);
}
/**
*开始播放视频
*/
__proto.play=function(){
this.videoElement.play();
Laya.timer.frameLoop(1,this,this.renderCanvas);
}
/**
*暂停视频播放
*/
__proto.pause=function(){
this.videoElement.pause();
Laya.timer.clear(this,this.renderCanvas);
}
/**
*重新加载视频
*/
__proto.reload=function(){
this.videoElement.load();
}
/**
*检测是否支持播放指定格式视频
*@param type 参数为Video.MP4 / Video.OGG / Video.WEBM之一
*@return 表示支持的级别可能的值
*<ul>
*<li>"probably"Video.SUPPORT_PROBABLY-浏览器最可能支持该音频/视频类型</li>
*<li>"maybe"Video.SUPPORT_MAYBY-浏览器也许支持该音频/视频类型</li>
*<li>""Video.SUPPORT_NO-空字符串浏览器不支持该音频/视频类型</li>
*</ul>
*/
__proto.canPlayType=function(type){
var typeString;
switch (type){
case laya.device.media.Video.MP4:
typeString="video/mp4";
break ;
case laya.device.media.Video.OGG:
typeString="video/ogg";
break ;
case laya.device.media.Video.WEBM:
typeString="video/webm";
break ;
}
return this.videoElement.canPlayType(typeString);
}
__proto.renderCanvas=function(){
if (this.readyState===0)
return;
if (Render.isWebGL)
this.htmlVideo['updateTexture']();
this.graphics.clear();
this.graphics.drawTexture(this.internalTexture,0,0,this.width,this.height);
}
__proto.onDocumentClick=function(){
this.videoElement.play();
this.videoElement.pause();
Browser.document.removeEventListener("touchend",this.onDocumentClick);
}
__proto.size=function(width,height){
_super.prototype.size.call(this,width,height)
this.videoElement.width=width / Browser.pixelRatio;
if (this.paused)this.renderCanvas();
return this;
}
/**
*销毁内部事件绑定
*/
__proto.destroy=function(detroyChildren){
(detroyChildren===void 0)&& (detroyChildren=true);
_super.prototype.destroy.call(this,detroyChildren);
this.videoElement.removeEventListener("abort",Video.onAbort);
this.videoElement.removeEventListener("canplay",Video.onCanplay);
this.videoElement.removeEventListener("canplaythrough",Video.onCanplaythrough);
this.videoElement.removeEventListener("durationchange",Video.onDurationchange);
this.videoElement.removeEventListener("emptied",Video.onEmptied);
this.videoElement.removeEventListener("error",Video.onError);
this.videoElement.removeEventListener("loadeddata",Video.onLoadeddata);
this.videoElement.removeEventListener("loadedmetadata",Video.onLoadedmetadata);
this.videoElement.removeEventListener("loadstart",Video.onLoadstart);
this.videoElement.removeEventListener("pause",Video.onPause);
this.videoElement.removeEventListener("play",Video.onPlay);
this.videoElement.removeEventListener("playing",Video.onPlaying);
this.videoElement.removeEventListener("progress",Video.onProgress);
this.videoElement.removeEventListener("ratechange",Video.onRatechange);
this.videoElement.removeEventListener("seeked",Video.onSeeked);
this.videoElement.removeEventListener("seeking",Video.onSeeking);
this.videoElement.removeEventListener("stalled",Video.onStalled);
this.videoElement.removeEventListener("suspend",Video.onSuspend);
this.videoElement.removeEventListener("timeupdate",Video.onTimeupdate);
this.videoElement.removeEventListener("volumechange",Video.onVolumechange);
this.videoElement.removeEventListener("waiting",Video.onWaiting);
this.videoElement.removeEventListener("ended",this.onPlayComplete);
this.pause();
this.videoElement=null;
}
__proto.syncVideoPosition=function(){
var stage=Laya.stage;
var rec;
rec=Utils.getGlobalPosAndScale(this);
var a=stage._canvasTransform.a,d=stage._canvasTransform.d;
var x=rec.x *stage.clientScaleX *a+stage.offset.x;
var y=rec.y *stage.clientScaleY *d+stage.offset.y;
this.videoElement.style.left=x+'px';;
this.videoElement.style.top=y+'px';
this.videoElement.width=this.width / Browser.pixelRatio;
this.videoElement.height=this.height / Browser.pixelRatio;
}
/**
*buffered 属性返回 TimeRanges(JS)对象TimeRanges 对象表示用户的音视频缓冲范围缓冲范围指的是已缓冲音视频的时间范围如果用户在音视频中跳跃播放会得到多个缓冲范围
*<p>buffered.length返回缓冲范围个数如获取第一个缓冲范围则是buffered.start(0)和buffered.end(0)以秒计</p>
*@return TimeRanges(JS)对象
*/
__getset(0,__proto,'buffered',function(){
return this.videoElement.buffered;
});
/**
*获取视频源尺寸ready事件触发后可用
*/
__getset(0,__proto,'videoWidth',function(){
return this.videoElement.videoWidth;
});
/**
*获取当前播放源路径
*/
__getset(0,__proto,'currentSrc',function(){
return this.videoElement.currentSrc;
});
/**
*设置和获取当前播放头位置
*/
__getset(0,__proto,'currentTime',function(){
return this.videoElement.currentTime;
},function(value){
this.videoElement.currentTime=value;
this.renderCanvas();
});
/**
*返回音频/视频的播放是否已结束
*/
__getset(0,__proto,'ended',function(){
return this.videoElement.ended;
});
/**
*设置和获取当前音量
*/
__getset(0,__proto,'volume',function(){
return this.videoElement.volume;
},function(value){
this.videoElement.volume=value;
});
__getset(0,__proto,'videoHeight',function(){
return this.videoElement.videoHeight;
});
/**
*表示视频元素的就绪状态
*<ul>
*<li>0=HAVE_NOTHING-没有关于音频/视频是否就绪的信息</li>
*<li>1=HAVE_METADATA-关于音频/视频就绪的元数据</li>
*<li>2=HAVE_CURRENT_DATA-关于当前播放位置的数据是可用的但没有足够的数据来播放下一帧/毫秒</li>
*<li>3=HAVE_FUTURE_DATA-当前及至少下一帧的数据是可用的</li>
*<li>4=HAVE_ENOUGH_DATA-可用数据足以开始播放</li>
*</ul>
*/
__getset(0,__proto,'readyState',function(){
return this.videoElement.readyState;
});
/**
*获取视频长度ready事件触发后可用
*/
__getset(0,__proto,'duration',function(){
return this.videoElement.duration;
});
/**
*返回表示音频/视频错误状态的 MediaErrorJS对象
*/
__getset(0,__proto,'error',function(){
return this.videoElement.error;
});
/**
*设置或返回音频/视频是否应在结束时重新播放
*/
__getset(0,__proto,'loop',function(){
return this.videoElement.loop;
},function(value){
this.videoElement.loop=value;
});
/**
*playbackRate 属性设置或返回音频/视频的当前播放速度
*<ul>
*<li>1.0 正常速度</li>
*<li>0.5 半速更慢</li>
*<li>2.0 倍速更快</li>
*<li>-1.0 向后正常速度</li>
*<li>-0.5 向后半速</li>
*</ul>
*<p>只有 Google Chrome Safari 支持 playbackRate 属性</p>
*/
__getset(0,__proto,'playbackRate',function(){
return this.videoElement.playbackRate;
},function(value){
this.videoElement.playbackRate=value;
});
/**
*获取和设置静音状态
*/
__getset(0,__proto,'muted',function(){
return this.videoElement.muted;
},function(value){
this.videoElement.muted=value;
});
/**
*返回视频是否暂停
*/
__getset(0,__proto,'paused',function(){
return this.videoElement.paused;
});
/**
*preload 属性设置或返回是否在页面加载后立即加载视频可赋值如下
*<ul>
*<li>auto 指示一旦页面加载则开始加载视频</li>
*<li>metadata 指示当页面加载后仅加载音频/视频的元数据</li>
*<li>none 指示页面加载后不应加载音频/视频</li>
*</ul>
*/
__getset(0,__proto,'preload',function(){
return this.videoElement.preload;
},function(value){
this.videoElement.preload=value;
});
/**
*参见 <i>http://www.w3school.com.cn/tags/av_prop_seekable.asp</i>。
*/
__getset(0,__proto,'seekable',function(){
return this.videoElement.seekable;
});
/**
*seeking 属性返回用户目前是否在音频/视频中寻址
*寻址中Seeking指的是用户在音频/视频中移动/跳跃到新的位置
*/
__getset(0,__proto,'seeking',function(){
return this.videoElement.seeking;
});
__getset(0,__proto,'height',_super.prototype._$get_height,function(value){
Laya.superSet(Sprite,this,'height',value);
if (this.paused)this.renderCanvas();
});
__getset(0,__proto,'width',_super.prototype._$get_width,function(value){
this.videoElement.width=this.width / Browser.pixelRatio;
Laya.superSet(Sprite,this,'width',value);
if (this.paused)this.renderCanvas();
});
Video.onAbort=function(e){e.target.layaTarget.event("abort")}
Video.onCanplay=function(e){e.target.layaTarget.event("canplay")}
Video.onCanplaythrough=function(e){e.target.layaTarget.event("canplaythrough")}
Video.onDurationchange=function(e){e.target.layaTarget.event("durationchange")}
Video.onEmptied=function(e){e.target.layaTarget.event("emptied")}
Video.onError=function(e){e.target.layaTarget.event("error")}
Video.onLoadeddata=function(e){e.target.layaTarget.event("loadeddata")}
Video.onLoadedmetadata=function(e){e.target.layaTarget.event("loadedmetadata")}
Video.onLoadstart=function(e){e.target.layaTarget.event("loadstart")}
Video.onPause=function(e){e.target.layaTarget.event("pause")}
Video.onPlay=function(e){e.target.layaTarget.event("play")}
Video.onPlaying=function(e){e.target.layaTarget.event("playing")}
Video.onProgress=function(e){e.target.layaTarget.event("progress")}
Video.onRatechange=function(e){e.target.layaTarget.event("ratechange")}
Video.onSeeked=function(e){e.target.layaTarget.event("seeked")}
Video.onSeeking=function(e){e.target.layaTarget.event("seeking")}
Video.onStalled=function(e){e.target.layaTarget.event("stalled")}
Video.onSuspend=function(e){e.target.layaTarget.event("suspend")}
Video.onTimeupdate=function(e){e.target.layaTarget.event("timeupdate")}
Video.onVolumechange=function(e){e.target.layaTarget.event("volumechange")}
Video.onWaiting=function(e){e.target.layaTarget.event("waiting")}
Video.MP4=1;
Video.OGG=2;
Video.CAMERA=4;
Video.WEBM=8;
Video.SUPPORT_PROBABLY="probably";
Video.SUPPORT_MAYBY="maybe";
Video.SUPPORT_NO="";
return Video;
})(Sprite)
/**
*@private
*/
//class laya.device.media.HtmlVideo extends laya.resource.Bitmap
var HtmlVideo=(function(_super){
function HtmlVideo(){
this.video=null;
HtmlVideo.__super.call(this);
this._w=1;
this._h=1;
this.createDomElement();
}
__class(HtmlVideo,'laya.device.media.HtmlVideo',_super);
var __proto=HtmlVideo.prototype;
__proto.createDomElement=function(){
var _$this=this;
this._source=this.video=Browser.createElement("video");
var style=this.video.style;
style.position='absolute';
style.top='0px';
style.left='0px';
this.video.addEventListener("loadedmetadata",(function(){
this._w=_$this.video.videoWidth;
this._h=_$this.video.videoHeight;
})['bind'](this));
}
__proto.setSource=function(url,extension){
while(this.video.childElementCount)
this.video.firstChild.remove();
if (extension & Video.MP4)
this.appendSource(url,"video/mp4");
if (extension & Video.OGG)
this.appendSource(url+".ogg","video/ogg");
}
__proto.appendSource=function(source,type){
var sourceElement=Browser.createElement("source");
sourceElement.src=source;
sourceElement.type=type;
this.video.appendChild(sourceElement);
}
__proto.getVideo=function(){
return this.video;
}
HtmlVideo.create=function(){
return new HtmlVideo();
}
return HtmlVideo;
})(Bitmap)
/**
*@private
*/
//class laya.device.media.WebGLVideo extends laya.device.media.HtmlVideo
var WebGLVideo=(function(_super){
function WebGLVideo(){
this.gl=null;
this.preTarget=null;
this.preTexture=null;
WebGLVideo.__super.call(this);
if(Browser.onIPhone)
return;
this.gl=WebGL.mainContext;
this._source=this.gl.createTexture();
this.preTarget=WebGLContext.curBindTexTarget;
this.preTexture=WebGLContext.curBindTexValue;
WebGLContext.bindTexture(this.gl,/*laya.webgl.WebGLContext.TEXTURE_2D*/0x0DE1,this._source);
this.gl.texParameteri(/*laya.webgl.WebGLContext.TEXTURE_2D*/0x0DE1,/*laya.webgl.WebGLContext.TEXTURE_WRAP_S*/0x2802,/*laya.webgl.WebGLContext.CLAMP_TO_EDGE*/0x812F);
this.gl.texParameteri(/*laya.webgl.WebGLContext.TEXTURE_2D*/0x0DE1,/*laya.webgl.WebGLContext.TEXTURE_WRAP_T*/0x2803,/*laya.webgl.WebGLContext.CLAMP_TO_EDGE*/0x812F);
this.gl.texParameteri(/*laya.webgl.WebGLContext.TEXTURE_2D*/0x0DE1,/*laya.webgl.WebGLContext.TEXTURE_MAG_FILTER*/0x2800,/*laya.webgl.WebGLContext.LINEAR*/0x2601);
this.gl.texParameteri(/*laya.webgl.WebGLContext.TEXTURE_2D*/0x0DE1,/*laya.webgl.WebGLContext.TEXTURE_MIN_FILTER*/0x2801,/*laya.webgl.WebGLContext.LINEAR*/0x2601);
(this.preTarget && this.preTexture)&& (WebGLContext.bindTexture(this.gl,this.preTarget,this.preTexture));
}
__class(WebGLVideo,'laya.device.media.WebGLVideo',_super);
var __proto=WebGLVideo.prototype;
__proto.updateTexture=function(){
if(Browser.onIPhone)
return;
WebGLContext.bindTexture(this.gl,/*laya.webgl.WebGLContext.TEXTURE_2D*/0x0DE1,this._source);
this.gl.texImage2D(/*laya.webgl.WebGLContext.TEXTURE_2D*/0x0DE1,0,/*laya.webgl.WebGLContext.RGB*/0x1907,/*laya.webgl.WebGLContext.RGB*/0x1907,/*laya.webgl.WebGLContext.UNSIGNED_BYTE*/0x1401,this.video);
}
return WebGLVideo;
})(HtmlVideo)
Laya.__init([Media]);
})(window,document,Laya);
if (typeof define === 'function' && define.amd){
define('laya.core', ['require', "exports"], function(require, exports) {
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
for (var i in Laya) {
var o = Laya[i];
o && o.__isclass && (exports[i] = o);
}
});
}
+353
View File
@@ -0,0 +1,353 @@
(function(window,document,Laya){
var __un=Laya.un,__uns=Laya.uns,__static=Laya.static,__class=Laya.class,__getset=Laya.getset,__newvec=Laya.__newvec;
var Browser=laya.utils.Browser,Color=laya.utils.Color,ColorFilterAction=laya.filters.ColorFilterAction;
var ColorFilterActionGL=laya.filters.webgl.ColorFilterActionGL,Filter=laya.filters.Filter,FilterActionGL=laya.filters.webgl.FilterActionGL;
var Matrix=laya.maths.Matrix,Rectangle=laya.maths.Rectangle,Render=laya.renders.Render,RenderContext=laya.renders.RenderContext;
var RenderTarget2D=laya.webgl.resource.RenderTarget2D,RunDriver=laya.utils.RunDriver,ShaderDefines2D=laya.webgl.shader.d2.ShaderDefines2D;
var Sprite=laya.display.Sprite,Texture=laya.resource.Texture,Value2D=laya.webgl.shader.d2.value.Value2D;
/**
*默认的FILTER,什么都不做
*@private
*/
//class laya.filters.FilterAction
var FilterAction=(function(){
function FilterAction(){
this.data=null;
}
__class(FilterAction,'laya.filters.FilterAction');
var __proto=FilterAction.prototype;
Laya.imps(__proto,{"laya.filters.IFilterAction":true})
__proto.apply=function(data){
return null;
}
return FilterAction;
})()
/**
*@private
*/
//class laya.filters.WebGLFilter
var WebGLFilter=(function(){
function WebGLFilter(){}
__class(WebGLFilter,'laya.filters.WebGLFilter');
WebGLFilter.enable=function(){
if (WebGLFilter.isInit)return;
WebGLFilter.isInit=true;
if (!Render.isWebGL)return;
RunDriver.createFilterAction=function (type){
var action;
switch (type){
case /*laya.filters.Filter.COLOR*/0x20:
action=new ColorFilterActionGL();
break ;
case /*laya.filters.Filter.BLUR*/0x10:
action=new BlurFilterActionGL();
break ;
case /*laya.filters.Filter.GLOW*/0x08:
action=new GlowFilterActionGL();
break ;
}
return action;
}
}
WebGLFilter.isInit=false;
WebGLFilter.__init$=function(){
BlurFilterActionGL;
ColorFilterActionGL;
GlowFilterActionGL;
Render;
RunDriver;{
RunDriver.createFilterAction=function (type){
var action;
switch (type){
case /*laya.filters.Filter.BLUR*/0x10:
action=new FilterAction();
break ;
case /*laya.filters.Filter.GLOW*/0x08:
action=new FilterAction();
break ;
case /*laya.filters.Filter.COLOR*/0x20:
action=new ColorFilterAction();
break ;
}
return action;
}
}
}
return WebGLFilter;
})()
/**
*模糊滤镜
*/
//class laya.filters.BlurFilter extends laya.filters.Filter
var BlurFilter=(function(_super){
function BlurFilter(strength){
/**模糊滤镜的强度(值越大,越不清晰 */
this.strength=NaN;
this.strength_sig2_2sig2_gauss1=[];
BlurFilter.__super.call(this);
(strength===void 0)&& (strength=4);
if (Render.isWebGL)WebGLFilter.enable();
this.strength=strength;
this._action=RunDriver.createFilterAction(0x10);
this._action.data=this;
}
__class(BlurFilter,'laya.filters.BlurFilter',_super);
var __proto=BlurFilter.prototype;
/**
*@private 通知微端
*/
__proto.callNative=function(sp){
sp.conchModel &&sp.conchModel.blurFilter&&sp.conchModel.blurFilter(this.strength);
}
/**
*@private
*当前滤镜对应的操作器
*/
__getset(0,__proto,'action',function(){
return this._action;
});
/**
*@private
*当前滤镜的类型
*/
__getset(0,__proto,'type',function(){
return 0x10;
});
return BlurFilter;
})(Filter)
/**
*发光滤镜(也可以当成阴影滤使用
*/
//class laya.filters.GlowFilter extends laya.filters.Filter
var GlowFilter=(function(_super){
function GlowFilter(color,blur,offX,offY){
/**滤镜的颜色*/
this._color=null;
GlowFilter.__super.call(this);
this._elements=new Float32Array(9);
(blur===void 0)&& (blur=4);
(offX===void 0)&& (offX=6);
(offY===void 0)&& (offY=6);
if (Render.isWebGL){
WebGLFilter.enable();
}
this._color=new Color(color);
this.blur=Math.min(blur,20);
this.offX=offX;
this.offY=offY;
this._action=RunDriver.createFilterAction(0x08);
this._action.data=this;
}
__class(GlowFilter,'laya.filters.GlowFilter',_super);
var __proto=GlowFilter.prototype;
/**@private */
__proto.getColor=function(){
return this._color._color;
}
/**
*@private 通知微端
*/
__proto.callNative=function(sp){
sp.conchModel &&sp.conchModel.glowFilter&&sp.conchModel.glowFilter(this._color.strColor,this._elements[4],this._elements[5],this._elements[6]);
}
/**
*@private
*滤镜类型
*/
__getset(0,__proto,'type',function(){
return 0x08;
});
/**@private */
__getset(0,__proto,'action',function(){
return this._action;
});
/**@private */
/**@private */
__getset(0,__proto,'offY',function(){
return this._elements[6];
},function(value){
this._elements[6]=value;
});
/**@private */
/**@private */
__getset(0,__proto,'offX',function(){
return this._elements[5];
},function(value){
this._elements[5]=value;
});
/**@private */
/**@private */
__getset(0,__proto,'blur',function(){
return this._elements[4];
},function(value){
this._elements[4]=value;
});
return GlowFilter;
})(Filter)
/**
*@private
*/
//class laya.filters.webgl.BlurFilterActionGL extends laya.filters.webgl.FilterActionGL
var BlurFilterActionGL=(function(_super){
function BlurFilterActionGL(){
this.data=null;
BlurFilterActionGL.__super.call(this);
}
__class(BlurFilterActionGL,'laya.filters.webgl.BlurFilterActionGL',_super);
var __proto=BlurFilterActionGL.prototype;
__proto.setValueMix=function(shader){
shader.defines.add(this.data.type);
var o=shader;
}
__proto.apply3d=function(scope,sprite,context,x,y){
var b=scope.getValue("bounds");
var shaderValue=Value2D.create(/*laya.webgl.shader.d2.ShaderDefines2D.TEXTURE2D*/0x01,0);
shaderValue.setFilters([this.data]);
var tMatrix=Matrix.EMPTY;
tMatrix.identity();
context.ctx.drawTarget(scope,0,0,b.width,b.height,Matrix.EMPTY,"src",shaderValue);
shaderValue.setFilters(null);
}
__proto.setValue=function(shader){
shader.strength=this.data.strength;
var sigma=this.data.strength/3.0;
var sigma2=sigma*sigma;
this.data.strength_sig2_2sig2_gauss1[0]=this.data.strength;
this.data.strength_sig2_2sig2_gauss1[1]=sigma2;
this.data.strength_sig2_2sig2_gauss1[2]=2.0*sigma2;
this.data.strength_sig2_2sig2_gauss1[3]=1.0/(2.0*Math.PI*sigma2);
shader.strength_sig2_2sig2_gauss1=this.data.strength_sig2_2sig2_gauss1;
}
__getset(0,__proto,'typeMix',function(){return /*laya.filters.Filter.BLUR*/0x10;});
return BlurFilterActionGL;
})(FilterActionGL)
/**
*@private
*/
//class laya.filters.webgl.GlowFilterActionGL extends laya.filters.webgl.FilterActionGL
var GlowFilterActionGL=(function(_super){
function GlowFilterActionGL(){
this.data=null;
this._initKey=false;
this._textureWidth=0;
this._textureHeight=0;
GlowFilterActionGL.__super.call(this);
}
__class(GlowFilterActionGL,'laya.filters.webgl.GlowFilterActionGL',_super);
var __proto=GlowFilterActionGL.prototype;
Laya.imps(__proto,{"laya.filters.IFilterActionGL":true})
__proto.setValueMix=function(shader){}
__proto.apply3d=function(scope,sprite,context,x,y){
var b=scope.getValue("bounds");
scope.addValue("color",this.data.getColor());
var w=b.width,h=b.height;
this._textureWidth=w;
this._textureHeight=h;
var shaderValue;
var mat=Matrix.TEMP;
mat.identity();
shaderValue=Value2D.create(/*laya.webgl.shader.d2.ShaderDefines2D.TEXTURE2D*/0x01,0);
shaderValue.setFilters([this.data]);
context.ctx.drawTarget(scope,0,0,this._textureWidth,this._textureHeight,mat,"src",shaderValue,null);
shaderValue=Value2D.create(/*laya.webgl.shader.d2.ShaderDefines2D.TEXTURE2D*/0x01,0);
context.ctx.drawTarget(scope,0,0,this._textureWidth,this._textureHeight,mat,"src",shaderValue);
return null;
}
__proto.setSpriteWH=function(sprite){
this._textureWidth=sprite.width;
this._textureHeight=sprite.height;
}
__proto.setValue=function(shader){
shader.u_offsetX=this.data.offX;
shader.u_offsetY=-this.data.offY;
shader.u_strength=1.0;
shader.u_blurX=this.data.blur;
shader.u_blurY=this.data.blur;
shader.u_textW=this._textureWidth;
shader.u_textH=this._textureHeight;
shader.u_color=this.data.getColor();
}
__getset(0,__proto,'typeMix',function(){return /*laya.filters.Filter.GLOW*/0x08;});
GlowFilterActionGL.tmpTarget=function(scope,sprite,context,x,y){
var b=scope.getValue("bounds");
var out=scope.getValue("out");
out.end();
var tmpTarget=RenderTarget2D.create(b.width,b.height);
tmpTarget.start();
var color=scope.getValue("color");
if (color){
tmpTarget.clear(color[0],color[1],color[2],0);
}
scope.addValue("tmpTarget",tmpTarget);
}
GlowFilterActionGL.startOut=function(scope,sprite,context,x,y){
var tmpTarget=scope.getValue("tmpTarget");
tmpTarget.end();
var out=scope.getValue("out");
out.start();
var color=scope.getValue("color");
if (color){
out.clear(color[0],color[1],color[2],0);
}
}
GlowFilterActionGL.recycleTarget=function(scope,sprite,context,x,y){
var src=scope.getValue("src");
var tmpTarget=scope.getValue("tmpTarget");
tmpTarget.recycle();
}
return GlowFilterActionGL;
})(FilterActionGL)
Laya.__init([WebGLFilter]);
})(window,document,Laya);
if (typeof define === 'function' && define.amd){
define('laya.core', ['require', "exports"], function(require, exports) {
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
for (var i in Laya) {
var o = Laya[i];
o && o.__isclass && (exports[i] = o);
}
});
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+319
View File
@@ -0,0 +1,319 @@
var Browser = laya.utils.Browser;
var Composite = Matter.Composite;
var Events = Matter.Events;
var Bounds = Matter.Bounds;
var Common = Matter.Common;
var Vertices = Matter.Vertices;
var Vector = Matter.Vector;
var Sleeping = Matter.Sleeping;
var Axes = Matter.Axes;
var Body = Matter.Body;
var SAT = Matter.SAT;
var Contact = Matter.Contact;
var Pair = Matter.Pair;
var Detector = Matter.Detector;
var Grid = Matter.Grid;
var LayaRender = {};
(function()
{
var graphics,
spriteCon,
graphicsCon;
LayaRender.create = function(options)
{
var defaults = {
controller: LayaRender,
element: null,
canvas: null,
mouse: null,
options:
{
width: 800,
height: 600,
pixelRatio: 1,
background: '#fafafa',
wireframeBackground: '#222',
hasBounds: !!options.bounds,
enabled: true,
wireframes: true,
showSleeping: true,
showDebug: false,
showBroadphase: false,
showBounds: false,
showVelocity: false,
showCollisions: false,
showSeparations: false,
showAxes: false,
showPositions: false,
showAngleIndicator: false,
showIds: false,
showShadows: false,
showVertexNumbers: false,
showConvexHulls: false,
showInternalEdges: false,
showMousePosition: false
}
};
var render = Common.extend(defaults, options);
render.canvas = laya.renders.Render.canvas;
render.context = laya.renders.Render.context.ctx;
render.textures = {};
render.bounds = render.bounds ||
{
min:
{
x: 0,
y: 0
},
max:
{
x: Laya.stage.width,
y: Laya.stage.height
}
};
createContainer(render);
setBackground(render);
setPixelRatio();
return render;
};
function createContainer(render)
{
var con = render.container;
spriteCon = new Laya.Sprite();
graphicsCon = new Laya.Sprite();
render.spriteContainer = spriteCon;
render.graphicsContainer = graphicsCon;
con.addChild(spriteCon);
con.addChild(graphicsCon);
graphics = graphicsCon.graphics;
}
// 设置背景
function setBackground(render)
{
var bg = render.options.background;
// 纯色背景
if (bg.length == 7 && bg[0] == '#')
{
spriteCon.graphics.drawRect(
0, 0,
render.options.width, render.options.height,
bg);
}
// 图片背景
else
{
spriteCon.loadImage(bg);
}
}
function setPixelRatio()
{
var pixelRatio;
pixelRatio = 1;
Laya.Render.canvas.setAttribute('data-pixel-ratio', pixelRatio);
}
/**
* Renders the given `engine`'s `Matter.World` object.
* This is the entry point for all rendering and should be called every time the scene changes.
* @method world
* @param {engine} engine
*/
LayaRender.world = function(engine)
{
var render = engine.render,
world = engine.world,
options = render.options,
allConstraints = Composite.allConstraints(world),
bodies = Composite.allBodies(world),
constraints = [],
i;
// handle bounds
if (options.hasBounds)
{
var boundsWidth = render.bounds.max.x - render.bounds.min.x,
boundsHeight = render.bounds.max.y - render.bounds.min.y,
boundsScaleX = boundsWidth / options.width,
boundsScaleY = boundsHeight / options.height;
// filter out bodies that are not in view
for (i = 0; i < bodies.length; i++)
{
var body = bodies[i];
body.render.sprite.visible = Bounds.overlaps(body.bounds, render.bounds);
}
// filter out constraints that are not in view
for (i = 0; i < allConstraints.length; i++)
{
var constraint = allConstraints[i],
bodyA = constraint.bodyA,
bodyB = constraint.bodyB,
pointAWorld = constraint.pointA,
pointBWorld = constraint.pointB;
if (bodyA) pointAWorld = Vector.add(bodyA.position, constraint.pointA);
if (bodyB) pointBWorld = Vector.add(bodyB.position, constraint.pointB);
if (!pointAWorld || !pointBWorld)
continue;
if (Bounds.contains(render.bounds, pointAWorld) || Bounds.contains(render.bounds, pointBWorld))
constraints.push(constraint);
}
// transform the view
// context.scale(1 / boundsScaleX, 1 / boundsScaleY);
// context.translate(-render.bounds.min.x, -render.bounds.min.y);
}
else
{
constraints = allConstraints;
}
graphics.clear();
for (i = 0; i < bodies.length; i++)
LayaRender.body(engine, bodies[i]);
for (i = 0; i < constraints.length; i++)
LayaRender.constraint(engine, constraints[i]);
};
LayaRender.body = function(engine, body)
{
var render = engine.render,
bodyRender = body.render;
if (!bodyRender.visible)
{
return;
}
var spInfo = bodyRender.sprite;
var sp = body.sprite;
if (bodyRender.sprite && bodyRender.sprite.texture)
{
// initialize body sprite if not existing
if (!sp)
{
sp = body.sprite = createBodySprite(spInfo.xOffset, spInfo.yOffset);
sp.loadImage(spInfo.texture);
}
sp.scale(spInfo.xScale, spInfo.yScale);
sp.pos(body.position.x, body.position.y);
sp.rotation = body.angle * 180 / Math.PI;
}
else
{
var options = render.options;
// handle compound parts
for (k = body.parts.length > 1 ? 1 : 0; k < body.parts.length; k++)
{
part = body.parts[k];
if (!part.render.visible)
continue;
var fillStyle = options.wireframes ? null : part.render.fillStyle;
var lineWidth = part.render.lineWidth;
var strokeStyle = part.render.strokeStyle;
// part polygon
if (part.circleRadius)
{
graphics.drawCircle(part.position.x, part.position.y, part.circleRadius, fillStyle, strokeStyle, lineWidth);
}
else
{
var path = [];
path.push(part.vertices[0].x, part.vertices[0].y);
for (var j = 1; j < part.vertices.length; j++)
{
if (!part.vertices[j - 1].isInternal || showInternalEdges)
{
path.push(part.vertices[j].x, part.vertices[j].y);
}
else
{
path.push(part.vertices[j].x, part.vertices[j].y);
}
if (part.vertices[j].isInternal && !showInternalEdges)
{
path.push(part.vertices[(j + 1) % part.vertices.length].x, part.vertices[(j + 1) % part.vertices.length].y);
}
}
graphics.drawPoly(0, 0, path, fillStyle, strokeStyle, lineWidth);
}
}
}
};
LayaRender.constraint = function(engine, constraint)
{
var sx, sy, ex, ey;
if (!constraint.render.visible || !constraint.pointA || !constraint.pointB)
{
return;
}
var bodyA = constraint.bodyA,
bodyB = constraint.bodyB;
if (bodyA)
{
sx = bodyA.position.x + constraint.pointA.x;
sy = bodyA.position.y + constraint.pointA.y;
}
else
{
sx = constraint.pointA.x;
sy = constraint.pointA.y;
}
if (bodyB)
{
ex = bodyB.position.x + constraint.pointB.x;
ey = bodyB.position.y + constraint.pointB.y;
}
else
{
ex = constraint.pointB.x;
ey = constraint.pointB.y;
}
graphics.drawLine(
sx, sy, ex, ey,
constraint.render.strokeStyle,
constraint.render.lineWidth);
};
function createBodySprite(xOffset, yOffset)
{
var sp = new Laya.Sprite();
sp.pivot(xOffset, yOffset);
sp.pos(-9999, -9999);
spriteCon.addChild(sp);
return sp;
}
})();
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
!function(t){t.un,t.uns,t.static;var n=t.class,r=t.getset,t=(t.__newvec,laya.d3.component.Component3D);laya.d3.core.ComponentNode,laya.d3.core.MeshTerrainSprite3D,laya.d3.core.Sprite3D,function(i){function t(){this._meshTerrainSprite3D=null,this._finder=null,this._setting=null,this.grid=null,t.__super.call(this)}n(t,"laya.d3.component.PathFind",i);var e=t.prototype;e._load=function(t){if(!(t instanceof laya.d3.core.MeshTerrainSprite3D))throw new Error("PathFinding: The owner must MeshTerrainSprite3D!");i.prototype._load.call(this,t),this._meshTerrainSprite3D=t},e.findPath=function(t,i,e,n){var r=this._meshTerrainSprite3D.minX,a=this._meshTerrainSprite3D.minZ,h=this._meshTerrainSprite3D.width/this.grid.width,s=this._meshTerrainSprite3D.depth/this.grid.height,o=h/2,d=s/2,l=Math.floor((t-r)/h),f=Math.floor((i-a)/s),c=Math.floor((e-r)/h),u=Math.floor((n-a)/s),p=this.grid.width-1,_=this.grid.height-1,g=this._finder.findPath(l=(l=p<l?p:l)<0?0:l,f=(f=_<f?_:f)<0?0:f,c=(c=p<c?p:c)<0?0:c,u=(u=_<u?_:u)<0?0:u,this.grid);this.grid.reset();for(var m=1;m<g.length-1;m++){var y=g[m];y[0]=y[0]*h+o+r,y[1]=y[1]*s+d+a}return 1==g.length?(g[0][0]=e,g[0][1]=e):1<g.length&&(g[0][0]=t,g[0][1]=i,g[g.length-1][0]=e,g[g.length-1][1]=n),g},r(0,e,"setting",function(){return this._setting},function(t){t&&(this._finder=new PathFinding.finders.AStarFinder(t)),this._setting=t})}(t)}((window,document,Laya)),"function"==typeof define&&define.amd&&define("laya.core",["require","exports"],function(t,i){"use strict";for(var e in Object.defineProperty(i,"__esModule",{value:!0}),Laya){var n=Laya[e];n&&n.__isclass&&(i[e]=n)}});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
!function(i){i.un,i.uns,i.static;var a=i.class,n=i.getset,s=(i.__newvec,laya.utils.Browser,laya.utils.Color),r=laya.filters.ColorFilterAction,l=laya.filters.webgl.ColorFilterActionGL,o=laya.filters.Filter,u=laya.filters.webgl.FilterActionGL,c=laya.maths.Matrix,h=(laya.maths.Rectangle,laya.renders.Render),_=(laya.renders.RenderContext,laya.webgl.resource.RenderTarget2D),d=laya.utils.RunDriver,f=(laya.webgl.shader.d2.ShaderDefines2D,laya.display.Sprite,laya.resource.Texture,laya.webgl.shader.d2.value.Value2D),g=function(){function t(){this.data=null}a(t,"laya.filters.FilterAction");var e=t.prototype;return i.imps(e,{"laya.filters.IFilterAction":!0}),e.apply=function(t){return null},t}(),y=(a(t,"laya.filters.WebGLFilter"),t.enable=function(){t.isInit||(t.isInit=!0,h.isWebGL&&(d.createFilterAction=function(t){var e;switch(t){case 32:e=new l;break;case 16:e=new p;break;case 8:e=new w}return e}))},t.isInit=!1,t.__init$=function(){d.createFilterAction=function(t){var e;switch(t){case 16:case 8:e=new g;break;case 32:e=new r}return e}},t);function t(){}(function(){function e(t){this.strength=NaN,this.strength_sig2_2sig2_gauss1=[],e.__super.call(this),void 0===t&&(t=4),h.isWebGL&&y.enable(),this.strength=t,this._action=d.createFilterAction(16),this._action.data=this}a(e,"laya.filters.BlurFilter",o);var t=e.prototype;t.callNative=function(t){t.conchModel&&t.conchModel.blurFilter&&t.conchModel.blurFilter(this.strength)},n(0,t,"action",function(){return this._action}),n(0,t,"type",function(){return 16})})(),function(){function r(t,e,i,a){this._color=null,r.__super.call(this),this._elements=new Float32Array(9),void 0===e&&(e=4),void 0===i&&(i=6),void 0===a&&(a=6),h.isWebGL&&y.enable(),this._color=new s(t),this.blur=Math.min(e,20),this.offX=i,this.offY=a,this._action=d.createFilterAction(8),this._action.data=this}a(r,"laya.filters.GlowFilter",o);var t=r.prototype;t.getColor=function(){return this._color._color},t.callNative=function(t){t.conchModel&&t.conchModel.glowFilter&&t.conchModel.glowFilter(this._color.strColor,this._elements[4],this._elements[5],this._elements[6])},n(0,t,"type",function(){return 8}),n(0,t,"action",function(){return this._action}),n(0,t,"offY",function(){return this._elements[6]},function(t){this._elements[6]=t}),n(0,t,"offX",function(){return this._elements[5]},function(t){this._elements[5]=t}),n(0,t,"blur",function(){return this._elements[4]},function(t){this._elements[4]=t})}();var p=function(){function t(){this.data=null,t.__super.call(this)}a(t,"laya.filters.webgl.BlurFilterActionGL",u);var e=t.prototype;return e.setValueMix=function(t){t.defines.add(this.data.type)},e.apply3d=function(t,e,i,a,r){var n=t.getValue("bounds"),s=f.create(1,0);s.setFilters([this.data]),c.EMPTY.identity(),i.ctx.drawTarget(t,0,0,n.width,n.height,c.EMPTY,"src",s),s.setFilters(null)},e.setValue=function(t){t.strength=this.data.strength;var e=this.data.strength/3,e=e*e;this.data.strength_sig2_2sig2_gauss1[0]=this.data.strength,this.data.strength_sig2_2sig2_gauss1[1]=e,this.data.strength_sig2_2sig2_gauss1[2]=2*e,this.data.strength_sig2_2sig2_gauss1[3]=1/(2*Math.PI*e),t.strength_sig2_2sig2_gauss1=this.data.strength_sig2_2sig2_gauss1},n(0,e,"typeMix",function(){return 16}),t}(),w=function(){function t(){this.data=null,this._initKey=!1,this._textureWidth=0,this._textureHeight=0,t.__super.call(this)}a(t,"laya.filters.webgl.GlowFilterActionGL",u);var e=t.prototype;return i.imps(e,{"laya.filters.IFilterActionGL":!0}),e.setValueMix=function(t){},e.apply3d=function(t,e,i,a,r){var n=t.getValue("bounds");t.addValue("color",this.data.getColor());var s=n.width,n=n.height;this._textureWidth=s,this._textureHeight=n;s=c.TEMP;return s.identity(),(n=f.create(1,0)).setFilters([this.data]),i.ctx.drawTarget(t,0,0,this._textureWidth,this._textureHeight,s,"src",n,null),n=f.create(1,0),i.ctx.drawTarget(t,0,0,this._textureWidth,this._textureHeight,s,"src",n),null},e.setSpriteWH=function(t){this._textureWidth=t.width,this._textureHeight=t.height},e.setValue=function(t){t.u_offsetX=this.data.offX,t.u_offsetY=-this.data.offY,t.u_strength=1,t.u_blurX=this.data.blur,t.u_blurY=this.data.blur,t.u_textW=this._textureWidth,t.u_textH=this._textureHeight,t.u_color=this.data.getColor()},n(0,e,"typeMix",function(){return 8}),t.tmpTarget=function(t,e,i,a,r){var n=t.getValue("bounds");t.getValue("out").end();var s=_.create(n.width,n.height);s.start();n=t.getValue("color");n&&s.clear(n[0],n[1],n[2],0),t.addValue("tmpTarget",s)},t.startOut=function(t,e,i,a,r){t.getValue("tmpTarget").end();var n=t.getValue("out");n.start();t=t.getValue("color");t&&n.clear(t[0],t[1],t[2],0)},t.recycleTarget=function(t,e,i,a,r){t.getValue("src");t.getValue("tmpTarget").recycle()},t}();i.__init([y])}((window,document,Laya)),"function"==typeof define&&define.amd&&define("laya.core",["require","exports"],function(t,e){"use strict";for(var i in Object.defineProperty(e,"__esModule",{value:!0}),Laya){var a=Laya[i];a&&a.__isclass&&(e[i]=a)}});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
View File
+2 -2
View File
@@ -1,6 +1,6 @@
import { summary } from '../src/functions/summary.js'
import { readFile } from 'fs/promises';
import Life from '../src/life.js';
import Life from '../src/modules/life.js';
globalThis.json = async fileName => JSON.parse(await readFile(`data/${fileName}.json`));
@@ -527,7 +527,7 @@ class App {
case this.Steps.TRAJECTORY:
return this.showProperty();
default:
return undefined;
}
+31609
View File
File diff suppressed because it is too large Load Diff
+1262
View File
File diff suppressed because it is too large Load Diff
+6118
View File
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,5 @@
import { clone } from './functions/util.js';
import { checkCondition } from './functions/condition.js';
import { clone } from '../functions/util.js';
import { checkCondition } from '../functions/condition.js';
class Achievement {
constructor() {}
+2 -2
View File
@@ -1,5 +1,5 @@
import { clone } from './functions/util.js';
import { checkCondition } from './functions/condition.js';
import { clone } from '../functions/util.js';
import { checkCondition } from '../functions/condition.js';
class Event {
constructor() {}
+1 -1
View File
@@ -1,4 +1,4 @@
import { weightRandom } from './functions/util.js'
import { weightRandom } from '../functions/util.js'
import Property from './property.js';
import Event from './event.js';
import Talent from './talent.js';
+1 -1
View File
@@ -1,4 +1,4 @@
import { max, min, sum, clone, listRandom } from './functions/util.js';
import { max, min, sum, clone, listRandom } from '../functions/util.js';
class Property {
constructor() {}
+3 -3
View File
@@ -1,6 +1,6 @@
import { clone, weightRandom } from './functions/util.js';
import { checkCondition, extractMaxTriggers } from './functions/condition.js';
import { getRate } from './functions/addition.js';
import { clone, weightRandom } from '../functions/util.js';
import { checkCondition, extractMaxTriggers } from '../functions/condition.js';
import { getRate } from '../functions/addition.js';
class Talent {
constructor() {}
-201
View File
@@ -1,201 +0,0 @@
import { readFile, writeFile, stat, readdir } from 'fs/promises';
import * as XLSX from 'xlsx';
import { join, extname, dirname } from 'path';
// const { readFile, writeFile, stat, readdir } = require('fs/promises');
// const XLSX = require('xlsx');
// const { join, extname, dirname } = require('path');
async function read(xlsxPath) {
const xlsxFileBuffer = await readFile(xlsxPath);
const xlsx = XLSX.read(xlsxFileBuffer, {type: 'buffer'});
const sheets = xlsx.Sheets;
const data = {};
for(const sheetName in sheets) {
const sheetRawData = sheets[sheetName];
if(!sheetRawData['!ref']) break;
data[sheetName] = XLSX.utils.sheet_to_json(sheetRawData);
}
return data;
}
async function write(sheets) {
for(const sheetName in sheets) {
const { dirname, data, source } = sheets[sheetName];
const savePath = join(dirname, `${sheetName}.json`);
console.info('[Transform] XLSX(', source.map(([p, s])=>`${p}:${s}`).join('\n\t\t '), `) \n\t -> JSON( ${savePath} )`);
await writeFile(
savePath,
JSON.stringify(data, null, 4),
)
}
}
function format(rawSheet, isArray, xlsxPath, rawSheetName) {
const newSheet = isArray?[]:{};
rawSheet.shift();
for(const index in rawSheet) {
const row = rawSheet[index];
const rowData = {};
let mainKey;
for(let key in row) {
const cell = row[key];
if(key[0] == "$") {
key = key.substr(1);
mainKey = cell;
}
if(key.includes(':')) {
const keys = key.split(':');
const lastKey = keys.pop();
let temp = rowData;
for(const subKey of keys) {
if(!temp[subKey]) temp[subKey] = {};
temp = temp[subKey];
}
if(lastKey.includes('[]')) {
const aKey = lastKey.split('[]')[0];
if(!temp[aKey]) temp[aKey] = [cell];
else temp[aKey].push(cell);
} else {
temp[lastKey] = cell;
}
} else if(key.includes('[]')) {
const aKey = key.split('[]')[0];
if(!rowData[aKey]) rowData[aKey] = [cell];
else rowData[aKey].push(cell);
} else {
rowData[key] = cell;
}
}
if(isArray) {
newSheet.push(rowData);
continue;
}
if(mainKey===undefined) {
console.warn(`[WARN][No Main Key] ${xlsxPath}:${rawSheetName}`, parseInt(index)+3, rowData);
continue;
}
if(newSheet[mainKey]) console.warn(`[WARN][Duplicate Key] ${mainKey} ${xlsxPath}:${rawSheetName}`, parseInt(index), '\n\t', JSON.stringify(newSheet[mainKey]), '\n\t', JSON.stringify(rowData));
newSheet[mainKey] = rowData;
}
return newSheet;
}
function merge(original, rawData, isMerge, isArray, xlsxPath, rawSheetName) {
if(!original)
return {
isMerge,
isArray,
source: [[xlsxPath, rawSheetName]],
data: format(rawData, isArray, xlsxPath, rawSheetName)
};
if(!isMerge) {
if(original) {
console.warn(`[WARN][Sheet Duplicate] ${xlsxPath}:${rawSheetName}\n\t\t${original.source[0][0]}:${original.source[0][1]}`)
return original;
}
}
if(!original.isMerge) {
console.warn(`[WARN][Sheet Duplicate] ${xlsxPath}:${rawSheetName}\n\t\t${original.source[0][0]}:${original.source[0][1]}`)
return original;
}
if(original.isArray != isArray) {
console.warn(`[WARN][Sheet Format not pair] ${xlsxPath}:${rawSheetName}\n\t\t${original.source[0][0]}:${original.source[0][1]}`)
return original;
}
const formatData = format(rawData, isArray, xlsxPath, rawSheetName);
original.source.push([xlsxPath, rawSheetName]);
if(isArray) {
original.data = original.data.concat(formatData)
} else {
for(const key in formatData) {
if(original.data[key]) {
console.warn(`[WARN][Duplicate key] ${key} ${xlsxPath}:${rawSheetName} ${JSON.stringify(formatData[key])}\n\t\t${original.source[0][0]}:${original.source[0][1]} ${JSON.stringify(original.data[key])}`);
continue;
}
original.data[key] = formatData[key];
}
}
return original;
}
function transform(rawSheets) {
const sheets = {};
for(const xlsxPath in rawSheets) {
const {dirname: d, data: rawSheetsData} = rawSheets[xlsxPath];
for(const rawSheetName in rawSheetsData) {
const rawData = rawSheetsData[rawSheetName];
if(rawSheetName[0] === "#") continue;
let sheetName = rawSheetName;
const isArray = rawSheetName.substr(-5) === "<arr>";
if(isArray) sheetName = sheetName.substring(0, sheetName.length - 5);
const isMerge = rawSheetName[0] === ">";
if(isMerge) sheetName = sheetName.substr(1);
sheets[sheetName] = merge(
sheets[sheetName],
rawData,
isMerge,
isArray,
xlsxPath,
rawSheetName
);
sheets[sheetName].dirname = d;
}
}
return sheets;
}
async function walk(filePath) {
const xlsxPaths = [];
if(Array.isArray(filePath)) {
for(const subPath of filePath)
xlsxPaths.push(await walk(subPath));
return xlsxPaths.flat();
}
const fileStat = await stat(filePath);
if(!fileStat.isDirectory()) {
const ext = extname(filePath);
if( ext=='.xls' || ext=='.xlsx' ) xlsxPaths.push(filePath);
return xlsxPaths;
}
const dirData = await readdir(filePath);
for(const subPath of dirData)
xlsxPaths.push(await walk(join(filePath, subPath)));
return xlsxPaths.flat();
}
async function main() {
const filePaths = process.argv.slice(2);
if(filePaths.length<0) process.exit(0);
const xlsxs = await walk(filePaths);
const sheets = {};
for(const p of xlsxs) {
const data = await read(p);
const d = dirname(p);
sheets[p] = {
dirname: d,
data
};
}
await write(
transform(sheets)
);
console.info(`
------------------------
| Transform Complete |
------------------------
`);
setTimeout(()=>{}, 1000);
}
main();
-903
View File
@@ -1,903 +0,0 @@
@media (min-width:640px){html{font-size:24px;}}
@media (min-width:631px) and (max-width:639px){html{font-size:23.66px;}}
@media (min-width:622px) and (max-width:630px){html{font-size:23.33px;}}
@media (min-width:613px) and (max-width:621px){html{font-size:23px;}}
@media (min-width:604px) and (max-width:612px){html{font-size:22.66px;}}
@media (min-width:595px) and (max-width:603px){html{font-size:22.33px;}}
@media (min-width:586px) and (max-width:594px){html{font-size:22px;}}
@media (min-width:577px) and (max-width:585px){html{font-size:21.66px;}}
@media (min-width:568px) and (max-width:576px){html{font-size:21.33px;}}
@media (min-width:559px) and (max-width:567px){html{font-size:21px;}}
@media (min-width:550px) and (max-width:558px){html{font-size:20.66px;}}
@media (min-width:541px) and (max-width:549px){html{font-size:20.33px;}}
@media (min-width:533px) and (max-width:540px){html{font-size:20px;}}
@media (min-width:524px) and (max-width:532px){html{font-size:19.66px;}}
@media (min-width:515px) and (max-width:523px){html{font-size:19.33px;}}
@media (min-width:506px) and (max-width:514px){html{font-size:19px;}}
@media (min-width:497px) and (max-width:505px){html{font-size:18.66px;}}
@media (min-width:488px) and (max-width:496px){html{font-size:18.33px;}}
@media (min-width:480px) and (max-width:487px){html{font-size:18px;}}
@media (min-width:471px) and (max-width:479px){html{font-size:17.66px;}}
@media (min-width:462px) and (max-width:470px){html{font-size:17.33px;}}
@media (min-width:453px) and (max-width:461px){html{font-size:17px;}}
@media (min-width:444px) and (max-width:452px){html{font-size:17.12px;}}
@media (min-width:435px) and (max-width:443px){html{font-size:16.33px;}}
@media (min-width:426px) and (max-width:434px){html{font-size:16px;}}
@media (min-width:417px) and (max-width:425px){html{font-size:15.66px;}}
@media (min-width:408px) and (max-width:416px){html{font-size:15.33px;}}
@media (min-width:400px) and (max-width:407px){html{font-size:15px;}}
@media (min-width:391px) and (max-width:399px){html{font-size:14.66px;}}
@media (min-width:382px) and (max-width:390px){html{font-size:14.33px;}}
@media (min-width:374px) and (max-width:381px){html{font-size:14px;}}
@media (min-width:365px) and (max-width:373px){html{font-size:13.66px;}}
@media (min-width:356px) and (max-width:364px){html{font-size:13.33px;}}
@media (min-width:347px) and (max-width:355px){html{font-size:13px;}}
@media (min-width:338px) and (max-width:346px){html{font-size:12.66px;}}
@media (min-width:329px) and (max-width:337px){html{font-size:12.44px;}}
@media (max-width:328px){html{font-size:12px;}}
@font-face {
font-family: 'iconfont';
src: url('iconfont.woff2?t=1628944689555') format('woff2'),
url('iconfont.woff?t=1628944689555') format('woff'),
url('iconfont.ttf?t=1628944689555') format('truetype');
}
* {
margin: 0;
padding: 0;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
}
input[type="number"]{
-moz-appearance: textfield;
}
html {
background-color: #222831;
font-family: PingFangSC, 'Noto Sans CJK SC', 'MS Yahei';
}
body {
user-select: none;
}
#main {
display: flex;
flex-direction: column;
width: 100%;
max-width: 30rem;
height: 100%;
text-align: center;
box-sizing: border-box;
position: relative;
}
#title {
position: fixed;
font-size: 3rem;
font-weight: 700;
top: 35%;
left: 50%;
white-space: nowrap;
transform: translate(-50%, -50%);
color: #EEEEEE;
}
#restart {
position: fixed;
top: 65%;
left: 50%;
transform: translate(-50%, -50%);
}
#restart .iconfont {
margin-right: 0.5rem;
}
#next {
display: none;
}
#talentSelectedView {
flex: 0 1 auto;
}
.mainbtn {
margin: 0.5rem 1rem 1rem;
padding: 0.5rem 1.5rem;
background-color: #393E46;
border: 1px #EEEEEE solid;
border-radius: 0.2rem;
color: #EEEEEE;
font-size: 1.6rem;
white-space: nowrap;
cursor: pointer;
}
.mainbtn:hover {
background: #ff7878;
color: #fff;
transition: all .4s ease 0s;
}
.btn-area {
display: flex;
flex-direction: row;
}
.btn-area>.mainbtn {
flex: 1;
}
.iconfont {
display: inline-block;
vertical-align: middle;
font-family: "iconfont" !important;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.sponsor,
#rank,
#specialthanks,
#achievement {
position: fixed;
top: 4rem;
right: 1rem;
padding: 0.1rem;
width: 6rem;
border: none;
border-radius: 0.2rem;
background-color:lightsteelblue;
font-size: 1.4rem;
color: #EEEEEE;
cursor: pointer;
z-index:2;
word-wrap: none;
}
#specialthanks {
background-color: #5865F2;
top: 1rem;
}
.sponsor {
top: auto;
bottom: 0;
width: auto;
padding: 0.5rem;
}
#rank {
position: absolute;
top: 50%;
right: 1.5rem;
transform: translateY(-50%);
}
#spthx {
position: fixed;
display: grid;
top: 4rem;
bottom: 5rem;
left: 50%;
width: 30rem;
max-width: calc(100% - 2rem);
transform: translateX(-50%);
}
#spthx ul {
list-style-type: none;
padding: 0;
}
#spthx ul li {
margin: 0;
}
#spthx ul.g1 {
display: grid;
max-block-size: 9rem;
max-height: 9rem;
overflow: scroll;
}
#spthx ul.g1 li {
display: inline-grid;
background-color: orange;
margin-bottom: 0.5rem;
padding: 0.2rem 0;
grid-template-columns: 7rem auto;
}
#spthx ul.g1 li .name {
padding: 0 0.5rem;
font-weight: 700;
}
#spthx ul.g1 li .comment {
padding: 0 0.5rem;
}
#spthx ul.g2 {
color: white;
display: grid;
grid-template-columns: 50% 50%;
overflow: scroll;
}
#spthx ul.g2 li {
text-align: center;
}
.title {
color: white;
position: relative;
font-size: 1.5rem;
font-weight: 700;
padding: 1rem;
}
ul#total,
#achievements {
list-style-type: none;
display: grid;
justify-items: center;
grid-template-columns: 50% 50%;
grid-auto-columns: max-content;
justify-content: center;
}
ul#total li,
#achievements li {
position: relative;
color: white;
display: inline-grid;
margin: 0.5rem;
width: 12rem;
height: 6rem;
align-items: center;
}
ul#total li .achievementtitle,
#achievements li .achievementtitle{
font-weight: 700;
font-size: 1.2rem;
}
#achievements {
overflow: scroll;
}
#save,
#load,
#themeToggleBtn {
padding: 0 0.7rem;
width: 6.5rem;
background-color:#EEEEEE;
border: none;
border-radius: 4px;
font-size: 1.4rem;
color: #222831;
line-height: 2.5rem;
text-align: center;
vertical-align: middle;
cursor: pointer;
position: fixed;
z-index:2;
right: 0.5rem;
bottom: 0.5rem;
}
#save {
background-color:#007046;
color: white;
bottom: 6.5rem;
}
#load {
background-color: #fc5531;
color: white;
bottom: 3.5rem;
}
.head {
display: flex;
flex-direction: column;
justify-content: center;
height: 5.2rem;
font-size: 1.4rem;
white-space: nowrap;
color: #EEEEEE;
}
.propinitial,
.selectlist {
list-style: none;
flex: 1;
padding: 1rem;
}
.lifeProperty {
list-style: none;
padding: 2rem 1rem 0.5rem 1rem;
display: flex;
color: #FFFFFF;
overflow: auto;
}
.lifeProperty>li {
flex: 1;
margin: 0.1rem 2px;
display: flex;
flex-direction: column;
border: 1px #ccc solid;
border-radius: 0.2rem;
font-size: 1rem;
position: relative;
}
.lifeProperty>li>span:last-child {
background: #eee;
color: #666;
}
.selectlist>li {
margin-bottom: 0.6rem;
display: block;
border: 1px #EEEEEE solid;
border-radius: 0.2rem;
color: #EEEEEE;
font-size: 1.2rem;
line-height: 1.6;
user-select: none;
position: relative;
cursor: pointer;
}
.selectlist>li:last-child {
margin-bottom: 0;
}
.achvg0,
.grade0b {
background-color: #464646;
border: #f8f8f8 2px solid !important;
}
.achvg1,
.grade1b {
background-color: #6495ed;
border: #f8f8f8 2px solid !important;
}
.achvg2,
.grade2b {
background-color: #e2a7ff;
border: #f8f8f8 2px solid !important;
}
.achvg3,
.grade3b {
background-color: #ffa07a;
border: #f8f8f8 2px solid !important;
}
.mask::before {
display: block;
content: " ";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000;
opacity: 0.5;
}
@media (min-width:1080px) {
.grade0b:hover {
background-color: #c0c0c0;
color: #3b3b3b;
transition: all .3s ease 0s;
}
.grade1b:hover {
background-color: #87cefa;
color: #3b3b3b;
transition: all .3s ease 0s;
}
.grade2b:hover {
background-color: #e7beff;
color: #3b3b3b;
transition: all .3s ease 0s;
}
.grade3b:hover {
background-color: #f7a989;
color: #3b3b3b;
transition: all .3s ease 0s;
}
}
.grade0b.selected,
.grade1b.selected,
.grade2b.selected,
.grade3b.selected {
box-shadow: #ccc 0px 0px 10px;
color: #3b3b3b;
overflow: hidden;
}
.grade0b.selected::after,
.grade1b.selected::after,
.grade2b.selected::after,
.grade3b.selected::after {
content: '';
position: absolute;
background-color:#000;
top: 0;
bottom: 0;
left: 0;
right: 0;
box-shadow: 0 0 10px #000;
opacity: 0;
animation: blink 3s linear infinite;
}
@keyframes blink {
0% {
opacity: 0;
transform: translateX(-150%);
}
50% {
opacity: .2;
}
100% {
opacity: 0;
transform: translateX(150%);
}
}
.grade0b.selected {
background-color: #c0c0c0 !important;
}
.grade1b.selected {
background-color: #87cefa !important;
}
.grade2b.selected {
background-color: #e7beff !important;
}
.grade3b.selected {
background-color: #f1bfac !important;
}
.propinitial {
display: flex;
flex-direction: column;
justify-content: center;
}
.propbtn:hover {
color: #5c5c5c;
transition: all .2s ease 0s;
}
.propinitial>li {
position: relative;
margin: 0.1rem auto;
padding: 0.2rem;
display: inline-block;
border-radius: 0.2rem;
color: #EEEEEE;
font-size: 1.6rem;
line-height: 2;
}
.propinitial>li>input {
height: 2.2rem;
width: 2.2rem;
margin: 0 0.5rem;
padding: 0;
font-size: 2rem;
border: 0.1rem #EEEEEE solid;
background-color: #393E46;
color: #EEEEEE;
text-align: center;
}
.propbtn {
position: relative;
cursor: pointer;
font-size: 2rem;
color: #EEEEEE;
}
.judge>li>span:nth-child(1),
.lifeTrajectory>li>span:nth-child(1) {
width: 5rem;
text-align: right;
}
.judge>li>span:nth-child(2),
.lifeTrajectory>li>span:nth-child(2) {
flex: 1;
text-align: left;
}
.lifeTrajectory {
flex: 1;
margin: 0.5rem 1rem;
padding: 0;
border: 1px #9b9b9b solid;
background-color: #393E46;
border-radius: 4px;
overflow: auto;
}
.lifeTrajectory>li {
margin: 10px 0;
padding: 5px 10px;
display: flex;
background-color: #4a5361;
box-shadow: #EEEEEE 0 0 0.4rem;
color: #EEEEEE;
font-size: 1rem;
position: relative;
}
.judge {
list-style: none;
flex: 1;
margin: 1rem;
display: flex;
flex-direction: column;
border: 1px solid #EEEEEE;
border-radius: 4px;
overflow: scroll;
}
.judge>li {
flex: 1;
display: flex;
align-items: center;
background-color: #4a5361;
border-bottom: 1px solid #EEEEEE;
box-shadow: none;
color: #EEEEEE;
}
.judge>li:last-child {
border-bottom: 0
}
.judge>li.grade1 span,
.judge>li.grade1 {
background-color: #87cefa;
color: #4a5361;
}
.judge>li.grade2 span,
.judge>li.grade2 {
background-color: #e7beff;
color: #4a5361;
}
.judge>li.grade3 span,
.judge>li.grade3 {
background-color: #f7a989;
color: #4a5361;
}
@import url("https://fonts.googleapis.com/css?family=Montserrat:400,400i,700");
:root {
font-family: "Montserrat";
}
html,
body {
margin: 0;
height: 100%;
}
body {
display: flex;
align-items: center;
justify-content: center;
}
i {
color: inherit;
}
.banners-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 9;
}
.banner {
color: white;
font-weight: 700;
padding: 2rem;
display: flex;
flex-direction: row;
align-items: center;
}
.banner .banner-message {
flex: 1;
padding: 0 2rem;
word-break: break-word;
overflow: auto;
}
.banner .banner-close {
display: flex;
align-items: center;
justify-content: center;
padding: 0.1rem;
border-radius: 4px;
cursor: pointer;
transition: background 0.3s;
}
.banner .iconfont {
font-size: 2rem;
}
.banner .banner-close:hover {
background: rgba(0, 0, 0, 0.12);
}
.banner.success {
background: lightgreen;
}
.banner.success::after {
background: lightgreen;
}
.banner.error {
background: #ed1c24;
}
.banner.error::after {
background: #ed1c24;
}
.banner.info {
background: skyblue;
}
.banner.info::after {
background: skyblue;
}
.banner::after {
content: "";
position: absolute;
height: 10%;
width: 100%;
bottom: 100%;
left: 0;
}
.banner:not(.visible) {
display: none;
transform: translateY(-100%);
}
.banner.visible {
box-shadow: 0 2px 2px 2px rgba(0, 0, 0, 0.12);
animation-name: banner-in;
animation-direction: forwards;
animation-duration: 0.6s;
animation-timing-function: ease-in-out;
animation-fill-mode: forwards;
animation-iteration-count: 1;
}
@keyframes banner-in {
0% {
transform: translateY(-100%);
}
50% {
transform: translateY(10%);
}
100% {
transform: translateY(0);
}
}
.show-banner {
appearance: none;
background: #ededed;
border: 0;
padding: 1rem 2rem;
border-radius: 4px;
cursor: pointer;
text-transform: uppercase;
margin: 0.25rem;
}
/**
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
.eva-animation {
animation-duration: 1s;
animation-fill-mode: both;
}
.eva-infinite {
animation-iteration-count: infinite;
}
.eva-icon-shake {
animation-name: eva-shake;
}
.eva-icon-zoom {
animation-name: eva-zoomIn;
}
.eva-icon-pulse {
animation-name: eva-pulse;
}
.eva-icon-flip {
animation-name: eva-flipInY;
}
.eva-hover {
display: inline-block;
}
.eva-hover:hover .eva-icon-hover-shake,
.eva-parent-hover:hover .eva-icon-hover-shake {
animation-name: eva-shake;
}
.eva-hover:hover .eva-icon-hover-zoom,
.eva-parent-hover:hover .eva-icon-hover-zoom {
animation-name: eva-zoomIn;
}
.eva-hover:hover .eva-icon-hover-pulse,
.eva-parent-hover:hover .eva-icon-hover-pulse {
animation-name: eva-pulse;
}
.eva-hover:hover .eva-icon-hover-flip,
.eva-parent-hover:hover .eva-icon-hover-flip {
animation-name: eva-flipInY;
}
@keyframes eva-flipInY {
from {
transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
animation-timing-function: ease-in;
opacity: 0;
}
40% {
transform: perspective(400px) rotate3d(0, 1, 0, -20deg);
animation-timing-function: ease-in;
}
60% {
transform: perspective(400px) rotate3d(0, 1, 0, 10deg);
opacity: 1;
}
80% {
transform: perspective(400px) rotate3d(0, 1, 0, -5deg);
}
to {
transform: perspective(400px);
}
}
@keyframes eva-shake {
from,
to {
transform: translate3d(0, 0, 0);
}
10%,
30%,
50%,
70%,
90% {
transform: translate3d(-3px, 0, 0);
}
20%,
40%,
60%,
80% {
transform: translate3d(3px, 0, 0);
}
}
@keyframes eva-pulse {
from {
transform: scale3d(1, 1, 1);
}
50% {
transform: scale3d(1.2, 1.2, 1.2);
}
to {
transform: scale3d(1, 1, 1);
}
}
@keyframes eva-zoomIn {
from {
opacity: 1;
transform: scale3d(0.5, 0.5, 0.5);
}
50% {
opacity: 1;
}
}
::-webkit-scrollbar {
width: 0 !important
}
.deleteFixed {
margin: 0;
padding: 0.5rem 1rem;
border: 0;
border-radius: 0;
overflow: visible;
}
.operateBtn {
padding: 0.5rem 1.5rem;
border: 1px #EEEEEE solid;
border-radius: 0.2rem;
background-color:#393E46;
font-size: 1.6rem;
white-space: nowrap;
transform: translate(-50%,-50%);
cursor: pointer;
z-index:2;
color: #EEEEEE;
}
.operateBtn:hover {
background: #ff7878;
color: #fff;
transition: all .4s ease 0s;
}
.domToImage2wx {
position: fixed;
z-index: 1111;
width: 100%;
}
.domToImage2wx img {
width: 100%;
}
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
+13 -49
View File
@@ -1,52 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="やり直すんだ。そして、次はうまくやる。"/>
<meta name="keywords" content="人生重开模拟器 liferestart life restart remake 人生重来"/>
<link id="themeLink" rel="stylesheet" href="light.css">
<link rel="manifest" href="./manifest.json">
<title>Life Restart</title>
</head>
<body>
<div class="banners-container">
<div class="banners">
<div class="banner error">
<div class="banner-icon"><span class="iconfont">&#xe6a1;</span></div>
<pre class="banner-message">Oops! Something went wrong!</pre>
<div class="banner-close" onclick="hideBanners()"><span class="iconfont">&#xe6a8;</span></div>
</div>
<div class="banner success">
<div class="banner-icon"><span class="iconfont">&#xe6a2;</span></div>
<pre class="banner-message">Everything was fine!</pre>
<div class="banner-close" onclick="hideBanners()"><span class="iconfont">&#xe6a8;</span></div>
</div>
<div class="banner info">
<div class="banner-icon"><span class="iconfont">&#xe6a3;</span></div>
<pre class="banner-message">Here is some useful information</pre>
<div class="banner-close" onclick="hideBanners()"><span class="iconfont">&#xe6a8;</span></div>
</div>
</div>
</div>
<a href="https://github.com/VickScarlet/lifeRestart" class="github-corner" style="z-index: 9999;" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; left: 0; transform: scale(-1, 1);" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style></a>
<script src="../lib/jquery-3.6.0.min.js"></script>
<script src="../lib/dom-to-image.min.js"></script>
<script src="../public/bundle.js"></script>
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('./sw.js', {scope: '.'})
.then(function (registration) {
console.log('ServiceWorker registration successful');
})
.catch(function (err) {
console.log('ServiceWorker registration failed');
});
});
}
</script>
</body>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="やり直すんだ。そして、次はうまくやる。"/>
<meta name="keywords" content="人生重开模拟器 liferestart life restart remake 人生重来"/>
<title>Life Restart</title>
</head>
<body>
<script language="javascript" type="text/javascript">
window.location.href="../public/index.html";
</script>
</body>
</html>
-900
View File
@@ -1,900 +0,0 @@
@media (min-width:640px){html{font-size:24px;}}
@media (min-width:631px) and (max-width:639px){html{font-size:23.66px;}}
@media (min-width:622px) and (max-width:630px){html{font-size:23.33px;}}
@media (min-width:613px) and (max-width:621px){html{font-size:23px;}}
@media (min-width:604px) and (max-width:612px){html{font-size:22.66px;}}
@media (min-width:595px) and (max-width:603px){html{font-size:22.33px;}}
@media (min-width:586px) and (max-width:594px){html{font-size:22px;}}
@media (min-width:577px) and (max-width:585px){html{font-size:21.66px;}}
@media (min-width:568px) and (max-width:576px){html{font-size:21.33px;}}
@media (min-width:559px) and (max-width:567px){html{font-size:21px;}}
@media (min-width:550px) and (max-width:558px){html{font-size:20.66px;}}
@media (min-width:541px) and (max-width:549px){html{font-size:20.33px;}}
@media (min-width:533px) and (max-width:540px){html{font-size:20px;}}
@media (min-width:524px) and (max-width:532px){html{font-size:19.66px;}}
@media (min-width:515px) and (max-width:523px){html{font-size:19.33px;}}
@media (min-width:506px) and (max-width:514px){html{font-size:19px;}}
@media (min-width:497px) and (max-width:505px){html{font-size:18.66px;}}
@media (min-width:488px) and (max-width:496px){html{font-size:18.33px;}}
@media (min-width:480px) and (max-width:487px){html{font-size:18px;}}
@media (min-width:471px) and (max-width:479px){html{font-size:17.66px;}}
@media (min-width:462px) and (max-width:470px){html{font-size:17.33px;}}
@media (min-width:453px) and (max-width:461px){html{font-size:17px;}}
@media (min-width:444px) and (max-width:452px){html{font-size:17.12px;}}
@media (min-width:435px) and (max-width:443px){html{font-size:16.33px;}}
@media (min-width:426px) and (max-width:434px){html{font-size:16px;}}
@media (min-width:417px) and (max-width:425px){html{font-size:15.66px;}}
@media (min-width:408px) and (max-width:416px){html{font-size:15.33px;}}
@media (min-width:400px) and (max-width:407px){html{font-size:15px;}}
@media (min-width:391px) and (max-width:399px){html{font-size:14.66px;}}
@media (min-width:382px) and (max-width:390px){html{font-size:14.33px;}}
@media (min-width:374px) and (max-width:381px){html{font-size:14px;}}
@media (min-width:365px) and (max-width:373px){html{font-size:13.66px;}}
@media (min-width:356px) and (max-width:364px){html{font-size:13.33px;}}
@media (min-width:347px) and (max-width:355px){html{font-size:13px;}}
@media (min-width:338px) and (max-width:346px){html{font-size:12.66px;}}
@media (min-width:329px) and (max-width:337px){html{font-size:12.44px;}}
@media (max-width:328px){html{font-size:12px;}}
@font-face {
font-family: 'iconfont';
src: url('iconfont.woff2?t=1628944689555') format('woff2'),
url('iconfont.woff?t=1628944689555') format('woff'),
url('iconfont.ttf?t=1628944689555') format('truetype');
}
* {
margin: 0;
padding: 0;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
}
input[type="number"]{
-moz-appearance: textfield;
}
html {
font-family: PingFangSC, 'Noto Sans CJK SC', 'MS Yahei';
}
body {
user-select: none;
}
#main {
display: flex;
flex-direction: column;
width: 100%;
max-width: 30rem;
height: 100%;
text-align: center;
box-sizing: border-box;
position: relative;
}
#title {
position: fixed;
font-size: 3rem;
font-weight: 700;
top: 35%;
left: 50%;
white-space: nowrap;
transform: translate(-50%, -50%);
color: #000;
}
#restart {
position: fixed;
top: 65%;
left: 50%;
transform: translate(-50%, -50%);
}
#restart .iconfont {
margin-right: 0.5rem;
}
#next {
display: none;
}
#talentSelectedView {
flex: 0 1 auto;
}
.mainbtn {
margin: 0.5rem 1rem 1rem;
padding: 0.5rem 1.5rem;
background-color: #FFFFFF;
border: 1px #CCCCCC solid;
border-radius: 0.2rem;
color: #000000;
font-size: 1.6rem;
white-space: nowrap;
cursor: pointer;
}
.mainbtn:hover {
background: #ff7878;
color: #FFFFFF;
transition: all .4s ease 0s;
}
.btn-area {
display: flex;
flex-direction: row;
}
.btn-area>.mainbtn {
flex: 1;
}
.iconfont {
display: inline-block;
vertical-align: middle;
font-family: "iconfont" !important;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.sponsor,
#rank,
#specialthanks,
#achievement {
position: fixed;
top: 4rem;
right: 1rem;
padding: 0.1rem;
width: 6rem;
border: none;
border-radius: 0.2rem;
background-color:lightsteelblue;
font-size: 1.4rem;
color: #EEEEEE;
cursor: pointer;
z-index:2;
word-wrap: none;
}
#specialthanks {
background-color: #5865F2;
top: 1rem;
}
.sponsor {
top: auto;
bottom: 0;
width: auto;
padding: 0.5rem;
}
#rank {
position: absolute;
top: 50%;
right: 1.5rem;
transform: translateY(-50%);
}
#spthx {
position: fixed;
display: grid;
top: 4rem;
bottom: 5rem;
left: 50%;
width: 30rem;
max-width: calc(100% - 2rem);
transform: translateX(-50%);
}
#spthx ul {
list-style-type: none;
padding: 0;
}
#spthx ul li {
margin: 0;
}
#spthx ul.g1 {
display: grid;
max-block-size: 9rem;
max-height: 9rem;
overflow: scroll;
}
#spthx ul.g1 li {
display: inline-grid;
background-color: orange;
margin-bottom: 0.5rem;
padding: 0.2rem 0;
grid-template-columns: 7rem auto;
}
#spthx ul.g1 li .name {
padding: 0 0.5rem;
font-weight: 700;
}
#spthx ul.g1 li .comment {
padding: 0 0.5rem;
}
#spthx ul.g2 {
display: grid;
grid-template-columns: 50% 50%;
overflow: scroll;
}
#spthx ul.g2 li {
text-align: center;
}
.title {
position: relative;
font-size: 1.5rem;
font-weight: 700;
padding: 1rem;
}
ul#total,
#achievements {
list-style-type: none;
display: grid;
justify-items: center;
grid-template-columns: 50% 50%;
grid-auto-columns: max-content;
justify-content: center;
}
ul#total li,
#achievements li {
position: relative;
display: inline-grid;
margin: 0.5rem;
width: 12rem;
height: 6rem;
align-items: center;
}
ul#total li .achievementtitle,
#achievements li .achievementtitle{
font-weight: 700;
font-size: 1.2rem;
}
#achievements {
overflow: scroll;
}
#save,
#load,
#themeToggleBtn {
padding: 0 0.7rem;
width: 6.5rem;
background-color:#222831;
border: none;
border-radius: 4px;
font-size: 1.4rem;
color: #EEEEEE;
line-height: 2.5rem;
text-align: center;
vertical-align: middle;
cursor: pointer;
position: fixed;
z-index:2;
right: 0.5rem;
bottom: 0.5rem;
}
#save {
background-color:#007046;
color: white;
bottom: 6.5rem;
}
#load {
background-color: #fc5531;
color: white;
bottom: 3.5rem;
}
.head {
display: flex;
flex-direction: column;
justify-content: center;
height: 5.2rem;
font-size: 1.4rem;
white-space: nowrap;
color: #000;
}
.propinitial,
.selectlist {
list-style: none;
flex: 1;
padding: 1rem;
}
.lifeProperty {
list-style: none;
padding: 2rem 1rem 0.5rem 1rem;
display: flex;
color: #FFFFFF;
overflow: auto;
}
.lifeProperty>li {
flex: 1;
margin: 0.1rem 2px;
display: flex;
flex-direction: column;
background-color: #8d8d8d;
border: 1px #ccc solid;
border-radius: 0.2rem;
font-size: 1rem;
position: relative;
}
.lifeProperty>li>span:last-child {
background: #fff;
color: #000;
}
.selectlist>li {
margin-bottom: 0.6rem;
display: block;
border: 1px #EEEEEE solid;
border-radius: 0.2rem;
color: #666;
font-size: 1.2rem;
line-height: 1.6;
user-select: none;
position: relative;
cursor: pointer;
}
.selectlist>li:last-child {
margin-bottom: 0;
}
.propinitial {
display: flex;
flex-direction: column;
justify-content: center;
}
.propbtn:hover {
color: #5c5c5c;
transition: all .2s ease 0s;
}
.propinitial>li {
position: relative;
margin: 0.1rem auto;
padding: 0.2rem;
display: inline-block;
border-radius: 0.2rem;
color: #000;
font-size: 1.6rem;
line-height: 2;
}
.propinitial>li>input {
height: 2.2rem;
width: 2.2rem;
margin: 0 0.5rem;
padding: 0;
font-size: 2rem;
border: 0.1rem #000 solid;
background-color: #fff;
color: #000;
text-align: center;
}
.propbtn {
position: relative;
cursor: pointer;
font-size: 2rem;
color: #000;
}
.judge>li>span:nth-child(1),
.lifeTrajectory>li>span:nth-child(1) {
width: 5rem;
text-align: right;
}
.judge>li>span:nth-child(2),
.lifeTrajectory>li>span:nth-child(2) {
flex: 1;
text-align: left;
}
.lifeTrajectory {
flex: 1;
margin: 0.5rem 1rem;
padding: 0;
border: 1px #9b9b9b solid;
background-color: #fff;
border-radius: 4px;
overflow: auto;
}
.lifeTrajectory>li {
margin: 10px 0;
padding: 5px 10px;
display: flex;
background-color: #fff;
box-shadow: #b1b1b1 0 0 0.4rem;
color: #1a1a1a;
font-size: 1rem;
position: relative;
}
.judge {
list-style: none;
flex: 1;
margin: 1rem;
display: flex;
flex-direction: column;
border: 1px solid #EEEEEE;
border-radius: 4px;
overflow: scroll;
}
.judge>li {
flex: 1;
display: flex;
align-items: center;
background-color: #6f6f6f;
border-bottom: 1px solid #EEEEEE;
box-shadow: none;
color: #EEEEEE;
}
.judge>li:last-child {
border-bottom: 0
}
.judge>li.grade1 span,
.judge>li.grade1 {
background-color: #87cefa;
color: #4a5361;
}
.judge>li.grade2 span,
.judge>li.grade2 {
background-color: #e7beff;
color: #4a5361;
}
.judge>li.grade3 span,
.judge>li.grade3 {
background-color: #f7a989;
color: #4a5361;
}
@import url("https://fonts.googleapis.com/css?family=Montserrat:400,400i,700");
:root {
font-family: "Montserrat";
}
html,
body {
margin: 0;
height: 100%;
}
body {
display: flex;
align-items: center;
justify-content: center;
}
i {
color: inherit;
}
.banners-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 9;
}
.banner {
color: white;
font-weight: 700;
padding: 2rem;
display: flex;
flex-direction: row;
align-items: center;
}
.banner .banner-message {
flex: 1;
padding: 0 2rem;
word-break: break-word;
overflow: auto;
}
.banner .banner-close {
display: flex;
align-items: center;
justify-content: center;
padding: 0.1rem;
border-radius: 4px;
cursor: pointer;
transition: background 0.3s;
}
.banner .iconfont {
font-size: 2rem;
}
.banner .banner-close:hover {
background: rgba(0, 0, 0, 0.12);
}
.banner.success {
background: lightgreen;
}
.banner.success::after {
background: lightgreen;
}
.banner.error {
background: #ed1c24;
}
.banner.error::after {
background: #ed1c24;
}
.banner.info {
background: skyblue;
}
.banner.info::after {
background: skyblue;
}
.banner::after {
content: "";
position: absolute;
height: 10%;
width: 100%;
bottom: 100%;
left: 0;
}
.banner:not(.visible) {
display: none;
transform: translateY(-100%);
}
.banner.visible {
box-shadow: 0 2px 2px 2px rgba(0, 0, 0, 0.12);
animation-name: banner-in;
animation-direction: forwards;
animation-duration: 0.6s;
animation-timing-function: ease-in-out;
animation-fill-mode: forwards;
animation-iteration-count: 1;
}
.achvg0,
.grade0b {
background-color: #ededed;
border: #c5c5c5 2px solid !important;
}
.achvg1,
.grade1b {
background-color: #7ea5ec;
border: #c5c5c5 2px solid !important;
}
.achvg2,
.grade2b {
background-color: #e2a7ff;
border: #c5c5c5 2px solid !important;
}
.achvg3,
.grade3b {
background-color: #ffa07a;
border: #c5c5c5 2px solid !important;
}
.mask::before {
display: block;
content: " ";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000;
opacity: 0.5;
}
@media (min-width:1080px) {
.grade0b:hover {
background-color: #868686;
transition: all .3s ease 0s;
}
.grade1b:hover {
background-color: #5d90ff;
color: #3b3b3b;
transition: all .3s ease 0s;
}
.grade2b:hover {
background-color: #bc72ec;
color: #3b3b3b;
transition: all .3s ease 0s;
}
.grade3b:hover {
background-color: #e09074;
color: #3b3b3b;
transition: all .3s ease 0s;
}
}
.grade0b.selected,
.grade1b.selected,
.grade2b.selected,
.grade3b.selected {
box-shadow: #bbb 0px 0px 10px;
color: #fff;
overflow: hidden;
}
.grade0b.selected::after,
.grade1b.selected::after,
.grade2b.selected::after,
.grade3b.selected::after {
content: '';
position: absolute;
background-color:#000;
top: 0;
bottom: 0;
left: 0;
right: 0;
box-shadow: 0 0 10px #000;
opacity: 0;
animation: blink 3s linear infinite;
}
@keyframes blink {
0% {
opacity: 0;
transform: translateX(-150%);
}
50% {
opacity: .2;
}
100% {
opacity: 0;
transform: translateX(150%);
}
}
.grade0b.selected {
background-color: #444 !important;
}
.grade1b.selected {
background-color: #407dec !important;
}
.grade2b.selected {
background-color: #b362e7 !important;
}
.grade3b.selected {
background-color: #ff7f4d !important;
}
@keyframes banner-in {
0% {
transform: translateY(-100%);
}
50% {
transform: translateY(10%);
}
100% {
transform: translateY(0);
}
}
.show-banner {
appearance: none;
background: #ededed;
border: 0;
padding: 1rem 2rem;
border-radius: 4px;
cursor: pointer;
text-transform: uppercase;
margin: 0.25rem;
}
/**
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
.eva-animation {
animation-duration: 1s;
animation-fill-mode: both;
}
.eva-infinite {
animation-iteration-count: infinite;
}
.eva-icon-shake {
animation-name: eva-shake;
}
.eva-icon-zoom {
animation-name: eva-zoomIn;
}
.eva-icon-pulse {
animation-name: eva-pulse;
}
.eva-icon-flip {
animation-name: eva-flipInY;
}
.eva-hover {
display: inline-block;
}
.eva-hover:hover .eva-icon-hover-shake,
.eva-parent-hover:hover .eva-icon-hover-shake {
animation-name: eva-shake;
}
.eva-hover:hover .eva-icon-hover-zoom,
.eva-parent-hover:hover .eva-icon-hover-zoom {
animation-name: eva-zoomIn;
}
.eva-hover:hover .eva-icon-hover-pulse,
.eva-parent-hover:hover .eva-icon-hover-pulse {
animation-name: eva-pulse;
}
.eva-hover:hover .eva-icon-hover-flip,
.eva-parent-hover:hover .eva-icon-hover-flip {
animation-name: eva-flipInY;
}
@keyframes eva-flipInY {
from {
transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
animation-timing-function: ease-in;
opacity: 0;
}
40% {
transform: perspective(400px) rotate3d(0, 1, 0, -20deg);
animation-timing-function: ease-in;
}
60% {
transform: perspective(400px) rotate3d(0, 1, 0, 10deg);
opacity: 1;
}
80% {
transform: perspective(400px) rotate3d(0, 1, 0, -5deg);
}
to {
transform: perspective(400px);
}
}
@keyframes eva-shake {
from,
to {
transform: translate3d(0, 0, 0);
}
10%,
30%,
50%,
70%,
90% {
transform: translate3d(-3px, 0, 0);
}
20%,
40%,
60%,
80% {
transform: translate3d(3px, 0, 0);
}
}
@keyframes eva-pulse {
from {
transform: scale3d(1, 1, 1);
}
50% {
transform: scale3d(1.2, 1.2, 1.2);
}
to {
transform: scale3d(1, 1, 1);
}
}
@keyframes eva-zoomIn {
from {
opacity: 1;
transform: scale3d(0.5, 0.5, 0.5);
}
50% {
opacity: 1;
}
}
::-webkit-scrollbar {
width: 0 !important
}
.deleteFixed {
margin: 0;
padding: 0.5rem 1rem;
border: 0;
border-radius: 0;
overflow: visible;
}
.operateBtn {
padding: 0.5rem 1.5rem;
border: 1px #EEEEEE solid;
border-radius: 0.2rem;
background-color:#393E46;
font-size: 1.6rem;
white-space: nowrap;
transform: translate(-50%,-50%);
cursor: pointer;
z-index:2;
color: #EEEEEE;
}
.operateBtn:hover {
background: #ff7878;
color: #fff;
transition: all .4s ease 0s;
}
.domToImage2wx {
position: fixed;
z-index: 1111;
width: 100%;
}
.domToImage2wx img {
width: 100%;
}
-51
View File
@@ -1,51 +0,0 @@
{
"icons": [
{
"src": "./images/icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "./images/icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "./images/icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "./images/icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "./images/icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png"
},
{
"src": "./images/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "./images/icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "./images/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"name": "人生重开模拟器",
"short_name": "LifeRestart",
"orientation": "portrait",
"display": "standalone",
"start_url": "/view/index.html",
"description": "人生重开模拟器",
"background_color": "#ffffff"
}
-27
View File
@@ -1,27 +0,0 @@
var CACHE_VERSION = 'sw_v1';
var CACHE_FILES = [
'/',
];
self.addEventListener('install', function (event) {
event.waitUntil(
caches.open(CACHE_VERSION)
.then(cache => cache.addAll(CACHE_FILES)
.then(() => self.skipWaiting())
));
});
self.addEventListener('activate', function (event) {
event.waitUntil(
caches.keys().then(function (keys) {
return Promise.all(keys.map(function (key, i) {
if (key !== CACHE_VERSION) {
return caches.delete(keys[i]);
}
}));
})
);
});
self.addEventListener('fetch', function(event) {});
-8
View File
@@ -6,10 +6,6 @@ module.exports = {
devtool: 'eval-cheap-module-source-map',
devServer: {
static: [
{
directory: path.join(__dirname, 'data'),
publicPath: '/data',
},
{
directory: path.join(__dirname, 'public'),
publicPath: '/public',
@@ -22,10 +18,6 @@ module.exports = {
directory: path.join(__dirname, 'src'),
publicPath: '/src',
},
{
directory: path.join(__dirname, 'lib'),
publicPath: '/lib',
}
],
},
output: {