|
@@ -8,6 +8,8 @@ let GameUpdate = require("GameUpdate");
|
|
let BundleLoaderManager = require("BundleLoaderManager");
|
|
let BundleLoaderManager = require("BundleLoaderManager");
|
|
let _ScenceManagerInstance = null;
|
|
let _ScenceManagerInstance = null;
|
|
import GameManagerBase from 'GameManagerBase'
|
|
import GameManagerBase from 'GameManagerBase'
|
|
|
|
+const LanguageKey = require("LanguageKey");
|
|
|
|
+var topTipMsg = require("topTipMsg")
|
|
|
|
|
|
//退出游戏,需要保留的内存资源
|
|
//退出游戏,需要保留的内存资源
|
|
let filter_assets = [
|
|
let filter_assets = [
|
|
@@ -24,6 +26,7 @@ let filter_home_assets = [
|
|
class HNScenceManager {
|
|
class HNScenceManager {
|
|
PORTRAIT = 0
|
|
PORTRAIT = 0
|
|
LANDSCAPE = 1
|
|
LANDSCAPE = 1
|
|
|
|
+ pgDirect = 0//0是竖着,1是横着
|
|
constructor() {
|
|
constructor() {
|
|
this._rootComponent = null;
|
|
this._rootComponent = null;
|
|
this._currGameNode = null;
|
|
this._currGameNode = null;
|
|
@@ -33,7 +36,10 @@ class HNScenceManager {
|
|
this.recvMemoryRes = [];
|
|
this.recvMemoryRes = [];
|
|
this.pgContentP = null;
|
|
this.pgContentP = null;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ //设置pg旋转方向
|
|
|
|
+ setPGDirect(value=0){
|
|
|
|
+ this.pgDirect = value
|
|
|
|
+ }
|
|
CreateGame() {
|
|
CreateGame() {
|
|
let gameComponent = null;
|
|
let gameComponent = null;
|
|
if (!this._currGameNode) {
|
|
if (!this._currGameNode) {
|
|
@@ -220,6 +226,7 @@ class HNScenceManager {
|
|
}
|
|
}
|
|
let runScene = cc.director.getScene().getChildByName("GameScence");
|
|
let runScene = cc.director.getScene().getChildByName("GameScence");
|
|
if (pgurl) {
|
|
if (pgurl) {
|
|
|
|
+ this.setPGDirect(this.LANDSCAPE)//这里根据启动pg游戏的时候传入 转向参数
|
|
let pgContentP
|
|
let pgContentP
|
|
if (this.pgContentP) {
|
|
if (this.pgContentP) {
|
|
pgContentP = this.pgContentP
|
|
pgContentP = this.pgContentP
|
|
@@ -228,7 +235,7 @@ class HNScenceManager {
|
|
runScene.addChild(pgContentP);
|
|
runScene.addChild(pgContentP);
|
|
}
|
|
}
|
|
|
|
|
|
- let direct = 0
|
|
|
|
|
|
+ let direct = this.pgDirect
|
|
if (direct == this.PORTRAIT) {//PG游戏竖着放
|
|
if (direct == this.PORTRAIT) {//PG游戏竖着放
|
|
pgContentP.setContentSize(750,1334);
|
|
pgContentP.setContentSize(750,1334);
|
|
let scale = runScene.getContentSize().height/1334;
|
|
let scale = runScene.getContentSize().height/1334;
|
|
@@ -240,12 +247,6 @@ class HNScenceManager {
|
|
gameNode.parent = pgContentP
|
|
gameNode.parent = pgContentP
|
|
pgContentP.setAnchorPoint(0.5, 0.5);
|
|
pgContentP.setAnchorPoint(0.5, 0.5);
|
|
pgContentP.setPosition(cc.v2(0,0))
|
|
pgContentP.setPosition(cc.v2(0,0))
|
|
- // let widget = pgContentP.addComponent(cc.Widget);
|
|
|
|
- // widget.isAlignLeft = true;
|
|
|
|
- // widget.isAlignRight = true;
|
|
|
|
- // widget.isAlignTop = true;
|
|
|
|
- // widget.isAlignBottom = true;
|
|
|
|
- // widget.alignMode = cc.Widget.AlignMode.ON_WINDOW_RESIZE;
|
|
|
|
}else{
|
|
}else{
|
|
runScene.addChild(gameNode);
|
|
runScene.addChild(gameNode);
|
|
gameNode.setPosition(cc.v2(cc.winSize / 2, cc.winSize.height / 2));
|
|
gameNode.setPosition(cc.v2(cc.winSize / 2, cc.winSize.height / 2));
|
|
@@ -346,6 +347,10 @@ class HNScenceManager {
|
|
cc.director.getScene().getChildByName('Canvas').getChildByName('TopNodeEx').active = bActive;
|
|
cc.director.getScene().getChildByName('Canvas').getChildByName('TopNodeEx').active = bActive;
|
|
cc.director.getScene().getChildByName('Canvas').getChildByName('SecondaryGameList').active = bActive;
|
|
cc.director.getScene().getChildByName('Canvas').getChildByName('SecondaryGameList').active = bActive;
|
|
}
|
|
}
|
|
|
|
+ //pg游戏中退出提示
|
|
|
|
+ cannotExitGame(){
|
|
|
|
+ topTipMsg.showTopTipMsg(LanguageKey.t("pubWords.not_exit_game"),this.pgDirect==this.LANDSCAPE);
|
|
|
|
+ }
|
|
};
|
|
};
|
|
|
|
|
|
HNScenceManager.Instance = function () {
|
|
HNScenceManager.Instance = function () {
|