merge: integrate platform login migration

This commit is contained in:
2026-09-06 09:06:19 +08:00
149 changed files with 8958 additions and 1622 deletions
@@ -38,7 +38,9 @@ SDK runtime 也不导入框架实现层,平台适配由 `platform/game-host-ad
`GameEntry.resolveSeatCount` 只接收真实房间的 `roomtype`,预检只检查该方法存在; `GameEntry.resolveSeatCount` 只接收真实房间的 `roomtype`,预检只检查该方法存在;
GameHost 在进房边界验证返回值是正整数并与服务器座位数组长度相同。 GameHost 在进房边界验证返回值是正整数并与服务器座位数组长度相同。
`assertGameContract(entry, samples)` 的每个样本由游戏提供 `roomtype`、`expectedSeatCount` `assertGameContract(entry, samples, assert)` 的 `assert` 由测试调用方从 `node:assert/strict`
显式导入并传入;harness 仅引用断言类型,避免 Creator 加载脚本时解析 Node 内置模块。
每个样本由游戏提供 `roomtype`、`expectedSeatCount`
和对应的 `makeHost` 工厂,不要求游戏支持框架虚构的房间配置。 和对应的 `makeHost` 工厂,不要求游戏支持框架虚构的房间配置。
远程地址唯一取自 `data.urlserver`。配置请求使用空 body 的 POST,沿用无条件 `?` 缓存参数拼接。 远程地址唯一取自 `data.urlserver`。配置请求使用空 body 的 POST,沿用无条件 `?` 缓存参数拼接。
@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "aea92450-9c09-40ed-8a4d-5cced7a56b3b",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "c1b8189d-1134-4ff3-9426-d2668fd9ab6f",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -2,7 +2,7 @@
"ver": "4.0.24", "ver": "4.0.24",
"importer": "typescript", "importer": "typescript",
"imported": true, "imported": true,
"uuid": "2eb9409f-115d-4a7d-bdc4-30a333b57a28", "uuid": "0693ece5-bed1-4b21-8ae7-7393c2eee8a7",
"files": [], "files": [],
"subMetas": {}, "subMetas": {},
"userData": {} "userData": {}
@@ -2,7 +2,7 @@
"ver": "4.0.24", "ver": "4.0.24",
"importer": "typescript", "importer": "typescript",
"imported": true, "imported": true,
"uuid": "d8981b12-16b5-49a7-95d6-a51eb735462a", "uuid": "4deb8dec-916d-4dda-b709-ac5f38fa0253",
"files": [], "files": [],
"subMetas": {}, "subMetas": {},
"userData": {} "userData": {}
@@ -70,7 +70,7 @@ function sample(random: () => number, key: string): number {
return sampleLocalRandom(random, (reason, cause) => wrap(key, 'random', reason, cause)); return sampleLocalRandom(random, (reason, cause) => wrap(key, 'random', reason, cause));
} }
function generate(random: () => number, key: string): LoginAccountIdentity { export function generate(random: () => number, key: string): LoginAccountIdentity {
const id = Math.floor(sample(random, key) * 100000); const id = Math.floor(sample(random, key) * 100000);
const avatar = AVATARS[Math.floor(sample(random, key) * AVATARS.length)]!; const avatar = AVATARS[Math.floor(sample(random, key) * AVATARS.length)]!;
const sex = Math.floor(sample(random, key) * 2) + 1; const sex = Math.floor(sample(random, key) * 2) + 1;
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "bb7c9b58-c08f-4dc9-b8d1-57c2b20f9c28",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "8499ef07-6051-4d8f-aca6-11996e448b7f",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,169 @@
import type { LoginAccountIdentity, DeviceLoginMode } from '../../protocol/contracts/login-contract.ts';
import type { LoginPolicy } from '../../presentation/login-policy.ts';
import { generate } from '../local/visitor-account.ts';
import { readPhoneCode } from './phone-code.ts';
export interface LoginNativeSettings {
accreditlogin(provider: number): void;
getcompareCode(): number | string;
}
interface Options {
storage: {getItem(key:string):string|null;setItem(key:string,value:string):void};
settings?:LoginNativeSettings; random():number; now():number;
gameid:string|number;agentid:string|number;policy:LoginPolicy;
submit(account:LoginAccountIdentity,device:DeviceLoginMode):void;tip(message:string):void;
}
/** MD5 is the legacy nickname derivation, not a security primitive. */
export function nicknameHash(input:string):string {
const bytes=Array.from(new TextEncoder().encode(input));const bitLength=bytes.length*8;
bytes.push(128);while(bytes.length%64!==56)bytes.push(0);
for(let i=0;i<8;i++)bytes.push(i<4?(bitLength>>>(8*i))&255:0);
const shifts=[7,12,17,22,5,9,14,20,4,11,16,23,6,10,15,21];
let state=[0x67452301,0xefcdab89,0x98badcfe,0x10325476];
for(let offset=0;offset<bytes.length;offset+=64){
const words=Array.from({length:16},(_,j)=>bytes[offset+j*4]|bytes[offset+j*4+1]<<8|bytes[offset+j*4+2]<<16|bytes[offset+j*4+3]<<24);
let [a,b,c,d]=state;
for(let i=0;i<64;i++){
const round=Math.floor(i/16);let f:number,g:number;
if(round===0){f=(b&c)|(~b&d);g=i;}else if(round===1){f=(d&b)|(~d&c);g=(5*i+1)%16;}
else if(round===2){f=b^c^d;g=(3*i+5)%16;}else{f=c^(b|~d);g=(7*i)%16;}
const sum=(a+f+Math.floor(Math.abs(Math.sin(i+1))*4294967296)+words[g])|0;
const shift=shifts[round*4+i%4];const next=(b+((sum<<shift)|(sum>>>(32-shift))))|0;
a=d;d=c;c=b;b=next;
}
state=state.map((v,i)=>(v+[a,b,c,d][i])|0);
}
return state.map(v=>[0,8,16,24].map(s=>((v>>>s)&255).toString(16).padStart(2,'0')).join('')).join('');
}
function record(value:unknown):Record<string,unknown>{
if(typeof value==='string')value=JSON.parse(value);
if(!value||typeof value!=='object'||Array.isArray(value))throw Error('Invalid sharelogin account');
return value as Record<string,unknown>;
}
function accountFrom(value:unknown):LoginAccountIdentity {
const data=record(value);
for(const field of ['openid','headimgurl','nickname','city','Province'])if(typeof data[field]!=='string')throw Error(`Invalid sharelogin.${field}`);
if(typeof data.unionid!=='string'&&typeof data.unionid!=='number')throw Error('Invalid sharelogin.unionid');
const sex=data.sex?data.sex:1; // Func.sharelogin explicitly owns this default.
if(typeof sex!=='number'||!Number.isFinite(sex))throw Error('Invalid sharelogin.sex');
if(!data.nickname&&!data.headimgurl)throw Error('授权失败,请重新授权!');
return {openid:data.openid as string,avatar:data.headimgurl as string,nickname:data.nickname as string,
city:data.city as string,province:data.Province as string,unionid:data.unionid as string|number,sex};
}
/** Exact native/cached account boundary; UI never invents account or server fields. */
/** 账户统一入口:协议确认、缓存选择、原生授权及提交模式均由此处管理。 */
export class LoginAccounts {
readonly versionState:0|1;
private hiddenClicks=0;
/** 每次启动默认同意;按钮、缓存登录及原生回调读取同一份状态。 */
private agreementAccepted=true;
get agreed():boolean{return this.agreementAccepted;}
setAgreement(accepted:boolean):void{
if(accepted&&!this.agreementAccepted)this.options.tip('');
this.agreementAccepted=accepted;
}
/** 未同意时只提示,不调用授权、不写缓存、不提交请求。 */
requireAgreement():boolean{
if(this.agreementAccepted)return true;
this.options.tip('未同意协议');return false;
}
constructor(private readonly options:Options){
// Browser source explicitly uses the legacy getVersionState default of zero.
const state=options.settings?Number(options.settings.getcompareCode()):0;
if(state!==0&&state!==1)throw Error('Invalid getcompareCode result');this.versionState=state;
}
private read(key:string,cookie:boolean):Record<string,unknown>|null {
if(cookie&&this.versionState===0){
const expiry=this.options.storage.getItem('tsgame_validtime');
if(expiry===null)return null;
if(!Number.isFinite(Number(expiry)))throw Error('Invalid tsgame_validtime');
if(this.options.now()>=Number(expiry))return null;
}
const raw=this.options.storage.getItem(key);return raw===null?null:record(raw);
}
private save(account:LoginAccountIdentity,key:string,telphone?:string){
const data={openid:account.openid,headimgurl:account.avatar,nickname:account.nickname,sex:account.sex,
city:account.city,Province:account.province,unionid:account.unionid,...(telphone===undefined?{}:{telphone})};
this.options.storage.setItem('tsgame_validtime',String(this.options.now()+48*60*60*1000));
this.options.storage.setItem(key,JSON.stringify(data));
}
/** 保留原工程缓存优先级,游客开关先于手机模式判断。 */
cached():LoginAccountIdentity|null {
if(this.versionState!==0)return null;
const policy=this.options.policy;
const data=this.read(policy.showVisitor?'tsgame_visitorinfo':policy.deviceLogin?'tsgame_devicePlayer':'tsgame_wxinfo',true);
return data===null?null:accountFrom(data);
}
autoLogin():void {
if(!this.requireAgreement())return;
const account=this.cached();if(account===null)throw Error('No cached login');
// showVisitor selects the visitor cache above, even when the phone button is enabled.
if(!this.options.policy.showVisitor&&this.options.policy.deviceLogin){
const data=this.read('tsgame_devicePlayer',true)!;
if(typeof data.telphone!=='string')throw Error('Cached device account missing telphone');
this.options.submit(account,{enabled:true,telphone:data.telphone});
}else this.options.submit(account,{enabled:false});
}
authorize(provider:'wechat'|'qq'):void {
if(!this.requireAgreement())return;
if(!this.options.settings){this.options.tip('当前宿主未提供原生登录授权接口');return;}
if(provider==='wechat')this.options.storage.setItem(`tsgame_playerid_${this.options.gameid}${this.options.agentid}`,'');
this.options.settings.accreditlogin(provider==='wechat'?2:1);
}
acceptNative(data:unknown,channel:'global'|'bridge'):void {
if(!this.requireAgreement())return;
const account=accountFrom(data);
this.save(account,channel==='global'&&this.options.policy.showVisitor?'tsgame_visitorinfo':'tsgame_wxinfo');
this.options.submit(account,{enabled:false});
}
/** 仅本次手机登录要求 tel,不能依据按钮显示配置要求游客响应携带手机号。 */
loginSucceeded(value:unknown,mode:DeviceLoginMode):void {
const data=record(value);
if(data.state!==0)throw Error('Cannot cache an unsuccessful login');
if(typeof data.playerid!=='string'&&(typeof data.playerid!=='number'||!Number.isFinite(data.playerid)))throw Error('Invalid login playerid');
// Button availability is not the authentication mode of this request.
if(mode.enabled){
if(typeof data.tel!=='string')throw Error('Device login response missing tel');
const account=accountFrom({...data,headimgurl:data.avatar,Province:data.province});
this.save(account,'tsgame_devicePlayer',data.tel);
this.options.storage.setItem('tsgame_dLogin','1');
}
this.options.storage.setItem(`tsgame_playerid_${this.options.gameid}${this.options.agentid}`,String(data.playerid));
}
visitor():void {
if(!this.requireAgreement())return;
const cached=this.read('tsgame_visitorinfo',false);
const account=cached===null?generate(this.options.random,'tsgame_visitorinfo'):accountFrom(cached);
this.save(account,this.options.policy.showVisitor?'tsgame_visitorinfo':'tsgame_wxinfo');
this.options.submit(account,{enabled:false});
}
hiddenFirst():void{this.hiddenClicks++;}
phonePanelState(){return readPhoneCode(this.options.storage.getItem('sgame_phoneCode'),this.options.now());}
hiddenSecond():void{if(this.hiddenClicks>=5&&this.options.policy.hiddenVisitor){this.hiddenClicks=0;this.visitor();}}
private deviceAccount(phone?:string):LoginAccountIdentity {
const cached=this.read('tsgame_devicePlayer',true);if(cached)return accountFrom(cached);
let unionid:string;
if(phone!==undefined)unionid=`phone_${phone}`;
else {
const info=this.read('tsgame_phoneInfo1',false);
if(info&&typeof info.PhoneIMEI==='string'&&info.PhoneIMEI)unionid=info.PhoneIMEI;
else {
const sets=['0123456789','qwertyuioplkjhgfdsazxcvbnm','QWERTYUIOPLKJHGFDSAZXCVBNM'];
unionid=Array.from({length:25},()=>{const chars=sets[Math.round(this.options.random()*2)];return chars[Math.ceil(this.options.random()*100000000)%chars.length];}).join('');
this.options.storage.setItem('tsgame_phoneInfo1',JSON.stringify({...info,PhoneIMEI:unionid}));
}
}
const {avatarUrl,avatarRange}=this.options.policy;
return {openid:unionid,unionid,nickname:`User_${nicknameHash(unionid).slice(0,6)}`,
avatar:avatarUrl?`${avatarUrl}${avatarRange[0]+Math.round(this.options.random()*(avatarRange[1]-avatarRange[0]))}.jpg`:'',
sex:Math.floor(this.options.random()*2)+1,city:'China',province:phone===undefined?'HongKong':'ShangHai'};
}
device():void{if(!this.requireAgreement())return;this.options.submit(this.deviceAccount(),{enabled:false});}
phone(phone:string,code:string):void {
if(!this.requireAgreement())return;
if(!phone||!code){this.options.tip('手机号与验证码均不能为空!');return;}
this.options.submit(this.deviceAccount(phone),{enabled:true,telphone:phone,smmcode:code});
}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "57d7618f-3e88-4036-83de-96a6e63be657",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "27e9345c-5f75-4829-be9f-174141dec6e6",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "df3fb4b3-bb92-40f7-b661-05a158dec617",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
/** Logic.readPhoneCode: sgame_phoneCode owns the phone number and 30-second expiry. */
export function readPhoneCode(raw:string|null,now:number):{phoneNumber:string;restTime:number}|null {
if(raw===null)return null;
const data=JSON.parse(raw);
if(!data||typeof data!=='object'||typeof data.phoneNumber!=='string')throw Error('Invalid phoneCode.phoneNumber');
if(!Object.prototype.hasOwnProperty.call(data,'codeTime')||!['string','number'].includes(typeof data.codeTime)||!Number.isFinite(Number(data.codeTime)))throw Error('Invalid phoneCode.codeTime');
const elapsed=now-Number(data.codeTime);
return {phoneNumber:data.phoneNumber,restTime:elapsed>30000?0:Math.trunc(30-elapsed/1000)};
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "bb46066c-73af-4603-9f7a-5579a2ad030b",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "588b5341-c0f6-4eef-bf31-b47c815db2b0",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -1,5 +1,4 @@
import type { DebugAccount, DebugProfile } from './profiles.ts'; import type { DebugAccount } from './profiles.ts';
import { PROFILES, resolveActiveProfile } from './profiles.ts';
import { import {
resolveRuntimeConfig, resolveRuntimeConfig,
type HostKind, type HostKind,
@@ -24,7 +23,7 @@ export type BootstrapResult = Omit<RuntimeConfig, 'servers' | 'source' | 'gamese
readonly source?: RuntimeConfig['source']; readonly source?: RuntimeConfig['source'];
readonly gameserver?: RuntimeConfig['gameserver']; readonly gameserver?: RuntimeConfig['gameserver'];
readonly account?: DebugAccount; readonly account?: DebugAccount;
readonly profile: Pick<DebugProfile, 'name'>; readonly profile: Readonly<{ name: 'local' | 'prod' }>;
}; };
function bootstrapHostKind(options: BootstrapOptions): HostKind { function bootstrapHostKind(options: BootstrapOptions): HostKind {
@@ -34,9 +33,8 @@ function bootstrapHostKind(options: BootstrapOptions): HostKind {
/** 兼容启动编排外观;所有运行契约均由唯一的 RuntimeConfig 边界产出。 */ /** 兼容启动编排外观;所有运行契约均由唯一的 RuntimeConfig 边界产出。 */
export async function resolveBootstrap(options: BootstrapOptions): Promise<BootstrapResult> { export async function resolveBootstrap(options: BootstrapOptions): Promise<BootstrapResult> {
const profile = options.mode === 'release' ? PROFILES.prod! : resolveActiveProfile(options.search);
const runtime = await resolveRuntimeConfig({ const runtime = await resolveRuntimeConfig({
mode: options.mode, startupConfig: options.startupConfig,
hostKind: bootstrapHostKind(options), hostKind: bootstrapHostKind(options),
win: options.win, win: options.win,
search: options.search, search: options.search,
@@ -46,7 +44,6 @@ export async function resolveBootstrap(options: BootstrapOptions): Promise<Boots
return Object.freeze({ return Object.freeze({
...runtime, ...runtime,
servers: [...runtime.servers], servers: [...runtime.servers],
account: profile.account, profile: Object.freeze({ name: runtime.startupConfig.useLocalServer ? 'local' as const : 'prod' as const }),
profile,
}); });
} }
@@ -1,5 +1,5 @@
import { resolveIdentity } from './identity.ts'; import { resolveIdentity } from './identity.ts';
import { PROFILES } from './profiles.ts'; import { STARTUP_CONFIG, validateStartupConfig, validateLocalServer } from './profiles.ts';
import { import {
resolveRuntimeConfig, resolveRuntimeConfig,
type ResolveRuntimeConfigOptions, type ResolveRuntimeConfigOptions,
@@ -13,8 +13,6 @@ export interface LocalStartupContext {
} }
const QUERY_CONTROLS = Object.freeze([ const QUERY_CONTROLS = Object.freeze([
'profile',
'mode',
'gameconfig', 'gameconfig',
'agentid', 'agentid',
'channelid', 'channelid',
@@ -27,41 +25,12 @@ function fail(field: string, reason: string): never {
throw new Error(`Invalid local startup ${field}: ${reason}`); throw new Error(`Invalid local startup ${field}: ${reason}`);
} }
function validateLocalUrl(url: string, field: string): void {
let parsed: URL;
try {
parsed = new URL(url);
} catch {
fail(field, 'url must be absolute');
}
if (parsed.protocol !== 'ws:' && parsed.protocol !== 'wss:') {
fail(field, 'url protocol must be ws: or wss:');
}
if (parsed.username !== '' || parsed.password !== '') {
fail(field, 'url credentials are forbidden');
}
const hostname = parsed.hostname.toLowerCase();
if (
hostname !== 'localhost'
&& hostname !== '[::1]'
&& !/^127(?:\.[0-9]{1,3}){3}$/.test(hostname)
) {
fail(field, 'url hostname must be loopback');
}
}
function assertLocalQuery(search: string): void { function assertLocalQuery(search: string): void {
const query = new URLSearchParams(search); const query = new URLSearchParams(search);
for (const field of QUERY_CONTROLS) { for (const field of QUERY_CONTROLS) {
if (query.getAll(field).length > 1) fail(field, 'duplicate query control'); if (query.getAll(field).length > 1) fail(field, 'duplicate query control');
} }
const profiles = query.getAll('profile');
if (profiles.length !== 1 || profiles[0] !== 'local') {
fail('profile', 'must occur exactly once with value local');
}
const modes = query.getAll('mode');
if (modes.length === 1 && modes[0] !== 'debug') fail('mode', 'must be debug');
const gameconfigs = query.getAll('gameconfig'); const gameconfigs = query.getAll('gameconfig');
if (gameconfigs.length === 1 && gameconfigs[0] !== '') { if (gameconfigs.length === 1 && gameconfigs[0] !== '') {
fail('gameconfig', 'must be empty'); fail('gameconfig', 'must be empty');
@@ -72,11 +41,13 @@ function assertLocalQuery(search: string): void {
export async function resolveLocalStartup( export async function resolveLocalStartup(
options: ResolveRuntimeConfigOptions, options: ResolveRuntimeConfigOptions,
): Promise<LocalStartupContext> { ): Promise<LocalStartupContext> {
if (options.mode !== 'debug') fail('mode', 'must be debug'); const startupConfig = validateStartupConfig(options.startupConfig === undefined ? STARTUP_CONFIG : options.startupConfig);
if (startupConfig.mode !== 'debug') fail('mode', 'must be debug');
if (!startupConfig.useLocalServer) fail('useLocalServer', 'must be true');
if (options.hostKind !== 'h5') fail('hostKind', 'must be h5'); if (options.hostKind !== 'h5') fail('hostKind', 'must be h5');
assertLocalQuery(options.search); assertLocalQuery(options.search);
const config = await resolveRuntimeConfig(options); const config = await resolveRuntimeConfig({...options, startupConfig});
const context = Object.freeze({ hostKind: 'h5' as const, profile: 'local' as const, config }); const context = Object.freeze({ hostKind: 'h5' as const, profile: 'local' as const, config });
assertLocalStartupContext(context); assertLocalStartupContext(context);
return context; return context;
@@ -87,11 +58,16 @@ export function assertLocalStartupContext(context: LocalStartupContext): void {
if (context.profile !== 'local') fail('profile', 'must be local'); if (context.profile !== 'local') fail('profile', 'must be local');
const { config } = context; const { config } = context;
const startupConfig = validateStartupConfig(config.startupConfig);
if (startupConfig.mode !== 'debug') fail('mode', 'source must be debug');
if (!startupConfig.useLocalServer) fail('useLocalServer', 'source must be true');
if (config.mode !== 'debug') fail('mode', 'must be debug'); if (config.mode !== 'debug') fail('mode', 'must be debug');
if (config.isDebugger !== true) fail('isDebugger', 'must be true'); if (config.isDebugger !== true) fail('isDebugger', 'must be true');
if (config.source !== 'direct') fail('source', 'must be direct'); if (config.source !== startupConfig.configSource) fail('source', 'must equal startupConfig.configSource');
if (config.gameserver !== null) fail('gameserver', 'must be null'); const configEntry = startupConfig.configSource === 'local' ? startupConfig.localConfigResource : startupConfig.gameserver;
if (config.rawConfig !== null) fail('rawConfig', 'must be null'); if (config.gameserver !== configEntry) fail('gameserver', 'must equal startupConfig selected entry');
if (!config.remoteConfig || typeof config.remoteConfig.getValue !== 'function') fail('remoteConfig', 'must provide memory view');
if (!config.rawConfig || config.rawConfig !== config.remoteConfig.raw) fail('rawConfig', 'must share remoteConfig.raw');
try { try {
resolveIdentity([() => config.identity]); resolveIdentity([() => config.identity]);
@@ -104,26 +80,23 @@ export function assertLocalStartupContext(context: LocalStartupContext): void {
throw wrapped; throw wrapped;
} }
const authoritative = PROFILES.local?.servers; const authoritative = startupConfig.localServers;
if (!authoritative || authoritative.length === 0) {
fail('servers', 'PROFILES.local must define servers');
}
if (config.servers.length !== authoritative.length) { if (config.servers.length !== authoritative.length) {
fail('servers', 'must equal PROFILES.local.servers'); fail('servers', 'must equal startupConfig.localServers');
} }
for (let index = 0; index < authoritative.length; index += 1) { for (let index = 0; index < authoritative.length; index += 1) {
const expected = authoritative[index]; const expected = authoritative[index];
validateLocalUrl(expected, `servers[${index}]`); validateLocalServer(expected, `servers[${index}]`);
if (config.servers[index] !== expected) { if (config.servers[index] !== expected) {
fail('servers', 'must equal PROFILES.local.servers'); fail('servers', 'must equal startupConfig.localServers');
} }
} }
} }
export function assertLocalConnectionTarget(context: LocalStartupContext, url: string): void { export function assertLocalConnectionTarget(context: LocalStartupContext, url: string): void {
assertLocalStartupContext(context); assertLocalStartupContext(context);
validateLocalUrl(url, 'url'); validateLocalServer(url, 'url');
if (!PROFILES.local?.servers?.includes(url)) { if (!context.config.startupConfig.localServers.includes(url)) {
fail('url', 'target must occur in PROFILES.local.servers'); fail('url', 'target must occur in startupConfig.localServers');
} }
} }
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "1d920343-a60b-4b40-8eba-f29b4a7d53fa",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -1,3 +1,5 @@
import { resolveRuntimeMode, type RuntimeMode } from './runtime-mode.ts';
/** 调试用登录玩家档案;值只能由测试或本地启动配置显式注入。 */ /** 调试用登录玩家档案;值只能由测试或本地启动配置显式注入。 */
export interface DebugAccount { export interface DebugAccount {
openid: string; openid: string;
@@ -9,37 +11,61 @@ export interface DebugAccount {
unionid?: string | number; unionid?: string | number;
} }
export type ProfileSource = 'remote' | 'direct'; export interface StartupConfig {
readonly mode: RuntimeMode;
export interface DebugProfile { /** 配置内容来源;local 仅允许 debug,独立于 WebSocket 服务器选择。 */
readonly name: string; readonly configSource: 'remote' | 'local';
readonly source: ProfileSource; /** resources 下的 txt 路径,不含扩展名。 */
readonly gameserver?: string; readonly localConfigResource: string;
readonly servers?: readonly string[]; readonly gameserver: string;
readonly account?: DebugAccount; readonly useLocalServer: boolean;
readonly localServers: readonly string[];
} }
/** 正式 gameserver:原 00_SubGame_Config.js:11。 */ /** 唯一发布配置入口;mode 与服务器选择互相独立。 */
export const DEFAULT_GAMESERVER = 'https://tsgames.daoqi88.cn/config/update_jsonv2.txt'; export const STARTUP_CONFIG: Readonly<StartupConfig> = Object.freeze({
mode: 'debug',
export const PROFILES: Readonly<Record<string, DebugProfile>> = Object.freeze({ // 开发时改为 local,编辑 assets/resources/dev-config/update_jsonv2.txt 后重新预览。
prod: Object.freeze({ name: 'prod', source: 'remote', gameserver: DEFAULT_GAMESERVER }), configSource: 'local',
staging: Object.freeze({ name: 'staging', source: 'remote', gameserver: DEFAULT_GAMESERVER }), localConfigResource: 'dev-config/update_jsonv2',
local: Object.freeze({ gameserver: 'https://tsgames.daoqi88.cn/config_test/update_jsonv2.txt',
name: 'local', useLocalServer: true,
source: 'direct', localServers: Object.freeze(['ws://127.0.0.1:3088']),
servers: Object.freeze(['ws://127.0.0.1:3088']),
}),
}); });
export const ACTIVE_PROFILE = 'prod'; function invalid(field: string, reason: string): never {
throw new Error('Invalid startup config ' + field + ': ' + reason);
}
export function resolveActiveProfile(search: string): DebugProfile { export function validateLocalServer(value: string, field = 'localServers'): void {
const requested = new URLSearchParams(search).get('profile'); if (typeof value !== 'string' || value.trim() !== value) invalid(field, 'must be an absolute URL');
const name = requested || ACTIVE_PROFILE; let url: URL;
const profile = PROFILES[name]; try { url = new URL(value); } catch { invalid(field, 'must be an absolute URL'); }
if (!profile) throw new Error(`未知 profile: ${name}`); if (url.protocol !== 'ws:' && url.protocol !== 'wss:') invalid(field, 'protocol must be ws: or wss:');
return profile; if (url.username || url.password || value.includes('#')) invalid(field, 'credentials and fragments are forbidden');
const host = url.hostname.toLowerCase();
if (host !== 'localhost' && host !== '[::1]' && !/^127(?:\.[0-9]{1,3}){3}$/.test(host)) {
invalid(field, 'hostname must be loopback');
}
}
/** 验证后复制为不可变快照,异步抓取期间调用方不能改变配置。 */
export function validateStartupConfig(source: Readonly<StartupConfig>): Readonly<StartupConfig> {
if (!source || typeof source !== 'object') invalid('source', 'must be an object');
const mode = resolveRuntimeMode(source.mode);
if (source.configSource !== 'remote' && source.configSource !== 'local') invalid('configSource', 'must be remote or local');
if (source.configSource === 'local' && mode !== 'debug') invalid('configSource', 'local is only allowed in debug mode');
if (typeof source.localConfigResource !== 'string' || !/^[a-zA-Z0-9_-]+(?:\/[a-zA-Z0-9_-]+)*$/.test(source.localConfigResource)) {
invalid('localConfigResource', 'must be a resources path without extension or traversal');
}
if (typeof source.useLocalServer !== 'boolean') invalid('useLocalServer', 'must be boolean');
if (typeof source.gameserver !== 'string' || source.gameserver.trim() !== source.gameserver) invalid('gameserver', 'must be http(s) URL');
let url: URL;
try { url = new URL(source.gameserver); } catch { invalid('gameserver', 'must be http(s) URL'); }
if (url.protocol !== 'http:' && url.protocol !== 'https:') invalid('gameserver', 'must be http(s) URL');
if (!Array.isArray(source.localServers) || source.localServers.length === 0) invalid('localServers', 'must be a nonempty array');
for (let index = 0; index < source.localServers.length; index++) validateLocalServer(source.localServers[index], 'localServers[' + index + ']');
return Object.freeze({mode, configSource:source.configSource, localConfigResource:source.localConfigResource, gameserver:source.gameserver, useLocalServer:source.useLocalServer, localServers:Object.freeze([...source.localServers])});
} }
/** 忠实旧 min_replaceAll 链:- → /,# → :,再包成 http://...txt。 */ /** 忠实旧 min_replaceAll 链:- → /,# → :,再包成 http://...txt。 */
@@ -54,11 +80,11 @@ export interface ResolveGameServerOptions {
readonly injectedGameConfig: unknown; readonly injectedGameConfig: unknown;
} }
/** 注入的 gameconfig 非空时是唯一覆盖源;否则只使用 profile 配置源。 */ /** 注入的 gameconfig 非空时是唯一覆盖源;否则只使用 启动配置源。 */
export function resolveGameServer(options: ResolveGameServerOptions): string { export function resolveGameServer(options: ResolveGameServerOptions): string {
const injected = options.injectedGameConfig; const injected = options.injectedGameConfig;
if (injected === '' || injected === undefined || injected === null) { if (injected === '' || injected === undefined || injected === null) {
if (!options.configured) throw new Error('profile 未配置 gameserver'); if (!options.configured) throw new Error('启动配置未配置 gameserver');
return options.configured; return options.configured;
} }
if (typeof injected !== 'string') throw new Error('gameconfig 必须是字符串'); if (typeof injected !== 'string') throw new Error('gameconfig 必须是字符串');
@@ -1,46 +1,127 @@
/** 原配置服务的唯一服务器字段,逐字对齐 ServerUrl_Succ 的 data.urlserver。 */ import type { ChannelIdentity } from './identity.ts';
import { DEFAULT_LAUNCH_WAIT_TIME_MS } from './sources/defaults.ts';
/** One in-memory view over the JSON root received by legacy getConfig_Succ. */
export interface RemoteConfig { export interface RemoteConfig {
readonly data: { readonly raw: Readonly<Record<string, unknown>>;
readonly urlserver: string | readonly string[]; readonly getValue: (name: string) => unknown;
readonly [key: string]: unknown;
};
} }
/** 远程配置抓取抽象;cache bust 在 fetcher 内形成且只形成一次。 */
export interface ConfigFetcher { export interface ConfigFetcher {
fetch(gameserver: string, cacheBust?: () => string): Promise<unknown>; fetch(gameserver: string, cacheBust?: () => string): Promise<unknown>;
} }
/** Legacy initial value -> hall_config merge -> scoped top-level override. */
export function resolveLaunchWaitTime(remote: RemoteConfig): number {
let value: unknown = DEFAULT_LAUNCH_WAIT_TIME_MS;
const hall = remote.getValue('hall_config');
if (typeof hall === 'object' && hall !== null && Object.prototype.hasOwnProperty.call(hall, 'launchWaitTime')) {
value = (hall as Record<string, unknown>).launchWaitTime;
}
const override = remote.getValue('launchWaitTime');
if (override !== null && override !== undefined) value = override;
if (typeof value !== 'number' || !Number.isFinite(value) || value < 0) {
throw new Error('Invalid launchWaitTime: expected finite nonnegative milliseconds');
}
return value;
}
export class ConfigFetchError extends Error {} export class ConfigFetchError extends Error {}
export class ConfigParseError extends Error {} export class ConfigParseError extends Error {}
function normalizeWebSocketUrl(value: string): string { const SCOPES = [
if (value.startsWith('ws://') || value.startsWith('wss://')) return value; ['agentlist', 'agentid'], ['gamelist', 'gameid'],
const scheme = /^([A-Za-z][A-Za-z0-9+.-]*):\/\//.exec(value); ['channellist', 'channelid'], ['marketlist', 'marketid'],
if (scheme) { ] as const;
throw new ConfigParseError(`远程配置 data.urlserver 不支持 scheme: ${scheme[1]}`);
type ConfigObject = Record<string, unknown>;
function requireObject(value: unknown, path: string): ConfigObject {
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
throw new ConfigParseError(`Invalid remote config ${path}: expected object`);
} }
return `ws://${value}`; return value as ConfigObject;
}
function validateHierarchy(scope: ConfigObject, depth: number): void {
if (depth === SCOPES.length) return;
const [listName] = SCOPES[depth];
if (!Object.prototype.hasOwnProperty.call(scope, listName)) return;
const list = scope[listName];
if (!Array.isArray(list)) throw new ConfigParseError(`Invalid remote config ${listName}: expected array`);
for (const entry of list) validateHierarchy(requireObject(entry, listName), depth + 1);
} }
/** /**
* 只接受 data.urlserver;不读取旧的 *_server_tcp,也不去重或改变配置顺序。 * Port of Game_Surface_3/12_Logic.js get_paravalue. Only GameData globals are
* replaced with the resolved identity argument; lookup order and truthiness stay exact.
* createRemoteConfig validates the downloaded JSON before exposing this reader.
*/ */
export function parseUrlServers(input: unknown): readonly string[] { export function get_paravalue(
if (typeof input !== 'object' || input === null || !('data' in input)) { o_config: { readonly data?: Readonly<ConfigObject> | null },
throw new ConfigParseError('远程配置缺少 data.urlserver'); paraname: string,
} identity: Readonly<ChannelIdentity>,
const data = (input as { data?: unknown }).data; ): unknown {
if (typeof data !== 'object' || data === null || !('urlserver' in data)) { const {agentid, gameid, channelid, marketid} = identity;
throw new ConfigParseError('远程配置缺少 data.urlserver'); let paravalue: unknown = null;
} const do_get_para = (arylist: unknown, keyname: string, keyvalue: string | number): ConfigObject | null => {
if (arylist && keyname && keyvalue) {
const list = arylist as ConfigObject[];
for (let i = 0; i < list.length; i++) {
if (list[i][keyname] == keyvalue) {
if (list[i][paraname]) paravalue = list[i][paraname];
return list[i];
}
}
}
return null;
};
if (!o_config.data) return paravalue;
if (o_config.data[paraname]) paravalue = o_config.data[paraname];
const _o_agent = do_get_para(o_config.data.agentlist, 'agentid', agentid);
if (!_o_agent) return paravalue;
const _o_game = do_get_para(_o_agent.gamelist, 'gameid', gameid);
if (!_o_game) return paravalue;
const _o_channel = do_get_para(_o_game.channellist, 'channelid', channelid);
if (!_o_channel) return paravalue;
const _o_market = do_get_para(_o_channel.marketlist, 'marketid', marketid);
if (!_o_market) return paravalue;
return paravalue;
}
const raw = (data as { urlserver?: unknown }).urlserver; /** All consumers share get_paravalue; no separate hierarchy or override rules. */
export function createRemoteConfig(input: unknown, identity: Readonly<ChannelIdentity>): RemoteConfig {
const raw = requireObject(input, 'root');
validateHierarchy(raw, 0);
const wrapper = {data: raw};
return Object.freeze({
raw,
getValue(name: string): unknown {
return get_paravalue(wrapper, name, identity);
},
});
}
function normalizeWebSocketUrl(value: string): string {
const url = value.startsWith('ws://') || value.startsWith('wss://') ? value : `ws://${value}`;
if (/^[A-Za-z][A-Za-z0-9+.-]*:\/\//.test(value) && !/^wss?:\/\//.test(value)) {
throw new ConfigParseError('Invalid remote server: unsupported scheme');
}
try {
const parsed = new URL(url);
if (!value || /\s/.test(value) || url.includes('#') || !parsed.hostname || parsed.username || parsed.password
|| (parsed.protocol !== 'ws:' && parsed.protocol !== 'wss:')) throw new Error('invalid');
} catch {
throw new ConfigParseError('Invalid remote server: malformed WebSocket URL');
}
return url;
}
/** Legacy getConfig_Succ selects game_server_tcp when truthy, otherwise player_server_tcp. */
export function parseUrlServers(config: RemoteConfig): readonly string[] {
const raw = config.getValue('game_server_tcp') || config.getValue('player_server_tcp');
const values = typeof raw === 'string' ? [raw] : raw; const values = typeof raw === 'string' ? [raw] : raw;
if (!Array.isArray(values) || values.length === 0 if (!Array.isArray(values) || values.length === 0 || values.some(value => typeof value !== 'string' || !value)) {
|| values.some((value) => typeof value !== 'string' || value.length === 0)) { throw new ConfigParseError('Remote game_server_tcp/player_server_tcp must be a nonempty string or string array');
throw new ConfigParseError('远程配置 data.urlserver 必须是非空字符串或非空字符串数组');
} }
return Object.freeze(values.map(normalizeWebSocketUrl)); return Object.freeze(values.map(normalizeWebSocketUrl));
} }
@@ -1,13 +1,15 @@
import type { ChannelIdentity, IdentitySource } from './identity.ts'; import type { ChannelIdentity, IdentitySource } from './identity.ts';
import { resolveIdentity } from './identity.ts'; import { resolveIdentity } from './identity.ts';
import { import {
PROFILES, STARTUP_CONFIG,
resolveActiveProfile, validateStartupConfig,
resolveGameServer, resolveGameServer,
type DebugProfile, type StartupConfig,
} from './profiles.ts'; } from './profiles.ts';
import { import {
ConfigFetchError, ConfigFetchError,
ConfigParseError,
createRemoteConfig,
parseUrlServers, parseUrlServers,
type ConfigFetcher, type ConfigFetcher,
type RemoteConfig, type RemoteConfig,
@@ -25,21 +27,26 @@ import { queryStringSource } from './sources/query-string.ts';
export type HostKind = 'h5' | NativeHostKind; export type HostKind = 'h5' | NativeHostKind;
export interface RuntimeConfig { export interface RuntimeConfig {
readonly startupConfig: Readonly<StartupConfig>;
readonly mode: RuntimeMode; readonly mode: RuntimeMode;
readonly isDebugger: boolean; readonly isDebugger: boolean;
readonly identity: Readonly<ChannelIdentity>; readonly identity: Readonly<ChannelIdentity>;
readonly servers: readonly string[]; readonly servers: readonly string[];
readonly source: 'remote' | 'direct'; readonly source: 'remote' | 'local';
readonly gameserver: string | null; /** 实际读取入口:remote 为最终 URL,local 为 resources 资源路径。 */
readonly rawConfig: RemoteConfig | null; readonly gameserver: string;
readonly rawConfig: RemoteConfig['raw'];
readonly remoteConfig: RemoteConfig;
} }
export interface ResolveRuntimeConfigOptions { export interface ResolveRuntimeConfigOptions {
readonly mode: RuntimeMode; readonly startupConfig?: Readonly<StartupConfig>;
readonly hostKind: HostKind; readonly hostKind: HostKind;
readonly win: NativeHost; readonly win: NativeHost;
readonly search: string; readonly search: string;
readonly fetcher: ConfigFetcher; readonly fetcher: ConfigFetcher;
/** 由引擎层注入项目 txt 读取器;仅 local 模式需要,缺失直接报错。 */
readonly localFetcher?: ConfigFetcher;
readonly cacheBust?: () => string; readonly cacheBust?: () => string;
} }
@@ -64,10 +71,6 @@ function resolveInjectedGameConfig(options: ResolveRuntimeConfigOptions): unknow
return getothername(options.win, options.hostKind, 'gameconfig'); return getothername(options.win, options.hostKind, 'gameconfig');
} }
function selectedProfile(mode: RuntimeMode, search: string): DebugProfile {
return mode === 'release' ? PROFILES.prod! : resolveActiveProfile(search);
}
function freezeResult(result: RuntimeConfig): RuntimeConfig { function freezeResult(result: RuntimeConfig): RuntimeConfig {
return Object.freeze(result); return Object.freeze(result);
} }
@@ -75,51 +78,37 @@ function freezeResult(result: RuntimeConfig): RuntimeConfig {
export async function resolveRuntimeConfig( export async function resolveRuntimeConfig(
options: ResolveRuntimeConfigOptions, options: ResolveRuntimeConfigOptions,
): Promise<RuntimeConfig> { ): Promise<RuntimeConfig> {
const profile = selectedProfile(options.mode, options.search); const startupConfig = validateStartupConfig(options.startupConfig === undefined ? STARTUP_CONFIG : options.startupConfig);
const identity = resolveHostIdentity(options); const identity = resolveHostIdentity(options);
if (profile.source === 'direct') { // 先选择唯一来源;本地模式不读取或应用宿主的远程 gameconfig 覆盖。
if (options.mode !== 'debug' || profile.name !== 'local') { const local = startupConfig.configSource === 'local';
throw new ConfigFetchError(`profile '${profile.name}' 不是允许的 local debug direct 模式`); const gameserver = local ? startupConfig.localConfigResource : resolveGameServer({
} configured: startupConfig.gameserver,
if (!profile.servers || profile.servers.length === 0) {
throw new ConfigFetchError(`profile '${profile.name}' 未配置完整 servers`);
}
return freezeResult({
mode: options.mode,
isDebugger: true,
identity,
servers: Object.freeze([...profile.servers]),
source: 'direct',
gameserver: null,
rawConfig: null,
});
}
if (!profile.gameserver) {
throw new ConfigFetchError(`profile '${profile.name}' 未配置 gameserver`);
}
const gameserver = resolveGameServer({
configured: profile.gameserver,
injectedGameConfig: resolveInjectedGameConfig(options), injectedGameConfig: resolveInjectedGameConfig(options),
}); });
const fetcher = local ? options.localFetcher : options.fetcher;
if (!fetcher) throw new ConfigFetchError('本地配置缺少 localFetcher');
let raw: unknown; let raw: unknown;
try { try {
raw = await options.fetcher.fetch(gameserver, options.cacheBust); raw = await fetcher.fetch(gameserver, options.cacheBust);
} catch (error) { } catch (error) {
if (error instanceof ConfigFetchError) throw error; if (error instanceof ConfigFetchError || error instanceof ConfigParseError) throw error;
throw new ConfigFetchError(`远程配置抓取失败: ${gameserver}`); throw new ConfigFetchError(`${local ? '本地配置读取失败' : '远程配置抓取失败'}: ${gameserver}`);
} }
const servers = parseUrlServers(raw); const remoteConfig = createRemoteConfig(raw, identity);
const servers = startupConfig.useLocalServer ? startupConfig.localServers : parseUrlServers(remoteConfig);
return freezeResult({ return freezeResult({
mode: options.mode, startupConfig,
isDebugger: options.mode === 'debug', mode: startupConfig.mode,
isDebugger: startupConfig.mode === 'debug',
identity, identity,
servers, servers,
source: 'remote', source: startupConfig.configSource,
gameserver, gameserver,
rawConfig: raw as RemoteConfig, rawConfig: remoteConfig.raw,
remoteConfig,
}); });
} }
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "4e90f0c8-b271-40a4-9909-68aa8f7d5974",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -1,32 +1,7 @@
// 1. 先 export type
export type RuntimeMode = 'debug' | 'release'; export type RuntimeMode = 'debug' | 'release';
declare const DEBUG: boolean | undefined; /** 应用模式仅来自显式配置,不读取 URL 或 Creator 编译标志。 */
export function resolveRuntimeMode(mode: RuntimeMode): RuntimeMode {
// 2. 函数引用 RuntimeMode(此时 type 已 export) if (mode !== 'debug' && mode !== 'release') throw new Error('Invalid startup config mode: must be debug or release');
function readModeFromUrl(): RuntimeMode | null { return mode;
if (typeof window === 'undefined' || !window.location) return null;
const m = new URLSearchParams(window.location.search).get('mode');
if (m === 'debug' || m === 'release') return m;
return null;
}
function detectDebugBuild(): boolean {
if (typeof DEBUG !== 'undefined') return DEBUG;
return true; // Cocos 编辑器内 dev workflow 默认;生产 build 改 false
}
// 3. 导出常量
export const MODE_OVERRIDE: RuntimeMode | null =
readModeFromUrl() ?? (detectDebugBuild() ? 'debug' : 'release');
/**
* 解析运行模式:override 优先,否则由是否 debug 构建决定。
*/
export function resolveRuntimeMode(
isDebugBuild: boolean,
override: RuntimeMode | null = MODE_OVERRIDE,
): RuntimeMode {
if (override) return override;
return isDebugBuild ? 'debug' : 'release';
} }
@@ -1,12 +1,16 @@
import type { ChannelIdentity } from '../identity.ts'; import type { ChannelIdentity } from '../identity.ts';
/** Legacy GameData launchWaitTime (04_Data.js): timer units are milliseconds. */
export const DEFAULT_LAUNCH_WAIT_TIME_MS = 10;
/** /**
* 构建期默认渠道身份(旧 version.js 等价物)。 * 构建期默认渠道身份(旧 version.js 等价物)。
* gameid 每子游戏固定写死;agentid/channelid/marketid/version 为默认,运行期由 query/native/profile 覆盖。 * gameid 每子游戏固定写死;agentid/channelid/marketid/version 为默认,运行期由 query/native/profile 覆盖。
*/ */
export const BUILD_IDENTITY: ChannelIdentity = { export const BUILD_IDENTITY: ChannelIdentity = {
agentid: 'veRa0qrBf0df2K1G4de2tgfmVxB2jxpv', // This game's entry in config_test/update_jsonv2.txt belongs to this agent/channel.
channelid: 'FtJf073aa0d6rI1xD8J1Y42fINTm0ziK', agentid: '1B2h0ccl205c390Y28m1Ajdplkuu4wgy',
channelid: 'aouv0LotK0pYyQ0Pdrx0CsdcaezfzrcG',
gameid: 'J9r4022t80pxlb01zOK76DN1WD4QewFl', gameid: 'J9r4022t80pxlb01zOK76DN1WD4QewFl',
marketid: 4, marketid: 4,
version: 1, // 数字 versionCode(联调时改成本地服要求的版本号) version: 1, // 数字 versionCode(联调时改成本地服要求的版本号)
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "613b0457-be57-44e3-a1fb-e5d086b69468",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "4098ba4c-c444-459f-9427-0412f1a15bb6",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "1a6fd8e5-5d0c-4fbb-a035-ef3a4f90badd",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "92bf4247-2b4b-460d-8992-8922baf78df2",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "ac23132b-03ac-47c4-b6f8-93602c94f080",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "3e0b81db-7986-47f4-9e23-fbc9b47d8a36",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "9f495e9b-65ae-4b3e-b44c-9c9a91f6679f",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "4f5169b6-e140-4a3a-9eed-e155fecf24df",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "3b11f970-2e0d-4784-8d65-c0fcc5e4ac6a",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "68da9cca-3c8e-400b-ba7e-539b49994ed4",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "8eb5d9a1-cfd3-4df4-b311-c67cb7db4423",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "717f5c0e-b085-47f8-879c-1b605e4fc773",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "8650f2a7-9471-4a3e-bec9-0aecf6405cdb",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,42 @@
import type { RemoteConfig } from '../config/remote-config.ts';
/** Defaults owned here reproduce 04_Data.js and Game_Surface_3 Debugger. */
const LOGIN_DEFAULTS = Object.freeze({ deviceLogin:0, showVisitor:0, qqLogin:0,
avatarUrl:'https://projectimage.tscce.cn/image_132/', avatarRange:[100,10000] as readonly number[],
hiddenVisitor:true });
export interface LoginPolicy {
deviceLogin:boolean; showVisitor:boolean; qqLogin:boolean; hiddenVisitor:boolean;
avatarUrl:string; avatarRange:readonly number[];
}
function flag(value:unknown, name:string):boolean {
if (![0,1,false,true].includes(value as number)) throw Error(`Invalid login config ${name}`);
return Boolean(value);
}
export function resolveLoginPolicy(remote:RemoteConfig):LoginPolicy {
const hallValue=remote.getValue('hall_config');
if (hallValue != null && (typeof hallValue!=='object' || Array.isArray(hallValue))) throw Error('Invalid hall_config');
const hall=hallValue as Record<string,unknown> | null;
// Legacy hall_config merge precedes hallConfigName top-level overrides.
const hallField=(name:'showVisitor'|'qqLogin')=> {
const override=remote.getValue(name);
if(override!=null) return override;
return hall && Object.prototype.hasOwnProperty.call(hall,name)?hall[name]:LOGIN_DEFAULTS[name];
};
const sourceField=(name:'deviceLogin'|'avatarUrl'|'avatarRange')=> {
const value=remote.getValue(name);return value==null?LOGIN_DEFAULTS[name]:value;
};
const avatarUrl=sourceField('avatarUrl'),range=sourceField('avatarRange');
if(typeof avatarUrl!=='string')throw Error('Invalid login config avatarUrl');
if(!Array.isArray(range)||range.length!==2||range.some(v=>!Number.isInteger(v))||range[1]<=range[0])throw Error('Invalid login config avatarRange');
return Object.freeze({deviceLogin:flag(sourceField('deviceLogin'),'deviceLogin'),
showVisitor:flag(hallField('showVisitor'),'showVisitor'),qqLogin:flag(hallField('qqLogin'),'qqLogin'),
hiddenVisitor:LOGIN_DEFAULTS.hiddenVisitor,avatarUrl,avatarRange:Object.freeze([...range])});
}
/** Assignment order is significant: JumpWxAuth applies showVisitor/QQ after cache hiding. */
export function loginButtons(policy:LoginPolicy, versionState:0|1, cached:boolean) {
const account=versionState===0&&cached;
let wechat=!policy.deviceLogin&&!account;
let visitor=!account;
if(versionState===0){visitor=false;if(policy.showVisitor){wechat=false;visitor=true;}}
return {wechat,visitor,phone:policy.deviceLogin&&!account,quick:false,qq:policy.qqLogin,account};
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "fe78702a-5e02-4006-844c-15123d950d80",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "093506bf-570f-47f8-9f4d-0a87d78cba2e",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "024324ab-1239-4568-9b72-5f957e32ba15",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "e6f7adfb-42be-43ed-a658-73aac741e2f2",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "65fb20da-5c43-4171-a53a-66ae24890751",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "0b2dae51-cba0-4d30-95f6-a6ca50bc2f83",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -42,7 +42,7 @@ export interface LoginAccountIdentity {
export type DeviceLoginMode = export type DeviceLoginMode =
| { readonly enabled: false } | { readonly enabled: false }
| { readonly enabled: true; readonly telphone: string }; | { readonly enabled: true; readonly telphone: string; readonly smmcode?: string };
export type LoginPlayerIdMode = export type LoginPlayerIdMode =
| { readonly enabled: false } | { readonly enabled: false }
@@ -112,7 +112,11 @@ export function buildLoginRequest(
const deviceLogin = requireRecord(deviceRecord.deviceLogin, '$.device.deviceLogin'); const deviceLogin = requireRecord(deviceRecord.deviceLogin, '$.device.deviceLogin');
if (requireBoolean(deviceLogin.enabled, '$.device.deviceLogin.enabled')) { if (requireBoolean(deviceLogin.enabled, '$.device.deviceLogin.enabled')) {
data.telphone = requireString(deviceLogin.telphone, '$.device.deviceLogin.telphone'); data.telphone = requireString(deviceLogin.telphone, '$.device.deviceLogin.telphone');
data.telphoneAuto = true; // Explicit phone verification (sharelogin) differs from cached device login.
if (hasOwn(deviceLogin, 'smmcode')) {
data.smmcode = requireString(deviceLogin.smmcode, '$.device.deviceLogin.smmcode');
data.telphoneAuto = false;
} else data.telphoneAuto = true;
} }
const loginPlayerId = requireRecord(deviceRecord.loginPlayerId, '$.device.loginPlayerId'); const loginPlayerId = requireRecord(deviceRecord.loginPlayerId, '$.device.loginPlayerId');
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "e473d40d-15cb-4ba0-a9dd-2aee7db34288",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "c39d248f-79e2-4e7e-935c-8640d7ba2c1d",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "464618de-1031-4d9d-b47a-5abfc3884b2a",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "396594e0-d025-4f59-8f09-55f5563149fc",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "bc28a4de-e56a-4ff3-9793-4a358b7f40e1",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "d8033485-9f99-48f1-8c69-80173036f33c",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "7e0c41b9-1036-46cd-9401-98c4ae86794e",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "f657f863-7e72-4697-827c-11240096d8be",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "3ad6eade-cc0c-4971-bdfb-453f0016df2c",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "bd3872ba-100e-4b2a-838f-2098366df9fb",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "03a2c16b-b059-4ef9-8c26-3fe3a9761720",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "a61c62b7-e973-4fb6-97be-69db3ed6fd90",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "5e7d1166-152b-4697-a882-032da5c60f10",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "f6eae679-99d7-45f3-b301-319b961625f1",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "650981bd-d942-4bb9-8e68-3efb07dda4dd",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "f1d3ef88-5577-4be2-853b-27900231ff29",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -1,4 +1,4 @@
import { strict as assert } from 'node:assert'; import type { strict } from 'node:assert';
import type { import type {
GameEntry, GameEntry,
GameHost, GameHost,
@@ -21,8 +21,12 @@ export interface GameContractSample {
readonly makeHost: GameContractHostFactory; readonly makeHost: GameContractHostFactory;
} }
/** Runs the shared lifecycle checks required of the app's sole GameEntry. */ /** Runs lifecycle checks with assertions explicitly supplied by the test caller. */
export function assertGameContract(entry: GameEntry, samples: readonly GameContractSample[]): void { export function assertGameContract(
entry: GameEntry,
samples: readonly GameContractSample[],
assert: typeof strict,
): void {
assert.ok(samples.length > 0, 'conformance requires game-owned roomtype samples'); assert.ok(samples.length > 0, 'conformance requires game-owned roomtype samples');
assertGameEntry(entry); assertGameEntry(entry);
for (const route of ['platform', 'agent', 'room']) { for (const route of ['platform', 'agent', 'room']) {
@@ -48,8 +52,8 @@ export function assertGameContract(entry: GameEntry, samples: readonly GameContr
const sessions = new GameSessionHost(entry); const sessions = new GameSessionHost(entry);
for (const sample of samples) { for (const sample of samples) {
runCycle(sessions, sample, entry, 1); runCycle(sessions, sample, entry, 1, assert);
runCycle(sessions, sample, entry, 2); runCycle(sessions, sample, entry, 2, assert);
} }
assert.equal(sessions.state, 'idle'); assert.equal(sessions.state, 'idle');
} }
@@ -59,6 +63,7 @@ function runCycle(
sample: GameContractSample, sample: GameContractSample,
entry: GameEntry, entry: GameEntry,
cycle: number, cycle: number,
assert: typeof strict,
): void { ): void {
const contractHost = sample.makeHost(); const contractHost = sample.makeHost();
const snapshot = contractHost.host.getSnapshot(); const snapshot = contractHost.host.getSnapshot();
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "754c5d58-de20-4a2d-9a62-406126c1cf93",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "2ade8276-e1d3-46ca-9c77-46b3c5f71413",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,86 @@
[
{
"__type__": "cc.AnimationClip",
"_name": "LoginLoading",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"sample": 3,
"speed": 1,
"wrapMode": 2,
"enableTrsBlending": false,
"_duration": 1,
"_hash": 0,
"_tracks": [
{
"__id__": 1
}
],
"_exoticAnimation": null,
"_events": [],
"_embeddedPlayers": [],
"_additiveSettings": {
"__id__": 6
},
"_auxiliaryCurveEntries": []
},
{
"__type__": "cc.animation.ObjectTrack",
"_binding": {
"__type__": "cc.animation.TrackBinding",
"path": {
"__id__": 2
},
"proxy": null
},
"_channel": {
"__id__": 4
}
},
{
"__type__": "cc.animation.TrackPath",
"_paths": [
{
"__id__": 3
},
"spriteFrame"
]
},
{
"__type__": "cc.animation.ComponentPath",
"component": "cc.Sprite"
},
{
"__type__": "cc.animation.Channel",
"_curve": {
"__id__": 5
}
},
{
"__type__": "cc.ObjectCurve",
"_times": [
0,
0.3333333333333333,
0.6666666666666666
],
"_values": [
{
"__uuid__": "41c0f42d-631a-4a3f-abf1-a36ed787e563@f9941",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "bb80821b-0b3f-460e-a74a-1b1a7eaad560@f9941",
"__expectedType__": "cc.SpriteFrame"
},
{
"__uuid__": "b39af9d6-4d70-43ca-a312-f993de9f961c@f9941",
"__expectedType__": "cc.SpriteFrame"
}
]
},
{
"__type__": "cc.AnimationClipAdditiveSettings",
"enabled": false,
"refClip": null
}
]
@@ -0,0 +1,13 @@
{
"ver": "2.0.4",
"importer": "animation-clip",
"imported": true,
"uuid": "d7f4b280-dc40-47c7-bfe5-9421350459fe",
"files": [
".bin"
],
"subMetas": {},
"userData": {
"name": "LoginLoading"
}
}
File diff suppressed because it is too large Load Diff
@@ -25,14 +25,14 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 40 "__id__": 50
}, },
{ {
"__id__": 42 "__id__": 52
} }
], ],
"_prefab": { "_prefab": {
"__id__": 44 "__id__": 54
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -61,7 +61,7 @@
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
"_id": "acrZGZbf1NerIwhXMce5C9" "_id": ""
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
@@ -79,23 +79,23 @@
"__id__": 11 "__id__": 11
}, },
{ {
"__id__": 19 "__id__": 21
},
{
"__id__": 27
}
],
"_active": true,
"_components": [
{
"__id__": 35
}, },
{ {
"__id__": 37 "__id__": 37
} }
], ],
"_active": true,
"_components": [
{
"__id__": 45
},
{
"__id__": 47
}
],
"_prefab": { "_prefab": {
"__id__": 39 "__id__": 49
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -124,7 +124,7 @@
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
"_id": "e6VeYSc7NPirZdAaN4p44e" "_id": ""
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
@@ -177,7 +177,7 @@
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
"_id": "f1pHSoD4dILLRVFTIObRtT" "_id": ""
}, },
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
@@ -201,7 +201,7 @@
"x": 0.5, "x": 0.5,
"y": 0.5 "y": 0.5
}, },
"_id": "a9XLkwiTVFH68tpCqSosju" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
@@ -246,7 +246,7 @@
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_useGrayscale": false, "_useGrayscale": false,
"_atlas": null, "_atlas": null,
"_id": "15y0dNzphPKaTgoMZ3YkkU" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
@@ -282,7 +282,7 @@
"_originalHeight": 0, "_originalHeight": 0,
"_alignMode": 2, "_alignMode": 2,
"_lockFlags": 0, "_lockFlags": 0,
"_id": "8b8p/boZJEqocxUC1G22sv" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
@@ -320,10 +320,13 @@
}, },
{ {
"__id__": 16 "__id__": 16
},
{
"__id__": 18
} }
], ],
"_prefab": { "_prefab": {
"__id__": 18 "__id__": 20
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -352,7 +355,7 @@
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
"_id": "03KAkUqStGDaHp3GFOQbYR" "_id": ""
}, },
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
@@ -376,7 +379,7 @@
"x": 0.5, "x": 0.5,
"y": 0.5 "y": 0.5
}, },
"_id": "feVdaeICBA07uZAmLtAU07" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
@@ -421,7 +424,7 @@
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_useGrayscale": false, "_useGrayscale": false,
"_atlas": null, "_atlas": null,
"_id": "b6GW+6L8VHILl5D4tnXajn" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
@@ -457,12 +460,30 @@
"_originalHeight": 0, "_originalHeight": 0,
"_alignMode": 2, "_alignMode": 2,
"_lockFlags": 0, "_lockFlags": 0,
"_id": "5dO4+lWM1I74eFWhnD+bgo" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "MW2xRLaeE9itOcgHj0p+dQ" "fileId": "MW2xRLaeE9itOcgHj0p+dQ"
}, },
{
"__type__": "cc.BlockInputEvents",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 11
},
"_enabled": true,
"__prefab": {
"__id__": 19
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "4fv3LfgR5DPIoVUfROUOzr"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
@@ -478,32 +499,39 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "协议内容", "_name": "协议滚动",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 2 "__id__": 2
}, },
"_children": [], "_children": [
{
"__id__": 22
}
],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 20 "__id__": 28
}, },
{ {
"__id__": 22 "__id__": 30
}, },
{ {
"__id__": 24 "__id__": 32
},
{
"__id__": 34
} }
], ],
"_prefab": { "_prefab": {
"__id__": 26 "__id__": 36
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -5.5, "x": -5.5,
"y": -208.5, "y": -5,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -527,7 +555,57 @@
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
"_id": "fcOwSwvSpMlaZQPDjbA1f7" "_id": ""
},
{
"__type__": "cc.Node",
"_name": "协议内容",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 21
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 23
},
{
"__id__": 25
}
],
"_prefab": {
"__id__": 27
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -203.5,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
}, },
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
@@ -535,11 +613,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 19 "__id__": 22
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 21 "__id__": 24
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -551,7 +629,7 @@
"x": 0.5, "x": 0.5,
"y": 0.5 "y": 0.5
}, },
"_id": "e4LJQjJ6FE6LjQy5yIP382" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
@@ -563,11 +641,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 19 "__id__": 22
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 23 "__id__": 26
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -596,48 +674,12 @@
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_useGrayscale": false, "_useGrayscale": false,
"_atlas": null, "_atlas": null,
"_id": "bfkfehGNlIxp/fTJn+oOTB" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "1jOdeOrfg2vu2QJl+s+VeA" "fileId": "1jOdeOrfg2vu2QJl+s+VeA"
}, },
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 19
},
"_enabled": true,
"__prefab": {
"__id__": 25
},
"_alignFlags": 16,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": -5.5,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": "32AaRKNa5IUaPeF5jIfKTl"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "D1Qfc6QTWy0vKDGsx+qLQg"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
@@ -651,6 +693,146 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 21
},
"_enabled": true,
"__prefab": {
"__id__": 29
},
"_contentSize": {
"__type__": "cc.Size",
"width": 729,
"height": 590
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "0bFbdo0btAnLpeg5XLVeih"
},
{
"__type__": "cc.Mask",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 21
},
"_enabled": true,
"__prefab": {
"__id__": 31
},
"_type": 0,
"_inverted": false,
"_segments": 64,
"_alphaThreshold": 0.1,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8bWDB4GxZEjZGyBHlWT8Ry"
},
{
"__type__": "cc.Graphics",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 21
},
"_enabled": true,
"__prefab": {
"__id__": 33
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_lineWidth": 1,
"_strokeColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_lineJoin": 2,
"_lineCap": 0,
"_fillColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 0
},
"_miterLimit": 10,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "d5mkJTZEZFOru7Ifoe3YX/"
},
{
"__type__": "cc.ScrollView",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 21
},
"_enabled": true,
"__prefab": {
"__id__": 35
},
"bounceDuration": 1,
"brake": 0.5,
"elastic": true,
"inertia": true,
"horizontal": false,
"vertical": true,
"cancelInnerEvents": true,
"scrollEvents": [],
"_content": {
"__id__": 22
},
"_horizontalScrollBar": null,
"_verticalScrollBar": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "cfxheTMxVE45LJ6nYtvr4t"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "edhlQTi55MNo1ZWcRw9+qA",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "Spirit253", "_name": "Spirit253",
@@ -663,17 +845,17 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 28 "__id__": 38
}, },
{ {
"__id__": 30 "__id__": 40
}, },
{ {
"__id__": 32 "__id__": 42
} }
], ],
"_prefab": { "_prefab": {
"__id__": 34 "__id__": 44
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -702,7 +884,7 @@
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
"_id": "770rm+dOJPVJdLQnhaoDaZ" "_id": ""
}, },
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
@@ -710,11 +892,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 27 "__id__": 37
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 29 "__id__": 39
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -726,7 +908,7 @@
"x": 0.5, "x": 0.5,
"y": 0.5 "y": 0.5
}, },
"_id": "02BeJasixOrpU3LpuhrkT+" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
@@ -738,11 +920,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 27 "__id__": 37
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 31 "__id__": 41
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -771,7 +953,7 @@
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_useGrayscale": false, "_useGrayscale": false,
"_atlas": null, "_atlas": null,
"_id": "f372YRc0pCR5LhJkRDp5mj" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
@@ -783,11 +965,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 27 "__id__": 37
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 33 "__id__": 43
}, },
"_alignFlags": 16, "_alignFlags": 16,
"_target": null, "_target": null,
@@ -807,7 +989,7 @@
"_originalHeight": 0, "_originalHeight": 0,
"_alignMode": 2, "_alignMode": 2,
"_lockFlags": 0, "_lockFlags": 0,
"_id": "46JhwhkSdK0KV8Lt3p+HOy" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
@@ -836,7 +1018,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 36 "__id__": 46
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -848,7 +1030,7 @@
"x": 0.5, "x": 0.5,
"y": 0.5 "y": 0.5
}, },
"_id": "07nq/yMyxNHq4xU2y77PJH" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
@@ -864,7 +1046,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 38 "__id__": 48
}, },
"_alignFlags": 45, "_alignFlags": 45,
"_target": null, "_target": null,
@@ -884,7 +1066,7 @@
"_originalHeight": 0, "_originalHeight": 0,
"_alignMode": 2, "_alignMode": 2,
"_lockFlags": 0, "_lockFlags": 0,
"_id": "fdaBoOjw5KN4+Xi8tr/T8R" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
@@ -913,7 +1095,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 41 "__id__": 51
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -925,7 +1107,7 @@
"x": 0.5, "x": 0.5,
"y": 0.5 "y": 0.5
}, },
"_id": "52OXNuOopHTL574Hc5gszK" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
@@ -941,7 +1123,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 43 "__id__": 53
}, },
"_alignFlags": 45, "_alignFlags": 45,
"_target": null, "_target": null,
@@ -961,7 +1143,7 @@
"_originalHeight": 0, "_originalHeight": 0,
"_alignMode": 2, "_alignMode": 2,
"_lockFlags": 0, "_lockFlags": 0,
"_id": "73lGoAY61JlYZxdhx3MnbQ" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
@@ -977,7 +1159,6 @@
}, },
"fileId": "xSY2ymJa1y54ctanvQH+WQ", "fileId": "xSY2ymJa1y54ctanvQH+WQ",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null
"nestedPrefabInstanceRoots": null
} }
] ]
@@ -22,13 +22,13 @@
"__id__": 2 "__id__": 2
}, },
{ {
"__id__": 40 "__id__": 50
} }
], ],
"_active": true, "_active": true,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 50 "__id__": 60
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -75,23 +75,20 @@
"__id__": 11 "__id__": 11
}, },
{ {
"__id__": 19 "__id__": 29
},
{
"__id__": 27
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 35 "__id__": 45
}, },
{ {
"__id__": 37 "__id__": 47
} }
], ],
"_prefab": { "_prefab": {
"__id__": 39 "__id__": 49
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -305,21 +302,28 @@
"_parent": { "_parent": {
"__id__": 2 "__id__": 2
}, },
"_children": [], "_children": [
{
"__id__": 12
}
],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 12 "__id__": 20
}, },
{ {
"__id__": 14 "__id__": 22
}, },
{ {
"__id__": 16 "__id__": 24
},
{
"__id__": 26
} }
], ],
"_prefab": { "_prefab": {
"__id__": 18 "__id__": 28
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -350,6 +354,181 @@
}, },
"_id": "" "_id": ""
}, },
{
"__type__": "cc.Node",
"_name": "Fill",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 11
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 13
},
{
"__id__": 15
},
{
"__id__": 17
}
],
"_prefab": {
"__id__": 19
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 12
},
"_enabled": true,
"__prefab": {
"__id__": 14
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1600,
"height": 7
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "11wryNsjhNPqbXqeNtm4GL"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 12
},
"_enabled": true,
"__prefab": {
"__id__": 16
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "04b97952-ff19-40c5-b2f0-d5a84ff93bb5@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 3,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "93ObiVr8BLmL02Gr+0Ygcn"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 12
},
"_enabled": true,
"__prefab": {
"__id__": 18
},
"_alignFlags": 45,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 416,
"_originalHeight": 7,
"_alignMode": 1,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "64uW+20zNAZ7vzhVMp3KqI"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "09/GP9iWJEppj1bGMyhJQK",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -360,7 +539,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 13 "__id__": 21
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -388,7 +567,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 15 "__id__": 23
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -433,7 +612,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 17 "__id__": 25
}, },
"_alignFlags": 21, "_alignFlags": 21,
"_target": null, "_target": null,
@@ -459,6 +638,31 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "w8o18qHP5Wem3Gb4ztYDwQ" "fileId": "w8o18qHP5Wem3Gb4ztYDwQ"
}, },
{
"__type__": "cc.ProgressBar",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 11
},
"_enabled": true,
"__prefab": {
"__id__": 27
},
"_barSprite": {
"__id__": 15
},
"_mode": 2,
"_totalLength": 1,
"_progress": 0,
"_reverse": false,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a0JQfp8UpBJbgzk6ZEyuhB"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
@@ -480,21 +684,25 @@
"_parent": { "_parent": {
"__id__": 2 "__id__": 2
}, },
"_children": [], "_children": [
{
"__id__": 30
}
],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 20 "__id__": 38
}, },
{ {
"__id__": 22 "__id__": 40
}, },
{ {
"__id__": 24 "__id__": 42
} }
], ],
"_prefab": { "_prefab": {
"__id__": 26 "__id__": 44
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -525,156 +733,34 @@
}, },
"_id": "" "_id": ""
}, },
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 19
},
"_enabled": true,
"__prefab": {
"__id__": 21
},
"_contentSize": {
"__type__": "cc.Size",
"width": 208,
"height": 59
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "t4s+2kLm2F//czXxT9Xo8A"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 19
},
"_enabled": true,
"__prefab": {
"__id__": 23
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "d313aa40-9397-4b44-8100-65ea389233f3@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "/rrApudp/UA/nOAEHDamNA"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 19
},
"_enabled": true,
"__prefab": {
"__id__": 25
},
"_alignFlags": 16,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 671.37,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "v+C5/D9J96sTVhcAhSrUng"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "QQkO56LzjjkpTd+xNv6zcA",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "Spirit3104", "_name": "Spirit3104",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 2 "__id__": 29
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 28 "__id__": 31
}, },
{ {
"__id__": 30 "__id__": 33
}, },
{ {
"__id__": 32 "__id__": 35
} }
], ],
"_prefab": { "_prefab": {
"__id__": 34 "__id__": 37
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 671.87, "x": 0,
"y": 311.5, "y": 0,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -706,16 +792,16 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 27 "__id__": 30
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 29 "__id__": 32
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 63.005419342885375, "width": 81.03130596899703,
"height": 17.64 "height": 22.680000000000003
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -734,11 +820,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 27 "__id__": 30
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 31 "__id__": 34
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -753,10 +839,10 @@
"_string": "Spirit3104", "_string": "Spirit3104",
"_horizontalAlign": 1, "_horizontalAlign": 1,
"_verticalAlign": 1, "_verticalAlign": 1,
"_actualFontSize": 14.758333333333333, "_actualFontSize": 18.975,
"_fontSize": 14, "_fontSize": 18,
"_fontFamily": "Arial", "_fontFamily": "Arial",
"_lineHeight": 14, "_lineHeight": 18,
"_overflow": 0, "_overflow": 0,
"_enableWrapText": true, "_enableWrapText": true,
"_font": null, "_font": null,
@@ -802,19 +888,19 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 27 "__id__": 30
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 33 "__id__": 36
}, },
"_alignFlags": 16, "_alignFlags": 18,
"_target": null, "_target": null,
"_left": 0, "_left": 63.484347015501484,
"_right": 0, "_right": 63.484347015501484,
"_top": 0, "_top": 18.159999999999997,
"_bottom": 0, "_bottom": 18.159999999999997,
"_horizontalCenter": 671.87, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_isAbsLeft": true, "_isAbsLeft": true,
"_isAbsRight": true, "_isAbsRight": true,
@@ -822,8 +908,8 @@
"_isAbsBottom": true, "_isAbsBottom": true,
"_isAbsHorizontalCenter": true, "_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true, "_isAbsVerticalCenter": true,
"_originalWidth": 0, "_originalWidth": 81.03130596899703,
"_originalHeight": 0, "_originalHeight": 22.680000000000003,
"_alignMode": 2, "_alignMode": 2,
"_lockFlags": 0, "_lockFlags": 0,
"_id": "" "_id": ""
@@ -845,6 +931,128 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 29
},
"_enabled": true,
"__prefab": {
"__id__": 39
},
"_contentSize": {
"__type__": "cc.Size",
"width": 208,
"height": 59
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "t4s+2kLm2F//czXxT9Xo8A"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 29
},
"_enabled": true,
"__prefab": {
"__id__": 41
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "d313aa40-9397-4b44-8100-65ea389233f3@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "/rrApudp/UA/nOAEHDamNA"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 29
},
"_enabled": true,
"__prefab": {
"__id__": 43
},
"_alignFlags": 16,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 671.37,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "v+C5/D9J96sTVhcAhSrUng"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "QQkO56LzjjkpTd+xNv6zcA",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -855,7 +1063,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 36 "__id__": 46
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -883,7 +1091,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 38 "__id__": 48
}, },
"_alignFlags": 0, "_alignFlags": 0,
"_target": null, "_target": null,
@@ -932,13 +1140,13 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 41 "__id__": 51
} }
], ],
"_active": true, "_active": true,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 49 "__id__": 59
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -975,23 +1183,23 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 40 "__id__": 50
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 42 "__id__": 52
}, },
{ {
"__id__": 44 "__id__": 54
}, },
{ {
"__id__": 46 "__id__": 56
} }
], ],
"_prefab": { "_prefab": {
"__id__": 48 "__id__": 58
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -1028,11 +1236,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 41 "__id__": 51
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 43 "__id__": 53
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -1056,11 +1264,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 41 "__id__": 51
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 45 "__id__": 55
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -1101,11 +1309,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 41 "__id__": 51
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 47 "__id__": 57
}, },
"_alignFlags": 16, "_alignFlags": 16,
"_target": null, "_target": null,
@@ -0,0 +1,14 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "1830368b-b039-44a1-8023-ede4c94e9dd3",
"files": [],
"subMetas": {},
"userData": {
"isBundle": true,
"bundleConfigID": "default",
"bundleName": "resources",
"priority": 8
}
}
@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "2d251f16-3748-411c-88b6-6ef547bc63a5",
"files": [],
"subMetas": {},
"userData": {}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,11 @@
{
"ver": "1.0.1",
"importer": "text",
"imported": true,
"uuid": "cf18eee8-2e2c-476f-85c7-7cf6bcb17aee",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,416 @@
[
{
"__type__": "cc.SceneAsset",
"_name": "PlatformLoading",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_name": "PlatformLoading",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"autoReleaseAssets": false,
"_globals": {
"__id__": 7
},
"_id": "262ea1ac-58e5-4144-b79c-6e854d75d693"
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
}
],
"_active": true,
"_components": [
{
"__id__": 5
},
{
"__id__": 6
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 800,
"y": 360,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "d9wH0yQuNFD6cIVq4RHwPA"
},
{
"__type__": "cc.Node",
"_name": "Camera",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 1000
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "03SwPEvXVIrKlz1Ycix1/b"
},
{
"__type__": "cc.Camera",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 3
},
"_enabled": true,
"__prefab": null,
"_projection": 0,
"_priority": 0,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 360,
"_near": 1,
"_far": 2000,
"_color": {
"__type__": "cc.Color",
"r": 51,
"g": 51,
"b": 51,
"a": 255
},
"_depth": 1,
"_stencil": 0,
"_clearFlags": 7,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"_aperture": 19,
"_shutter": 7,
"_iso": 0,
"_screenScale": 1,
"_visibility": 1107296256,
"_targetTexture": null,
"_postProcess": null,
"_usePostProcess": false,
"_cameraType": -1,
"_trackingType": 0,
"_id": "67kXVpE8xNtp7r60I1VAI2"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 1600,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "adybdpE3VDW4/URT3c6gX8"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"_cameraComponent": {
"__id__": 4
},
"_alignCanvasWithScreen": true,
"_id": "c6tdlDQhRJNIBJ8DjXiFQ/"
},
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 8
},
"shadows": {
"__id__": 9
},
"_skybox": {
"__id__": 10
},
"fog": {
"__id__": 11
},
"octree": {
"__id__": 12
},
"skin": {
"__id__": 13
},
"lightProbeInfo": {
"__id__": 14
},
"postSettings": {
"__id__": 15
},
"bakedWithStationaryMainLight": false,
"bakedWithHighpLightmap": false
},
{
"__type__": "cc.AmbientInfo",
"_skyColorHDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.5,
"z": 0.8,
"w": 0.520833125
},
"_skyColor": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.5,
"z": 0.8,
"w": 0.520833125
},
"_skyIllumHDR": 20000,
"_skyIllum": 20000,
"_groundAlbedoHDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.2,
"z": 0.2,
"w": 1
},
"_groundAlbedo": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.2,
"z": 0.2,
"w": 1
},
"_skyColorLDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.5,
"z": 0.8,
"w": 1
},
"_skyIllumLDR": 20000,
"_groundAlbedoLDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.2,
"z": 0.2,
"w": 1
}
},
{
"__type__": "cc.ShadowsInfo",
"_enabled": false,
"_type": 0,
"_normal": {
"__type__": "cc.Vec3",
"x": 0,
"y": 1,
"z": 0
},
"_distance": 0,
"_planeBias": 1,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 76
},
"_maxReceived": 4,
"_size": {
"__type__": "cc.Vec2",
"x": 1024,
"y": 1024
}
},
{
"__type__": "cc.SkyboxInfo",
"_envLightingType": 0,
"_envmapHDR": null,
"_envmap": null,
"_envmapLDR": null,
"_diffuseMapHDR": null,
"_diffuseMapLDR": null,
"_enabled": false,
"_useHDR": true,
"_editableMaterial": null,
"_reflectionHDR": null,
"_reflectionLDR": null,
"_rotationAngle": 0
},
{
"__type__": "cc.FogInfo",
"_type": 0,
"_fogColor": {
"__type__": "cc.Color",
"r": 200,
"g": 200,
"b": 200,
"a": 255
},
"_enabled": false,
"_fogDensity": 0.3,
"_fogStart": 0.5,
"_fogEnd": 300,
"_fogAtten": 5,
"_fogTop": 1.5,
"_fogRange": 1.2,
"_accurate": false
},
{
"__type__": "cc.OctreeInfo",
"_enabled": false,
"_minPos": {
"__type__": "cc.Vec3",
"x": -1024,
"y": -1024,
"z": -1024
},
"_maxPos": {
"__type__": "cc.Vec3",
"x": 1024,
"y": 1024,
"z": 1024
},
"_depth": 8
},
{
"__type__": "cc.SkinInfo",
"_enabled": true,
"_blurRadius": 0.01,
"_sssIntensity": 3
},
{
"__type__": "cc.LightProbeInfo",
"_giScale": 1,
"_giSamples": 1024,
"_bounces": 2,
"_reduceRinging": 0,
"_showProbe": true,
"_showWireframe": true,
"_showConvex": false,
"_data": null,
"_lightProbeSphereVolume": 1
},
{
"__type__": "cc.PostSettingsInfo",
"_toneMappingType": 0
}
]
@@ -0,0 +1,11 @@
{
"ver": "1.1.50",
"importer": "scene",
"imported": true,
"uuid": "262ea1ac-58e5-4144-b79c-6e854d75d693",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,416 @@
[
{
"__type__": "cc.SceneAsset",
"_name": "PlatformLogin",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_name": "PlatformLogin",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"autoReleaseAssets": false,
"_globals": {
"__id__": 7
},
"_id": "c6bf90e9-2e5e-4b7b-bfc0-ed8a4e243e4d"
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
}
],
"_active": true,
"_components": [
{
"__id__": 5
},
{
"__id__": 6
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 800,
"y": 360,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "faTOCTLXRFdpZeZi7lNLQq"
},
{
"__type__": "cc.Node",
"_name": "Camera",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 1000
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "6ayrdwHr9GLKXUxRdk2hH5"
},
{
"__type__": "cc.Camera",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 3
},
"_enabled": true,
"__prefab": null,
"_projection": 0,
"_priority": 0,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 360,
"_near": 1,
"_far": 2000,
"_color": {
"__type__": "cc.Color",
"r": 51,
"g": 51,
"b": 51,
"a": 255
},
"_depth": 1,
"_stencil": 0,
"_clearFlags": 7,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"_aperture": 19,
"_shutter": 7,
"_iso": 0,
"_screenScale": 1,
"_visibility": 1107296256,
"_targetTexture": null,
"_postProcess": null,
"_usePostProcess": false,
"_cameraType": -1,
"_trackingType": 0,
"_id": "51tpdCan1JboRRHZOyhxuv"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 1600,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "8ej3BZPwhAD6WQVYXaPCUB"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"_cameraComponent": {
"__id__": 4
},
"_alignCanvasWithScreen": true,
"_id": "cduZE+wFRG1q4NzbTvVx8E"
},
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 8
},
"shadows": {
"__id__": 9
},
"_skybox": {
"__id__": 10
},
"fog": {
"__id__": 11
},
"octree": {
"__id__": 12
},
"skin": {
"__id__": 13
},
"lightProbeInfo": {
"__id__": 14
},
"postSettings": {
"__id__": 15
},
"bakedWithStationaryMainLight": false,
"bakedWithHighpLightmap": false
},
{
"__type__": "cc.AmbientInfo",
"_skyColorHDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.5,
"z": 0.8,
"w": 0.520833125
},
"_skyColor": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.5,
"z": 0.8,
"w": 0.520833125
},
"_skyIllumHDR": 20000,
"_skyIllum": 20000,
"_groundAlbedoHDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.2,
"z": 0.2,
"w": 1
},
"_groundAlbedo": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.2,
"z": 0.2,
"w": 1
},
"_skyColorLDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.5,
"z": 0.8,
"w": 1
},
"_skyIllumLDR": 20000,
"_groundAlbedoLDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.2,
"z": 0.2,
"w": 1
}
},
{
"__type__": "cc.ShadowsInfo",
"_enabled": false,
"_type": 0,
"_normal": {
"__type__": "cc.Vec3",
"x": 0,
"y": 1,
"z": 0
},
"_distance": 0,
"_planeBias": 1,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 76
},
"_maxReceived": 4,
"_size": {
"__type__": "cc.Vec2",
"x": 1024,
"y": 1024
}
},
{
"__type__": "cc.SkyboxInfo",
"_envLightingType": 0,
"_envmapHDR": null,
"_envmap": null,
"_envmapLDR": null,
"_diffuseMapHDR": null,
"_diffuseMapLDR": null,
"_enabled": false,
"_useHDR": true,
"_editableMaterial": null,
"_reflectionHDR": null,
"_reflectionLDR": null,
"_rotationAngle": 0
},
{
"__type__": "cc.FogInfo",
"_type": 0,
"_fogColor": {
"__type__": "cc.Color",
"r": 200,
"g": 200,
"b": 200,
"a": 255
},
"_enabled": false,
"_fogDensity": 0.3,
"_fogStart": 0.5,
"_fogEnd": 300,
"_fogAtten": 5,
"_fogTop": 1.5,
"_fogRange": 1.2,
"_accurate": false
},
{
"__type__": "cc.OctreeInfo",
"_enabled": false,
"_minPos": {
"__type__": "cc.Vec3",
"x": -1024,
"y": -1024,
"z": -1024
},
"_maxPos": {
"__type__": "cc.Vec3",
"x": 1024,
"y": 1024,
"z": 1024
},
"_depth": 8
},
{
"__type__": "cc.SkinInfo",
"_enabled": true,
"_blurRadius": 0.01,
"_sssIntensity": 3
},
{
"__type__": "cc.LightProbeInfo",
"_giScale": 1,
"_giSamples": 1024,
"_bounces": 2,
"_reduceRinging": 0,
"_showProbe": true,
"_showWireframe": true,
"_showConvex": false,
"_data": null,
"_lightProbeSphereVolume": 1
},
{
"__type__": "cc.PostSettingsInfo",
"_toneMappingType": 0
}
]
@@ -0,0 +1,11 @@
{
"ver": "1.1.50",
"importer": "scene",
"imported": true,
"uuid": "c6bf90e9-2e5e-4b7b-bfc0-ed8a4e243e4d",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,316 @@
[
{
"__type__": "cc.SceneAsset",
"_name": "PlatformStartup",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_name": "PlatformStartup",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"autoReleaseAssets": false,
"_globals": {
"__id__": 4
},
"_id": "1c10c2ee-adc2-496f-9005-d3e0e6ebbb56"
},
{
"__type__": "cc.Node",
"_name": "PlatformServices",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "edK1iknZ1EDKLpdkoVy5NZ"
},
{
"__type__": "6dba8Keu9dNqL1ILyFO7MyT",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"loadingScene": {
"__uuid__": "262ea1ac-58e5-4144-b79c-6e854d75d693",
"__expectedType__": "cc.SceneAsset"
},
"loginScene": {
"__uuid__": "c6bf90e9-2e5e-4b7b-bfc0-ed8a4e243e4d",
"__expectedType__": "cc.SceneAsset"
},
"loadingPrefab": {
"__uuid__": "3e5a41f3-b043-45a5-94f6-e299ea9acc61",
"__expectedType__": "cc.Prefab"
},
"loginPrefab": {
"__uuid__": "b209cefb-b381-4c7c-b765-94a5ab75a89c",
"__expectedType__": "cc.Prefab"
},
"protocolPrefab": {
"__uuid__": "8fad42f6-6e14-4311-a344-e6ca87bc0087",
"__expectedType__": "cc.Prefab"
},
"phonePrefab": {
"__uuid__": "b9ec1622-fe6d-4a07-8958-3a0732040e91",
"__expectedType__": "cc.Prefab"
},
"_id": "09m0ERGqxLWKsJIBthaeXP"
},
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 5
},
"shadows": {
"__id__": 6
},
"_skybox": {
"__id__": 7
},
"fog": {
"__id__": 8
},
"octree": {
"__id__": 9
},
"skin": {
"__id__": 10
},
"lightProbeInfo": {
"__id__": 11
},
"postSettings": {
"__id__": 12
},
"bakedWithStationaryMainLight": false,
"bakedWithHighpLightmap": false
},
{
"__type__": "cc.AmbientInfo",
"_skyColorHDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.5,
"z": 0.8,
"w": 0.520833125
},
"_skyColor": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.5,
"z": 0.8,
"w": 0.520833125
},
"_skyIllumHDR": 20000,
"_skyIllum": 20000,
"_groundAlbedoHDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.2,
"z": 0.2,
"w": 1
},
"_groundAlbedo": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.2,
"z": 0.2,
"w": 1
},
"_skyColorLDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.5,
"z": 0.8,
"w": 1
},
"_skyIllumLDR": 20000,
"_groundAlbedoLDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.2,
"z": 0.2,
"w": 1
}
},
{
"__type__": "cc.ShadowsInfo",
"_enabled": false,
"_type": 0,
"_normal": {
"__type__": "cc.Vec3",
"x": 0,
"y": 1,
"z": 0
},
"_distance": 0,
"_planeBias": 1,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 76
},
"_maxReceived": 4,
"_size": {
"__type__": "cc.Vec2",
"x": 1024,
"y": 1024
}
},
{
"__type__": "cc.SkyboxInfo",
"_envLightingType": 0,
"_envmapHDR": null,
"_envmap": null,
"_envmapLDR": null,
"_diffuseMapHDR": null,
"_diffuseMapLDR": null,
"_enabled": false,
"_useHDR": true,
"_editableMaterial": null,
"_reflectionHDR": null,
"_reflectionLDR": null,
"_rotationAngle": 0
},
{
"__type__": "cc.FogInfo",
"_type": 0,
"_fogColor": {
"__type__": "cc.Color",
"r": 200,
"g": 200,
"b": 200,
"a": 255
},
"_enabled": false,
"_fogDensity": 0.3,
"_fogStart": 0.5,
"_fogEnd": 300,
"_fogAtten": 5,
"_fogTop": 1.5,
"_fogRange": 1.2,
"_accurate": false
},
{
"__type__": "cc.OctreeInfo",
"_enabled": false,
"_minPos": {
"__type__": "cc.Vec3",
"x": -1024,
"y": -1024,
"z": -1024
},
"_maxPos": {
"__type__": "cc.Vec3",
"x": 1024,
"y": 1024,
"z": 1024
},
"_depth": 8
},
{
"__type__": "cc.SkinInfo",
"_enabled": true,
"_blurRadius": 0.01,
"_sssIntensity": 3
},
{
"__type__": "cc.LightProbeInfo",
"_giScale": 1,
"_giSamples": 1024,
"_bounces": 2,
"_reduceRinging": 0,
"_showProbe": true,
"_showWireframe": true,
"_showConvex": false,
"_data": null,
"_lightProbeSphereVolume": 1
},
{
"__type__": "cc.PostSettingsInfo",
"_toneMappingType": 0
}
]
@@ -0,0 +1,11 @@
{
"ver": "1.1.50",
"importer": "scene",
"imported": true,
"uuid": "1c10c2ee-adc2-496f-9005-d3e0e6ebbb56",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,449 @@
[
{
"__type__": "cc.SceneAsset",
"_name": "scene-2d",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_name": "scene-2d",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"autoReleaseAssets": false,
"_globals": {
"__id__": 8
},
"_id": "aa6aad6d-aef0-4b69-95a0-18ffda41f4c7"
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
}
],
"_active": true,
"_components": [
{
"__id__": 5
},
{
"__id__": 6
},
{
"__id__": 7
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 800,
"y": 360.00000000000006,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "beI88Z2HpFELqR4T5EMHpg"
},
{
"__type__": "cc.Node",
"_name": "Camera",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 1000
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "ebFwiq8gBFaYpqYbdoDODe"
},
{
"__type__": "cc.Camera",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 3
},
"_enabled": true,
"__prefab": null,
"_projection": 0,
"_priority": 0,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 360,
"_near": 0,
"_far": 2000,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_depth": 1,
"_stencil": 0,
"_clearFlags": 7,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"_aperture": 19,
"_shutter": 7,
"_iso": 0,
"_screenScale": 1,
"_visibility": 1108344832,
"_targetTexture": null,
"_postProcess": null,
"_usePostProcess": false,
"_cameraType": -1,
"_trackingType": 0,
"_id": "63WIch3o5BEYRlXzTT0oWc"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 1600,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "d6rUX5yfhMlKoWX2bSbawx"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"_cameraComponent": {
"__id__": 4
},
"_alignCanvasWithScreen": true,
"_id": "12O/ljcVlEqLmVm3U2gEOQ"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"_alignFlags": 45,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 5.684341886080802e-14,
"_bottom": 5.684341886080802e-14,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": "c5V1EV8IpMtrIvY1OE9t2u"
},
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 9
},
"shadows": {
"__id__": 10
},
"_skybox": {
"__id__": 11
},
"fog": {
"__id__": 12
},
"octree": {
"__id__": 13
},
"skin": {
"__id__": 14
},
"lightProbeInfo": {
"__id__": 15
},
"postSettings": {
"__id__": 16
},
"bakedWithStationaryMainLight": false,
"bakedWithHighpLightmap": false
},
{
"__type__": "cc.AmbientInfo",
"_skyColorHDR": {
"__type__": "cc.Vec4",
"x": 0,
"y": 0,
"z": 0,
"w": 0.520833125
},
"_skyColor": {
"__type__": "cc.Vec4",
"x": 0,
"y": 0,
"z": 0,
"w": 0.520833125
},
"_skyIllumHDR": 20000,
"_skyIllum": 20000,
"_groundAlbedoHDR": {
"__type__": "cc.Vec4",
"x": 0,
"y": 0,
"z": 0,
"w": 0
},
"_groundAlbedo": {
"__type__": "cc.Vec4",
"x": 0,
"y": 0,
"z": 0,
"w": 0
},
"_skyColorLDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.5,
"z": 0.8,
"w": 1
},
"_skyIllumLDR": 20000,
"_groundAlbedoLDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.2,
"z": 0.2,
"w": 1
}
},
{
"__type__": "cc.ShadowsInfo",
"_enabled": false,
"_type": 0,
"_normal": {
"__type__": "cc.Vec3",
"x": 0,
"y": 1,
"z": 0
},
"_distance": 0,
"_planeBias": 1,
"_shadowColor": {
"__type__": "cc.Color",
"r": 76,
"g": 76,
"b": 76,
"a": 255
},
"_maxReceived": 4,
"_size": {
"__type__": "cc.Vec2",
"x": 512,
"y": 512
}
},
{
"__type__": "cc.SkyboxInfo",
"_envLightingType": 0,
"_envmapHDR": null,
"_envmap": null,
"_envmapLDR": null,
"_diffuseMapHDR": null,
"_diffuseMapLDR": null,
"_enabled": false,
"_useHDR": true,
"_editableMaterial": null,
"_reflectionHDR": null,
"_reflectionLDR": null,
"_rotationAngle": 0
},
{
"__type__": "cc.FogInfo",
"_type": 0,
"_fogColor": {
"__type__": "cc.Color",
"r": 200,
"g": 200,
"b": 200,
"a": 255
},
"_enabled": false,
"_fogDensity": 0.3,
"_fogStart": 0.5,
"_fogEnd": 300,
"_fogAtten": 5,
"_fogTop": 1.5,
"_fogRange": 1.2,
"_accurate": false
},
{
"__type__": "cc.OctreeInfo",
"_enabled": false,
"_minPos": {
"__type__": "cc.Vec3",
"x": -1024,
"y": -1024,
"z": -1024
},
"_maxPos": {
"__type__": "cc.Vec3",
"x": 1024,
"y": 1024,
"z": 1024
},
"_depth": 8
},
{
"__type__": "cc.SkinInfo",
"_enabled": false,
"_blurRadius": 0.01,
"_sssIntensity": 3
},
{
"__type__": "cc.LightProbeInfo",
"_giScale": 1,
"_giSamples": 1024,
"_bounces": 2,
"_reduceRinging": 0,
"_showProbe": true,
"_showWireframe": true,
"_showConvex": false,
"_data": null,
"_lightProbeSphereVolume": 1
},
{
"__type__": "cc.PostSettingsInfo",
"_toneMappingType": 0
}
]
@@ -0,0 +1,11 @@
{
"ver": "1.1.50",
"importer": "scene",
"imported": true,
"uuid": "aa6aad6d-aef0-4b69-95a0-18ffda41f4c7",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}
@@ -9,20 +9,7 @@ import type { Transport } from '../framework/net/transport.ts';
const { ccclass } = _decorator; const { ccclass } = _decorator;
/** /** 旧登录编排兼容入口;启动配置由 profiles.ts 统一提供。 */
* LoginFlow: 登录场景编排器(真机版,接入 PlatformSession 真实流)。
*
* 调试期间:
* - mode='debug' + ?profile=local → 跳过远程配置,直连本地服务器
* - 真实 WebSocket 传输(用浏览器原生 WebSocket API)
*
* 流程:
* 1. 构造 EventBus + PlatformSession + NetClient(WebSocket transport)
* 2. bootstrap() 跳过远程,直接拿 local server='ws://127.0.0.1:3088'
* 3. NetClient.start() → 真 WS connect → server 回 player_login
* 4. PlatformSession 落 3 Store → app.phase=loggedIn
* 5. director.loadScene('MainMenu')
*/
class WSTransport implements Transport { class WSTransport implements Transport {
private onOpenCb?: () => void; private onOpenCb?: () => void;
@@ -73,11 +60,9 @@ export class LoginFlow extends Component {
(async () => { (async () => {
try { try {
// 调试模式 + ?profile=local → 跳过远程,直连本地 ws://127.0.0.1:3088
const result = await resolveBootstrap({ const result = await resolveBootstrap({
mode: 'debug',
win: window as any, win: window as any,
search: '?profile=local', search: window.location.search,
fetcher: new HttpConfigFetcher(), fetcher: new HttpConfigFetcher(),
isNative: false, isNative: false,
}); });
@@ -86,11 +71,7 @@ export class LoginFlow extends Component {
console.log('[LoginFlow] bootstrap OK, servers=' + result.servers[0] + ' profile=' + result.profile.name); console.log('[LoginFlow] bootstrap OK, servers=' + result.servers[0] + ' profile=' + result.profile.name);
} catch (e) { } catch (e) {
console.warn('[LoginFlow] bootstrap failed: ' + (e as Error).message); console.warn('[LoginFlow] bootstrap failed: ' + (e as Error).message);
session.app.setIdentity({ return;
agentid: 'A', channelid: 'C', gameid: 'G', marketid: 4, version: 10000,
});
session.app.setServers(['ws://127.0.0.1:3088']);
console.log('[LoginFlow] fallback to ws://127.0.0.1:3088');
} }
// 构造 NetClient + 真实 WS transport // 构造 NetClient + 真实 WS transport
@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "2d0af0de-962c-48db-a658-3f0396048806",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,9 @@
import { _decorator, Component, SpriteFrame } from 'cc';
const {ccclass,property}=_decorator;
/** Serialized frame references keep both original phone-panel modes in the build. */
@ccclass('PhoneLoginAssets')
export class PhoneLoginAssets extends Component {
@property(SpriteFrame) loginTitle:SpriteFrame|null=null;
@property(SpriteFrame) codeWaiting:SpriteFrame|null=null;
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "1f765b40-c144-4ae2-b1b0-7b6ba99fe17a",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,217 @@
import { _decorator, assetManager, Component, Director, Label, Node, Prefab, ProgressBar, SceneAsset,
UITransform, Widget, director, instantiate, isValid } from 'cc';
import { resolveRuntimeConfig, type RuntimeConfig } from '../../framework/config/runtime-config.ts';
import { CocosLocalConfigFetcher } from './local-config-fetcher.ts';
import { HttpConfigFetcher } from '../../framework/config/remote-config-fetcher.ts';
import { resolveLaunchWaitTime } from '../../framework/config/remote-config.ts';
import { resolveLoginPolicy, type LoginPolicy } from '../../framework/presentation/login-policy.ts';
import { LoginAccounts, type LoginNativeSettings } from '../../framework/adapters/native/login-accounts.ts';
import { WebViewJavascriptBridgeAdapter, type WebViewJavascriptBridgeEnvironment } from '../../framework/adapters/native/webview-javascript-bridge.ts';
import { PlatformRuntime } from '../../framework/platform/runtime.ts';
import { WireClient } from '../../framework/net/wire-client.ts';
import { CocosWebSocketTransport } from '../../framework/net/cocos-transport.ts';
import type { DeviceLoginMode, LoginAccountIdentity, LoginDeviceSnapshot } from '../../framework/protocol/contracts/login-contract.ts';
import { createLoginStageGameEntry } from './login-stage-game-entry.ts';
import { CocosLogoCountdownView, createLogoCountdown } from './logo-countdown.ts';
import { requireNode } from './node-bindings.ts';
import { SceneFlow } from './scene-flow.ts';
import { LoginPanel } from './login-panel.ts';
const {ccclass,property}=_decorator;
function required<T>(value:T|null|undefined,name:string):T{if(value==null)throw Error(`PlatformStartup missing ${name}`);return value;}
/** One persistent owner for config/socket/account; scenes own their own visual trees. */
@ccclass('PlatformStartup')
export class PlatformStartup extends Component {
@property(SceneAsset) loadingScene:SceneAsset|null=null;
@property(SceneAsset) loginScene:SceneAsset|null=null;
@property(Prefab) loadingPrefab:Prefab|null=null;
@property(Prefab) loginPrefab:Prefab|null=null;
@property(Prefab) protocolPrefab:Prefab|null=null;
@property(Prefab) phonePrefab:Prefab|null=null;
private runtime:PlatformRuntime|null=null;
private config:RuntimeConfig|null=null;
private policy:LoginPolicy|null=null;
private accounts:LoginAccounts|null=null;
private panel:LoginPanel|null=null;
private bridge:WebViewJavascriptBridgeAdapter|null=null;
private restoreShareLogin:(()=>void)|null=null;
private restoreLocation:(()=>void)|null=null;
private startLocation:(()=>void)|null=null;
private location:unknown=null;
private loginResponse:unknown=null;
private unsubscribe:(()=>void)|null=null;
private countdown:ReturnType<typeof createLogoCountdown>|null=null;
private countdownView:CocosLogoCountdownView|null=null;
private progress:ProgressBar|null=null;
private status:Label|null=null;
private device:LoginDeviceSnapshot|null=null;
private busy=false;
private terminal=false;
private readonly events:Array<{kind:string;data:unknown}>=[];
private readonly flow=new SceneFlow(name=>new Promise<void>((resolve,reject)=>{
if(!director.loadScene(name,error=>error?reject(error):resolve()))reject(Error(`Cannot load scene ${name}`));
}));
/** 常驻服务按加载场景、配置与桥接、连接、登录场景顺序启动;场景仅拥有自己的 UI。 */
async start():Promise<void>{
try{
required(this.loadingScene,'loadingScene');required(this.loginScene,'loginScene');
required(this.loadingPrefab,'loadingPrefab');required(this.loginPrefab,'loginPrefab');
required(this.protocolPrefab,'protocolPrefab');required(this.phonePrefab,'phonePrefab');
director.addPersistRootNode(this.node);
await this.flow.enter(this.loadingScene!.name,()=>this.bindLoading());
if(this.terminal)return;
const injected=window as unknown as {settings?:LoginNativeSettings & {startlocation(type:number):void};app_version?:number|string;app_appversion?:number|string};
const bridgeHost=injected.app_version!==undefined&&Number(injected.app_version)!==0;
const native=bridgeHost?{
getcompareCode:()=>Number(injected.app_appversion),
// uAgent_3 passes the original argument, not its unused local tp variable.
accreditlogin:(provider:number)=>required(this.bridge,'native bridge').call('accreditlogin',provider===2?undefined:provider,()=>{}),
}:injected.settings;
this.config=await resolveRuntimeConfig({hostKind:bridgeHost?'uAgent_3':native?'native-settings':'h5',win:window as any,
search:window.location.search,fetcher:new HttpConfigFetcher(),localFetcher:new CocosLocalConfigFetcher()});
if(this.terminal)return;
this.policy=resolveLoginPolicy(this.config.remoteConfig);
const loginConfig={source:this.config.source,gameserver:this.config.gameserver,identity:this.config.identity,
showVisitor:this.policy.showVisitor,deviceLogin:this.policy.deviceLogin,qqLogin:this.policy.qqLogin};
this.events.push({kind:'login-config',data:loginConfig});
if(this.config.isDebugger)console.info('[PlatformStartup] login-config',JSON.stringify(loginConfig));
this.accounts=new LoginAccounts({storage:window.localStorage,settings:native,random:Math.random,now:Date.now,
gameid:this.config.identity.gameid,agentid:this.config.identity.agentid,policy:this.policy,
submit:(account,mode)=>this.login(account,mode),tip:text=>this.tip(text)});
const previous=(window as any).sharelogin;
const callback=(openid:unknown,headimgurl:unknown,nickname:unknown,sex:unknown,city:unknown,Province:unknown,unionid:unknown)=>{
if(!this.terminal)this.acceptNative({openid,headimgurl,nickname,sex,city,Province,unionid},'global');
};
(window as any).sharelogin=callback;
this.restoreShareLogin=()=>{if((window as any).sharelogin===callback){if(previous===undefined)delete (window as any).sharelogin;else (window as any).sharelogin=previous;}};
const oldLocation=(window as any).getlocationinfo;
const locationCallback=(data:unknown)=>{
if(this.terminal)return;
try{
const value=typeof data==='string'?JSON.parse(data):data;
if(value===null||typeof value!=='object'||Array.isArray(value))throw Error('Invalid getlocationinfo payload');
this.location=value;
}catch(error){this.tip(error instanceof Error?error.message:String(error));}
};
(window as any).getlocationinfo=locationCallback;
this.restoreLocation=()=>{if((window as any).getlocationinfo===locationCallback){if(oldLocation===undefined)delete (window as any).getlocationinfo;else (window as any).getlocationinfo=oldLocation;}};
if(native){
this.bridge=new WebViewJavascriptBridgeAdapter(window as unknown as WebViewJavascriptBridgeEnvironment);
this.bridge.register('sharelogin',data=>this.acceptNative(data,'bridge'));
this.bridge.register('getlocationinfo',locationCallback);
this.startLocation=()=>{if(bridgeHost)required(this.bridge,'native bridge').call('startlocation',2,()=>{});
else required(injected.settings,'settings').startlocation(2);};
}
required(this.countdown,'countdown').start(resolveLaunchWaitTime(this.config.remoteConfig));
this.runtime=new PlatformRuntime({gameEntry:createLoginStageGameEntry(this.config.identity.gameid,event=>this.events.push(event)),
resolveRuntimeConfig:async()=>required(this.config,'config'),
createWireClient:config=>{
const wire=new WireClient({servers:config.servers,transportFactory:()=>new CocosWebSocketTransport()});
wire.subscribe(event=>{this.events.push({kind:'wire',data:event.type});
if(event.type==='message'&&event.message.route==='agent'&&event.message.rpc==='player_login')this.loginResponse=event.message.data;
});return wire;
},
scene:{showLoading:()=>{},showLogin:()=>{void this.showLogin().catch(error=>this.fail(error));},
showLobby:()=>{try{required(this.accounts,'accounts').loginSucceeded(required(this.loginResponse,'login response'),required(this.device,'prepared login device').deviceLogin);
this.busy=false;this.panel?.setBusy(false);this.panel?.close();this.tip('登录成功');}catch(error){this.fail(error);}},
showRoom:()=>this.fail(Error('当前入口尚未接入子游戏场景')),
showReconnect:()=>this.tip('连接中断,正在重连…'),
showKicked:data=>this.fail(Error(`账号退出:${JSON.stringify(data)}`)),
showServerDenial:outcome=>{this.busy=false;this.panel?.setBusy(false);this.tip(JSON.stringify(outcome.data));},
showFatal:error=>this.fail(error)},
loadResources:()=>this.loadLoginResources(),
waitForMinimumDisplay:()=>required(this.countdown,'countdown').promise,
getLoginDeviceSnapshot:()=>required(this.device,'prepared login device'),
});
this.unsubscribe=this.runtime.subscribeState(state=>this.countdown?.socketReady(state.app.phase==='connected'||state.app.phase==='logged-in'),error=>this.fail(error));
await this.runtime.start();
}catch(error){this.fail(error);}
}
private canvas():Node{return required(director.getScene(),'scene').getChildByName('Canvas') ?? (()=>{throw Error('Scene requires Canvas');})();}
private createStatus():void{
const canvas=this.canvas();const node=new Node('Status');node.parent=canvas;node.layer=canvas.layer;
node.setPosition(0,315,0);node.addComponent(UITransform).setContentSize(1200,60);
this.status=node.addComponent(Label);this.status.string='';this.status.fontSize=24;this.status.lineHeight=28;
}
private async bindLoading():Promise<void>{
const logo=instantiate(required(this.loadingPrefab,'loadingPrefab'));logo.parent=this.canvas();logo.setPosition(0,0,0);
this.createStatus();requireNode(logo,'group-32').active=false;
this.progress=required(requireNode(logo,'group-1/Spirit254').getComponent(ProgressBar),'Logo ProgressBar');
const labels=logo.getComponentsInChildren(Label).filter(label=>label.node.name==='Spirit3104');
if(labels.length!==1)throw Error('Logo requires one Spirit3104');
this.countdownView=new CocosLogoCountdownView(requireNode(logo,'group-1/Spirit3103'),labels[0].node,()=>this.countdown?.skip());
this.countdown=createLogoCountdown({now:()=>performance.now(),schedule:(callback,ms)=>{const id=window.setTimeout(callback,ms);return ()=>window.clearTimeout(id);},
render:state=>this.countdownView?.render(state)});
await new Promise<void>(resolve=>director.once(Director.EVENT_AFTER_DRAW,resolve));
this.events.push({kind:'scene',data:'Loading'});
}
private async loadLoginResources():Promise<void>{
const prefab=required(this.loginPrefab,'loginPrefab');
await new Promise<void>((resolve,reject)=>assetManager.loadAny(prefab.uuid,(done,total)=>{
if(!this.terminal&&this.progress&&total>0)this.progress.progress=done/total;
},error=>error?reject(error):resolve()));
if(this.terminal)throw Error('Startup stopped');
this.countdown?.resourcesReady();required(this.progress,'progress').node.active=false;
}
/** 完成真实场景切换后再绑定按钮和尝试缓存登录;弹窗挂在独立 PopupRoot。 */
private async showLogin():Promise<void>{
this.countdownView?.dispose();this.countdownView=null;
await this.flow.enter(required(this.loginScene,'loginScene').name,()=>{
const root=instantiate(required(this.loginPrefab,'loginPrefab'));root.parent=this.canvas();root.setPosition(0,0,0);
const popup=new Node('PopupRoot');popup.parent=this.canvas();popup.layer=root.layer;popup.addComponent(UITransform).setContentSize(1600,720);
this.createStatus();this.panel=new LoginPanel(root,popup,required(this.protocolPrefab,'protocolPrefab'),required(this.phonePrefab,'phonePrefab'),
required(this.accounts,'accounts'),required(this.policy,'policy'),message=>this.tip(message),
()=>!this.busy&&!this.terminal&&this.runtime?.state.app.phase==='connected');
const version=required(requireNode(root,'group-2/版本显示').getComponent(Label),'version Label');
// Beta 展示格式使用当前渠道版本号;只改变显示,不改变登录协议中的数值版本。
version.string=`v${required(this.config,'config').identity.version}.0.0 Beta`;
// Label 自动尺寸更新后重新计算左上角 Widget,避免长版本文字向屏幕外扩展。
required(version.node.getComponent(UITransform),'version UITransform').setAnchorPoint(0,1);
version.updateRenderData(true);
const versionWidget=required(version.node.getComponent(Widget),'version Widget');
versionWidget.target=this.canvas();
versionWidget.updateAlignment();
this.events.push({kind:'scene',data:'Login'});
// Legacy location acquisition is independent of login. Keep the source null
// until a real callback arrives; report host failure without stopping the socket.
try{this.startLocation?.();}catch(error){this.tip(`定位接口调用失败:${error instanceof Error?error.message:String(error)}`);}
if(this.accounts!.cached())this.accounts!.autoLogin();
});
}
private acceptNative(data:unknown,channel:'global'|'bridge'):void{
if(this.terminal)return;
try{required(this.accounts,'accounts').acceptNative(data,channel);}catch(error){this.tip(error instanceof Error?error.message:String(error));}
}
/** 所有登录最终收口:再次校验协议与就绪状态,保存本次模式供登录响应使用。 */
private login(account:LoginAccountIdentity,mode:DeviceLoginMode):void{
const runtime=required(this.runtime,'runtime');
if(this.busy||this.terminal)return;
if(!required(this.accounts,'accounts').requireAgreement())return;
if(!runtime.ready)throw Error('登录资源或连接尚未就绪');
const storage=window.localStorage;
let machineid=storage.getItem('tsgame_machineId_');
if(machineid===null){machineid=`${Date.now()}-${1000+Math.floor(Math.random()*8999)}`;storage.setItem('tsgame_machineId_',machineid);}
const host=window as unknown as {returnCitySN?:{ip:string;province:string;city:string}};
const city=host.returnCitySN;
if(city!==undefined&&(!city||typeof city.ip!=='string'||typeof city.province!=='string'||typeof city.city!=='string'))throw Error('Invalid returnCitySN');
this.device={location:this.location,machineid,machineroom:'',deviceLogin:mode,loginPlayerId:{enabled:false},...(city?{ip:city.ip}:{})};
this.busy=true;this.panel?.setBusy(true);
try{runtime.login(city?{...account,province:city.province,city:city.city}:account);}
catch(error){this.busy=false;this.panel?.setBusy(false);throw error;}
}
private tip(text:string):void{if(this.status&&isValid(this.status))this.status.string=text;}
private fail(error:unknown):void{
this.tip(error instanceof Error?error.message:String(error));console.error('[PlatformStartup]',error);
this.release();
}
/** 幂等释放计时器、订阅和宿主回调,阻止销毁后的迟到消息重新激活流程。 */
private release():void{
if(this.terminal)return;this.terminal=true;this.flow.dispose();this.panel?.dispose();
this.countdown?.cancel();this.countdownView?.dispose();this.unsubscribe?.();this.bridge?.dispose();
this.restoreShareLogin?.();this.restoreLocation?.();this.runtime?.stop();
}
onDestroy():void{this.release();}
getDiagnostics(){return {events:[...this.events],ready:this.runtime?.ready,busy:this.busy,terminal:this.terminal};}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "6dba829e-bbd7-4da8-bd48-2f214eeccc93",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,29 @@
import { resources, TextAsset } from 'cc';
import { DEBUG } from 'cc/env';
import { ConfigFetchError, ConfigParseError, type ConfigFetcher } from '../../framework/config/remote-config.ts';
/**
* 开发专用配置读取器。使用 Cocos 资源数据库读取项目 txt,支持预览和调试构建。
* 路径由 profiles.ts 唯一指定;读取失败绝不改用远程,以免测试了错误的数据。
*/
export class CocosLocalConfigFetcher implements ConfigFetcher {
async fetch(resourcePath: string): Promise<unknown> {
// 除启动配置的 debug 限制外,发布构建也在引擎边界禁止加载开发配置。
if (!DEBUG) throw new ConfigFetchError('本地配置仅允许开发预览或调试构建');
const asset = await new Promise<TextAsset>((resolve, reject) => {
resources.load(resourcePath, TextAsset, (error, result) => {
if (error) reject(new ConfigFetchError(`本地配置读取失败: ${resourcePath}.txt: ${error.message}`));
else if (!result) reject(new ConfigFetchError(`本地配置资源为空: ${resourcePath}.txt`));
else resolve(result);
});
});
try {
return JSON.parse(asset.text) as unknown;
} catch {
throw new ConfigParseError(`本地配置 JSON 解析失败: ${resourcePath}.txt`);
} finally {
// 内容已转为普通数据;下次启动重新加载,避免沿用旧 TextAsset 缓存。
resources.release(resourcePath, TextAsset);
}
}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "97325d47-c809-4a38-9e1a-520ee2a3d863",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,166 @@
import { Animation, assetManager, BlockInputEvents, Color, EditBox, ImageAsset, Label, Node, Prefab, ScrollView, Sprite, SpriteFrame, Texture2D, UITransform, Widget, instantiate, isValid } from 'cc';
import type { LoginAccounts } from '../../framework/adapters/native/login-accounts.ts';
import { loginButtons, type LoginPolicy } from '../../framework/presentation/login-policy.ts';
import { requireNode } from './node-bindings.ts';
import { PhoneLoginAssets } from './PhoneLoginAssets.ts';
/** 登录场景节点与弹窗的生命周期管理;协议状态和账户行为由 LoginAccounts 唯一持有。 */
export class LoginPanel {
private readonly releases:Array<()=>void>=[];
private modal:Node|null=null;
private modalReleases:Array<()=>void>=[];
private disposed=false;
private readonly loadingAnimation:Animation;
constructor(readonly root:Node,private readonly popupRoot:Node,
private readonly protocol:Prefab,private readonly phone:Prefab,
private readonly accounts:LoginAccounts,policy:LoginPolicy,
private readonly tip:(message:string)=>void,private readonly canAct:()=>boolean){
const group=requireNode(root,'group-2');
const animation=requireNode(group,'Logining/登录中动画').getComponent(Animation);
if(!animation||!animation.defaultClip)throw Error('登录中动画 requires Animation and default clip');
this.loadingAnimation=animation;
const state=loginButtons(policy,accounts.versionState,accounts.cached()!==null);
const names={wechat:'微信登录',visitor:'游客登录',phone:'手机登录',quick:'快速登录',qq:'qq登录'};
for(const key of Object.keys(names) as Array<keyof typeof names>)requireNode(group,names[key]).active=state[key];
// JumpWxAuth uses legacy 1280-wide coordinates; prefab coordinates are centered.
const left=(name:string,x:number,width?:number,height?:number)=>{
const node=requireNode(group,name),ui=node.getComponent(UITransform);if(!ui)throw Error(`${name} requires UITransform`);
const widget=node.getComponent(Widget);if(widget)widget.enabled=false;
if(width!==undefined&&height!==undefined)ui.setContentSize(width,height);
node.setPosition(x-640+ui.width*ui.anchorX,node.position.y,node.position.z);
};
if(policy.deviceLogin)left('手机登录',490);
if(accounts.versionState===1){requireNode(group,'渠道logo').active=false;left('微信登录',113,320,98);left('游客登录',488);}
else left('微信登录',415);
// Both switches may be enabled by the remote hierarchy. Keep both actions
// visible, with the user-requested side-by-side layout instead of overlap.
if(state.visitor&&state.phone){
for(const [name,x] of [['游客登录',-210],['手机登录',210]] as const){
const node=requireNode(group,name),widget=node.getComponent(Widget);if(widget)widget.enabled=false;
node.setPosition(x,node.position.y,node.position.z);
}
}
// 登录中展示节点统一位于 prefab 的 Logining 分组,路径必须与资源一致。
const logining=requireNode(group,'Logining');
for(const name of ['登录头像背景框','登录中头像','登录中昵称','登录中动画','登录中头像框'])requireNode(logining,name).active=state.account;
this.setBusy(state.account);
const cached=accounts.cached();if(cached){const label=requireNode(logining,'登录中昵称').getComponent(Label);if(!label)throw Error('登录中昵称 requires Label');label.string=cached.nickname;}
if(cached?.avatar){
const sprite=requireNode(logining,'登录中头像').getComponent(Sprite);if(!sprite)throw Error('登录中头像 requires Sprite');
assetManager.loadRemote<ImageAsset>(cached.avatar,{ext:'.png'},(error,image)=>{
if(this.disposed||!isValid(sprite))return;
if(error){this.tip(`登录头像加载失败:${error.message}`);return;}
const texture=new Texture2D();texture.image=image;const frame=new SpriteFrame();frame.texture=texture;sprite.spriteFrame=frame;
this.releases.push(()=>{if(isValid(sprite))sprite.spriteFrame=null;frame.destroy();texture.destroy();});
});
}
const check=requireNode(group,'协议确认/check');check.active=accounts.agreed;
this.bind(requireNode(group,'协议确认'),()=>{accounts.setAgreement(!accounts.agreed);check.active=accounts.agreed;});
this.bind(requireNode(group,'协议内容'),()=>this.openProtocol());
this.bind(requireNode(group,'微信登录'),()=>accounts.authorize('wechat'));
this.bind(requireNode(group,'qq登录'),()=>accounts.authorize('qq'));
this.bind(requireNode(group,'游客登录'),()=>accounts.visitor());
this.bind(requireNode(group,'快速登录'),()=>accounts.device());
this.bind(requireNode(group,'手机登录'),()=>this.openPhone());
this.bind(requireNode(group,'隐藏快速登录-1'),()=>accounts.hiddenFirst());
this.bind(requireNode(group,'隐藏快速登录-2'),()=>accounts.hiddenSecond());
}
private bind(node:Node,action:()=>void,modal=false){
const listener=()=>{if(this.disposed||!this.canAct())return;try{action();}catch(error){this.tip(error instanceof Error?error.message:String(error));}};
node.on(Node.EventType.TOUCH_END,listener);
(modal?this.modalReleases:this.releases).push(()=>node.off(Node.EventType.TOUCH_END,listener));
}
private open(prefab:Prefab):Node|null{
if(this.modal!==null)return null;
const modal=instantiate(prefab);modal.parent=this.popupRoot;modal.setPosition(0,0,0);modal.active=true;
this.modal=modal;return modal;
}
/** 协议弹窗独立实例化,每次打开回到顶部,关闭时解除监听并销毁实例。 */
openProtocol():void{
const modal=this.open(this.protocol);if(!modal)return;
const scroll=requireNode(modal,'group-37/协议滚动').getComponent(ScrollView);
if(!scroll)throw Error('协议滚动 requires ScrollView');scroll.scrollToTop(0);
for(const name of ['Spirit253','协议遮罩'])this.bind(requireNode(modal,`group-37/${name}`),()=>this.close(),true);
}
/** 沿用原工程输入与验证码倒计时规则;弹窗不另存协议勾选状态。 */
openPhone():void{
if(!this.accounts.requireAgreement())return;
const modal=this.open(this.phone);if(!modal)return;
const group=requireNode(modal,'group-106');
requireNode(modal,'group-108').active=false;
const frames=modal.getComponent(PhoneLoginAssets);
if(!frames?.loginTitle||!frames.codeWaiting)throw Error('PhoneLoginAssets requires loginTitle/codeWaiting');
const title=requireNode(group,'Spirit3252').getComponent(Sprite);if(!title)throw Error('Spirit3252 requires Sprite');title.spriteFrame=frames.loginTitle;
const saved=this.accounts.phonePanelState();
const input=(name:string,textName:string,placeholderName:string)=>{
const node=requireNode(group,name),labelNode=requireNode(group,textName);
const placeholder=requireNode(group,placeholderName);
const glyph=labelNode.getComponent(UITransform);if(!glyph)throw Error(`${textName} requires UITransform`);
// Existing art remains the input background; native EditBox owns text entry.
const ui=node.getComponent(UITransform);if(!ui)throw Error(`${name} requires UITransform`);
const text=new Node('InputText');text.parent=node;text.layer=node.layer;
const textUi=text.addComponent(UITransform);textUi.setAnchorPoint(0,0.5);textUi.setContentSize(ui.width-85,ui.height);
text.setPosition(-ui.width/2+65,0,0);
const inputLabel=text.addComponent(Label);inputLabel.string='';inputLabel.fontSize=glyph.height;
inputLabel.horizontalAlign=Label.HorizontalAlign.LEFT;inputLabel.overflow=Label.Overflow.CLAMP;inputLabel.color=Color.BLACK;
const hint=new Node('Placeholder');hint.parent=node;hint.layer=node.layer;
hint.addComponent(UITransform).setContentSize(ui.width-20,ui.height);
const hintLabel=hint.addComponent(Label);hintLabel.string='';hintLabel.fontSize=glyph.height;
// Configure before onLoad so EditBox does not create orphan default labels.
labelNode.active=false;node.active=false;
const edit=node.addComponent(EditBox);edit.textLabel=inputLabel;edit.placeholderLabel=hintLabel;
edit.string='';edit.placeholder='';
edit.inputMode=EditBox.InputMode.NUMERIC;edit.maxLength=18;
const changed=()=>{edit.string=edit.string.replace(/\D/g,'');placeholder.active=edit.string.length===0;};
node.on(EditBox.EventType.TEXT_CHANGED,changed);this.modalReleases.push(()=>node.off(EditBox.EventType.TEXT_CHANGED,changed));
changed();node.active=true;
const alignText=()=>{
textUi.setAnchorPoint(0,1);textUi.setContentSize(ui.width-85,ui.height);
text.setPosition(-ui.width/2+65,ui.height/2,0);inputLabel.verticalAlign=Label.VerticalAlign.CENTER;
};
alignText();node.on(Node.EventType.SIZE_CHANGED,alignText);
this.modalReleases.push(()=>node.off(Node.EventType.SIZE_CHANGED,alignText));return edit;
};
const phone=input('Spirit3243','Spirit3247','Spirit3249');
const code=input('Spirit3244','Spirit3248','Spirit3250');
if(saved?.phoneNumber){phone.string=saved.phoneNumber;requireNode(group,'Spirit3249').active=false;}
const codeButton=requireNode(group,'Spirit3245'),codeSprite=codeButton.getComponent(Sprite);
if(!codeSprite||!codeSprite.spriteFrame)throw Error('Spirit3245 requires SpriteFrame');
const idleFrame=codeSprite.spriteFrame;
const timerNode=requireNode(group,'Spirit3246'),timerSprite=timerNode.getComponent(Sprite);
if(!timerSprite)throw Error('Spirit3246 requires Sprite');timerSprite.enabled=false;
const timerWidget=timerNode.getComponent(Widget);if(timerWidget)timerWidget.enabled=false;
timerNode.setPosition(codeButton.position);timerNode.getComponent(UITransform)!.setContentSize(148,28);
const timerText=new Node('CountdownText');timerText.parent=timerNode;timerText.layer=timerNode.layer;
timerText.addComponent(UITransform).setContentSize(148,28);
const timerLabel=timerText.addComponent(Label);timerLabel.fontSize=28;timerLabel.color=Color.BLACK;
let restTime=saved===null?0:saved.restTime;
let waiting=restTime>0;
const renderTimer=()=>{timerNode.active=waiting;timerLabel.string=`${restTime}秒`;codeSprite.spriteFrame=waiting?frames.codeWaiting:idleFrame;};
renderTimer();
if(waiting){const timer=window.setInterval(()=>{restTime--;if(restTime<0){waiting=false;window.clearInterval(timer);}renderTimer();},1000);
this.modalReleases.push(()=>window.clearInterval(timer));}
this.bind(codeButton,()=>{if(restTime<=0&&phone.string)this.tip('请通过相关渠道获取');},true);
this.bind(requireNode(group,'Spirit3253'),()=>{if(!this.accounts.requireAgreement())return;
if(!phone.string||!code.string){this.tip('手机号与验证码均不能为空!');return;}
this.accounts.phone(phone.string,code.string);this.close();},true);
for(const name of ['Spirit3251','Spirit3241'])this.bind(requireNode(group,name),()=>this.close(),true);
const background=requireNode(group,'Spirit3242');if(!background.getComponent(BlockInputEvents))background.addComponent(BlockInputEvents);
}
/** 帧切换由 prefab 的 AnimationClip 驱动;登录状态只负责显隐及播放生命周期。 */
setBusy(busy:boolean):void{
const group=requireNode(this.root,'group-2/Logining');
group.active=busy;
for(const name of ['登录中遮罩','登录头像背景框','登录中头像','登录中昵称','登录中动画','登录中头像框'])requireNode(group,name).active=busy;
if(busy){
const clip=this.loadingAnimation.defaultClip!;
if(!this.loadingAnimation.getState(clip.name)?.isPlaying)this.loadingAnimation.play(clip.name);
}else this.loadingAnimation.stop();
}
/** 清理弹窗事件和验证码计时器,避免反复打开时累积回调。 */
close():void{
this.modalReleases.splice(0).forEach(release=>release());
if(this.modal&&isValid(this.modal))this.modal.destroy();this.modal=null;
}
dispose():void{this.setBusy(false);this.disposed=true;this.close();this.releases.splice(0).forEach(release=>release());}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "e79a22bd-cbb6-41d0-a2ca-6ffb7e340f38",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,37 @@
import type { GameEntry } from '../../framework/sdk/contracts/game-entry.ts';
/** 登录阶段的诊断事件,仅供入口记录生命周期和越界操作。 */
export type LoginEntryEvent = { kind: string; data: unknown };
type EvidenceSink = (event: LoginEntryEvent) => void;
/** 登录阶段尚未接入子游戏:满足运行时入口契约,但任何游戏操作均显式拒绝。
* 接入真实子游戏时应替换此入口,不能把占位实现当作大厅或房间支持。
*/
export function createLoginStageGameEntry(gameId: string | number, record: EvidenceSink): GameEntry {
let nextInstanceId = 0;
function violation(operation: string, instanceId?: number): never {
record({ kind: 'scope-violation', data: { operation, instanceId } });
throw new Error(`Local platform login scope forbids ${operation}`);
}
return {
key: 'local-platform-login',
route: 'local-platform-login',
gameId,
resolveSeatCount: () => violation('resolveSeatCount'),
createModule() {
const instanceId = ++nextInstanceId;
let disposed = false;
record({ kind: 'diagnostic-module', data: { instanceId, state: 'created' } });
return {
attach: () => violation('attach', instanceId),
restore: () => violation('restore', instanceId),
handlePlatformEvent: () => violation('handlePlatformEvent', instanceId),
handleGameMessage: () => violation('handleGameMessage', instanceId),
dispose() {
if (disposed) return;
disposed = true;
record({ kind: 'diagnostic-module', data: { instanceId, state: 'disposed' } });
},
};
},
};
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "57db0201-3b1b-482e-b783-f19e5e9a47a7",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,116 @@
import { Label, Node, UITransform, Vec3, Widget } from 'cc';
/** Logo 展示状态;倒计时只控制最短展示时间,资源和连接就绪由运行时独立管理。 */
export interface LogoCountdownState { readonly visible: boolean; readonly text: string; }
/** Native input and measured label layout, independent of serialized label parentage. */
export class CocosLogoCountdownView {
private readonly label: Label;
private readonly buttonTransform: UITransform;
private readonly textTransform: UITransform;
private readonly parentTransform: UITransform;
private disposed = false;
constructor(private readonly button: Node, private readonly text: Node, private readonly onSkip: () => void) {
const label = text.getComponent(Label), buttonTransform = button.getComponent(UITransform);
const textTransform = text.getComponent(UITransform), parentTransform = text.parent?.getComponent(UITransform);
if (!label || !buttonTransform || !textTransform || !parentTransform) {
throw new Error('Logo countdown requires Label and native UITransform bindings');
}
this.label = label; this.buttonTransform = buttonTransform;
this.textTransform = textTransform; this.parentTransform = parentTransform;
// The label follows the actual button center, so its old absolute Widget must not fight layout.
const widget = text.getComponent(Widget); if (widget) widget.enabled = false;
this.label.overflow = Label.Overflow.NONE;
button.active = false; text.active = false;
button.on(Node.EventType.TOUCH_END, onSkip);
}
render(state: LogoCountdownState): void {
if (this.disposed) return;
this.button.active = state.visible; this.text.active = state.visible;
this.label.string = state.text;
if (!state.visible) return;
this.button.getComponent(Widget)?.updateAlignment();
this.label.updateRenderData(true);
const button = this.buttonTransform, text = this.textTransform;
const center = button.convertToWorldSpaceAR(new Vec3((0.5 - button.anchorX) * button.width, (0.5 - button.anchorY) * button.height, 0));
const position = this.parentTransform.convertToNodeSpaceAR(center);
position.x += (text.anchorX - 0.5) * text.width;
position.y += (text.anchorY - 0.5) * text.height;
this.text.setPosition(position);
}
dispose(): void {
if (this.disposed) return;
this.disposed = true;
this.button.off(Node.EventType.TOUCH_END, this.onSkip);
this.button.active = false; this.text.active = false;
}
}
/** Display gate only. Runtime still independently owns resource/config/socket gates. */
export function createLogoCountdown(options: {
now(): number;
schedule(callback: () => void, milliseconds: number): () => void;
render(state: LogoCountdownState): void;
}) {
let started = false, finished = false, resources = false, socket = false;
let remaining = 0, deadline = 0;
let cancelDeadline: (() => void) | null = null, cancelTick: (() => void) | null = null;
let resolve!: () => void, reject!: (error: unknown) => void;
const promise = new Promise<void>((yes, no) => { resolve = yes; reject = no; });
// Cancellation may precede the host attaching the display gate.
void promise.catch(() => {});
const render = () => options.render({ visible: started && !finished && remaining > 0,
text: `倒计时${Math.ceil(Math.max(0, remaining) / 1000)}s${resources ? ' 跳过' : ''}` });
const finish = (error?: unknown) => {
if (finished) return;
finished = true;
const failures: unknown[] = error === undefined ? [] : [error];
for (const cancel of [cancelDeadline, cancelTick]) {
try { cancel?.(); } catch (failure) { failures.push(failure); }
}
cancelDeadline = null; cancelTick = null;
try { render(); } catch (failure) { failures.push(failure); }
if (failures.length > 0) reject(failures[0]); else resolve();
};
const guard = (operation: () => void) => {
if (finished) return;
try { operation(); } catch (error) { finish(error); }
};
const checkDeadline = () => {
cancelDeadline = null;
if (finished) return;
const wait = deadline - options.now();
if (wait <= 0) { finish(); return; }
guard(() => { cancelDeadline = options.schedule(checkDeadline, wait); });
};
const tick = () => {
cancelTick = null;
if (finished) return;
guard(() => {
remaining -= 1000;
render();
if (remaining > 1000) cancelTick = options.schedule(tick, 1000);
});
};
render();
return {
promise,
start(milliseconds: number) {
if (finished) return;
if (started) throw new Error('Logo countdown already started');
if (!Number.isFinite(milliseconds) || milliseconds < 0) throw new Error('Invalid launchWaitTime');
started = true; remaining = milliseconds; deadline = options.now() + milliseconds;
guard(() => {
render(); checkDeadline();
if (!finished && remaining > 1000) cancelTick = options.schedule(tick, 1000);
});
},
resourcesReady() { guard(() => { resources = true; render(); }); },
socketReady(value: boolean) { if (!finished) socket = value; },
skip() { if (!finished && started && resources && socket) finish(); },
cancel() { finish(new Error('Logo countdown cancelled')); },
};
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "1baca79a-2862-41de-b01e-616eb90baf04",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,8 @@
import { Node } from 'cc';
/** 按迁移资源的固定路径取节点;绑定缺失直接报错,避免把资源错误掩盖成按钮无响应。 */
export function requireNode(root: Node, path: string): Node {
const node = root.getChildByPath(path);
if (node === null) throw new Error(`Platform login binding missing node: ${path}`);
return node;
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "a7ceb35e-66c2-4ecf-ba76-3e8ee1aac9a0",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,18 @@
/** Serializes scene lifetime; services are owned by the persistent startup component. */
export class SceneFlow {
private pending:Promise<void>=Promise.resolve();
private disposed=false;
constructor(private readonly load:(name:string)=>Promise<void>){}
/** 串行加载后绑定新场景;等待期间已销毁则禁止继续绑定。 */
enter(name:string,bind:()=>void|Promise<void>):Promise<void>{
const next=this.pending.then(async()=>{
if(this.disposed)throw Error('SceneFlow disposed');
await this.load(name);
if(this.disposed)throw Error('SceneFlow disposed');
await bind();
});
this.pending=next;
return next;
}
dispose():void{this.disposed=true;}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "5fb154af-f704-44d3-9786-640db8ac3051",
"files": [],
"subMetas": {},
"userData": {}
}

Some files were not shown because too many files have changed in this diff Show More