Commit e3d0a9dd authored by zhangjinzhou's avatar zhangjinzhou

暂存

parent 1ce0f63f
project/public/assets/guide1.png

162 KB | W: | H:

project/public/assets/guide1.png

49.7 KB | W: | H:

project/public/assets/guide1.png
project/public/assets/guide1.png
project/public/assets/guide1.png
project/public/assets/guide1.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -10,6 +10,8 @@
<script id="scriptjs" src="//yun.duiba.com.cn/js-libs/px-token/0.0.4/px-token.min.js"></script>
<script src="//yun.duiba.com.cn/js-libs/rem/1.1.0/rem.min.js"></script>
<script src="//yun.duiba.com.cn/h5/lib/zepto.min.js"></script>
<script src="http://yun.duiba.com.cn/db_games/libs0924/svgaParser.minWeb.js"></script>
<script>
function getApp() {
return {
......
import { Shape, Container, TextField, TEXT_ALIGN, TEXT_lINETYPE, Sprite, MouseEvent, TextureCache, WidgetBase } from 'spark-wrapper-fyge';
import { Shape, Container, TextField, TEXT_ALIGN, TEXT_lINETYPE, Sprite, MouseEvent, TextureCache, WidgetBase, Tween, MovieClip } from 'spark-wrapper-fyge';
import metaConfig from './meta.json';
/*! *****************************************************************************
......@@ -28,6 +28,44 @@ function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
var GameStage = /** @class */ (function (_super) {
......@@ -37,6 +75,9 @@ var GameStage = /** @class */ (function (_super) {
_this._step = 1;
_this.canclick = true;
_this.guideconfig = {};
_this.anirolesvga = "https://yun.duiba.com.cn/spark/assets/14b5846d42f0e6a48f0e463500ce04720cee70d9.svga";
_this.shousvga = "https://yun.duiba.com.cn/spark/assets/327e6a094060ad20d67bfccc16ffe42f20adc1d1.svga";
_this.anifinarolesvga = "https://yun.duiba.com.cn/spark/assets/cc46b3281cad2db353c6d63a4a49ae4f929dfe5b.svga";
return _this;
}
Object.defineProperty(GameStage.prototype, "step", {
......@@ -148,115 +189,230 @@ var GameStage = /** @class */ (function (_super) {
};
//步数渲染
GameStage.prototype.setGuideShow = function () {
var stepdata = this.guideconfig[this.step];
if (!stepdata) {
console.error("引导完毕====》");
this.dispatchOutEvent("guidecomplete", null);
return;
}
var hole = stepdata.hole, txt = stepdata.txt, role = stepdata.role, nextbtn = stepdata.nextbtn, skipbtn = stepdata.skipbtn, touch = stepdata.touch;
this.guideRect.clear();
this.guideRect.beginFill(0x000000, 0.7);
this.guideRect.drawRect(0, 0, this.stagew, this.stageh);
if (hole) {
var holetype = hole.holetype, holex = hole.holex, holey = hole.holey, holesize = hole.holesize;
switch (holetype) {
case "cir":
this.guideRect.arc(holex, holey, holesize[0], 0, Math.PI * 2, true);
break;
case "cirect":
console.log("画圆角洞====》");
//点设置
var cirectwid = holesize[0];
var cirecthei = holesize[1];
var cirectrad = holesize[2];
var dot1 = [holex + cirectrad, holey];
var dot2 = [holex, holey + cirectrad];
var dot3 = [holex, holey + cirecthei - cirectrad];
var dot4 = [holex + cirectrad, holey + cirecthei];
var dot5 = [holex + cirectwid - cirectrad, holey + cirecthei];
var dot6 = [holex + cirectwid, holey + cirecthei - cirectrad];
var dot7 = [holex + cirectwid, holey + cirectrad];
var dot8 = [holex + cirectwid - cirectrad, holey];
this.guideRect.moveTo(dot1[0], dot1[1]);
this.guideRect.quadraticCurveTo(holex, holey, dot2[0], dot2[1]);
this.guideRect.lineTo(dot3[0], dot3[1]);
this.guideRect.quadraticCurveTo(holex, holey + cirecthei, dot4[0], dot4[1]);
this.guideRect.lineTo(dot5[0], dot5[1]);
this.guideRect.quadraticCurveTo(holex + cirectwid, holey + cirecthei, dot6[0], dot6[1]);
this.guideRect.lineTo(dot7[0], dot7[1]);
this.guideRect.quadraticCurveTo(holex + cirectwid, holey, dot8[0], dot8[1]);
this.guideRect.lineTo(dot1[0], dot1[1]);
break;
case "rect":
break;
case "nohole":
break;
default:
console.error("为定义类型");
break;
}
}
this.guideRect.endFill();
if (txt) {
var text = txt.text, txtwidth = txt.txtwidth, txtx = txt.txtx, txty = txt.txty, txtalign = txt.txtalign;
this.messagetxt.text = text;
this.messagetxt.x = txtx;
this.messagetxt.y = txty;
this.messagetxt.textWidth = txtwidth;
this.messagetxt.visible = true;
this.messagetxt.textAlign = txtalign || TEXT_ALIGN.LEFT;
}
else {
this.messagetxt.visible = false;
}
if (role) {
console.log('资源管理==》', TextureCache);
this.rolecont.removeChildren();
this.rolecont.visible = true;
for (var i = 0; i < role.length; i++) {
var irole = role[i];
var rolex = irole.rolex, roley = irole.roley, roletex = irole.roletex;
var ichild = new Sprite(TextureCache[roletex]);
ichild.x = rolex;
ichild.y = roley;
this.rolecont.addChild(ichild);
}
}
else {
this.rolecont.visible = false;
}
if (nextbtn) {
var btnx = nextbtn.btnx, btny = nextbtn.btny, btntex = nextbtn.btntex;
this.nextbtn.texture = TextureCache[btntex];
this.nextbtn.x = btnx;
this.nextbtn.y = btny;
this.nextbtn.visible = true;
}
else {
this.nextbtn.visible = false;
}
if (skipbtn) {
var skipx = skipbtn.skipx, skipy = skipbtn.skipy, skiptex = skipbtn.skiptex;
this.skipbtn.texture = TextureCache[skiptex];
this.skipbtn.x = skipx;
this.skipbtn.y = skipy;
this.skipbtn.visible = true;
console.log("skipbtn====》", skipbtn);
}
else {
this.skipbtn.visible = false;
}
if (touch) {
var touchx = touch.touchx, touchy = touch.touchy, touchsize = touch.touchsize;
this.touchrect.clear();
this.touchrect.beginFill(0x000000, 0.01);
this.touchrect.drawRect(touchx, touchy, touchsize[0], touchsize[1]);
this.touchrect.endFill();
}
else {
console.error("没有点击区域====》");
}
return __awaiter(this, void 0, void 0, function () {
var stepdata, hole, txt, role, nextbtn, skipbtn, touch, holetype, holex, holey, holesize, cirectwid, cirecthei, cirectrad, dot1, dot2, dot3, dot4, dot5, dot6, dot7, dot8, text, txtwidth, txtx, txty, txtalign, _a, rolex, roley, _b, firstcont, svga, btnx, btny, btntex, skipx, skipy, skiptex, touchx, touchy, touchsize;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
stepdata = this.guideconfig[this.step];
if (!stepdata) {
console.error("引导完毕====》");
this.dispatchOutEvent("guidecomplete", null);
return [2 /*return*/];
}
hole = stepdata.hole, txt = stepdata.txt, role = stepdata.role, nextbtn = stepdata.nextbtn, skipbtn = stepdata.skipbtn, touch = stepdata.touch;
this.guideRect.clear();
this.guideRect.beginFill(0x000000, 0.7);
this.guideRect.drawRect(0, 0, this.stagew, this.stageh);
if (hole) {
holetype = hole.holetype, holex = hole.holex, holey = hole.holey, holesize = hole.holesize;
switch (holetype) {
case "cir":
this.guideRect.arc(holex, holey, holesize[0], 0, Math.PI * 2, true);
break;
case "cirect":
console.log("画圆角洞====》");
cirectwid = holesize[0];
cirecthei = holesize[1];
cirectrad = holesize[2];
dot1 = [holex + cirectrad, holey];
dot2 = [holex, holey + cirectrad];
dot3 = [holex, holey + cirecthei - cirectrad];
dot4 = [holex + cirectrad, holey + cirecthei];
dot5 = [holex + cirectwid - cirectrad, holey + cirecthei];
dot6 = [holex + cirectwid, holey + cirecthei - cirectrad];
dot7 = [holex + cirectwid, holey + cirectrad];
dot8 = [holex + cirectwid - cirectrad, holey];
this.guideRect.moveTo(dot1[0], dot1[1]);
this.guideRect.quadraticCurveTo(holex, holey, dot2[0], dot2[1]);
this.guideRect.lineTo(dot3[0], dot3[1]);
this.guideRect.quadraticCurveTo(holex, holey + cirecthei, dot4[0], dot4[1]);
this.guideRect.lineTo(dot5[0], dot5[1]);
this.guideRect.quadraticCurveTo(holex + cirectwid, holey + cirecthei, dot6[0], dot6[1]);
this.guideRect.lineTo(dot7[0], dot7[1]);
this.guideRect.quadraticCurveTo(holex + cirectwid, holey, dot8[0], dot8[1]);
this.guideRect.lineTo(dot1[0], dot1[1]);
break;
case "rect":
break;
case "nohole":
break;
default:
console.error("为定义类型");
break;
}
}
this.guideRect.endFill();
if (txt) {
text = txt.text, txtwidth = txt.txtwidth, txtx = txt.txtx, txty = txt.txty, txtalign = txt.txtalign;
this.messagetxt.text = text;
this.messagetxt.x = txtx;
this.messagetxt.y = txty;
this.messagetxt.textWidth = txtwidth;
this.messagetxt.visible = true;
this.messagetxt.textAlign = txtalign || TEXT_ALIGN.LEFT;
}
else {
this.messagetxt.visible = false;
}
_a = role[0], rolex = _a.rolex, roley = _a.roley;
if (!(this.step != 9)) return [3 /*break*/, 4];
if (this.firstTcont && this.firstTcont.parent) {
this.rolecont.removeChild(this.firstTcont);
}
if (!(this.anirole && this.anirole.parent)) return [3 /*break*/, 1];
this.anirole.x = rolex;
this.anirole.y = roley;
return [3 /*break*/, 3];
case 1:
console.error("新增svga动画===》");
_b = this;
return [4 /*yield*/, this.getAnirole()];
case 2:
_b.anirole = _c.sent();
if (this.anirole) {
this.anirole.x = rolex;
this.anirole.y = roley;
this.rolecont.addChild(this.anirole);
}
_c.label = 3;
case 3:
if (this.step == 1) {
firstcont = this.getFirstTcont();
this.rolecont.addChild(firstcont);
console.log("添加firstCont===>", firstcont);
firstcont.x = rolex - 300;
firstcont.y = roley - 380;
firstcont.scaleX = 0;
firstcont.scaleY = 0;
Tween.get(firstcont, { loop: false })
.to({
scaleX: 1,
scaleY: 1,
}, 200);
console.log("firstcont添加完毕");
}
return [3 /*break*/, 6];
case 4:
if (!(this.step == 9)) return [3 /*break*/, 6];
this.rolecont.removeChildren();
return [4 /*yield*/, this.getFinarole()];
case 5:
svga = _c.sent();
if (svga) {
svga.x = rolex;
svga.y = roley;
this.rolecont.addChild(svga);
}
_c.label = 6;
case 6:
if (nextbtn) {
btnx = nextbtn.btnx, btny = nextbtn.btny, btntex = nextbtn.btntex;
this.nextbtn.texture = TextureCache[btntex];
this.nextbtn.x = btnx;
this.nextbtn.y = btny;
this.nextbtn.visible = true;
}
else {
this.nextbtn.visible = false;
}
if (skipbtn) {
skipx = skipbtn.skipx, skipy = skipbtn.skipy, skiptex = skipbtn.skiptex;
this.skipbtn.texture = TextureCache[skiptex];
this.skipbtn.x = skipx;
this.skipbtn.y = skipy;
this.skipbtn.visible = true;
console.log("skipbtn====》", skipbtn);
}
else {
this.skipbtn.visible = false;
}
if (touch) {
touchx = touch.touchx, touchy = touch.touchy, touchsize = touch.touchsize;
this.touchrect.clear();
this.touchrect.beginFill(0x000000, 0.01);
this.touchrect.drawRect(touchx, touchy, touchsize[0], touchsize[1]);
this.touchrect.endFill();
}
else {
console.error("没有点击区域====》");
}
return [2 /*return*/];
}
});
});
};
GameStage.prototype.getFirstTcont = function () {
this.firstTcont = new Container();
this.firstTcont.addChild(new Sprite(TextureCache["guide1"]));
this.firstTcont.width = 633;
this.firstTcont.height = 410;
this.firstTxt = new TextField();
this.firstTxt.fillColor = "#e9381b";
this.firstTxt.size = 30;
this.firstTxt.x = 266;
this.firstTxt.y = 186;
this.firstTxt.text = "1000欢趣豆";
this.firstTcont.addChild(this.firstTxt);
this.firstTcont.anchorX = 390;
this.firstTcont.anchorY = 410;
return this.firstTcont;
};
GameStage.prototype.getAnirole = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (this.anirole) {
return [2 /*return*/, this.anirole];
}
return [4 /*yield*/, this.loadSvga(this.anirolesvga, this.anirole)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
GameStage.prototype.getShou = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (this.shou) {
return [2 /*return*/, this.shou];
}
return [4 /*yield*/, this.loadSvga(this.shousvga, this.shou)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
GameStage.prototype.getFinarole = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (this.anifinarole) {
return [2 /*return*/, this.anifinarole];
}
return [4 /*yield*/, this.loadSvga(this.anifinarolesvga, this.anifinarole)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
GameStage.prototype.loadSvga = function (src, target) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (res) {
window["SvgaParser"].loadSvga(src, function (_v) {
target = new MovieClip(_v);
res(target);
}, function (e) {
res(null);
});
})];
});
});
};
return GameStage;
}(WidgetBase));
......
......@@ -6,7 +6,7 @@ import API from '../../api';
import { Aup, AUPOP, AUP_MBX_STATE } from '../../pop';
import './main3.less';
import { CanvasWidget } from 'spark-utils';
import { Guideact } from '@spark/guideact';//'./bundle';//
import { Guideact } from './bundle';//'@spark/guideact';//
import { widgetConfig } from './widgetConfig';
import { GDispatcher } from "spark-wrapper-fyge"
import dataCenter, { Store } from '../../dataCenter';
......@@ -23,7 +23,7 @@ class Main3 extends Component {
};
}
updateMoney(){
updateMoney() {
console.log('update money')
}
......@@ -33,7 +33,7 @@ class Main3 extends Component {
}
onClick_signBtn = () => {
API.signInfo().then((res)=>{
API.signInfo().then((res) => {
Aup.show('Sign', res.data, this);
})
}
......@@ -53,10 +53,10 @@ class Main3 extends Component {
componentDidMount() {
this.initEvent();
if(!this.props.data.isnewUser) {
API.signInfo().then((res)=>{
const {needPopup} =res.data;
if(needPopup)
if (!this.props.data.isnewUser) {
API.signInfo().then((res) => {
const { needPopup } = res.data;
if (needPopup)
Aup.show('Sign', res.data, this);
})
}
......@@ -149,9 +149,9 @@ class Main3 extends Component {
txt: null,
role: [
{
rolex: 40,
roley: (canvashei - 764) / 2,
roletex: "guide1"
"rolex": 360,
"roley": 875,
"roletex": "guide1"
}
],
nextbtn: null,
......@@ -181,10 +181,10 @@ class Main3 extends Component {
txty: 224,
txtalign: "center"
},
role :[
role: [
{
rolex: 375,
roley: canvashei-550,
roley: canvashei - 550,
roletex: "guide2_1"
}
],
......@@ -220,10 +220,10 @@ class Main3 extends Component {
txty: 245,
txtalign: "left"
},
role :[
role: [
{
rolex: 375,
roley: canvashei-550,
roley: canvashei - 550,
roletex: "guide2_1"
}
],
......@@ -259,10 +259,10 @@ class Main3 extends Component {
txty: 357,
txtalign: "left"
},
role :[
role: [
{
rolex: 375,
roley: canvashei-550,
roley: canvashei - 550,
roletex: "guide2_1"
}
],
......@@ -297,10 +297,10 @@ class Main3 extends Component {
txty: 580,
txtalign: "left"
},
role :[
role: [
{
rolex: 375,
roley: canvashei-550,
roley: canvashei - 550,
roletex: "guide2_1"
}
],
......@@ -335,10 +335,10 @@ class Main3 extends Component {
txty: 500,
txtalign: "left"
},
role :[
role: [
{
rolex: 375,
roley: canvashei-550,
roley: canvashei - 550,
roletex: "guide2_1"
}
],
......@@ -358,16 +358,16 @@ class Main3 extends Component {
let offsety7 = 0;
let holly = 1110;
if((holly+165/2)>canvashei-300){
let holly1 = canvashei-300-165/2;
offsety7 = holly-holly1;
if ((holly + 165 / 2) > canvashei - 300) {
let holly1 = canvashei - 300 - 165 / 2;
offsety7 = holly - holly1;
}
this.guideconfig[7] = {
hole: {
holetype: "cir",
holex: 575,
holey: 1110-offsety7,
holey: 1110 - offsety7,
holesize: [
165,
440
......@@ -377,19 +377,19 @@ class Main3 extends Component {
text: "点击小卖铺可以进到\n商城页面,在这里购\n买心仪的物品哦~",
txtwidth: 320,
txtx: 85,
txty: 500-offsety7,
txty: 500 - offsety7,
txtalign: "left"
},
role :[
role: [
{
rolex: 0,
roley: canvashei-550,
roley: canvashei - 550,
roletex: "guide2_1"
}
],
nextbtn: {
btnx: 86,
btny: 665-offsety7,
btny: 665 - offsety7,
btntex: "nextbtn"
},
skipbtn: {
......@@ -401,7 +401,7 @@ class Main3 extends Component {
touch: touchdata,
pagey: offsety7,
}
console.log("77777偏移===》",offsety7);
console.log("77777偏移===》", offsety7);
_widget && _widget.dispatchInEvent("setStepData", {
step: 7,
stepdata: this.guideconfig[7]
......@@ -422,9 +422,9 @@ class Main3 extends Component {
case "guidecomplete":
dataCenter.setData(Store.needguide, false);
API.signInfo().then((res)=>{
const {needPopup} =res.data;
if(needPopup)
API.signInfo().then((res) => {
const { needPopup } = res.data;
if (needPopup)
Aup.show('Sign', res.data, this);
})
break;
......@@ -434,7 +434,7 @@ class Main3 extends Component {
let nowstepdata = this.guideconfig[payload];
let nowpagey = nowstepdata.pagey;
this.refs.main3.scrollTop = nowpagey;
console.log("滑动位置调整===》",nowpagey);
console.log("滑动位置调整===》", nowpagey);
break;
default:
......@@ -515,7 +515,7 @@ class Main3 extends Component {
src={this.state.resList['98666530-5e40-49d7-8b86-8397e3ee0889'].url}
/>
<img
onClick={this.onClick_shareBtn}
onClick={this.onClick_shareBtn}
className="main3_share "
uuid="def4d721-bfe0-4c42-970c-40d99e1c2944"
src={this.state.resList['82a28387-28f0-4e49-856a-dbe5e981bbb1'].url}
......
......@@ -7,8 +7,8 @@
"txt": null,
"role": [
{
"rolex": 40,
"roley": 460,
"rolex": 360,
"roley": 875,
"roletex": "guide1"
}
],
......@@ -48,8 +48,8 @@
},
"role": [
{
"rolex": 375,
"roley": 911,
"rolex": 360,
"roley": 875,
"roletex": "guide2_1"
}
],
......@@ -93,8 +93,8 @@
},
"role": [
{
"rolex": 375,
"roley": 911,
"rolex": 360,
"roley": 875,
"roletex": "guide2_1"
}
],
......@@ -137,8 +137,8 @@
},
"role": [
{
"rolex": 375,
"roley": 911,
"rolex": 360,
"roley": 875,
"roletex": "guide2_1"
}
],
......@@ -181,8 +181,8 @@
},
"role": [
{
"rolex": 375,
"roley": 911,
"rolex": 360,
"roley": 875,
"roletex": "guide2_1"
}
],
......@@ -225,8 +225,8 @@
},
"role": [
{
"rolex": 375,
"roley": 911,
"rolex": 360,
"roley": 875,
"roletex": "guide2_1"
}
],
......@@ -344,8 +344,8 @@
},
"role": [
{
"rolex": 238,
"roley": 768,
"rolex": 0,
"roley": 0,
"roletex": "guide2_1"
}
],
......
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