Commit 7ac39318 authored by wildfirecode13's avatar wildfirecode13

u

parent df3c1ad3
{ {
"groups": [ "groups": [
{ {
"keys": "comCloseBtn.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,知道啦.png", "keys": "ruleBg.png,我知道了.png",
"name": "RulePanel"
},
{
"keys": "startSceneBg.jpg,奖品按钮.png,底部按钮区背景.png,开始游戏.png,排行榜按钮.png,规则按钮.png,赚次数按钮.png,运动锦鲤按钮.png",
"name": "StartScene"
},
{
"keys": "comCloseBtn.png,sharemask.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,知道啦.png",
"name": "common" "name": "common"
}, },
{ {
...@@ -13,12 +21,8 @@ ...@@ -13,12 +21,8 @@
"name": "playScene" "name": "playScene"
}, },
{ {
"keys": "ruleBg.png,我知道了.png", "keys": "share_bg.png,share_close.png,share_go.png",
"name": "RulePanel" "name": "share"
},
{
"keys": "startSceneBg.jpg,奖品按钮.png,底部按钮区背景.png,开始游戏.png,排行榜按钮.png,规则按钮.png,赚次数按钮.png,运动锦鲤按钮.png",
"name": "StartScene"
} }
], ],
"path": "./resource/" "path": "./resource/"
......
{ {"x":0,"y":0,"type":"container","children":[{"name":"RulePanel","x":0,"y":0,"type":"container","children":[{"name":"ruleBg","x":28,"y":248,"type":"sprite","props":{"source":"ruleBg.png"}},{"name":"规则内容","x":74,"y":369,"type":"text","props":{"text":"游戏规则\n","size":30,"fillColor":"#000000","textAlpha":1},"id":"ruleTxt"},{"name":"我知道了","x":164,"y":1197,"type":"button","props":{"tUp":"我知道了.png"},"id":"knowBtn"},{"name":"关闭按钮","x":625,"y":272,"type":"button","props":{"tUp":"关闭按钮.png"},"id":"closeBtn"}]},{"name":"StartScene","x":0,"y":0,"type":"container","children":[{"name":"startSceneBg","x":0,"y":0,"type":"sprite","props":{"source":"startSceneBg.jpg"}},{"name":"底部按钮区","x":0,"y":1242,"type":"container","children":[{"name":"底部按钮区背景","x":0,"y":0,"type":"sprite","props":{"source":"底部按钮区背景.png"}},{"name":"icon","x":56,"y":35,"type":"container","children":[{"name":"赚次数按钮","x":547,"y":0,"type":"button","props":{"tUp":"赚次数按钮.png"},"id":"taskBtn"},{"name":"运动锦鲤按钮","x":258,"y":0,"type":"button","props":{"tUp":"运动锦鲤按钮.png"},"id":"lotBtn"},{"name":"排行榜按钮","x":0,"y":0,"type":"button","props":{"tUp":"排行榜按钮.png"},"id":"rankBtn"}]}]},{"name":"timesTxt","x":286,"y":1205,"type":"text","props":{"text":"剩余次数:3次","size":16.00722,"fillColor":"#ffffff","textAlpha":1},"id":"timesTxt"},{"name":"开始游戏","x":171,"y":1052,"type":"button","props":{"tUp":"开始游戏.png"},"id":"startBtn"},{"name":"规则按钮","x":621,"y":212,"type":"button","props":{"tUp":"规则按钮.png"},"id":"ruleBtn"},{"name":"奖品按钮","x":11,"y":212,"type":"button","props":{"tUp":"奖品按钮.png"},"id":"recordBtn"}]},{"name":"share","x":126,"y":508,"type":"container","children":[{"name":"share_bg","x":0,"y":0,"type":"sprite","props":{"source":"share_bg.png"}},{"name":"share_go","x":139,"y":458,"type":"sprite","props":{"source":"share_go.png"}},{"name":"share_tips","x":122,"y":299,"type":"text","props":{"text":"获得一次拆盲盒机会","size":28,"fillColor":"#000000","textAlpha":1}},{"name":"share_close","x":216,"y":635,"type":"sprite","props":{"source":"share_close.png"}}]}]}
"x": 0,
"y": 0,
"type": "container",
"children": [
{
"name": "RulePanel",
"x": 0,
"y": 0,
"type": "container",
"children": [
{
"name": "ruleBg",
"x": 28,
"y": 248,
"type": "sprite",
"props": {
"source": "ruleBg.png"
}
},
{
"name": "规则内容",
"x": 74,
"y": 369,
"type": "text",
"props": {
"text": "游戏规则\n",
"size": 30,
"fillColor": "#000000",
"textAlpha": 1
},
"id": "ruleTxt"
},
{
"name": "我知道了",
"x": 164,
"y": 1197,
"type": "button",
"props": {
"tUp": "我知道了.png"
},
"id": "knowBtn"
},
{
"name": "关闭按钮",
"x": 625,
"y": 272,
"type": "button",
"props": {
"tUp": "关闭按钮.png"
},
"id": "closeBtn"
}
]
},
{
"name": "StartScene",
"x": 0,
"y": 0,
"type": "container",
"children": [
{
"name": "startSceneBg",
"x": 0,
"y": 0,
"type": "sprite",
"props": {
"source": "startSceneBg.jpg"
}
},
{
"name": "底部按钮区",
"x": 0,
"y": 1242,
"type": "container",
"children": [
{
"name": "底部按钮区背景",
"x": 0,
"y": 0,
"type": "sprite",
"props": {
"source": "底部按钮区背景.png"
}
},
{
"name": "icon",
"x": 56,
"y": 35,
"type": "container",
"children": [
{
"name": "赚次数按钮",
"x": 547,
"y": 0,
"type": "button",
"props": {
"tUp": "赚次数按钮.png"
},
"id": "taskBtn"
},
{
"name": "运动锦鲤按钮",
"x": 258,
"y": 0,
"type": "button",
"props": {
"tUp": "运动锦鲤按钮.png"
},
"id": "lotBtn"
},
{
"name": "排行榜按钮",
"x": 0,
"y": 0,
"type": "button",
"props": {
"tUp": "排行榜按钮.png"
},
"id": "rankBtn"
}
]
}
]
},
{
"name": "timesTxt",
"x": 286,
"y": 1205,
"type": "text",
"props": {
"text": "剩余次数:3次",
"size": 16.00722,
"fillColor": "#ffffff",
"textAlpha": 1
},
"id": "timesTxt"
},
{
"name": "开始游戏",
"x": 171,
"y": 1052,
"type": "button",
"props": {
"tUp": "开始游戏.png"
},
"id": "startBtn"
},
{
"name": "规则按钮",
"x": 621,
"y": 212,
"type": "button",
"props": {
"tUp": "规则按钮.png"
},
"id": "ruleBtn"
},
{
"name": "奖品按钮",
"x": 11,
"y": 212,
"type": "button",
"props": {
"tUp": "奖品按钮.png"
},
"id": "recordBtn"
}
]
}
]
}
\ No newline at end of file
export const ResJson = { export const ResJson = {
"groups": [ "groups": [
{ {
"keys": "comCloseBtn.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,知道啦.png", "keys": "ruleBg.png,我知道了.png",
"name": "common", "name": "RulePanel"
"atlas": { },
"toastBg.png": { {
"x": 2, "keys": "startSceneBg.jpg,奖品按钮.png,底部按钮区背景.png,开始游戏.png,排行榜按钮.png,规则按钮.png,赚次数按钮.png,运动锦鲤按钮.png",
"y": 2, "name": "StartScene"
"w": 460, },
"h": 130, {
"ox": 0, "keys": "comCloseBtn.png,sharemask.png,toastBg.png,waitingBg.png,waitingRot.png,关闭按钮.png,知道啦.png",
"oy": 0, "name": "common"
"sw": 460,
"sh": 130,
"ro": false
},
"知道啦.png": {
"x": 2,
"y": 134,
"w": 306,
"h": 102,
"ox": 0,
"oy": 0,
"sw": 306,
"sh": 102,
"ro": false
},
"waitingBg.png": {
"x": 2,
"y": 238,
"w": 160,
"h": 180,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 180,
"ro": true
},
"关闭按钮.png": {
"x": 310,
"y": 134,
"w": 60,
"h": 60,
"ox": 0,
"oy": 0,
"sw": 60,
"sh": 60,
"ro": false
},
"waitingRot.png": {
"x": 372,
"y": 134,
"w": 56,
"h": 56,
"ox": 0,
"oy": 0,
"sw": 56,
"sh": 56,
"ro": false
},
"comCloseBtn.png": {
"x": 372,
"y": 192,
"w": 48,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 48,
"sh": 48,
"ro": false
}
}
}, },
{ {
"keys": "进度条.png,进度条底.png", "keys": "进度条.png,进度条底.png",
"name": "loading", "name": "loading"
"atlas": {
"进度条底.png": {
"x": 2,
"y": 2,
"w": 584,
"h": 24,
"ox": 0,
"oy": 0,
"sw": 584,
"sh": 24,
"ro": false
},
"进度条.png": {
"x": 2,
"y": 28,
"w": 580,
"h": 20,
"ox": 0,
"oy": 0,
"sw": 580,
"sh": 20,
"ro": false
}
}
}, },
{ {
"keys": "playBg.jpg", "keys": "playBg.jpg",
"name": "playScene" "name": "playScene"
}, },
{ {
"keys": "ruleBg.png,我知道了.png", "keys": "share_bg.png,share_close.png,share_go.png",
"name": "RulePanel", "name": "share"
"atlas": {
"ruleBg.png": {
"x": 2,
"y": 2,
"w": 680,
"h": 1120,
"ox": 0,
"oy": 0,
"sw": 680,
"sh": 1120,
"ro": false
},
"我知道了.png": {
"x": 684,
"y": 2,
"w": 412,
"h": 114,
"ox": 0,
"oy": 0,
"sw": 412,
"sh": 114,
"ro": true
}
}
},
{
"keys": "startSceneBg.jpg,奖品按钮.png,底部按钮区背景.png,开始游戏.png,排行榜按钮.png,规则按钮.png,赚次数按钮.png,运动锦鲤按钮.png",
"name": "StartScene",
"atlas": {
"底部按钮区背景.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 191,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 191,
"ro": false
},
"开始游戏.png": {
"x": 2,
"y": 195,
"w": 413,
"h": 149,
"ox": 0,
"oy": 0,
"sw": 413,
"sh": 149,
"ro": false
},
"运动锦鲤按钮.png": {
"x": 417,
"y": 195,
"w": 121,
"h": 117,
"ox": 0,
"oy": 0,
"sw": 121,
"sh": 117,
"ro": true
},
"奖品按钮.png": {
"x": 536,
"y": 195,
"w": 119,
"h": 44,
"ox": 0,
"oy": 0,
"sw": 119,
"sh": 44,
"ro": true
},
"规则按钮.png": {
"x": 582,
"y": 195,
"w": 119,
"h": 44,
"ox": 0,
"oy": 0,
"sw": 119,
"sh": 44,
"ro": true
},
"排行榜按钮.png": {
"x": 628,
"y": 195,
"w": 91,
"h": 117,
"ox": 0,
"oy": 0,
"sw": 91,
"sh": 117,
"ro": true
},
"赚次数按钮.png": {
"x": 2,
"y": 346,
"w": 92,
"h": 117,
"ox": 0,
"oy": 0,
"sw": 92,
"sh": 117,
"ro": true
}
}
} }
], ],
"path": "https://yun.duiba.com.cn/db_games/activity/template/1628675421/resource/" "path": "./resource/"
} }
\ No newline at end of file
export const SkinJson = { export const SkinJson ={
"x": 0, "x": 0,
"y": 0, "y": 0,
"type": "container", "type": "container",
"children": [ "children": [
{ {
"name": "RulePanel", "name": "RulePanel",
"x": 0, "x": 0,
"y": 0, "y": 0,
"type": "container", "type": "container",
"children": [ "children": [
{ {
"name": "ruleBg", "name": "ruleBg",
"x": 28, "x": 28,
"y": 248, "y": 248,
"type": "sprite", "type": "sprite",
"props": { "props": {
"source": "ruleBg.png" "source": "ruleBg.png"
} }
}, },
{ {
"name": "规则内容", "name": "规则内容",
"x": 74, "x": 74,
"y": 369, "y": 369,
"type": "text", "type": "text",
"props": { "props": {
"text": "游戏规则\n", "text": "游戏规则\n",
"size": 30, "size": 30,
"fillColor": "#000000", "fillColor": "#000000",
"textAlpha": 1 "textAlpha": 1
}, },
"id": "ruleTxt" "id": "ruleTxt"
}, },
{ {
"name": "我知道了", "name": "我知道了",
"x": 164, "x": 164,
"y": 1197, "y": 1197,
"type": "button", "type": "button",
"props": { "props": {
"tUp": "我知道了.png" "tUp": "我知道了.png"
}, },
"id": "knowBtn" "id": "knowBtn"
}, },
{ {
"name": "关闭按钮", "name": "关闭按钮",
"x": 625, "x": 625,
"y": 272, "y": 272,
"type": "button", "type": "button",
"props": { "props": {
"tUp": "关闭按钮.png" "tUp": "关闭按钮.png"
}, },
"id": "closeBtn" "id": "closeBtn"
} }
] ]
}, },
{ {
"name": "StartScene", "name": "StartScene",
"x": 0, "x": 0,
"y": 0, "y": 0,
"type": "container", "type": "container",
"children": [ "children": [
{ {
"name": "startSceneBg", "name": "startSceneBg",
"x": 0, "x": 0,
"y": 0, "y": 0,
"type": "sprite", "type": "sprite",
"props": { "props": {
"source": "startSceneBg.jpg" "source": "startSceneBg.jpg"
} }
}, },
{ {
"name": "底部按钮区", "name": "底部按钮区",
"x": 0, "x": 0,
"y": 1242, "y": 1242,
"type": "container", "type": "container",
"children": [ "children": [
{ {
"name": "底部按钮区背景", "name": "底部按钮区背景",
"x": 0, "x": 0,
"y": 0, "y": 0,
"type": "sprite", "type": "sprite",
"props": { "props": {
"source": "底部按钮区背景.png" "source": "底部按钮区背景.png"
} }
}, },
{ {
"name": "icon", "name": "icon",
"x": 56, "x": 56,
"y": 35, "y": 35,
"type": "container", "type": "container",
"children": [ "children": [
{ {
"name": "赚次数按钮", "name": "赚次数按钮",
"x": 547, "x": 547,
"y": 0, "y": 0,
"type": "button", "type": "button",
"props": { "props": {
"tUp": "赚次数按钮.png" "tUp": "赚次数按钮.png"
}, },
"id": "taskBtn" "id": "taskBtn"
}, },
{ {
"name": "运动锦鲤按钮", "name": "运动锦鲤按钮",
"x": 258, "x": 258,
"y": 0, "y": 0,
"type": "button", "type": "button",
"props": { "props": {
"tUp": "运动锦鲤按钮.png" "tUp": "运动锦鲤按钮.png"
}, },
"id": "lotBtn" "id": "lotBtn"
}, },
{ {
"name": "排行榜按钮", "name": "排行榜按钮",
"x": 0, "x": 0,
"y": 0, "y": 0,
"type": "button", "type": "button",
"props": { "props": {
"tUp": "排行榜按钮.png" "tUp": "排行榜按钮.png"
}, },
"id": "rankBtn" "id": "rankBtn"
} }
] ]
} }
] ]
}, },
{ {
"name": "timesTxt", "name": "timesTxt",
"x": 286, "x": 286,
"y": 1205, "y": 1205,
"type": "text", "type": "text",
"props": { "props": {
"text": "剩余次数:3次", "text": "剩余次数:3次",
"size": 28, "size": 16.00722,
"fillColor": "#ffffff", "fillColor": "#ffffff",
"textAlpha": 1 "textAlpha": 1
}, },
"id": "timesTxt" "id": "timesTxt"
}, },
{ {
"name": "开始游戏", "name": "开始游戏",
"x": 171, "x": 171,
"y": 1052, "y": 1052,
"type": "button", "type": "button",
"props": { "props": {
"tUp": "开始游戏.png" "tUp": "开始游戏.png"
}, },
"id": "startBtn" "id": "startBtn"
}, },
{ {
"name": "规则按钮", "name": "规则按钮",
"x": 621, "x": 621,
"y": 212, "y": 212,
"type": "button", "type": "button",
"props": { "props": {
"tUp": "规则按钮.png" "tUp": "规则按钮.png"
}, },
"id": "ruleBtn" "id": "ruleBtn"
}, },
{ {
"name": "奖品按钮", "name": "奖品按钮",
"x": 11, "x": 11,
"y": 212, "y": 212,
"type": "button", "type": "button",
"props": { "props": {
"tUp": "奖品按钮.png" "tUp": "奖品按钮.png"
}, },
"id": "recordBtn" "id": "recordBtn"
} }
] ]
} },
] {
"name": "share",
"x": 126,
"y": 508,
"type": "container",
"children": [
{
"name": "share_bg",
"x": 0,
"y": 0,
"type": "sprite",
"props": {
"source": "share_bg.png"
}
},
{
"name": "share_go",
"x": 139,
"y": 458,
"type": "sprite",
"props": {
"source": "share_go.png"
}
},
{
"name": "share_tips",
"x": 122,
"y": 299,
"type": "text",
"props": {
"text": "获得一次拆盲盒机会",
"size": 28,
"fillColor": "#000000",
"textAlpha": 1
}
},
{
"name": "share_close",
"x": 216,
"y": 635,
"type": "sprite",
"props": {
"source": "share_close.png"
}
}
]
}
]
} }
\ No newline at end of file
let getObject;
getObject = (object:FYGE.Container, name:string)=>{
const result = object.getChildByName(name);
if(result) return result;
for (const child of object.children) {
const result = getObject(child,name);
if(result) return result;
}
return null;
}
export const getObjects=(object:FYGE.Container,names:string[])=>{
return names.map(name=>getObject(object,name))
}
export default getObject
\ No newline at end of file
import { RES } from "../../module/RES";
import { Panel } from "../../module/views/Panel";
import getObject from "../common/getObject";
import { Tools } from "../Tools";
import { getWebData, sendWebNet } from "../WebNet";
import { WebNetName } from "../WebNetName";
let section;
export class SharePanel extends Panel {
share_share_go(){
console.log('share_share_go');
}
get groupNames() { return ["share"] }
get skinName() { return "share" }
initUi() {
super.initUi();
var skin = RES.getSkinDataByName(this.skinName);
this.position.set(skin.x, skin.y);
}
initEvents() {
super.initEvents();
getObject(this, 'share_go').addEventListener(FYGE.MouseEvent.CLICK, this.share_share_go, this);
}
removeEvents() {
super.removeEvents();
getObject(this, 'share_go').removeEventListener(FYGE.MouseEvent.CLICK, this.share_share_go, this);
}
protected get closeBtns(): any[] {
return [getObject(this,'share_close')]
}
}
import { Panel } from "../../module/views/Panel";
import { Tools } from "../Tools";
import { getWebData, sendWebNet } from "../WebNet";
import { WebNetName } from "../WebNetName";
let section;
export class RulePanel extends Panel {
get groupNames() { return ["RulePanel"] }
get skinName() { return "RulePanel" }
ruleTxt: FYGE.TextField;
knowBtn: FYGE.Button;
closeBtn: FYGE.Button;
//两个按钮都是关闭作用
get closeBtns() {
return [this.closeBtn, this.knowBtn];
}
async start(data) {
super.start();
//取接口数据
const res = await sendWebNet(WebNetName.projectRule)
if (!res.success) return
var ruleStr = res.data;
//原先视图上有一个
this.removeChild(this.ruleTxt);
this.addChild(this.closeBtn);
console.log(this.closeBtn)
//文案
// var scroll = this.addChild(new FYGE.ScrollPage(610, 816, 100, true, false))
// scroll.position.copy(this.ruleTxt.position)
// //加文案
// var txt = scroll.view.addChild(Tools.getText(
// ruleStr,
// 30,//this.ruleTxt.size,
// this.ruleTxt.fillColor,
// FYGE.TEXT_ALIGN.LEFT,
// 610
// ))
// //多行设置
// txt.lineType = FYGE.TEXT_lINETYPE.MULTI;
// //行间距设置
// txt.lineSpacing = 20;
// //滚动最大长度按文本高度
// scroll.maxDistance = txt.textHeight
if (!section) {//避免文案过长,用这种方式
document.getElementById("cusEngine").style.position = "absolute"
section = document.createElement('section');
section.id = "rule";
section.style.overflowX = "hidden";
section.style.overflowY = "auto";
section.style.width = 610 + "px";
section.style.height = 816 + "px";
section.style.lineHeight = 48 + "px";
section.style.fontSize = this.ruleTxt.size + 'px';
section.style.color = this.ruleTxt.fillColor;
section.style.whiteSpace = "pre-line";
section.innerHTML = ruleStr;
}
var rule = this.addChild(new FYGE.FloatDisplay());
rule.position.set(this.ruleTxt.x, this.ruleTxt.y)
rule.init(section);
}
}
const ruleTemplate = `啊企鹅去欧文u去外婆偶尔u欺骗我如情人坡i去哦日期【人贫穷人品【去哦微软【哦前往平壤【 去哦【让我气泡【让我去【王培荣亲王【人跑去欧文人【强我弱【\n 去哦人权为荣哦破千万人脾气【微软哦亲哦人气泡【 人游戏规则游戏规则游戏规则游戏规则游戏规则
游戏规则游戏规则游戏规则游戏规则游戏规则
游戏规则游戏规则游戏规则游戏规则游戏规则
游戏规则游戏规则游戏规则游戏规则游戏规则
游戏规则游戏规则游戏规则游戏规则游戏规则
游戏规则游戏规则游戏规则游戏规则游戏规则
游戏规则游戏规则游戏规则游戏规则游戏规则
游戏规则游戏规则游戏规则游戏规则游戏规则
游戏规则游戏规则游戏规则游戏规则游戏规则
游戏规则游戏规则游戏规则游戏规则游戏规则
游戏规则游戏规则游戏规则游戏规则游戏规则
游戏规则游戏规则游戏规则游戏规则游戏规则
游戏规则游戏规则游戏规则游戏规则游戏规则`
...@@ -8,6 +8,7 @@ import { G_EVENT } from "../common/G_EVENT"; ...@@ -8,6 +8,7 @@ import { G_EVENT } from "../common/G_EVENT";
import { PlayScene } from "./PlayScene"; import { PlayScene } from "./PlayScene";
import { sendWebNet } from "../WebNet"; import { sendWebNet } from "../WebNet";
import { WebNetName } from "../WebNetName"; import { WebNetName } from "../WebNetName";
import { SharePanel } from "../panels/share";
export class StartScene extends Scene { export class StartScene extends Scene {
get groupNames() { return ["StartScene"] } get groupNames() { return ["StartScene"] }
get skinName() { return "StartScene" } get skinName() { return "StartScene" }
...@@ -43,6 +44,8 @@ export class StartScene extends Scene { ...@@ -43,6 +44,8 @@ export class StartScene extends Scene {
super.start() super.start()
//次数文案修改 //次数文案修改
this.timesTxt.text = "剩余次数:" + this.data.gameCounts + "次"; this.timesTxt.text = "剩余次数:" + this.data.gameCounts + "次";
showPanel(SharePanel);
} }
initEvents() { initEvents() {
super.initEvents(); super.initEvents();
......
import { RES } from "../../module/RES";
import { Panel } from "../../module/views/Panel";
import getObject from "../common/getObject";
let section;
export class DemoPanel extends Panel {
share_share_go(){
console.log('share_share_go');
}
get groupNames() { return ["demo"] }
get skinName() { return "demo" }
initUi() {
super.initUi();
var skin = RES.getSkinDataByName(this.skinName);
this.position.set(skin.x, skin.y);
}
initEvents() {
super.initEvents();
getObject(this, 'share_fail_btn').addEventListener(FYGE.MouseEvent.CLICK, this.share_share_go, this);
}
removeEvents() {
super.removeEvents();
getObject(this, 'share_fail_btn').removeEventListener(FYGE.MouseEvent.CLICK, this.share_share_go, this);
}
protected get closeBtns(): any[] {
return [getObject(this,'share_close')]
}
}
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