34 lines
1.0 KiB
JavaScript
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;
|
|
}
|
|
},
|
|
};
|