Commit a5812bab authored by huangwenjie's avatar huangwenjie

1

parent dccf7f43
......@@ -49,7 +49,13 @@
"guideLinesEnabled": true
},
"168654fb707": {
"guideLinesEnabled": false
"guideLinesEnabled": true,
"guideLines": [
{
"type": "v",
"pos": 375
}
]
},
"1687055130d": {
"guideLines": [
......
{
"type": "activity",
"name": "ChristmasGifts"
"name": "ggk_qcs"
}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Main_1","version":5,"files":["..\\assets\\main\\title.png","..\\assets\\main\\startBtnBg.png","..\\assets\\main\\startBtn.png","..\\assets\\main\\star.png","..\\assets\\main\\smallSnow.png","..\\assets\\main\\prizeMinTitle.png","..\\assets\\main\\plate.png","..\\assets\\main\\emptyStar.png","..\\assets\\main\\snow.png","..\\assets\\main\\startBtn_d.png","..\\assets\\main\\startDrawBg.png","..\\assets\\main\\logo.png","..\\assets\\pops\\recordBtn.png","..\\assets\\pops\\sureBtn.png","..\\assets\\pops\\useBtn.png","..\\assets\\pops\\ruleBtn.png","..\\assets\\pops\\ruleBg.png","..\\assets\\pops\\prizePanelBg.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Play_3","version":5,"files":["..\\assets\\play\\bell.png","..\\assets\\play\\giftBox.png","..\\assets\\play\\hole.png","..\\assets\\play\\stone.png","..\\assets\\play\\socks.png","..\\assets\\play\\snowBall.png","..\\assets\\play\\scoreBg.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Preload_0","version":5,"files":["..\\assets\\waiting\\progress.png","..\\assets\\waiting\\bg.png","..\\assets\\pops\\sureBtn.png","..\\assets\\pops\\ruleTitle.png","..\\assets\\pops\\restartBtn.png","..\\assets\\pops\\prizePanelBg.png","..\\assets\\pops\\noPrizeTitle.png","..\\assets\\pops\\msgSureBtn.png","..\\assets\\pops\\msgBg.png","..\\assets\\pops\\loginBtn.png","..\\assets\\pops\\knowBtn.png","..\\assets\\common\\closeBtn.png","..\\assets\\pops\\noPrizePanelBg.png","..\\assets\\pops\\ruleBg.png","..\\assets\\pops\\restartBtn3.png","..\\assets\\pops\\restartBtn2.png","..\\assets\\pops\\warningtitle.png","..\\assets\\pops\\useBtn.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Preload_0","version":5,"files":["..\\assets\\waiting\\progress.png","..\\assets\\waiting\\bg.png","..\\assets\\common\\closeBtn.png","..\\assets\\pops\\noPrizePanelBg.png","..\\assets\\pops\\msgSureBtn.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Start_2","version":5,"files":["..\\assets\\start\\recordBtn.png","..\\assets\\start\\ruleBtn.png","..\\assets\\start\\startBtn.png","..\\assets\\start\\hand.png","..\\assets\\start\\giveStar.png","..\\assets\\start\\star.png","..\\assets\\start\\smallSnow.png","..\\assets\\start\\sled.png","..\\assets\\start\\title.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"Guide_1","version":5,"files":["..\\assets\\guide\\finger.png"]}
\ No newline at end of file
{"options":{"layoutMath":"2","sizeMode":"2n","useExtension":1,"layoutGap":1,"extend":0},"projectName":"preload_2","version":5,"files":["..\\assets\\pops\\ruleBg.png"]}
\ No newline at end of file
{
"groups": [
{
"keys": "progress_png,bg_png,sureBtn_png,prizePanelBg_png,msgSureBtn_png,closeBtn_png,noPrizePanelBg_png,useBtn_png",
"keys": "progress_png,bg_png,closeBtn_png,noPrizePanelBg_png,msgSureBtn_png",
"name": "Preload"
},
{
"keys": "title_png,startBtnBg_png,startBtn_png,startBg_jpg,star_png,smallSnow_png,prizeMinTitle_png,plate_png,emptyStar_png,snow_png,startBtn_d_png",
"keys": "title_png,startBtnBg_png,startBtn_png,startBg_jpg,star_png,smallSnow_png,prizeMinTitle_png,plate_png,emptyStar_png,snow_png,startBtn_d_png,startDrawBg_png,logo_png,recordBtn_png,sureBtn_png,useBtn_png,ruleBtn_png,ruleBg_png,prizePanelBg_png",
"name": "Main"
},
{
"name": "preload",
"keys": "startDrawBg_png"
}
],
"resources": [
......@@ -115,9 +111,24 @@
"name": "startBtn_d_png"
},
{
"name": "startDrawBg_png",
"url": "assets/main/startDrawBg.png",
"type": "image",
"name": "startDrawBg_png"
},
{
"url": "assets/pops/recordBtn.png",
"type": "image",
"name": "recordBtn_png"
},
{
"url": "assets/pops/ruleBtn.png",
"type": "image",
"name": "ruleBtn_png"
},
{
"url": "assets/pops/ruleBg.png",
"type": "image",
"url": "assets/main/startDrawBg.png"
"name": "ruleBg_png"
}
]
}
\ No newline at end of file
{
"skins": {},
"autoGenerateExmlsList": true,
"exmls": [
"resource/skins/ToastSkin.exml",
"resource/skins/PrizeItemSkin.exml",
"resource/skins/MsgSkin.exml",
"resource/skins/MainSkin.exml",
"resource/skins/NoPrizeSkin.exml",
"resource/skins/PrizeSkin.exml",
"resource/skins/VScrollBarSkin.exml",
"resource/skins/WaitingSkin.exml",
"resource/skins/ui/IconButtonSkin.exml",
"resource/skins/ui/MusicButtonSkin.exml",
"resource/skins/ui/ProgressBarSkin.exml",
"resource/skins/ui/SliderSkin.exml",
"resource/skins/ui/StartButtonSkin.exml"
],
"path": "resource/default.thm.json"
"skins": {},
"autoGenerateExmlsList": true,
"exmls": [
"resource/skins/MainSkin.exml",
"resource/skins/MsgSkin.exml",
"resource/skins/NoPrizeSkin.exml",
"resource/skins/PrizeItemSkin.exml",
"resource/skins/PrizeSkin.exml",
"resource/skins/RuleSkin.exml",
"resource/skins/ToastSkin.exml",
"resource/skins/VScrollBarSkin.exml",
"resource/skins/WaitingSkin.exml",
"resource/skins/WarningSkin.exml",
"resource/skins/ui/IconButtonSkin.exml",
"resource/skins/ui/MusicButtonSkin.exml",
"resource/skins/ui/ProgressBarSkin.exml",
"resource/skins/ui/SliderSkin.exml",
"resource/skins/ui/StartButtonSkin.exml"
],
"path": "resource/default.thm.json"
}
\ No newline at end of file
......@@ -7,7 +7,7 @@
<e:Image id="plate" source="plate_png" y="1108" horizontalCenter="0"/>
<e:Image source="snow_png" x="596" y="194.5"/>
<e:Image source="snow_png" x="-35.51" y="387" anchorOffsetX="0" width="120.33" anchorOffsetY="0" height="106"/>
<e:Image source="star_png" x="612" y="-8"/>
<e:Image source="star_png" x="599.02" y="9" anchorOffsetX="0" width="54.98" anchorOffsetY="0" height="114"/>
<e:Image source="emptyStar_png" x="110" y="188"/>
<e:Image source="star_png" x="82" y="812.5" anchorOffsetX="0" width="80" anchorOffsetY="0" height="165.88"/>
<e:Group id="winnerList" width="750" height="50" x="0" y="0" scaleX="1" scaleY="1">
......@@ -35,6 +35,8 @@
<e:Image id="prizeImg" width="494" height="258" x="127.66" y="180.67" visible="false"/>
</e:Group>
<e:Button id="startBtn" label="" y="670.5" skinName="ui.IconButtonSkin" icon="startBtn_png" width="452" anchorOffsetX="226" height="113" anchorOffsetY="56.5" touchEnabled="true" touchChildren="true" horizontalCenter="0"/>
<e:Button id="ruleBtn" label="" y="125" skinName="ui.IconButtonSkin" icon="ruleBtn_png" anchorOffsetX="49" anchorOffsetY="14" right="0"/>
<e:Button id="recordBtn" label="" y="167" skinName="ui.IconButtonSkin" icon="recordBtn_png" anchorOffsetX="49" anchorOffsetY="14" right="0"/>
......
<?xml version="1.0" encoding="utf-8"?>
<e:Skin class="RuleSkin" width="750" height="1206" xmlns:e="http://ns.egret.com/eui" xmlns:w="http://ns.egret.com/wing">
<w:Config id="168654fb707" x="-86" y="-98"/>
<e:Group width="750" height="1000" horizontalCenter="0" verticalCenter="-50">
<e:Image horizontalCenter="-18.5" anchorOffsetY="0" height="859" verticalCenter="3.5" x="0" y="0" scaleX="1" scaleY="1" scale9Grid="60,380,284,95" source="ruleBg_png"/>
<e:Scroller id="scroller" width="517" height="670" y="190" anchorOffsetY="0" anchorOffsetX="0" scaleX="1" scaleY="1" horizontalCenter="0">
<e:Group id="group" width="100%" anchorOffsetY="0" x="0" y="-252" height="479">
<e:Rect width="100%" height="10" x="206" y="59" fillAlpha="0"/>
<e:Label id="labContent" width="100%" text="" lineSpacing="10" size="30" multiline="true" anchorOffsetY="-8" fontFamily="Microsoft YaHei" textColor="0xfcca80"/>
<e:layout>
<e:VerticalLayout/>
</e:layout>
</e:Group>
</e:Scroller>
<e:Button id="closeBtn" label="" icon="closeBtn_png" y="38" skinName="ui.IconButtonSkin" anchorOffsetY="24" x="619" scaleX="1" scaleY="1" height="48" width="48" anchorOffsetX="24"/>
</e:Group>
</e:Skin>
\ No newline at end of file
......@@ -18,6 +18,7 @@ import PrizePanel from './pops/prizePanel/PrizePanel';
import MainScene from './scenes/MainScene';
import ToastCtrl from './ctrls/toastCtrl';
import NoPrizePanel from './pops/prizePanel/NoPrizePanel';
import RulePanel from './pops/rule/RulePanel';
class Main extends MainBase {
......@@ -26,6 +27,7 @@ class Main extends MainBase {
// 注册所有Panel
PanelCtrl.instance.registerClass(ModuleTypes.MSG_PANEL, Msg);
PanelCtrl.instance.registerClass(ModuleTypes.RULE_PANEL, RulePanel);
PanelCtrl.instance.registerClass(ModuleTypes.PRIZE_PANEL, PrizePanel);
PanelCtrl.instance.registerClass(ModuleTypes.NOPRIZE_PANEL, NoPrizePanel);
// 注册所有Scene
......
......@@ -14,6 +14,20 @@ export default class qcsNet {
uri: `/projectx/${projectxId}/join_1/getRemainTime.do`,
type: 'get',
dataType: 'json',
hideMsg: true,
param: {},
callback: callback
};
NetManager.ins.send(net);
}
public static getRule(callback, projectxId = window["projectxId"]) {
const net: INetData = {
name: 'getRule',
uri: `/projectx/${projectxId}/projectRule.query`,
type: 'get',
dataType: 'json',
hideMsg: true,
param: {},
callback: callback
};
......@@ -31,6 +45,7 @@ export default class qcsNet {
uri: `/projectx/${projectxId}/join_1/join.do`,
type: 'get',
dataType: 'json',
hideMsg: true,
param: {},
callback: callback
};
......@@ -53,6 +68,7 @@ export default class qcsNet {
uri: `/projectx/${projectxId}/prize.query`,
type: 'get',
dataType: 'json',
hideMsg: true,
param: param,
callback: callback
};
......
......@@ -50,8 +50,16 @@ export default class PrizePanel extends Panel {
this.prizeName.text = this.lottery.name + ""
}
this.initBuried()
}
getExposure
initBuried() {
let dpm = Buried.connectDpm(110, 1, 1)
let dcm = Buried.connectDpm(202, 0, 0)
this.getExposure = Buried.createExposure(dpm, dcm)
NetManager.ins.showLog(this.getExposure)
}
initEvents() {
......@@ -62,7 +70,12 @@ export default class PrizePanel extends Panel {
}
onTap_GetPrize() {
window.location.href = this.prize.url
NetManager.ins.clickLog(this.getExposure)
setTimeout(() => {
window.location.href = this.prize.url
}, 200);
}
onTap_CloseBtn(e: egret.TouchEvent) {
......
/**
* Convert the text in html format to the object that can be assigned to the egret.TextField#textFlow property
* @see http://edn.egret.com/cn/docs/page/146 Text mixed in a variety of style
* @version Egret 2.4
* @platform Web,Native
* @includeExample egret/text/HtmlTextParser.ts
* @language en_US
*/
/**
* 将html格式文本转换为可赋值给 egret.TextField#textFlow 属性的对象
* @see http://edn.egret.com/cn/docs/page/146 多种样式文本混合
* @version Egret 2.4
* @platform Web,Native
* @includeExample egret/text/HtmlTextParser.ts
* @language zh_CN
*/
export class HtmlTextParser {
/**
* @version Egret 2.4
* @platform Web,Native
*/
constructor() {
this.initReplaceArr();
this.initPreReplaceArr();
}
private replaceArr: any[] = [];
private initReplaceArr(): void {
const arr = this.replaceArr = [];
arr.push([/&lt;/g, "<"]);
arr.push([/&gt;/g, ">"]);
arr.push([/&amp;/g, "&"]);
arr.push([/&quot;/g, "\""]);
arr.push([/&apos;/g, "\'"]);
}
private preReplaceArr: any[] = [];
private initPreReplaceArr() {
const arr = this.preReplaceArr = [];
arr.push([/\\\"/g, "\""]);
arr.push([/<br>/g, "\n"]);
}
/**
* @private
*
* @param value
* @returns
*/
private replaceSpecial(value: string): string {
// tslint:disable-next-line:prefer-for-of
for (let i = 0; i < this.replaceArr.length; i++) {
const k = this.replaceArr[i][0];
const v = this.replaceArr[i][1];
value = value.replace(k, v);
}
return value;
}
/**
* @private
*/
private resutlArr: Array<egret.ITextElement> = [];
/**
* Convert the text in html format to the object that can be assigned to the egret.TextField#textFlow property
* @param htmltext {string} Text in html
* @returns {Array<egret.ITextElement>} 可赋值给 egret.TextField#textFlow Object that can be assigned to the egret.TextField#textFlow property
* @version Egret 2.4
* @platform Web,Native
* @language en_US
*/
/**
* 将html格式文本转换为可赋值给 egret.TextField#textFlow 属性的对象
* @param htmltext {string} html文本
* @returns {Array<egret.ITextElement>} 可赋值给 egret.TextField#textFlow 属性的对象
* @version Egret 2.4
* @platform Web,Native
* @language zh_CN
*/
public parse(htmltext: string): egret.ITextElement[] {
this.preReplaceArr.forEach(p => {
htmltext = htmltext.replace(p[0], p[1]);
});
this.stackArray = [];
this.resutlArr = [];
let firstIdx = 0;//文本段开始位置
const length: number = htmltext.length;
while (firstIdx < length) {
const starIdx: number = htmltext.indexOf("<", firstIdx);
if (starIdx < 0) {
this.addToResultArr(htmltext.substring(firstIdx));
firstIdx = length;
}
else {
this.addToResultArr(htmltext.substring(firstIdx, starIdx));
let fontEnd = htmltext.indexOf(">", starIdx);
if (fontEnd == -1) {
egret.$error(1038);
fontEnd = starIdx;
}
else if (htmltext.charAt(starIdx + 1) == "\/") {//关闭
this.stackArray.pop();
}
else {
this.addToArray(htmltext.substring(starIdx + 1, fontEnd));
}
firstIdx = fontEnd + 1;
}
}
return this.resutlArr;
}
public parser(htmltext: string): Array<egret.ITextElement> {
return this.parse(htmltext);
}
/**
* @private
*
* @param value
*/
private addToResultArr(value: string): void {
if (value == "") {
return;
}
value = this.replaceSpecial(value);
if (this.stackArray.length > 0) {
this.resutlArr.push({ text: value, style: this.stackArray[this.stackArray.length - 1] })
}
else {
this.resutlArr.push(<egret.ITextElement>{ text: value });
}
}
//将字符数据转成Json数据
private changeStringToObject(str: string): egret.ITextStyle {
str = this.replaceSpecial(str.trim());
const info: any = {};
let header = [];
if (str.charAt(0) == "i" || str.charAt(0) == "b" || str.charAt(0) == "u") {
this.addProperty(info, str, "true");
}
// tslint:disable-next-line:no-conditional-assignment
else if (header = str.match(/^(font|a)\s/)) {
str = str.substring(header[0].length).trim();
let next = 0;
let titles;
// tslint:disable-next-line:no-conditional-assignment
while (titles = str.match(this.getHeadReg())) {
const title = titles[0];
let value = "";
str = str.substring(title.length).trim();
if (str.charAt(0) == "\"") {
next = str.indexOf("\"", 1);
value = str.substring(1, next);
next += 1;
}
else if (str.charAt(0) == "\'") {
next = str.indexOf("\'", 1);
value = str.substring(1, next);
next += 1;
}
else {
value = str.match(/(\S)+/)[0];
next = value.length;
}
this.addProperty(info, title.substring(0, title.length - 1).trim(), value.trim());
str = str.substring(next).trim();
}
}
return info;
}
/**
* @private
*
* @returns
*/
private getHeadReg(): RegExp {
return /^(color|textcolor|strokecolor|stroke|b|bold|i|italic|u|size|fontfamily|href|target)(\s)*=/;
}
/**
* @private
*
* @param info
* @param head
* @param value
*/
private addProperty(info: egret.ITextStyle, head: string, value: string): void {
switch (head.toLowerCase()) {
case "color":
case "textcolor":
value = value.replace(/#/, "0x");
info.textColor = parseInt(value);
break;
case "strokecolor":
value = value.replace(/#/, "0x");
info.strokeColor = parseInt(value);
break;
case "stroke":
info.stroke = parseInt(value);
break;
case "b":
case "bold":
info.bold = value == "true";
break;
case "u":
info.underline = value == "true";
break;
case "i":
case "italic":
info.italic = value == "true";
break;
case "size":
info.size = parseInt(value);
break;
case "fontfamily":
info.fontFamily = value;
break;
case "href":
info.href = this.replaceSpecial(value);
break;
case "target":
info.target = this.replaceSpecial(value);
break;
}
}
/**
* @private
*/
private stackArray: Array<egret.ITextStyle>;
/**
* @private
*
* @param infoStr
*/
private addToArray(infoStr: string): void {
const info: egret.ITextStyle = this.changeStringToObject(infoStr);
if (this.stackArray.length == 0) {
this.stackArray.push(info);
}
else {
const lastInfo: Object = this.stackArray[this.stackArray.length - 1];
for (const key in lastInfo) {
if (info[key] == null) {
info[key] = lastInfo[key];
}
}
this.stackArray.push(info);
}
}
}
const parser = new HtmlTextParser();
export const parseHtmlText = (content) => {
return parser.parse(content);
}
import { NetPromise } from './../../promises/NetPromise';
import { NetManager } from '../../../libs/tw/manager/NetManager';
import { DataManager } from '../../../libs/tw/manager/DataManager';
import { HtmlTextParser } from "./HtmlTextParser";
import Panel from "../../views/Panel";
import ToastCtrl from '../../ctrls/toastCtrl';
export default class RulePanel extends Panel {
public labContent: eui.Label;
public scroller: eui.Scroller;
start() {
if (window['ruleTxt']) {
this.labContent.textFlow = (new HtmlTextParser).parser(window['ruleTxt']);
} else {
if (!DataManager.ins.getData("getRule")) {
NetPromise.getRule()
.then(() => {
this.addRule();
})
.catch((e) => {
console.error(e);
ToastCtrl.instance.show("获取规则失败,请稍后重试~")
})
}
else {
this.addRule();
}
}
}
group: eui.Group;
private addRule() {
const text = DataManager.ins.getData("getRule").data;
this.labContent.textFlow = (new HtmlTextParser).parser(text);
}
get skinKey() { return 'Rule' }
}
\ No newline at end of file
......@@ -17,6 +17,18 @@ export class NetPromise {
})
}
static getRule() {
return new Promise((r, j) => {
qcsNet.getRule((s) => {
if (!s) {
j(s)
return
}
r()
});
})
}
/**
* 参与刮奖
*/
......
......@@ -34,7 +34,8 @@ export default class MainScene extends Scene {
public thanksBg: eui.Rect;
public prizeImg: eui.Image;
public startBtn: eui.Button;
public ruleBtn: eui.Button;
public recordBtn: eui.Button;
public mainMask: egret.Shape;
......@@ -126,15 +127,35 @@ export default class MainScene extends Scene {
this.snowAni()
ToastCtrl.instance.show(`恭喜你,获得${this.remainTimes}次抽奖次数`)
}
initEvents() {
super.initEvents()
this.onTap(this.startBtn, this.onTap_startBtn)
this.onTap(this.ruleBtn, this.onTap_ruleBtn)
this.onTap(this.recordBtn, this.onTap_recordBtn)
this.addEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this)
}
onTap_ruleBtn() {
NetPromise.getRule()
.then(() => {
PanelCtrl.instance.show(ModuleTypes.RULE_PANEL)
})
.catch(e => {
console.error(e);
ToastCtrl.instance.show("获取规则失败,请稍后重试~")
})
}
onTap_recordBtn() {
window.location.href = window['recordUrl']
}
onTap_startBtn() {
if (this.remainTimes && this.remainTimes > 0) {
Waiting.instance.show()
......@@ -174,6 +195,8 @@ export default class MainScene extends Scene {
removeEvents() {
super.removeEvents
this.clearTap(this.startBtn, this.onTap_startBtn)
this.clearTap(this.ruleBtn, this.onTap_ruleBtn)
this.clearTap(this.recordBtn, this.onTap_recordBtn)
this.removeEventListener(egret.Event.ENTER_FRAME, this.onEnterFrame, this)
}
......
......@@ -12,6 +12,9 @@ const config = {
'/projectx/1/queryAllUserRecords': {
data: './qcs/queryAllUserRecords.json'
},
'/projectx/1/projectRule.query': {
data: './qcs/getRule.json'
},
'/activityCommon/getRole': {
data: './json/getRole.json'
......
{
"success": true,
"message": "",
"data": "afadsfasdfasdfasdfasdfasdfasd"
}
\ 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