Commit 17c44c38 authored by wildfirecode's avatar wildfirecode

1

parent 6aa7b8e7
No preview for this file type
......@@ -46,14 +46,14 @@
var __monkeyHandSize__ = 50;
var __boxMoveSpeed__ = 1.5;
var __boxmap__ = {
coin: { award: 0, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539244791/resource/assets/startScene/coin.png' },
gift: { award: 0, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539244791/resource/assets/startScene/gift.png' },
gift2: { award: 0, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539244791/resource/assets/startScene/gift2.png' },
woodbox: { award: 1, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539244791/resource/assets/startScene/woodbox.json', offset: [128, 79] }, //木宝箱
silverbox: { award: 3, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539244791/resource/assets/startScene/silverbox.png' },//银宝箱
goldenbox: { award: 5, skin: 'https://yun.duiba.com.cn/db_games/activity/fishing/1539244791/resource/assets/startScene/goldenbox.png' },//金宝箱
coin: { award: 0, skin: 'resource/assets/startScene/coin.png' },
gift: { award: 0, skin: 'resource/assets/startScene/gift.png' },
gift2: { award: 0, skin: 'resource/assets/startScene/gift2.png' },
woodbox: { award: 1, skin: 'resource/assets/startScene/woodbox.json', offset: [128, 79] }, //木宝箱
silverbox: { award: 3, skin: 'resource/assets/startScene/silverbox.png' },//银宝箱
goldenbox: { award: 5, skin: 'resource/assets/startScene/goldenbox.png' },//金宝箱
};
var __bgUrl__ = 'https://yun.duiba.com.cn/db_games/activity/fishing/1539244791/resource/assets/startScene/bg.jpg';
var __bgUrl__ = 'resource/assets/startScene/bg.jpg';
var gameId = 1;
var CFG = {
......
......@@ -19,7 +19,10 @@ export default class MainBase extends eui.UILayer {
if (RES.fileSystem['getFileOld']) return;
RES.fileSystem['getFileOld'] = RES.fileSystem.getFile;
window['RES'].fileSystem.getFile = function (filename: string) {
console.log("RES.fileSystem.getFile->",filename)
//生效情况
//RES.getResByUrl spritesheet类型
//不生效
//RES.getResAsync('net_png') spritesheet类型
if (filename.indexOf('.json') != -1) {
var arr = filename.split('.json')[0].split('/');
var filename1 = arr[arr.length - 1] + '_png';
......@@ -28,10 +31,16 @@ export default class MainBase extends eui.UILayer {
RES.fileSystem['fsData'][filename1] =
{ name: filename1, type: 'image', url: filename2, root: '', extra: '1' };
}
var result = RES.fileSystem['getFileOld'](filename);
if (result && result.url && check_webp_feature()) {
//生效情况
//RES.getResByUrl jpg or png类型
//RES.getResAsync('monkey_png')
if(filename.indexOf('png')!=-1||filename.indexOf('jpg')!=-1)
console.log('已经处理:',filename)
result = JSON.parse(JSON.stringify(result));
result.url = result.url.replace('.png', '.png?x-oss-process=image/format,webp');
// result.url = result.url.replace('.png', '.png?x-oss-process=image/format,webp');
result.url = result.url.replace('.jpg', '.jpg?x-oss-process=image/format,webp');
}
return result;
......
{"file":"net.png","frames":{
"01":{"x":1223,"y":1,"w":609,"h":428,"offX":69,"offY":104,"sourceW":750,"sourceH":558},
"02":{"x":613,"y":431,"w":610,"h":414,"offX":68,"offY":81,"sourceW":750,"sourceH":558},
"03":{"x":1225,"y":822,"w":610,"h":383,"offX":68,"offY":59,"sourceW":750,"sourceH":558},
"04":{"x":1,"y":856,"w":612,"h":371,"offX":65,"offY":32,"sourceW":750,"sourceH":558},
"05":{"x":1227,"y":1207,"w":610,"h":371,"offX":68,"offY":19,"sourceW":750,"sourceH":558},
"06":{"x":615,"y":1207,"w":610,"h":372,"offX":68,"offY":39,"sourceW":750,"sourceH":558},
"07":{"x":1225,"y":431,"w":610,"h":389,"offX":68,"offY":84,"sourceW":750,"sourceH":558},
"08":{"x":1,"y":431,"w":610,"h":423,"offX":68,"offY":100,"sourceW":750,"sourceH":558},
"09":{"x":612,"y":1,"w":609,"h":428,"offX":69,"offY":104,"sourceW":750,"sourceH":558},
"10":{"x":1,"y":1,"w":609,"h":428,"offX":69,"offY":104,"sourceW":750,"sourceH":558}}}
\ No newline at end of file
"10":{"x":1222,"y":0,"w":609,"h":428,"offX":69,"offY":104,"sourceW":750,"sourceH":558},
"09":{"x":611,"y":0,"w":609,"h":428,"offX":69,"offY":104,"sourceW":750,"sourceH":558},
"08":{"x":0,"y":430,"w":610,"h":423,"offX":68,"offY":100,"sourceW":750,"sourceH":558},
"07":{"x":1224,"y":430,"w":610,"h":389,"offX":68,"offY":84,"sourceW":750,"sourceH":558},
"06":{"x":614,"y":1206,"w":610,"h":372,"offX":68,"offY":39,"sourceW":750,"sourceH":558},
"05":{"x":1226,"y":1206,"w":610,"h":371,"offX":68,"offY":19,"sourceW":750,"sourceH":558},
"04":{"x":0,"y":855,"w":612,"h":371,"offX":65,"offY":32,"sourceW":750,"sourceH":558},
"03":{"x":1224,"y":821,"w":610,"h":383,"offX":68,"offY":59,"sourceW":750,"sourceH":558},
"02":{"x":612,"y":430,"w":610,"h":414,"offX":68,"offY":81,"sourceW":750,"sourceH":558},
"01":{"x":0,"y":0,"w":609,"h":428,"offX":69,"offY":104,"sourceW":750,"sourceH":558}}}
\ No newline at end of file
......@@ -109,6 +109,11 @@
"type": "sheet",
"name": "net_json",
"subkeys": "01,02,03,04,05,06,07,08,09,10"
},
{
"url": "assets/startScene/monkey.png",
"type": "image",
"name": "monkey_png"
}
]
}
\ No newline at end of file
......@@ -34,7 +34,7 @@ const config: ResourceManagerConfig = {
return {
outputDir,
commands: [
new ExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new MyExmlPlugin('commonjs'), // 非 EUI 项目关闭此设置
new TextureMergerPlugin({ textureMergerRoot: ['resource'] }),
new ConvertResConfigFilePlugin({
resourceConfigFiles: [{ filename: "resource/default.res.json", root: "resource/" }],
......
......@@ -66,13 +66,11 @@ export default class Monkey extends egret.Sprite {
}
async createBg() {
let url = getResPath() + `resource/assets/startScene/monkey.png`;
return new Promise((resolve) => {
RES.getResByUrl(url, (picData) => {
return new Promise(async (resolve) => {
const picData = await RES.getResAsync('monkey_png');
const pic = new egret.Bitmap(picData);
this.addChild(pic);
resolve(pic)
}, this, RES.ResourceItem.TYPE_IMAGE);
});
}
}
\ No newline at end of file
import SheetAnimation from "../components/SheetAnimation";
import { getResPath } from "../utils";
export default class Net extends egret.Sprite {
private _pic: SheetAnimation;
constructor() {
......@@ -21,14 +22,16 @@ export default class Net extends egret.Sprite {
}
}
async createBg() {
const sheet = await RES.getResAsync('net_json') as egret.SpriteSheet;
createBg() {
let url = getResPath() + `resource/assets/startScene/net.json`;
RES.getResByUrl(url, (sheet: egret.SpriteSheet) => {
this._pic.sheet = sheet;
this._pic.fps = 10;
this.alpha = 0;
egret.Tween.get(this).to({ alpha: 1 }, 500);
setInterval(()=>{
setInterval(() => {
this.doAction()
},5000);
}, 5000);
}, this, RES.ResourceItem.TYPE_SHEET);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment