sweet/assets/scriptes/Module_Remote.js
2020-08-07 09:55:56 +08:00

34 lines
1.0 KiB
JavaScript

module.exports = {
//RemoteServerURL: 'http://192.168.100.147/test/',
_RemoteServerURL: 'https://resource.kingsome.cn/sweet2/RemoteResource/',
_TestRemoteServerURL: 'https://test.kingsome.cn/sweet2/RemoteResource/',
_isPublic: false,
Init: function (isPublish) {
this._isPublic = isPublish;
},
Get: function (names, callbackfunc) {
let url = null;
if (this._isPublic) {
url = this._RemoteServerURL;
} else {
url = this._TestRemoteServerURL;
}
// 远程 url names带后缀名
const remoteUrl = url + names;
cc.loader.load(remoteUrl, (err, texture) => {
// Use texture to create sprite frame
if (callbackfunc) {
callbackfunc(texture);
}
});
},
getRemoteServerURL: function () {
if (this._isPublic) {
return this._RemoteServerURL;
} else {
return this._TestRemoteServerURL;
}
},
};