Commit 35cb9b69 authored by 邱旭's avatar 邱旭

template

parent 9b91545e
......@@ -94,7 +94,7 @@
var canvas = document.getElementById("canvas");
canvas.width = document.body.clientWidth * (window.devicePixelRatio || 1)
canvas.height = document.body.clientHeight * (window.devicePixelRatio || 1)
var main = new output.Main(canvas);
var main = new output.Game(canvas);
var mouseEvent = main.stage.onMouseEvent.bind(main.stage);
canvas.addEventListener("touchstart", mouseEvent, false);
canvas.addEventListener('touchmove', mouseEvent, false);
......
import { GDispatcher } from "../src/Main";
import { GDispatcher } from "../src";
interface ResData {
......@@ -120,7 +120,6 @@ export namespace RES {
* }
* ];
* }
* @param path
*/
export function loadConfig(res) {
resData = res;
......
......@@ -15,7 +15,7 @@ class Layers extends FYGE.Container {
private _shareLayer: FYGE.Container;
init(stage: FYGE.Stage) {
stage.addChild(this);
var arr = [
const arr = [
"_bottomLayer",
"_sceneLayer",
"_popupLayer",
......@@ -23,7 +23,7 @@ class Layers extends FYGE.Container {
"_topLayer",
"_shareLayer"
];
for (var i = 0; i < arr.length; i++) {
for (let i = 0; i < arr.length; i++) {
this[arr[i]] = new FYGE.Container();
//有些时候,定宽的时候,部分layer置顶,部分居中,再处理
//为了都置顶和置左,stage的方式永远居中视窗,要么改stage永远左上为00
......@@ -35,17 +35,19 @@ class Layers extends FYGE.Container {
//都以顶部适配
// this.sceneLayer.y = this.stageOffsetY;
// this.popupLayer.y = this.stageOffsetY;
//都以底部适配
// this.sceneLayer.y = -this.stageOffsetY;
// this.popupLayer.y = -this.stageOffsetY;
//这个因为psd弹框不规范
// this.popupLayer.y -= 420 / 2;
this.shareLayer.y = -this.stageOffsetY;
//初始化场景层级
SceneCtrl.instance.init(this.sceneLayer)
SceneCtrl.instance.init(this.sceneLayer);
//初始化弹框层级
PanelCtrl.instance.init(this.popupLayer)
PanelCtrl.instance.init(this.popupLayer);
}
......
......@@ -3,117 +3,5 @@
"y": 0,
"type": "container",
"children": [
{
"name": "LoadingScene",
"x": 0,
"y": 0,
"type": "container",
"children": [
{
"name": "LoadingSceneBg",
"x": 0,
"y": 0,
"type": "sprite",
"props": {
"source": "LoadingSceneBg.png"
}
},
{
"name": "LoadingSceneProBg",
"x": 193,
"y": 1064,
"type": "sprite",
"props": {
"source": "LoadingSceneProBg.png"
}
},
{
"name": "LoadingScenePro",
"x": 199,
"y": 1072,
"type": "sprite",
"props": {
"source": "LoadingScenePro.png"
}
},
{
"name": "LoadingSceneBean",
"x": 273,
"y": 572,
"type": "sprite",
"props": {
"source": "LoadingSceneBean.png"
}
},
{
"name": "LoadingSceneText",
"x": 218,
"y": 477,
"type": "text",
"props": {
"text": "最高可得1000小豆奖励",
"size": 30.000002081447345,
"fillColor": "#ffffff",
"textAlpha": 1
}
},
{
"name": "LoadingSceneTitle",
"x": 55,
"y": 265,
"type": "sprite",
"props": {
"source": "LoadingSceneTitle.png"
}
}
]
},
{
"name": "RulePanel",
"x": 0,
"y": 0,
"type": "container",
"children": [
{
"name": "RulePanelBg",
"x": 51,
"y": 330,
"type": "sprite",
"props": {
"source": "RulePanelBg.png"
}
},
{
"name": "RulePanelBtn",
"x": 235,
"y": 929,
"type": "sprite",
"props": {
"source": "RulePanelBtn.png"
}
},
{
"name": "RulePanelText",
"x": 138,
"y": 592,
"type": "text",
"props": {
"text": "1.本次活动的规则是\n2.本次活动的规则是这样的,那样的,开心就好\r3.本次活动的规则是这样的,那样的,开心就好。本次活动的规则是这样的,那样的,开心就好",
"size": 24.00000598698421,
"fillColor": "#b06852",
"textAlpha": 1
}
},
{
"name": "RulePanelTitle",
"x": 260,
"y": 498,
"type": "sprite",
"props": {
"source": "RulePanelTitle.png"
}
}
]
}
]
}
......@@ -4,6 +4,7 @@
* Copyright © 2021 haiyoucuv. All rights reserved.
*/
import address from "address";
import chalk from 'chalk';
import * as fs from "fs";
import * as path from "path";
......@@ -30,7 +31,7 @@ const { version } = JSON.parse(fs.readFileSync("./package.json", "utf-8"));
watchResChange();
const options = {
input: "src/Main.ts",
input: "src/index.ts",
cache: true,
output: [
{
......@@ -72,12 +73,30 @@ const options = {
headers: {
'Access-Control-Allow-Origin': '*',
},
verbose: false,
}),
livereload({
verbose: false,
}),
livereload(),
],
};
rollup.watch(options);
const watcher = rollup.watch(options);
watcher.on("event", (event) => {
switch (event.code) {
case "START":
console.clear();
break;
case "END":
console.log(`http://localhost:${port} -> ${path.resolve(".")}`);
console.log(`http://${address.ip()}:${port} -> ${path.resolve(".")}`);
console.log(chalk.green("LiveReload enabled"));
break;
}
});
/**
* 资源变化自动刷新
......
......@@ -17,7 +17,7 @@ import BannerVariable from "./config/plugins/BannerVariable/index.mjs";
const { version } = JSON.parse(fs.readFileSync("./package.json", "utf-8"));
export default {
input: "src/Main.ts",
input: "src/index.ts",
output: [
{
file: "released/output.js",
......
......@@ -7,9 +7,9 @@ import MusicBtn from "./scenes/Jump3D/MusicBtn";
import { ResJson } from "./ResJson";
import { SkinJson } from "./SkinJson";
import { destroyTbNetData } from "./TaoBaoNet";
import { Tools } from "./Tools";
import { destroyWebNetData } from "./WebNet";
import { destroyTbNetData } from "./tools/TaoBaoNet";
import { Tools } from "./tools/Tools";
import { destroyWebNetData } from "./tools/WebNet";
import Tween = FYGE.Tween;
import EventDispatcher = FYGE.EventDispatcher;
import Stage = FYGE.Stage;
......@@ -25,7 +25,7 @@ import Texture = FYGE.Texture;
*/
export const GDispatcher = new EventDispatcher();
export class Main {
export class Game {
//主舞台
stage: Stage;
private requestID;
......
......@@ -2,5 +2,6 @@ export const SkinJson = {
"x": 0,
"y": 0,
"type": "container",
"children": []
"children": [
]
}
import UI from "../UI";
import UI from "../tools/UI";
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
import Container = FYGE.Container;
......
/*
* usePool.ts
* Created by 还有醋v on 2022/6/1.
* Copyright © 2022 haiyoucuv. All rights reserved.
*/
/**
* 使用对象池能力
* @param cls
*/
export function usePool<T extends {new (...args: any[]): any}>(cls: T) {
return class nCls extends cls {
static _pool: T[] = [];
static get(): T {
return this._pool.splice(0, 1)[0] || new nCls();
}
static put(obj: T) {
return this._pool.push(obj);
}
};
}
/*
* index.ts
* Created by 还有醋v on 2022/6/2.
* Copyright © 2022 haiyoucuv. All rights reserved.
*/
import EventDispatcher = FYGE.EventDispatcher;
export * from "./Game";
export const GDispatcher = new EventDispatcher();
import { Panel } from "../../module/views/Panel";
import { RES } from "../../module/RES";
import { Tools } from "../Tools";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { Tools } from "../tools/Tools";
import { sendTbNet, TbNetName } from "../tools/TaoBaoNet";
import { showToast } from "../../module/ctrls";
import UI from "../UI";
import UI from "../tools/UI";
import Button = FYGE.Button;
import MouseEvent = FYGE.MouseEvent;
......
import { changeScene } from "../../module/ctrls";
import { Panel } from "../../module/views/Panel";
import { IndexScene } from "../scenes/IndexScene";
import { goTask } from "../Tools";
import { goTask } from "../tools/Tools";
import { RES } from "../../module/RES";
import UI from "../UI";
import UI from "../tools/UI";
import Button = FYGE.Button;
import MouseEvent = FYGE.MouseEvent;
......
......@@ -2,9 +2,9 @@ import { changeScene, showPanel } from "../../module/ctrls";
import { Panel } from "../../module/views/Panel";
import { IndexScene } from "../scenes/IndexScene";
import { LoadingScene } from "../scenes/LoadingScene";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { sendTbNet, TbNetName } from "../tools/TaoBaoNet";
import { RES } from "../../module/RES";
import UI from "../UI";
import UI from "../tools/UI";
import { NoTimePanel } from "./NoTimePanel";
import Button = FYGE.Button;
import MouseEvent = FYGE.MouseEvent;
......
......@@ -2,9 +2,9 @@ import { changeScene, showPanel, showToast } from "../../module/ctrls";
import { Panel } from "../../module/views/Panel";
import { IndexScene } from "../scenes/IndexScene";
import { LoadingScene } from "../scenes/LoadingScene";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { sendTbNet, TbNetName } from "../tools/TaoBaoNet";
import { RES } from "../../module/RES";
import UI from "../UI";
import UI from "../tools/UI";
import { NoTimePanel } from "./NoTimePanel";
import Button = FYGE.Button;
import MouseEvent = FYGE.MouseEvent;
......
import { Panel } from "../../module/views/Panel";
import { RES } from "../../module/RES";
import UI from "../UI";
import UI from "../tools/UI";
import Button = FYGE.Button;
import MouseEvent = FYGE.MouseEvent;
......
import { RES } from "../../module/RES";
import { Item } from "../../module/views/Item";
import { Panel } from "../../module/views/Panel";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { Tools } from "../Tools";
import UI from "../UI";
import { sendTbNet, TbNetName } from "../tools/TaoBaoNet";
import { Tools } from "../tools/Tools";
import UI from "../tools/UI";
import Button = FYGE.Button;
import MouseEvent = FYGE.MouseEvent;
import ScrollList = FYGE.ScrollList;
......
import { showToast } from "../../module/ctrls";
import { Panel } from "../../module/views/Panel";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { sendTbNet, TbNetName } from "../tools/TaoBaoNet";
import { RES } from "../../module/RES";
import UI from "../UI";
import UI from "../tools/UI";
import Button = FYGE.Button;
import MouseEvent = FYGE.MouseEvent;
import Sprite = FYGE.Sprite;
......
import { showToast } from "../../module/ctrls";
import { Panel } from "../../module/views/Panel";
import { GDispatcher } from "../Main";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { Tools } from "../Tools";
import { GDispatcher } from "../index";
import { sendTbNet, TbNetName } from "../tools/TaoBaoNet";
import { Tools } from "../tools/Tools";
import { RES } from "../../module/RES";
import Button = FYGE.Button;
import MouseEvent = FYGE.MouseEvent;
......
import { Panel } from "../../module/views/Panel";
import { Tools } from "../Tools";
import { Tools } from "../tools/Tools";
import { RES } from "../../module/RES";
import UI from "../UI";
import UI from "../tools/UI";
import TextField = FYGE.TextField;
import TEXT_lINETYPE = FYGE.TEXT_lINETYPE;
import ScrollPage = FYGE.ScrollPage;
......
import { changeScene, showPanel, showToast } from "../../module/ctrls";
import { RES } from "../../module/RES";
import { Scene } from "../../module/views/Scene";
import { GDispatcher } from "../Main";
import { GDispatcher } from "../Game";
import { HelpPanel } from "../panels/HelpPanel";
import { NoTimePanel } from "../panels/NoTimePanel";
import { RankNoPrizePanel } from "../panels/RankNoPrizePanel";
import { RankPanel } from "../panels/RankPanel";
import { RankPrizePanel } from "../panels/RankPrizePanel";
import { RulePanel } from "../panels/RulePanel";
import { sendTbNet, TbNetName } from "../TaoBaoNet";
import { goMyPrize, goTask, Tools } from "../Tools";
import UI from "../UI";
import { sendTbNet, TbNetName } from "../tools/TaoBaoNet";
import { goMyPrize, goTask, Tools } from "../tools/Tools";
import UI from "../tools/UI";
import { LoadingScene } from "./LoadingScene";
import Button = FYGE.Button;
import Container = FYGE.Container;
......
......@@ -8,7 +8,7 @@ import Button = FYGE.Button;
import Container = FYGE.Container;
import Texture = FYGE.Texture;
import MouseEvent = FYGE.MouseEvent;
import { sendTbNet, TbNetName } from "../../TaoBaoNet";
import { sendTbNet, TbNetName } from "../../tools/TaoBaoNet";
export default class MusicBtn extends Container {
......
......@@ -5,9 +5,9 @@ import { Scene } from "../../../module/views/Scene";
import { OverNoPrizePanel } from "../../panels/OverNoPrizePanel";
import { OverPrizePanel } from "../../panels/OverPrizePanel";
import { RevivePanel } from "../../panels/RevivePanel";
import { sendTbNet, TbNetName } from "../../TaoBaoNet";
import { sleep, Tools } from "../../Tools";
import UI from "../../UI";
import { sendTbNet, TbNetName } from "../../tools/TaoBaoNet";
import { sleep, Tools } from "../../tools/Tools";
import UI from "../../tools/UI";
import { IndexScene } from "../IndexScene";
import { Jump3d } from "./Jump3d";
import MusicBtn from "./MusicBtn";
......
......@@ -2,7 +2,7 @@ import { RES } from "../../module/RES";
import { Scene } from "../../module/views/Scene";
import { LoadingEffect } from "../lotties/LoadingEffect";
import { changeScene } from "../../module/ctrls";
import UI from "../UI";
import UI from "../tools/UI";
import { getBoxConfig, M_loadGLB, typeArr } from "./Jump3D/MT";
import { PlayScene } from "./Jump3D/PlayScene";
import Lottie = FYGE.Lottie;
......
import { showToast } from "../module/ctrls";
import { GDispatcher } from "./Main";
import { showToast } from "../../module/ctrls";
import { GDispatcher } from "../index";
//接口枚举,包括需要调用淘宝的api,用是否含有兑吧区分,或者单独区分
export enum TbNetName {
......
import { RES } from "../module/RES";
import { layers } from "../module/views/layers";
import { RES } from "../../module/RES";
import { layers } from "../../module/views/layers";
import { sendTbNet, TbNetName } from "./TaoBaoNet";
import Container = FYGE.Container;
import TEXT_ALIGN = FYGE.TEXT_ALIGN;
......
......@@ -3,7 +3,7 @@
* Created by 还有醋v on 2021/5/12.
* Copyright © 2021 haiyoucuv. All rights reserved.
*/
import { RES } from "../module/RES";
import { RES } from "../../module/RES";
import Container = FYGE.Container;
import Button = FYGE.Button;
import MouseEvent = FYGE.MouseEvent;
......
import { showToast } from "../module/ctrls";
import { ajax, jsonp } from "../module/ajax";
import { GDispatcher } from "./Main";
import { getUrlParams } from "../module/tools/WebTool";
import { showToast } from "../../module/ctrls";
import { ajax, jsonp } from "../../module/ajax";
import { GDispatcher } from "../index";
import { getUrlParams } from "../../module/tools/WebTool";
//////////////星速台接口方法集成
/**
......
......@@ -167,7 +167,7 @@ acorn@^8.5.0, acorn@^8.7.0:
resolved "http://npm.dui88.com:80/acorn/-/acorn-8.7.1.tgz#0197122c843d1bf6d0a5e83220a788f278f63c30"
integrity sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==
address@>=0.0.1, address@^1.0.0:
address@>=0.0.1, address@^1.0.0, address@^1.2.0:
version "1.2.0"
resolved "http://npm.dui88.com:80/address/-/address-1.2.0.tgz#d352a62c92fee90f89a693eccd2a8b2139ab02d9"
integrity sha512-tNEZYz5G/zYunxFm7sfhAxkXEuLj3K6BKwv6ZURlsF6yiUQ65z0Q2wZW9L5cPUl9ocofGvXOdFYbFHp0+6MOig==
......
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