update
This commit is contained in:
@@ -61,7 +61,7 @@ export class GButton {
|
||||
}
|
||||
//点击音效处理
|
||||
if (buttonType > 0) {
|
||||
AudioManager.I.PlayEffect(buttonType); //音效
|
||||
//AudioManager.I.PlayEffect(buttonType); //音效
|
||||
}
|
||||
}, obj);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,16 @@ export default class GameRootUI extends Component {
|
||||
@property
|
||||
public DefaultUI: string = "" //默认打开的界面
|
||||
|
||||
private defaultView:Node;
|
||||
|
||||
showDefaultView()
|
||||
{
|
||||
this.defaultView.active =true;
|
||||
}
|
||||
hideDefaultView():void{
|
||||
this.defaultView.active = false;
|
||||
}
|
||||
|
||||
onLoad() {
|
||||
GameRootUI.I = this;
|
||||
}
|
||||
@@ -53,6 +63,7 @@ export default class GameRootUI extends Component {
|
||||
if (this.DefaultUI.length > 0) {
|
||||
ResManager.I.loadSubpackagePrefab(this.DefaultUI, (res)=>{
|
||||
|
||||
this.defaultView = res;
|
||||
let viewSP = res.getComponent(res.name);
|
||||
viewSP && viewSP.openUIData && viewSP.openUIData(null);
|
||||
|
||||
|
||||
@@ -148,7 +148,25 @@ export default class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**适配背景图
|
||||
* @method node 背景图节点
|
||||
* @param mod 适配模式 1=按高度适配 2=按宽度适配
|
||||
*/
|
||||
public static adjustBgPixelRatioToSize(windowSize:Size,node:Node, mod:number = 1) {
|
||||
//let windowSize = view.getVisibleSize();
|
||||
let bgTf = node.getComponent(UITransform)
|
||||
if (bgTf) {
|
||||
if (mod == 1 && bgTf.height < windowSize.height) {
|
||||
let scale = windowSize.height / bgTf.height
|
||||
bgTf.height = bgTf.height * scale
|
||||
bgTf.width = bgTf.width * scale
|
||||
} else if (mod == 2 && bgTf.width < windowSize.width) {
|
||||
let scale = windowSize.width / bgTf.width
|
||||
bgTf.height = bgTf.height * scale
|
||||
bgTf.width = bgTf.width * scale
|
||||
}
|
||||
}
|
||||
}
|
||||
/**适配背景图
|
||||
* @method node 背景图节点
|
||||
* @param mod 适配模式 1=按高度适配 2=按宽度适配
|
||||
@@ -157,6 +175,15 @@ export default class Utils {
|
||||
let windowSize = view.getVisibleSize();
|
||||
let bgTf = node.getComponent(UITransform)
|
||||
if (bgTf) {
|
||||
if(mod == 3)
|
||||
{
|
||||
if(windowSize.height-bgTf.height < windowSize.width-bgTf.width )
|
||||
{
|
||||
mod = 1;
|
||||
}else{
|
||||
mod = 2;
|
||||
}
|
||||
}
|
||||
if (mod == 1 && bgTf.height < windowSize.height) {
|
||||
let scale = windowSize.height / bgTf.height
|
||||
bgTf.height = bgTf.height * scale
|
||||
|
||||
@@ -22,4 +22,7 @@ export enum InnerMsgCode {
|
||||
|
||||
BgVideo_Ready, //背景视频准备完成
|
||||
BgVideo_End, //背景视频播放完毕
|
||||
|
||||
|
||||
Chat_DialogRefresh
|
||||
}
|
||||
@@ -100,7 +100,7 @@ export default class ResManager {
|
||||
}
|
||||
/** 加载bundle中的PB*/
|
||||
loadSubpackagePrefab(url: string, cb) {
|
||||
let bundle = assetManager.getBundle("PB");
|
||||
let bundle = assetManager.getBundle("Chat18x");
|
||||
if (bundle){
|
||||
bundle.load(url, Prefab, (err, res: Prefab) => {
|
||||
if (err) {
|
||||
|
||||
Reference in New Issue
Block a user