update
This commit is contained in:
@@ -20,22 +20,22 @@ export class PreloadUI extends Component {
|
||||
private jinduBar: Node = null;
|
||||
private jinduFilled: Sprite = null;
|
||||
private LabProgress: Label = null;
|
||||
private btnLogin: Sprite = null; //登录按钮
|
||||
//private btnLogin: Sprite = null; //登录按钮
|
||||
|
||||
start() {
|
||||
Utils.addInnerEL(InnerMsgCode.UI_ShowPrompt, this, this.resiveShowPrompt)
|
||||
//Utils.addInnerEL(InnerMsgCode.UI_ShowPrompt, this, this.resiveShowPrompt)
|
||||
|
||||
this.jinduBar = this.node.getChildByName("jinduBar");
|
||||
this.jinduFilled = this.jinduBar.getChildByName("jinduFilled").getComponent(Sprite);
|
||||
this.LabProgress = this.node.getChildByName("LabProgress").getComponent(Label);
|
||||
this.btnLogin = this.node.getChildByName("btnLogin").getComponent(Sprite);
|
||||
//this.btnLogin = this.node.getChildByName("btnLogin").getComponent(Sprite);
|
||||
|
||||
//适配背景图
|
||||
let BG = this.node.getChildByName("BG");
|
||||
Utils.adjustBgPixelRatio(BG, 1)
|
||||
|
||||
this.jinduFilled.fillRange = 0;
|
||||
this.btnLogin.node.active = false;
|
||||
//this.btnLogin.node.active = false;
|
||||
|
||||
this.preloadFiles()
|
||||
}
|
||||
@@ -68,26 +68,29 @@ export class PreloadUI extends Component {
|
||||
//预加载文件
|
||||
preloadFiles() {
|
||||
let preloadTab = [
|
||||
{path:"Music/music_interface", bundleName: "Audio", ftype: AudioClip},
|
||||
{path:"bg/mengli_stage_bg", bundleName: "Raw", ftype: ImageAsset},
|
||||
{path:"cg0/mengli_0_cg", bundleName: "Raw", ftype: ImageAsset},
|
||||
{path:"cg1/mengli_1_cg", bundleName: "Raw", ftype: ImageAsset},
|
||||
{path:"cg2/mengli_2_cg", bundleName: "Raw", ftype: ImageAsset},
|
||||
{path:"cg3/mengli_3_cg", bundleName: "Raw", ftype: ImageAsset},
|
||||
{path:"emo_1/mengli_shy", bundleName: "Raw", ftype: ImageAsset},
|
||||
{path:"emo_2/mengli_laugh", bundleName: "Raw", ftype: ImageAsset},
|
||||
{path:"emo_3/mengli_disgust", bundleName: "Raw", ftype: ImageAsset},
|
||||
{path:"role/mengli_default", bundleName: "Raw", ftype: ImageAsset},
|
||||
{path:"Zjm/raw1", bundleName: "Raw", ftype: ImageAsset},
|
||||
{path:"touming", bundleName: "common", ftype: ImageAsset},
|
||||
// {path:"chanpin_1_0", bundleName: "daoju", ftype: ImageAsset}, //有合图加载失败
|
||||
{path:"zjm_1", bundleName: "Zhujiemian", ftype: ImageAsset},
|
||||
{path:"zjm_19", bundleName: "Zhujiemian", ftype: ImageAsset},
|
||||
{path:"zjm_30", bundleName: "Zhujiemian", ftype: ImageAsset},
|
||||
{path:"mohu", bundleName: "Materials", ftype: Material},
|
||||
{path:"UI/Cross/Cross_UI", bundleName: "PB", ftype: Prefab},
|
||||
{path:"UI/StartUI/Start_UI", bundleName: "PB", ftype: Prefab},
|
||||
{path:"commonGlobal", bundleName: "DataTable", ftype: JsonAsset},
|
||||
{path:"ChatPanel", bundleName: "Chat18x", ftype: Prefab},
|
||||
{path:"GirlDetailPanel", bundleName: "Chat18x", ftype: Prefab},
|
||||
{path:"GirlListPanel", bundleName: "Chat18x", ftype: Prefab},
|
||||
// {path:"Music/music_interface", bundleName: "Audio", ftype: AudioClip},
|
||||
// {path:"bg/mengli_stage_bg", bundleName: "Raw", ftype: ImageAsset},
|
||||
// {path:"cg0/mengli_0_cg", bundleName: "Raw", ftype: ImageAsset},
|
||||
// {path:"cg1/mengli_1_cg", bundleName: "Raw", ftype: ImageAsset},
|
||||
// {path:"cg2/mengli_2_cg", bundleName: "Raw", ftype: ImageAsset},
|
||||
// {path:"cg3/mengli_3_cg", bundleName: "Raw", ftype: ImageAsset},
|
||||
// {path:"emo_1/mengli_shy", bundleName: "Raw", ftype: ImageAsset},
|
||||
// {path:"emo_2/mengli_laugh", bundleName: "Raw", ftype: ImageAsset},
|
||||
// {path:"emo_3/mengli_disgust", bundleName: "Raw", ftype: ImageAsset},
|
||||
// {path:"role/mengli_default", bundleName: "Raw", ftype: ImageAsset},
|
||||
// {path:"Zjm/raw1", bundleName: "Raw", ftype: ImageAsset},
|
||||
// {path:"touming", bundleName: "common", ftype: ImageAsset},
|
||||
// // {path:"chanpin_1_0", bundleName: "daoju", ftype: ImageAsset}, //有合图加载失败
|
||||
// {path:"zjm_1", bundleName: "Zhujiemian", ftype: ImageAsset},
|
||||
// {path:"zjm_19", bundleName: "Zhujiemian", ftype: ImageAsset},
|
||||
// {path:"zjm_30", bundleName: "Zhujiemian", ftype: ImageAsset},
|
||||
// {path:"mohu", bundleName: "Materials", ftype: Material},
|
||||
// {path:"UI/Cross/Cross_UI", bundleName: "PB", ftype: Prefab},
|
||||
// {path:"UI/StartUI/Start_UI", bundleName: "PB", ftype: Prefab},
|
||||
// {path:"commonGlobal", bundleName: "DataTable", ftype: JsonAsset},
|
||||
];
|
||||
let num_prefab = 0; //已加载数量
|
||||
let num_succeed = 0;//加载成功数量
|
||||
@@ -117,10 +120,10 @@ export class PreloadUI extends Component {
|
||||
//加载配置表
|
||||
loadDataTable(){
|
||||
let dataArr = [
|
||||
"commonGlobal",
|
||||
//"commonGlobal",
|
||||
// "levelHole",
|
||||
"Music",
|
||||
"Sound",
|
||||
//"Music",
|
||||
//"Sound",
|
||||
]
|
||||
|
||||
//配置表使用方法: let cfgs = Resource.getConfig("Sound")
|
||||
@@ -149,57 +152,58 @@ export class PreloadUI extends Component {
|
||||
//登录
|
||||
onLogin() {
|
||||
//初始化SDK信息
|
||||
SDKManager.init(() => {
|
||||
//检测是否有授权,有授权直接登录,没有授权就先进主界面,到主界面获取权限
|
||||
SDKManager.checkAutoSetting("userInfo", (ishave) => {
|
||||
if (ishave) {
|
||||
console.log("有授权,直接登录")
|
||||
HttpUnit.ins.login((loginData) => {
|
||||
if (loginData == null) {
|
||||
//登录失败,这里处理重复登录的逻辑
|
||||
} else {
|
||||
this.loginFinish = true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log("没有授权,等待授权后登录")
|
||||
// this.loginFinish = true
|
||||
this.jinduBar.active = false
|
||||
this.LabProgress.node.active = false
|
||||
//登录按钮
|
||||
this.btnLogin.node.active = true
|
||||
let loginPath = ""
|
||||
if (SDKManager.isWenxin()) {
|
||||
loginPath = "login1"
|
||||
} else if (SDKManager.isByteDance()) {
|
||||
loginPath = "login2"
|
||||
} else if (SDKManager.isKuaishou()) {
|
||||
loginPath = "login3"
|
||||
}
|
||||
ResManager.I.changeResourceSpriteFrame(this.btnLogin, loginPath)
|
||||
|
||||
HttpUnit.ins.login((loginData) => {
|
||||
if (loginData == null) {
|
||||
//登录失败,这里处理重复登录的逻辑
|
||||
} else {
|
||||
this.loginFinish = true
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
// SDKManager.init(() => {
|
||||
// //检测是否有授权,有授权直接登录,没有授权就先进主界面,到主界面获取权限
|
||||
// SDKManager.checkAutoSetting("userInfo", (ishave) => {
|
||||
// if (ishave) {
|
||||
// console.log("有授权,直接登录")
|
||||
// HttpUnit.ins.login((loginData) => {
|
||||
// if (loginData == null) {
|
||||
// //登录失败,这里处理重复登录的逻辑
|
||||
// } else {
|
||||
// this.loginFinish = true
|
||||
// }
|
||||
// })
|
||||
// } else {
|
||||
// console.log("没有授权,等待授权后登录")
|
||||
// // this.loginFinish = true
|
||||
// this.jinduBar.active = false
|
||||
// this.LabProgress.node.active = false
|
||||
// //登录按钮
|
||||
// this.btnLogin.node.active = true
|
||||
// let loginPath = ""
|
||||
// if (SDKManager.isWenxin()) {
|
||||
// loginPath = "login1"
|
||||
// } else if (SDKManager.isByteDance()) {
|
||||
// loginPath = "login2"
|
||||
// } else if (SDKManager.isKuaishou()) {
|
||||
// loginPath = "login3"
|
||||
// }
|
||||
// ResManager.I.changeResourceSpriteFrame(this.btnLogin, loginPath)
|
||||
//
|
||||
// HttpUnit.ins.login((loginData) => {
|
||||
// if (loginData == null) {
|
||||
// //登录失败,这里处理重复登录的逻辑
|
||||
// } else {
|
||||
// this.loginFinish = true
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
this.loginFinish = true;
|
||||
}
|
||||
|
||||
enterGame() {
|
||||
let islogin = HttpUnit.IsLogin();
|
||||
console.log("进入游戏,登录状态:", islogin);
|
||||
//let islogin = HttpUnit.IsLogin();
|
||||
//console.log("进入游戏,登录状态:", islogin);
|
||||
this.jinduBar.active = false
|
||||
this.LabProgress.node.active = false
|
||||
this.btnLogin.node.active = false
|
||||
if (islogin) {
|
||||
} else {
|
||||
//没登录成功,先进主界面,在主界面里进行登录
|
||||
}
|
||||
//this.btnLogin.node.active = false
|
||||
// if (islogin) {
|
||||
// } else {
|
||||
// //没登录成功,先进主界面,在主界面里进行登录
|
||||
// }
|
||||
ResManager.I.goMainScene(); //进入下一个场景
|
||||
// ResManager.I.goCustomScene("Test2DScene"); //进入自定义场景
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user