(function () { 'use strict'; class ImageRunTime extends Laya.Image { constructor() { super(); this.scaleTime = 80; this.clickId = false; this.on(Laya.Event.MOUSE_DOWN, this, this.scaleSmall); this.on(Laya.Event.MOUSE_OVER, this, this.overs); this.on(Laya.Event.MOUSE_UP, this, this.scaleBig); this.on(Laya.Event.MOUSE_OUT, this, this.mouseout); } scaleBig(e) { if (!this.clickId) return; this.clickId = false; this.alpha = 1; if (this.CZ) { this.CZ(); } } overs() { this.alpha = 0.7; } mouseout() { this.alpha = 1; } scaleSmall(e) { this.clickId = true; } onDestroy() { this.ClearRunTime(); } ClearRunTime() { this.off(Laya.Event.MOUSE_DOWN, this, this.scaleSmall); this.off(Laya.Event.MOUSE_UP, this, this.scaleBig); this.off(Laya.Event.MOUSE_OUT, this, this.mouseout); this.off(Laya.Event.MOUSE_OVER, this, this.overs); this.CZ = null; } } class GameTool { static getM_Vector(v1, v2) { let temp = new Laya.Vector3(); Laya.Vector3.add(v1, v2, temp); return new Laya.Vector3(temp.x * 0.5, temp.y * 0.5, temp.z * 0.5); } static SpliteString(s, sp) { var _sp = sp ? sp : ";"; let s_s = s.split(_sp); let result = []; for (let i = 0; i < s_s.length; i++) { result.push(s_s[i]); } return result; } static random_1to1() { var iszheng = Math.random() > 0.5 ? -1 : 1; return Math.random() * iszheng; } static get64Encode(str) { var c1, c2, c3; var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var i = 0, len = str.length, string = ''; while (i < len) { c1 = str.charCodeAt(i++) & 0xff; if (i == len) { string += base64EncodeChars.charAt(c1 >> 2); string += base64EncodeChars.charAt((c1 & 0x3) << 4); string += "=="; break; } c2 = str.charCodeAt(i++); if (i == len) { string += base64EncodeChars.charAt(c1 >> 2); string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4)); string += base64EncodeChars.charAt((c2 & 0xF) << 2); string += "="; break; } c3 = str.charCodeAt(i++); string += base64EncodeChars.charAt(c1 >> 2); string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4)); string += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6)); string += base64EncodeChars.charAt(c3 & 0x3F); } return string; } static randomInt(min, max) { if (max < min) return parseInt(min); return parseInt(Math.random() * (max - min + 1) + min); } static randRangefloat(min, max) { var value = Math.random() * (max - min + 1) + min; if (value > max) { value = max; } return value; } } class Dictionary { constructor() { this._container = {}; this._length = 0; } get container() { return this._container; } get size() { return this._length; } set(key, value) { if (!this._container.hasOwnProperty(key)) { this._length++; } this._container[key] = value; } delete(key) { if (this._container.hasOwnProperty(key)) { delete this._container[key]; this._length--; } } has(key) { return this._container.hasOwnProperty(key) ? true : false; } get(key) { if (this._container.hasOwnProperty(key)) { return this._container[key]; } else { return undefined; } } clear() { this._container = {}; this._length = 0; } } class DispatcherManager { static get Disispatcher() { return DispatcherManager.disispatcher || (DispatcherManager.disispatcher = new Laya.EventDispatcher()); } static on(type, call, data) { this.Disispatcher.on(type, call, data); } static off(type, call, data) { this.Disispatcher.off(type, call, data); } static event(type, data = null) { this.Disispatcher.event(type, data); } } class EventType { loadUI() { Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () { var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "正常模式")); changeActionButton.size(160, 40); changeActionButton.labelBold = true; changeActionButton.labelSize = 30; changeActionButton.sizeGrid = "4,4,4,4"; changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio); changeActionButton.pos(Laya.stage.width / 2 - changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio); changeActionButton.on(Laya.Event.CLICK, this, function () { if (++this.curStateIndex % 2 == 1) { this.sprite3D.active = false; this.lineSprite3D.active = true; changeActionButton.label = "网格模式"; } else { this.sprite3D.active = true; this.lineSprite3D.active = false; changeActionButton.label = "正常模式"; } }); })); } } EventType.Event = { CamFollowArg: "CamFollowArg", SetAimPos: "SetAimPos", RefreshBulletCount: "RefreshBulletCount", RefreshRemainEnemyCount: "RefreshRemainEnemyCount", GameShowTips: "GameShowTips", StartShot: 'StartShot', StopShot: 'StopShot', ShowMainUi: "ShowMainUi", SetMonery: "SetMonery", SetStage: "SetStage", SetStagePro: "SetStagePro" }; class GameVersion { } GameVersion.VER = "1.0.11"; GameVersion.CFG = "CFG"; GameVersion.wxValue = ""; GameVersion.isX = false; GameVersion.mSharePeopleScene = null; var Particle2D = Laya.Particle2D; var SoundType; (function (SoundType) { SoundType[SoundType["hit"] = 0] = "hit"; SoundType[SoundType["click"] = 1] = "click"; SoundType[SoundType["win"] = 2] = "win"; SoundType[SoundType["defeat"] = 3] = "defeat"; })(SoundType || (SoundType = {})); class SettingController { constructor() { this.vibrate = true; this.sound = true; this.SoundType = { click: "subpackage1/sound/click.mp3", win: "subpackage1/sound/vector.mp3", defeat: "subpackage1/sound/defeat.mp3", car_crush_1: "subpackage1/sound/car_crush_1.mp3", car_crush_2: "subpackage1/sound/car_crush_2.mp3", car_crush_3: "subpackage1/sound/car_crush_3.mp3", explotion1: "subpackage1/sound/explotion1.mp3", explotion2: "subpackage1/sound/explotion2.mp3", gun_fire_1: "subpackage1/sound/gun_fire_1.mp3", gun_fire_2: "subpackage1/sound/gun_fire_2.mp3", gun_fire_3: "subpackage1/sound/gun_fire_3.mp3", reload_gun_1: "subpackage1/sound/reload_gun_1.mp3", reload_gun_2: "subpackage1/sound/reload_gun_2.mp3", hitcar: "subpackage1/sound/hitcar.mp3", hitrole: "subpackage1/sound/hitrole.mp3", hit: "subpackage1/sound/hit.mp3" }; this.bgm = "subpackage1/sound/bgm.mp3"; } static get Instance() { return this.instasnce || (this.instasnce = new SettingController()); } onAssetsLoaded(settings) { this.sp = new Particle2D(settings); this.sp.emitter.start(); this.sp.play(); Laya.stage.addChild(this.sp); this.sp.x = Laya.stage.width / 2; this.sp.y = Laya.stage.height / 2; } SettingSound(value) { } _playMusic(on) { } SetSoundV(value) { } PlaySound(type) { } StopSound(type) { } Init() { var v = Laya.LocalStorage.getItem("vibrate"); this.vibrate = Number(v) ? v == "1" ? true : false : true; } } class ShareModule { static GoShare(callBack) { ShareModule.ShareTime = new Date().getTime(); console.log("分享点击时间=" + ShareModule.ShareTime); ShareModule.IsSharing = true; ShareModule.callback = callBack; } static OnShowHandle() { if (Laya.Browser.window.wx) { Laya.Browser.window.wx.onShow(function (option) { SettingController.Instance.SetSoundV(1); console.log("onshow share start"); console.log("进入微信"); if (ShareModule.IsSharing) { ShareModule.IsSharing = false; let time = new Date().getTime(); console.log("分享回到游戏时间" + time); let wait = (time - ShareModule.ShareTime) / 1000; console.log("分享停留时间为:" + wait); if (wait >= 2) { if (Math.random() <= 1) { if (!ShareModule.callback) return; ShareModule.callback(true, 1); } else { if (!ShareModule.callback) return; if (Math.random() <= 0.5) { ViewManager.Instance.ShowTips("分享失败!"); } else { ViewManager.Instance.ShowTips("请分享到不同的群!"); } ShareModule.callback(false, 1); } } else { if (!ShareModule.callback) return; if (Math.random() <= 0.5) { ViewManager.Instance.ShowTips("分享失败!"); } else { ViewManager.Instance.ShowTips("请分享到不同的群!"); } ShareModule.callback(false, 1); } } }); } } } ShareModule.IsSharing = false; class OnHideHandler { static Reg() { } } var Templet = Laya.Templet; var Event = Laya.Event; class NetInfoManager { constructor() { this.mStartX = 200; this.mStartY = 500; this.mActionIndex = 0; this.mCurrIndex = 0; this.mCurrSkinIndex = 0; } static get Instance() { return this.instance || (this.instance = new NetInfoManager()); } GetThing(id) { if (this._thing) { return this._thing[id - 1]; } return null; } GetTheme(id) { if (this._theme) { return this._theme[id - 1]; } return null; } GetRoad(id) { if (this._road) { return this._road[id - 1]; } return null; } GetRate(id) { if (this._rate) { return this._rate[id - 1]; } return null; } GetStreet(id) { if (this._block) { return this._block[id - 1]; } return null; } GetGlobal(key) { if (this._globe) { for (let index = 0; index < this._globe.length; index++) { const element = this._globe[index]; if (element.key == key) { return element.value; } } } } GetLevel(id) { if (this._level) { return this._level[id - 1]; } return null; } GetAtk(id) { if (this._atk) { return this._atk[id - 1]; } return null; } startFun() { this.mAniPath = "res/spine/spineRes5/vine.sk"; this.mFactory = new Templet(); this.mFactory.on(Event.COMPLETE, this, this.parseComplete); this.mFactory.on(Event.ERROR, this, this.onError); this.mFactory.loadAni(this.mAniPath); } onError() { console.log("error"); } parseComplete() { this.mArmature = this.mFactory.buildArmature(1); this.mArmature.x = this.mStartX; this.mArmature.y = this.mStartY; this.mArmature.scale(0.5, 0.5); Laya.stage.addChild(this.mArmature); this.mArmature.on(Event.STOPPED, this, this.completeHandler); this.play(); } completeHandler() { this.play(); } play() { this.mCurrIndex++; if (this.mCurrIndex >= this.mArmature.getAnimNum()) { this.mCurrIndex = 0; } this.mArmature.play(this.mCurrIndex, false); } } class AssetPath { loadUI() { Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () { var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "切换注视目标")); changeActionButton.size(200, 40); changeActionButton.labelBold = true; changeActionButton.labelSize = 30; changeActionButton.sizeGrid = "4,4,4,4"; changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio); changeActionButton.pos(Laya.stage.width / 2 - changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio); changeActionButton.on(Laya.Event.CLICK, this, function () { this.index++; if (this.index % 3 === 1) { this.camera.transform.lookAt(this.box.transform.position, this.upVector); } else if (this.index % 3 === 2) { this.camera.transform.lookAt(this.cylinder.transform.position, this.upVector); } else { this.camera.transform.lookAt(this.capsule.transform.position, this.upVector); } }); })); } } AssetPath.MainScene = "subpackage/LayaScene_MainScene/Conventional/main.ls"; AssetPath.Player = ["subpackage/LayaScene_Character/Conventional/Character1.lh", "subpackage/LayaScene_Character/Conventional/Character2.lh", "subpackage/LayaScene_Character/Conventional/Character3.lh", "subpackage/LayaScene_Character/Conventional/Character4.lh", "subpackage/LayaScene_Character/Conventional/Character5.lh", "subpackage/LayaScene_Character/Conventional/Character6.lh", "subpackage/LayaScene_Character/Conventional/Character7.lh", "subpackage/LayaScene_Character/Conventional/Character8.lh", ]; AssetPath.Enemy = "subpackage/LayaScene_Character/Conventional/enemy.lh"; AssetPath.PlayerShot = "subpackage/LayaScene_Property/Conventional/PlayerShoot.lh"; AssetPath.Mound = "subpackage/LayaScene_Property/Conventional/Mound.lh"; AssetPath.Barrier = [ "subpackage/LayaScene_barrier/Conventional/barrier_1.lh", "subpackage/LayaScene_barrier/Conventional/barrier_2.lh", "subpackage/LayaScene_barrier/Conventional/barrier_3.lh", "subpackage/LayaScene_barrier/Conventional/barrier_4.lh", "subpackage/LayaScene_barrier/Conventional/move_barrier.lh", "subpackage/LayaScene_barrier/Conventional/stone_1.lh", "subpackage/LayaScene_barrier/Conventional/stone_2.lh", "subpackage/LayaScene_barrier/Conventional/stone_3.lh", "subpackage/LayaScene_barrier/Conventional/stone_4.lh", "subpackage/LayaScene_barrier/Conventional/Block1.lh", ]; AssetPath.Particle = [ "subpackage/LayaScene_Particle/Conventional/Explode.lh", "subpackage/LayaScene_Particle/Conventional/Hit.lh", "subpackage/LayaScene_Particle/Conventional/Blood.lh", ]; AssetPath.Config = { level: "level", road: "road", block: "block", thing: "thing", atk: "atk", rate: "rate", global: "global", theme: "theme" }; class AppSetting { constructor() { this._outHitResult = new Laya.HitResult(); this.outs = new Array(); this.posX = 0.0; this.posY = 0.0; this.point = new Laya.Vector2(); } addBoxXYZ(x, y, z) { var mat1 = new Laya.BlinnPhongMaterial(); Laya.Texture2D.load("res/threeDimen/Physics/rocks.jpg", Laya.Handler.create(null, function (tex) { mat1.albedoTexture = tex; })); var sX = Math.random() * 0.75 + 0.25; var sY = Math.random() * 0.75 + 0.25; var sZ = Math.random() * 0.75 + 0.25; var box = new Laya.MeshSprite3D(Laya.PrimitiveMesh.createBox(sX, sY, sZ)); this.scene.addChild(box); box.meshRenderer.material = mat1; this.tmpVector.setValue(x, y, z); box.transform.position = this.tmpVector; this.tmpVector.setValue(Math.random() * 360, Math.random() * 360, Math.random() * 360); box.transform.rotationEuler = this.tmpVector; var rigidBody = box.addComponent(Laya.Rigidbody3D); var boxShape = new Laya.BoxColliderShape(sX, sY, sZ); rigidBody.colliderShape = boxShape; rigidBody.mass = 10; } } AppSetting.moveTime = 1; var TiledMap = Laya.TiledMap; var Rectangle = Laya.Rectangle; var Browser = Laya.Browser; var Handler = Laya.Handler; class PlayerManager { constructor() { this.stage = 1; this.equipId = 1; this.mLastMouseX = 0; this.mLastMouseY = 0; this.mX = 0; this.mY = 0; } static get Instance() { return PlayerManager.instance || (PlayerManager.instance = new PlayerManager()); } static GlobalMessage() { PlayerManager.tower_reward = Number(NetInfoManager.Instance.GetGlobal("tower_reward")); PlayerManager.block_reward = Number(NetInfoManager.Instance.GetGlobal("block_reward")); PlayerManager.enemy_reward = Number(NetInfoManager.Instance.GetGlobal("enemy_reward")); } InitPlayer() { var usermodel = UserModel.Instance.CurModel; PlayerManager.instance.stage = (Number(usermodel.GetUserAttr(UserAttr.stage)) + 1); PlayerManager.instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]); this.SetInfo(); } SpeedUp(level, chanel, count, callback) { let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "attr": "rate" }, { "level": level }, { "channel": chanel }, { "amount": count }]; NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => { if (callback) callback(true); }, (data) => { if (callback) callback(false); }); } SetInfo() { let power = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)["power"]; if (power) this.powerLevel = Number(power); else this.powerLevel = 1; let al = NetInfoManager.Instance._atk.length; let t = this.powerLevel > al ? al : this.powerLevel; PlayerManager.bulletAttack = NetInfoManager.Instance.GetAtk(t)["atk"]; let rate = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)["rate"]; if (rate) this.rateLevel = Number(rate); else this.rateLevel = 1; let al1 = NetInfoManager.Instance._rate.length; let t1 = this.rateLevel > al1 ? al1 : this.rateLevel; PlayerManager.bulletTime = NetInfoManager.Instance.GetRate(t1)["rate"]; } createMap() { this.tiledMap = new TiledMap(); this.mX = this.mY = 0; this.tiledMap.createMap("res/tiledMap/desert.json", new Rectangle(0, 0, Browser.width, Browser.height), new Handler(this, this.completeHandler)); } completeHandler() { console.log("地图创建完成"); console.log("ClientW:" + Browser.clientWidth + " ClientH:" + Browser.clientHeight); Laya.stage.on(Laya.Event.RESIZE, this, this.resize); this.resize(); } mouseDown() { this.mLastMouseX = Laya.stage.mouseX; this.mLastMouseY = Laya.stage.mouseY; Laya.stage.on(Laya.Event.MOUSE_MOVE, this, this.mouseMove); } mouseMove() { this.tiledMap.moveViewPort(this.mX - (Laya.stage.mouseX - this.mLastMouseX), this.mY - (Laya.stage.mouseY - this.mLastMouseY)); } mouseUp() { this.mX = this.mX - (Laya.stage.mouseX - this.mLastMouseX); this.mY = this.mY - (Laya.stage.mouseY - this.mLastMouseY); Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.mouseMove); } resize() { this.tiledMap.changeViewPort(this.mX, this.mY, Browser.width, Browser.height); } PowerUp(level, chanel, count, callback) { let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "attr": "power" }, { "level": level }, { "channel": chanel }, { "amount": count }]; NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => { if (callback) callback(true); }, (data) => { if (callback) callback(false); }); } } PlayerManager.bulletAttack = 1; PlayerManager.bulletTime = 0.3; class GlobalParam { } GlobalParam.playerRayLengthF = 1.3; GlobalParam.playerRayLengthLR = 0.3; GlobalParam.bulletRayLength = 1; GlobalParam.bulletMaxDis = 40; GlobalParam.barrierRoadLength = 50; GlobalParam.barrierRoadAverageNum = 50; GlobalParam.playerspeed = 0.1; GlobalParam.matespeed = 0.2; GlobalParam.hitmaxcount = 2; GlobalParam.boommaxcount = 2; GlobalParam.blockLRmoveMaxDis = 5; GlobalParam.arriveStandWidth = 5; GlobalParam.enemySpeed = 0.1; GlobalParam.shootspeed = 0.8; GlobalParam.sliderFactor = 0.02; GlobalParam.playerMoveMaxX = 4.5; var Sprite = Laya.Sprite; var Event$1 = Laya.Event; var SoundManager = Laya.SoundManager; var Handler$1 = Laya.Handler; class UserInfoManager { static GameInfo() { PlayerManager.Instance.InitPlayer(); } static SetCfg(cfg) { NetInfoManager.Instance._level = cfg[AssetPath.Config.level]; NetInfoManager.Instance._road = cfg[AssetPath.Config.road]; NetInfoManager.Instance._block = cfg[AssetPath.Config.block]; NetInfoManager.Instance._thing = cfg[AssetPath.Config.thing]; NetInfoManager.Instance._atk = cfg[AssetPath.Config.atk]; NetInfoManager.Instance._rate = cfg[AssetPath.Config.rate]; NetInfoManager.Instance._theme = cfg[AssetPath.Config.theme]; NetInfoManager.Instance._globe = cfg[AssetPath.Config.global]; PlayerManager.GlobalMessage(); } setup() { var gap = 10; var soundButton = this.createButton("播放音效"); soundButton.x = (Laya.stage.width - soundButton.width * 2 + gap) / 2; soundButton.y = (Laya.stage.height - soundButton.height) / 2; Laya.stage.addChild(soundButton); var musicButton = this.createButton("播放音乐"); musicButton.x = soundButton.x + gap + soundButton.width; musicButton.y = soundButton.y; Laya.stage.addChild(musicButton); soundButton.on(Event$1.CLICK, this, this.onPlaySound); musicButton.on(Event$1.CLICK, this, this.onPlayMusic); } createButton(label) { var w = 110; var h = 40; var button = new Sprite(); button.size(w, h); button.graphics.drawRect(0, 0, w, h, "#FF7F50"); button.graphics.fillText(label, w / 2, 8, "25px SimHei", "#FFFFFF", "center"); Laya.stage.addChild(button); return button; } onPlayMusic(e) { console.log("播放音乐"); SoundManager.playMusic("res/sounds/bgm.mp3", 1, new Handler$1(this, this.onComplete)); } onPlaySound(e) { console.log("播放音效"); SoundManager.playSound("res/sounds/btn.mp3", 1, new Handler$1(this, this.onComplete)); } onComplete() { console.log("播放完成"); } static Appseting(data) { AppSetting.shareimage = data["shareimage"]; AppSetting.sharetitle = data["sharetitle"]; AppSetting.bannerCanMove = Number(data["bannerCanMove"]); AppSetting.moveTime = Number(data["moveTime"]); AppSetting.OpenSceneValue = Number(data["OpenSceneValue"]); AppSetting.freeUpdateVideotime = Number(data["freeUpdateVideotime"]); AppSetting.freecoinValue = Number(data["freecoinValue"]); AppSetting.freeGetcoinTime = Number(data["freeGetcoinTime"]); AppSetting.cheat = data["cheat"]; AppSetting.cheattime = data["cheattime"]; AppSetting.checkscene = data["checkscene"]; GlobalParam.playerspeed = Number(data["playerspeed"]); GlobalParam.matespeed = Number(data["friendspeed"]); GlobalParam.shootspeed = Number(data["bulletspeed"]); GlobalParam.sliderFactor = Number(data["sliderFactor"]); GlobalParam.playerMoveMaxX = Number(data["playerMoveMaxX"]); GlobalParam.playerRayLengthF = Number(data["playerRayLengthF"]); GlobalParam.playerRayLengthLR = Number(data["playerRayLengthLR"]); GlobalParam.bulletRayLength = Number(data["bulletRayLength"]); GlobalParam.bulletMaxDis = Number(data["bulletMaxDis"]); GlobalParam.barrierRoadLength = Number(data["barrierRoadLength"]); GlobalParam.barrierRoadAverageNum = Number(data["barrierRoadAverageNum"]); GlobalParam.hitmaxcount = Number(data["hitmaxcount"]); GlobalParam.boommaxcount = Number(data["boommaxcount"]); GlobalParam.blockLRmoveMaxDis = Number(data["blockLRmoveMaxDis"]); GlobalParam.arriveStandWidth = Number(data["arriveStandWidth"]); GlobalParam.enemySpeed = Number(data["enemySpeed"]); } static get Cheat() { return AppSetting.cheat == "1"; } static get CheatTime() { return Number(AppSetting.cheattime); } static get CheckScene() { return AppSetting.checkscene == "1"; } } var Event$2 = Laya.Event; var HttpRequest = Laya.HttpRequest; const PROTOCOL_URL = "https://gungangfengyunapi.xwxgame.com/"; class PROTOCOLS { } PROTOCOLS.protocols = { Login: "user/login", Userauth: "user/auth", BuyLand: "shop/land", UserSync: "user/sync", ShopBuild: "shop/build", ShopUpgrade: "shop/upgrade", ShopSale: "shop/sale", RoleUpgrade: "role/upgrade", Fissionvd: "fission/vd", DailyTaskrefresh: "dailytask/refresh", DailyTaskrewards: "dailytask/rewards", Rankingvmoney: "ranking/vmoney", Lotterylottery: "lottery/lottery", AchievementgetRewards: "achievement/getRewards", Fissiondeduct: "fission/deduct", Sign: "sign/sign", InvitegetRewards: "invite/getRewards", InvitetargetRewards: "invite/targetRewards", GameResult: "game/play", Easter: "game/revival", GetCfg: "config/table", DoubleAward: "fission/vd", KunDiscard: "kun/discard", KunEquip: "kun/equip", KunMove: "kun/move", KunBuy: "kun/buy", Opentreasure: "treasure/open", Entertreasure: "treasure/enter", Buy: "theme/buy", Equip: "theme/equip", themefission: "theme/fission", Start: "game/start", UpgradeAttr: "attr/upgrade" }; class NetManager { PostTokenRequest(protocol, completecb, errorcb, isload = true) { let args = ""; let url = PROTOCOL_URL + protocol; args = args = `token=${UserModel.Instance.CurModel.m_token}`; let httpRequest = new HttpRequest(); httpRequest.once(Event$2.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]); httpRequest.once(Event$2.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]); httpRequest.send(url, args, "post", "text"); if (isload) { WXSdk.ShowLoading(""); } } onHttpRequestComplete(succeedcb, failurecb, httpRequest, isload) { let data; if (isload) { WXSdk.HideLoading(); } data = JSON.parse(httpRequest.data); console.log("请求成功:" + JSON.stringify(data)); if (data["code"] == 0) { UserModel.Instance.RefreshModel(data); if (succeedcb != null) { succeedcb(data); } } else { if (failurecb != null) { var mess = GameTool.SpliteString(data["message"], ",")[0]; failurecb(mess); } } } onHttpRequestError(errorcb, httpRequest, isload) { if (errorcb != null) { var data = JSON.parse(httpRequest.data); errorcb(data); } console.log("Error! Http request error, code: " + data); if (isload) { WXSdk.HideLoading(); } } static get Instance() { return NetManager.instance || (NetManager.instance = new NetManager()); } login(progresscb, completecb, errorcb) { console.log("发送登录请求"); var userInfor = UserModel.Instance; var ver = GameVersion.VER; let args = `code=${userInfor.m_code}&nickname=${userInfor.m_nickname}&avatar=${userInfor.m_avatar}&gender=${userInfor.m_gender}&country=${userInfor.m_country}&province=${userInfor.m_province}&city=${userInfor.m_city}&device=${userInfor.m_device}&share_id=${userInfor.m_share_id}&scene=${userInfor.channel}&v=${ver}`; console.log("登录 参数: " + args); let httpRequest = new HttpRequest(); httpRequest.once(Event$2.PROGRESS, this, this.onHttpRequestProgress, [progresscb, httpRequest]); httpRequest.once(Event$2.COMPLETE, this, this.onLoginRequestComplete, [completecb, httpRequest]); httpRequest.once(Event$2.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]); httpRequest.send(PROTOCOL_URL + PROTOCOLS.protocols.Login, args, "post", "text"); } onHttpRequestProgress() { } onLoginRequestComplete(completecb, httpRequest) { let data = JSON.parse(httpRequest.data); console.log(data); console.log("登录完成"); if (data["code"] != "0") { var errInfo = JSON.stringify(httpRequest.data); console.log("登录异常错误!错误信息:", errInfo); completecb(data); return; } UserModel.Instance.SetUserModel(new NetUserModel(data["token"], data["configs"], data["app_setting"], data["user"], data["user_base"], data["user_invite"], data["user_lottery"], data["user_treasure"], data["t"], data["user_achievement"], data["user_sign"], data["user_arena"], data["is_new"], data["user_shop"], data["user_daily_task"], data["user_video"])); UserInfoManager.Appseting(data["app_setting"]); var ver = data["table_version"]; UserModel.Instance.CurModel.JundgCfg(ver, (c) => { if (c) { UserInfoManager.GameInfo(); completecb(data); } }); WXSdk.ShareMessage(); } PostCfgRequest(completecb, errorcb) { let args = ""; let url = PROTOCOL_URL + PROTOCOLS.protocols.GetCfg; args = `token=${UserModel.Instance.CurModel.m_token}`; let httpRequest = new HttpRequest(); httpRequest.once(Event$2.COMPLETE, this, () => { var data = JSON.parse(httpRequest.data); if (data["code"] == 0) { if (completecb != null) { if (data["configs"]) { completecb(data["configs"]); } } } else { if (errorcb != null) { errorcb(data); } } }); httpRequest.once(Event$2.ERROR, this, () => { var data = JSON.parse(httpRequest.data); if (errorcb != null) { errorcb(data); } }); httpRequest.send(url, args, "post", "text"); } HttpPostRequest(protocol, param, completecb, errorcb, hasToken = true, isload = true) { let args = ""; let url = PROTOCOL_URL + protocol; if (hasToken == true) { args = `token=${UserModel.Instance.CurModel.m_token}&`; } if (protocol == PROTOCOLS.protocols.UserSync || protocol == PROTOCOLS.protocols.Fissionvd || protocol == PROTOCOLS.protocols.Lotterylottery || protocol == PROTOCOLS.protocols.Fissiondeduct || protocol == PROTOCOLS.protocols.KunBuy || protocol == PROTOCOLS.protocols.KunDiscard || protocol == PROTOCOLS.protocols.KunEquip || protocol == PROTOCOLS.protocols.KunMove || protocol == PROTOCOLS.protocols.Start || protocol == PROTOCOLS.protocols.GameResult || protocol == PROTOCOLS.protocols.themefission || protocol == PROTOCOLS.protocols.Opentreasure || protocol == PROTOCOLS.protocols.UpgradeAttr) { let str = "abcdefghijkimnopqrstuvwxyz0123456789"; let code = "{"; let mask = ""; for (let i = 0; i < 4; i++) { mask += str[Math.floor(Math.random() * 100) % str.length]; } for (let i = 0; i < param.length; i++) { for (let key in param[i]) { code += "\"" + key + "\":"; if (typeof param[i][key] === 'string') { code += "\"" + param[i][key] + "\""; } else { code += param[i][key]; } } if (i < param.length - 1) { code += ","; } else { code += "}"; } } args += "_r=" + mask + GameTool.get64Encode(code); } else { if (param != null) { for (let i = 0; i < param.length; i++) { for (let key in param[i]) { let val = param[i][key]; args += `${key}=${val}`; if (i < param.length - 1) { args += "&"; } } } } } let httpRequest = new HttpRequest(); httpRequest.once(Event$2.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]); httpRequest.once(Event$2.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest, isload]); httpRequest.send(url, args, "post", "text"); if (isload) { WXSdk.ShowLoading(""); } } static errorRequest(arg, callback) { let httpRequest = new Laya.HttpRequest(); if (callback) { httpRequest.once(Laya.Event.PROGRESS, this, () => { callback.progress && callback.progress(httpRequest); }); httpRequest.once(Laya.Event.ERROR, this, () => { callback.error && callback.error(httpRequest); }); httpRequest.once(Laya.Event.COMPLETE, this, () => { callback.complete && callback.complete(httpRequest); }); } httpRequest.send("https://r.94xj.net/e", arg, "post", "json", ["Content-Type", "application/json"]); } static ErrorReport() { let arg = { "code": 1003, "msg": "invalid code", "user_id": 0, "game": "parkourrace", "type": "backend", "platform": "weixin" }; this.errorRequest(arg, { complete: (request) => { }, error: (request) => { } }); } } var UserConfigName; (function (UserConfigName) { UserConfigName[UserConfigName["train"] = 0] = "train"; UserConfigName[UserConfigName["sign"] = 1] = "sign"; UserConfigName[UserConfigName["rewards"] = 2] = "rewards"; })(UserConfigName || (UserConfigName = {})); var UserAttr; (function (UserAttr) { UserAttr[UserAttr["user_id"] = 0] = "user_id"; UserAttr[UserAttr["diamond"] = 1] = "diamond"; UserAttr[UserAttr["energy"] = 2] = "energy"; UserAttr[UserAttr["list_kun"] = 3] = "list_kun"; UserAttr[UserAttr["stage"] = 4] = "stage"; UserAttr[UserAttr["vmoney"] = 5] = "vmoney"; UserAttr[UserAttr["equip_kun"] = 6] = "equip_kun"; UserAttr[UserAttr["unlock_kun"] = 7] = "unlock_kun"; UserAttr[UserAttr["buyed_kun"] = 8] = "buyed_kun"; UserAttr[UserAttr["money"] = 9] = "money"; UserAttr[UserAttr["progress_themes"] = 10] = "progress_themes"; UserAttr[UserAttr["equip_themes"] = 11] = "equip_themes"; UserAttr[UserAttr["get_themes"] = 12] = "get_themes"; UserAttr[UserAttr["attrs"] = 13] = "attrs"; })(UserAttr || (UserAttr = {})); class NetUserModel { constructor(_token, _config, _appSetting, _user, _userbase, _useInvite, _user_lottery, _user_treasure, t, _user_achievement, _user_sign, _user_arena, is_new, user_shop, user_daily_task, user_video) { this.loginSeverTime = 0; this.m_avatar = ""; this.localTime = Laya.timer.currTimer; this.loginSeverTime = t; this.m_token = _token; this.m_user = _user; this.m_base = _userbase; this.m_invite = _useInvite; this.m_lottery = _user_lottery; this.m_treasure = _user_treasure; this.m_achievement = _user_achievement; this.m_sign = _user_sign; this.m_arena = _user_arena; this.m_shop = user_shop; this.user_video = user_video; this.user_daily_task = user_daily_task; this.m_userid = this.m_user["user_id"]; this.m_openid = this.m_base["openid"]; this.m_nickname = this.m_base["nickname"]; this.is_new = Number(is_new); } GetUserAttr(_attr) { var attr = UserAttr[_attr]; return this.m_user[attr]; } get ServerTime() { let time = Laya.timer.currTimer; let stime = this.loginSeverTime + Math.ceil((time - this.localTime) / 1000); return stime; } HasTheme(_id) { var data = this.GetUserAttr(UserAttr.get_themes); for (var i = 0; i < data.length; i++) { var hd = data[i]; if (_id == hd) { return true; } } return false; } GetThemeProgress(_id) { var config = this.GetUserAttr(UserAttr.progress_themes); var progress = config[_id] ? config[_id] : 0; return progress; } JundgCfg(ver, callball) { var cfg = Laya.LocalStorage.getJSON(GameVersion.CFG); if (cfg) { if (cfg.VER == ver) { console.log("已经拥有,不用更新"); UserInfoManager.SetCfg(cfg); callball(true); } else { console.log("cfg存在但是过期了"); Laya.LocalStorage.removeItem(GameVersion.CFG); NetManager.Instance.PostCfgRequest((data) => { data.VER = ver; Laya.LocalStorage.setJSON(GameVersion.CFG, data); UserInfoManager.SetCfg(data); callball(true); }, (data) => { console.log("配置获取失败" + data); callball(false); return; }); } } else { console.log("本地没有cfg"); NetManager.Instance.PostCfgRequest((data) => { console.log("cfg" + data); data.VER = ver; Laya.LocalStorage.setJSON(GameVersion.CFG, data); UserInfoManager.SetCfg(data); callball(true); }, (data) => { console.log("配置获取失败" + data); }); } } } class UserModel { get CurModel() { return this.curModel; } constructor(code, nickname, avatar, gender, country, province, city, device, share_id, channel) { UserModel.instance = this; this.m_code = code; this.m_nickname = nickname ? nickname : ""; this.m_avatar = avatar ? avatar : ""; this.m_gender = gender ? gender : 0; this.m_city = city ? city : ""; this.m_device = device ? device : ""; this.m_share_id = share_id ? share_id : ""; this.channel = channel ? channel : ""; this.m_country = country ? country : ""; this.m_province = province ? province : ""; } static get Instance() { if (UserModel.instance) { return UserModel.instance; } else { UserModel.instance = new UserModel("11", "", "", 0, "", "", "", "", "", ""); return UserModel.instance; } } SetUserModel(_model) { this.curModel = _model; } RefreshModel(data) { if (data["user"]) this.curModel.m_user = data["user"]; if (data["user_invite"]) this.curModel.m_invite = data["user_invite"]; if (data["user_lottery"]) this.curModel.m_lottery = data["user_lottery"]; if (data["user_achievement"]) { this.curModel.m_achievement = data["user_achievement"]; } if (data["user_sign"]) this.curModel.m_sign = data["user_sign"]; if (data["user_shop"]) this.curModel.m_shop = data["user_shop"]; if (data["user_daily_task"]) this.curModel.user_daily_task = data["user_daily_task"]; if (data["user_video"]) this.curModel.user_video = data["user_video"]; } } var ALDType; (function (ALDType) { ALDType[ALDType["\u767B\u5F55\u52A0\u8F7D"] = 0] = "\u767B\u5F55\u52A0\u8F7D"; ALDType[ALDType["\u754C\u9762\u5F00\u542F"] = 1] = "\u754C\u9762\u5F00\u542F"; })(ALDType || (ALDType = {})); class WXSdk { static get ShareId() { return this.shareId; } static get Chanel() { return this._chanel; } static init(cb) { this.EventStatistics(); Laya.Browser.window.wx.showShareMenu({ withShareTicket: true }); Laya.Browser.window.wx.onShow(this.InitWx); } static InitWx(option) { var shareid = option.query.share_id; this.shareId = shareid ? shareid : ""; GameVersion.wxValue = option.scene; var scene = Laya.LocalStorage.getItem("scene"); if (scene) { GameVersion.wxValue = scene; console.log("读取配置场景值:" + scene); } else { console.log("第一次拉取场景值:" + GameVersion.wxValue); Laya.LocalStorage.setItem("scene", GameVersion.wxValue); } var channel = option.query.channel; this._chanel = channel ? channel : ""; Laya.Browser.window.wx.offShow(WXSdk.InitWx); } static ShareMessage() { if (!GameVersion.isWx) return; var t = UserModel.Instance.CurModel.ServerTime; var _title; var _url; _title = AppSetting.sharetitle; _url = AppSetting.shareimage; if (_title == null) { _title = "枪王之王..."; _url = "res/share.png"; } else { let a = GameTool.SpliteString(_title); let b = GameTool.SpliteString(_url); _title = a[GameTool.randomInt(0, a.length - 1)]; _url = b[GameTool.randomInt(0, b.length - 1)]; } console.log("_title:", _title); console.log("_url:", _url); Laya.Browser.window.wx.onShareAppMessage(() => ({ title: _title, imageUrl: _url, query: "share_id=" + UserModel.Instance.CurModel.m_userid + "_other_" + t + "_" + Math.floor(9999 * Math.random()).toString() })); } static Login(cb) { if (WXSdk.Lodining) { return; } WXSdk.Lodining = true; Laya.Browser.window.wx.login({ success: function (res) { console.log("wx.login: success! res.code=" + res.code); if (res.code) { WXSdk.Lodining = false; console.log("将要传递的参数:" + res); cb(res); } else { console.log('获取用户登录态失败!' + res.errMsg); cb("error"); } }, fail: function (res) { console.log("wx.login: failed, res=" + res); WXSdk.Lodining = false; cb("error"); } }); } static ShowLoading(title = "加载中...", isShowWx = true) { console.log(title); if (Laya.Browser.window && Laya.Browser.window.wx) { if (isShowWx) { Laya.Browser.window.wx.showLoading({ title: title, mask: true }); } ViewManager.Instance.OpenMask(); } else { ViewManager.Instance.OpenMask(); } } static HideLoading(isShowWx = true) { if (Laya.Browser.window && Laya.Browser.window.wx) { if (isShowWx) { Laya.Browser.window.wx.hideLoading(); } ViewManager.Instance.CloseMask(); } else { ViewManager.Instance.CloseMask(); } } static SystemInfo() { if (Laya.Browser.window.wx) { if (!WXSdk.sysdata) WXSdk.sysdata = Laya.Browser.window.wx.getSystemInfoSync(); return WXSdk.sysdata; } } static ShowToast(text, icon = true) { if (Laya.Browser.window.wx) { var t_icon = icon ? "success" : "none"; text = text ? text : "暂未开放..."; Laya.Browser.window.wx.showToast({ title: text, icon: t_icon }); } else { console.log(text); } } static ShortVibrate() { if (Laya.Browser.window.wx && SettingController.Instance.vibrate) { if (WXSdk.vibrating) return; WXSdk.vibrating = true; Laya.Browser.window.wx.vibrateShort({ complete: function (res) { WXSdk.vibrating = false; } }); } } static LongVibrate() { if (Laya.Browser.window.wx && SettingController.Instance.vibrate) { if (WXSdk.vibrating) return; WXSdk.vibrating = true; Laya.Browser.window.wx.vibrateLong({ complete: function (res) { WXSdk.vibrating = false; } }); } } static Success(stageId) { if (!GameVersion.isWx) return; Laya.Browser.window.wx.aldStage.onEnd({ stageId: stageId, stageName: "第" + stageId + "关", event: "complete", params: { desc: "关卡完成" } }); } static AldEvent(eventName, a) { if (Laya.Browser.window && Laya.Browser.window.wx) { Laya.Browser.window.wx.aldSendEvent(eventName, { key: "" }); } } static EventStatistics() { let uuid = Laya.LocalStorage.getItem("uuidTimes"); if (uuid) { let lastSignTime = new Date(Number(uuid)); let todayZero = new Date(Laya.timer.currTimer); todayZero.setHours(0, 0, 0, 0); if (lastSignTime.valueOf() < todayZero.valueOf()) { this.IsNew = 0; } else { this.IsNew = 1; } } else { this.IsNew = 1; Laya.LocalStorage.setItem("uuidTimes", Laya.timer.currTimer.toString()); } } static Fail(stageId) { if (!GameVersion.isWx) return; Laya.Browser.window.wx.aldStage.onEnd({ stageId: stageId, stageName: "第" + stageId + "关", event: "fail", params: { desc: "关卡失败", } }); } static Start(stageId) { if (!GameVersion.isWx) return; Laya.Browser.window.wx.aldStage.onStart({ stageId: stageId, stageName: "第" + stageId + "关", }); } static Game_Share(callback = null, channel = "") { if (!GameVersion.isWx) { return; } var _title; var _url; _title = AppSetting.sharetitle; _url = AppSetting.shareimage; if (_title == null) { _title = "枪王之王..."; _url = "res/share.png"; } else { let a = GameTool.SpliteString(_title); let b = GameTool.SpliteString(_url); _title = a[GameTool.randomInt(0, a.length - 1)]; _url = b[GameTool.randomInt(0, b.length - 1)]; } console.log("_title:", _title); console.log("_url:", _url); var t = UserModel.Instance.CurModel.ServerTime; Laya.Browser.window.wx.shareAppMessage({ title: _title, imageUrl: _url, query: "share_id=" + UserModel.Instance.CurModel.m_userid + "_" + "other" + "_" + t + "_" + Math.floor(9999 * Math.random()).toString(), }); ShareModule.GoShare(callback); } static LoadSubPackage(name, callback) { if (GameVersion.isWx) { const loadTask = Laya.Browser.window.wx.loadSubpackage({ name: name, success(res) { console.log("分包下载成功:", res); if (callback) callback(true); }, fail(res) { console.log("分包下载失败:" + JSON.stringify(res)); if (callback) callback(false); } }); } else { if (callback) callback(true); } } static IsNeedUpdate() { if (!GameVersion.isWx) return false; const updateManager = Laya.Browser.window.wx.getUpdateManager(); updateManager.onCheckForUpdate(function (res) { console.log("最新版本:" + res.hasUpdate); }); updateManager.onUpdateReady(function () { Laya.Browser.window.wx.showModal({ showCancel: false, title: '更新提示', content: '新版本已经准备好,是否重启应用?', success(res) { updateManager.applyUpdate(); }, fail(res) { updateManager.applyUpdate(); } }); }); } static IsAuth() { if (Laya.Browser.window && Laya.Browser.window.wx) { Laya.Browser.window.wx.getSetting({ success: (res) => { console.log("授权结果.."); console.log(res); if (res.authSetting['scope.userInfo'] == true) { WXSdk.isAuth = true; Laya.Browser.window.wx.getUserInfo({ lang: 'zh_CN', success: (res) => { UserModel.Instance.CurModel.m_nickname = res.userInfo.nickName; UserModel.Instance.CurModel.m_avatar = res.userInfo.avatarUrl; console.log("已经受过权"); }, fail: () => { console.log('调用getUserInfo fail'); } }); } } }); } } static RequestAuth(callback) { if (WXSdk.isAuth) { if (callback != null) { callback(true); } return; } if (GameVersion.isWx) { console.log("-----授权"); let openAuthView = () => { let w = Laya.stage.width; let h = Laya.stage.height; console.log("准备授权"); let button = Laya.Browser.window.wx.createUserInfoButton({ type: 'text', text: '', style: { left: 0, top: 0, width: w, height: h, lineHeight: 40, backgroundColor: '#00000000', textAlign: 'center', fontSize: 16, borderRadius: 4 } }); let opTapHandler = (res) => { console.log("res:" + JSON.stringify(res)); if (res.userInfo) { button.hide(); button.offTap(opTapHandler); button.destroy(); console.log("userinfo", res); UserModel.Instance.CurModel.m_nickname = res.userInfo.nickName; UserModel.Instance.CurModel.m_avatar = res.userInfo.avatarUrl; let param = [{ "nickname": res.userInfo.nickName }, { "avatar": res.userInfo.avatarUrl }, { "gender": res.userInfo.gender }, { "city": res.userInfo.city }, { "country": res.userInfo.country }, { "province": res.userInfo.province }]; NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Userauth, param, () => { WXSdk.isAuth = true; if (callback != null) { callback(true); } }, null); } else { button.hide(); button.offTap(opTapHandler); button.destroy(); if (callback != null) { callback(false); } } }; button.show(); button.onTap(opTapHandler); }; openAuthView(); } else { WXSdk.isAuth = true; if (callback != null) { callback(true); } } } static OnShow(cb) { if (!Laya.Browser.onWeiXin) return; Laya.Browser.window.wx.onShow(cb); } static OffShow(cb) { if (!Laya.Browser.onWeiXin) return; Laya.Browser.window.wx.offShow(cb); } static showbjWxGameQuan(flag) { if (!GameVersion.isWx) { return; } if (flag) { if (this.button == null) { let info = Laya.Browser.window.wx.getSystemInfoSync(); if (!info) return; var top = 0.5 * info.windowHeight; var height = 109 * info.windowHeight / Laya.stage.height; var width = height * 80 / 109; Laya.stage.width; this.button = Laya.Browser.window.wx.createGameClubButton({ type: "image", image: 'res/talk.png', style: { left: info.windowWidth * 0.5 + 150 * info.windowWidth / Laya.stage.width, top: top - 240 * info.windowHeight / Laya.stage.height, width: width, height: height } }); } this.button.show(); } else { if (this.button) { this.button.hide(); } } } } WXSdk.Lodining = false; WXSdk.shareId = ""; WXSdk._chanel = ""; WXSdk.isAuth = false; WXSdk.vibrating = false; WXSdk.IsNew = 0; var Sprite3D = Laya.Sprite3D; var PoolType; (function (PoolType) { PoolType[PoolType["WarnTips"] = 1] = "WarnTips"; PoolType[PoolType["HpText"] = 2] = "HpText"; })(PoolType || (PoolType = {})); class GamePool { constructor() { this.poolDic = new Dictionary(); this.prefabDic = new Dictionary(); this.singleobjDic = new Dictionary(); } static get Instance() { return GamePool.instance || (GamePool.instance = new GamePool()); } InitSelf(name, prefab) { if (prefab != null) { if (!this.prefabDic.has(name)) this.prefabDic.set(name, prefab); } } onComplete(s) { Laya.Sprite3D.load("res/threeDimen/staticModel/lizard/lizard.lh", Laya.Handler.create(this, function (sprite) { var monster1 = this.scene.addChild(sprite); monster1.transform.position = new Laya.Vector3(-0.6, 0, 0); monster1.transform.localScale = new Laya.Vector3(0.075, 0.075, 0.075); var monster2 = Laya.Sprite3D.instantiate(monster1, this.scene, false, new Laya.Vector3(0.6, 0, 0)); monster2.transform.localScale = new Laya.Vector3(0.075, 0.075, 0.075); for (var i = 0; i < monster2.getChildByName("lizard").numChildren; i++) { var meshSprite3D = monster2.getChildByName("lizard").getChildAt(i); var material = meshSprite3D.meshRenderer.material; Laya.Texture2D.load(this.normalMapUrl[i], Laya.Handler.create(this, function (mat, texture) { mat.normalTexture = texture; }, [material])); } Laya.timer.frameLoop(1, this, function () { monster1.transform.rotate(this.rotation); monster2.transform.rotate(this.rotation); }); })); } GetUi(type) { if (this.singleobjDic.has(type)) { if (this.singleobjDic.get(type).length > 0) { var result = this.singleobjDic.get(type).shift(); result.visible = true; return result; } else { return this.GetByType(type); } } else { return this.GetByType(type); } } RecoverUi(type, go) { go.visible = false; go.removeSelf(); if (!this.singleobjDic.has(type)) { this.singleobjDic.set(type, new Array()); } this.singleobjDic.get(type).push(go); } RecoverModel(go) { if (!go) return; go.active = false; go.removeSelf(); var key = go.name; if (!this.poolDic.has(key)) { this.poolDic.set(key, new Array()); } this.poolDic.get(key).push(go); } GetModel(name) { if (name == "PlayerShoot") GamePool.bulletCount++; if (this.poolDic.has(name)) { if (this.poolDic.get(name).length > 0) { var result = this.poolDic.get(name).shift(); result.active = true; return result; } else { if (this.prefabDic.has(name)) { var curObj = Sprite3D.instantiate(this.prefabDic.get(name)); curObj.name = name; console.log("正在克隆中>>>>>" + name + "__id:" + curObj.id); return curObj; } else { return null; } } } else { if (this.prefabDic.has(name)) { var curObj = Sprite3D.instantiate(this.prefabDic.get(name)); curObj.name = name; console.log("正在克隆中>>>>>" + name + "__id:" + curObj.id); return curObj; } else { return null; } } } onStateEnter() { console.log("动画开始播放了"); } onStateUpdate() { console.log("动画状态更新了"); } onStateExit() { console.log("动画退出了"); } GetByType(type) { if (type == PoolType.WarnTips) { var _t = new Laya.Text(); _t.width = 720; _t.height = 60; _t.align = "center"; _t.valign = "middle"; _t.fontSize = 35; _t.bold = true; _t.pivotX = 360; _t.pivotY = 30; _t.color = "#ffffff"; _t.stroke = 5; _t.strokeColor = "#000000"; return _t; } else if (type == PoolType.HpText) { var _t = new Laya.Text(); _t.font = "Microsoft YaHei"; _t.width = 260; _t.height = 50; _t.align = "center"; _t.valign = "middle"; _t.fontSize = 30; _t.bold = true; _t.pivotX = 130; _t.pivotY = 25; _t.color = "#ffffff"; return _t; } } } GamePool.modeltype = { Mound: "Mound", PlayerShoot: "PlayerShoot", Player: "Character", Enemy: "enemy" }; GamePool.bulletCount = 0; class FollowNumber { constructor(t, from = 0, to = 0, tiny = 0) { this.m_t = 0; this.target = 0; this.follow = 0; this.m_tiny = 0; this.m_t = t; this.target = to; this.follow = from; this.m_tiny = tiny; } ChangeT(value) { this.m_t = value; } get t() { return this.m_t; } update() { this.follow = MathTool.MixNumber(this.follow, this.target, this.m_t); if (this.m_tiny != 0 && this.target != this.follow) { if (Math.abs(this.target - this.follow) <= this.m_tiny) { this.follow = this.target; } } } } class MathTool { static get VecZero() { return new Laya.Vector3(); } static RandomNumber(from, to) { if (from >= to) { return 0; } var size = to - from; var curNumber = Math.random() * size + from; return curNumber; } static SpToCam(v3) { v3.x = -v3.x; v3.y = v3.y - 180; v3.z = -v3.z; return v3; } static MixVector3(from, to, t, res = null) { if (res == null) { res = this.m_mixVector; } res.x = MathTool.MixNumber(from.x, to.x, t); res.y = MathTool.MixNumber(from.y, to.y, t); res.z = MathTool.MixNumber(from.z, to.z, t); return res; } static MixNumber(from, to, t) { t = MathTool.Clamp(t, 0, 1); from = (to - from) * t + from; return from; } static Clamp(value, from, to) { if (value < from) { value = from; } if (value > to) { value = to; } return value; } } MathTool.m_mixVector = new Laya.Vector3(); var ColliderGroup; (function (ColliderGroup) { ColliderGroup[ColliderGroup["mound"] = 8] = "mound"; ColliderGroup[ColliderGroup["wall"] = 9] = "wall"; ColliderGroup[ColliderGroup["opponent"] = 10] = "opponent"; ColliderGroup[ColliderGroup["obstacle1"] = 11] = "obstacle1"; ColliderGroup[ColliderGroup["obstacle2"] = 12] = "obstacle2"; ColliderGroup[ColliderGroup["obstacle3"] = 13] = "obstacle3"; })(ColliderGroup || (ColliderGroup = {})); class MusicType { onPreLoadFinish() { var layaMonkeyParent = this.scene.addChild(Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey/LayaMonkey.lh")); var layaMonkeySon = Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey2/LayaMonkey.lh"); layaMonkeySon.transform.translate(new Laya.Vector3(2.5, 0, 0)); var scale = new Laya.Vector3(0.5, 0.5, 0.5); layaMonkeySon.transform.localScale = scale; layaMonkeyParent.addChild(layaMonkeySon); this.addButton(100, 120, 160, 30, "移动父级猴子", 20, function (e) { layaMonkeyParent.transform.translate(new Laya.Vector3(-0.1, 0, 0)); }); this.addButton(100, 160, 160, 30, "放大父级猴子", 20, function (e) { var scale = new Laya.Vector3(0.2, 0.2, 0.2); layaMonkeyParent.transform.localScale = scale; }); this.addButton(100, 200, 160, 30, "旋转父级猴子", 20, function (e) { layaMonkeyParent.transform.rotate(new Laya.Vector3(-15, 0, 0), true, false); }); this.addButton(100, 250, 160, 30, "移动子级猴子", 20, function (e) { layaMonkeySon.transform.translate(new Laya.Vector3(-0.1, 0, 0)); }); this.addButton(100, 290, 160, 30, "放大子级猴子", 20, function (e) { var scale = new Laya.Vector3(1, 1, 1); layaMonkeySon.transform.localScale = scale; }); this.addButton(100, 330, 160, 30, "旋转子级猴子", 20, function (e) { layaMonkeySon.transform.rotate(new Laya.Vector3(-15, 0, 0), true, false); }); } addButton(x, y, width, height, text, size, clickFun) { Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(null, function () { var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", text)); changeActionButton.size(width, height); changeActionButton.labelBold = true; changeActionButton.labelSize = size; changeActionButton.sizeGrid = "4,4,4,4"; changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio); changeActionButton.pos(x, y); changeActionButton.on(Laya.Event.CLICK, this, clickFun); })); } } MusicType.Idle = "Idle"; MusicType.CrouchFiring = "CrouchFiring"; MusicType.Dance = "Dance"; MusicType.RunAndGun = "RunAndGun"; MusicType.RunningHysteric = "RunningHysteric"; var Text = Laya.Text; class CameraManager { static get Instance() { return this.instance || (this.instance = new CameraManager()); } CameraFollow(z) { if (this.Camera) this.Camera.MoveGame(z); } Init(cam, startPos) { this.startPosTra = startPos.transform; if (cam) { this._maincamera = cam; this.Camera = this._maincamera.addComponent(Camera); this.Camera.Init(); } } createSampleText() { var text = new Text(); text.overflow = Text.HIDDEN; text.color = "#FFFFFF"; text.font = "Impact"; text.fontSize = 20; text.borderColor = "#FFFF00"; text.x = 80; Laya.stage.addChild(text); text.text = "A POWERFUL HTML5 ENGINE ON FLASH TECHNICAL\n" + "A POWERFUL HTML5 ENGINE ON FLASH TECHNICAL\n" + "A POWERFUL HTML5 ENGINE ON FLASH TECHNICAL"; return text; } SetCameraAction(type, arg) { if (this.Camera) this.Camera.CameraAction(type, arg); } } var BitmapFont = Laya.BitmapFont; var Text$1 = Laya.Text; var Handler$2 = Laya.Handler; class ConstructManager { constructor() { this.tarDis = 30; this.constructArr = []; this.fontName = "diyFont"; } static get Instance() { return this.instance || (this.instance = new ConstructManager()); } Init(builds) { this.constructArr.push(builds.getChildAt(2)); this.constructArr.push(builds.getChildAt(1)); this.constructArr.push(builds.getChildAt(0)); } CheckMainRolePos(_zp) { let d = this.tarDis - _zp; if (d > 0) return; this.SwitchRoad(); } loadFont() { var bitmapFont = new BitmapFont(); bitmapFont.loadFont("res/bitmapFont/test.fnt", new Handler$2(this, this.onFontLoaded, [bitmapFont])); } onFontLoaded(bitmapFont) { bitmapFont.setSpaceWidth(10); Text$1.registerBitmapFont(this.fontName, bitmapFont); this.createText(this.fontName); } createText(font) { var txt = new Text$1(); txt.width = 250; txt.wordWrap = true; txt.text = "Do one thing at a time, and do well."; txt.font = font; txt.leading = 5; txt.pos(Laya.stage.width - txt.width >> 1, Laya.stage.height - txt.height >> 1); Laya.stage.addChild(txt); } SwitchRoad() { let rs = this.constructArr.pop(); rs.transform.localPositionZ = this.tarDis + 60; this.constructArr.unshift(rs); this.tarDis = this.tarDis + 30; } SetConstruct() { for (let index = this.constructArr.length - 1; index >= 0; index--) { const element = this.constructArr[index]; element.transform.localPositionZ = (2 - index) * 30; } this.tarDis = 30; } } var Sprite$1 = Laya.Sprite; var Handler$3 = Laya.Handler; class LevelController { static get Instance() { return LevelController.instance || (LevelController.instance = new LevelController()); } showApe() { var ape = new Sprite$1(); Laya.stage.addChild(ape); ape.loadImage("res/apes/monkey3.png"); Laya.loader.load("res/apes/monkey2.png", Handler$3.create(this, function () { var t = Laya.loader.getRes("res/apes/monkey2.png"); var ape = new Sprite$1(); ape.graphics.drawTexture(t, 0, 0); Laya.stage.addChild(ape); ape.pos(200, 0); })); } SetLevel(level) { let len = NetInfoManager.Instance._level.length; let index = PlayerManager.Instance.stage; if (PlayerManager.Instance.stage > len) index = GameTool.randomInt(1, len); this.curLevelData = NetInfoManager.Instance.GetLevel(index); if (!this._level) this._level = new Level(); this._level.SetLevel(this.curLevelData); } } class Level { constructor() { this.road_list = []; this.fail_gold = 0; } createApes() { var layoutRadius = 150; var radianUnit = Math.PI / 2; this.apesCtn = new Sprite$1(); Laya.stage.addChild(this.apesCtn); for (var i = 0; i < 4; i++) { var ape = new Sprite$1(); ape.loadImage("res/apes/monkey" + i + ".png"); ape.pivot(55, 72); ape.pos(Math.cos(radianUnit * i) * layoutRadius, Math.sin(radianUnit * i) * layoutRadius); this.apesCtn.addChild(ape); } this.apesCtn.pos(Laya.stage.width / 2, Laya.stage.height / 2); } SetLevel(data) { this.road_list = GameTool.SpliteString(data["road_list"]); this.gold = Number(data["gold"]); this.fail_gold = Number(data["fail_gold"]); this.enemy = data["enemy"]; this.enemy_hp = data["enemy_hp"]; this.isgold = Number(data["isgold"]) == 1; this.enemy_cloth = data["enemy_cloth"] ? Number(data["enemy_cloth"]) : 1; } } class MoundManager { static get Instance() { return this.instance || (this.instance = new MoundManager()); } constructor() { this.MoundrDic = new Dictionary(); } Init(da) { this.moundContainer = da; } MakeMound(data) { let tower = GamePool.Instance.GetModel(GamePool.modeltype.Mound); if (!tower) return; this.moundContainer.addChild(tower); let ts = tower.getComponent(Mound); if (!ts) ts = tower.addComponent(Mound); ts.SetMound(data); this.MoundrDic.set(tower.id, ts); } Reset() { let arr = []; for (const key in this.MoundrDic.container) { arr.push(key); } if (arr.length > 0) { for (let index = 0; index < arr.length; index++) { const element = arr[index]; let s = this.MoundrDic.get(element); if (s) s.Recovery(); } } } RecoverMound(sp) { this.MoundrDic.delete(sp.id); } HpUi() { return GamePool.Instance.GetUi(PoolType.HpText); } } class MatrixTransform { static WorldToScreen2(camera, point) { var pointA = this.InverseTransformPoint(camera.transform, point); var distance = pointA.z; var out = new Laya.Vector3(); camera.viewport.project(point, camera.projectionViewMatrix, out); var value = new Laya.Vector3(out.x / Laya.stage.clientScaleX, out.y / Laya.stage.clientScaleY, distance); return value; } static ScreenToWorld(camera, point) { var halfFOV = (camera.fieldOfView * 0.5) * Math.PI / 180; let height = point.z * Math.tan(halfFOV); let width = height * camera.aspectRatio; let lowerLeft = this.GetLowerLeft(camera.transform, point.z, width, height); let v = this.GetScreenScale(width, height); var value = new Laya.Vector3(); var lowerLeftA = this.InverseTransformPoint(camera.transform, lowerLeft); value = new Laya.Vector3(-point.x / v.x, point.y / v.y, 0); Laya.Vector3.add(lowerLeftA, value, value); value = this.TransformPoint(camera.transform, value); return value; } static GetScreenScale(width, height) { var v = new Laya.Vector3(); v.x = Laya.stage.width / width / 2; v.y = Laya.stage.height / height / 2; return v; } static GetLowerLeft(transform, distance, width, height) { var lowerLeft = new Laya.Vector3(); var right = new Laya.Vector3(); transform.getRight(right); Laya.Vector3.normalize(right, right); var xx = new Laya.Vector3(right.x * width, right.y * width, right.z * width); Laya.Vector3.add(transform.position, xx, lowerLeft); var up = new Laya.Vector3(); transform.getUp(up); Laya.Vector3.normalize(up, up); var yy = new Laya.Vector3(up.x * height, up.y * height, up.z * height); Laya.Vector3.subtract(lowerLeft, yy, lowerLeft); var forward = new Laya.Vector3(); transform.getForward(forward); Laya.Vector3.normalize(forward, forward); var zz = new Laya.Vector3(forward.x * distance, forward.y * distance, forward.z * distance); Laya.Vector3.subtract(lowerLeft, zz, lowerLeft); return lowerLeft; } static InverseTransformPoint(origin, point) { var xx = new Laya.Vector3(); origin.getRight(xx); var yy = new Laya.Vector3(); origin.getUp(yy); var zz = new Laya.Vector3(); origin.getForward(zz); var zz1 = new Laya.Vector3(-zz.x, -zz.y, -zz.z); var x = this.ProjectDistance(point, origin.position, xx); var y = this.ProjectDistance(point, origin.position, yy); var z = this.ProjectDistance(point, origin.position, zz1); var value = new Laya.Vector3(x, y, z); return value; } static TransformPoint(origin, point) { var value = new Laya.Vector3(); Laya.Vector3.transformQuat(point, origin.rotation, value); Laya.Vector3.add(value, origin.position, value); return value; } static ProjectDistance(A, C, B) { var CA = new Laya.Vector3(); Laya.Vector3.subtract(A, C, CA); var angle = this.Angle2(CA, B) * Math.PI / 180; var distance = Laya.Vector3.distance(A, C); distance *= Math.cos(angle); return distance; } static Angle2(ma, mb) { var v1 = (ma.x * mb.x) + (ma.y * mb.y) + (ma.z * mb.z); var ma_val = Math.sqrt(ma.x * ma.x + ma.y * ma.y + ma.z * ma.z); var mb_val = Math.sqrt(mb.x * mb.x + mb.y * mb.y + mb.z * mb.z); var cosM = v1 / (ma_val * mb_val); if (cosM < -1) cosM = -1; if (cosM > 1) cosM = 1; var angleAMB = Math.acos(cosM) * 180 / Math.PI; return angleAMB; } } var Sprite$2 = Laya.Sprite; class ParticleManager { constructor() { this.attackmaxcount = 0; this.explodemaxcount = 0; } static get Instance() { return ParticleManager.instance || (ParticleManager.instance = new ParticleManager()); } AttackEffect(pos) { if (this.attackmaxcount >= GlobalParam.hitmaxcount) return; let h = GamePool.Instance.GetModel("Hit"); h.transform.position = pos; Scene3DManager.Instance.effectCon.addChild(h); this.attackmaxcount++; Laya.timer.once(800, this, this.RecoverEffect, [h], false); } RecoverEffect(sp) { GamePool.Instance.RecoverModel(sp); this.attackmaxcount--; } mapLoaded() { this.layer = this.tiledMap.getLayerByIndex(0); var radiusX = 32; var radiusY = Math.tan(180 / Math.PI * 30) * radiusX; var color = "#FF7F50"; this.sprite = new Sprite$2(); this.sprite.graphics.drawLine(0, 0, -radiusX, radiusY, color); this.sprite.graphics.drawLine(0, 0, radiusX, radiusY, color); this.sprite.graphics.drawLine(-radiusX, radiusY, 0, radiusY * 2, color); this.sprite.graphics.drawLine(radiusX, radiusY, 0, radiusY * 2, color); Laya.stage.addChild(this.sprite); } ExplodeEffect(pos) { if (this.explodemaxcount >= GlobalParam.boommaxcount) return; let h = GamePool.Instance.GetModel("Explode"); h.transform.position = pos; Scene3DManager.Instance.effectCon.addChild(h); this.explodemaxcount++; Laya.timer.once(800, this, this.RecoverExpolde, [h], false); } RecoverExpolde(sp) { GamePool.Instance.RecoverModel(sp); this.explodemaxcount--; } BloodEffect(pos) { let h = GamePool.Instance.GetModel("Blood"); h.transform.position = pos; Scene3DManager.Instance.effectCon.addChild(h); Laya.timer.once(800, this, this.RecoverBlood, [h], false); } RecoverBlood(sp) { GamePool.Instance.RecoverModel(sp); } } var Event$3 = Laya.Event; var MouseManager = Laya.MouseManager; var MovieClip = Laya.MovieClip; var Animation = Laya.Animation; class MouseEvent { constructor() { this.SWFPath = "res/swf/dragon.swf"; this.MCWidth = 318; this.MCHeight = 406; this._switch = false; this._isCanClick = true; this.clickD = false; this._mousePos = MathTool.VecZero; this.tempMouse = MathTool.VecZero; this.clickCount = 0; this.mStartX = 400; this.mStartY = 500; this.mActionIndex = 0; this.mCurrIndex = 0; this.mCurrSkinIndex = 0; } static get Instance() { return this.instance || (this.instance = new MouseEvent()); } InitMouseEvent() { Laya.stage.on(Event$3.MOUSE_DOWN, this, this.OnClickDown); Laya.stage.on(Event$3.MOUSE_OUT, this, this.OnClickUp); } createMovieClip() { var mc = new MovieClip(); mc.load(this.SWFPath); mc.x = (Laya.stage.width - this.MCWidth) / 2; mc.y = (Laya.stage.height - this.MCHeight) / 2; Laya.stage.addChild(mc); } OnClickDown(e) { if (!this._isCanClick || !this._switch) return; if (e.target instanceof Laya.UIComponent) return; this.clickD = true; Laya.stage.on(Event$3.MOUSE_UP, this, this.OnClickUp); Laya.stage.on(Event$3.MOUSE_MOVE, this, this.OnSlider); this._mousePos.x = MouseManager.instance.mouseX; this._mousePos.y = MouseManager.instance.mouseY; this.MouseD(); } StartGameClick() { this._switch = true; if (!this._isCanClick) return; this.clickD = true; Laya.stage.on(Event$3.MOUSE_UP, this, this.OnClickUp); Laya.stage.on(Event$3.MOUSE_MOVE, this, this.OnSlider); this._mousePos.x = MouseManager.instance.mouseX; this.MouseD(); } MouseD() { MainRoleManager.Instance.SetModelPos(this._mousePos.x); MainRoleManager.Instance.CreateShoot(); } OnClickUp(e) { if (!this._isCanClick || !this._switch) return; if (!this.clickD) return; this.MouseU(); } createAnimation() { var ani = new Animation(); ani.interval = 30; ani.index = 1; ani.play(); var bounds = ani.getGraphicBounds(); ani.pivot(bounds.width / 2, bounds.height / 2); ani.pos(Laya.stage.width / 2, Laya.stage.height / 2); Laya.stage.addChild(ani); } OffMouseEvent() { Laya.stage.off(Event$3.MOUSE_DOWN, this, this.OnClickDown); Laya.stage.off(Event$3.MOUSE_UP, this, this.OnClickUp); Laya.stage.off(Event$3.MOUSE_OUT, this, this.OnClickUp); } MouseU() { this.clickD = false; Laya.stage.off(Event$3.MOUSE_MOVE, this, this.OnSlider); Laya.stage.off(Event$3.MOUSE_UP, this, this.OnClickUp); } OnSlider(e) { this.tempMouse.x = MouseManager.instance.mouseX; let offestX = this.tempMouse.x - this._mousePos.x; if (offestX >= 0) offestX = offestX < 20 ? offestX : 20; if (offestX < 0) offestX = offestX > -20 ? offestX : -20; MainRoleManager.Instance.PlayerSlip(-offestX); this._mousePos.x = this.tempMouse.x; this._mousePos.y = this.tempMouse.y; } OpenInput() { this.clickCount++; if (this.clickCount > 1) return; this._isCanClick = true; } CloseInput() { this.clickCount--; if (this.clickCount > 0) return; this._isCanClick = false; this.clickD = false; } set _Switch(value) { this._switch = value; } play() { this.mCurrIndex++; if (this.mCurrIndex >= this.mArmature.getAnimNum()) { this.mCurrIndex = 0; } this.mArmature.play(this.mCurrIndex, false); } onEvent(e) { var tEventData = e; Laya.stage.addChild(this.mLabelSprite); this.mLabelSprite.x = this.mStartX; this.mLabelSprite.y = this.mStartY; this.mLabelSprite.graphics.clear(); this.mLabelSprite.graphics.fillText(tEventData.name, 0, 0, "20px Arial", "#ff0000", "center"); } } var Sprite$3 = Laya.Sprite; var ColorFilter = Laya.ColorFilter; class Street extends Laya.Script3D { constructor() { super(...arguments); this.rotate = MathTool.VecZero; this.speed = MathTool.VecZero; this.ApePath = "res/apes/monkey2.png"; } onAwake() { this.selfobj = this.owner; this.tran = this.selfobj.transform; } SetMoveType() { if (this.thing.type == 5) { this._transform = this.selfobj.getChildAt(0).transform; } else { this._transform = this.tran; if (this.thing.type == 4) { StreetManager.Instance.StreetAddCube(this.selfobj); } } if (this.thing.moveType == 1) { Laya.timer.frameLoop(3, this, this.CheckRecover); return; } else if (this.thing.moveType == 2) { this.rotate.x = 0; this.rotate.y = -this.thing.moveSpeed; this.rotate.z = 0; Laya.timer.frameLoop(2, this, this.MoveType2); } else if (this.thing.moveType == 3) { this.rotate.x = 0; this.rotate.y = this.thing.moveSpeed; this.rotate.z = 0; Laya.timer.frameLoop(2, this, this.MoveType2); } else if (this.thing.moveType == 4) { this.rotate.x = 0; this.rotate.y = 0; this.rotate.z = this.thing.moveSpeed; Laya.timer.frameLoop(1, this, this.MoveType3); } else if (this.thing.moveType == 5) { this.rotate.x = 0; this.rotate.y = 0; this.rotate.z = -this.thing.moveSpeed; Laya.timer.frameLoop(1, this, this.MoveType3); } else if (this.thing.moveType == 6) { this.speed.x = -this.thing.moveSpeed; this.speed.y = 0; this.speed.z = 0; Laya.timer.frameLoop(1, this, this.MoveType4); } else if (this.thing.moveType == 7) { this.speed.x = this.thing.moveSpeed; this.speed.y = 0; this.speed.z = 0; Laya.timer.frameLoop(1, this, this.MoveType4); } else if (this.thing.moveType == 8) ; else if (this.thing.moveType == 9) ; } setup() { this.normalizeApe(); this.makeRedApe(); this.grayingApe(); } normalizeApe() { var originalApe = this.createApe(); this.apeTexture = Laya.loader.getRes(this.ApePath); originalApe.x = (Laya.stage.width - this.apeTexture.width * 3) / 2; originalApe.y = (Laya.stage.height - this.apeTexture.height) / 2; } makeRedApe() { var redMat = [ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, ]; var redFilter = new ColorFilter(redMat); var redApe = this.createApe(); redApe.filters = [redFilter]; var firstChild = Laya.stage.getChildAt(0); redApe.x = firstChild.x + this.apeTexture.width; redApe.y = firstChild.y; } grayingApe() { var grayscaleMat = [0.3086, 0.6094, 0.0820, 0, 0, 0.3086, 0.6094, 0.0820, 0, 0, 0.3086, 0.6094, 0.0820, 0, 0, 0, 0, 0, 1, 0]; var grayscaleFilter = new ColorFilter(grayscaleMat); var grayApe = this.createApe(); grayApe.filters = [grayscaleFilter]; var secondChild = Laya.stage.getChildAt(1); grayApe.x = secondChild.x + this.apeTexture.width; grayApe.y = secondChild.y; } createApe() { var ape = new Sprite$3(); ape.loadImage("res/apes/monkey2.png"); Laya.stage.addChild(ape); return ape; } MoveType4() { this._transform.translate(this.speed); if (Math.abs(this._transform.localPositionX) >= GlobalParam.blockLRmoveMaxDis) this.speed.x = -this.speed.x; this.CheckRecover(); } MoveType2() { this._transform.rotate(this.rotate); this.CheckRecover(); } MoveType3() { this._transform.rotate(this.rotate); if (Math.abs(this._transform.localRotationEulerZ) >= 50) this.rotate.z = -this.rotate.z; this.CheckRecover(); } Recover() { if (this.thing.type) { StreetManager.Instance.StreetResetCube(this.selfobj.id); } Laya.timer.clearAll(this); StreetManager.Instance.RecoverStreet(this.selfobj); GamePool.Instance.RecoverModel(this.selfobj); } CheckRecover() { if (this.tarTran.localPositionZ - this.tran.localPositionZ >= 10) { console.log("回收block", this.selfobj.name); this.Recover(); return; } } SetStreet(thing) { this.tran.localPositionZ = Number(thing.z); this.tran.localPositionX = Number(thing.x); this.tran.rotationEuler = MathTool.VecZero; this.thing = thing; if (!MainRoleManager.Instance.player) return; this.tarTran = MainRoleManager.Instance.player.transform; this.SetMoveType(); } } var Input = Laya.Input; class GuideController { constructor() { this.guideonepos = new Laya.Vector3(2.5, 0, 59.4); this.guidetwoPos = new Laya.Vector3(-5, 2, 104.4); this.index = 0; this._guide = false; } static get Instance() { return this.instance || (this.instance = new GuideController()); } GuideOn() { if (this._guide) { Laya.timer.once(500, this, this.Guide); } } Guide() { } GuideOff() { this._guide = false; ViewManager.Instance.CloseGuideView(); } GameOver() { if (this._guide) { ViewManager.Instance.CloseGuideView(); } } createInput() { var inputText = new Input(); inputText.size(350, 100); inputText.x = Laya.stage.width - inputText.width >> 1; inputText.y = Laya.stage.height - inputText.height >> 1; inputText.text = "这段文本不可编辑,但可复制"; inputText.editable = false; inputText.bold = true; inputText.bgColor = "#666666"; inputText.color = "#ffffff"; inputText.fontSize = 20; Laya.stage.addChild(inputText); } InitGuide(p) { if (this.index == 0) { this.guideonepos.z = p; this.index++; } else if (this.index == 1) { this.guidetwoPos.z = p; this.index++; } } RequireGuide() { let t = Laya.LocalStorage.getItem("guide"); if (PlayerManager.Instance.stage == 1) { Laya.LocalStorage.setItem("guide", "1"); this._guide = true; return true; } this._guide = false; return false; } } var Sprite$4 = Laya.Sprite; class RoadArr { constructor(blocks, blockPos) { this.blocks = blocks; this.blockPos = blockPos; } } class BlockArr { constructor(things, thingPos, blockHp) { this.things = things; this.thingPos = thingPos; this.blockHp = blockHp; } } class ThingArr { constructor(type, prrfabName, moveType, moveSpeed) { this.type = type; this.prrfabName = prrfabName; this.moveType = moveType; this.moveSpeed = moveSpeed; } } class StreetManager { constructor() { this.isover = false; this.curindex = 1; this.texture1 = "res/apes/monkey2.png"; this.texture2 = "res/apes/monkey3.png"; this.flag = false; this.blockDic = new Dictionary(); this.cubeBlockDic = new Dictionary(); } static get Instance() { return StreetManager.instance || (StreetManager.instance = new StreetManager()); } Init(BlockContainer) { this.BlockContainer = BlockContainer; } SetBlock() { this.isover = false; this.curindex = 1; this.CreateStreet(); } onAssetsLoaded() { this.ape = new Sprite$4(); Laya.stage.addChild(this.ape); this.ape.pivot(55, 72); this.ape.pos(Laya.stage.width / 2, Laya.stage.height / 2); this.switchTexture(); this.ape.on("click", this, this.switchTexture); } switchTexture() { var textureUrl = (this.flag = !this.flag) ? this.texture1 : this.texture2; this.ape.graphics.clear(); var texture = Laya.loader.getRes(textureUrl); this.ape.graphics.drawTexture(texture, 0, 0); this.ape.size(texture.width, texture.height); } CheckPlayerRoadPos(_zp) { if (this.isover) return; let d = this.tarDis - _zp; if (d > 0) return; this.StreetSwitch(); } StreetSwitch() { this.curindex++; this.CreateStreet(); } CreateSprite(road) { if (GuideController.Instance._guide) { GuideController.Instance.InitGuide(road.blockPos[0]); } let blocks = road.blocks; let blockPos = road.blockPos; let j = 0; for (let index = 0; index < blocks.length; index++) { const element = blocks[index]; const p = blockPos[index]; let things = element.things; let thingPos = element.thingPos; let blockHp = element.blockHp; let isr = blockHp.length > 1; for (let index = 0; index < things.length; index++) { const element1 = things[index]; element1.z = p; element1.x = thingPos[index]; element1.towerR = isr; element1.hp = blockHp[index]; j++; Laya.timer.frameOnce(j, this, this.Create, [element1], false); } } } Create(thing) { if (thing.type == 1 || thing.type == 2) { MoundManager.Instance.MakeMound(thing); } else { let p = GamePool.Instance.GetModel(thing.prrfabName); if (!p) return; this.BlockContainer.addChild(p); let ts = p.getComponent(Street); if (!ts) ts = p.addComponent(Street); ts.SetStreet(thing); this.blockDic.set(p.id, ts); } } RecoverStreet(sp) { this.blockDic.delete(sp.id); } StreetAtkedCube(sp) { sp.active = false; ParticleManager.Instance.ExplodeEffect(sp.transform.position); } Reset() { this.isover = false; let arr = []; for (const key in this.blockDic.container) { arr.push(key); } let j = 1; if (arr.length > 0) { for (let index = 0; index < arr.length; index++) { const element = arr[index]; let s = this.blockDic.get(element); if (s) s.Recover(); if (this.cubeBlockDic.has(element)) { Laya.timer.frameOnce(j, this, this.StreetResetCube, [element], false); j++; } } } } StreetAddCube(sp) { if (this.cubeBlockDic.has(sp.id)) return; this.cubeBlockDic.set(sp.id, sp); } StreetResetCube(id) { let sp = this.cubeBlockDic.get(id); this.cubeBlockDic.delete(id); if (!sp) return; console.log("回收CubeBlock,", sp.name); for (let index = 0; index < sp.numChildren; index++) { const element = sp.getChildAt(index); element.active = true; } } createApes() { var gap = 300; this.sp1 = new Sprite$4(); this.sp1.pos((Laya.stage.width - gap) / 2, Laya.stage.height / 2); this.sp1.pivot(55, 72); Laya.stage.addChild(this.sp1); this.sp2 = new Sprite$4(); this.sp2.pos((Laya.stage.width + gap) / 2, Laya.stage.height / 2); Laya.stage.addChild(this.sp2); Laya.timer.frameLoop(1, this, this.animate); } animate(e) { this.sp1.rotation += 2; this.sp2.rotation += 2; } CreateStreet() { let road_list = LevelController.Instance._level.road_list; if (this.curindex > road_list.length - 1) { this.isover = true; console.log("没有障碍物了"); return; } this.tarDis = this.curindex * GlobalParam.barrierRoadLength; let roadindex = road_list[this.curindex]; if (roadindex == 0) return; let roads = NetInfoManager.Instance.GetRoad(roadindex); if (!roads) return; let blocks = GameTool.SpliteString(roads["blocks"]); let blockPoss = GameTool.SpliteString(roads["position"]); let bps = []; let d = GlobalParam.barrierRoadLength / GlobalParam.barrierRoadAverageNum; blockPoss.forEach(element => { bps.push(this.tarDis + element * d); }); let bbs = []; blocks.forEach(element => { let thing = NetInfoManager.Instance.GetStreet(element); let tss = GameTool.SpliteString(thing["block_things"]); let tps = GameTool.SpliteString(thing["thing_position"]); let ths = GameTool.SpliteString(thing["block_hp"]); let ttt = []; tss.forEach(element1 => { let t = NetInfoManager.Instance.GetThing(element1); let tt = new ThingArr(t["type"], t["prefabs"], t["dynamic_type"], t["dynamic_speed"]); ttt.push(tt); }); let things = new BlockArr(ttt, tps, ths); bbs.push(things); }); let blockB = new RoadArr(bbs, bps); this.CreateSprite(blockB); } } var Vector3 = Laya.Vector3; var Quaternion = Laya.Quaternion; var Animation$1 = Laya.Animation; var Tween = Laya.Tween; class Opponent extends Laya.Script3D { constructor() { super(...arguments); this._up = new Vector3(0, 1, 0); this.isArrive1 = false; this.phoenixWidth = 550; this.phoenixHeight = 400; this.bgColorTweener = new Tween(); this.gradientInterval = 2000; this.bgColorChannels = { r: 99, g: 0, b: 0xFF }; } onAwake() { this.selfobj = this.owner; this.tran = this.selfobj.transform; this.forW = MathTool.VecZero; this.speed = GlobalParam.enemySpeed; this.quaternion1 = new Quaternion(); } Run() { if (this.isArrive1) { if (this.tarSp == null) return; if (!this.tarSp.active) { this.tarSp = RoleManager.Instance.GetTar(); if (this.tarSp == null) return; this.tarPos = this.tarSp.transform.position.clone(); } Vector3.subtract(this.tarPos, this.tran.position, this.forW); Vector3.normalize(this.forW, this.forW); this.forW = new Vector3(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed); this.tran.translate(this.forW, false); if (Vector3.distance(this.tran.position, this.tarPos) < 0.1) { return; } Quaternion.lookAt(this.tarPos, this.tran.position, this._up, this.quaternion1); this.quaternion1.invert(this.quaternion1); this.tran.rotation = this.quaternion1.clone(); } else { Vector3.subtract(this.tarPos, this.tran.position, this.forW); Vector3.normalize(this.forW, this.forW); this.forW = new Vector3(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed); this.tran.translate(this.forW, false); if (Vector3.distance(this.tran.position, this.tarPos) < 0.1) { this.tarSp = RoleManager.Instance.GetTar(); this.isArrive1 = true; if (this.tarSp == null) return; this.tarPos = this.tarSp.transform.position.clone(); return; } Quaternion.lookAt(this.tarPos, this.tran.position, this._up, this.quaternion1); this.quaternion1.invert(this.quaternion1); this.tran.rotation = this.quaternion1.clone(); } } createPhoenixes() { var scaleFactor = Math.min(Laya.stage.width / (this.phoenixWidth * 2), Laya.stage.height / this.phoenixHeight); var blendedPhoenix = this.createAnimation(); blendedPhoenix.blendMode = "lighter"; blendedPhoenix.scale(scaleFactor, scaleFactor); blendedPhoenix.y = (Laya.stage.height - this.phoenixHeight * scaleFactor) / 2; var normalPhoenix = this.createAnimation(); normalPhoenix.scale(scaleFactor, scaleFactor); normalPhoenix.x = this.phoenixWidth * scaleFactor; normalPhoenix.y = (Laya.stage.height - this.phoenixHeight * scaleFactor) / 2; } createAnimation() { var frames = []; var animation = new Animation$1(); animation.loadImages(frames); Laya.stage.addChild(animation); var clips = animation.frames.concat(); clips = clips.reverse(); animation.frames = animation.frames.concat(clips); animation.play(); return animation; } Recovery() { Laya.timer.clearAll(this); RoleManager.Instance.RecoverEnemy(this.selfobj); GamePool.Instance.RecoverModel(this.selfobj); } InitModel(tar, hp, cloth) { this.tarSp = tar; this.isArrive1 = false; if (this.tarSp == null) return; this.tarPos = this.tarSp.transform.position.clone(); if (this.tarPos.x > 0) { this.tarPos = PlaneManager.Instance.toured1.clone(); } else { this.tarPos = PlaneManager.Instance.toured2.clone(); } this.hp = hp; Laya.timer.frameLoop(1, this, this.Run); } Injured(hitpos) { this.hp -= PlayerManager.bulletAttack; if (this.hp <= 0) { this.Dead(); return; } ParticleManager.Instance.AttackEffect(hitpos); } Dead() { ParticleManager.Instance.BloodEffect(this.tran.position); this.Recovery(); RoleManager.Instance.CheckGameOver(); GameManager.Instance.roleCount++; } } var Sprite$5 = Laya.Sprite; class RoleManager { constructor() { this.frameCount = 10; this.enemyDic = new Dictionary(); } static get Instance() { return this.instance || (this.instance = new RoleManager()); } Create(hp, texture) { let e = GamePool.Instance.GetModel(GamePool.modeltype.Enemy); if (!e) return; MainRoleManager.Instance.playerContainer.addChild(e); e.transform.position = this.startPos.clone(); let ps = e.getComponent(Opponent); if (!ps) ps = e.addComponent(Opponent); let sp = this.GetTar(); ps.InitModel(sp, hp, texture); this.enemyDic.set(e.id, ps); } CheckGameOver() { if (this.enemyDic.size == 0) { MouseEvent.Instance.OnClickUp(); MainRoleManager.Instance.CreateOver(); GameManager.Instance.Congratulate(); } } GetOpponent() { for (const key in this.enemyDic.container) { const element = this.enemyDic.get(key); return element.selfobj; } return null; } Reset() { let arr = []; for (const key in this.enemyDic.container) { arr.push(key); } if (arr.length > 0) { for (let index = 0; index < arr.length; index++) { const element = arr[index]; let s = this.enemyDic.get(element); if (s) s.Recovery(); } } } CreateOpponent(startPos) { this.startPos = startPos; let count = LevelController.Instance._level.enemy; let hp = LevelController.Instance._level.enemy_hp; let texture = LevelController.Instance._level.enemy_cloth; for (let index = 0; index < count; index++) { let a = index; Laya.timer.frameOnce(a * this.frameCount, this, this.Create, [hp, texture], false); } } createCoralRect() { var coralRect = new Sprite$5(); coralRect.graphics.drawRect(0, 0, Laya.stage.width, Laya.stage.height / 2, "#FF7F50"); coralRect.name = "珊瑚色容器"; coralRect.size(Laya.stage.width, Laya.stage.height / 2); Laya.stage.addChild(coralRect); } createDeepSkyblueRect() { var deepSkyblueRect = new Sprite$5(); deepSkyblueRect.graphics.drawRect(0, 0, 100, 100, "#00BFFF"); deepSkyblueRect.name = "天蓝色矩形"; deepSkyblueRect.size(100, 100); deepSkyblueRect.pos(10, 10); Laya.stage.addChild(deepSkyblueRect); } GetTar() { let p = MainRoleManager.Instance.NearIsdead(); if (!p) { if (Math.random() > 0.5) { return MainRoleManager.Instance.playerScript.body; } else { let s = MateManager.Instance.GetSprite(); if (!s) return MainRoleManager.Instance.playerScript.body; else return s; } } else { let s = MateManager.Instance.GetSprite(); if (!s) return null; else return s; } } RecoverEnemy(sp) { this.enemyDic.delete(sp.id); } } class GameManager { constructor() { this.towerCount = 0; this.roleCount = 0; this.blockCount = 0; } static get Instance() { return GameManager.instance || (GameManager.instance = new GameManager()); } Start() { this.towerCount = 0; this.roleCount = 0; this.blockCount = 0; } Win() { WXSdk.LongVibrate(); GameManager.WINORLOSE = true; if (FYHD_Sdk.iswhite && GameManager.GameCount == 1) { ViewManager.Instance.AddView(ViewType.ExitView, true); } else { ViewManager.Instance.AddView(ViewType.CompleteView, true); } MoundManager.Instance.Reset(); StreetManager.Instance.Reset(); MateManager.Instance.Reset(); MainRoleManager.Instance.Reset(); RoleManager.Instance.Reset(); } Congratulate(isglod = false) { MainRoleManager.Instance.GoToTiaoWu(); if (isglod) MateManager.Instance.TiaoWu1(); else MateManager.Instance.TiaoWu(); CameraManager.Instance.SetCameraAction(CameraState.jump, 0.03); Laya.timer.once(4000, this, this.Win); } Over() { GuideController.Instance.GameOver(); MouseEvent.Instance.OnClickUp(); MainRoleManager.Instance.CreateOver(); MouseEvent.Instance._Switch = false; WXSdk.LongVibrate(); GameManager.WINORLOSE = false; if (FYHD_Sdk.iswhite && GameManager.GameCount == 1) { ViewManager.Instance.AddView(ViewType.ExitView, true); } else { ViewManager.Instance.AddView(ViewType.CompleteView, false); } MoundManager.Instance.Reset(); StreetManager.Instance.Reset(); MateManager.Instance.Reset(); MainRoleManager.Instance.Reset(); MainRoleManager.Instance.HidePlayer(); RoleManager.Instance.Reset(); } loadUI() { Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () { this.changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "切换Mesh")); this.changeActionButton.size(160, 40); this.changeActionButton.labelBold = true; this.changeActionButton.labelSize = 30; this.changeActionButton.sizeGrid = "4,4,4,4"; this.changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio); this.changeActionButton.pos(Laya.stage.width / 2 - this.changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio); this.changeActionButton.on(Laya.Event.CLICK, this, function () { this.index++; if (this.index % 5 === 1) { this.sphere.meshFilter.sharedMesh = this.box; } else if (this.index % 5 === 2) { this.sphere.meshFilter.sharedMesh = this.capsule; } else if (this.index % 5 === 3) { this.sphere.meshFilter.sharedMesh = this.cylinder; } else if (this.index % 5 === 3) { this.sphere.meshFilter.sharedMesh = this.cone; } else { this.sphere.meshFilter.sharedMesh = this.sphereMesh; } }); })); } Near() { MoundManager.Instance.Reset(); StreetManager.Instance.Reset(); } ReStart() { MateManager.Instance.Reset(); Scene3DManager.Instance.InItScene(); DispatcherManager.event(EventType.Event.ShowMainUi); DispatcherManager.event(EventType.Event.SetStagePro, 0); } LevelUp() { PlayerManager.Instance.stage++; Scene3DManager.Instance.InItScene(); ViewManager.Instance.CloseView(ViewType.CompleteView); DispatcherManager.event(EventType.Event.ShowMainUi); DispatcherManager.event(EventType.Event.SetStage); DispatcherManager.event(EventType.Event.SetStagePro, 0); } } GameManager.GameNum = 0; GameManager.WINORLOSE = false; GameManager.GameCount = 0; class Mound extends Laya.Script3D { constructor() { super(...arguments); this.guideSteps = [ { x: 151, y: 575, radius: 150, tip: "res/guide/help6.png", tipx: 200, tipy: 250 }, { x: 883, y: 620, radius: 100, tip: "res/guide/help4.png", tipx: 730, tipy: 380 }, { x: 1128, y: 583, radius: 110, tip: "res/guide/help3.png", tipx: 900, tipy: 300 } ]; this.guideStep = 0; } onAwake() { this.selfobj = this.owner; this.tran = this.selfobj.transform; this.FriendSpawnPoint = this.selfobj.getChildByName("FriendSpawnPoint").transform; this.HealthText = this.selfobj.getChildByName("HealthText").transform; let we = this.selfobj.getChildByName("WallsEnd"); this.WallsEnd = we.transform; this._reflect = we.getChildAt(0).meshRenderer.material; } HpUi() { let p = MatrixTransform.WorldToScreen2(this._camera, this.HealthText.position.clone()); if (p.x <= 0 || p.x >= Laya.stage.width || p.y <= 0 || p.y >= Laya.stage.height) this.hpText.visible = false; else { if (!this.hpText.visible) this.hpText.visible = true; this.hpText.x = p.x; this.hpText.y = p.y; } } CheckHp() { if (this.tarTran.localPositionZ - this.tran.localPositionZ >= 5) { this.Recovery(); return; } this.HpUi(); } nextStep() { if (this.guideStep == this.guideSteps.length) { Laya.stage.removeChild(this.guideContainer); Laya.stage.removeChild(this.tipContainer); } else { var step = this.guideSteps[this.guideStep++]; this.hitArea.unHit.clear(); this.hitArea.unHit.drawCircle(step.x, step.y, step.radius, "#000000"); this.interactionArea.graphics.clear(); this.interactionArea.graphics.drawCircle(step.x, step.y, step.radius, "#000000"); this.tipContainer.graphics.clear(); this.tipContainer.loadImage(step.tip); this.tipContainer.pos(step.tipx, step.tipy); } } MakeMate() { this._mate = MateManager.Instance.MadeMate(this.FriendSpawnPoint); } Rescue() { if (this._mate) { this._mate.FallDown(); this._mate = null; } } ReflectSet() { this._reflect.albedoIntensity = 4; Laya.timer.once(100, this, () => { this._reflect.albedoIntensity = 1; }); } Recovery() { Laya.timer.clearAll(this); if (this.hpText) { GamePool.Instance.RecoverUi(PoolType.HpText, this.hpText); this.hpText = null; } this._reflect.albedoIntensity = 1; MoundManager.Instance.RecoverMound(this.selfobj); GamePool.Instance.RecoverModel(this.selfobj); if (this._mate) { this._mate.Recover(); this._mate = null; } } Injured(hitpos) { this._hp -= PlayerManager.bulletAttack; if (this._hp <= 0) { this.Rescue(); ParticleManager.Instance.ExplodeEffect(this.tran.position); this.Recovery(); GameManager.Instance.towerCount++; return; } ParticleManager.Instance.AttackEffect(hitpos); let t = Math.ceil(this._hp); this.hpText.text = t.toString(); this.ReflectSet(); } SetMound(data) { this._mate = null; this.tarTran = MainRoleManager.Instance.player.transform; this.tran.localPositionX = data.x; this.tran.localPositionY = 0; this.tran.localPositionZ = data.z; if (data.towerR) this.WallsEnd.localRotationEulerY = 30; else this.WallsEnd.localRotationEulerY = 0; if (data.type == 1) { this.MakeMate(); } this._hp = data.hp; if (!this.hpText) { this.hpText = MoundManager.Instance.HpUi(); this.hpText.text = this._hp.toString(); if (!this._camera) this._camera = CameraManager.Instance._maincamera; ViewManager.Instance.popNode.addChild(this.hpText); } this.HpUi(); Laya.timer.frameLoop(1, this, this.CheckHp); } } var Vector3$1 = Laya.Vector3; var Sprite$6 = Laya.Sprite; class MainRoleShot extends Laya.Script3D { constructor() { super(...arguments); this.speed = MathTool.VecZero; this._forward = new Vector3$1(0, 0, 1); this.over = false; } onAwake() { this.selfobj = this.owner; this.tran = this.selfobj.transform; this.rayPoint = this.selfobj.getChildByName("rayPoint").transform; this.speed.z = GlobalParam.shootspeed; } Run() { this.tran.translate(this.speed); let d = Vector3$1.distance(this.tarTran.position, this.tran.position); if (d >= GlobalParam.bulletMaxDis) { this.RecoverBullet(); return; } this.RayReset(); } RecoverBullet() { Laya.timer.clearAll(this); GamePool.Instance.RecoverModel(this.selfobj); GamePool.bulletCount--; } drawSomething() { this.sp = new Sprite$6(); Laya.stage.addChild(this.sp); this.sp.graphics.drawLine(10, 58, 146, 58, "#ff0000", 3); this.sp.graphics.drawLines(176, 58, [0, 0, 39, -50, 78, 0, 117, 50, 156, 0], "#ff0000", 5); this.sp.graphics.drawCurves(352, 58, [0, 0, 19, -100, 39, 0, 58, 100, 78, 0, 97, -100, 117, 0, 136, 100, 156, 0], "#ff0000", 5); this.sp.graphics.drawRect(10, 166, 166, 90, "#ffff00"); this.sp.graphics.drawPoly(264, 166, [0, 0, 60, 0, 78.48, 57, 30, 93.48, -18.48, 57], "#ffff00"); this.sp.graphics.drawPoly(400, 166, [0, 100, 50, 0, 100, 100], "#ffff00"); this.sp.graphics.drawCircle(98, 332, 50, "#00ffff"); this.sp.graphics.drawPie(240, 290, 100, 10, 60, "#00ffff"); this.sp.graphics.drawPath(400, 310, [["moveTo", 5, 0], ["lineTo", 105, 0], ["arcTo", 110, 0, 110, 5, 5], ["lineTo", 110, 55], ["arcTo", 110, 60, 105, 60, 5], ["lineTo", 5, 60], ["arcTo", 0, 60, 0, 55, 5], ["lineTo", 0, 5], ["arcTo", 0, 0, 5, 0, 5], ["closePath"]], { fillStyle: "#00ffff" }); } RayReset() { let origP = this.rayPoint.position.clone(); if (!this._scene) { this._scene = Scene3DManager.Instance.MainScene; } if (!this.ray) { if (!this.forward) this.forward = MathTool.VecZero; this.ray = new Laya.Ray(MathTool.VecZero, this._forward); this.outHit = new Laya.HitResult(); } this.ray.origin = origP; if (this.over) { this.tran.getForward(this.forward); this.forward.x = -this.forward.x; this.forward.y = -this.forward.y; this.forward.z = -this.forward.z; this.ray.direction = this.forward; } else { this.ray.direction = this._forward; } let isHItF = this._scene.physicsSimulation.rayCast(this.ray, this.outHit, GlobalParam.bulletRayLength); if (isHItF) { let obj = this.outHit.collider.owner; if (obj.layer == ColliderGroup.mound) { let tower = obj.getComponent(Mound); if (tower) { tower.Injured(this.outHit.point); } } else if (obj.layer == ColliderGroup.opponent) { let tower = obj.getComponent(Opponent); if (tower) { tower.Injured(this.outHit.point); } } else if (obj.layer == ColliderGroup.obstacle1 || obj.layer == ColliderGroup.obstacle2 || obj.layer == ColliderGroup.obstacle3) { StreetManager.Instance.StreetAtkedCube(obj); GameManager.Instance.blockCount++; } else { ParticleManager.Instance.AttackEffect(this.outHit.point); } this.RecoverBullet(); return; } } Start(tarTran, isover = false) { this.tarTran = tarTran; this.over = isover; Laya.timer.frameLoop(1, this, this.Run); } } var Vector3$2 = Laya.Vector3; var Quaternion$1 = Laya.Quaternion; var Sprite$7 = Laya.Sprite; var Text$2 = Laya.Text; class Mate extends Laya.Script3D { constructor() { super(...arguments); this._up = new Vector3$2(0, 1, 0); this.isreturn = false; this.isover = false; this.isClickCom = true; this.isStop = true; this.texture1 = "res/apes/monkey2.png"; this.texture2 = "res/apes/monkey3.png"; this.flag = false; this.isFristShoot = true; this.ts = new Vector3$2(0, 0, 0.01); } onAwake() { this.selfobj = this.owner; this.tran = this.selfobj.transform; this.animator = this.selfobj.getChildAt(0).getComponent(Laya.Animator); this.rayPoint = this.selfobj.getChildByName("rayPoint").transform; this.bulletPos = this.selfobj.getChildByName("bulletPos").transform; this.forW = MathTool.VecZero; this.speed = GlobalParam.matespeed; this.quaternion1 = new Quaternion$1(); } setup() { var textBox = new Sprite$7(); var text; for (var i = 0; i < 1000; i++) { text = new Text$2(); text.fontSize = 20; text.text = (Math.random() * 100).toFixed(0); text.rotation = Math.random() * 360; text.color = "#CCCCCC"; text.x = Math.random() * Laya.stage.width; text.y = Math.random() * Laya.stage.height; textBox.addChild(text); } textBox.cacheAs = "bitmap"; Laya.stage.addChild(textBox); } TrialAdd(dataPar) { this.AnimatorPlayByType(MusicType.Idle, 1); this.dataPar = dataPar; this.dataPar["ishave"] = true; this.isClickCom = true; this.isStop = true; this.isreturn = true; this.isover = false; MateManager.Instance.AddModelToDic(this.selfobj.id, this); this.ShootFunc(); if (MainRoleManager.Instance.IsShoot()) this.CreateShoot(); Laya.timer.frameLoop(1, this, this.Move); } SetTar() { this.isreturn = false; this.isClickCom = true; this.isStop = true; this.isover = false; this.AnimatorPlayByType(MusicType.Idle, 1); DispatcherManager.off(EventType.Event.StopShot, this, this.StopCreate); } FallDown() { let tween = Laya.Tween.to(this.tran, { localPositionY: 0 }, 400, Laya.Ease.quintIn, Laya.Handler.create(this, () => { let dataPar = MainRoleManager.Instance.GetMatePos(); if (!dataPar) { console.warn("friendPar没有位置了"); return; } this.dataPar = dataPar; this.dataPar["ishave"] = true; this.tar = this.dataPar["sp"]; this.tarTra = this.tar.transform; tween.clear(); this.Start(); }, null, false)); } Start() { this.AnimatorPlayByType(MusicType.RunAndGun, 2); this.isreturn = false; this.isClickCom = true; this.isStop = true; this.isover = false; Laya.timer.frameLoop(1, this, this.Move); } ArriveTarPos() { this.isClickCom = true; this.isStop = true; this.isreturn = true; this.tar.addChild(this.selfobj); this.tran.localPosition = MathTool.VecZero; this.AnimatorPlayByType(MusicType.RunAndGun, 2); MateManager.Instance.AddModelToDic(this.selfobj.id, this); let tween = Laya.Tween.to(this.tran, { localRotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => { tween.clear(); this.tran.localRotationEuler = MathTool.VecZero; this.ShootFunc(); this.CreateShoot(); }, null, false)); } RayReset() { let origP = this.rayPoint.position; if (!this._scene) { this._scene = Scene3DManager.Instance.MainScene; } if (!this.rayF) { this.rayF = new Laya.Ray(MathTool.VecZero, new Vector3$2(0, 0, 1)); this.outHitF = new Laya.HitResult(); } this.rayF.origin = origP; let isHItF = this._scene.physicsSimulation.rayCast(this.rayF, this.outHitF, GlobalParam.playerRayLengthF); if (isHItF) { let obj = this.outHitF.collider.owner; this.Dead(this.outHitF.point); return; } if (!this.rayL) { this.rayL = new Laya.Ray(MathTool.VecZero, new Vector3$2(1, 0, 0)); this.outHitL = new Laya.HitResult(); } this.rayL.origin = origP; let isHItL = this._scene.physicsSimulation.rayCast(this.rayL, this.outHitL, GlobalParam.playerRayLengthLR); if (isHItL) { let obj = this.outHitL.collider.owner; this.Dead(this.outHitL.point); return; } if (!this.rayR) { this.rayR = new Laya.Ray(MathTool.VecZero, new Vector3$2(-1, 0, 0)); this.outHitR = new Laya.HitResult(); } this.rayR.origin = origP; let isHItR = this._scene.physicsSimulation.rayCast(this.rayR, this.outHitR, GlobalParam.playerRayLengthLR); if (isHItR) { let obj = this.outHitR.collider.owner; this.Dead(this.outHitR.point); return; } } createApes() { this.ape1 = new Sprite$7(); this.ape2 = new Sprite$7(); this.ape1.loadImage("res/apes/monkey2.png"); this.ape2.loadImage("res/apes/monkey2.png"); this.ape1.pivot(55, 72); this.ape2.pivot(55, 72); this.ape1.pos(Laya.stage.width / 2, Laya.stage.height / 2); this.ape2.pos(200, 0); Laya.stage.addChild(this.ape1); this.ape1.addChild(this.ape2); Laya.timer.frameLoop(1, this, this.animate); } animate(e) { this.ape1.rotation += 2; this.ape2.rotation -= 4; } Move() { if (this.isreturn) { this.RayReset(); return; } let tarPos = this.tarTra.position.clone(); Vector3$2.subtract(tarPos, this.tran.position, this.forW); Vector3$2.normalize(this.forW, this.forW); this.forW = new Vector3$2(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed); this.tran.translate(this.forW, false); if (Vector3$2.distance(this.tran.position, tarPos) < 0.1) { this.ArriveTarPos(); return; } Quaternion$1.lookAt(tarPos, this.tran.position, this._up, this.quaternion1); this.quaternion1.invert(this.quaternion1); Quaternion$1.slerp(this.tran.rotation, this.quaternion1, 0.1, this.quaternion1); this.tran.rotation = this.quaternion1.clone(); } AnimatorPlayByType(clip, speed, callback) { this.animator.play(clip); if (!speed) speed = 1; this.animator.speed = speed; } ShootFunc() { DispatcherManager.on(EventType.Event.StopShot, this, this.StopCreate); } LoopCreate() { if (this.isStop) { Laya.timer.clear(this, this.LoopCreate); this.isClickCom = true; return; } this._CreateShoot(); } CreateShoot() { this.isStop = false; if (!this.isClickCom) return; this.isClickCom = false; this._CreateShoot(); Laya.timer.loop(PlayerManager.bulletTime * 2 * 1000, this, this.LoopCreate); } _CreateShoot() { let bu = GamePool.Instance.GetModel(GamePool.modeltype.PlayerShoot); if (bu) { Scene3DManager.Instance.bulletCon.addChild(bu); bu.transform.position = this.bulletPos.position.clone(); bu.transform.localRotationEuler = this.bulletPos.rotationEuler.clone(); let pb = bu.getComponent(MainRoleShot); if (!pb) pb = bu.addComponent(MainRoleShot); pb.Start(this.bulletPos, this.isover); } } StopCreate() { this.isStop = true; } Dead(pos) { if (this.dataPar) this.dataPar["ishave"] = false; ParticleManager.Instance.BloodEffect(pos); MateManager.Instance.RemoveModelToDic(this.selfobj); this.Recover(); MainRoleManager.Instance.CheckGameOver(); } SetPar() { let t = this.tran.position.clone(); MainRoleManager.Instance.playerContainer.addChild(this.selfobj); this.tran.position = t.clone(); } TiaoWu(sp) { this.AnimatorPlayByType(MusicType.RunAndGun, 2); this.danceP = sp.position.clone(); this.r = sp.rotationEuler.clone(); Laya.timer.frameLoop(1, this, this._TiaoWu); } _TiaoWu() { Vector3$2.subtract(this.danceP, this.tran.position, this.forW); Vector3$2.normalize(this.forW, this.forW); this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15); this.tran.translate(this.forW); if (Vector3$2.distance(this.tran.position, this.danceP) < 0.15) { Laya.timer.clear(this, this._TiaoWu); this.tran.position = this.danceP.clone(); this.tran.rotationEuler = this.r.clone(); this.AnimatorPlayByType(MusicType.Dance, 1); return; } Quaternion$1.lookAt(this.danceP, this.tran.position, this._up, this.quaternion1); this.quaternion1.invert(this.quaternion1); this.tran.rotation = this.quaternion1.clone(); } onAssetsLoaded() { this.ape = new Sprite$7(); Laya.stage.addChild(this.ape); this.ape.pivot(55, 72); this.ape.pos(Laya.stage.width / 2, Laya.stage.height / 2); } Attack() { Laya.timer.clear(this, this._Defense); this.isover = true; this.isFristShoot = true; this.enemyTar = null; Laya.timer.frameLoop(1, this, this._attack); } _attack() { if (this.enemyTar == null) { this.enemyTar = RoleManager.Instance.GetOpponent(); if (this.enemyTar != null) { this.ATKp = this.enemyTar.transform.position.clone(); Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1); this.quaternion1.invert(this.quaternion1); this.tran.rotation = this.quaternion1.clone(); } } else { if (!this.enemyTar.active) { this.enemyTar = RoleManager.Instance.GetOpponent(); if (this.enemyTar != null) { this.ATKp = this.enemyTar.transform.position.clone(); Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1); this.quaternion1.invert(this.quaternion1); this.tran.rotation = this.quaternion1.clone(); } } if (this.enemyTar == null) { this.StopCreate(); this.isFristShoot = true; return; } if (this.isFristShoot) { this.isFristShoot = false; this.CreateShoot(); } this.ATKp = this.enemyTar.transform.position.clone(); Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1); this.quaternion1.invert(this.quaternion1); this.tran.rotation = this.quaternion1.clone(); } } _Defense() { Vector3$2.subtract(this.tp, this.tran.position, this.forW); Vector3$2.normalize(this.forW, this.forW); this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15); this.tran.translate(this.forW, false); if (Vector3$2.distance(this.tran.position, this.tp) < 0.1) { Laya.timer.clear(this, this._Defense); let tween = Laya.Tween.to(this.tran, { localRotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => { tween.clear(); }, null, false)); return; } Quaternion$1.lookAt(this.tp, this.tran.position, this._up, this.quaternion1); this.quaternion1.invert(this.quaternion1); this.tran.rotation = this.quaternion1.clone(); } Defense(pos) { this.SetPar(); this.tp = pos; Quaternion$1.lookAt(pos, this.tran.position, this._up, this.quaternion1); this.quaternion1.invert(this.quaternion1); this.tran.rotation = this.quaternion1.clone(); this.AnimatorPlayByType(MusicType.CrouchFiring, 1); Laya.timer.frameLoop(1, this, this._Defense); } Recover() { if (this.dataPar) { this.dataPar["ishave"] = false; this.dataPar = null; } MateManager.Instance.RecoverMateModel(this.selfobj); MateManager.Instance.RemoveModelToDic(this.selfobj); Laya.timer.clearAll(this); Laya.Tween.clearAll(this); DispatcherManager.off(EventType.Event.StopShot, this, this.StopCreate); GamePool.Instance.RecoverModel(this.selfobj); } } var Rectangle$1 = Laya.Rectangle; class MateManager { constructor() { this.ApePath = "res/apes/monkey2.png"; this.v3 = MathTool.VecZero; this.friendDic = new Dictionary(); this.getDic = new Dictionary(); } static get Instance() { return this.instance || (this.instance = new MateManager()); } Trial() { for (let index = 0; index < 3; index++) { Laya.timer.frameOnce(index, this, this._createtrialmodel, null, false); } } TrialModelPlayAni() { for (const key in this.friendDic.container) { const element = this.friendDic.get(key); element.CreateShoot(); element.AnimatorPlayByType(MusicType.RunAndGun, 2); } } RecoverMateModel(sp) { this.friendDic.delete(sp.id); } AddModelToDic(id, fr) { this.getDic.set(id, fr); } RemoveModelToDic(sp) { this.getDic.delete(sp.id); } MadeMate(tra) { let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId); if (p) { p.transform.position = tra.position.clone(); p.transform.rotationEuler = tra.rotationEuler.clone(); MainRoleManager.Instance.playerContainer.addChild(p); let ps = p.getComponent(Mate); if (!ps) ps = p.addComponent(Mate); ps.SetTar(); this.friendDic.set(p.id, ps); return ps; } return null; } showDragRegion() { var dragWidthLimit = 350; var dragHeightLimit = 200; this.dragRegion = new Rectangle$1(Laya.stage.width - dragWidthLimit >> 1, Laya.stage.height - dragHeightLimit >> 1, dragWidthLimit, dragHeightLimit); Laya.stage.graphics.drawRect(this.dragRegion.x, this.dragRegion.y, this.dragRegion.width, this.dragRegion.height, null, "#FFFFFF", 2); } onStartDrag(e) { this.ape.startDrag(this.dragRegion, true, 100); } NearDestination() { return this.getDic.size; } Near(count, zs) { if (count == 1) { for (const key in this.getDic.container) { const element = this.getDic.get(key); this.v3.x = 0; element.Defense(this.v3.clone()); } return; } let len = 2 * GlobalParam.arriveStandWidth; let avr = len / (count - 1); let index = 0; this.v3.z = zs; for (const key in this.getDic.container) { const element = this.getDic.get(key); this.v3.x = GlobalParam.arriveStandWidth - index * avr; element.Defense(this.v3.clone()); index++; } } Attack() { for (const key in this.getDic.container) { const element = this.getDic.get(key); element.Attack(); } } GetSprite() { let count = this.getDic.size; let a = GameTool.randomInt(1, count); let tindex = 1; for (const key in this.getDic.container) { if (tindex == a) { const element = this.getDic.get(key); return element.selfobj; } tindex++; } return null; } TiaoWu() { for (const key in this.getDic.container) { let t = PlaneManager.Instance.GetWuDaoPosition(); if (!t) return; const element = this.getDic.get(key); element.TiaoWu(t); } } Reset() { let arr = []; for (const key in this.friendDic.container) { arr.push(key); } if (arr.length > 0) { for (let index = 0; index < arr.length; index++) { const element = arr[index]; let s = this.friendDic.get(element); if (s) s.Recover(); } } console.log("this.friendDic.size", this.friendDic.size); this.getDic.clear(); } TiaoWu1() { for (const key in this.getDic.container) { let t = PlaneManager.Instance.GetWuDaoPosition(); const element = this.getDic.get(key); element.SetPar(); if (t) { element.TiaoWu(t); } } } _createtrialmodel() { let dataPar = MainRoleManager.Instance.GetMatePos(); if (!dataPar) { console.warn("friendPar没有位置了"); return; } let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId); if (p) { let tar = dataPar["sp"]; tar.addChild(p); p.transform.localPosition = MathTool.VecZero; p.transform.localRotationEuler = MathTool.VecZero; let ps = p.getComponent(Mate); if (!ps) ps = p.addComponent(Mate); ps.TrialAdd(dataPar); this.friendDic.set(p.id, ps); } } } var Sprite$8 = Laya.Sprite; var Text$3 = Laya.Text; class PlaneManager { constructor() { this.airisshow = false; this.danceindex = 0; } static get Instance() { return this.instance || (this.instance = new PlaneManager()); } Init(finalP) { if (!finalP) { console.error("飞机不存在"); return; } this.finalTra = finalP.transform; this.jumpCamTra = finalP.getChildByName("jumpCamPos").transform; this.FinalBlock = finalP.getChildAt(0); this.EnemySpawnPoint = this.FinalBlock.getChildByName("EnemySpawnPoint").transform; this.PlayerDancePoint = this.FinalBlock.getChildByName("PlayerDancePoint"); this.helicopter = this.FinalBlock.getChildByName("helicopter"); this.toured = this.FinalBlock.getChildByName("toured").transform; this.FinalBlock.active = false; } SetAir() { this.danceindex = 0; this.airisshow = false; this.FinalBlock.active = false; let count = LevelController.Instance._level.road_list.length; this.winPos = (count) * GlobalParam.barrierRoadLength; this.finalTra.localPositionZ = this.winPos; this.stageProLen = this.winPos - MainRoleManager.Instance.playerStartTra.localPositionZ; let isgold = LevelController.Instance._level.isgold; this.helicopter.active = isgold; this.toured1 = this.FinalBlock.getChildByName("toured1").transform.position.clone(); this.toured2 = this.FinalBlock.getChildByName("toured2").transform.position.clone(); } createDarkOrchidRect() { var darkOrchidRect = new Sprite$8(); darkOrchidRect.name = "暗紫色矩形容器"; darkOrchidRect.graphics.drawRect(-100, -100, 200, 200, "#9932CC"); darkOrchidRect.pos(Laya.stage.width / 2, Laya.stage.height / 2); Laya.stage.addChild(darkOrchidRect); darkOrchidRect.mouseThrough = true; } createLogger() { this.logger = new Text$3(); this.logger.size(Laya.stage.width, Laya.stage.height); this.logger.align = 'right'; this.logger.fontSize = 20; this.logger.color = "#FFFFFF"; Laya.stage.addChild(this.logger); } CheckPlayerRoadPos(_zp) { let d = this.winPos - _zp; if (d <= 60 && !this.airisshow) { this.ShowAir(); return; } DispatcherManager.event(EventType.Event.SetStagePro, (this.stageProLen - d) / this.stageProLen); if (d <= 0) { this.NearDestination(); } } ShowAir() { this.airisshow = true; this.FinalBlock.active = true; } NearDestination() { MainRoleManager.Instance.Destination(); if (LevelController.Instance._level.isgold) { GameManager.Instance.Congratulate(true); } else { let count = 0; let isdesd = MainRoleManager.Instance.NearIsdead(); if (!isdesd) { count++; } let num = MateManager.Instance.NearDestination(); count += num; if (count == 0) return; MateManager.Instance.Near(count, this.toured.position.z); if (!isdesd) MainRoleManager.Instance.Near(count, this.toured.position.z); Laya.timer.once(1300, this, this.CreateOpponent); } } CreateOpponent() { MainRoleManager.Instance.Attack(); MateManager.Instance.Attack(); RoleManager.Instance.CreateOpponent(this.EnemySpawnPoint.position.clone()); } GetWuDaoPosition() { if (this.danceindex > this.PlayerDancePoint.numChildren - 1) return null; let t = this.PlayerDancePoint.getChildAt(this.danceindex).transform; this.danceindex++; return t; } } var Vector3$3 = Laya.Vector3; var Quaternion$2 = Laya.Quaternion; var Sprite$9 = Laya.Sprite; class MainRole extends Laya.Script3D { constructor() { super(...arguments); this.isarrive = false; this.isdead = false; this.isFristShoot = true; this._up = new Vector3$3(0, 1, 0); this.ts = new Vector3$3(0, 0, 0.01); } onAwake() { this.selfobj = this.owner; this._transform = this.selfobj.transform; this.body = this.selfobj.getChildAt(0); this.animator = this.body.getComponent(Laya.Animator); this.rayPoint = this.selfobj.getChildByName("rayPoint").transform; this.shootPos = this.selfobj.getChildByName("bulletPos").transform; this._speed = MathTool.VecZero; this._speed.z = GlobalParam.playerspeed; this.forW = MathTool.VecZero; this.quaternion1 = new Quaternion$2(); } Move() { if (this.isarrive) { if (this.isdead) return; this.RayReset(); return; } this._transform.translate(this._speed); let pz = this._transform.localPositionZ; ConstructManager.Instance.CheckMainRolePos(pz); PlaneManager.Instance.CheckPlayerRoadPos(pz); StreetManager.Instance.CheckPlayerRoadPos(pz); CameraManager.Instance.CameraFollow(pz); if (this.isdead) return; this.RayReset(); } Near() { this.isarrive = true; } Start() { this.isdead = false; this.isarrive = false; Laya.timer.frameLoop(1, this, this.Move); } drawPentagram() { var canvas = new Sprite$9(); Laya.stage.addChild(canvas); var path = []; path.push(0, -130); path.push(33, -33); path.push(137, -30); path.push(55, 32); path.push(85, 130); path.push(0, 73); path.push(-85, 130); path.push(-55, 32); path.push(-137, -30); path.push(-33, -33); canvas.graphics.drawPoly(Laya.stage.width / 2, Laya.stage.height / 2, path, "#FF7F50"); } PlayAni(clip, speed, callback) { this.animator.play(clip); if (!speed) speed = 1; this.animator.speed = speed; } Slider(x) { this._transform.localPositionX += x; let px = this._transform.localPositionX; let abs = Math.abs(px); if (abs > GlobalParam.playerMoveMaxX) { if (px > 0) this._transform.localPositionX = GlobalParam.playerMoveMaxX; else this._transform.localPositionX = -GlobalParam.playerMoveMaxX; } } CreateBullet() { if (this.isdead) return null; return this.shootPos; } Dead(pos) { this.isdead = true; this.body.active = false; ParticleManager.Instance.BloodEffect(pos); MainRoleManager.Instance.CheckGameOver(true); } Reset() { this.body.active = true; this.PlayAni(MusicType.Idle, 1); Laya.timer.clearAll(this); } RayReset() { let origP = this.rayPoint.position; if (!this._scene) { this._scene = Scene3DManager.Instance.MainScene; } if (!this.rayF) { this.rayF = new Laya.Ray(MathTool.VecZero, new Vector3$3(0, 0, 1)); this.outHitF = new Laya.HitResult(); } this.rayF.origin = origP; let isHItF = this._scene.physicsSimulation.rayCast(this.rayF, this.outHitF, GlobalParam.playerRayLengthF); if (isHItF) { let obj = this.outHitF.collider.owner; this.Dead(this.outHitF.point); return; } if (!this.rayL) { this.rayL = new Laya.Ray(MathTool.VecZero, new Vector3$3(1, 0, 0)); this.outHitL = new Laya.HitResult(); } this.rayL.origin = origP; let isHItL = this._scene.physicsSimulation.rayCast(this.rayL, this.outHitL, GlobalParam.playerRayLengthLR); if (isHItL) { let obj = this.outHitL.collider.owner; this.Dead(this.outHitL.point); return; } if (!this.rayR) { this.rayR = new Laya.Ray(MathTool.VecZero, new Vector3$3(-1, 0, 0)); this.outHitR = new Laya.HitResult(); } this.rayR.origin = origP; let isHItR = this._scene.physicsSimulation.rayCast(this.rayR, this.outHitR, GlobalParam.playerRayLengthLR); if (isHItR) { let obj = this.outHitR.collider.owner; this.Dead(this.outHitR.point); return; } } setup() { var bg = new Sprite$9(); bg.loadImage("res/bg2.png"); Laya.stage.addChild(bg); this.bg2 = new Sprite$9(); this.bg2.loadImage("res/bg2.png"); Laya.stage.addChild(this.bg2); this.bg2.scale(3, 3); this.maskSp = new Sprite$9(); this.maskSp.loadImage("res/mask.png"); this.maskSp.pivot(50, 50); this.bg2.mask = this.maskSp; } _attack() { if (this.isdead) return; if (this.enemyTar == null) { this.enemyTar = RoleManager.Instance.GetOpponent(); if (this.enemyTar != null) { this.tp = this.enemyTar.transform.position.clone(); Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1); this.quaternion1.invert(this.quaternion1); this._transform.rotation = this.quaternion1.clone(); } } else { if (!this.enemyTar.active) { this.enemyTar = RoleManager.Instance.GetOpponent(); if (this.enemyTar != null) { this.tp = this.enemyTar.transform.position.clone(); Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1); this.quaternion1.invert(this.quaternion1); this._transform.rotation = this.quaternion1.clone(); } } if (this.enemyTar == null) { MainRoleManager.Instance.CreateOver(true); this.isFristShoot = true; return; } if (this.isFristShoot) { this.isFristShoot = false; MainRoleManager.Instance.CreateShoot(true); } this.tp = this.enemyTar.transform.position.clone(); Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1); this.quaternion1.invert(this.quaternion1); this._transform.rotation = this.quaternion1.clone(); } } TiaoWu(sp) { this.PlayAni(MusicType.RunAndGun, 2); this.dancepos = sp.position.clone(); this.r = sp.rotationEuler.clone(); Laya.timer.frameLoop(1, this, this.PlayWuDao); } PlayWuDao() { Vector3$3.subtract(this.dancepos, this._transform.position, this.forW); Vector3$3.normalize(this.forW, this.forW); this.forW = new Vector3$3(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15); this._transform.translate(this.forW); if (Vector3$3.distance(this._transform.position, this.dancepos) < 0.15) { Laya.timer.clear(this, this.PlayWuDao); this._transform.position = this.dancepos.clone(); this._transform.rotationEuler = this.r.clone(); this.PlayAni(MusicType.Dance, 1); return; } Quaternion$2.lookAt(this.dancepos, this._transform.position, this._up, this.quaternion1); this.quaternion1.invert(this.quaternion1); this._transform.rotation = this.quaternion1.clone(); } Defense(pos) { if (this.isdead) return; this.tp = pos; Quaternion$2.lookAt(pos, this._transform.position, this._up, this.quaternion1); this.quaternion1.invert(this.quaternion1); this._transform.rotation = this.quaternion1.clone(); this.PlayAni(MusicType.CrouchFiring, 1); Laya.timer.frameLoop(1, this, this._Defense); } _Defense() { Vector3$3.subtract(this.tp, this._transform.position, this.forW); Vector3$3.normalize(this.forW, this.forW); this.forW = new Vector3$3(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15); this._transform.translate(this.forW); if (Vector3$3.distance(this._transform.position, this.tp) < 0.1) { Laya.timer.clear(this, this._Defense); return; } Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1); this.quaternion1.invert(this.quaternion1); this._transform.rotation = this.quaternion1.clone(); } Attack() { Laya.timer.clear(this, this._Defense); this.isFristShoot = true; this.enemyTar = null; Laya.timer.frameLoop(1, this, this._attack); } } var Vector3$4 = Laya.Vector3; var Text$4 = Laya.Text; var HScrollBar = Laya.HScrollBar; var VScrollBar = Laya.VScrollBar; class MainRoleManager { constructor() { this.isover = false; this.isClickCom = true; this.isend = true; } static get Instance() { return this.instance || (this.instance = new MainRoleManager()); } Init(startPos, playerCon) { this.playerStartTra = startPos.transform; this.playerContainer = playerCon; } ChangeModel() { if (this.player) GamePool.Instance.RecoverModel(this.player); let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId); if (p) { this.player = p; this.SetMatePos(p); this.playerTra = this.player.transform; this.playerTra.position = this.playerStartTra.position.clone(); this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone(); this.playerContainer.addChild(this.player); let ps = this.player.getComponent(MainRole); if (ps) this.playerScript = ps; else this.playerScript = this.player.addComponent(MainRole); } } SetMatePos(player) { this.MateArrPosition = []; let par = player.getChildByName("FriendSpawPos"); if (!par) console.error("friend父物体不存在"); for (let index = 0; index < par.numChildren; index++) { let data = {}; data["ishave"] = false; data["sp"] = par.getChildAt(index); this.MateArrPosition.push(data); } } GetMatePos() { for (let index = 0; index < this.MateArrPosition.length; index++) { const element = this.MateArrPosition[index]; if (!element["ishave"]) return element; } return null; } createTexts() { var t1 = this.createText(); t1.overflow = Text$4.VISIBLE; t1.pos(10, 10); var t2 = this.createText(); t2.overflow = Text$4.SCROLL; t2.pos(10, 110); var t3 = this.createText(); t3.overflow = Text$4.HIDDEN; t3.pos(10, 210); } createText() { var txt = new Text$4(); txt.text = "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!\n" + "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!\n" + "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!"; txt.borderColor = "#FFFF00"; txt.size(300, 50); txt.fontSize = 20; txt.color = "#ffffff"; Laya.stage.addChild(txt); return txt; } PlayerSlip(offsetX) { let x = offsetX.toFixed(2); let x1 = Number(x) * GlobalParam.sliderFactor; if (this.playerScript) this.playerScript.Slider(x1); } CreateOver(isgameover = false) { this.isend = true; if (!isgameover) DispatcherManager.event(EventType.Event.StopShot); } IsShoot() { return !this.isend; } Destination() { MouseEvent.Instance.OnClickUp(); MainRoleManager.Instance.CreateOver(); MouseEvent.Instance._Switch = false; GameManager.Instance.Near(); if (!this.playerScript) return; this.playerScript.Near(); } NearIsdead() { if (!this.playerScript) return true; return this.playerScript.isdead; } Near(count, z) { if (!this.playerScript) return; if (count == 1) { this.playerScript.Defense(new Vector3$4(0, 0, z)); } else { this.playerScript.Defense(new Vector3$4(-GlobalParam.arriveStandWidth, 0, z)); } } Attack() { if (!this.playerScript) return; this.isover = true; this.playerScript.Attack(); } CreateShoot(isgameover = false) { if (!this.playerScript) return; this.isend = false; if (!this.isClickCom) return; console.log("开始创建子弹"); this.isClickCom = false; this._CreateShoot(); Laya.timer.loop(PlayerManager.bulletTime * 1000, this, this._Loop); } _Loop() { if (this.isend) { Laya.timer.clear(this, this._Loop); this.isClickCom = true; return; } this._CreateShoot(); } _CreateShoot() { WXSdk.ShortVibrate(); SettingController.Instance.PlaySound(SoundType.hit); let bulletPos = this.playerScript.CreateBullet(); if (bulletPos == null) return; let bu = GamePool.Instance.GetModel(GamePool.modeltype.PlayerShoot); if (bu) { Scene3DManager.Instance.bulletCon.addChild(bu); bu.transform.position = bulletPos.position.clone(); bu.transform.localRotationEuler = bulletPos.rotationEuler.clone(); let pb = bu.getComponent(MainRoleShot); if (!pb) pb = bu.addComponent(MainRoleShot); pb.Start(bulletPos, this.isover); } } CheckGameOver(isplayer) { if (isplayer) { let count = MateManager.Instance.NearDestination(); if (count == 0) { this.playerScript.Near(); GameManager.Instance.Over(); } } else { let count = MateManager.Instance.NearDestination(); if (count == 0) { let isplayerdead = this.playerScript.isdead; if (isplayerdead) { this.playerScript.Near(); GameManager.Instance.Over(); } } } } GoToTiaoWu() { if (!this.playerScript) return; let t = PlaneManager.Instance.GetWuDaoPosition(); if (!t) return; this.playerScript.TiaoWu(t); } Reset() { for (let index = 0; index < this.MateArrPosition.length; index++) { const element = this.MateArrPosition[index]; element["ishave"] = false; } this.isover = false; if (!this.playerScript) return; this.playerScript.Reset(); } HidePlayer() { if (this.player) this.player.active = false; } onSkinLoadComplete() { this.placeHScroller(); this.placeVScroller(); } placeHScroller() { var hs = new HScrollBar(); hs.skin = "res/ui/hscroll.png"; hs.width = 300; hs.pos(50, 170); hs.min = 0; hs.max = 100; } placeVScroller() { var vs = new VScrollBar(); vs.skin = "res/ui/vscroll.png"; vs.height = 300; vs.pos(400, 50); vs.min = 0; vs.max = 100; Laya.stage.addChild(vs); } MadePlayer() { let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId); if (p) { this.player = p; this.SetMatePos(p); this.playerTra = this.player.transform; this.playerTra.position = this.playerStartTra.position.clone(); this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone(); this.playerContainer.addChild(this.player); let ps = this.player.getComponent(MainRole); if (ps) this.playerScript = ps; else this.playerScript = this.player.addComponent(MainRole); } else { console.error("player不存在"); } } SetPlayerPosition() { this.player.active = true; this.playerTra.position = this.playerStartTra.position.clone(); this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone(); this.playerScript.PlayAni(MusicType.Idle, 1); } SetModelPos(x) { if (!this.player) { this.MadePlayer(); this.SetPlayerPosition(); } if (!this._maincamera) { this._maincamera = CameraManager.Instance._maincamera; this._distance = -Vector3$4.distance(this.playerTra.position, this._maincamera.transform.position); this._posy = MatrixTransform.WorldToScreen2(this._maincamera, this.playerTra.position).y; } let uiP = new Vector3$4(x, this._posy, this._distance); let p = MatrixTransform.ScreenToWorld(this._maincamera, uiP); this.playerTra.localPositionX = p.x; } Start() { if (this.playerScript) { this.playerScript.Start(); this.playerScript.PlayAni(MusicType.RunAndGun, 2); } } } var Vector3$5 = Laya.Vector3; var CameraState; (function (CameraState) { CameraState[CameraState["game"] = 1] = "game"; CameraState[CameraState["jump"] = 2] = "jump"; })(CameraState || (CameraState = {})); class Camera extends Laya.Script3D { constructor() { super(); this.arg = 0.1; this.startShake = false; this.seconds = 0; this.started = false; this.quake = 0.3; this._position = new Laya.Vector3(); this._outPos = new Laya.Vector3(); this.scaleDelta = 0; this.scale = new Laya.Vector3(0.1, 0.1, 0.1); this.canmovegame = false; } onAwake() { this.selfObj = this.owner; this._tran = this.selfObj.transform; this.nowP = MathTool.VecZero; this.nowR = MathTool.VecZero; this.dis = MathTool.VecZero; this.temp = MathTool.VecZero; } Init() { let t = CameraManager.Instance.startPosTra; this._tran.position = t.position.clone(); this._tran.localRotationEuler = MathTool.SpToCam(t.localRotationEuler.clone()); this.dis.x = MainRoleManager.Instance.playerStartTra.position.x - this._tran.position.x; this.dis.y = MainRoleManager.Instance.playerStartTra.position.y - this._tran.position.y; this.dis.z = MainRoleManager.Instance.playerStartTra.position.z - this._tran.position.z; } StopMove() { Laya.timer.clear(this, this.JumpCameraMove); } JumpCameraMove() { let p, r; if (this.arg == 1) { p = this._transform.position; r = MathTool.SpToCam(this._transform.localRotationEuler.clone()); } else { p = MathTool.MixVector3(this._tran.position.clone(), this._transform.position, this.arg, this.nowP); r = MathTool.MixVector3(this._tran.localRotationEuler, MathTool.SpToCam(this._transform.localRotationEuler.clone()), this.arg, this.nowR); } this._tran.position = p; this._tran.localRotationEuler = r; } CameraAction(type, arg) { this.arg = arg; switch (type) { case CameraState.game: this._transform = MainRoleManager.Instance.playerTra; if (!this._transform) return; let t = CameraManager.Instance.startPosTra; this._tran.position = t.position.clone(); this._tran.localRotationEuler = MathTool.SpToCam(t.localRotationEuler.clone()); this.canmovegame = true; break; case CameraState.jump: this._transform = PlaneManager.Instance.jumpCamTra; if (!this._transform) return; this.canmovegame = false; Laya.timer.frameLoop(1, this, this.JumpCameraMove); Laya.timer.once(3000, this, this.StopMove); break; } } onComplete() { var grid = this._scene.addChild(Laya.Loader.getRes("res/threeDimen/staticModel/grid/plane.lh")); grid.getChildAt(0).meshRenderer.receiveShadow = true; grid.getChildAt(0).layer = 5; var staticLayaMonkey = new Laya.MeshSprite3D(Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey/Assets/LayaMonkey/LayaMonkey-LayaMonkey.lm")); this._scene.addChild(staticLayaMonkey); staticLayaMonkey.meshRenderer.material = Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey/Assets/LayaMonkey/Materials/T_Diffuse.lmat"); staticLayaMonkey.layer = 1; staticLayaMonkey.transform.position = new Laya.Vector3(0, 0, 0.5); staticLayaMonkey.transform.localScale = new Laya.Vector3(0.3, 0.3, 0.3); staticLayaMonkey.transform.rotation = new Laya.Quaternion(0.7071068, 0, 0, -0.7071067); staticLayaMonkey.meshRenderer.castShadow = true; var layaMonkey_clone1 = Laya.Sprite3D.instantiate(staticLayaMonkey, this._scene, false, new Laya.Vector3(0.0, 0, 0.5)); var layaMonkey_clone2 = Laya.Sprite3D.instantiate(staticLayaMonkey, this._scene, false, new Laya.Vector3(0.0, 0, 0.5)); var layaMonkey_clone3 = Laya.Sprite3D.instantiate(staticLayaMonkey, this._scene, false, new Laya.Vector3(0.0, 0, 0.5)); layaMonkey_clone1.layer = 2; layaMonkey_clone2.layer = 3; layaMonkey_clone3.layer = 0; layaMonkey_clone1.transform.translate(new Laya.Vector3(1.5, 0, 0.0)); layaMonkey_clone2.transform.translate(new Laya.Vector3(-1.5, 0, 0.0)); layaMonkey_clone3.transform.translate(new Laya.Vector3(2.5, 0, 0.0)); layaMonkey_clone2.transform.rotate(new Laya.Vector3(0, 60, 0), false, false); var scale = new Laya.Vector3(0.1, 0.1, 0.1); layaMonkey_clone3.transform.localScale = scale; } onDestroy() { Laya.timer.clearAll(this); } ShakeFor(a, b) { this.camPOS = this.selfObj.transform.position.clone(); this.seconds = a; this.started = true; this.startShake = true; this.quake = b; } Shake() { var x = GameTool.random_1to1() * this.quake; var y = GameTool.random_1to1() * this.quake; var z = GameTool.random_1to1() * this.quake; var temp = new Vector3$5(this.camPOS.x + Math.random() * this.quake, this.camPOS.y + Math.random() * this.quake, this.camPOS.z + Math.random() * this.quake); this.selfObj.transform.position = temp; } onLateUpdate() { if (this.startShake) { this.Shake(); } if (this.started) { this.started = false; Laya.timer.once(this.seconds * 1000, this, () => { this.startShake = false; this.selfObj.transform.position = this.camPOS; }); } } animate() { this._position.x = Math.sin(this.scaleDelta += 0.01); this.layaMonkey3D.transform.position = this._position; this.layaMonkey3D.transform.scale = this.scale; this.camera.viewport.project(this.layaMonkey3D.transform.position, this.camera.projectionViewMatrix, this._outPos); this.layaMonkey2D.pos(this._outPos.x / Laya.stage.clientScaleX, this._outPos.y / Laya.stage.clientScaleY); } MoveGame(z) { if (!this.canmovegame) return; this.temp.z = z - this.dis.z; this._tran.localPositionZ = this.temp.z; } } var Sprite$a = Laya.Sprite; var BlurFilter = Laya.BlurFilter; class Scene3DManager { constructor() { this.apePath = "res/apes/monkey2.png"; } static get Instance() { return Scene3DManager.instance || (Scene3DManager.instance = new Scene3DManager()); } InitGame() { Laya.timer.frameOnce(10, this, () => { MainRoleManager.Instance.MadePlayer(); this.InItScene(); }); } ; Init(_s) { if (_s) { this.MainScene = _s; Laya.stage.addChild(_s); } else { console.error("场景不存在"); return; } let sceneNode; sceneNode = this.MainScene.getChildByName("scene"); if (!sceneNode) { console.error("场景资源配置错误!"); return; } this.MainCamera = this.MainScene.getChildByName("Main Camera"); this.MainCamera.enableHDR = false; this.bulletCon = sceneNode.getChildByName("bulletContainer"); this.effectCon = sceneNode.getChildByName("effectPos"); this.SetSceneMaterial(); let build = sceneNode.getChildByName("buildings"); ConstructManager.Instance.Init(build); let playerStartPos = sceneNode.getChildByName("playerstartPoint"); let playerCon = sceneNode.getChildByName("playerContainer"); MainRoleManager.Instance.Init(playerStartPos, playerCon); let moveBlockContainer = sceneNode.getChildByName("BlockContainer"); StreetManager.Instance.Init(moveBlockContainer); let towerContainer = sceneNode.getChildByName("towerContainer"); MoundManager.Instance.Init(towerContainer); let startCampos1 = sceneNode.getChildByName("startCamPos"); let startCamposX = sceneNode.getChildByName("startXCamPos"); let ps; if (GameVersion.isX) ps = startCamposX; else ps = startCampos1; CameraManager.Instance.Init(this.MainCamera, ps); let finalPos = sceneNode.getChildByName("finalPos"); PlaneManager.Instance.Init(finalPos); this.InitGame(); } createApe() { var ape = new Sprite$a(); ape.loadImage(this.apePath); ape.x = (Laya.stage.width - ape.width) / 2; ape.y = (Laya.stage.height - ape.height) / 2; Laya.stage.addChild(ape); this.applayFilter(ape); } applayFilter(ape) { var blurFilter = new BlurFilter(); blurFilter.strength = 5; ape.filters = [blurFilter]; } SetSceneMaterial() { this.MainCamera.clearFlag = Laya.BaseCamera.CLEARFLAG_SKY; let skyRenderer = this.MainScene.skyRenderer; skyRenderer.mesh = Laya.SkyDome.instance; let mat = new Laya.SkyProceduralMaterial(); skyRenderer.material = mat; mat.sunDisk = Laya.SkyProceduralMaterial.SUN_NODE; mat.skyTint = new Laya.Vector4(1, 0.74, 0.74, 1); } InItScene() { LevelController.Instance.SetLevel(); PlaneManager.Instance.SetAir(); ConstructManager.Instance.SetConstruct(); CameraManager.Instance.SetCameraAction(CameraState.game, 1); MainRoleManager.Instance.SetPlayerPosition(); } } var Sprite$b = Laya.Sprite; var GlowFilter = Laya.GlowFilter; class ResourcesManager { constructor() { this.cloth = []; this.apePath = "res/apes/monkey2.png"; } static get Instance() { return this.instance || (this.instance = new ResourcesManager()); } static LoadResource(path, complet) { Laya.loader.retryNum = 2; Laya.loader.maxLoader = 3; Laya.loader.retryDelay = 100; Laya.loader.create(path, new Laya.Handler(this, complet)); Laya.loader.on(Laya.Event.ERROR, this, (data) => { console.log(data + " 资源加载失败"); }); } InitAsset() { AssetPath.Player.forEach(element => { let _player = Laya.loader.getRes(element); Laya.loader.clearRes(element); this.LoadPoolRes(_player.name, _player); }); AssetPath.Particle.forEach(element => { let _effect = Laya.loader.getRes(element); Laya.loader.clearRes(element); this.LoadPoolRes(_effect.name, _effect); }); let _enemy = Laya.loader.getRes(AssetPath.Enemy); Laya.loader.clearRes(AssetPath.Enemy); this.LoadPoolRes(_enemy.name, _enemy); let _playerbullet = Laya.loader.getRes(AssetPath.PlayerShot); Laya.loader.clearRes(AssetPath.PlayerShot); this.LoadPoolRes(_playerbullet.name, _playerbullet); let _tower = Laya.loader.getRes(AssetPath.Mound); Laya.loader.clearRes(AssetPath.Mound); this.LoadPoolRes(_tower.name, _tower); let _scene = Laya.loader.getRes(AssetPath.MainScene); Laya.loader.clearRes(AssetPath.MainScene); AssetPath.Barrier.forEach(element => { let _barrier = Laya.loader.getRes(element); Laya.loader.clearRes(element); this.LoadPoolRes(_barrier.name, _barrier); }); Scene3DManager.Instance.Init(_scene); } LoadPoolRes(name, prefab) { GamePool.Instance.InitSelf(name, prefab); } setup() { this.createApe(); this.applayFilter(); } createApe() { this.ape = new Sprite$b(); this.ape.loadImage(this.apePath); var texture = Laya.loader.getRes(this.apePath); this.ape.x = (Laya.stage.width - texture.width) / 2; this.ape.y = (Laya.stage.height - texture.height) / 2; Laya.stage.addChild(this.ape); } applayFilter() { var glowFilter = new GlowFilter("#ffff00", 10, 0, 0); this.ape.filters = [glowFilter]; } Load(callback) { var arr = [ AssetPath.MainScene, AssetPath.Enemy, AssetPath.PlayerShot, AssetPath.Mound, ]; let arr1 = arr.concat(AssetPath.Player); let arr2 = arr1.concat(AssetPath.Barrier); let arr3 = arr2.concat(AssetPath.Particle); ResourcesManager.LoadResource(arr3, () => { this.InitAsset(); if (callback) callback(); }); } } var REG = Laya.ClassUtils.regClass; var ui; (function (ui) { class AttributeUpViewUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(AttributeUpViewUI.uiView); } } AttributeUpViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "14,14,13,15", "right": 0, "left": 0, "bottom": 0, "alpha": 1 }, "compId": 3 }, { "type": "Box", "props": { "y": 253, "x": 42, "width": 636, "height": 538 }, "compId": 4, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/webp.webp.png", "right": 0, "left": 0, "bottom": 0 }, "compId": 31, "child": [{ "type": "Image", "props": { "y": 40, "x": -9, "width": 655, "skin": "Main/shengji-biaoti.png", "height": 102 }, "compId": 32 }] }, { "type": "Button", "props": { "y": 556, "x": 350, "var": "rateBtn", "stateNum": 1, "skin": "Main/landi.png" }, "compId": 34, "child": [{ "type": "Image", "props": { "y": 19, "x": 44, "skin": "Main/gongjisudu-1.png" }, "compId": 35 }, { "type": "Image", "props": { "y": 124, "x": 4, "width": 236, "var": "_rate", "stateNum": 1, "height": 71 }, "compId": 36, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 37 }, { "type": "Image", "props": { "y": 13, "x": 57, "skin": "Main/jinbi-zhu.png" }, "compId": 38, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 39 }] }] }, { "type": "Text", "props": { "y": 71, "x": 72, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 40 }, { "type": "Image", "props": { "y": 124, "x": 5, "width": 235, "visible": false, "var": "_rateVideo", "stateNum": 1, "height": 71 }, "compId": 41, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 42 }, { "type": "Image", "props": { "y": 16.5, "x": 117.5, "skin": "Main/shipin-biao.png" }, "compId": 43 }] }, { "type": "Image", "props": { "y": 154, "x": 137, "var": "click2", "skin": "Main/shou.png", "anchorX": 0.5 }, "compId": 49 }] }, { "type": "Button", "props": { "y": 558, "x": 54, "var": "atkBtn", "stateNum": 1, "skin": "Main/hong-di.png" }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 19, "x": 66, "skin": "Main/gongjili-2.png" }, "compId": 10 }, { "type": "Image", "props": { "y": 124, "x": 3, "width": 236, "var": "_atk", "stateNum": 1, "height": 71 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 33 }, { "type": "Image", "props": { "y": 15, "x": 61, "skin": "Main/jinbi-zhu.png" }, "compId": 14, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 16 }] }] }, { "type": "Text", "props": { "y": 71, "x": 57, "width": 136, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 12 }, { "type": "Image", "props": { "y": 124, "x": 2, "width": 238, "visible": false, "var": "_atkVideo", "stateNum": 1, "height": 71 }, "compId": 45, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 46 }, { "type": "Image", "props": { "y": 16.5, "x": 119, "skin": "Main/shipin-biao.png" }, "compId": 47 }] }, { "type": "Image", "props": { "y": 154.5, "x": 137, "var": "click1", "skin": "Main/shou.png", "anchorX": 0.5 }, "compId": 48 }] }, { "type": "Image", "props": { "x": 201, "var": "backBtn", "skin": "Main/jixuyouxi-bt.png", "runtime": "View/Com/ButtonRunTime.ts", "centerY": 620 }, "compId": 8 }] }, { "type": "Box", "props": { "y": 384, "x": 75, "width": 571, "var": "PushBox", "height": 407 }, "compId": 72, "child": [{ "type": "Box", "props": { "y": 112, "x": 100, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 68, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 70 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 71 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 69 }] }, { "type": "Box", "props": { "y": 112, "x": 283, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 73, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 74 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 75 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 76 }] }, { "type": "Box", "props": { "y": 112, "x": 470, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 77, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 78 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 79 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 80 }] }, { "type": "Box", "props": { "y": 306, "x": 100, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 81, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 84 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 85 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 86 }] }, { "type": "Box", "props": { "y": 306, "x": 283, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 82, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 87 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 88 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 89 }] }, { "type": "Box", "props": { "y": 306, "x": 470, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 83, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 90 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 91 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 92 }] }] }, { "type": "Button", "props": { "y": 176, "x": 578, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 94 }], "animations": [{ "nodes": [{ "target": 48, "keyframes": { "y": [{ "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 0 }, { "value": 207, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 5 }, { "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 10 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 49, "keyframes": { "y": [{ "value": 154, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 0 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 5 }, { "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 10 }] } }], "name": "ani2", "id": 2, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 68, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 20 }] } }, { "target": 73, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 20 }] } }, { "target": 77, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 20 }] } }, { "target": 81, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 20 }] } }, { "target": 82, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 20 }] } }, { "target": 83, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 20 }] } }], "name": "shakeani", "id": 3, "frameRate": 24, "action": 0 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/webp.webp.png", "Main/shengji-biaoti.png", "Main/landi.png", "Main/gongjisudu-1.png", "Main/shengji-tubiao-1.png", "Main/jinbi-zhu.png", "Main/shipin-biao.png", "Main/shou.png", "Main/hong-di.png", "Main/gongjili-2.png", "Main/jixuyouxi-bt.png", "Main/exit2.png"], "loadList3D": [] }; ui.AttributeUpViewUI = AttributeUpViewUI; REG("ui.AttributeUpViewUI", AttributeUpViewUI); class CompleteViewUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(CompleteViewUI.uiView); } } CompleteViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "10,10,12,11", "right": 0, "left": 0, "bottom": 0, "alpha": 1 }, "compId": 22 }, { "type": "Image", "props": { "y": 1196, "x": 298, "var": "nextBtn", "skin": "Main/no.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 46 }, { "type": "Image", "props": { "x": 214, "var": "doublegetBtn", "skin": "Main/sanbeilingqu.png", "runtime": "View/Com/ButtonRunTime.ts", "bottom": 350 }, "compId": 28 }, { "type": "Image", "props": { "x": 41, "var": "shibaiTop", "skin": "Main/shibai-di bg.png", "centerY": -182 }, "compId": 68, "child": [{ "type": "Image", "props": { "y": 136, "x": 76, "skin": "Main/shibai-jiesuan-b.png" }, "compId": 121 }] }, { "type": "Image", "props": { "x": 41.5, "var": "winTop", "skin": "Main/shengli-beidi.png", "centerY": -182 }, "compId": 44, "child": [{ "type": "Image", "props": { "y": 132, "x": 76, "skin": "Main/tonggun-biao.png" }, "compId": 122 }] }, { "type": "Image", "props": { "x": 243, "width": 60, "skin": "Main/jinbi-zhu.png", "height": 60, "centerY": 120 }, "compId": 69, "child": [{ "type": "Text", "props": { "y": -8, "x": 77, "width": 165, "var": "valueText", "valign": "middle", "text": "50(+100)", "height": 75, "fontSize": 40, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 70 }] }, { "type": "Box", "props": { "x": 136, "width": 447, "height": 419, "centerY": -138 }, "compId": 71, "child": [{ "type": "Image", "props": { "y": 58, "x": 0, "width": 448, "skin": "Main/zhengchang-di.png", "height": 100 }, "compId": 76, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "Main/biaozhi-di8.png" }, "compId": 80, "child": [{ "type": "Image", "props": { "y": 15, "x": 17, "skin": "Main/baolei.png" }, "compId": 118 }] }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "Main/jinbi-zhu.png", "height": 50 }, "compId": 83 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "towerValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#48efcc", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 82 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "towerCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#48efcc", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 81 }] }, { "type": "Image", "props": { "y": 179, "x": 0, "width": 448, "skin": "Main/zhengchang-di.png", "height": 100 }, "compId": 84, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "Main/biaozhi-di8.png" }, "compId": 85, "child": [{ "type": "Image", "props": { "y": 15, "x": 13.5, "skin": "Main/rentou.png" }, "compId": 119 }] }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "Main/jinbi-zhu.png", "height": 50 }, "compId": 88 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "roleCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#99ff53", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 86 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "roleValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#99ff53", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 87 }] }, { "type": "Image", "props": { "y": 301, "x": 0, "width": 448, "skin": "Main/zhengchang-di.png", "height": 100 }, "compId": 89, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "Main/biaozhi-di8.png" }, "compId": 90, "child": [{ "type": "Image", "props": { "y": 13, "x": 16, "skin": "Main/baohe.png" }, "compId": 120 }] }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "Main/jinbi-zhu.png", "height": 50 }, "compId": 93 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "blockCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffe92e", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 91 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "blockValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffe92e", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 92 }] }] }, { "type": "Button", "props": { "y": 423, "width": 109, "var": "LeftTopPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 14, "height": 128 }, "compId": 96, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 98 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 99 }] }, { "type": "Button", "props": { "y": 640, "width": 109, "var": "LeftBottomPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 14, "height": 128 }, "compId": 102, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 103 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 104 }] }, { "type": "Button", "props": { "y": 423, "width": 109, "var": "RightTopPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 595, "height": 128 }, "compId": 105, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 107 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 108 }] }, { "type": "Button", "props": { "y": 640, "width": 109, "var": "RightBottomPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 595, "height": 128 }, "compId": 106, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 109 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 110 }] }, { "type": "Button", "props": { "y": 175, "x": 568.5, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 123 }], "animations": [{ "nodes": [{ "target": 18, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 0 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 20 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 40 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 0 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 20 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 40 }] } }], "name": "aim", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 96, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 20 }] } }, { "target": 102, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 20 }] } }, { "target": 105, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 20 }] } }, { "target": 106, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 20 }] } }], "name": "pushshake", "id": 2, "frameRate": 24, "action": 0 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/no.png", "Main/sanbeilingqu.png", "Main/shibai-di bg.png", "Main/shibai-jiesuan-b.png", "Main/shengli-beidi.png", "Main/tonggun-biao.png", "Main/jinbi-zhu.png", "Main/zhengchang-di.png", "Main/biaozhi-di8.png", "Main/baolei.png", "Main/rentou.png", "Main/baohe.png", "Main/hutui-1-4.png", "Main/exit2.png"], "loadList3D": [] }; ui.CompleteViewUI = CompleteViewUI; REG("ui.CompleteViewUI", CompleteViewUI); class ExitViewUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(ExitViewUI.uiView); } } ExitViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/hutui-1-4.png", "sizeGrid": "16,16,14,14", "right": 0, "name": "BG", "left": 0, "bottom": 0 }, "compId": 5 }, { "type": "Image", "props": { "x": 0, "width": 720, "top": 0, "skin": "Main/hutui-1-3.png", "height": 131 }, "compId": 4, "child": [{ "type": "Text", "props": { "y": 84, "x": 360, "width": 135, "valign": "middle", "text": "小程序", "pivotY": 31, "pivotX": 68, "height": 61, "fontSize": 35, "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 6 }, { "type": "Text", "props": { "y": 154, "x": 56, "width": 92, "valign": "middle", "text": "最近使用", "pivotY": 18, "pivotX": 46, "height": 36, "fontSize": 23, "color": "#5d5353", "align": "center", "runtime": "laya.display.Text" }, "compId": 8 }, { "type": "Image", "props": { "y": 174, "width": 753, "skin": "Main/hutui_line.png", "right": 0, "pivotY": 2, "pivotX": 320, "height": 7 }, "compId": 19 }] }, { "type": "Button", "props": { "y": 66, "x": 37, "width": 66, "var": "CloseBtn", "pivotY": 41, "pivotX": 33, "height": 81 }, "compId": 7 }, { "type": "List", "props": { "x": 360, "width": 656, "var": "PushList", "top": 180, "spaceY": 15, "bottom": 0, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 9, "child": [{ "type": "Box", "props": { "y": 0, "width": 630, "right": 26, "renderType": "render", "height": 101 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 100, "x": 123, "width": 538, "skin": "Main/hutui_line.png", "name": "line", "height": 5 }, "compId": 18 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 100, "name": "icon", "height": 100 }, "compId": 11 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 101, "skin": "Main/zhezhao.png", "name": "zhezhao", "height": 101 }, "compId": 17 }, { "type": "Text", "props": { "y": 0, "x": 150, "width": 473, "valign": "middle", "text": "冲冲冲冲", "name": "name", "height": 100, "fontSize": 30, "align": "left", "runtime": "laya.display.Text" }, "compId": 12 }, { "type": "Image", "props": { "y": 65, "x": 598.5, "width": 49, "skin": "Main/hutui-1-1.png", "pivotY": 23, "pivotX": 25, "name": "star", "height": 46 }, "compId": 13 }, { "type": "Button", "props": { "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 14 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 16 }] }] }], "loadList": ["Main/hutui-1-4.png", "Main/hutui-1-3.png", "Main/hutui_line.png", "Main/zhezhao.png", "Main/hutui-1-1.png"], "loadList3D": [] }; ui.ExitViewUI = ExitViewUI; REG("ui.ExitViewUI", ExitViewUI); class ExportViewUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(ExportViewUI.uiView); } } ExportViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "var": "BG", "top": 0, "skin": "Main/111111.png", "sizeGrid": "10,12,14,10", "right": 0, "left": 0, "bottom": 0 }, "compId": 5 }, { "type": "Image", "props": { "top": 130, "skin": "Main/haoyourwBg.png", "right": 10, "left": 10, "height": 200 }, "compId": 3, "child": [{ "type": "List", "props": { "y": 52, "x": 11.5, "width": 697, "var": "TopList", "spaceX": 20, "height": 130 }, "compId": 8, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 130, "renderType": "render", "height": 130 }, "compId": 9, "child": [{ "type": "Image", "props": { "width": 131, "name": "icon", "height": 131 }, "compId": 10 }, { "type": "Button", "props": { "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 11 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 23 }] }] }] }, { "type": "Image", "props": { "top": 360, "skin": "Main/baokuanrwbg.png", "right": 10, "left": 10, "height": 36 }, "compId": 4 }, { "type": "Image", "props": { "x": 209.5, "top": 50, "skin": "Main/hotGameTitle.png" }, "compId": 6 }, { "type": "Button", "props": { "x": 8, "width": 172, "var": "CloseBtn", "top": 50, "stateNum": 1, "skin": "Main/backBtn.png", "height": 51 }, "compId": 7 }, { "type": "List", "props": { "x": 10, "var": "BottomList", "top": 400, "spaceY": 15, "spaceX": 40, "right": 0, "repeatX": 3, "left": 0, "bottom": 150 }, "compId": 12, "child": [{ "type": "Box", "props": { "y": 0, "x": 32, "width": 190, "renderType": "render", "height": 230 }, "compId": 13, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/bg-box.png", "sizeGrid": "33,36,40,30", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 18 }, { "type": "Image", "props": { "y": 40, "x": 0, "width": 190, "name": "icon", "height": 150 }, "compId": 14 }, { "type": "Text", "props": { "y": 190, "x": 1, "width": 189, "valign": "middle", "text": "text", "name": "tip", "height": 41, "fontSize": 23, "align": "center", "runtime": "laya.display.Text" }, "compId": 15 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 190, "name": "bottom", "height": 40 }, "compId": 16 }, { "type": "Text", "props": { "y": 0, "x": 0, "width": 189, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 40, "fontSize": 30, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 17 }, { "type": "Button", "props": { "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 19 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 24 }] }] }, { "type": "Button", "props": { "x": 228, "width": 241, "var": "ContinueBtn", "stateNum": 1, "skin": "Main/zhengchang-di2.png", "sizeGrid": "17,31,12,28", "height": 65, "bottom": 50 }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 11, "x": 33.5, "skin": "Main/jixuyouxi.png" }, "compId": 21 }] }], "loadList": ["Main/111111.png", "Main/haoyourwBg.png", "Main/baokuanrwbg.png", "Main/hotGameTitle.png", "Main/backBtn.png", "Main/bg-box.png", "Main/zhengchang-di2.png", "Main/jixuyouxi.png"], "loadList3D": [] }; ui.ExportViewUI = ExportViewUI; REG("ui.ExportViewUI", ExportViewUI); class GiftViewUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(GiftViewUI.uiView); } } GiftViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "var": "BG", "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "8,10,11,9", "right": 0, "left": 0, "bottom": 0 }, "compId": 6 }, { "type": "Image", "props": { "y": 504, "x": 360, "width": 467, "skin": "Main/liwukuang.png", "pivotY": 234, "pivotX": 234, "name": "kuang", "height": 467 }, "compId": 3, "child": [{ "type": "Image", "props": { "y": 233.5, "x": 233.5, "width": 183, "skin": "Main/lihe.png", "pivotY": 102, "pivotX": 92, "name": "gift", "height": 203 }, "compId": 4 }, { "type": "Image", "props": { "y": 233.5, "x": 233.5, "width": 85, "skin": "Main/wenhao.png", "pivotY": 66, "pivotX": 43, "name": "wenhao", "height": 132 }, "compId": 5 }] }, { "type": "Button", "props": { "x": 352, "width": 200, "var": "HitBtn", "stateNum": 1, "pivotY": 67, "pivotX": 100, "height": 133, "bottom": 8 }, "compId": 9, "child": [{ "type": "Image", "props": { "y": -51, "x": 108, "width": 89, "var": "shou", "skin": "Main/shou1.png", "pivotY": 59, "pivotX": 45, "height": 118 }, "compId": 12 }, { "type": "Image", "props": { "y": 34, "x": 0, "skin": "Main/eee 1@2x.png" }, "compId": 24 }, { "type": "Image", "props": { "y": 45, "x": 100, "width": 174, "skin": "Main/anniu.png", "pivotY": 41, "pivotX": 87, "height": 82 }, "compId": 10 }] }, { "type": "Text", "props": { "y": 356, "x": 360, "width": 199, "valign": "middle", "text": "神秘礼盒", "pivotY": 34, "pivotX": 100, "name": "name", "height": 67, "fontSize": 30, "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 13 }, { "type": "ProgressBar", "props": { "y": 666, "x": 360, "width": 268, "var": "jinduBar", "value": 0, "skin": "Main/di.png", "pivotY": 11, "pivotX": 134, "height": 22 }, "compId": 14 }], "animations": [{ "nodes": [{ "target": 12, "keyframes": { "y": [{ "value": -51, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "y", "index": 0 }, { "value": -90, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "y", "index": 5 }, { "value": -51, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "y", "index": 10 }, { "value": -90, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "y", "index": 15 }, { "value": -51, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "y", "index": 20 }], "x": [{ "value": 108, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "x", "index": 0 }] } }], "name": "click", "id": 1, "frameRate": 24, "action": 0 }], "loadList": ["Main/chunhei.png", "Main/liwukuang.png", "Main/lihe.png", "Main/wenhao.png", "Main/shou1.png", "Main/eee 1@2x.png", "Main/anniu.png", "Main/di.png"], "loadList3D": [] }; ui.GiftViewUI = GiftViewUI; REG("ui.GiftViewUI", GiftViewUI); class GoldEggViewUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(GoldEggViewUI.uiView); } } GoldEggViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "var": "BG", "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "8,11,10,8", "right": 0, "left": 0, "bottom": 0 }, "compId": 4 }, { "type": "Image", "props": { "y": 288, "x": 177.5, "skin": "Main/zajindan_3.png" }, "compId": 3, "child": [{ "type": "Image", "props": { "y": 284, "x": 456, "width": 137, "skin": "Main/zajindan_5_3.png", "pivotY": 177, "pivotX": 77, "height": 177 }, "compId": 6 }] }, { "type": "ProgressBar", "props": { "y": 725.5, "x": 21, "var": "jindu", "value": 0, "skin": "Main/zadanjindu.png", "rotation": -90 }, "compId": 5 }, { "type": "Button", "props": { "y": 1157, "x": 360, "var": "HitBtn", "stateNum": 1, "skin": "Main/zadan.png", "scaleY": 1.01, "scaleX": 1.01, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 7 }, { "type": "Image", "props": { "y": 1007, "x": 506, "var": "kuangdian", "skin": "Main/kuangdian-2.png" }, "compId": 9 }], "animations": [{ "nodes": [{ "target": 6, "keyframes": { "y": [{ "value": 107, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "y", "index": 0 }, { "value": 284, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "y", "index": 1 }], "x": [{ "value": 379, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 0 }, { "value": 448, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 1 }], "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 0 }, { "value": -6, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 1 }, { "value": -17, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 2 }, { "value": -46, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 3 }, { "value": -19, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 4 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 5 }], "pivotY": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "pivotY", "index": 0 }, { "value": 177, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "pivotY", "index": 1 }], "pivotX": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "pivotX", "index": 0 }, { "value": 69, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "pivotX", "index": 1 }] } }, { "target": 4, "keyframes": { "var": [{ "value": "BG", "tweenMethod": "linearNone", "tween": false, "target": 4, "key": "var", "index": 0 }, { "value": "Black", "tweenMethod": "linearNone", "tween": false, "target": 4, "key": "var", "index": 5 }], "name": [{ "value": "BG", "tweenMethod": "linearNone", "tween": false, "target": 4, "key": "name", "index": 0 }, { "value": "", "tweenMethod": "linearNone", "tween": false, "target": 4, "key": "name", "index": 5 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 7, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleY", "index": 0 }, { "value": 0.9, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleY", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleY", "index": 20 }, { "value": 1.1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleY", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleY", "index": 40 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleX", "index": 0 }, { "value": 0.9, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleX", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleX", "index": 20 }, { "value": 1.1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleX", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleX", "index": 40 }] } }], "name": "btnscale", "id": 2, "frameRate": 24, "action": 0 }], "loadList": ["Main/chunhei.png", "Main/zajindan_3.png", "Main/zajindan_5_3.png", "Main/zadanjindu.png", "Main/zadan.png", "Main/kuangdian-2.png"], "loadList3D": [] }; ui.GoldEggViewUI = GoldEggViewUI; REG("ui.GoldEggViewUI", GoldEggViewUI); class GuideViewUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(GuideViewUI.uiView); } } GuideViewUI.uiView = { "type": "Scene", "props": { "width": 720, "mouseThrough": true, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "y": 30, "x": 958, "width": 104, "var": "guide1Box", "scaleY": 0.8, "scaleX": 0.8, "height": 44, "anchorY": 1, "anchorX": 0.5 }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 3, "x": -3, "skin": "Main/guangquan(1).png" }, "compId": 8 }, { "type": "Image", "props": { "y": -123, "x": 2, "skin": "Main/jiantou(1).png" }, "compId": 9 }] }, { "type": "Box", "props": { "y": 154, "x": 969, "width": 207, "var": "guide2Box", "scaleY": 0.8, "scaleX": 0.8, "height": 56, "anchorY": 0.5, "anchorX": 0 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 28, "x": 207, "width": 0, "skin": "Main/zuoyou-jiantou(1).png", "rotation": 180, "pivotY": 48, "height": 96 }, "compId": 12 }, { "type": "Image", "props": { "y": 15, "x": 181, "skin": "Main/shou.png" }, "compId": 11 }] }, { "type": "Box", "props": { "y": 298, "x": 1790, "width": 207, "var": "guide3Box", "scaleY": 0.8, "scaleX": 0.8, "height": 48, "anchorY": 0.5, "anchorX": 1 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 22, "x": 0, "width": 0, "skin": "Main/zuoyou-jiantou(1).png", "pivotY": 48, "height": 96 }, "compId": 14 }, { "type": "Image", "props": { "y": 6, "x": -17, "width": 61, "skin": "Main/shou.png" }, "compId": 15 }] }, { "type": "Box", "props": { "y": 278, "x": -163, "width": 104, "var": "guide4Box", "scaleY": 0.8, "scaleX": 0.8, "height": 44, "anchorY": 1, "anchorX": 0.5 }, "compId": 19, "child": [{ "type": "Image", "props": { "y": -106, "x": 4, "skin": "Main/jiantou(1).png" }, "compId": 21 }] }, { "type": "Image", "props": { "x": 183, "var": "guide1Image", "skin": "Main/biaoyu.png", "bottom": 220 }, "compId": 16 }, { "type": "Image", "props": { "x": 164, "var": "guide2Image", "skin": "Main/biaoyu4.png", "bottom": 218 }, "compId": 17 }, { "type": "Image", "props": { "x": 136, "var": "guide3Image", "skin": "Main/biaoyu2.png", "bottom": 220 }, "compId": 18 }], "animations": [{ "nodes": [{ "target": 9, "keyframes": { "y": [{ "value": -116, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 0 }, { "value": -197, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 5 }, { "value": -115, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 10 }] } }], "name": "guide1", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 11, "keyframes": { "x": [{ "value": 181, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 0 }, { "value": 21, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 10 }] } }, { "target": 12, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 0 }, { "value": 188, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 10 }] } }], "name": "guide2", "id": 2, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 15, "keyframes": { "x": [{ "value": -17, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 0 }, { "value": 122, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 10 }] } }, { "target": 14, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 0 }, { "value": 149, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 10 }] } }], "name": "guide3", "id": 3, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 21, "keyframes": { "y": [{ "value": -212, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 0 }, { "value": -106, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 10 }] } }], "name": "guide4", "id": 4, "frameRate": 24, "action": 0 }], "loadList": ["Main/guangquan(1).png", "Main/jiantou(1).png", "Main/zuoyou-jiantou(1).png", "Main/shou.png", "Main/biaoyu.png", "Main/biaoyu4.png", "Main/biaoyu2.png"], "loadList3D": [] }; ui.GuideViewUI = GuideViewUI; REG("ui.GuideViewUI", GuideViewUI); class InGameViewUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(InGameViewUI.uiView); } } InGameViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "loadList": [], "loadList3D": [] }; ui.InGameViewUI = InGameViewUI; REG("ui.InGameViewUI", InGameViewUI); class IntensifyViewUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(IntensifyViewUI.uiView); } } IntensifyViewUI.uiView = { "type": "Scene", "props": { "width": 720, "sizeGrid": "0,0,0,0", "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "15,13,12,13", "right": 0, "left": 0, "bottom": 0 }, "compId": 64 }, { "type": "Image", "props": { "top": 0, "skin": "Main/bg-sheng.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.8 }, "compId": 3 }, { "type": "Image", "props": { "y": 139, "x": 63.5, "skin": "Main/beijing-di.png" }, "compId": 36 }, { "type": "Box", "props": { "y": 402, "x": 42, "width": 636, "height": 645 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 17, "x": 44.5, "var": "atkBox", "skin": "Main/wenzi-di5.png" }, "compId": 37, "child": [{ "type": "Image", "props": { "y": 43, "x": 183, "skin": "Main/gongji-2-3.png" }, "compId": 38 }, { "type": "Image", "props": { "y": 48, "x": 26, "skin": "Main/zhuangbei-tubiao-di.png" }, "compId": 60 }, { "type": "Image", "props": { "y": 58.5, "x": 34, "skin": "Main/gongji-icon.png" }, "compId": 39 }, { "type": "Image", "props": { "y": 125, "x": 179, "skin": "Main/gongji-1-3.png" }, "compId": 40 }, { "type": "Button", "props": { "y": 95.5, "x": 358, "var": "atkupBtn", "stateNum": 1, "skin": "Main/zheng-qianbi-di.png" }, "compId": 41, "child": [{ "type": "Image", "props": { "y": 7, "x": 15, "width": 45, "skin": "Main/jinbi-zhu.png", "height": 45 }, "compId": 43, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 44 }] }] }, { "type": "Text", "props": { "y": 38, "x": 390, "width": 106, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 50, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 42 }] }, { "type": "Image", "props": { "y": 226, "x": 44.5, "var": "rateBox", "skin": "Main/wenzi-di5.png" }, "compId": 45, "child": [{ "type": "Image", "props": { "y": 43, "x": 170, "skin": "Main/gongji-2-2.png" }, "compId": 46 }, { "type": "Image", "props": { "y": 48, "x": 26, "skin": "Main/zhuangbei-tubiao-di.png" }, "compId": 62 }, { "type": "Image", "props": { "y": 63.5, "x": 35, "skin": "Main/iconqiang.png" }, "compId": 47 }, { "type": "Image", "props": { "y": 125, "x": 164, "skin": "Main/gongji-1-2.png" }, "compId": 48 }, { "type": "Button", "props": { "y": 94.5, "x": 360, "var": "rateupBtn", "stateNum": 1, "skin": "Main/zheng-qianbi-di.png" }, "compId": 49, "child": [{ "type": "Image", "props": { "y": 7, "x": 12, "width": 45, "skin": "Main/jinbi-zhu.png", "height": 45 }, "compId": 51, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 52 }] }] }, { "type": "Text", "props": { "y": 33, "x": 392, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 50, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 50 }] }, { "type": "Image", "props": { "y": 445, "x": 44.5, "var": "coinBox", "skin": "Main/wenzi-di5.png" }, "compId": 53, "child": [{ "type": "Image", "props": { "y": 43, "x": 161, "skin": "Main/gongji-2.png" }, "compId": 54 }, { "type": "Image", "props": { "y": 48, "x": 26, "skin": "Main/zhuangbei-tubiao-di.png" }, "compId": 63 }, { "type": "Image", "props": { "y": 63.5, "x": 30, "skin": "Main/jinbi.png" }, "compId": 55 }, { "type": "Image", "props": { "y": 124, "x": 161, "skin": "Main/gongji-1.png" }, "compId": 56 }, { "type": "Button", "props": { "y": 94, "x": 351, "var": "getcoinBtn", "stateNum": 1, "skin": "Main/zheng-qianbi-di.png" }, "compId": 57, "child": [{ "type": "Image", "props": { "y": 7, "x": 12, "width": 45, "skin": "Main/shipin-biao.png", "height": 45 }, "compId": 58, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "coinValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 59 }] }] }] }] }, { "type": "Button", "props": { "y": 174.5, "x": 573, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 65 }, { "type": "Button", "props": { "y": 139, "x": 14, "var": "backBtn", "stateNum": 1, "skin": "Main/p__fanhui.png" }, "compId": 66 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/bg-sheng.png", "Main/beijing-di.png", "Main/wenzi-di5.png", "Main/gongji-2-3.png", "Main/zhuangbei-tubiao-di.png", "Main/gongji-icon.png", "Main/gongji-1-3.png", "Main/zheng-qianbi-di.png", "Main/jinbi-zhu.png", "Main/gongji-2-2.png", "Main/iconqiang.png", "Main/gongji-1-2.png", "Main/gongji-2.png", "Main/jinbi.png", "Main/gongji-1.png", "Main/shipin-biao.png", "Main/exit2.png", "Main/p__fanhui.png"], "loadList3D": [] }; ui.IntensifyViewUI = IntensifyViewUI; REG("ui.IntensifyViewUI", IntensifyViewUI); class LoadViewUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(LoadViewUI.uiView); } } LoadViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "var": "bg", "top": 0, "skin": "load/bg.png", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 6 }, { "type": "Image", "props": { "x": 360, "var": "prepan", "centerY": -68 }, "compId": 14 }, { "type": "Image", "props": { "x": 86, "skin": "load/title.png", "centerY": -360 }, "compId": 17 }, { "type": "Image", "props": { "y": 932, "x": 137, "var": "pro", "skin": "load/jindu-di.png", "centerY": 309 }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 4, "x": 4, "width": 438, "var": "pro1", "skin": "load/shang.png" }, "compId": 21 }, { "type": "Text", "props": { "y": 0, "x": 2, "width": 442, "var": "proTex", "valign": "middle", "text": "100%", "height": 38, "fontSize": 28, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 22 }, { "type": "Text", "props": { "y": 60, "x": 51, "width": 359, "valign": "middle", "text": "一款好玩的游戏正在加载...", "height": 37, "fontSize": 30, "font": "SimSun", "color": "#ff0000", "align": "left", "runtime": "laya.display.Text" }, "compId": 23 }] }], "animations": [{ "nodes": [{ "target": 9, "keyframes": { "alpha": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "alpha", "index": 0 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "alpha", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "alpha", "index": 20 }] } }, { "target": 10, "keyframes": { "alpha": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "alpha", "index": 0 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "alpha", "index": 10 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "alpha", "index": 20 }] } }, { "target": 11, "keyframes": { "alpha": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "alpha", "index": 0 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "alpha", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "alpha", "index": 20 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["load/bg.png", "load/title.png", "load/jindu-di.png", "load/shang.png"], "loadList3D": [] }; ui.LoadViewUI = LoadViewUI; REG("ui.LoadViewUI", LoadViewUI); class MainViewUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(MainViewUI.uiView); } } MainViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "x": 0, "top": 82, "right": 0, "left": 0, "height": 70 }, "compId": 265, "child": [{ "type": "Image", "props": { "y": 21, "x": 282, "width": 157, "var": "pro", "skin": "Main/jindu-duan.png" }, "compId": 302, "child": [{ "type": "Image", "props": { "y": 4, "x": 1, "width": 150, "var": "pro1", "skin": "Main/jindu-guan-do.png", "height": 20 }, "compId": 305 }, { "type": "Image", "props": { "y": -11, "x": -49, "skin": "Main/guanshu.png" }, "compId": 303, "child": [{ "type": "Text", "props": { "y": -1, "x": -3, "width": 54, "var": "stageValue", "valign": "middle", "text": "10", "height": 51, "fontSize": 32, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 264 }] }, { "type": "Image", "props": { "y": -11, "x": 155, "skin": "Main/shadi.png" }, "compId": 304 }] }, { "type": "Image", "props": { "width": 187, "top": 130, "skin": "Main/jinbi-di.png", "right": 522 }, "compId": 261, "child": [{ "type": "Image", "props": { "y": 4.5, "x": 0, "skin": "Main/jinbi-zhu.png" }, "compId": 262 }, { "type": "Text", "props": { "y": 3.5, "x": 37, "width": 142, "var": "countValue", "valign": "middle", "text": "100000", "italic": true, "height": 47, "fontSize": 36, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 263 }] }] }, { "type": "Box", "props": { "var": "mainBox", "top": 0, "right": 0, "name": "mainBox", "left": 0, "bottom": 0 }, "compId": 284, "child": [{ "type": "Image", "props": { "x": 30, "var": "settingBtn", "top": 104, "skin": "Main/shezhi.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 260 }, { "type": "Box", "props": { "x": 29, "width": 63, "visible": false, "var": "settingBox", "top": 179, "height": 134 }, "compId": 291, "child": [{ "type": "Button", "props": { "x": 2, "width": 59, "var": "shake_btn", "stateNum": 1, "height": 59 }, "compId": 285, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/ButtonVibrationOff.png", "name": "kai" }, "compId": 287 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "Main/ButtonVibrationOn.png", "name": "guan" }, "compId": 288 }] }, { "type": "Button", "props": { "y": 74, "width": 62, "var": "sound_btn", "stateNum": 1, "height": 60 }, "compId": 286, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/Icon_SoundOn.png", "name": "kai" }, "compId": 289 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "Main/Icon_SoundOff.png", "name": "guan" }, "compId": 290 }] }] }, { "type": "Box", "props": { "var": "startBox", "right": 0, "left": 0, "height": 5, "bottom": 208 }, "compId": 259, "child": [{ "type": "Image", "props": { "var": "updateBtn", "skin": "Main/shengji.png", "runtime": "View/Com/ButtonRunTime.ts", "left": 0, "bottom": 0 }, "compId": 257 }, { "type": "Image", "props": { "var": "skinBtn", "skin": "Main/shangdain.png", "runtime": "View/Com/ButtonRunTime.ts", "right": 0, "bottom": 0 }, "compId": 258 }] }, { "type": "Text", "props": { "y": 0, "x": 0, "width": 194, "var": "user_id", "valign": "middle", "text": "user_id:12", "height": 25, "fontSize": 25, "color": "#000000", "runtime": "laya.display.Text" }, "compId": 270 }, { "type": "Button", "props": { "y": 689, "x": 196, "var": "MoreFunBtn2", "stateNum": 1, "skin": "Main/gengduoyouxo-2.png" }, "compId": 336 }] }, { "type": "Image", "props": { "x": 168.5, "var": "sliderBox", "skin": "Main/zhiyin-di.png", "mouseEnabled": false, "gray": false, "bottom": 325 }, "compId": 253, "child": [{ "type": "Image", "props": { "y": -71, "x": 27, "skin": "Main/pause1.png" }, "compId": 334 }, { "type": "Image", "props": { "y": 18, "x": 191.5, "skin": "Main/shouzhi.png", "anchorX": 0.5 }, "compId": 293 }, { "type": "Image", "props": { "y": 13.5, "x": 18, "skin": "Main/fangxiangzuo.png" }, "compId": 331 }, { "type": "Image", "props": { "y": 13.5, "x": 283, "skin": "Main/fangxiangyou.png" }, "compId": 332 }] }, { "type": "Sprite", "props": { "var": "duohuituiSp" }, "compId": 312 }, { "type": "Sprite", "props": { "y": 0, "x": 0, "var": "bannerHuiTuiSp" }, "compId": 313 }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 720, "visible": true, "right": 0, "name": "BottomBox", "left": 0, "height": 177, "bottom": 0 }, "compId": 314, "child": [{ "type": "Image", "props": { "width": 720, "top": 0, "skin": "Main/chunhei2.png", "sizeGrid": "12,11,13,10", "right": 0, "name": "BG", "left": 0, "height": 183, "bottom": 0 }, "compId": 317 }, { "type": "List", "props": { "width": 720, "var": "BottomList", "spaceX": 30, "right": 0, "repeatY": 1, "left": 0, "height": 176, "bottom": 0 }, "compId": 318, "child": [{ "type": "Box", "props": { "y": 8, "x": 18, "width": 130, "renderType": "render", "height": 160 }, "compId": 319, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 129, "skin": "Main/bg-box.png", "sizeGrid": "27,27,37,20", "name": "BG", "height": 159 }, "compId": 320 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 130, "name": "icon", "height": 130 }, "compId": 321 }, { "type": "Text", "props": { "y": 130, "x": 0, "width": 126, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 29, "fontSize": 20, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 322 }, { "type": "Button", "props": { "y": 0, "x": 0, "width": 130, "name": "btn", "height": 160 }, "compId": 323 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 335 }] }] }] }, { "type": "Button", "props": { "y": 561, "width": 140, "var": "LeftPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 88, "pivotX": 70, "left": 20, "height": 175 }, "compId": 315, "child": [{ "type": "Image", "props": { "width": 140, "name": "icon", "height": 140 }, "compId": 325 }, { "type": "Text", "props": { "y": 159, "x": 70, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 326 }] }, { "type": "Button", "props": { "y": 561, "width": 140, "var": "RightPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "right": 21, "pivotY": 88, "pivotX": 70, "height": 175 }, "compId": 316, "child": [{ "type": "Image", "props": { "width": 140, "name": "icon", "height": 140 }, "compId": 327 }, { "type": "Text", "props": { "y": 159, "x": 70, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 328 }] }, { "type": "Button", "props": { "y": 211, "x": 561, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 330 }, { "type": "Button", "props": { "y": 726, "x": 0, "var": "MoreGameBtn", "stateNum": 1, "skin": "Main/gengduoyouxi.png" }, "compId": 333 }, { "type": "Image", "props": { "visible": false, "var": "BoxPanel", "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "10,12,14,10", "right": 0, "left": 0, "bottom": 0 }, "compId": 337, "child": [{ "type": "Image", "props": { "y": 114, "x": 158.5, "skin": "Main/baoxiang-1-1.png" }, "compId": 339 }, { "type": "Image", "props": { "y": 272, "x": 165, "skin": "Main/baoxiang-1-2.png" }, "compId": 341 }, { "type": "Image", "props": { "y": 371, "x": 236, "skin": "Main/baoxiang-1-3.png" }, "compId": 340 }, { "type": "Button", "props": { "y": 756, "x": 205.5, "var": "VideoGetCoinBtn", "stateNum": 1, "skin": "Main/baoxiang-1-4.png" }, "compId": 342 }, { "type": "Button", "props": { "y": 912, "x": 312, "var": "CloseVideoBtn", "stateNum": 1, "skin": "Main/baoxiang-1-5.png" }, "compId": 344 }] }], "animations": [{ "nodes": [{ "target": 293, "keyframes": { "x": [{ "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 0 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 15 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 30 }, { "value": 326, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 45 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 60 }] } }], "name": "gameStart", "id": 1, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 315, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 20 }] } }], "name": "lefticon", "id": 2, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 316, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 20 }] } }], "name": "righticon", "id": 3, "frameRate": 24, "action": 0 }], "loadList": ["Main/jindu-duan.png", "Main/jindu-guan-do.png", "Main/guanshu.png", "Main/shadi.png", "Main/jinbi-di.png", "Main/jinbi-zhu.png", "Main/shezhi.png", "Main/ButtonVibrationOff.png", "Main/ButtonVibrationOn.png", "Main/Icon_SoundOn.png", "Main/Icon_SoundOff.png", "Main/shengji.png", "Main/shangdain.png", "Main/gengduoyouxo-2.png", "Main/zhiyin-di.png", "Main/pause1.png", "Main/shouzhi.png", "Main/fangxiangzuo.png", "Main/fangxiangyou.png", "Main/chunhei2.png", "Main/bg-box.png", "Main/hutui-1-4.png", "Main/exit2.png", "Main/gengduoyouxi.png", "Main/chunhei.png", "Main/baoxiang-1-1.png", "Main/baoxiang-1-2.png", "Main/baoxiang-1-3.png", "Main/baoxiang-1-4.png", "Main/baoxiang-1-5.png"], "loadList3D": [] }; ui.MainViewUI = MainViewUI; REG("ui.MainViewUI", MainViewUI); class ShadeViewUI extends Laya.View { constructor() { super(); } createChildren() { super.createChildren(); this.createView(ShadeViewUI.uiView); } } ShadeViewUI.uiView = { "type": "View", "props": { "width": 720, "height": 1280 }, "compId": 2, "loadList": [], "loadList3D": [] }; ui.ShadeViewUI = ShadeViewUI; REG("ui.ShadeViewUI", ShadeViewUI); class SkinShopViewUI extends Laya.View { constructor() { super(); } createChildren() { super.createChildren(); this.createView(SkinShopViewUI.uiView); } } SkinShopViewUI.uiView = { "type": "View", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "13,14,14,13", "right": 0, "left": 0, "bottom": 0 }, "compId": 115 }, { "type": "Image", "props": { "top": 0, "skin": "Main/bg-sheng1.png", "right": 0, "left": 0, "bottom": 0 }, "compId": 3 }, { "type": "Image", "props": { "y": 238, "x": 0, "skin": "Main/pifu-biaoti.png" }, "compId": 92 }, { "type": "Box", "props": { "x": 50, "width": 626, "height": 102, "centerY": -70 }, "compId": 100, "child": [{ "type": "Button", "props": { "y": 0, "x": 0, "width": 83, "var": "leftBtn", "stateNum": 1, "height": 88 }, "compId": 93, "child": [{ "type": "Image", "props": { "y": 3, "x": 3, "skin": "Main/wu-you.png", "name": "leftFalse" }, "compId": 95 }, { "type": "Image", "props": { "y": 3, "x": 3, "skin": "Main/you-zuo.png", "name": "leftTrue" }, "compId": 96 }] }, { "type": "Button", "props": { "y": 51, "x": 572, "width": 94, "var": "rightBtn", "stateNum": 1, "pivotY": 51, "pivotX": 51, "height": 97 }, "compId": 97, "child": [{ "type": "Image", "props": { "y": 51, "x": 51, "width": 80, "skin": "Main/wu-zuo.png", "rotation": 180, "pivotY": 42, "pivotX": 40, "name": "rightFalse", "height": 84 }, "compId": 98 }, { "type": "Image", "props": { "y": 51, "x": 51, "width": 80, "skin": "Main/you-you.png", "pivotY": 42, "pivotX": 40, "name": "rightTrue", "height": 84 }, "compId": 99 }] }] }, { "type": "Image", "props": { "x": 163.5, "skin": "Main/dizuo.png", "centerY": 199 }, "compId": 101 }, { "type": "Image", "props": { "x": 173.5, "width": 379, "var": "viewPort", "height": 426, "centerY": 14 }, "compId": 102 }, { "type": "Box", "props": { "x": 196, "width": 331, "var": "btnBox", "height": 127, "centerY": 396 }, "compId": 113, "child": [{ "type": "Image", "props": { "y": 9, "x": 0, "var": "using", "skin": "Main/bt.png" }, "compId": 103, "child": [{ "type": "Text", "props": { "y": 22, "x": 54.5, "width": 202, "valign": "middle", "text": "使用中", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 104 }] }, { "type": "Image", "props": { "y": 9, "x": 0, "var": "use", "skin": "Main/bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 105, "child": [{ "type": "Text", "props": { "y": 22, "x": 54.5, "width": 202, "valign": "middle", "text": "使用", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 106 }] }, { "type": "Image", "props": { "y": 9, "x": 0, "var": "coin", "skin": "Main/bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 107, "child": [{ "type": "Image", "props": { "y": 26.5, "x": 40, "width": 53, "skin": "Main/jinbi-zhu.png", "height": 56 }, "compId": 109, "child": [{ "type": "Text", "props": { "y": -4.5, "x": 37, "width": 202, "valign": "middle", "text": "500", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 108 }] }] }, { "type": "Image", "props": { "y": 9, "x": 0, "var": "video", "skin": "Main/bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 110, "child": [{ "type": "Image", "props": { "y": 24, "x": 46, "width": 65, "skin": "Main/shipin-biao.png", "height": 61 }, "compId": 111, "child": [{ "type": "Text", "props": { "y": -2, "x": 63, "width": 202, "valign": "middle", "text": "1/3", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 112 }] }] }] }, { "type": "Button", "props": { "y": 155, "x": 562.5, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 116 }, { "type": "Button", "props": { "y": 131, "x": 18, "var": "CloseBtn", "stateNum": 1, "skin": "Main/guanbi-bt.png" }, "compId": 117 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/bg-sheng1.png", "Main/pifu-biaoti.png", "Main/wu-you.png", "Main/you-zuo.png", "Main/wu-zuo.png", "Main/you-you.png", "Main/dizuo.png", "Main/bt.png", "Main/jinbi-zhu.png", "Main/shipin-biao.png", "Main/exit2.png", "Main/guanbi-bt.png"], "loadList3D": [] }; ui.SkinShopViewUI = SkinShopViewUI; REG("ui.SkinShopViewUI", SkinShopViewUI); class TopTipUiUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(TopTipUiUI.uiView); } } TopTipUiUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "var": "bg", "top": 0, "skin": "Main/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0 }, "compId": 3 }, { "type": "Image", "props": { "y": 647, "x": 159, "width": 402, "var": "sliderBox", "skin": "Main/huadong-tiao.png", "height": 33, "gray": false, "centerY": 23 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 124, "x": 37, "skin": "Main/pause1.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 0, "x": 201, "skin": "Main/shou.png", "anchorX": 0.5 }, "compId": 6 }] }], "animations": [{ "nodes": [{ "target": 6, "keyframes": { "x": [{ "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 0 }, { "value": 13, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 15 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 30 }, { "value": 402, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 45 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 60 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/huadong-tiao.png", "Main/pause1.png", "Main/shou.png"], "loadList3D": [] }; ui.TopTipUiUI = TopTipUiUI; REG("ui.TopTipUiUI", TopTipUiUI); class TrialViewUI extends Laya.Scene { constructor() { super(); } createChildren() { super.createChildren(); this.createView(TrialViewUI.uiView); } } TrialViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "11,11,13,10", "right": 0, "left": 0, "bottom": 0 }, "compId": 3 }, { "type": "Image", "props": { "y": 97, "x": 125, "skin": "Main/biaoti.png" }, "compId": 4 }, { "type": "Image", "props": { "y": 221, "x": 98, "visible": false, "skin": "Main/shiyong-bg.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 657, "x": 170, "skin": "Main/dizuo.png" }, "compId": 6 }, { "type": "Image", "props": { "y": 357, "x": 169, "width": 380, "var": "viewPort", "height": 398 }, "compId": 8 }, { "type": "Button", "props": { "y": 203, "x": 570, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 13 }, { "type": "Image", "props": { "y": 1192, "x": 287, "var": "backBtn", "skin": "Main/no-bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 9 }, { "type": "Image", "props": { "x": 212, "var": "videoBtn", "skin": "Main/sanbeilingqu--s.png", "runtime": "View/Com/ButtonRunTime.ts", "bottom": 350 }, "compId": 10 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/biaoti.png", "Main/shiyong-bg.png", "Main/dizuo.png", "Main/exit2.png", "Main/no-bt.png", "Main/sanbeilingqu--s.png"], "loadList3D": [] }; ui.TrialViewUI = TrialViewUI; REG("ui.TrialViewUI", TrialViewUI); })(ui || (ui = {})); class GuangGao { constructor() { GuangGao.ins = this; } static get Instance() { if (GuangGao.ins == null) { return new GuangGao(); } return GuangGao.ins; } static InitVideo() { if (!Laya.Browser.onWeiXin) return; this.fsaasfafssfa = Laya.Browser.window.wx.createRewardedVideoAd({ adUnitId: this.videlAdUnitId }); this.fsaasfafssfa.onLoad(() => { console.log('激励视频 广告加载成功'); this.asfasfsaffsa = true; }); this.fsaasfafssfa.onError(err => { console.log("激励视屏加载失败:" + err); this.asfasfsaffsa = false; }); this.afsfsaafsfsa = true; } static ShowVideo(callback) { if (this.asfasfsaffsa) { console.log("showVideoAd:" + this.asfasfsaffsa); this.SetVideoCallBack(callback); this.fsaasfafssfa.show().catch(err => { this.fsaasfafssfa.load().then(() => { this.SetVideoCallBack(callback); this.fsaasfafssfa.show(); }); }); } } static SetVideoCallBack(callback) { this.fsaasfafssfa.offClose(); this.fsaasfafssfa.onClose(res => { console.log("激励视频关闭:" + res.isEnded); if (res && res.isEnded || res === undefined) { callback && callback(true); } else { callback && callback(false); } this.fsaasfafssfa.offClose(); }); } static OpenBanner(gap = 0, callVack = null, iswait = false) { if (!Laya.Browser.onWeiXin) { callVack && callVack(null); return; } this.canshowbanner = true; var idd = this.bannerAdUnitId; console.log("adUnitId:" + idd); let newBanner = Laya.Browser.window.wx.createBannerAd({ adUnitId: idd, style: { left: 0, top: 0, width: 460 } }); newBanner.onError(err => { console.log(err); callVack && callVack(null); }); newBanner.onLoad(() => { if (this.curbanner) this.curbanner.destroy(); this.curbanner = newBanner; var hight = this.GetRealHight(gap); if (callVack != null) { callVack(hight); } if (this.canshowbanner && !iswait) { this.curbanner.show(); } else { this.curbanner.hide(); } }); } static GetRealHight(gap) { if (this.curbanner) { let info = Laya.Browser.window.wx.getSystemInfoSync(); this.curbanner.style.width = info.windowWidth; this.curbanner.style.top = info.windowHeight - this.curbanner.style.realHeight - gap; return Laya.stage.height / info.windowHeight * this.curbanner.style.realHeight; } } static Clear() { Laya.timer.clearAll(this); Laya.Tween.clearAll(this); this.canshowbanner = false; if (this.curbanner) this.curbanner.hide(); } static hidebanner() { if (!Laya.Browser.onWeiXin) return; if (this.curbanner) this.curbanner.hide(); } static showbanner() { if (!Laya.Browser.onWeiXin) return; if (this.curbanner) this.curbanner.show(); } static get cancheat() { if (!UserInfoManager.Cheat) { console.log("cheat:false-> CurAccountData.cheat != 1"); return false; } var checkscence = UserInfoManager.CheckScene; if (checkscence == false) { console.log("cheat:true-> " + GameVersion.wxValue); return true; } if (GameVersion.wxValue == "1037" || GameVersion.wxValue == "1058" || GameVersion.wxValue == "1067" || GameVersion.wxValue == "1095") { console.log("cheat:true-> " + GameVersion.wxValue); return true; } console.log("cheat:false-> " + GameVersion.wxValue); return false; } showBanner(success = null, fail = null, gap = 0) { if (!Laya.Browser.onWeiXin) { success && success(null); return; } let ad = GuangGao.bannerAdUnitId; let bannerAd = Laya.Browser.window.wx.createBannerAd({ adUnitId: ad, style: { left: 0, top: 0, width: 460 } }); bannerAd.onLoad(() => { console.log("[LOG] Banner广告加载成功"); this.hideBanner(); this._bannerAd = bannerAd; let info = Laya.Browser.window.wx.getSystemInfoSync(); this._bannerAd.style.width = info.windowWidth; this._bannerAd.style.top = info.windowHeight - this._bannerAd.style.realHeight - 10; this._bannerAd.show(); var hight = GuangGao.GetRealHight2(this._bannerAd, gap); let data = {}; data["banner"] = this._bannerAd; data["gap"] = hight; success && success(data); }); bannerAd.onError(err => { console.log("[LOG] Banner广告加载失败"); console.log(err); fail && fail(); }); } hideBanner() { if (!Laya.Browser.onWeiXin) return; if (this._bannerAd) { this._bannerAd.hide(); this._bannerAd.destroy(); this._bannerAd = null; } } showBanner2(success = null, fail = null, gap = 0) { if (!Laya.Browser.onWeiXin) { success && success(null); return; } let ad = GuangGao.bannerAdUnitId2; let bannerAd = Laya.Browser.window.wx.createBannerAd({ adUnitId: ad, style: { left: 0, top: 0, width: 460 } }); bannerAd.onLoad(() => { console.log("[LOG] Banner广告加载成功"); this.hideBanner2(); this._bannerAd2 = bannerAd; let info = Laya.Browser.window.wx.getSystemInfoSync(); this._bannerAd2.style.width = info.windowWidth; this._bannerAd2.style.top = info.windowHeight - this._bannerAd2.style.realHeight - 10; this._bannerAd2.show(); var hight = GuangGao.GetRealHight2(this._bannerAd2, gap); let data = {}; data["banner"] = this._bannerAd2; data["gap"] = hight; console.log("data>>>>>", data); success && success(data); }); bannerAd.onError(err => { console.log("[LOG] Banner广告加载失败"); console.log(err); fail && fail(); }); } hideBanner2() { if (!Laya.Browser.onWeiXin) return; if (this._bannerAd2) { this._bannerAd2.hide(); this._bannerAd2.destroy(); this._bannerAd2 = null; } } showBanner3(success = null, fail = null, gap = 0) { if (!Laya.Browser.onWeiXin) { success && success(null); return; } let ad = GuangGao.bannerAdUnitId3; let bannerAd = Laya.Browser.window.wx.createBannerAd({ adUnitId: ad, style: { left: 0, top: 0, width: 460 } }); bannerAd.onLoad(() => { console.log("[LOG] Banner广告加载成功"); this.hideBanner3(); this._bannerAd3 = bannerAd; let info = Laya.Browser.window.wx.getSystemInfoSync(); this._bannerAd3.style.width = info.windowWidth; this._bannerAd3.style.top = info.windowHeight - this._bannerAd3.style.realHeight - 10; this._bannerAd3.show(); var hight = GuangGao.GetRealHight2(this._bannerAd3, gap); let data = {}; data["banner"] = this._bannerAd2; data["gap"] = hight; success && success(data); }); bannerAd.onError(err => { console.log("[LOG] Banner广告加载失败"); console.log(err); fail && fail(); }); } hideBanner3() { if (!Laya.Browser.onWeiXin) return; if (this._bannerAd3) { this._bannerAd3.hide(); this._bannerAd3.destroy(); this._bannerAd3 = null; } } static CheatBanner(btn, complete = null, gap = 0) { btn.mouseEnabled = false; GuangGao.Instance.showBanner((height) => { if (height == null) { btn.mouseEnabled = true; } else { let _height = Number(height["gap"]); height["banner"].hide(); console.log("cheatstart", "bottom:100"); btn.mouseEnabled = false; console.log("——height--", _height); var end = Laya.stage.height - _height - btn.height - 50; console.log("y:" + end); Laya.timer.once(UserInfoManager.CheatTime * 1000, this, () => { height["banner"].show(); Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => { btn.mouseEnabled = true; console.log("上移成功cheat1--"); if (complete != null) { complete(); } })); }); } }); } static CheatBanner2(btn, complete = null, gap = 0) { btn.mouseEnabled = false; GuangGao.Instance.showBanner2((height) => { if (height == null) { btn.mouseEnabled = true; } else { let _height = Number(height["gap"]); height["banner"].hide(); console.log("cheatstart", "bottom:100"); console.log("——height--", _height); var end = Laya.stage.height - _height - btn.height - 50; console.log("y:" + end); Laya.timer.once(UserInfoManager.CheatTime * 1000, this, () => { height["banner"].show(); Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => { btn.mouseEnabled = true; console.log("上移成功cheat2---"); height["banner"].hide(); GuangGao.Instance.showBanner3(); if (complete != null) { complete(); } })); }); } }); } static CheatBanner3(btn, complete = null, gap = 0) { btn.mouseEnabled = false; GuangGao.Instance.showBanner3((height) => { if (height == null) { btn.mouseEnabled = true; } else { let _height = Number(height["gap"]); height["banner"].hide(); console.log("cheatstart", "bottom:100"); console.log("——height--", _height); var end = Laya.stage.height - _height - btn.height - 50; console.log("y:" + end); Laya.timer.once(UserInfoManager.CheatTime * 1000, this, () => { height["banner"].show(); Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => { console.log("上移成功cheat3--"); btn.mouseEnabled = true; height["banner"].hide(); GuangGao.Instance.showBanner(); if (complete != null) { complete(); } })); }); } }); } static GetRealHight2(banner, gap) { if (banner) { let info = Laya.Browser.window.wx.getSystemInfoSync(); banner.style.width = info.windowWidth; banner.style.top = info.windowHeight - banner.style.realHeight - gap; console.log("banner真实高度为---", Laya.stage.height / info.windowHeight * banner.style.realHeight); return Laya.stage.height / info.windowHeight * banner.style.realHeight; } } } GuangGao.videlAdUnitId = "adunit-0fb53ab4969d46bb"; GuangGao.bannerAdUnitId = "adunit-de3afc5da6054394"; GuangGao.bannerAdUnitId2 = "adunit-72492b628fc3dee9"; GuangGao.bannerAdUnitId3 = "adunit-a0e0b5dbf2b6c840"; GuangGao.afsfsaafsfsa = false; GuangGao.asfasfsaffsa = false; GuangGao.canshowbanner = true; GuangGao.bannerhigt = 0; var Tween$1 = Laya.Tween; class LoadView extends ui.LoadViewUI { constructor() { super(); this.proCom = false; this.a = new Laya.Vector3(); this.loadResCom = false; this.loginCom = false; this.errorTime = 0; this.timers = 0; this.subLoadCom = false; LoadView.instance = this; DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize); } static get Instance() { return LoadView.instance; } Resize() { this.height = Laya.stage.height; } OnShow(data) { this.proTex.text = "0%"; this.pro1.width = 0; this.RefreshUI(); this.LoginGame(); this.LoadSubpackage(); Laya.timer.frameOnce(5, this, () => { this.Resize(); }); WXSdk.AldEvent("进入加载加载界面!"); let _new = Laya.LocalStorage.getItem("newuser"); if (_new) { this.newuser = false; } else { this.newuser = true; Laya.LocalStorage.setItem("newuser", "1"); } } RefreshData() { this.proLen = this.pro.width; } RegButton() { } RefreshUI() { Tween$1.to(this.a, { x: 1, update: new Laya.Handler(this, () => { var num = this.a.x; this.pro1.width = this.proLen * num; num = num * 100; this.proTex.text = Math.ceil(num) + "%"; }) }, 1500, Laya.Ease.quadInOut, new Laya.Handler(this, () => { this.proTex.text = "100%"; this.pro1.width = this.proLen; this.proCom = true; this.AllCom(); })); } LoadRes() { if (this.subLoadCom && this.loginCom) { ResourcesManager.Instance.Load(() => { WXSdk.AldEvent("资源加载成功"); this.loadResCom = true; this.AllCom(); }); } } LoginGame() { if (GameVersion.isWx) { WXSdk.Login((data) => { this.onWxLoginHandler(data); }); } else { this.LocalLogin(); } } onWxLoginHandler(params) { console.log("微信回调成功!"); console.log(params); if (params == "error" || params.code == null) { if (this.errorTime == 0) { WXSdk.AldEvent("微信登录失败"); } this.errorTime++; if (this.errorTime >= 3) return; WXSdk.Login((data) => { this.onWxLoginHandler(data); }); } else { if (this.errorTime == 0) { WXSdk.AldEvent("微信登录成功!"); } let systemInfo = WXSdk.SystemInfo(); let platformModel = "ipx"; if (systemInfo != null) { var model = systemInfo.model; platformModel = `${systemInfo.brand}_${model}_${systemInfo.system}_wx${systemInfo.version}_SDKVer${systemInfo.SDKVersion}`; console.log("platformModel:" + platformModel); } new UserModel(params.code, params.nickName, params.avatarUrl, params.gender, params.country, params.province, params.city, platformModel, WXSdk.ShareId, WXSdk.Chanel); this.LocalLogin(); } } LocalLogin() { NetManager.Instance.login(null, (data) => { this.OnLoginComplete(data); }, (data) => { this.OnLoginError(data); }); } OnLoginComplete(data) { if (data["code"] != "0") { console.log("登录异常错误!"); WXSdk.AldEvent("本地登录成功!"); this.timers++; if (this.timers >= 4) return; if (GameVersion.isWx) { WXSdk.Login((data) => { this.onWxLoginHandler(data); }); } else { this.LocalLogin(); } } else { this.loginCom = true; this.LoadRes(); FYHD_Sdk.InitSdk(); this.AllCom(); } } OnLoginError(data) { console.log("登录错误"); WXSdk.AldEvent("本地登陆失败"); } LoadSubpackage() { WXSdk.LoadSubPackage("subpackage", (com) => { if (com) { console.log("subpackage com++++++++++++++++"); LoadView.instance.subLoadCom = true; LoadView.instance.LoadRes(); } }); } AllCom() { if (this.proCom && this.loadResCom && this.loginCom) { GuangGao.InitVideo(); Laya.timer.once(1000, this, () => { FYHD_Sdk.ValueUser(); WXSdk.AldEvent("进入主界面"); ViewManager.Instance.OpenView(ViewType.MainView); if (!this.newuser && FYHD_Sdk.iswhite) { ViewManager.Instance.AddView(ViewType.GiftView); } MouseEvent.Instance.InitMouseEvent(); ShareModule.OnShowHandle(); SettingController.Instance.Init(); OnHideHandler.Reg(); SettingController.Instance._playMusic(); }); } } OnClose() { LoadView.instance = null; DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize); } } class MainView extends ui.MainViewUI { constructor() { super(); this.isTryed = false; MainView.instance = this; this.Resize(); DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize); } static get Instance() { return MainView.instance; } OnShow(data) { this.RefreshData(); this.RegButton(); this.RefreshUI(); this.SetData(); this.SetTopAd(); } RefreshUI() { this.user_id.text = "user_id:" + UserModel.Instance.CurModel.m_userid; this.SetPlayerGrade(UserModel.Instance.CurModel.GetUserAttr(UserAttr.money)); this.SetStage(); this.SetStagePro(0); this.SetSettingBox(false); this.MoreFunBtn2.bottom = this.sliderBox.bottom + 155; } RefreshData() { this.GetImage(); this.coinFollow = new FollowNumber(0.1, 0, 0, 0.1); this.proWidth = this.pro.width; this.isTryed = false; } AdaptiveUI() { } moreFunc(ist) { if (ist) ; else { console.log("mainui"); } } RegButton() { this.on(Laya.Event.MOUSE_DOWN, this, this.StartGame); this.settingBtn.CZ = () => { this.SetSettingBox(); }; this.skinBtn.CZ = () => { ViewManager.Instance.AddView(ViewType.SKinShopView); }; this.updateBtn.CZ = () => { ViewManager.Instance.AddView(ViewType.IntensifyView); }; DispatcherManager.on(EventType.Event.ShowMainUi, this, this.ShowMainBox); DispatcherManager.on(EventType.Event.SetMonery, this, this.SetPlayerGrade); DispatcherManager.on(EventType.Event.SetStage, this, this.SetStage); DispatcherManager.on(EventType.Event.SetStagePro, this, this.SetStagePro); this.sound_btn.clickHandler = new Laya.Handler(this, () => { this.ClickSound(); }); this.shake_btn.clickHandler = new Laya.Handler(this, () => { this.ClickShake(); }); this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit); this.MoreGameBtn.clickHandler = new Laya.Handler(this, this.ClickExport); this.MoreFunBtn2.clickHandler = new Laya.Handler(this, this.ClickExport); this.ExitBtn.visible = FYHD_Sdk.iswhite; this.VideoGetCoinBtn.clickHandler = new Laya.Handler(this, this.VideoGet); this.CloseVideoBtn.clickHandler = new Laya.Handler(this, this.CloseVideoGet); } ClickExit() { ViewManager.Instance.AddView(ViewType.ExitView); } ClickExport() { ViewManager.Instance.AddView(ViewType.ExportView); } SetStage() { this.stageValue.text = PlayerManager.Instance.stage.toString(); } SetStagePro(value) { value = value >= 1 ? 1 : value; this.pro1.width = this.proWidth * value; } SetPlayerGrade(num) { this.tempTarGrade = num; this.coinFollow.target = num; Laya.timer.frameLoop(1, this, this.T2); } T2() { this.coinFollow.update(); let v = Math.ceil(this.coinFollow.follow); this.countValue.text = v.toString(); if (v >= this.tempTarGrade) { this.countValue.text = this.tempTarGrade.toString(); Laya.timer.clear(this, this.T2); } } StartGame(e) { if (this.isTryed) { this.TryStartGame(); return; } if (e.target instanceof Laya.UIComponent) { if (e.target.name != "mainBox") return; } console.log("click"); let param = [{ "t": UserModel.Instance.CurModel.ServerTime }]; NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Start, param, (data) => { if (data["play_id"]) { PlayerManager.Instance.Play_Id = data["play_id"]; } WXSdk.Start(PlayerManager.Instance.stage.toString()); if (GameManager.GameCount == 1) { ViewManager.Instance.AddView(ViewType.TrialView); } else { this.MainStartGame(); } }, (data) => { }); } MainStartGame() { GameManager.GameCount++; GameManager.GameNum++; this.mainBox.visible = false; this.sliderBox.visible = false; this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame); this.gameStart.stop(); GameManager.Instance.Start(); MouseEvent.Instance.StartGameClick(); MainRoleManager.Instance.Start(); MateManager.Instance.TrialModelPlayAni(); StreetManager.Instance.SetBlock(); } TryStartGame() { GameManager.GameCount++; GameManager.GameNum++; this.sliderBox.visible = false; this.gameStart.stop(); this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame); GameManager.Instance.Start(); MouseEvent.Instance.StartGameClick(); MainRoleManager.Instance.Start(); MateManager.Instance.TrialModelPlayAni(); StreetManager.Instance.SetBlock(); } TryClick() { this.isTryed = true; this.mainBox.visible = false; } ShowMainBox() { this.mainBox.visible = true; this.sliderBox.visible = true; this.gameStart.play(0, true); this.SetPlayerGrade(UserModel.Instance.CurModel.GetUserAttr(UserAttr.money)); this.isTryed = false; this.on(Laya.Event.MOUSE_DOWN, this, this.StartGame); } SetSettingBox(ist = true) { if (!ist) { this.settingBox.visible = false; return; } this.settingBox.visible = !this.settingBox.visible; } GetImage() { this.sound_open = this.sound_btn.getChildByName("kai"); this.sound_guan = this.sound_btn.getChildByName("guan"); this.shake_open = this.shake_btn.getChildByName("kai"); this.shake_guan = this.shake_btn.getChildByName("guan"); this.ShowSound(SettingController.Instance.sound); this.ShowShake(SettingController.Instance.vibrate); } ClickSound() { SettingController.Instance.sound = !SettingController.Instance.sound; this.ShowSound(SettingController.Instance.sound); } ShowSound(isshow) { if (!isshow) { this.sound_open.visible = false; this.sound_guan.visible = true; SettingController.Instance.SettingSound(0); Laya.LocalStorage.setItem("sound", "0"); console.log("关闭声音"); } else { this.sound_open.visible = true; this.sound_guan.visible = false; SettingController.Instance.SettingSound(1); Laya.LocalStorage.setItem("sound", "1"); console.log("开启声音"); } } ClickShake() { SettingController.Instance.vibrate = !SettingController.Instance.vibrate; this.ShowShake(SettingController.Instance.vibrate); } ShowShake(isshow) { if (!isshow) { this.shake_open.visible = false; this.shake_guan.visible = true; Laya.LocalStorage.setItem("vibrate", "0"); console.log("关闭震动"); } else { this.shake_open.visible = true; this.shake_guan.visible = false; Laya.LocalStorage.setItem("vibrate", "1"); console.log("开启震动"); } } OnClose() { this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame); DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize); DispatcherManager.off(EventType.Event.ShowMainUi, this, this.ShowMainBox); DispatcherManager.off(EventType.Event.SetMonery, this, this.SetPlayerGrade); DispatcherManager.off(EventType.Event.SetStage, this, this.SetStage); DispatcherManager.off(EventType.Event.SetStagePro, this, this.SetStagePro); MainView.instance = null; Laya.timer.clearAll(this); } Resize() { this.height = Laya.stage.height; } SetData() { FYHD_Sdk.SetHuTuiList(this.BottomList, 2, ""); this.GunGun(); } GunGun() { var maxBtm; try { this.BottomList.scrollBar.value = 0; maxBtm = this.BottomList.scrollBar.max; } catch (error) { console.error(error); return; } var tempBtm = 1; Laya.timer.frameLoop(1, this, () => { this.BottomList.scrollBar.value += tempBtm; if (this.BottomList.scrollBar.value >= maxBtm || this.BottomList.scrollBar.value <= 0) { tempBtm = -tempBtm; } }); } SetTopAd() { if (Laya.Browser.onPC) return; this.topAdData = FYHD_Sdk.pushData || []; this.LeftPushIcon.visible = this.RightPushIcon.visible = this.topAdData.length >= 2; if (this.topAdData.length < 2) return; this.topLeftAdIndex = { index: 0 }; this.topRightAdIndex = { index: 1 }; this._setTopAd(this.LeftPushIcon, this.topLeftAdIndex); this._setTopAd(this.RightPushIcon, this.topRightAdIndex); } _setTopAd(topAd, adIndex) { let _icon = topAd.getChildByName("icon"); let _name = topAd.getChildByName("name"); topAd.clickHandler = new Laya.Handler(this, () => { FYHD_Sdk.ShowHuTuiJump(this.topAdData[adIndex.index]); }); this._setIcon(_icon, _name, adIndex); Laya.timer.loop(3000, this, () => { this._setIcon(_icon, _name, adIndex); this.lefticon.play(null, false); this.righticon.play(null, false); }); } _setIcon(_icon, _name, adIndex) { adIndex.index = (adIndex.index + 2) % this.topAdData.length; _icon.skin = this.topAdData[adIndex.index].icon; _name.text = this.topAdData[adIndex.index].togame_name; } ShowBoxPanel() { this.BoxPanel.visible = true; this.CloseVideoBtn.visible = false; Laya.timer.once(2000, this, () => { this.CloseVideoBtn.visible = true; }); GuangGao.Instance.showBanner2((_banner) => { if (_banner) { this.banner = _banner["banner"]; } }); } HideBoxPanel() { this.BoxPanel.visible = false; if (this.banner) { this.banner.hide(); } } VideoGet() { GuangGao.ShowVideo((isLoad) => { if (isLoad) { var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": "200" }]; NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => { ViewManager.Instance.ShowTips("金币:X" + 200); this.HideBoxPanel(); }, (data) => { }); } }); } CloseVideoGet() { this.HideBoxPanel(); } } class CompleteView extends ui.CompleteViewUI { constructor() { super(); this.isWin = false; this.clicknum = 0; CompleteView.instance = this; this.Resize(); DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize); } static get Instance() { return CompleteView.instance; } OnShow(data) { this.isWin = data; this.RefreshData(); this.RegButton(); this.RefreshUI(); this.SetTopAd(); if (GameManager.GameCount == 1 || GameManager.GameCount >= 4) { GuangGao.Instance.showBanner((_banner) => { if (_banner) { this.banner = _banner["banner"]; console.log("banner加载完毕---", this.banner); } }); this.nextBtn.y = Laya.stage.height - this.nextBtn.height - 300; } else { if (FYHD_Sdk.iswhite) { this.nextBtn.y = Laya.stage.height - this.nextBtn.height - 50; } else { GuangGao.Instance.showBanner((_banner) => { if (_banner) { this.banner = _banner["banner"]; console.log("banner加载完毕---", this.banner); } }); this.nextBtn.y = Laya.stage.height - this.nextBtn.height - 300; } } } Resize() { this.height = Laya.stage.height; } RefreshData() { this.coinValue = this.isWin == true ? LevelController.Instance._level.gold : LevelController.Instance._level.fail_gold; this.tes1 = this.coinValue; this.coinValue += (PlayerManager.tower_reward * GameManager.Instance.towerCount + PlayerManager.enemy_reward * GameManager.Instance.roleCount + PlayerManager.block_reward * GameManager.Instance.blockCount); let iswin = this.isWin == true ? 1 : 0; let count = this.coinValue; let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "play_id": PlayerManager.Instance.Play_Id }, { "win": iswin }, { "money": count }]; NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.GameResult, param, (data) => { }, (data) => { ViewManager.Instance.ShowTips("结算失败"); }); if (this.isWin) { SettingController.Instance.PlaySound(SoundType.win); WXSdk.Success(PlayerManager.Instance.stage.toString()); } else { SettingController.Instance.PlaySound(SoundType.defeat); WXSdk.Fail(PlayerManager.Instance.stage.toString()); } } RegButton() { this.ExitBtn.visible = FYHD_Sdk.iswhite; this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit); this.doublegetBtn.CZ = () => { this.DoubleGet(); }; this.nextBtn.CZ = () => { this.clicknum++; if (GameManager.GameCount <= 1 || GameManager.GameCount >= 4) { if (this.isWin) { this.Next(); } else { this.Resset(); } } else { if (FYHD_Sdk.iswhite) { if (this.clicknum <= 1) { GuangGao.CheatBanner3(this.nextBtn, () => { }); } else { if (this.isWin) { this.Next(); } else { this.Resset(); } } } else { if (this.isWin) { this.Next(); } else { this.Resset(); } } } }; } ClickExit() { ViewManager.Instance.AddView(ViewType.ExitView); } Next() { GameManager.Instance.LevelUp(); } Resset() { ViewManager.Instance.CloseView(ViewType.CompleteView); GameManager.Instance.ReStart(); } OnClose() { DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize); CompleteView.instance = null; Laya.timer.clearAll(this); if (FYHD_Sdk.iswhite) { if (GuangGao.Instance._bannerAd3) { GuangGao.Instance._bannerAd3.hide(); } if (GuangGao.Instance._bannerAd) { GuangGao.Instance._bannerAd.hide(); } } if (GameManager.GameNum == 1) { if (GameManager.GameCount <= 3 && FYHD_Sdk.iswhite) { ViewManager.Instance.AddView(ViewType.GoldEggView); } ViewManager.Instance.AddView(ViewType.ExportView); } else { if (GameManager.GameCount <= 3 && FYHD_Sdk.iswhite) { ViewManager.Instance.AddView(ViewType.GoldEggView); } ViewManager.Instance.AddView(ViewType.ExportView, true); } } RefreshUI() { this.winTop.visible = this.isWin; this.shibaiTop.visible = !this.isWin; this.valueText.text = "+" + this.coinValue; this.towerCount.text = "X" + GameManager.Instance.towerCount.toString(); this.towerValue.text = (PlayerManager.tower_reward * GameManager.Instance.towerCount).toString(); this.roleCount.text = "X" + GameManager.Instance.roleCount.toString(); this.roleValue.text = (PlayerManager.enemy_reward * GameManager.Instance.roleCount).toString(); this.blockCount.text = "X" + GameManager.Instance.blockCount.toString(); this.blockValue.text = (PlayerManager.block_reward * GameManager.Instance.blockCount).toString(); } DoubleGet() { GuangGao.ShowVideo((isok) => { if (isok) { WXSdk.AldEvent("结束界面看视屏获得钱"); var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": (this.coinValue * 2).toString() }]; NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => { ViewManager.Instance.ShowTips("金币:X" + (this.coinValue * 3)); this.Next(); }, (data) => { }); } }); } SetTopAd() { if (Laya.Browser.onPC) return; this.topAdData = FYHD_Sdk.pushData || []; if (this.topAdData.length < 4) return; this.topLeftAdIndex = { index: 0 }; this.topRightAdIndex = { index: 1 }; this.bottomleftAdIndex = { index: 2 }; this.bottomRightAdIndex = { index: 3 }; this._setTopAd(this.LeftTopPushIcon, this.topLeftAdIndex); this._setTopAd(this.LeftBottomPushIcon, this.bottomleftAdIndex); this._setTopAd(this.RightTopPushIcon, this.topRightAdIndex); this._setTopAd(this.RightBottomPushIcon, this.bottomRightAdIndex); } _setTopAd(topAd, adIndex) { let _icon = topAd.getChildByName("icon"); let _name = topAd.getChildByName("name"); topAd.clickHandler = new Laya.Handler(this, () => { FYHD_Sdk.ShowHuTuiJump(this.topAdData[adIndex.index]); }); this._setIcon(_icon, _name, adIndex); Laya.timer.loop(3000, this, () => { this._setIcon(_icon, _name, adIndex); this.pushshake.play(null, false); }); } _setIcon(_icon, _name, adIndex) { adIndex.index = (adIndex.index + 4) % this.topAdData.length; _icon.skin = this.topAdData[adIndex.index].icon; _name.text = this.topAdData[adIndex.index].togame_name; } } class InGameView extends ui.InGameViewUI { static get Instance() { return InGameView.instance; } constructor() { super(); InGameView.instance = this; this.Resize(); DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize); } OnShow(data) { this.RefreshData(); this.RegButton(); this.RefreshUI(); } Resize() { this.height = Laya.stage.height; } RefreshData() { } RegButton() { } RefreshUI() { } OnClose() { DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize); InGameView.instance = null; Laya.timer.clearAll(this); } } class IntensifyView extends ui.IntensifyViewUI { constructor() { super(); this.iscoinShowfreecoinbtn = false; this.Resize(); DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize); } OnShow(data) { this.RefreshData(); this.RegButton(); this.RefreshUI(); GuangGao.Instance.showBanner2((_banner) => { if (_banner) { this.banner = _banner["banner"]; console.log("banner加载成功--"); } }); } RefreshUI() { this.InitUi(); this.RefreshCoinShow(); let t = this.cost1 < this.cost2 ? this.cost1 : this.cost2; this.freecoinValue = Math.floor(t * 1.2); this.coinValue.text = this.freecoinValue.toString(); } RefreshData() { this.tempPowerLevel = PlayerManager.Instance.powerLevel; this.tempRateLevel = PlayerManager.Instance.rateLevel; this.RefreshData2(); } RefreshData2() { let detail = UserModel.Instance.CurModel.user_video.detail; if (!detail) this.iscoinShowfreecoinbtn = true; else { let freet = detail.freecoin; if (!freet) { this.iscoinShowfreecoinbtn = true; return; } if (freet < AppSetting.freeGetcoinTime) { this.iscoinShowfreecoinbtn = true; return; } this.iscoinShowfreecoinbtn = false; } } RegButton() { this.ExitBtn.visible = FYHD_Sdk.iswhite; this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit); this.backBtn.visible = false; Laya.timer.once(3000, this, () => { this.backBtn.visible = true; this.backBtn.clickHandler = new Laya.Handler(this, this.ClickClose); }); this.atkupBtn.clickHandler = new Laya.Handler(this, this.AtkUp); this.rateupBtn.clickHandler = new Laya.Handler(this, this.RateUp); this.getcoinBtn.clickHandler = new Laya.Handler(this, this.GetCoin); } ClickExit() { ViewManager.Instance.AddView(ViewType.ExitView); } ClickClose() { ViewManager.Instance.CloseView(ViewType.IntensifyView); } AtkUp() { if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) { ViewManager.Instance.ShowTips("金币不足!", 1); return; } PlayerManager.Instance.PowerUp(this.tempPowerLevel + 1, "money", this.cost1, (iscom) => { if (iscom) { WXSdk.AldEvent("升级界面花钱升级攻击力"); this.tempPowerLevel++; this.InitUi(); DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money)); } }); } RateUp() { if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) { ViewManager.Instance.ShowTips("金币不足!", 1); return; } PlayerManager.Instance.SpeedUp(this.tempRateLevel + 1, "money", this.cost2, (iscom) => { if (iscom) { WXSdk.AldEvent("升级界面花钱升级速度"); this.tempRateLevel++; this.InitUi(); DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money)); } }); } GetCoin() { GuangGao.ShowVideo((isok) => { if (isok) { var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": (this.freecoinValue).toString() }, { "channel": "video:freecoin" }]; NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => { WXSdk.AldEvent("升级界面看视屏获得钱"); DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money)); this.RefreshData(); this.RefreshCoinShow(); }, (data) => { }); } }); } RefreshCoinShow() { if (this.iscoinShowfreecoinbtn) { this.getcoinBtn.gray = false; this.getcoinBtn.mouseEnabled = true; } else { this.getcoinBtn.gray = true; this.getcoinBtn.mouseEnabled = false; } } InitUi() { this.atkLv.text = "LV" + this.tempPowerLevel; let al = NetInfoManager.Instance._atk.length; let t = this.tempPowerLevel > al ? al : this.tempPowerLevel; this.cost1 = NetInfoManager.Instance.GetAtk(t)["cost"]; this.atkValue.text = this.cost1.toString(); this.rateLv.text = "LV" + this.tempRateLevel; let al1 = NetInfoManager.Instance._rate.length; let t1 = this.tempRateLevel > al1 ? al1 : this.tempRateLevel; this.cost2 = NetInfoManager.Instance.GetRate(t1)["cost"]; this.rateValue.text = this.cost2.toString(); if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) { this.atkupBtn.gray = true; this.atkupBtn.mouseEnabled = false; } else { this.atkupBtn.gray = false; this.atkupBtn.mouseEnabled = true; } if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) { this.rateupBtn.gray = true; this.rateupBtn.mouseEnabled = false; } else { this.rateupBtn.gray = false; this.rateupBtn.mouseEnabled = true; } } OnClose() { DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize); if (this.tempPowerLevel != PlayerManager.Instance.powerLevel || this.tempRateLevel != PlayerManager.Instance.rateLevel) { PlayerManager.Instance.SetInfo(); } if (FYHD_Sdk.iswhite) { this.banner.hide(); } else { GuangGao.Instance.hideBanner2(); } } Resize() { this.height = Laya.stage.height; } } class AttributeUpView extends ui.AttributeUpViewUI { constructor() { super(); this.iscanShowVideoBtn = true; this.isatkvideo = false; this.isfirstatkvideo = true; this.isfirstratevideo = true; this.isratevideo = false; this.atkShow = false; this.PushDataArray = []; this.doudongcishu = 2; this.Resize(); DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize); } OnShow(data) { this.RefreshData(); this.RegButton(); this.RefreshUI(); this.InitPushData(); } RefreshUI() { this.SetUi(); } SetUi() { this.atkLv.text = "LV" + this.tempPowerLevel; let al = NetInfoManager.Instance._atk.length; let t = this.tempPowerLevel > al ? al : this.tempPowerLevel; this.cost1 = NetInfoManager.Instance.GetAtk(t)["cost"]; this.atkValue.text = this.cost1.toString(); this.rateLv.text = "LV" + this.tempRateLevel; let al1 = NetInfoManager.Instance._rate.length; let t1 = this.tempRateLevel > al1 ? al1 : this.tempRateLevel; this.cost2 = NetInfoManager.Instance.GetRate(t1)["cost"]; this.rateValue.text = this.cost2.toString(); if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) { if (this.iscanShowVideoBtn && this.isfirstatkvideo) { this.isatkvideo = true; this._atk.visible = false; this._atkVideo.visible = true; this.atkBtn.mouseEnabled = true; this.atkBtn.gray = false; this.click1.visible = true; this.atkShow = true; } else { this.atkBtn.mouseEnabled = false; this.atkBtn.gray = true; this.isatkvideo = false; this.click1.visible = false; this.atkShow = false; } } else { this._atk.visible = true; this._atkVideo.visible = false; this.atkBtn.gray = false; this.atkBtn.mouseEnabled = true; this.isatkvideo = false; this.click1.visible = true; this.atkShow = true; } if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) { if (this.iscanShowVideoBtn && this.isfirstratevideo) { this.isratevideo = true; this._rate.visible = false; this._rateVideo.visible = true; this.rateBtn.mouseEnabled = true; this.rateBtn.gray = false; if (this.atkShow) this.click2.visible = false; else this.click2.visible = true; } else { this.rateBtn.mouseEnabled = false; this.rateBtn.gray = true; this.isratevideo = false; this.click2.visible = false; } } else { this._rate.visible = true; this._rateVideo.visible = false; this.rateBtn.gray = false; this.rateBtn.mouseEnabled = true; this.isratevideo = false; if (this.atkShow) this.click2.visible = false; else this.click2.visible = true; } } RefreshData() { this.tempPowerLevel = PlayerManager.Instance.powerLevel; this.tempRateLevel = PlayerManager.Instance.rateLevel; let detail = UserModel.Instance.CurModel.user_video.detail; if (!detail) this.iscanShowVideoBtn = true; else { let freet = detail.free; if (!freet) { this.iscanShowVideoBtn = true; return; } if (freet < AppSetting.freeUpdateVideotime) { this.iscanShowVideoBtn = true; return; } { this.iscanShowVideoBtn = false; } } } RegButton() { this.ExitBtn.visible = FYHD_Sdk.iswhite; this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit); this.backBtn.CZ = () => { this.BackClickHandler(); }; this.atkBtn.clickHandler = new Laya.Handler(this, this.AtkBtnHandler); this.rateBtn.clickHandler = new Laya.Handler(this, this.RateBtnHandler); } ClickExit() { ViewManager.Instance.AddView(ViewType.ExitView); } AtkBtnHandler() { if (this.isatkvideo) { GuangGao.ShowVideo((iscom) => { if (iscom) { PlayerManager.Instance.PowerUp(this.tempPowerLevel + 1, "video:free", this.cost1, (iscom) => { if (iscom) { WXSdk.AldEvent("失败界面看视屏升级攻击力"); this.tempPowerLevel++; this.isfirstatkvideo = false; this.SetUi(); DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money)); } }); } }); } else { PlayerManager.Instance.PowerUp(this.tempPowerLevel + 1, "money", this.cost1, (iscom) => { if (iscom) { WXSdk.AldEvent("失败界面花钱升级攻击力"); this.tempPowerLevel++; this.SetUi(); DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money)); } }); } } RateBtnHandler() { if (this.isratevideo) { GuangGao.ShowVideo((iscom) => { if (iscom) { PlayerManager.Instance.SpeedUp(this.tempRateLevel + 1, "video:free", this.cost2, (iscom) => { if (iscom) { WXSdk.AldEvent("失败界面看视屏升级速度"); this.tempRateLevel++; this.isfirstratevideo = false; this.SetUi(); } }); } }); } else { PlayerManager.Instance.SpeedUp(this.tempRateLevel + 1, "money", this.cost2, (iscom) => { if (iscom) { WXSdk.AldEvent("失败界面花钱升级速度"); this.tempRateLevel++; this.SetUi(); } }); } } BackClickHandler() { ViewManager.Instance.CloseView(ViewType.AttributeUpView); GameManager.Instance.ReStart(); } OnClose() { DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize); if (this.tempPowerLevel != PlayerManager.Instance.powerLevel || this.tempRateLevel != PlayerManager.Instance.rateLevel) { PlayerManager.Instance.SetInfo(); DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money)); } } Resize() { this.height = Laya.stage.height; } InitPushData() { for (let i = 0; i < FYHD_Sdk.pushData.length; i++) { if (i < 6) { this.PushDataArray.push(FYHD_Sdk.pushData[i]); } } for (let j = 0; j < this.PushBox.numChildren; j++) { let box = this.PushBox.getChildAt(j); let icon = box.getChildByName("icon"); let btn = box.getChildByName("btn"); let name = box.getChildByName("name"); icon.skin = this.PushDataArray[j].icon; name.text = this.PushDataArray[j].togame_name; btn.clickHandler = new Laya.Handler(this, this.clickAd, [this.PushDataArray[j]]); } Laya.timer.loop(3000, this, this.Doudong); } clickAd(_data) { FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick); FYHD_Sdk.ShowHuTuiJump(_data); } PlayAni() { this.shakeani.play(null, false); } Doudong() { this.PlayAni(); this.doudongcishu++; let _arr = []; if (this.doudongcishu % 2 == 0) { for (let i = 0; i < FYHD_Sdk.pushData.length; i++) { if (i < 6) { _arr.push(FYHD_Sdk.pushData[i]); } } for (let j = 0; j < this.PushBox.numChildren; j++) { let box = this.PushBox.getChildAt(j); let icon = box.getChildByName("icon"); let btn = box.getChildByName("btn"); icon.skin = _arr[j].icon; btn.clickHandler = new Laya.Handler(this, this.clickAd, [_arr[j]]); } } else { let num = 0; for (let i = FYHD_Sdk.pushData.length - 1; i > -1; i--) { if (num < 6) { _arr.push(FYHD_Sdk.pushData[i]); } num++; } for (let j = 0; j < this.PushBox.numChildren; j++) { let box = this.PushBox.getChildAt(j); let icon = box.getChildByName("icon"); let btn = box.getChildByName("btn"); icon.skin = _arr[j].icon; btn.clickHandler = new Laya.Handler(this, this.clickAd, [_arr[j]]); } } } } var Vector3$6 = Laya.Vector3; class DisplayerCarController { static get Instance() { return DisplayerCarController.instance || (DisplayerCarController.instance = new DisplayerCarController()); } CreatePlayer(id) { if (!id) id = PlayerManager.Instance.equipId; if (!this.player) { let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + id); if (p) this.player = p; this.mainscene.addChild(this.player); this.player.transform.localPosition = MathTool.VecZero; this.player.transform.localRotationEuler = MathTool.VecZero; } else { GamePool.Instance.RecoverModel(this.player); let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + id); if (p) this.player = p; this.mainscene.addChild(this.player); this.player.transform.localPosition = MathTool.VecZero; this.player.transform.localRotationEuler = MathTool.VecZero; } let anima = this.player.getChildAt(0).getComponent(Laya.Animator); anima.play(MusicType.Dance); anima.speed = 1; } Reset() { if (this.mainscene) { this.mainscene.removeSelf(); } if (this.player) { GamePool.Instance.RecoverModel(this.player); this.player = null; } } InitDis(par) { if (!this.mainscene) { this.mainscene = new Laya.Scene3D(); this.maincamera = new Laya.Camera(); this.maincamera.enableHDR = false; this.mainscene.addChild(this.maincamera); this.light = new Laya.DirectionLight(); this.light.transform.rotation = new Laya.Quaternion(-0.24776, 0, 0, 0.9688215); this.light.intensity = 0.45; this.light.color = new Vector3$6(1, 1, 1); this.mainscene.addChild(this.light); let or = 1; this.maincamera.viewport = new Laya.Viewport(par.x * or, par.y * or, par.width * or, par.height * or); this.maincamera.orthographic = false; this.maincamera.enableHDR = false; this.maincamera.clearFlag = 2; this.maincamera.fieldOfView = 60; this.maincamera.transform.position = new Vector3$6(0, 1.52, 3.12); this.maincamera.transform.rotation = new Laya.Quaternion(0, 0, 0, 1); } let or = 1; this.maincamera.viewport = new Laya.Viewport(par.x * or, par.y * or, par.width * or, par.height * or); par.addChild(this.mainscene); this.CreatePlayer(); } } class SKinShopView extends ui.SkinShopViewUI { static get Instance() { return SKinShopView.instance; } constructor() { super(); SKinShopView.instance = this; this.Resize(); DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize); } Resize() { this.height = Laya.stage.height; } OnShow(data) { this.RefreshData(); this.RegButton(); this.RefreshUI(); WXSdk.AldEvent("打开皮肤界面"); } RefreshData() { this.oignPlayerid = PlayerManager.Instance.equipId; this.operateIndex = this.oignPlayerid; } RefreshUI(data) { this.SetBtnUi(this.operateIndex); this.RefreshBtnUi(this.operateIndex); DisplayerCarController.Instance.InitDis(this.viewPort); } RefreshBtnUi(index) { if (PlayerManager.Instance.equipId == index) { this.using.visible = true; this.use.visible = false; this.coin.visible = false; this.video.visible = false; return; } if (UserModel.Instance.CurModel.HasTheme(index)) { this.using.visible = false; this.use.visible = true; this.coin.visible = false; this.video.visible = false; return; } let data = NetInfoManager.Instance.GetTheme(index); if (data.require_type == 2) { this.using.visible = false; this.use.visible = false; this.coin.visible = true; this.video.visible = false; this.coinValue = Number(data.require_num); this.coin.getChildAt(0).getChildAt(0).text = this.coinValue.toString(); return; } if (data.require_type == 3) { this.using.visible = false; this.use.visible = false; this.coin.visible = false; this.video.visible = true; this.video.getChildAt(0).getChildAt(0).text = UserModel.Instance.CurModel.GetThemeProgress(data.id) + "/" + data.require_num; return; } } SetBtnUi(index) { if (index == 1) { this.leftBtn.getChildByName("leftFalse").visible = true; this.leftBtn.getChildByName("leftTrue").visible = false; this.rightBtn.getChildByName("rightFalse").visible = false; this.rightBtn.getChildByName("rightTrue").visible = true; return; } if (index == 8) { this.leftBtn.getChildByName("leftFalse").visible = false; this.leftBtn.getChildByName("leftTrue").visible = true; this.rightBtn.getChildByName("rightFalse").visible = true; this.rightBtn.getChildByName("rightTrue").visible = false; return; } this.leftBtn.getChildByName("leftFalse").visible = false; this.leftBtn.getChildByName("leftTrue").visible = true; this.rightBtn.getChildByName("rightFalse").visible = false; this.rightBtn.getChildByName("rightTrue").visible = true; } ClickClose() { DisplayerCarController.Instance.Reset(); if (this.oignPlayerid != PlayerManager.Instance.equipId) { MainRoleManager.Instance.ChangeModel(); } ViewManager.Instance.CloseView(ViewType.SKinShopView); } ClickVideo() { GuangGao.ShowVideo((done) => { if (done) { WXSdk.AldEvent("商店中看视屏获得皮肤"); this.VideoGet(); } }); } ; VideoGet() { var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "id": this.operateIndex }, { "channel": "video" }]; NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.themefission, param, (data) => { var usermodel = UserModel.Instance.CurModel; PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]); this.RefreshBtnUi(this.operateIndex); }, (data) => { }); } Buy() { var param = [{ "id": this.operateIndex }]; NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Buy, param, (data) => { var usermodel = UserModel.Instance.CurModel; PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]); DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money)); this.RefreshBtnUi(this.operateIndex); }, (data) => { }); } Equip() { var param = [{ "id": this.operateIndex }]; NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Equip, param, (data) => { var usermodel = UserModel.Instance.CurModel; PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]); this.RefreshBtnUi(this.operateIndex); }, (data) => { }); } RegButton() { this.ExitBtn.visible = FYHD_Sdk.iswhite; this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit); this.CloseBtn.visible = false; Laya.timer.once(3000, this, () => { this.CloseBtn.visible = true; this.CloseBtn.clickHandler = new Laya.Handler(this, this.ClickClose); }); this.leftBtn.clickHandler = Laya.Handler.create(this, () => { if (this.operateIndex == 1) return; this.operateIndex--; this.SetBtnUi(this.operateIndex); this.RefreshBtnUi(this.operateIndex); DisplayerCarController.Instance.CreatePlayer(this.operateIndex); }, null, false); this.rightBtn.clickHandler = Laya.Handler.create(this, () => { if (this.operateIndex == 8) return; this.operateIndex++; this.SetBtnUi(this.operateIndex); this.RefreshBtnUi(this.operateIndex); DisplayerCarController.Instance.CreatePlayer(this.operateIndex); }, null, false); this.use.CZ = () => { this.Equip(); }; this.coin.CZ = () => { if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.coinValue) ViewManager.Instance.ShowTips("金币不足!", 2); else this.Buy(); }; this.video.CZ = () => { this.ClickVideo(); }; } ClickExit() { ViewManager.Instance.AddView(ViewType.ExitView); } OnClose() { DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize); SKinShopView.instance = null; WXSdk.AldEvent("关闭皮肤界面"); } } class TrialView extends ui.TrialViewUI { constructor() { super(); this.clicknum = 0; this.Resize(); DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize); } OnShow(data) { this.RegButton(); this.RefreshData(); this.RegButton(); this.RefreshUI(); if (GameManager.GameCount < 1 || GameManager.GameCount >= 3) { console.log("第一局游戏》》》》"); GuangGao.Instance.showBanner2((_banner) => { if (_banner) { this.banner = _banner["banner"]; } }); this.backBtn.y = Laya.stage.height - this.backBtn.height - 300; } else { console.log("非第一局游戏1》》》》"); if (FYHD_Sdk.iswhite) { this.backBtn.y = Laya.stage.height - this.backBtn.height - 50; } else { GuangGao.Instance.showBanner2(); this.backBtn.y = Laya.stage.height - this.backBtn.height - 300; } } } RefreshUI() { DisplayerCarController.Instance.InitDis(this.viewPort); } RefreshData() { } RegButton() { this.ExitBtn.visible = FYHD_Sdk.iswhite; this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit); this.videoBtn.CZ = () => { this.VideoHandler(); }; this.backBtn.CZ = () => { this.clicknum++; if (GameManager.GameCount < 1 || GameManager.GameCount >= 3) { console.log("第一局游戏2》》》》"); DisplayerCarController.Instance.Reset(); this.BackUi(); } else { console.log("非第一局游戏2》》》》"); if (FYHD_Sdk.iswhite) { if (this.clicknum <= 1) { GuangGao.CheatBanner2(this.backBtn); } else { DisplayerCarController.Instance.Reset(); this.BackUi(); } } else { DisplayerCarController.Instance.Reset(); this.BackUi(); } } }; } ClickExit() { ViewManager.Instance.AddView(ViewType.ExitView); } VideoHandler() { GuangGao.ShowVideo((isok) => { if (isok) { WXSdk.AldEvent("看视屏试用"); this.VideoCom(); } }); } VideoCom() { DisplayerCarController.Instance.Reset(); this.BackUi(); MateManager.Instance.Trial(); } BackUi() { ViewManager.Instance.CloseView(ViewType.TrialView); if (MainView.Instance) MainView.Instance.TryClick(); } OnClose() { DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize); if (FYHD_Sdk.iswhite) { if (GuangGao.Instance._bannerAd2) { GuangGao.Instance._bannerAd2.hide(); } if (GuangGao.Instance._bannerAd3) { GuangGao.Instance._bannerAd3.hide(); } } else { GuangGao.Instance.hideBanner2(); } } Resize() { this.height = Laya.stage.height; } } class GuideView extends ui.GuideViewUI { constructor() { super(); this.isguide2or3 = false; this.guide1pos = MathTool.VecZero; this.guide1Com = false; GuideView.instance = this; this.Resize(); DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize); } static get Instance() { return GuideView.instance; } OnShow(data) { this.RegButton(); this.RefreshData(); this.RefreshUI(); } RefreshUI() { } RefreshData() { } RegButton() { } TwoGuide() { this.guide3Box.visible = true; this.guide4Box.visible = true; this.guide2Image.visible = true; this.guide3.play(0, true); this.guide4.play(0, true); Laya.timer.frameLoop(1, this, this._twoguide); this.guide1pos.x = -4.5; this.guide1pos.y = 0; } _twoguide() { let p = MatrixTransform.WorldToScreen2(this._camera, GuideController.Instance.guidetwoPos.clone()); this.guide4Box.pos(p.x, p.y); this.guide1pos.z = this.playerTran.localPositionZ + 5; let p1 = MatrixTransform.WorldToScreen2(this._camera, this.guide1pos); this.guide3Box.pos(p1.x, p1.y); if (this.playerTran.localPositionZ >= GuideController.Instance.guidetwoPos.z - 10) { this.guide3Box.visible = false; this.guide4Box.visible = false; this.guide2Image.visible = false; this.guide3Image.visible = true; this.guide3.stop(); this.guide4.stop(); Laya.timer.clear(this, this._twoguide); Laya.timer.once(5000, this, () => { GuideController.Instance.GuideOff(); }); } } SetGuide(type) { if (!this.playerTran) this.playerTran = MainRoleManager.Instance.playerTra; if (!this._camera) this._camera = CameraManager.Instance._maincamera; if (type == 1) { this.guide1Image.visible = true; this.guide2Image.visible = false; this.guide3Image.visible = false; this.guide1Box.visible = true; this.guide1.play(0, true); this.guide4Box.visible = false; if (this.playerTran.localPositionX <= GuideController.Instance.guideonepos.x) { this.guide2Box.visible = true; this.guide3Box.visible = false; this.isguide2or3 = true; this.guide2.play(0, true); } else { this.guide2Box.visible = false; this.guide3Box.visible = true; this.isguide2or3 = false; this.guide3.play(0, true); } this.guide1pos = GuideController.Instance.guideonepos.clone(); Laya.timer.frameLoop(1, this, this.OneGuide); this.guide1Com = false; } } OnClose() { DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize); GuideView.instance = null; Laya.timer.clearAll(this); } Resize() { this.height = Laya.stage.height; } OneGuide() { if (!this.guide1Com) { let p = MatrixTransform.WorldToScreen2(this._camera, GuideController.Instance.guideonepos.clone()); this.guide1Box.pos(p.x, p.y); this.guide1pos.z = this.playerTran.localPositionZ + 10; let p1 = MatrixTransform.WorldToScreen2(this._camera, this.guide1pos); if (this.isguide2or3) { this.guide2Box.pos(p1.x, p1.y); } else { this.guide3Box.pos(p1.x, p1.y); } if (this.playerTran.localPositionZ >= GuideController.Instance.guideonepos.z - 5) { this.guide2.stop(); this.guide3.stop(); this.guide2Box.visible = false; this.guide3Box.visible = false; this.guide1Box.visible = false; this.guide1Com = true; this.guide1Image.visible = false; } } else { if (this.playerTran.localPositionZ >= GuideController.Instance.guideonepos.z) { console.log(111); Laya.timer.clear(this, this.OneGuide); this.TwoGuide(); } } } } class ShadeView extends ui.ShadeViewUI { constructor() { super(); this.Resize(); DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize); } OnShow(data) { this.RegButton(); } RefreshUI() { } RefreshData() { } RegButton() { this.on(Laya.Event.CLICK, this, this.Test); } Test() { } OnClose() { DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize); this.off(Laya.Event.CLICK, this, this.Test); } Resize() { this.height = Laya.stage.height; } } class ExportView extends ui.ExportViewUI { constructor() { super(...arguments); this.jump = false; this.clicknum = 0; } OnShow(data) { if (data) { this.CloseBtn.clickHandler = Laya.Handler.create(this, this.ClickClose, [data], false); } else { this.CloseBtn.clickHandler = Laya.Handler.create(this, this.ClickClose, null, false); } this.ContinueBtn.clickHandler = Laya.Handler.create(this, this.ClickContinue, null, false); this.SetData(); this.ContinueBtn.visible = FYHD_Sdk.iswhite; this.CloseBtn.visible = false; Laya.timer.once(3000, this, () => { this.CloseBtn.visible = true; }); if (GameManager.GameCount > 1 && GameManager.GameCount < 4 && FYHD_Sdk.iswhite) { if (GuangGao.Instance._bannerAd) { this._banner = GuangGao.Instance._bannerAd; this._banner.hide(); console.log("banner加载完毕--", this._banner); } } this.height = Laya.stage.height; Laya.stage.on(Laya.Event.RESIZE, this, () => { this.height = Laya.stage.height; }); } OnClose() { Laya.timer.clearAll(this); } ClickClose(_data) { ViewManager.Instance.CloseView(ViewType.ExportView); if (_data) { ViewManager.Instance.AddView(ViewType.IntensifyView); } } ClickContinue() { this.clicknum++; if (FYHD_Sdk.iswhite) { if (GameManager.GameCount <= 1 || GameManager.GameCount >= 4) { let ran = GameTool.randomInt(0, FYHD_Sdk.pushData.length); let item = FYHD_Sdk.pushData[ran]; FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick); FYHD_Sdk.ShowHuTuiJump(item); } else { if (this.clicknum == 1) { this.ContinueBtn.mouseEnabled = false; if (this._banner) { console.log("展示banner"); this._banner.show(); Laya.timer.once(1000, this, () => { this._banner.hide(); this.ContinueBtn.mouseEnabled = true; }); } else { Laya.timer.once(1000, this, () => { this.ContinueBtn.mouseEnabled = true; }); } } else { let ran = GameTool.randomInt(0, FYHD_Sdk.pushData.length); let item = FYHD_Sdk.pushData[ran]; FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick); FYHD_Sdk.ShowHuTuiJump(item); } } } else { ViewManager.Instance.CloseView(ViewType.ExportView); } } SetData() { FYHD_Sdk.SetHuTuiList(this.TopList, 2, ""); FYHD_Sdk.SetHuTuiList(this.BottomList, 1, ""); this.GunGun(); } GunGun() { var maxTop; var maxBtm; try { this.TopList.scrollBar.value = 0; this.BottomList.scrollBar.value = 0; maxTop = this.TopList.scrollBar.max; maxBtm = this.BottomList.scrollBar.max; } catch (error) { console.error(error); return; } var tempTop = 1; var tempBtm = 1; Laya.timer.frameLoop(1, this, () => { this.TopList.scrollBar.value += tempTop; if (this.TopList.scrollBar.value >= maxTop || this.TopList.scrollBar.value <= 0) { tempTop = -tempTop; } this.BottomList.scrollBar.value += tempBtm; if (this.BottomList.scrollBar.value >= maxBtm || this.BottomList.scrollBar.value <= 0) { tempBtm = -tempBtm; } }); } } class ExitView extends ui.ExitViewUI { constructor() { super(); this.jump = false; ExitView.ins = this; } static get Instance() { if (ExitView.ins) { return ExitView.ins; } else { return new ExitView(); } } OnShow(data) { this.SetData(); this.Jump(); if (data) { this.CloseBtn.clickHandler = new Laya.Handler(this, this.ClickClose, [data]); } else { this.CloseBtn.clickHandler = new Laya.Handler(this, this.ClickClose); } this.CloseBtn.visible = false; Laya.timer.once(2000, this, () => { this.CloseBtn.visible = true; }); this.height = Laya.stage.height; Laya.stage.on(Laya.Event.RESIZE, this, () => { this.height = Laya.stage.height; }); } OnClose() { } ClickClose(data) { ViewManager.Instance.CloseView(ViewType.ExitView); if (data) { ViewManager.Instance.AddView(ViewType.CompleteView, GameManager.WINORLOSE); } } SetData() { FYHD_Sdk.SetHuTuiList(this.PushList, 1, ""); } Jump() { let ran = GameTool.randomInt(0, FYHD_Sdk.pushData.length); let item = FYHD_Sdk.pushData[ran]; FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick); FYHD_Sdk.ShowHuTuiJump(item); } } class GoldEggView extends ui.GoldEggViewUI { constructor() { super(); this._isComplete = false; this._isShowBanner = false; this._bannerVal = 0.5; this._maxClickCnt = 12; this._clickCnt = 0; this._interval = 500; this._decrement = 0.03; this.shownum = 3; this.nowshownum = 0; GoldEggView.ins = this; } static get Instance() { if (GoldEggView.ins) { return GoldEggView.ins; } else { return new GoldEggView(); } } RefreshData() { } RegButton() { } Resize() { } RefreshUI(data) { } OnShow(data = null) { this.HitBtn.y = Laya.stage.height - this.HitBtn.height - 50; this.kuangdian.y = Laya.stage.height - this.HitBtn.height - 200; this.btnscale.play(null, true); this.HitBtn.clickHandler = Laya.Handler.create(this, this.QiaoDa, null, false); this._bannerVal = GameTool.randRangefloat(0.35, 0.75); this.jindu.value = 0; Laya.timer.loop(this._interval, this, this.Daojishi); WXSdk.OnShow(this.onBannerHide); if (GuangGao.Instance._bannerAd) { this.banner = GuangGao.Instance._bannerAd; this.banner.hide(); console.log("金蛋界面banner加载完毕--", this.banner); } this.height = Laya.stage.height; this.BG.height = Laya.stage.height; Laya.stage.on(Laya.Event.RESIZE, this, () => { this.BG.height = Laya.stage.height; this.height = Laya.stage.height; }); } ClosePanel() { ViewManager.Instance.CloseView(ViewType.AttributeUpView); } OnClose() { console.log("设置界面关闭---"); } QiaoDa() { this.ani1.play(null, false); this.btnscale.stop(); this.kuangdian.visible = false; if (!this._isComplete) { this._clickCnt++; if (this._clickCnt > this._maxClickCnt) this._clickCnt = this._maxClickCnt; let pv = this._clickCnt / this._maxClickCnt; if (pv >= 1) { pv = 1; } this.jindu.value = pv; if (pv >= this._bannerVal && this.nowshownum < this.shownum) { if (this.banner) { this.nowshownum++; this.banner.show(); Laya.timer.once(2000, this, () => { this.banner.hide(); this._bannerVal = GameTool.randRangefloat(0.35, 0.75); }); } } if (pv >= 1) { this._isComplete = true; this.onBannerHide(); } } } Daojishi() { let pv = this.jindu.value; pv -= this._decrement; if (pv <= 0) pv = 0; this.jindu.value = pv; if (this._clickCnt > 2) { this._clickCnt -= 2; } } onBannerHide() { GoldEggView.Instance._isComplete = true; ViewManager.Instance.CloseView(ViewType.GoldEggView); MainView.Instance.ShowBoxPanel(); WXSdk.OffShow(this.onBannerHide); var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": "200" }]; NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => { ViewManager.Instance.ShowTips("金币:X" + 200); }, (data) => { }); if (GuangGao.Instance._bannerAd) { GuangGao.Instance._bannerAd.hide(); } } } class GiftView extends ui.GiftViewUI { constructor() { super(); this.shownum = 3; this.nowshownum = 0; this._isComplete = false; this._bannerVal = 0.5; this._maxClickCnt = 12; this._clickCnt = 0; this._interval = 500; this._decrement = 0.03; GiftView.ins = this; } static get Instance() { if (GiftView.ins == null) { return new GiftView(); } return GiftView.ins; } RefreshData() { } RegButton() { } Resize() { } RefreshUI(data) { } OnShow() { this.HitBtn.clickHandler = Laya.Handler.create(this, this.QiaoDa, null, false); this._bannerVal = GameTool.randRangefloat(0.35, 0.75); this.click.play(0, true); this.jinduBar.value = 0; Laya.timer.loop(this._interval, this, this.Daojishi); WXSdk.OnShow(this.onBannerHide); GuangGao.Instance.showBanner((banner) => { console.log("礼盒界面出现banner---"); console.log("banner加载完毕--", banner); this.banner = banner["banner"]; banner["banner"].hide(); }, () => { }); this.height = Laya.stage.height; this.BG.height = Laya.stage.height; Laya.stage.on(Laya.Event.RESIZE, this, () => { this.BG.height = Laya.stage.height; this.height = Laya.stage.height; }); } OnClose() { } QiaoDa() { this.click.stop(); this.shou.visible = false; if (!this._isComplete) { this._clickCnt++; if (this._clickCnt > this._maxClickCnt) this._clickCnt = this._maxClickCnt; let pv = this._clickCnt / this._maxClickCnt; if (pv >= 1) { pv = 1; } this.jinduBar.value = pv; if (pv >= this._bannerVal && this.nowshownum < this.shownum) { if (this.banner) { console.log("有banner", this.banner); this.banner.show(); this.nowshownum++; Laya.timer.once(2000, this, () => { this.banner.hide(); this._bannerVal = GameTool.randRangefloat(0.35, 0.75); }); } } if (pv >= 1) { this._isComplete = true; this.onBannerHide(); } } } Daojishi() { let pv = this.jinduBar.value; pv -= this._decrement; if (pv <= 0) pv = 0; this.jinduBar.value = pv; if (this._clickCnt > 2) { this._clickCnt -= 2; } } onBannerHide() { if (GiftView.Instance.banner) GiftView.Instance.banner.hide(); WXSdk.OffShow(this.onBannerHide); ViewManager.Instance.CloseView(ViewType.GiftView); var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": "200" }]; NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => { ViewManager.Instance.ShowTips("金币:X" + 200); }, (data) => { }); } } var ViewType; (function (ViewType) { ViewType[ViewType["InGameView"] = 0] = "InGameView"; ViewType[ViewType["ShadeView"] = 1] = "ShadeView"; ViewType[ViewType["CompleteView"] = 2] = "CompleteView"; ViewType[ViewType["LoadView"] = 3] = "LoadView"; ViewType[ViewType["MainView"] = 4] = "MainView"; ViewType[ViewType["SettingUi"] = 5] = "SettingUi"; ViewType[ViewType["SKinShopView"] = 6] = "SKinShopView"; ViewType[ViewType["TrialView"] = 7] = "TrialView"; ViewType[ViewType["IntensifyView"] = 8] = "IntensifyView"; ViewType[ViewType["AttributeUpView"] = 9] = "AttributeUpView"; ViewType[ViewType["ExportView"] = 10] = "ExportView"; ViewType[ViewType["ExitView"] = 11] = "ExitView"; ViewType[ViewType["GoldEggView"] = 12] = "GoldEggView"; ViewType[ViewType["GiftView"] = 13] = "GiftView"; })(ViewType || (ViewType = {})); class ViewManager { constructor() { this.viewDic = []; this.addViewDic = new Dictionary(); this.showpushview = 0; this._maskCnt = 0; this.init(); } static get Instance() { return this.instance || (this.instance = new ViewManager()); } init() { this._maskCnt = 0; this.viewDic[ViewType.InGameView] = InGameView; this.viewDic[ViewType.LoadView] = LoadView; this.viewDic[ViewType.MainView] = MainView; this.viewDic[ViewType.IntensifyView] = IntensifyView; this.viewDic[ViewType.CompleteView] = CompleteView; this.viewDic[ViewType.SKinShopView] = SKinShopView; this.viewDic[ViewType.TrialView] = TrialView; this.viewDic[ViewType.ShadeView] = ShadeView; this.viewDic[ViewType.ExportView] = ExportView; this.viewDic[ViewType.ExitView] = ExitView; this.viewDic[ViewType.AttributeUpView] = AttributeUpView; this.viewDic[ViewType.GoldEggView] = GoldEggView; this.viewDic[ViewType.GiftView] = GiftView; this.uiNode = new Laya.Sprite(); this.popNode = new Laya.Sprite(); Laya.stage.addChild(this.uiNode); Laya.stage.addChild(this.popNode); this.uiNode.zOrder = 3; this.popNode.zOrder = 4; } OpenView(view, data) { if (this.curView != null) { this.curView.OnClose(); this.uiNode.removeChild(this.curView); this.curView.destroy(true); this.curView = null; } this.curView = new this.viewDic[view]; this.uiNode.addChild(this.curView); this.curView.OnShow(data); } get getCurView() { return this.curView; } AddView(view, data) { if (this.addViewDic.has(view)) return; let t_view = new this.viewDic[view]; this.addViewDic.set(view, t_view); this.uiNode.addChild(t_view); t_view.OnShow(data); MouseEvent.Instance.CloseInput(); } RemoveView() { if (this.curView != null) { this.curView.OnClose(); this.uiNode.removeChild(this.curView); this.curView.destroy(true); this.curView = null; } } HaveView(view) { return this.addViewDic.has(view); } CloseView(view) { if (!this.addViewDic.has(view)) return; let t_view = this.addViewDic.get(view); t_view.OnClose(); this.uiNode.removeChild(t_view); t_view.destroy(true); this.addViewDic.delete(view); MouseEvent.Instance.OpenInput(); } OpenMask() { this._maskCnt++; if (this._maskCnt > 1) return; if (this.curMask != null) { this.curMask.OnClose(); this.popNode.removeChild(this.curView); this.curMask.destroy(); this.curMask = null; return; } this.curMask = new this.viewDic[ViewType.ShadeView]; if (!this.curMask) return; console.log("打开遮罩"); this.popNode.addChild(this.curMask); this.curMask.OnShow(); } CloseMask() { this._maskCnt--; if (this._maskCnt > 0) return; if (this.curMask != null) { this.curMask.OnClose(); this.popNode.removeChild(this.curMask); this.curMask.destroy(true); console.log("关闭遮罩"); this.curMask = null; } } ShowTips(value, type = 1) { var warn = GamePool.Instance.GetUi(PoolType.WarnTips); if (!warn) return; if (type == 1) { warn.y = 0; warn.text = value; warn.x = Laya.stage.width >> 1; this.popNode.addChild(warn); let _end = (Laya.stage.height >> 1) - 300; var tw = Laya.Tween.to(warn, { y: _end }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => { tw.clear(); GamePool.Instance.RecoverUi(PoolType.WarnTips, warn); })); } else if (type == 2) { warn.y = Laya.stage.height - 400; warn.text = value; warn.x = Laya.stage.width >> 1; this.popNode.addChild(warn); var tw = Laya.Tween.to(warn, { alpha: 0 }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => { tw.clear(); GamePool.Instance.RecoverUi(PoolType.WarnTips, warn); warn.alpha = 1; })); } } ShowGuideView() { if (!this.GuideView) { this.GuideView = new GuideView(); this.popNode.addChild(this.GuideView); } this.GuideView.OnShow(); } CloseGuideView() { if (this.GuideView) { this.GuideView.OnClose(); this.GuideView.removeSelf(); this.GuideView.destroy(); } } } class FYHD_Sdk { static InitSdk() { Laya.Browser.window.sdk.getFyhd().startSdk(); FYHD_Sdk.UserInfoAuth(); let white = Laya.LocalStorage.getItem("is_white"); if (white) { FYHD_Sdk.iswhite = true; } else { FYHD_Sdk.getWhiteConfig(); } let newuser = Laya.LocalStorage.getItem("is_newuser"); if (!newuser) { FYHD_Sdk.isnewuser = true; Laya.LocalStorage.setItem("is_newuser", "1"); } else { FYHD_Sdk.isnewuser = false; } FYHD_Sdk.PushData(); } static UserInfoAuth() { if (!Laya.Browser.onWeiXin) return; Laya.Browser.window.sdk.getFyhd().getFyhdUserInfo(null, false, (data) => { console.log("无授权回调:" + JSON.stringify(data)); if (data.result.user) { FYHD_Sdk.openid = data.result.user.openid; FYHD_Sdk.AuthInfo(); } }); } static AuthInfo() { var args = { openid: FYHD_Sdk.openid, }; Laya.Browser.window.sdk.getFyhd().loginData(args, (data) => { console.log("授权上报回调:" + JSON.stringify(data)); }); } static ValueUser() { var args = { openid: FYHD_Sdk.openid, }; Laya.Browser.window.sdk.getFyhd().valueuser(args, (data) => { console.log("有效用户上报:" + JSON.stringify(data)); }); } static getWhiteConfig() { Laya.Browser.window.sdk.getFyhd().whiteConfig(function (e) { FYHD_Sdk.iswhite = e.data.is_white; if (FYHD_Sdk.iswhite) { Laya.LocalStorage.setItem("is_white", "1"); } console.log("白名单---", e); }); } static SetHuTuiList(list, scrol = 1, type = "") { let arr = this.pushData; if (!arr || arr.length == 0) return; list.selectEnable = false; scrol == 1 ? list.vScrollBarSkin = "" : list.hScrollBarSkin = ""; list.renderHandler = Laya.Handler.create(this, this.updateItem, [type], false); list.array = arr; list.refresh(); } static updateItem(type, cell, index) { var aditem = cell.getComponent(ListItem); aditem.Refresh(type); } static ClickAd(ad_type) { console.log("上报类型---", ad_type); if (!Laya.Browser.onWeiXin) return; var param = { ad_type: ad_type, openid: FYHD_Sdk.openid }; console.log("点击参数:" + param); Laya.Browser.window.sdk.getFyhd().advertisement(param, (data) => { console.log("点击结果:" + JSON.stringify(data)); }); } static PushData() { if (!Laya.Browser.onWeiXin) return; var param = {}; Laya.Browser.window.sdk.getFyhd().shareRecommend(param, (data) => { console.log("热门游戏数据--", data); if (data.data) { FYHD_Sdk.pushData = data.data; FYHD_Sdk.pushData.sort(FYHD_Sdk.ListSort); FYHD_Sdk.isHaveDate = true; } console.log("获取互推信息:" + JSON.stringify(FYHD_Sdk.pushData)); }); } static ShowHuTuiJump(data) { if (!Laya.Browser.onWeiXin) return; if (data.jump_type == 2) { Laya.Browser.window.wx.previewImage({ current: data.qrcode, urls: [data.qrcode] }); } else if (data.jump_type == 1) { Laya.Browser.window.wx.navigateToMiniProgram({ appId: data.to_appid, path: data.jump_path, success(res) { console.log("上报成功:" + JSON.stringify(res)); FYHD_Sdk.PushClick(data.to_appid); }, fail(res) { ViewManager.Instance.AddView(ViewType.ExportView); } }); } else if (data.jump_type == 0) { Laya.Browser.window.wx.navigateToMiniProgram({ appId: data.platform_appid, path: data.jump_path, success(res) { console.log("上报成功:" + JSON.stringify(res)); FYHD_Sdk.PushClick(data.to_appid); }, fail(res) { } }); } } static PushClick(to_appid) { if (!Laya.Browser.onWeiXin) return; var param = { openid: FYHD_Sdk.openid, to_appid: to_appid, }; Laya.Browser.window.sdk.getFyhd().sharePlay(param, (data) => { console.log("点击上报结果:" + JSON.stringify(data)); }); } static ListSort(a, b) { if (Number(a["panel"]) < Number(b["panel"])) { return -1; } if (Number(a["panel"]) == Number(b["panel"])) { return 0; } if (Number(a["panel"]) > Number(b["panel"])) { return 1; } } } FYHD_Sdk.Ad_ClickType = { Video: "video_click", Watch: "watch", Share: "share", Banner: "banner", Push: "push", PushClick: "icon_click" }; FYHD_Sdk.pushData = []; FYHD_Sdk.isHaveDate = false; FYHD_Sdk.ShowAd = "ShowAd"; class ListItem extends Laya.Script { constructor() { super(); } onAwake() { this.self = this.owner; this.icon = this.self.getChildByName("icon"); this.btn = this.self.getChildByName("btn"); this.name = this.self.getChildByName("name"); this._tip = this.self.getChildByName("tip"); this.bottom = this.self.getChildByName("bottom"); this.remen = this.self.getChildByName("remen"); this.star = this.self.getChildByName("star"); this.diandian = this.icon.getChildAt(0); this.btn.clickHandler = new Laya.Handler(this, this.clickAd); } Refresh(type) { this.data = this.self.dataSource; this.type = type; if (this.name) { this.name.text = this.data.togame_name; } if (this._tip) { this._tip.visible = true; let rnd = GameTool.randomInt(1, 200000); let text = rnd.toString() + "人在玩"; this._tip.text = text; } if (this.diandian) { this.diandian.visible = false; } if (this.bottom) { let num = GameTool.randomInt(1, 6); this.bottom.skin = "subpackage/bottom/icontitle" + num + ".png"; } if (this.remen) { this.remen.visible = Math.random() < 0.2 ? true : false; } if (this.star) { this.star.visible = Math.random() < 0.2 ? true : false; } this.icon.skin = this.data.icon; } clickAd() { FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick); FYHD_Sdk.ShowHuTuiJump(this.data); } onDestroy() { this.btn.clickHandler = null; } } class GameConfig { constructor() { } static init() { var reg = Laya.ClassUtils.regClass; reg("View/Com/ButtonRunTime.ts", ImageRunTime); reg("View/Com/ListItem.ts", ListItem); } } GameConfig.width = 720; GameConfig.height = 1280; GameConfig.scaleMode = "fixedwidth"; GameConfig.screenMode = "vertical"; GameConfig.alignV = "middle"; GameConfig.alignH = "center"; GameConfig.startScene = "MainView.scene"; GameConfig.sceneRoot = ""; GameConfig.debug = false; GameConfig.stat = false; GameConfig.physicsDebug = false; GameConfig.exportSceneToJson = true; GameConfig.init(); class Main { constructor() { window['Config3D'] && (window['Config3D']["_config"]["_defaultPhysicsMemory"] = 128); window['Config3D'] && (window['Config3D']["_config"]["isAntialias"] = true); if (window["Laya3D"]) Laya3D.init(GameConfig.width, GameConfig.height); else Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]); Laya["Physics"] && Laya["Physics"].enable(); Laya["DebugPanel"] && Laya["DebugPanel"].enable(); Laya.stage.scaleMode = GameConfig.scaleMode; Laya.stage.screenMode = GameConfig.screenMode; Laya.stage.alignV = GameConfig.alignV; Laya.stage.alignH = GameConfig.alignH; Laya.URL.exportSceneToJson = GameConfig.exportSceneToJson; if (GameConfig.debug || Laya.Utils.getQueryString("debug") == "true") Laya.enableDebugPanel(); if (GameConfig.physicsDebug && Laya["PhysicsDebugDraw"]) Laya["PhysicsDebugDraw"].enable(); if (GameConfig.stat) Laya.Stat.show(); Laya.alertGlobalError = true; GameVersion.isWx = Laya.Browser.onWeiXin; if (GameVersion.isWx) { WXSdk.init(); } Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION); WXSdk.IsNeedUpdate(); } onVersionLoaded() { Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded)); Laya.MouseManager.multiTouchEnabled = false; } onConfigLoaded() { ViewManager.Instance.OpenView(ViewType.LoadView); GameVersion.isX = Laya.Browser.clientHeight / Laya.Browser.clientWidth > 2; } } new Main(); }()); //# sourceMappingURL=bundle.js.map