📱
请竖屏游玩
旋转手机到竖屏模式获得最佳体验
function getEquippedId(type) { if (!GS.worldEquipped) GS.worldEquipped = {}; return GS.worldEquipped[type] || null; } // 设置装备(全局) function setEquipped(type, itemId) { if (!GS.worldEquipped) GS.worldEquipped = {}; if (itemId) { GS.worldEquipped[type] = itemId; } else { delete GS.worldEquipped[type]; } saveGame(); // 立即刷新所有显示位置 refreshAllEquippedDisplays(); } // v13:换装后立即刷新当前主屏幕(状态栏、角色、宠物全部重绘) function refreshAllEquippedDisplays() { refreshMainScreen(); } // 获取已装备的头像框对象 function getEquippedFrame() { var fid = getEquippedId('frame'); if (!fid) return null; for (var i = 0; i < SHOP_DATA.frames.length; i++) { if (SHOP_DATA.frames[i].id === fid && isOwned(fid)) return SHOP_DATA.frames[i]; } return null; } // 获取已装备的称号对象 function getEquippedTitle() { var tid = getEquippedId('title'); if (!tid) return null; for (var i = 0; i < SHOP_DATA.titles.length; i++) { if (SHOP_DATA.titles[i].id === tid && isOwned(tid)) return SHOP_DATA.titles[i]; } return null; } // v12: getEquippedSkin merged into costume (skin type no longer exists) function getEquippedSkin() { return null; } // v12: getEquippedPetSkin merged into petArmor function getEquippedPetSkin() { return null; } // 头像框边框样式映射 function getFrameBorderStyle(frame) { var styles = { 'frame_001': 'border:3px solid #FF5722;box-shadow:0 0 8px #FF572266,inset 0 0 4px #FF572233;animation:frameFlame 1.5s ease-in-out infinite', 'frame_002': 'border:3px solid #29B6F6;box-shadow:0 0 8px #29B6F666;animation:frameIce 2s ease-in-out infinite', 'frame_003': 'border:3px solid #f44;box-shadow:0 0 8px rgba(255,255,255,0.3);animation:frameRainbow 3s linear infinite', 'frame_004': 'border:3px solid #FFD740;box-shadow:0 0 10px #FFD74066;animation:frameStar 1.8s ease-in-out infinite', 'frame_005': 'border:3px solid #FF6F00;box-shadow:0 0 8px #FF6F0066;animation:frameDragon 2s ease-in-out infinite' }; return styles[frame.id] || ''; } // 宠物皮肤覆盖样式(用于面板大图显示) function getPetSkinStyle(skin) { if (!skin) return ''; var filterMap = { 'petSkin_001': 'filter:hue-rotate(90deg) saturate(1.5)', // 幻彩 'petSkin_002': 'filter:sepia(1) saturate(2) brightness(1.2)', // 暗影 'petSkin_003': 'filter:hue-rotate(180deg) brightness(1.3)' // 冰霜 }; return filterMap[skin.id] || ''; } // 宠物皮肤纯filter值(不含filter:前缀,用于合并到其他filter中) function getPetSkinFilterValue(skin) { if (!skin) return ''; var filterMap = { 'petSkin_001': 'hue-rotate(90deg) saturate(1.5)', 'petSkin_002': 'sepia(1) saturate(2) brightness(1.2)', 'petSkin_003': 'hue-rotate(180deg) brightness(1.3)' }; return filterMap[skin.id] || ''; } // 段位详情弹窗(点击状态栏段位触发) function toggleCareerDetail() { var existing = document.getElementById('careerDetailPopup'); if (existing) { existing.remove(); return; } var s = SS(); var c = getCareer(s.exp); var popup = document.createElement('div'); popup.id = 'careerDetailPopup'; popup.style.cssText = 'position:fixed;top:40px;left:50%;transform:translateX(-50%);background:linear-gradient(135deg,#1a1a2e,#2d1b69);border:1px solid #7C4DFF;border-radius:12px;padding:12px 16px;z-index:9999;min-width:200px;box-shadow:0 4px 20px rgba(0,0,0,0.5)'; var careerColor = c.color === 'rainbow' || c.color === 'legendary' ? '#FFD700' : c.color; popup.innerHTML = '
' + '
' + c.icon + '
' + '
' + getCareerName(c) + '
' + '
段位 ' + (c.segment+1) + '/9 · 段内 ' + c.levelInSegment + '/10 · 经验 ' + s.exp + '
' + '
'; document.body.appendChild(popup); // 3秒后自动关闭 setTimeout(function() { var p = document.getElementById('careerDetailPopup'); if (p) { p.style.opacity = '0'; p.style.transition = 'opacity 0.3s'; setTimeout(function() { if (p.parentNode) p.remove(); }, 300); } }, 3000); } // 【无锁版】调试面板 // ============================================================ // 调试面板当前查看的科目 var debugViewSubject = null; function showDebugPanel(viewSubj) { // 如果已有调试面板,先关闭(用于学科切换) var existing = document.getElementById("debugOverlay"); if (existing) { existing.remove(); } if (!viewSubj) viewSubj = GS.currentSubject; debugViewSubject = viewSubj; if (!GS.sub[viewSubj]) GS.sub[viewSubj] = defaultState().sub[viewSubj] || defaultState().sub.math; var sub = viewSubj; var exp = GS.sub[sub].exp; // v7:用新等级系统生成段位按钮 var segments = getSegmentsBySubject(sub); var careerBtns = ""; for (var i = 0; i < segments.length; i++) { careerBtns += ''; } // v7宠物定义(世界统一版) var petDef = getPetDef(sub); var activePet = getActivePet(); var hasPet = !!activePet; var petBtnText = hasPet ? "移除" + (petDef ? petDef.name : '宠物') : "获得" + (petDef ? petDef.name : '宠物'); var level = computeLevel(sub, exp); var careerName = buildCareerObj(sub, level).fullName; // 学科标签栏 var tabsHTML = '
'; for (var i = 0; i < SUBJECTS.length; i++) { var s = SUBJECTS[i]; var isActive = s.id === sub; var tabBg = isActive ? '#7C4DFF' : 'rgba(255,255,255,0.08)'; var tabColor = isActive ? '#fff' : '#888'; var tabBorder = isActive ? '2px solid #B388FF' : '1px solid rgba(255,255,255,0.1)'; tabsHTML += '
' + s.icon + ' ' + s.name.replace('大陆','') + '
'; } tabsHTML += '
'; var overlay = document.createElement("div"); overlay.id = "debugOverlay"; overlay.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.9);z-index:10000;overflow-y:auto;padding:20px"; overlay.onclick = function() { overlay.remove(); }; var box = document.createElement("div"); box.style.cssText = "max-width:400px;margin:0 auto;background:linear-gradient(135deg,#1a1a2e,#2d1b69);border:2px solid #FFD700;border-radius:16px;padding:20px"; box.onclick = function(e) { e.stopPropagation(); var el = e.target; while (el && el !== box) { var action = el.getAttribute('data-action'); if (action) { e.preventDefault(); handleAction(action, el); return; } el = el.parentElement; } }; box.innerHTML = '
' + '
🔧 调试面板
' + '
' + '
' + tabsHTML + '
' + '
' + ({math:"🔢",chinese:"📖",english:"🌍",physics:"⚡",chemistry:"🔬",history:"🏛️",biology:"🧬",geography:"🌏",politics:"⚖️"}[sub]||"🔢") + ' ' + ({math:"数学",chinese:"语文",english:"英语",physics:"物理",chemistry:"化学",history:"历史",biology:"生物",geography:"地理",politics:"道法"}[sub]||"数学") + ' · ' + careerName + '
' + '
经验 ' + exp + ' | 等级 ' + careerName + ' | 宠物 ' + (hasPet ? '✅' + (activePet ? activePet.name : '') : '❌') + ' | 世界金币 ' + getWorldCoins() + ' | 时空跳跃 ' + (GS.sub[sub].skillSkipLeft||0) + '/1
' + '
' + '
' + '
⚡ 设置经验值
' + '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
' + '
' + '
' + '
🎮 设置职级
' + '
' + careerBtns + '
' + '
' + '
' + '
🐾 宠物 & 技能
' + '
' + '' + '' + '
' + '
' + '
' + '
📊 通关
' + '
' + '' + '' + '
' + '
' + '
' + '
💰 世界金币(当前:' + getWorldCoins() + '币)
' + '
' + '' + '' + '' + '
' + '
' + '
' + '
🎮 小游戏
' + '
' + '' + '' + '' + '
' + '
' + '
'; overlay.appendChild(box); document.body.appendChild(overlay); } function debugClose() { var el = document.getElementById("debugOverlay"); if (el) el.remove(); debugViewSubject = null; } function debugSetExp(val) { var sub = debugViewSubject || GS.currentSubject; GS.sub[sub].exp = val; saveGame(); showMap(); debugClose(); showDebugPanel(sub); } function debugSetCareer(idx) { var sub = debugViewSubject || GS.currentSubject; var segments = getSegmentsBySubject(sub); if (idx >= 0 && idx < segments.length) { // 设置经验到该段位的最高级(段末) var targetLevel = (idx + 1) * 10; // 10, 20, 30, ... 90 GS.sub[sub].exp = getCumExpForLevel(targetLevel); saveGame(); showMap(); debugClose(); showDebugPanel(sub); } } function debugTogglePet() { var sub = debugViewSubject || GS.currentSubject; var petDef = getPetDef(sub); if (!petDef) return; // 检查世界宠物列表中是否已有该宠物 var found = false; for (var i = 0; i < (GS.worldPets||[]).length; i++) { if (GS.worldPets[i].id === petDef.id) { found = true; break; } } if (found) { // 移除 GS.worldPets = (GS.worldPets||[]).filter(function(p) { return p.id !== petDef.id; }); if (GS.activePetId === petDef.id) GS.activePetId = ''; } else { // 添加 if (!GS.worldPets) GS.worldPets = []; GS.worldPets.push({ id: petDef.id, name: petDef.name, icon: petDef.icon, level: 1, exp: 0, obtained: Date.now(), element: petDef.element || '数' }); if (!GS.activePetId) GS.activePetId = petDef.id; } saveGame(); showMap(); debugClose(); showDebugPanel(sub); } function debugSetFold(n) { var sub = debugViewSubject || GS.currentSubject; GS.sub[sub].skillSkipLeft = n; saveGame(); debugClose(); showDebugPanel(sub); } function debugClearAll() { var camps = getCamps(); var order = getCampOrder(); for (var tId in order) { var arr = order[tId]; for (var i = 0; i < arr.length; i++) { var sec = arr[i]; if (camps[sec] && !camps[sec].placeholder) { if (SS().clearedSections.indexOf(sec) < 0) { SS().clearedSections.push(sec); } } } } saveGame(); showMap(); debugClose(); showDebugPanel(debugViewSubject || GS.currentSubject); } function debugResetProgress() { var sub = debugViewSubject || GS.currentSubject; GS.sub[sub].exp = 0; GS.sub[sub].clearedSections = []; saveGame(); showMap(); debugClose(); showDebugPanel(sub); } function debugSetCoins(val) { if (val === 0) { GS.worldCoins = 0; GS.worldCoinsToday = 0; } else { GS.worldCoins = (GS.worldCoins || 0) + val; } saveGame(); debugClose(); showDebugPanel(debugViewSubject || GS.currentSubject); } function debugSetMiniGame(val) { SS().miniGameLeft = val; saveGame(); debugClose(); showDebugPanel(debugViewSubject || GS.currentSubject); } function getEquippedId(type) { if (!GS.worldEquipped) GS.worldEquipped = {}; return GS.worldEquipped[type] || null; } // 设置装备(全局) function setEquipped(type, itemId) { if (!GS.worldEquipped) GS.worldEquipped = {}; if (itemId) { GS.worldEquipped[type] = itemId; } else { delete GS.worldEquipped[type]; } saveGame(); // 立即刷新所有显示位置 refreshAllEquippedDisplays(); } // v13:换装后立即刷新当前主屏幕(状态栏、角色、宠物全部重绘) function refreshAllEquippedDisplays() { refreshMainScreen(); } // 获取已装备的头像框对象 function getEquippedFrame() { var fid = getEquippedId('frame'); if (!fid) return null; for (var i = 0; i < SHOP_DATA.frames.length; i++) { if (SHOP_DATA.frames[i].id === fid && isOwned(fid)) return SHOP_DATA.frames[i]; } return null; } // 获取已装备的称号对象 function getEquippedTitle() { var tid = getEquippedId('title'); if (!tid) return null; for (var i = 0; i < SHOP_DATA.titles.length; i++) { if (SHOP_DATA.titles[i].id === tid && isOwned(tid)) return SHOP_DATA.titles[i]; } return null; } // v12: getEquippedSkin merged into costume (skin type no longer exists) function getEquippedSkin() { return null; } // v12: getEquippedPetSkin merged into petArmor function getEquippedPetSkin() { return null; } // 头像框边框样式映射 function getFrameBorderStyle(frame) { var styles = { 'frame_001': 'border:3px solid #FF5722;box-shadow:0 0 8px #FF572266,inset 0 0 4px #FF572233;animation:frameFlame 1.5s ease-in-out infinite', 'frame_002': 'border:3px solid #29B6F6;box-shadow:0 0 8px #29B6F666;animation:frameIce 2s ease-in-out infinite', 'frame_003': 'border:3px solid #f44;box-shadow:0 0 8px rgba(255,255,255,0.3);animation:frameRainbow 3s linear infinite', 'frame_004': 'border:3px solid #FFD740;box-shadow:0 0 10px #FFD74066;animation:frameStar 1.8s ease-in-out infinite', 'frame_005': 'border:3px solid #FF6F00;box-shadow:0 0 8px #FF6F0066;animation:frameDragon 2s ease-in-out infinite' }; return styles[frame.id] || ''; } // 宠物皮肤覆盖样式(用于面板大图显示) function getPetSkinStyle(skin) { if (!skin) return ''; var filterMap = { 'petSkin_001': 'filter:hue-rotate(90deg) saturate(1.5)', // 幻彩 'petSkin_002': 'filter:sepia(1) saturate(2) brightness(1.2)', // 暗影 'petSkin_003': 'filter:hue-rotate(180deg) brightness(1.3)' // 冰霜 }; return filterMap[skin.id] || ''; } // 宠物皮肤纯filter值(不含filter:前缀,用于合并到其他filter中) function getPetSkinFilterValue(skin) { if (!skin) return ''; var filterMap = { 'petSkin_001': 'hue-rotate(90deg) saturate(1.5)', 'petSkin_002': 'sepia(1) saturate(2) brightness(1.2)', 'petSkin_003': 'hue-rotate(180deg) brightness(1.3)' }; return filterMap[skin.id] || ''; } // 段位详情弹窗(点击状态栏段位触发) function toggleCareerDetail() { var existing = document.getElementById('careerDetailPopup'); if (existing) { existing.remove(); return; } var s = SS(); var c = getCareer(s.exp); var popup = document.createElement('div'); popup.id = 'careerDetailPopup'; popup.style.cssText = 'position:fixed;top:40px;left:50%;transform:translateX(-50%);background:linear-gradient(135deg,#1a1a2e,#2d1b69);border:1px solid #7C4DFF;border-radius:12px;padding:12px 16px;z-index:9999;min-width:200px;box-shadow:0 4px 20px rgba(0,0,0,0.5)'; var careerColor = c.color === 'rainbow' || c.color === 'legendary' ? '#FFD700' : c.color; popup.innerHTML = '
' + '
' + c.icon + '
' + '
' + getCareerName(c) + '
' + '
段位 ' + (c.segment+1) + '/9 · 段内 ' + c.levelInSegment + '/10 · 经验 ' + s.exp + '
' + '
'; document.body.appendChild(popup); // 3秒后自动关闭 setTimeout(function() { var p = document.getElementById('careerDetailPopup'); if (p) { p.style.opacity = '0'; p.style.transition = 'opacity 0.3s'; setTimeout(function() { if (p.parentNode) p.remove(); }, 300); } }, 3000); } // 【无锁版】调试面板 // ============================================================ // 调试面板当前查看的科目 var debugViewSubject = null; function showDebugPanel(viewSubj) { // 如果已有调试面板,先关闭(用于学科切换) var existing = document.getElementById("debugOverlay"); if (existing) { existing.remove(); } if (!viewSubj) viewSubj = GS.currentSubject; debugViewSubject = viewSubj; if (!GS.sub[viewSubj]) GS.sub[viewSubj] = defaultState().sub[viewSubj] || defaultState().sub.math; var sub = viewSubj; var exp = GS.sub[sub].exp; // v7:用新等级系统生成段位按钮 var segments = getSegmentsBySubject(sub); var careerBtns = ""; for (var i = 0; i < segments.length; i++) { careerBtns += ''; } // v7宠物定义(世界统一版) var petDef = getPetDef(sub); var activePet = getActivePet(); var hasPet = !!activePet; var petBtnText = hasPet ? "移除" + (petDef ? petDef.name : '宠物') : "获得" + (petDef ? petDef.name : '宠物'); var level = computeLevel(sub, exp); var careerName = buildCareerObj(sub, level).fullName; // 学科标签栏 var tabsHTML = '
'; for (var i = 0; i < SUBJECTS.length; i++) { var s = SUBJECTS[i]; var isActive = s.id === sub; var tabBg = isActive ? '#7C4DFF' : 'rgba(255,255,255,0.08)'; var tabColor = isActive ? '#fff' : '#888'; var tabBorder = isActive ? '2px solid #B388FF' : '1px solid rgba(255,255,255,0.1)'; tabsHTML += '
' + s.icon + ' ' + s.name.replace('大陆','') + '
'; } tabsHTML += '
'; var overlay = document.createElement("div"); overlay.id = "debugOverlay"; overlay.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.9);z-index:10000;overflow-y:auto;padding:20px"; overlay.onclick = function() { overlay.remove(); }; var box = document.createElement("div"); box.style.cssText = "max-width:400px;margin:0 auto;background:linear-gradient(135deg,#1a1a2e,#2d1b69);border:2px solid #FFD700;border-radius:16px;padding:20px"; box.onclick = function(e) { e.stopPropagation(); var el = e.target; while (el && el !== box) { var action = el.getAttribute('data-action'); if (action) { e.preventDefault(); handleAction(action, el); return; } el = el.parentElement; } }; box.innerHTML = '
' + '
🔧 调试面板
' + '
' + '
' + tabsHTML + '
' + '
' + ({math:"🔢",chinese:"📖",english:"🌍",physics:"⚡",chemistry:"🔬",history:"🏛️",biology:"🧬",geography:"🌏",politics:"⚖️"}[sub]||"🔢") + ' ' + ({math:"数学",chinese:"语文",english:"英语",physics:"物理",chemistry:"化学",history:"历史",biology:"生物",geography:"地理",politics:"道法"}[sub]||"数学") + ' · ' + careerName + '
' + '
经验 ' + exp + ' | 等级 ' + careerName + ' | 宠物 ' + (hasPet ? '✅' + (activePet ? activePet.name : '') : '❌') + ' | 世界金币 ' + getWorldCoins() + ' | 时空跳跃 ' + (GS.sub[sub].skillSkipLeft||0) + '/1
' + '
' + '
' + '
⚡ 设置经验值
' + '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
' + '
' + '
' + '
🎮 设置职级
' + '
' + careerBtns + '
' + '
' + '
' + '
🐾 宠物 & 技能
' + '
' + '' + '' + '
' + '
' + '
' + '
📊 通关
' + '
' + '' + '' + '
' + '
' + '
' + '
💰 世界金币(当前:' + getWorldCoins() + '币)
' + '
' + '' + '' + '' + '
' + '
' + '
' + '
🎮 小游戏
' + '
' + '' + '' + '' + '
' + '
' + '
'; overlay.appendChild(box); document.body.appendChild(overlay); } function debugClose() { var el = document.getElementById("debugOverlay"); if (el) el.remove(); debugViewSubject = null; } function debugSetExp(val) { var sub = debugViewSubject || GS.currentSubject; GS.sub[sub].exp = val; saveGame(); showMap(); debugClose(); showDebugPanel(sub); } function debugSetCareer(idx) { var sub = debugViewSubject || GS.currentSubject; var segments = getSegmentsBySubject(sub); if (idx >= 0 && idx < segments.length) { // 设置经验到该段位的最高级(段末) var targetLevel = (idx + 1) * 10; // 10, 20, 30, ... 90 GS.sub[sub].exp = getCumExpForLevel(targetLevel); saveGame(); showMap(); debugClose(); showDebugPanel(sub); } } function debugTogglePet() { var sub = debugViewSubject || GS.currentSubject; var petDef = getPetDef(sub); if (!petDef) return; // 检查世界宠物列表中是否已有该宠物 var found = false; for (var i = 0; i < (GS.worldPets||[]).length; i++) { if (GS.worldPets[i].id === petDef.id) { found = true; break; } } if (found) { // 移除 GS.worldPets = (GS.worldPets||[]).filter(function(p) { return p.id !== petDef.id; }); if (GS.activePetId === petDef.id) GS.activePetId = ''; } else { // 添加 if (!GS.worldPets) GS.worldPets = []; GS.worldPets.push({ id: petDef.id, name: petDef.name, icon: petDef.icon, level: 1, exp: 0, obtained: Date.now(), element: petDef.element || '数' }); if (!GS.activePetId) GS.activePetId = petDef.id; } saveGame(); showMap(); debugClose(); showDebugPanel(sub); } function debugSetFold(n) { var sub = debugViewSubject || GS.currentSubject; GS.sub[sub].skillSkipLeft = n; saveGame(); debugClose(); showDebugPanel(sub); } function debugClearAll() { var camps = getCamps(); var order = getCampOrder(); for (var tId in order) { var arr = order[tId]; for (var i = 0; i < arr.length; i++) { var sec = arr[i]; if (camps[sec] && !camps[sec].placeholder) { if (SS().clearedSections.indexOf(sec) < 0) { SS().clearedSections.push(sec); } } } } saveGame(); showMap(); debugClose(); showDebugPanel(debugViewSubject || GS.currentSubject); } function debugResetProgress() { var sub = debugViewSubject || GS.currentSubject; GS.sub[sub].exp = 0; GS.sub[sub].clearedSections = []; saveGame(); showMap(); debugClose(); showDebugPanel(sub); } function debugSetCoins(val) { if (val === 0) { GS.worldCoins = 0; GS.worldCoinsToday = 0; } else { GS.worldCoins = (GS.worldCoins || 0) + val; } saveGame(); debugClose(); showDebugPanel(debugViewSubject || GS.currentSubject); } function debugSetMiniGame(val) { SS().miniGameLeft = val; saveGame(); debugClose(); showDebugPanel(debugViewSubject || GS.currentSubject); }