ms-vite-plugin 1.4.76 → 1.4.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/luaObfuscator/addVararg.js +1 -1
- package/dist/luaObfuscator/flatten.js +1 -1
- package/dist/luaObfuscator/rename.js +1 -1
- package/dist/luaObfuscator/scope.js +1 -1
- package/docs/api/device.md +0 -29
- package/docs/api/global.md +0 -49
- package/docs/apicn/device.md +0 -35
- package/docs/apicn/global.md +0 -49
- package/docs/apilua/device.md +0 -27
- package/docs/apilua/global.md +0 -52
- package/docs/apipython/device.md +2 -27
- package/docs/apipython/g.md +0 -47
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.addVararg=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.addVararg=o;function c(t){t.vararg=!0,s(t.body.body)}function a(t){switch(t.type){case"FuncExpr":c(t);break;case"UnaryExpr":a(t.arg);break;case"BinaryExpr":a(t.left),a(t.right);break;case"TableExpr":for(const e of t.fields)e.kind==="index"&&a(e.key),a(e.value);break;case"IndexExpr":a(t.object),a(t.index);break;case"MemberExpr":a(t.object);break;case"CallExpr":a(t.callee);for(const e of t.args)a(e);break;case"MethodCallExpr":a(t.object);for(const e of t.args)a(e);break;case"ParenExpr":a(t.exp);break;default:break}}function s(t){for(const e of t)switch(e.type){case"DoStat":case"WhileStat":case"RepeatStat":case"ForNumStat":case"ForInStat":if(e.type==="WhileStat"&&a(e.cond),e.type==="RepeatStat"&&a(e.cond),e.type==="ForNumStat"&&(a(e.start),a(e.end),e.step&&a(e.step)),e.type==="ForInStat")for(const r of e.exps)a(r);s(e.body.body);break;case"IfStat":for(const r of e.clauses)a(r.cond),s(r.body.body);e.elseBody&&s(e.elseBody.body);break;case"FuncStat":case"LocalFuncStat":c(e.func);break;case"LocalStat":if(e.exps)for(const r of e.exps)a(r);break;case"AssignStat":for(const r of e.vars)a(r);for(const r of e.exps)a(r);break;case"CallStat":a(e.exp);break;case"ReturnStat":for(const r of e.exps)a(r);break;default:break}}function o(t){s(t.body)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.flattenControlFlow=C;function m(e){return{type:"NumberLiteral",raw:String(e),value:e}}function y(e){return{type:"NameExpr",name:e}}function b(e,t){return{type:"AssignStat",vars:e.map(a=>y(a)),exps:t}}function u(e,t){return b([e.stateName],[typeof t=="number"?m(t):t])}function k(e,t,a){return{type:"BinaryExpr",op:"or",left:{type:"BinaryExpr",op:"and",left:y(e),right:m(t)},right:m(a)}}function E(e,t,a){return{type:"BinaryExpr",op:e,left:t,right:a}}function S(e){const t=`__t${e.nextTemp}`;return e.nextTemp+=1,e.temps.push(t),t}function x(e){const t=e.nextState;return e.nextState+=1,e.states.set(t,[]),t}function r(e,t,a){e.states.get(t).push(a)}function L(e,t){for(const a of e)if(a.type==="LocalStat")for(const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.flattenControlFlow=C;function m(e){return{type:"NumberLiteral",raw:String(e),value:e}}function y(e){return{type:"NameExpr",name:e}}function b(e,t){return{type:"AssignStat",vars:e.map(a=>y(a)),exps:t}}function u(e,t){return b([e.stateName],[typeof t=="number"?m(t):t])}function k(e,t,a){return{type:"BinaryExpr",op:"or",left:{type:"BinaryExpr",op:"and",left:y(e),right:m(t)},right:m(a)}}function E(e,t,a){return{type:"BinaryExpr",op:e,left:t,right:a}}function S(e){const t=`__t${e.nextTemp}`;return e.nextTemp+=1,e.temps.push(t),t}function x(e){const t=e.nextState;return e.nextState+=1,e.states.set(t,[]),t}function r(e,t,a){e.states.get(t).push(a)}function L(e,t){for(const a of e)if(a.type==="LocalStat")for(const o of a.names)t.push(o.name);else if(a.type==="LocalFuncStat")t.push(a.name);else if(a.type==="ForNumStat")t.push(a.name),L(a.body.body,t);else if(a.type==="ForInStat")t.push(...a.names),L(a.body.body,t);else if(a.type==="DoStat"||a.type==="WhileStat"||a.type==="RepeatStat")L(a.body.body,t);else if(a.type==="IfStat"){for(const o of a.clauses)L(o.body.body,t);a.elseBody&&L(a.elseBody.body,t)}}function h(e,t,a,o){if(e.length===0)return t;const p=e.map(()=>x(a));for(let n=0;n<e.length;n+=1){const c=e[n];c.type==="LabelStat"&&a.userLabels.set(c.name,p[n])}for(let n=0;n<e.length;n+=1){const c=n+1<e.length?p[n+1]:t;I(a,p[n],e[n],c,o)}return p[0]}function I(e,t,a,o,p){switch(a.type){case"EmptyStat":case"LabelStat":r(e,t,u(e,o));return;case"AssignStat":case"CallStat":case"FuncStat":r(e,t,a),r(e,t,u(e,o));return;case"LocalStat":a.exps&&a.exps.length>0&&r(e,t,b(a.names.map(n=>n.name),a.exps)),r(e,t,u(e,o));return;case"LocalFuncStat":r(e,t,b([a.name],[a.func])),r(e,t,u(e,o));return;case"ReturnStat":r(e,t,a);return;case"BreakStat":r(e,t,u(e,p));return;case"GotoStat":{const n=e.userLabels.get(a.name);if(n===void 0)throw new Error(`goto \u672A\u5B9A\u4E49\u6807\u7B7E ::${a.name}::`);r(e,t,u(e,n));return}case"DoStat":r(e,t,u(e,h(a.body.body,o,e,p)));return;case"IfStat":{const n=S(e);let c=t;for(let l=0;l<a.clauses.length;l+=1){const f=l===a.clauses.length-1,d=h(a.clauses[l].body.body,o,e,p);let i=o;f?a.elseBody&&(i=h(a.elseBody.body,o,e,p)):i=x(e),r(e,c,b([n],[a.clauses[l].cond])),r(e,c,u(e,k(n,d,i))),f||(c=i)}a.clauses.length===0&&r(e,t,u(e,o));return}case"WhileStat":{const n=S(e),c=h(a.body.body,t,e,o);r(e,t,b([n],[a.cond])),r(e,t,u(e,k(n,c,o)));return}case"RepeatStat":{const n=S(e),c=x(e),l=h(a.body.body,c,e,o);r(e,t,u(e,l)),r(e,c,b([n],[a.cond])),r(e,c,u(e,k(n,o,l)));return}case"ForNumStat":{const n=a.name,c=S(e),l=S(e),f=S(e),d=x(e),i=x(e),F=x(e),g=x(e),N=h(a.body.body,g,e,o);r(e,t,b([n],[a.start])),r(e,t,b([c],[a.end])),r(e,t,b([l],[a.step??m(1)])),r(e,t,u(e,d)),r(e,d,b([f],[E(">=",y(l),m(0))])),r(e,d,u(e,k(f,i,F))),r(e,i,b([f],[E("<=",y(n),y(c))])),r(e,i,u(e,k(f,N,o))),r(e,F,b([f],[E(">=",y(n),y(c))])),r(e,F,u(e,k(f,N,o))),r(e,g,b([n],[E("+",y(n),y(l))])),r(e,g,u(e,d));return}case"ForInStat":{const n=S(e),c=S(e),l=S(e),f=S(e),d=x(e),i=[b([l],[y(a.names[0])]),...a.body.body],F=h(i,d,e,o),g=a.exps.slice();for(;g.length<3;)g.push({type:"NilLiteral"});r(e,t,b([n,c,l],g.slice(0,3))),r(e,t,u(e,d)),r(e,d,{type:"AssignStat",vars:a.names.map(N=>y(N)),exps:[{type:"CallExpr",callee:y(n),args:[y(c),y(l)]}]}),r(e,d,b([f],[E("~=",y(a.names[0]),{type:"NilLiteral"})])),r(e,d,u(e,k(f,F,o)));return}default:r(e,t,u(e,o))}}function v(e,t){const a=e.slice();let o=t>>>0||1;for(let p=a.length-1;p>0;p-=1){o=Math.imul(o,1664525)+1013904223>>>0;const n=o%(p+1),c=a[p];a[p]=a[n],a[n]=c}return a}function w(e,t){if(e.length===0)return e;const a={states:new Map,temps:[],nextState:1,nextTemp:1,stateName:"__s",userLabels:new Map},o=[];L(e,o);const p=h(e,0,a,0),n=[...new Set([...o,...a.temps,a.stateName])],c=v([...a.states.keys()],t).map(l=>({cond:E("==",y(a.stateName),m(l)),body:{type:"Block",body:a.states.get(l)}}));return[{type:"LocalStat",names:n.map(l=>({name:l}))},b([a.stateName],[m(p)]),{type:"WhileStat",cond:E("~=",y(a.stateName),m(0)),body:{type:"Block",body:[{type:"IfStat",clauses:c}]}}]}function s(e,t){switch(e.type){case"FuncExpr":B(e.body.body,t),e.body.body=w(e.body.body,t);break;case"UnaryExpr":s(e.arg,t);break;case"BinaryExpr":s(e.left,t),s(e.right,t);break;case"TableExpr":for(const a of e.fields)a.kind==="index"&&s(a.key,t),s(a.value,t);break;case"IndexExpr":s(e.object,t),s(e.index,t);break;case"MemberExpr":s(e.object,t);break;case"CallExpr":s(e.callee,t);for(const a of e.args)s(a,t);break;case"MethodCallExpr":s(e.object,t);for(const a of e.args)s(a,t);break;case"ParenExpr":s(e.exp,t);break;default:break}}function B(e,t){for(const a of e)switch(a.type){case"DoStat":case"WhileStat":case"RepeatStat":case"ForNumStat":case"ForInStat":if((a.type==="WhileStat"||a.type==="RepeatStat")&&s(a.cond,t),a.type==="ForNumStat"&&(s(a.start,t),s(a.end,t),a.step&&s(a.step,t)),a.type==="ForInStat")for(const o of a.exps)s(o,t);B(a.body.body,t);break;case"IfStat":for(const o of a.clauses)s(o.cond,t),B(o.body.body,t);a.elseBody&&B(a.elseBody.body,t);break;case"FuncStat":case"LocalFuncStat":B(a.func.body.body,t),a.func.body.body=w(a.func.body.body,t);break;case"LocalStat":if(a.exps)for(const o of a.exps)s(o,t);break;case"AssignStat":for(const o of a.vars)s(o,t);for(const o of a.exps)s(o,t);break;case"CallStat":s(a.exp,t);break;case"ReturnStat":for(const o of a.exps)s(o,t);break;default:break}}function C(e,t){B(e.body,t),e.body=w(e.body,t)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shortName=o,exports.renameLocals=c;const u=require("./reserved"),d=require("./scope"),l="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function o(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.shortName=o,exports.renameLocals=c;const u=require("./reserved"),d=require("./scope"),l="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function o(r){let e=r,t="";do t=l[e%l.length]+t,e=Math.floor(e/l.length)-1;while(e>=0);return u.luaKeywords.has(t)?`_${t}`:t}function c(r){let e=0;const t=new Set;(0,d.collectAndRename)(r,(a,s)=>{if(a.newName!==a.original)return;let n=o(e);for(e+=1;s.has(n)||t.has(n)||u.luaKeywords.has(n);)n=o(e),e+=1;a.newName=n,t.add(n),s.add(n)})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveLocal=i,exports.collectAndRename=x;function i(e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveLocal=i,exports.collectAndRename=x;function i(e,o){let n=e;for(;n;){const a=n.locals.get(o);if(a)return a;n=n.parent}}function s(e){return{parent:e,locals:new Map}}function f(e,o){const n=e.locals.get(o);if(n)return n;const a={original:o,newName:o};return e.locals.set(o,a),a}function x(e,o){const n=new Set,a={locals:new Map};d(e.body,a,n,o)}function u(e,o,n,a){d(e.body,o,n,a)}function d(e,o,n,a){for(const c of e)b(c,o,n,a)}function m(e,o,n,a){const c=s(o),r=e.params.slice();for(let l=0;l<r.length;l+=1){const p=f(c,r[l]);a(p,n),e.params[l]=p.newName}u(e.body,c,n,a)}function b(e,o,n,a){switch(e.type){case"EmptyStat":case"BreakStat":case"GotoStat":case"LabelStat":return;case"DoStat":u(e.body,s(o),n,a);return;case"WhileStat":t(e.cond,o,n,a),u(e.body,s(o),n,a);return;case"RepeatStat":{const c=s(o);u(e.body,c,n,a),t(e.cond,c,n,a);return}case"IfStat":for(const c of e.clauses)t(c.cond,o,n,a),u(c.body,s(o),n,a);e.elseBody&&u(e.elseBody,s(o),n,a);return;case"ForNumStat":{t(e.start,o,n,a),t(e.end,o,n,a),e.step&&t(e.step,o,n,a);const c=s(o),r=f(c,e.name);a(r,n),e.name=r.newName,u(e.body,c,n,a);return}case"ForInStat":{for(const r of e.exps)t(r,o,n,a);const c=s(o);for(let r=0;r<e.names.length;r+=1){const l=f(c,e.names[r]);a(l,n),e.names[r]=l.newName}u(e.body,c,n,a);return}case"FuncStat":{const c=i(o,e.name.base);c&&(e.name.base=c.newName),m(e.func,o,n,a);return}case"LocalFuncStat":{const c=f(o,e.name);a(c,n),e.name=c.newName,m(e.func,o,n,a);return}case"LocalStat":if(e.exps)for(const c of e.exps)t(c,o,n,a);for(let c=0;c<e.names.length;c+=1){const r=f(o,e.names[c].name);a(r,n),e.names[c].name=r.newName}return;case"AssignStat":for(const c of e.vars)t(c,o,n,a);for(const c of e.exps)t(c,o,n,a);return;case"CallStat":t(e.exp,o,n,a);return;case"ReturnStat":for(const c of e.exps)t(c,o,n,a);return}}function t(e,o,n,a){switch(e.type){case"NilLiteral":case"BoolLiteral":case"NumberLiteral":case"StringLiteral":case"VarargExpr":return;case"NameExpr":{const c=i(o,e.name);c&&(e.name=c.newName);return}case"UnaryExpr":t(e.arg,o,n,a);return;case"BinaryExpr":t(e.left,o,n,a),t(e.right,o,n,a);return;case"FuncExpr":m(e,o,n,a);return;case"TableExpr":for(const c of e.fields)c.kind==="index"&&t(c.key,o,n,a),t(c.value,o,n,a);return;case"IndexExpr":t(e.object,o,n,a),t(e.index,o,n,a);return;case"MemberExpr":t(e.object,o,n,a);return;case"CallExpr":t(e.callee,o,n,a);for(const c of e.args)t(c,o,n,a);return;case"MethodCallExpr":t(e.object,o,n,a);for(const c of e.args)t(c,o,n,a);return;case"ParenExpr":t(e.exp,o,n,a);return}}
|
package/docs/api/device.md
CHANGED
|
@@ -166,35 +166,6 @@ logi(`设备型号: ${model}`);
|
|
|
166
166
|
|
|
167
167
|
## 屏幕信息
|
|
168
168
|
|
|
169
|
-
### getScreenSize - 获取屏幕尺寸(缩放后的)。
|
|
170
|
-
|
|
171
|
-
**注意事项:**
|
|
172
|
-
|
|
173
|
-
- 该方法返回的屏幕尺寸是根据当前设备的屏幕分辨率除以缩放比例计算得到的。
|
|
174
|
-
- 注意该方法只会返回竖屏分辨率。
|
|
175
|
-
|
|
176
|
-
```typescript
|
|
177
|
-
function getScreenSize(): {
|
|
178
|
-
width: number; // 屏幕宽度(像素)
|
|
179
|
-
height: number; // 屏幕高度(像素)
|
|
180
|
-
};
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
**返回值:**
|
|
184
|
-
|
|
185
|
-
| 参数名 | 类型 | 描述 |
|
|
186
|
-
| -------- | ------ | ---------------- |
|
|
187
|
-
| `width` | number | 屏幕宽度(像素) |
|
|
188
|
-
| `height` | number | 屏幕高度(像素) |
|
|
189
|
-
|
|
190
|
-
**示例:**
|
|
191
|
-
|
|
192
|
-
```typescript
|
|
193
|
-
// 获取屏幕尺寸
|
|
194
|
-
const screenSize = device.getScreenSize();
|
|
195
|
-
logi(`屏幕尺寸: ${screenSize.width} x ${screenSize.height}`);
|
|
196
|
-
```
|
|
197
|
-
|
|
198
169
|
### getScreenRealSize - 获取屏幕实际尺寸。
|
|
199
170
|
|
|
200
171
|
**注意事项:**
|
package/docs/api/global.md
CHANGED
|
@@ -307,55 +307,6 @@ takeMeToFront();
|
|
|
307
307
|
logi("应用已切换到前台");
|
|
308
308
|
```
|
|
309
309
|
|
|
310
|
-
### setAgentFastMode
|
|
311
|
-
|
|
312
|
-
设置 Agent 快速模式(兼容旧接口)。开启对应模式 `1`,关闭对应模式 `0`。推荐改用 `setAgentTouchMode`。设置会持久化。
|
|
313
|
-
|
|
314
|
-
```typescript
|
|
315
|
-
function setAgentFastMode(enabled: boolean): boolean;
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
**参数:**
|
|
319
|
-
|
|
320
|
-
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
321
|
-
| --------- | --------- | -------- | ------ | ---------------- |
|
|
322
|
-
| `enabled` | `boolean` | 是 | - | 是否开启快速模式 |
|
|
323
|
-
|
|
324
|
-
**返回值:**
|
|
325
|
-
|
|
326
|
-
| 类型 | 描述 |
|
|
327
|
-
| --------- | -------------------- |
|
|
328
|
-
| `boolean` | 实际是否开启快速模式 |
|
|
329
|
-
|
|
330
|
-
**示例:**
|
|
331
|
-
|
|
332
|
-
```javascript
|
|
333
|
-
const enabled = setAgentFastMode(true);
|
|
334
|
-
logi(`Agent 快速模式: ${enabled}`);
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
### getAgentFastMode
|
|
338
|
-
|
|
339
|
-
获取 Agent 快速模式当前状态(兼容旧接口)。
|
|
340
|
-
|
|
341
|
-
```typescript
|
|
342
|
-
function getAgentFastMode(): boolean;
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
**返回值:**
|
|
346
|
-
|
|
347
|
-
| 类型 | 描述 |
|
|
348
|
-
| --------- | -------------------- |
|
|
349
|
-
| `boolean` | 当前是否开启快速模式 |
|
|
350
|
-
|
|
351
|
-
**示例:**
|
|
352
|
-
|
|
353
|
-
```javascript
|
|
354
|
-
if (getAgentFastMode()) {
|
|
355
|
-
logi("Agent 快速模式已开启");
|
|
356
|
-
}
|
|
357
|
-
```
|
|
358
|
-
|
|
359
310
|
### setAgentTouchMode
|
|
360
311
|
|
|
361
312
|
设置 Agent 触控模式。默认 `1`,设置会持久化。
|
package/docs/apicn/device.md
CHANGED
|
@@ -166,41 +166,6 @@ $打印信息日志(`设备型号: ${model}`);
|
|
|
166
166
|
|
|
167
167
|
## 屏幕信息
|
|
168
168
|
|
|
169
|
-
### 获取屏幕宽高(缩放后的)
|
|
170
|
-
|
|
171
|
-
**注意事项:**
|
|
172
|
-
|
|
173
|
-
- 该方法返回的屏幕尺寸是根据当前设备的屏幕分辨率除以缩放比例计算得到的。
|
|
174
|
-
- 注意该方法只会返回竖屏分辨率。
|
|
175
|
-
|
|
176
|
-
```typescript
|
|
177
|
-
function 获取屏幕宽高(): {
|
|
178
|
-
/**
|
|
179
|
-
* 屏幕宽度
|
|
180
|
-
*/
|
|
181
|
-
width: 数字;
|
|
182
|
-
/**
|
|
183
|
-
* 屏幕高度
|
|
184
|
-
*/
|
|
185
|
-
height: 数字;
|
|
186
|
-
};
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
**返回值:**
|
|
190
|
-
|
|
191
|
-
| 参数名 | 类型 | 描述 |
|
|
192
|
-
| -------- | ---- | ---------------- |
|
|
193
|
-
| `width` | 数字 | 屏幕宽度(像素) |
|
|
194
|
-
| `height` | 数字 | 屏幕高度(像素) |
|
|
195
|
-
|
|
196
|
-
**示例:**
|
|
197
|
-
|
|
198
|
-
```typescript
|
|
199
|
-
// 获取屏幕尺寸
|
|
200
|
-
const screenSize = $设备.获取屏幕宽高();
|
|
201
|
-
$打印信息日志(`屏幕尺寸: ${screenSize.width} x ${screenSize.height}`);
|
|
202
|
-
```
|
|
203
|
-
|
|
204
169
|
### 获取屏幕实际宽高
|
|
205
170
|
|
|
206
171
|
**注意事项:**
|
package/docs/apicn/global.md
CHANGED
|
@@ -308,55 +308,6 @@ $APP切入前台();
|
|
|
308
308
|
$打印信息日志("应用已切换到前台");
|
|
309
309
|
```
|
|
310
310
|
|
|
311
|
-
### $设置 Agent 快速模式
|
|
312
|
-
|
|
313
|
-
设置 Agent 快速模式(兼容旧接口)。开启对应模式 `1`,关闭对应模式 `0`。推荐改用 `$设置Agent触控模式`。设置会持久化。
|
|
314
|
-
|
|
315
|
-
```typescript
|
|
316
|
-
declare function $设置Agent快速模式(是否开启: 布尔值): 布尔值;
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
**参数:**
|
|
320
|
-
|
|
321
|
-
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
322
|
-
| ---------- | -------- | -------- | ------ | ---------------- |
|
|
323
|
-
| `是否开启` | `布尔值` | 是 | - | 是否开启快速模式 |
|
|
324
|
-
|
|
325
|
-
**返回值:**
|
|
326
|
-
|
|
327
|
-
| 类型 | 描述 |
|
|
328
|
-
| -------- | -------------------- |
|
|
329
|
-
| `布尔值` | 实际是否开启快速模式 |
|
|
330
|
-
|
|
331
|
-
**示例:**
|
|
332
|
-
|
|
333
|
-
```javascript
|
|
334
|
-
const 是否开启 = $设置Agent快速模式(true);
|
|
335
|
-
$打印信息日志(`Agent 快速模式: ${是否开启}`);
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
### $获取 Agent 快速模式
|
|
339
|
-
|
|
340
|
-
获取 Agent 快速模式当前状态(兼容旧接口)。
|
|
341
|
-
|
|
342
|
-
```typescript
|
|
343
|
-
declare function $获取Agent快速模式(): 布尔值;
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
**返回值:**
|
|
347
|
-
|
|
348
|
-
| 类型 | 描述 |
|
|
349
|
-
| -------- | -------------------- |
|
|
350
|
-
| `布尔值` | 当前是否开启快速模式 |
|
|
351
|
-
|
|
352
|
-
**示例:**
|
|
353
|
-
|
|
354
|
-
```javascript
|
|
355
|
-
if ($获取Agent快速模式()) {
|
|
356
|
-
$打印信息日志("Agent 快速模式已开启");
|
|
357
|
-
}
|
|
358
|
-
```
|
|
359
|
-
|
|
360
311
|
### $设置 Agent 触控模式
|
|
361
312
|
|
|
362
313
|
设置 Agent 触控模式。默认 `1`,设置会持久化。
|
package/docs/apilua/device.md
CHANGED
|
@@ -168,33 +168,6 @@ print("设备型号: " .. tostring(model))
|
|
|
168
168
|
|
|
169
169
|
## 屏幕信息
|
|
170
170
|
|
|
171
|
-
### getScreenSize - 获取屏幕尺寸(缩放后的)。
|
|
172
|
-
|
|
173
|
-
**注意事项:**
|
|
174
|
-
|
|
175
|
-
- 该方法返回的屏幕尺寸是根据当前设备的屏幕分辨率除以缩放比例计算得到的。
|
|
176
|
-
- 注意该方法只会返回竖屏分辨率。
|
|
177
|
-
|
|
178
|
-
```lua
|
|
179
|
-
---@return any
|
|
180
|
-
function getScreenSize() end
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
**返回值:**
|
|
184
|
-
|
|
185
|
-
| 参数名 | 类型 | 描述 |
|
|
186
|
-
| -------- | ------ | ---------------- |
|
|
187
|
-
| `width` | number | 屏幕宽度(像素) |
|
|
188
|
-
| `height` | number | 屏幕高度(像素) |
|
|
189
|
-
|
|
190
|
-
**示例:**
|
|
191
|
-
|
|
192
|
-
```lua
|
|
193
|
-
-- 获取屏幕尺寸
|
|
194
|
-
local screenSize = device.getScreenSize()
|
|
195
|
-
print("屏幕尺寸: " .. tostring(screenSize.width) .. " x " .. tostring(screenSize.height))
|
|
196
|
-
```
|
|
197
|
-
|
|
198
171
|
### getScreenRealSize - 获取屏幕实际尺寸。
|
|
199
172
|
|
|
200
173
|
**注意事项:**
|
package/docs/apilua/global.md
CHANGED
|
@@ -248,58 +248,6 @@ TakeMeToFront()
|
|
|
248
248
|
print("应用已切换到前台")
|
|
249
249
|
```
|
|
250
250
|
|
|
251
|
-
### SetAgentFastMode
|
|
252
|
-
|
|
253
|
-
设置 Agent 快速模式(兼容旧接口)。开启对应模式 `1`,关闭对应模式 `0`。推荐改用 `SetAgentTouchMode`。设置会持久化。
|
|
254
|
-
|
|
255
|
-
```lua
|
|
256
|
-
---@param enabled boolean
|
|
257
|
-
---@return boolean
|
|
258
|
-
function SetAgentFastMode(enabled) end
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
**参数:**
|
|
262
|
-
|
|
263
|
-
| 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
|
|
264
|
-
| --------- | --------- | -------- | ------ | ---------------- |
|
|
265
|
-
| `enabled` | `boolean` | 是 | - | 是否开启快速模式 |
|
|
266
|
-
|
|
267
|
-
**返回值:**
|
|
268
|
-
|
|
269
|
-
| 类型 | 描述 |
|
|
270
|
-
| --------- | -------------------- |
|
|
271
|
-
| `boolean` | 实际是否开启快速模式 |
|
|
272
|
-
|
|
273
|
-
**示例:**
|
|
274
|
-
|
|
275
|
-
```lua
|
|
276
|
-
local enabled = SetAgentFastMode(true)
|
|
277
|
-
print("Agent 快速模式: " .. tostring(enabled))
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
### GetAgentFastMode
|
|
281
|
-
|
|
282
|
-
获取 Agent 快速模式当前状态(兼容旧接口)。
|
|
283
|
-
|
|
284
|
-
```lua
|
|
285
|
-
---@return boolean
|
|
286
|
-
function GetAgentFastMode() end
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
**返回值:**
|
|
290
|
-
|
|
291
|
-
| 类型 | 描述 |
|
|
292
|
-
| --------- | -------------------- |
|
|
293
|
-
| `boolean` | 当前是否开启快速模式 |
|
|
294
|
-
|
|
295
|
-
**示例:**
|
|
296
|
-
|
|
297
|
-
```lua
|
|
298
|
-
if GetAgentFastMode() then
|
|
299
|
-
print("Agent 快速模式已开启")
|
|
300
|
-
end
|
|
301
|
-
```
|
|
302
|
-
|
|
303
251
|
### SetAgentTouchMode
|
|
304
252
|
|
|
305
253
|
设置 Agent 触控模式。默认 `1`,设置会持久化。
|
package/docs/apipython/device.md
CHANGED
|
@@ -170,11 +170,11 @@ print(device.getDeviceModel())
|
|
|
170
170
|
|
|
171
171
|
## 屏幕信息
|
|
172
172
|
|
|
173
|
-
###
|
|
173
|
+
### getScreenRealSize - 获取屏幕实际尺寸。
|
|
174
174
|
|
|
175
175
|
**注意事项:**
|
|
176
176
|
|
|
177
|
-
-
|
|
177
|
+
- 返回实际分辨率;仅返回竖屏分辨率
|
|
178
178
|
|
|
179
179
|
```python
|
|
180
180
|
from kuaijs._types import KuaiJSNamespace
|
|
@@ -183,31 +183,6 @@ class ScreenSize(KuaiJSNamespace):
|
|
|
183
183
|
width: float # 屏幕宽度(像素)
|
|
184
184
|
height: float # 屏幕高度(像素)
|
|
185
185
|
|
|
186
|
-
def getScreenSize() -> ScreenSize:
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
**返回值:**
|
|
190
|
-
|
|
191
|
-
| 参数名 | 类型 | 描述 |
|
|
192
|
-
| -------- | ----- | ---------------- |
|
|
193
|
-
| `width` | float | 屏幕宽度(像素) |
|
|
194
|
-
| `height` | float | 屏幕高度(像素) |
|
|
195
|
-
|
|
196
|
-
**示例:**
|
|
197
|
-
|
|
198
|
-
```python
|
|
199
|
-
from kuaijs import device
|
|
200
|
-
size = device.getScreenSize()
|
|
201
|
-
print(f"屏幕尺寸: {size.width} x {size.height}")
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### getScreenRealSize - 获取屏幕实际尺寸。
|
|
205
|
-
|
|
206
|
-
**注意事项:**
|
|
207
|
-
|
|
208
|
-
- 返回实际分辨率;仅返回竖屏分辨率
|
|
209
|
-
|
|
210
|
-
```python
|
|
211
186
|
def getScreenRealSize() -> ScreenSize:
|
|
212
187
|
```
|
|
213
188
|
|
package/docs/apipython/g.md
CHANGED
|
@@ -55,53 +55,6 @@ from kuaijs import g
|
|
|
55
55
|
g.takeMeToFront()
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
#### `setAgentFastMode` - 设置 Agent 快速模式(兼容)
|
|
59
|
-
|
|
60
|
-
兼容旧接口:开启对应模式 `1`,关闭对应模式 `0`。推荐改用 `setAgentTouchMode`。设置会持久化。
|
|
61
|
-
|
|
62
|
-
```python
|
|
63
|
-
def setAgentFastMode(enabled: bool) -> bool
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
**参数:**
|
|
67
|
-
| 参数 | 类型 | 必需 | 默认值 | 描述 |
|
|
68
|
-
| ---- | ---- | ---- | ------ | ---- |
|
|
69
|
-
| `enabled` | bool | 是 | - | 是否开启快速模式 |
|
|
70
|
-
|
|
71
|
-
**返回值:**
|
|
72
|
-
|
|
73
|
-
- `bool` 实际是否开启快速模式
|
|
74
|
-
|
|
75
|
-
**示例:**
|
|
76
|
-
|
|
77
|
-
```python
|
|
78
|
-
from kuaijs import g
|
|
79
|
-
|
|
80
|
-
enabled = g.setAgentFastMode(True)
|
|
81
|
-
print(f"Agent 快速模式: {enabled}")
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
#### `getAgentFastMode` - 获取 Agent 快速模式(兼容)
|
|
85
|
-
|
|
86
|
-
获取 Agent 快速模式当前状态。
|
|
87
|
-
|
|
88
|
-
```python
|
|
89
|
-
def getAgentFastMode() -> bool
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
**返回值:**
|
|
93
|
-
|
|
94
|
-
- `bool` 当前是否开启快速模式
|
|
95
|
-
|
|
96
|
-
**示例:**
|
|
97
|
-
|
|
98
|
-
```python
|
|
99
|
-
from kuaijs import g
|
|
100
|
-
|
|
101
|
-
if g.getAgentFastMode():
|
|
102
|
-
print("Agent 快速模式已开启")
|
|
103
|
-
```
|
|
104
|
-
|
|
105
58
|
#### `setAgentTouchMode` - 设置 Agent 触控模式
|
|
106
59
|
|
|
107
60
|
默认 `1`,设置会持久化。
|