refactor(web):改造成vue工程

This commit is contained in:
kubbo
2025-09-30 17:43:06 +08:00
parent f140c92ddd
commit 39f7598b02
1777 changed files with 878 additions and 2238 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,411 @@
var __reflect = (this && this.__reflect) || function (p, c, t) {
p.__class__ = c, t ? t.push(c) : t = [c], p.__types__ = p.__types__ ? t.concat(p.__types__) : t;
};
var __extends = this && this.__extends || function __extends(t, e) {
function r() {
this.constructor = t;
}
for (var i in e)
e.hasOwnProperty(i) && (t[i] = e[i]);
r.prototype = e.prototype, t.prototype = new r();
};
var JSONParseClass = /** @class */ (function () {
function JSONParseClass() {
this.skinClass = {};
this.euiNormalizeNames = {
"$eBL": "eui.BitmapLabel",
"$eB": "eui.Button",
"$eCB": "eui.CheckBox",
"$eC": "eui.Component",
"$eDG": "eui.DataGroup",
"$eET": "eui.EditableText",
"$eG": "eui.Group",
"$eHL": "eui.HorizontalLayout",
"$eHSB": "eui.HScrollBar",
"$eHS": "eui.HSlider",
"$eI": "eui.Image",
"$eL": "eui.Label",
"$eLs": "eui.List",
"$eP": "eui.Panel",
"$ePB": "eui.ProgressBar",
"$eRB": "eui.RadioButton",
"$eRBG": "eui.RadioButtonGroup",
"$eRa": "eui.Range",
"$eR": "eui.Rect",
"$eRAl": "eui.RowAlign",
"$eS": "eui.Scroller",
"$eT": "eui.TabBar",
"$eTI": "eui.TextInput",
"$eTL": "eui.TileLayout",
"$eTB": "eui.ToggleButton",
"$eTS": "eui.ToggleSwitch",
"$eVL": "eui.VerticalLayout",
"$eV": "eui.ViewStack",
"$eVSB": "eui.VScrollBar",
"$eVS": "eui.VSlider",
"$eSk": "eui.Skin"
};
}
JSONParseClass.prototype.setData = function (data) {
if (!this.json) {
this.json = data;
this.parseSkinMap(this.json);
}
else {
this.parseSkinMap(data);
for (var a in data) {
this.json[a] = data[a];
}
}
};
JSONParseClass.prototype.generateSkinClass = function (skinData, className, superName) {
if (!skinData)
return null;
var paths = superName.split(".");
var target = window;
for (var _i = 0, paths_1 = paths; _i < paths_1.length; _i++) {
var p = paths_1[_i];
target = target[p];
}
function __SkinClass() {
target.call(this);
window["JSONParseClass"].create(className, this);
}
__extends(__SkinClass, target);
__reflect(__SkinClass, className, [superName]);
return __SkinClass;
};
JSONParseClass.prototype.parseSkinMap = function (skinMap) {
var skinResult = {};
for (var exml in skinMap) {
var skinData = skinMap[exml];
if (!skinData)
continue;
var paths = exml.split(".");
var target = window;
for (var _i = 0, paths_2 = paths; _i < paths_2.length; _i++) {
var p = paths_2[_i];
var parent = target;
if (p !== paths[paths.length - 1]) {
target = target[p];
if (target == undefined) {
target = {};
parent[p] = target;
}
}
}
var superName = this.euiNormalizeNames[skinData["$sC"]] == undefined ? skinData["$sC"] : this.euiNormalizeNames[skinData["$sC"]];
skinResult[exml] = target[paths[paths.length - 1]] = this.generateSkinClass(skinData, exml, superName);
if (skinMap[exml]["$path"]) {
generateEUI2["paths"][skinMap[exml]["$path"]] = skinResult[exml];
}
}
return skinResult;
};
JSONParseClass.prototype.create = function (skinName, target) {
if (!this.json) {
console.log("Missing json defined by eui resource, please modify the theme adapter");
console.log("缺少eui资源定义的json请修改主题适配器");
return;
}
//console.log('skinName=' + skinName);
/** 先解析对应名字的的 */
this.target = target;
this.skinName = skinName;
this.skinClass = this.json[skinName];
//开始生成
this.applyBase();
this.applySkinParts();
this.applyState();
this.applyBinding();
//skinParts 只能最后赋值在comp中引用问题
if (this.skinClass["$sP"] == undefined)
this.target["skinParts"] = [];
else
this.target["skinParts"] = this.skinClass["$sP"];
};
JSONParseClass.prototype.applySkinParts = function () {
if (this.skinClass["$sP"] == undefined)
return;
for (var _i = 0, _a = this.skinClass["$sP"]; _i < _a.length; _i++) {
var component = _a[_i];
if (this.target[component] == undefined)
this.createElementContentOrViewport(component);
}
};
JSONParseClass.prototype.applyBase = function () {
if (this.skinClass["$bs"] == undefined)
return;
this.addCommonProperty("$bs", this.target);
};
JSONParseClass.prototype.createElementContentOrViewport = function (component) {
var result;
var typeStr = this.getNormalizeEuiName(this.skinClass[component].$t);
if (typeStr == "egret.tween.TweenGroup") {
result = this.creatsEgretTweenGroup(component);
}
else {
/** 有可能对象是从外面一定义的皮肤 */
var type_1 = egret.getDefinitionByName(typeStr);
this.$createNewObject(function () {
result = new type_1();
});
this.addCommonProperty(component, result);
}
this.target[component] = result;
return result;
};
/**
* 生成单位有可能会跳出当前皮肤所以统一维护target和skin
* @param callback 创建对象的真实逻辑
*/
JSONParseClass.prototype.$createNewObject = function (callback) {
var skinName = this.skinName;
var target = this.target;
callback();
this.skinName = skinName;
this.skinClass = this.json[this.skinName];
this.target = target;
};
/**
* 生成对应的缓动组
* @param component 名字索引
*/
JSONParseClass.prototype.creatsEgretTweenGroup = function (component) {
var result = this.createTypeObject(component);
var items = [];
for (var _i = 0, _a = this.skinClass[component]["items"]; _i < _a.length; _i++) {
var item = _a[_i];
items.push(this.createEgretTweenItem(item));
}
result["items"] = items;
return result;
};
/**
* 生成对应的缓动单位
* @param tweenItem 名字索引
*/
JSONParseClass.prototype.createEgretTweenItem = function (tweenItem) {
var _this = this;
var result = this.createTypeObject(tweenItem);
var paths = [];
var _loop_1 = function (prop) {
var property = this_1.skinClass[tweenItem][prop];
if (prop == "$t" || prop == "target") {
}
else if (prop == "paths") {
for (var _i = 0, property_1 = property; _i < property_1.length; _i++) {
var path = property_1[_i];
paths.push(this_1.createSetOrTo(path));
}
}
else if (prop == "target") {
this_1.$createNewObject(function () {
result[prop] = _this.createElementContentOrViewport(property);
_this.target[property] = result[prop];
});
}
else {
result[prop] = property;
}
};
var this_1 = this;
for (var prop in this.skinClass[tweenItem]) {
_loop_1(prop);
}
result["paths"] = paths;
this.target[tweenItem] = result;
return result;
};
JSONParseClass.prototype.createSetOrTo = function (key) {
var result = this.createTypeObject(key);
for (var prop in this.skinClass[key]) {
var property = this.skinClass[key][prop];
if (prop == "$t" || prop == "target") {
}
else if (prop == "props") {
result[prop] = this.createObject(property);
this.target[property] = result[prop];
}
else {
result[prop] = property;
}
}
return result;
};
JSONParseClass.prototype.createObject = function (name) {
var result = {};
for (var prop in this.skinClass[name]) {
if (prop == "$t" || prop == "target") {
}
else {
result[prop] = this.skinClass[name][prop];
}
}
return result;
};
JSONParseClass.prototype.addCommonProperty = function (componentName, target) {
var eleC;
var sId;
var _loop_2 = function (prop) {
var property = this_2.skinClass[componentName][prop];
if (prop == "$t") {
}
else if (prop == "layout") {
target[prop] = this_2.createLayout(property);
}
else if (prop == "$eleC") {
eleC = property;
}
else if (prop == "$sId") {
sId = property;
}
else if (prop == "scale9Grid") {
target[prop] = this_2.getScale9Grid(property);
}
else if (prop == "skinName") {
this_2.$createNewObject(function () {
target[prop] = property;
});
}
else if (prop == "itemRendererSkinName") {
this_2.$createNewObject(function () {
var dirPath = property.split(".");
var t = window;
for (var _i = 0, dirPath_1 = dirPath; _i < dirPath_1.length; _i++) {
var p = dirPath_1[_i];
t = t[p];
}
target[prop] = t;
});
}
else if (prop == "itemRenderer") {
target[prop] = egret.getDefinitionByName(property);
}
else if (prop == "dataProvider") {
target[prop] = this_2.createDataProvider(property);
}
else if (prop == "viewport") {
target[prop] = this_2.createElementContentOrViewport(property);
}
else {
target[prop] = property;
}
};
var this_2 = this;
for (var prop in this.skinClass[componentName]) {
_loop_2(prop);
}
var ele = [];
if (eleC && eleC.length > 0) {
for (var _i = 0, eleC_1 = eleC; _i < eleC_1.length; _i++) {
var element = eleC_1[_i];
var e = this.createElementContentOrViewport(element);
ele.push(e);
}
}
target["elementsContent"] = ele;
if (sId && sId.length > 0) {
for (var _a = 0, sId_1 = sId; _a < sId_1.length; _a++) {
var element = sId_1[_a];
this.createElementContentOrViewport(element);
}
}
return target;
};
JSONParseClass.prototype.createLayout = function (componentName) {
var result = this.createTypeObject(componentName);
var component = this.skinClass[componentName];
for (var property in component) {
if (property !== "$t") {
result[property] = component[property];
}
}
this.target[componentName] = result;
return result;
};
JSONParseClass.prototype.applyState = function () {
if (this.skinClass["$s"] == undefined)
return;
var states = [];
for (var state in this.skinClass["$s"]) {
var setProperty = [];
var tempState = this.skinClass["$s"][state];
if (tempState["$saI"]) {
for (var _i = 0, _a = tempState["$saI"]; _i < _a.length; _i++) {
var property = _a[_i];
setProperty.push(new eui.AddItems(property["target"], property["property"], property["position"], property["relativeTo"]));
}
}
if (tempState["$ssP"]) {
for (var _b = 0, _c = tempState["$ssP"]; _b < _c.length; _b++) {
var property = _c[_b];
if (property["name"]) {
var value = property["value"];
if (property["name"] == "scale9Grid") {
value = this.getScale9Grid(property["value"]);
}
setProperty.push(new eui.SetProperty(property["target"], property["name"], value));
}
else {
setProperty.push(new eui.SetStateProperty(this.target, property["templates"], property["chainIndex"], this.target[property["target"]], property["property"]));
}
}
}
states.push(new eui.State(state, setProperty));
}
this.target["states"] = states;
};
JSONParseClass.prototype.applyBinding = function () {
if (this.skinClass["$b"] == undefined)
return;
for (var _i = 0, _a = this.skinClass["$b"]; _i < _a.length; _i++) {
var bindingDate = _a[_i];
if (bindingDate["$bc"] !== undefined) {
eui.Binding.$bindProperties(this.target, bindingDate["$bd"], bindingDate["$bc"], this.target[bindingDate["$bt"]], bindingDate["$bp"]);
}
else {
eui.Binding.bindProperty(this.target, bindingDate["$bd"][0].split("."), this.target[bindingDate["$bt"]], bindingDate["$bp"]);
}
}
};
JSONParseClass.prototype.createDataProvider = function (component) {
if (component == "")
return undefined;
var result = this.createTypeObject(component);
var source = [];
for (var _i = 0, _a = this.skinClass[component]["source"]; _i < _a.length; _i++) {
var sour = _a[_i];
source.push(this.createItemRender(sour));
}
result["source"] = source;
return result;
};
JSONParseClass.prototype.createItemRender = function (itemName) {
var result = this.createTypeObject(itemName);
for (var property in this.skinClass[itemName]) {
if (property != "$t") {
result[property] = this.skinClass[itemName][property];
}
}
return result;
};
JSONParseClass.prototype.getNormalizeEuiName = function (str) {
return this.euiNormalizeNames[str] ? this.euiNormalizeNames[str] : str;
};
JSONParseClass.prototype.createTypeObject = function (component) {
var typestr = this.getNormalizeEuiName(this.skinClass[component].$t);
var type = egret.getDefinitionByName(typestr);
return new type();
};
JSONParseClass.prototype.getScale9Grid = function (data) {
var datalist = data.split(",");
return new egret.Rectangle(parseFloat(datalist[0]), parseFloat(datalist[1]), parseFloat(datalist[2]), parseFloat(datalist[3]));
};
return JSONParseClass;
}());
window["JSONParseClass"] = new JSONParseClass();
window.generateEUI2 = window.generateEUI2||{};
generateEUI2.paths = generateEUI2.paths||{};
generateEUI2.styles = undefined;
generateEUI2.skins = {"eui.Button":"resource/eui_skins/ButtonSkin.exml","eui.CheckBox":"resource/eui_skins/CheckBoxSkin.exml","eui.HScrollBar":"resource/eui_skins/HScrollBarSkin.exml","eui.HSlider":"resource/eui_skins/HSliderSkin.exml","eui.Panel":"resource/eui_skins/PanelSkin.exml","eui.TextInput":"resource/eui_skins/TextInputSkin.exml","eui.ProgressBar":"resource/eui_skins/ProgressBarSkin.exml","eui.RadioButton":"resource/eui_skins/RadioButtonSkin.exml","eui.Scroller":"resource/eui_skins/ScrollerSkin.exml","eui.ToggleSwitch":"resource/eui_skins/ToggleSwitchSkin.exml","eui.VScrollBar":"resource/eui_skins/VScrollBarSkin.exml","eui.VSlider":"resource/eui_skins/VSliderSkin.exml","eui.ItemRenderer":"resource/eui_skins/ItemRendererSkin.exml","app.RuleTipsButton":"resource/eui_skins/web/common/RuleButton.exml","app.RedDotControl":"resource/eui_skins/web/common/RedDotSkin.exml"};

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

503
public/js/index.js Normal file
View File

@@ -0,0 +1,503 @@
/**
* 冰雪传奇H5
* 2022 XX信息科技有限公司
*
* @author 123456
* @wx 123456
* @qq 123456
*/
let host = window.location.hostname || '100.88.157.105';
let port = 80;
const webUrl = getHttp() + host + (port && 80 != port ? ':' + port : ''),
account = getQueryString('account'),
token = getQueryString('token'),
noLogin = !account || !token;
if (noLogin) {
setTimeout(function () {
loadBarClear();
loadBarFull();
setTimeout(function () {
window.location.href = webUrl + '/login';
}, randomRange(250, 500));
}, 1e3);
}
window['gameName'] = '夜风冰雪';
window['gameLogo'] = 'LOGO6';
// 请勿更改
window['game'] = 'YFBX';
window['pf'] = 'yfbx';
window['pfID'] = 10001;
window['userInfo'] = {
'account': account,
'token': token,
'openID': md5(account + window['game'] + window['pfID']).toUpperCase(),
'cm': 1,
'adult': 0
};
// 检测 Tampermonkey 插件
function checkTampermonkey() {
setTimeout(() => {
const TampermonkeyVars = ["unsafeWindow", "GM_info"]
if (!TampermonkeyVars.every(e => typeof window[e] == 'undefined')) {
// 如果检测到 Tampermonkey 插件,执行以下代码
alert('检测到您正在使用 Tampermonkey 插件,本网站禁止使用此类插件!');
// 可以选择阻止页面访问或其他操作
window.location.href = '/login'; // 将用户重定向到空白页
} else checkTampermonkey()
}, 5000)
}
checkTampermonkey()
// 游戏个性设置: 设备/版本/界面/NPC参数
window['device'] = 0; // 客户端设备(一般无需更改): 0=自适应, 1=PC端界面, 2=移动端界面
window['gameMode'] = 0; // 版本玩法: 0=三职业, 1=单职业(游戏内仅出现战士职业装备)
window['uiStyle'] = 1; // 血球特效: 0=默认, 1=龙头动态火焰特效
window['npcStyle'] = 1; // NPC特效: 0=默认, 1=微变版本NPC动态特效
window['specialId'] = 2; // 打金服ID
window['withdraw'] = {'sid': 1, 'type': 3, 'ratio': 10000}; // 提现
window['isShowGongGao'] = true;
window['isAutoShowGongGao'] = !getCookie('auto_show_notice') ? (setCookie('auto_show_notice', 1, 1), true) : false;
window['isMicro'] = window['pfID'];
window['selectServer'] = true;
window['fontFamily'] = 'Arial';
window['loginType'] = 1; // 登录类型 0:测试 1:正式
window['loginWay'] = 1;
window['isReport'] = 0; // 是否上报后台
window['isReportPF'] = 0; // 是否上报渠道
window['isDisablePay'] = 0; // 是否关闭充值
window['loginView'] = 'app.MainLoginView';
// 相关URL
window['webHost'] = host;
window['webUrl'] = webUrl;
window['serviceListdUrl'] = webUrl + '/server';
window['setServiceListdUrl'] = webUrl + '/server';
window['payUrl'] = webUrl + '/pay';
window['apiUrl'] = webUrl + '/api';
window['orderUrl'] = webUrl + '/api?act=order';
window['reportUrl'] = webUrl + '/api?act=report'; // 上报接口
window['errorReportUrl'] = webUrl + '/api?act=report&do=error';// 错误上报接口
window['checkUrl'] = webUrl + '/api?act=check'; // 验证URL
window['versionUrl'] = webUrl + '/api?act=version'; // 请求客户端版本
window['getActorInfoUrl'] = webUrl + '/api?act=actor';
window['roleInfoUrl'] = webUrl + '/api?act=role';
window['gongGaoUrl'] = webUrl + '/notice.txt';
// 客服信息
window['kfQQ'] = '123456';
window['kfWX'] = '123456';
window['kfQQUrl'] = 'https://127.0.0.1';
window['kfQQGroupUrl'] = 'https://127.0.0.1';
window['gameVerTxt1'] = '审批文号:新广出审[2022]007号 出版物号ISBN 001-1-0001-0001-1 著作权人XX信息科技有限公司';
window['gameVerTxt2'] = '出版单位XX信息科技有限公司 运营单位XX信息科技有限公司';
window['gameVerTxt3'] = '健康游戏忠告:抵制不良游戏,拒绝盗版游戏。注意自我保护,谨防受骗上当。适度游戏益脑,沉迷游戏伤身。合理安排时间,享受健康生活。';
window['publicRes'] = 'https://cdn-cq-res.kubbo.cn/';
const arr = ['loading_1_jpg', 'loading_1_jpg', 'mp_jzjm_png', 'mp_jzjm2_png'];
window['gameLoadImg'] = !getCookie('first_loading') ? (setCookie('first_loading', 1), arr[0]) : arr[randomRange(0, 4)];
window['version1'] = 'zjt1_png';
window['version2'] = 'zjt2_png';
window['version3'] = 'zjt3_png';
window['resVersion'] = '1';
window['thmVersion'] = '1';
window['tableVersion'] = '1.2.80';
window['mainVersion'] = '1.2.2';
window['isDebug'] = false;
const isJsDebug = false;
// 设置标题
//document.title = window['gameName'];
function reporting(type, result) {
if (noLogin) return;
if (window['isReport'] && window['reportUrl']) {
let loginType = window['loginWay'] ? 1 : 0;
let msgInfo = {
type: type,
counter: window['pfID'],
env: window['game'] + '|' + loginType,
time: Date.parse(new Date().toString()) / 1000,
result: result
};
msgInfo['data'] = {
uid: window['userInfo']['uid'],
serverAlias: window['userInfo']['server']
};
const str = JSON.stringify(msgInfo);
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () { //服务器返回值的处理函数,此处使用匿名函数进行实现
if (xhr.readyState == 4 && xhr.status == 200) {
//
}
};
xhr.open('GET', window['reportUrl'] + '&msg=' + str, true); //提交get请求到服务器
xhr.send(null);
}
}
function onerrorFunction(error, uid) {
const xhr = new XMLHttpRequest();
xhr.open('POST', window['checkUrl'] + window.location.search, true);//提交get请求到服务器
xhr.setRequestHeader('Content-Type', 'application/json');
let params = 'pfID=' + window['pfID'] + '&uid=' + uid + '&error=' + error;
xhr.open('GET', window['errorReportUrl'] + '&' + params, true);//提交get请求到服务器
xhr.send(null);
}
window.onerror = function (message, url, line) {
let str = "Message : " + message + "\nURL : " + url + "\nLine Number : " + line;
this.onerrorFunction(str, 0);
alert(str);
}
//1.平台参数格式化
if (!noLogin) {
if (window['loginType']) {
switch (window['pfID']) {
case 10001:
var urlData = window.location.search;
if (urlData.indexOf('?') != -1) {
urlData = urlData.substr(1);
var strs = urlData.split('&');
for (var i = 0; i < strs.length; i++) {
window['userInfo'][strs[i].split('=')[0]] = unescape(strs[i].split('=')[1]);
}
}
break;
default:
// 测试
}
} else {
var urlData = window.location.search;
if (urlData.indexOf('?') != -1) {
urlData = urlData.substr(1);
var strs = urlData.split('&');
for (var i = 0; i < strs.length; i++) {
window['userInfo'][strs[i].split('=')[0]] = unescape(strs[i].split('=')[1]);
}
}
}
}
//2.登录验证
function loginFunction() {
//alert('维护中');
//return;
if (noLogin) return;
// window['userInfo']['serverInfo'] = serverInfo;
//1.平台验证
if (window['loginType']) {
switch (window['pfID']) {
case 10001:
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () { // 服务器返回值的处理函数,此处使用匿名函数进行实现
if (xhr.readyState == 4 && xhr.status == 200) {
//console.log(xhr.responseText);
const obj = JSON.parse(xhr.responseText);
//验证成功
if (0 == obj.code) {
reporting(10001, 1);
start();
} else {
loadError = true;
reporting(10001, 0);
const errorMsg = obj.msg ? obj.msg : '通行证验证失败!',
label = document.getElementById('label');
if (label) {
const linkHtml = '<span class="font_small"><a onClick="window.history.back()" class="link_color">点击返回</a> / <a onClick="window.location.reload()" class="link_color">尝试刷新</a></span>';
label.innerHTML = errorMsg + linkHtml;
} else {
alert(filterHTML(errorMsg));
}
}
}
};
xhr.open('GET', window['checkUrl'] + '&do=verify&' + window.location.search.substr(1), true); //提交get请求到服务器
xhr.send(null);
break;
}
} else {
reporting(10001, 1);
start();
// window['checkFunction']();//检测上报
// window['checkSuccess']();
}
}
//3.支付
function payFunction(param) {
console.log(param);
window.open('./pay/?productId=' + param.productId + '&productName=' + param.productName + '&amount=' + param.amount + '&actorid=' + param.gameExtra + '&serverId=' + param.serverId, '_blank');
}
//4.工具类
function callJsFunction(msg) {
if (msg && msg['type']) {
switch (msg['type']) {
case 'showGame':
showGame();
break;
case 'showLoadProgress':
showLoadProgress(msg['progress'], msg['des']);
break;
default:
//测试
}
}
}
let jobAry = ['', '战士', '法师', '战士']
function ReportingFunction(msg) {
if (msg && msg) {
if (msg['type'] == 12 || msg['type'] == 1000) { //等级上报
//创建xhr对象
let reportingUrl = window['reportUrl'];
reportingUrl += '&do=' + encodeURIComponent('game_profile');
reportingUrl += '&udbid=' + encodeURIComponent(1024009155 + '');
reportingUrl += '&gam=' + encodeURIComponent(window['game'] + '');
reportingUrl += '&pas=';
reportingUrl += '&gse=' + encodeURIComponent('s1');
reportingUrl += '&pro=' + encodeURIComponent('logingame');
reportingUrl += '&ya_appid=' + encodeURIComponent('udblogin');
let json_data = {
game_event: msg['type'] == 12 ? 'new_role' : 'level_change',
role_name: msg.data['roleName'],
role_level: msg.data['level'] + '',
fight_cap: '',
sex: msg.data['sex'] > 0 ? 'f' : 'm',
job: jobAry[msg.data['job']],
partner: '',
equip: msg.data['guildName']
}
json_data = JSON.stringify(json_data);
reportingUrl += '&json_data=' + encodeURIComponent(json_data);
// json_data = { "role_level": "11", "role_name": "s1.虞鹏天", "game_event": "level_change", "fight_cap": "1371", "job": "1" }
const xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () { //服务器返回值的处理函数,此处使用匿名函数进行实现
if (xhr.readyState == 4 && xhr.status == 200) { //
//var obj = JSON.parse(xhr.responseText);
}
};
xhr.open('GET', reportingUrl, true); //提交get请求到服务器
xhr.send(null);
}
}
}
//6.屏蔽右键
document.onkeydown = function () {
// var e = window.event || arguments[0];
//F12
// if (e.keyCode == 123) {
// return false;
// //Ctrl+Shift+I
// } else if ((e.ctrlKey) && (e.shiftKey) && (e.keyCode == 73)) {
// return false;
// //Shift+F10
// } else if ((e.shiftKey) && (e.keyCode == 121)) {
// return false;
// //Ctrl+U
// } else if ((e.ctrlKey) && (e.keyCode == 85)) {
// return false;
// }
};
/**
* 反馈
*/
function feedbackFunction(info) {
removeIfram();
let msgInfo = {
act: 'feedback',
game: window['game'],
platform: window['pf'],
server: window['userInfo']['server'],
uid: info['uid'],
rolename: info['rolename'],
ts: Date.parse(new Date().toString()) / 1000
};
msgInfo['sign'] = new md5().hex_md5((msgInfo.game + msgInfo.platform + msgInfo.server + msgInfo.uid + msgInfo.rolename + msgInfo.ts + 123456));
let param = '';
for (let key in msgInfo) {
param += key + '=' + msgInfo[key] + '&'
}
param = param.substring(0, param.length - 1)
let srcStr = webUrl + '/api?' + param;
const div = document.createElement('div');
div.id = 'iframDiv';
div.innerHTML = '<iframe id="main" scrolling="no" noresize="true" frameborder="0" style="width: 90%;height: 90%;padding-left:5%;padding-top:2%;" src=' + srcStr + '></iframe>';
// div.style = 'position: relative; width:100%; height:100%;background: rgba(0, 0, 0, 0.5);';
div.style.position = 'relative';
div.style.width = '100%';
div.style.height = '100%';
div.style.background = 'rgba(0, 0, 0, 0.5)';
document.body.appendChild(div);
//创建关闭按钮
let div2 = document.createElement('div');
div2.id = 'btnDiv';
div2.innerHTML = '<img id="closeImg" src="static/img/close_btn.jpg?v=1" height="50" width="50" />'
// div2.style = 'position: absolute;right:0px;top:0px;width:50px;height:50px';
div2.style.position = 'absolute';
div2.style.right = '0px';
div2.style.top = '0px';
div2.style.width = '50px';
div2.style.height = '50px';
div.appendChild(div2);
const closeImg = document.getElementById('closeImg');
closeImg.onclick = removeIfram;
// onloadFunction();
}
// 防沉迷
function IdCardFunction() {
window.open(webUrl);
}
function addQQGrp() {
window.open(window['kfQQGroupUrl']);
}
//下载YY游戏大厅
function downYYGameHallFun() {
window.open(webUrl);
}
//开通会员
function openYYVip() {
window.open(webUrl);
}
//开超玩会员
function openChaoWanVip() {
window.open(webUrl);
}
function removeIfram() {
let div = document.getElementById('iframDiv');
if (div) {
document.body.removeChild(div);
}
div = document.getElementById('btnDiv');
if (div) {
document.body.removeChild(div);
}
}
document.oncontextmenu = () => false;
//加载项目工程
const loadScript = function (list, callback) {
let loaded = 0;
const loadNext = function () {
loadSingleScript(list[loaded], function () {
loaded++;
if (loaded >= list.length) {
callback();
} else {
loadNext();
}
});
};
loadNext();
};
let loadTimes = 0;
let jsScr = '';
window['loadScript'] = loadScript;
var loadSingleScript = function (src, callback) {
if (jsScr != src) {
loadTimes = 0;
}
if (src.indexOf('lib') > -1 || src.indexOf('main') > -1) {
const mainSuffix = getQueryString('mainSuffix');
if (mainSuffix) {
src = src.replace('.js', mainSuffix + '.js');
}
src += '?v=' + (isJsDebug ? Math.random() : window['mainVersion']);
}
jsScr = src;
const s = document.createElement('script');
s.type = 'text/javascript';
s.async = false;
s.src = src;
s.addEventListener('load', function () {
s.parentNode.removeChild(s);
s.removeEventListener('load', arguments.callee, false);
callback();
}, false);
s.addEventListener('error', function () {
s.parentNode.removeChild(s);
s.removeEventListener('load', arguments.callee, false);
loadTimes++;
if (loadTimes > 5) {
alert("主程序文件加载失败,请检测网络刷新游戏!\n " + src);
} else {
setTimeout(function () {
loadSingleScript(src, callback);
}, 2000);
}
}, false);
document.body.appendChild(s);
};
//开始启动游戏
function start() {
//alert('维护中');
//return;
const xhr = new XMLHttpRequest();
xhr.open('GET', './manifest.json?v=1.1.1.2', true); // '?v=' + Math.random()
xhr.addEventListener('load', function () {
const manifest = JSON.parse(xhr.response);
const list = manifest.initial.concat(manifest.game);
window['gameAppJS'] = manifest['gameAppJS'];
loadScript(list, function () {
egret.runEgret({
renderMode: 'webgl',
audioType: 0,
calculateCanvasScaleFactor: function (context) {
const backingStore = context.backingStorePixelRatio ||
context.webkitBackingStorePixelRatio ||
context.mozBackingStorePixelRatio ||
context.msBackingStorePixelRatio ||
context.oBackingStorePixelRatio ||
context.backingStorePixelRatio || 1;
return (window.devicePixelRatio || 1) / backingStore;
}
});
});
});
xhr.send(null);
}
//上报
reporting(10000, 1);
loginFunction();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

91545
public/js/main.min_jocw9Tu2.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
var __reflect=this&&this.__reflect||function(t,e,n){t.__class__=e,n?n.push(e):n=[e],t.__types__=t.__types__?n.concat(t.__types__):n},__extends=this&&this.__extends||function(t,e){function n(){this.constructor=t}for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o]);n.prototype=e.prototype,t.prototype=new n},egret;!function(t){}(egret||(egret={}));var egret;!function(t){var e=function(e){function n(o,i){void 0===o&&(o=""),void 0===i&&(i=0);var s=e.call(this)||this;return s._writeMessage="",s._readMessage="",s._connected=!1,s._connecting=!1,s._isReadySend=!1,s._bytesWrite=!1,s._type=n.TYPE_STRING,s._connected=!1,s._writeMessage="",s._readMessage="",s.socket=new t.ISocket,s.socket.addCallBacks(s.onConnect,s.onClose,s.onSocketData,s.onError,s),s}return __extends(n,e),n.prototype.connect=function(t,e){this._connecting||this._connected||(this._connecting=!0,this.socket.connect(t,e))},n.prototype.connectByUrl=function(t){this._connecting||this._connected||(this._connecting=!0,this.socket.connectByUrl(t))},n.prototype.close=function(){this._connected&&this.socket.close()},n.prototype.onConnect=function(){this._connected=!0,this._connecting=!1,this.dispatchEventWith(t.Event.CONNECT)},n.prototype.onClose=function(){this._connected=!1,this.dispatchEventWith(t.Event.CLOSE)},n.prototype.onError=function(){this._connecting&&(this._connecting=!1),this.dispatchEventWith(t.IOErrorEvent.IO_ERROR)},n.prototype.onSocketData=function(e){"string"==typeof e?this._readMessage+=e:this._readByte._writeUint8Array(new Uint8Array(e)),t.ProgressEvent.dispatchProgressEvent(this,t.ProgressEvent.SOCKET_DATA)},n.prototype.flush=function(){return this._connected?(this._writeMessage&&(this.socket.send(this._writeMessage),this._writeMessage=""),this._bytesWrite&&(this.socket.send(this._writeByte.buffer),this._bytesWrite=!1,this._writeByte.clear()),void(this._isReadySend=!1)):void t.$warn(3101)},n.prototype.writeUTF=function(e){return this._connected?(this._type==n.TYPE_BINARY?(this._bytesWrite=!0,this._writeByte.writeUTF(e)):this._writeMessage+=e,void this.flush()):void t.$warn(3101)},n.prototype.readUTF=function(){var t;return this._type==n.TYPE_BINARY?(this._readByte.position=0,t=this._readByte.readUTF(),this._readByte.clear()):(t=this._readMessage,this._readMessage=""),t},n.prototype.writeBytes=function(e,n,o){return void 0===n&&(n=0),void 0===o&&(o=0),this._connected?this._writeByte?(this._bytesWrite=!0,this._writeByte.writeBytes(e,n,o),void this.flush()):void t.$warn(3102):void t.$warn(3101)},n.prototype.readBytes=function(e,n,o){return void 0===n&&(n=0),void 0===o&&(o=0),this._readByte?(this._readByte.position=0,this._readByte.readBytes(e,n,o),void this._readByte.clear()):void t.$warn(3102)},Object.defineProperty(n.prototype,"connected",{get:function(){return this._connected},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"type",{get:function(){return this._type},set:function(e){this._type=e,e!=n.TYPE_BINARY||this._writeByte||(this._readByte=new t.ByteArray,this._writeByte=new t.ByteArray)},enumerable:!0,configurable:!0}),n.TYPE_STRING="webSocketTypeString",n.TYPE_BINARY="webSocketTypeBinary",n}(t.EventDispatcher);t.WebSocket=e,__reflect(e.prototype,"egret.WebSocket")}(egret||(egret={}));var egret;!function(t){var e;!function(e){var n=function(){function e(){this.host="",this.port=0,window.WebSocket||t.$error(3100)}return e.prototype.addCallBacks=function(t,e,n,o,i){this.onConnect=t,this.onClose=e,this.onSocketData=n,this.onError=o,this.thisObject=i},e.prototype.connect=function(t,e){this.host=t,this.port=e;var n="ws://"+this.host+this.port==443?"":":"+this.port;this.socket=new window.WebSocket(n),this.socket.binaryType="arraybuffer",this._bindEvent()},e.prototype.connectByUrl=function(t){this.socket=new window.WebSocket(t),this.socket.binaryType="arraybuffer",this._bindEvent()},e.prototype._bindEvent=function(){var t=this,e=this.socket;e.onopen=function(){t.onConnect&&t.onConnect.call(t.thisObject)},e.onclose=function(e){t.onClose&&t.onClose.call(t.thisObject)},e.onerror=function(e){t.onError&&t.onError.call(t.thisObject)},e.onmessage=function(e){t.onSocketData&&(e.data?t.onSocketData.call(t.thisObject,e.data):t.onSocketData.call(t.thisObject,e))}},e.prototype.send=function(t){this.socket.send(t)},e.prototype.close=function(){this.socket.close()},e.prototype.disconnect=function(){this.socket.disconnect&&this.socket.disconnect()},e}();e.HTML5WebSocket=n,__reflect(n.prototype,"egret.web.HTML5WebSocket",["egret.ISocket"]),t.ISocket=n}(e=t.web||(t.web={}))}(egret||(egret={}));

File diff suppressed because one or more lines are too long