@holoscript/core 6.0.3 → 7.0.0
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/README.md +40 -40
- package/dist/codebase/index.d.ts +25 -0
- package/dist/compiler/index.d.ts +82 -0
- package/dist/constants.d.ts +4 -0
- package/dist/coordinators/index.d.ts +189 -0
- package/dist/entries/interop.d.ts +9 -0
- package/dist/entries/scripting.d.ts +7 -0
- package/dist/index.d.ts +520 -19
- package/dist/paper-0c-spike/index.d.ts +29 -0
- package/dist/reconstruction/index.d.ts +78 -0
- package/dist/self-improvement/index.d.ts +0 -48
- package/dist/storage/index.d.ts +24 -0
- package/dist/tools/index.d.ts +33 -0
- package/dist/traitDocs/traitDocs.d.ts +69 -0
- package/dist/traits/index.d.ts +61 -0
- package/package.json +102 -19
- package/dist/GLTFPipeline-3KLWWUQO.cjs +0 -34
- package/dist/GLTFPipeline-LYII2ZVQ.js +0 -13
- package/dist/HoloScriptPlusParser-BZR5DELQ.js +0 -692
- package/dist/HoloScriptPlusParser-SBMYDNXO.cjs +0 -697
- package/dist/USDZExporter-MHEHXZB4.cjs +0 -709
- package/dist/USDZExporter-YA55ZS35.js +0 -707
- package/dist/chunk-26TLYBFD.js +0 -309
- package/dist/chunk-27LWW5FU.cjs +0 -410
- package/dist/chunk-2UX5LRAP.cjs +0 -833
- package/dist/chunk-32TWR3HE.js +0 -70
- package/dist/chunk-3FXV5S25.cjs +0 -633
- package/dist/chunk-3FYZOR7S.cjs +0 -69
- package/dist/chunk-3KEU5QYY.cjs +0 -175
- package/dist/chunk-4FCZDTD5.js +0 -610
- package/dist/chunk-4KJ2R7VP.cjs +0 -507
- package/dist/chunk-4SMUJFHL.js +0 -1213
- package/dist/chunk-54FHG2MX.js +0 -655
- package/dist/chunk-56IF4NTA.js +0 -56
- package/dist/chunk-5GLCTO44.js +0 -161
- package/dist/chunk-5TOFIR6L.js +0 -407
- package/dist/chunk-65RFOWZI.js +0 -765
- package/dist/chunk-6OQBLABR.js +0 -5240
- package/dist/chunk-6WNCRE6F.js +0 -126
- package/dist/chunk-74YCHHTE.js +0 -1872
- package/dist/chunk-7H5UNJZD.cjs +0 -1973
- package/dist/chunk-7KPI4EKH.cjs +0 -701
- package/dist/chunk-7LCYLPW2.cjs +0 -663
- package/dist/chunk-7N3JIJMT.js +0 -1395
- package/dist/chunk-7X2IEJIE.cjs +0 -2526
- package/dist/chunk-A6GO3DPZ.cjs +0 -1002
- package/dist/chunk-AC4BSHFV.js +0 -765
- package/dist/chunk-AIUXRS74.cjs +0 -3681
- package/dist/chunk-ARNKA274.cjs +0 -130
- package/dist/chunk-AW7WAELW.js +0 -975
- package/dist/chunk-BKIGPPVM.js +0 -629
- package/dist/chunk-BO2OKHIY.js +0 -6055
- package/dist/chunk-BU5ZAFMC.js +0 -115
- package/dist/chunk-BY3B7ZYV.cjs +0 -457
- package/dist/chunk-C2QHVHZF.js +0 -4066
- package/dist/chunk-C7BNX4XJ.js +0 -1043
- package/dist/chunk-CLYEIWA5.cjs +0 -408
- package/dist/chunk-CMYAWUX3.js +0 -4455
- package/dist/chunk-CN4NOESF.cjs +0 -416
- package/dist/chunk-CNVM7J3M.js +0 -883
- package/dist/chunk-CO2VM2DK.js +0 -1965
- package/dist/chunk-CQDOF3G7.cjs +0 -1404
- package/dist/chunk-DH5G2JUA.cjs +0 -614
- package/dist/chunk-DIEDKX5B.cjs +0 -660
- package/dist/chunk-DN7UFU63.cjs +0 -172
- package/dist/chunk-DXVCEFZB.js +0 -2027
- package/dist/chunk-EGIZHYJP.cjs +0 -85
- package/dist/chunk-EJA7G2C4.cjs +0 -428
- package/dist/chunk-ELLQPFAF.js +0 -830
- package/dist/chunk-EMO7HAKJ.cjs +0 -1875
- package/dist/chunk-ENV7K6XA.js +0 -282
- package/dist/chunk-EPWRXL6S.js +0 -2522
- package/dist/chunk-EUFLX2PI.js +0 -56956
- package/dist/chunk-F5LVGHNT.js +0 -449
- package/dist/chunk-FEFHPUEM.cjs +0 -6122
- package/dist/chunk-FF3Q7ADR.js +0 -380
- package/dist/chunk-GC3YU46J.js +0 -762
- package/dist/chunk-H6WMMLQK.cjs +0 -4492
- package/dist/chunk-H7XMORZI.js +0 -2731
- package/dist/chunk-HAN4V3PF.cjs +0 -2037
- package/dist/chunk-HBZYCASG.js +0 -4208
- package/dist/chunk-HF4OFY25.cjs +0 -4097
- package/dist/chunk-HHS6FMOU.cjs +0 -3813
- package/dist/chunk-HJJLD366.js +0 -1169
- package/dist/chunk-HKCVM6OK.cjs +0 -2237
- package/dist/chunk-HUFNKFA6.js +0 -698
- package/dist/chunk-I3XGTIHM.cjs +0 -1505
- package/dist/chunk-I6XZ5DZF.cjs +0 -488
- package/dist/chunk-IHOUYQIA.js +0 -406
- package/dist/chunk-ILRBGFVD.cjs +0 -72
- package/dist/chunk-KDB6BUMB.js +0 -3666
- package/dist/chunk-KUJRR4FJ.js +0 -657
- package/dist/chunk-KYM4XRFG.js +0 -421
- package/dist/chunk-L3Z2HIWJ.cjs +0 -793
- package/dist/chunk-LBPEZQAF.js +0 -2232
- package/dist/chunk-LER4WXW5.cjs +0 -286
- package/dist/chunk-LK5IAVH6.cjs +0 -1173
- package/dist/chunk-M6FU6S22.js +0 -2911
- package/dist/chunk-MWEFR6YQ.js +0 -1857
- package/dist/chunk-N5FTS757.cjs +0 -415
- package/dist/chunk-NCUHGRTZ.js +0 -752
- package/dist/chunk-NKRKT6V2.js +0 -69
- package/dist/chunk-NLPSZT4C.js +0 -630
- package/dist/chunk-NRUB55IT.cjs +0 -771
- package/dist/chunk-NTMZSDXM.cjs +0 -633
- package/dist/chunk-ODGMVILH.js +0 -9662
- package/dist/chunk-PBA6NXCT.cjs +0 -1216
- package/dist/chunk-PHENW4MQ.js +0 -65
- package/dist/chunk-PJMOXFPR.cjs +0 -1861
- package/dist/chunk-PLMYCCA4.js +0 -504
- package/dist/chunk-PPULB4GG.cjs +0 -9728
- package/dist/chunk-PQLGZKMC.cjs +0 -755
- package/dist/chunk-Q56TT7IL.js +0 -483
- package/dist/chunk-QHVVVN47.cjs +0 -2033
- package/dist/chunk-QWKUKVRE.js +0 -2026
- package/dist/chunk-RE3OKSYF.cjs +0 -424
- package/dist/chunk-RT7LJRSF.cjs +0 -57378
- package/dist/chunk-SPDELRRV.cjs +0 -319
- package/dist/chunk-SUCBB66F.js +0 -229
- package/dist/chunk-TSWTWZ42.cjs +0 -4214
- package/dist/chunk-UITWA6DV.cjs +0 -2829
- package/dist/chunk-UQW6SLM5.js +0 -172
- package/dist/chunk-V2ILLPHK.cjs +0 -237
- package/dist/chunk-V42NTCFH.js +0 -3645
- package/dist/chunk-VJ3L7CHT.cjs +0 -169
- package/dist/chunk-VJVCD5T5.cjs +0 -769
- package/dist/chunk-VK5AXKO3.js +0 -746
- package/dist/chunk-VSXOIUCF.cjs +0 -473
- package/dist/chunk-VZNKJZTT.cjs +0 -749
- package/dist/chunk-W76ETJTI.js +0 -678
- package/dist/chunk-WFJIDI2N.cjs +0 -424
- package/dist/chunk-WN3YF33G.cjs +0 -118
- package/dist/chunk-WUXIRGZP.cjs +0 -2915
- package/dist/chunk-WYH4GVZ5.js +0 -1488
- package/dist/chunk-X4YVN7H3.cjs +0 -888
- package/dist/chunk-X67XRI2T.js +0 -410
- package/dist/chunk-XDXZM3ZP.cjs +0 -1046
- package/dist/chunk-XH7SE4HH.cjs +0 -72
- package/dist/chunk-XNMEH2BI.js +0 -126
- package/dist/chunk-XSF76QRU.js +0 -468
- package/dist/chunk-XSUZMPVQ.cjs +0 -682
- package/dist/chunk-XUILI4KB.cjs +0 -430
- package/dist/chunk-Y5MUAYTO.js +0 -167
- package/dist/chunk-Y7VK5TH3.cjs +0 -129
- package/dist/chunk-YCMQQQ5U.cjs +0 -5244
- package/dist/chunk-YYXH45E2.js +0 -426
- package/dist/chunk-ZGTGVSTZ.js +0 -422
- package/dist/chunk-ZL6VJ6SN.js +0 -421
- package/dist/cli/holoscript-runner.cjs +0 -2258
- package/dist/cli/holoscript-runner.js +0 -2233
- package/dist/codebase/index.cjs +0 -336
- package/dist/codebase/index.js +0 -331
- package/dist/compiler/agent-inference.cjs +0 -29
- package/dist/compiler/agent-inference.js +0 -6
- package/dist/compiler/android-xr.cjs +0 -20
- package/dist/compiler/android-xr.js +0 -10
- package/dist/compiler/android.cjs +0 -21
- package/dist/compiler/android.js +0 -11
- package/dist/compiler/ar.cjs +0 -21
- package/dist/compiler/ar.js +0 -9
- package/dist/compiler/babylon.cjs +0 -18
- package/dist/compiler/babylon.js +0 -12
- package/dist/compiler/coco.cjs +0 -27
- package/dist/compiler/coco.js +0 -4
- package/dist/compiler/domain-block-utils.cjs +0 -595
- package/dist/compiler/domain-block-utils.js +0 -9
- package/dist/compiler/dtdl.cjs +0 -25
- package/dist/compiler/dtdl.js +0 -9
- package/dist/compiler/gltf-pipeline.cjs +0 -39
- package/dist/compiler/gltf-pipeline.js +0 -4
- package/dist/compiler/godot.cjs +0 -16
- package/dist/compiler/godot.js +0 -10
- package/dist/compiler/incremental.cjs +0 -30
- package/dist/compiler/incremental.js +0 -5
- package/dist/compiler/index.cjs +0 -1522
- package/dist/compiler/index.js +0 -1321
- package/dist/compiler/ios.cjs +0 -21
- package/dist/compiler/ios.js +0 -11
- package/dist/compiler/multi-layer.cjs +0 -27
- package/dist/compiler/multi-layer.js +0 -12
- package/dist/compiler/nodetoy.cjs +0 -23
- package/dist/compiler/nodetoy.js +0 -4
- package/dist/compiler/openxr.cjs +0 -16
- package/dist/compiler/openxr.js +0 -10
- package/dist/compiler/playcanvas.cjs +0 -17
- package/dist/compiler/playcanvas.js +0 -11
- package/dist/compiler/r3f.cjs +0 -35
- package/dist/compiler/r3f.js +0 -13
- package/dist/compiler/remotion.cjs +0 -23
- package/dist/compiler/remotion.js +0 -4
- package/dist/compiler/reproducibility.cjs +0 -39
- package/dist/compiler/reproducibility.js +0 -4
- package/dist/compiler/sdf.cjs +0 -22
- package/dist/compiler/sdf.js +0 -10
- package/dist/compiler/semantic-scene.cjs +0 -31
- package/dist/compiler/semantic-scene.js +0 -4
- package/dist/compiler/state.cjs +0 -18
- package/dist/compiler/state.js +0 -8
- package/dist/compiler/trait-composition.cjs +0 -27
- package/dist/compiler/trait-composition.js +0 -6
- package/dist/compiler/unity.cjs +0 -16
- package/dist/compiler/unity.js +0 -10
- package/dist/compiler/unreal.cjs +0 -20
- package/dist/compiler/unreal.js +0 -10
- package/dist/compiler/urdf.cjs +0 -46
- package/dist/compiler/urdf.js +0 -10
- package/dist/compiler/usd-physics.cjs +0 -24
- package/dist/compiler/usd-physics.js +0 -7
- package/dist/compiler/visionos.cjs +0 -16
- package/dist/compiler/visionos.js +0 -10
- package/dist/compiler/vrchat.cjs +0 -20
- package/dist/compiler/vrchat.js +0 -10
- package/dist/compiler/vrr.cjs +0 -22
- package/dist/compiler/vrr.js +0 -10
- package/dist/compiler/wasm.cjs +0 -34
- package/dist/compiler/wasm.js +0 -10
- package/dist/compiler/webgpu.cjs +0 -16
- package/dist/compiler/webgpu.js +0 -10
- package/dist/debugger.cjs +0 -21
- package/dist/debugger.js +0 -8
- package/dist/entries/interop.cjs +0 -62
- package/dist/entries/interop.js +0 -5
- package/dist/entries/scripting.cjs +0 -67
- package/dist/entries/scripting.js +0 -10
- package/dist/index.cjs +0 -61703
- package/dist/index.js +0 -58652
- package/dist/math/vec3.cjs +0 -57
- package/dist/math/vec3.js +0 -4
- package/dist/parser.cjs +0 -26
- package/dist/parser.js +0 -9
- package/dist/playwright-7DTEQCBD.cjs +0 -98673
- package/dist/playwright-BIZXMLD2.js +0 -98660
- package/dist/post-quantum-JTTAAGO3.cjs +0 -6
- package/dist/post-quantum-RVPVDEPI.js +0 -4
- package/dist/runtime.cjs +0 -16
- package/dist/runtime.js +0 -7
- package/dist/storage/index.cjs +0 -37
- package/dist/storage/index.js +0 -4
- package/dist/traits/index.cjs +0 -14331
- package/dist/traits/index.js +0 -12126
- package/dist/type-checker.cjs +0 -18
- package/dist/type-checker.js +0 -5
- package/dist/wot/index.cjs +0 -29
- package/dist/wot/index.js +0 -4
package/dist/chunk-7KPI4EKH.cjs
DELETED
|
@@ -1,701 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkHHS6FMOU_cjs = require('./chunk-HHS6FMOU.cjs');
|
|
4
|
-
var chunkQHVVVN47_cjs = require('./chunk-QHVVVN47.cjs');
|
|
5
|
-
var chunkEGIZHYJP_cjs = require('./chunk-EGIZHYJP.cjs');
|
|
6
|
-
|
|
7
|
-
// src/compiler/UnityCompiler.ts
|
|
8
|
-
var UnityCompiler_exports = {};
|
|
9
|
-
chunkEGIZHYJP_cjs.__export(UnityCompiler_exports, {
|
|
10
|
-
UnityCompiler: () => exports.UnityCompiler
|
|
11
|
-
});
|
|
12
|
-
exports.UnityCompiler = void 0;
|
|
13
|
-
var init_UnityCompiler = chunkEGIZHYJP_cjs.__esm({
|
|
14
|
-
"src/compiler/UnityCompiler.ts"() {
|
|
15
|
-
chunkQHVVVN47_cjs.init_CompilerBase();
|
|
16
|
-
chunkQHVVVN47_cjs.init_ANSNamespace();
|
|
17
|
-
chunkHHS6FMOU_cjs.init_DomainBlockCompilerMixin();
|
|
18
|
-
exports.UnityCompiler = class extends chunkQHVVVN47_cjs.CompilerBase {
|
|
19
|
-
constructor(options = {}) {
|
|
20
|
-
super();
|
|
21
|
-
this.compilerName = "UnityCompiler";
|
|
22
|
-
this.lines = [];
|
|
23
|
-
this.indentLevel = 0;
|
|
24
|
-
this.options = {
|
|
25
|
-
namespace: options.namespace || "HoloScene",
|
|
26
|
-
className: options.className || "GeneratedScene",
|
|
27
|
-
useURP: options.useURP ?? true,
|
|
28
|
-
indent: options.indent || " "
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
getRequiredCapability() {
|
|
32
|
-
return chunkQHVVVN47_cjs.ANSCapabilityPath.UNITY;
|
|
33
|
-
}
|
|
34
|
-
compile(composition, agentToken, outputPath) {
|
|
35
|
-
this.validateCompilerAccess(agentToken, outputPath);
|
|
36
|
-
this.lines = [];
|
|
37
|
-
this.indentLevel = 0;
|
|
38
|
-
this.emit("// Auto-generated by HoloScript UnityCompiler");
|
|
39
|
-
this.emit(
|
|
40
|
-
`// Source: composition "${this.escapeStringValue(composition.name, "CSharp")}"`
|
|
41
|
-
);
|
|
42
|
-
this.emit("// Do not edit manually \u2014 regenerate from .holo source");
|
|
43
|
-
this.emit("");
|
|
44
|
-
this.emit("using UnityEngine;");
|
|
45
|
-
this.emit("using UnityEngine.UI;");
|
|
46
|
-
if (composition.timelines?.length) this.emit("using System.Collections;");
|
|
47
|
-
this.emit("");
|
|
48
|
-
this.emit(`namespace ${this.options.namespace}`);
|
|
49
|
-
this.emit("{");
|
|
50
|
-
this.indentLevel++;
|
|
51
|
-
this.emit(`public class ${this.options.className} : MonoBehaviour`);
|
|
52
|
-
this.emit("{");
|
|
53
|
-
this.indentLevel++;
|
|
54
|
-
if (composition.state) {
|
|
55
|
-
this.emit("// === State ===");
|
|
56
|
-
for (const prop of composition.state.properties) {
|
|
57
|
-
const csType = this.toCSharpType(prop.value);
|
|
58
|
-
const csVal = this.toCSharpValue(prop.value);
|
|
59
|
-
this.emit(
|
|
60
|
-
`private ${csType} ${this.escapeStringValue(prop.key, "CSharp")} = ${csVal};`
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
this.emit("");
|
|
64
|
-
}
|
|
65
|
-
this.emit("private void Awake()");
|
|
66
|
-
this.emit("{");
|
|
67
|
-
this.indentLevel++;
|
|
68
|
-
if (composition.environment) {
|
|
69
|
-
this.compileEnvironment(composition.environment);
|
|
70
|
-
}
|
|
71
|
-
if (composition.lights) {
|
|
72
|
-
for (const light of composition.lights) {
|
|
73
|
-
this.compileLight(light);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (composition.camera) {
|
|
77
|
-
this.compileCamera(composition.camera);
|
|
78
|
-
}
|
|
79
|
-
if (composition.objects) {
|
|
80
|
-
for (const obj of composition.objects) {
|
|
81
|
-
this.compileObject(obj, "transform");
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (composition.spatialGroups) {
|
|
85
|
-
for (const group of composition.spatialGroups) {
|
|
86
|
-
this.compileSpatialGroup(group, "transform");
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
if (composition.audio) {
|
|
90
|
-
for (const audio of composition.audio) {
|
|
91
|
-
this.compileAudio(audio);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
if (composition.zones) {
|
|
95
|
-
for (const zone of composition.zones) {
|
|
96
|
-
this.compileZone(zone);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
if (composition.timelines) {
|
|
100
|
-
for (const tl of composition.timelines) {
|
|
101
|
-
if (tl.autoplay) {
|
|
102
|
-
this.emit(`StartCoroutine(${this.sanitizeName(tl.name)}Routine());`);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
this.indentLevel--;
|
|
107
|
-
this.emit("}");
|
|
108
|
-
this.emit("");
|
|
109
|
-
if (composition.timelines) {
|
|
110
|
-
for (const tl of composition.timelines) {
|
|
111
|
-
this.compileTimeline(tl);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (composition.effects) {
|
|
115
|
-
this.compileEffects(composition.effects);
|
|
116
|
-
}
|
|
117
|
-
if (composition.transitions) {
|
|
118
|
-
for (const tr of composition.transitions) {
|
|
119
|
-
this.compileTransition(tr);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (composition.ui) {
|
|
123
|
-
this.compileUI(composition.ui);
|
|
124
|
-
}
|
|
125
|
-
this.compileDomainBlocks(composition);
|
|
126
|
-
this.indentLevel--;
|
|
127
|
-
this.emit("}");
|
|
128
|
-
this.indentLevel--;
|
|
129
|
-
this.emit("}");
|
|
130
|
-
return this.lines.join("\n");
|
|
131
|
-
}
|
|
132
|
-
compileDomainBlocks(composition) {
|
|
133
|
-
const domainBlocks = composition.domainBlocks ?? [];
|
|
134
|
-
if (domainBlocks.length === 0) return;
|
|
135
|
-
this.emit("");
|
|
136
|
-
this.emit("// === v4.2 Domain Blocks ===");
|
|
137
|
-
let blockIdx = 0;
|
|
138
|
-
const compiled = chunkHHS6FMOU_cjs.compileDomainBlocks(
|
|
139
|
-
domainBlocks,
|
|
140
|
-
{
|
|
141
|
-
material: (block) => {
|
|
142
|
-
const mat = chunkHHS6FMOU_cjs.compileMaterialBlock(block);
|
|
143
|
-
const prefix = `db${blockIdx++}`;
|
|
144
|
-
return chunkHHS6FMOU_cjs.materialToUnity(mat, prefix);
|
|
145
|
-
},
|
|
146
|
-
physics: (block) => {
|
|
147
|
-
const phys = chunkHHS6FMOU_cjs.compilePhysicsBlock(block);
|
|
148
|
-
const prefix = `db${blockIdx++}`;
|
|
149
|
-
return chunkHHS6FMOU_cjs.physicsToUnity(phys, prefix);
|
|
150
|
-
},
|
|
151
|
-
vfx: (block) => {
|
|
152
|
-
const ps = chunkHHS6FMOU_cjs.compileParticleBlock(block);
|
|
153
|
-
const prefix = `db${blockIdx++}`;
|
|
154
|
-
return chunkHHS6FMOU_cjs.particlesToUnity(ps, prefix);
|
|
155
|
-
},
|
|
156
|
-
postfx: (block) => {
|
|
157
|
-
const pp = chunkHHS6FMOU_cjs.compilePostProcessingBlock(block);
|
|
158
|
-
return chunkHHS6FMOU_cjs.postProcessingToUnity(pp);
|
|
159
|
-
},
|
|
160
|
-
audio: (block) => {
|
|
161
|
-
const audio = chunkHHS6FMOU_cjs.compileAudioSourceBlock(block);
|
|
162
|
-
const prefix = `db${blockIdx++}`;
|
|
163
|
-
return chunkHHS6FMOU_cjs.audioSourceToUnity(audio, prefix);
|
|
164
|
-
},
|
|
165
|
-
weather: (block) => {
|
|
166
|
-
const weather = chunkHHS6FMOU_cjs.compileWeatherBlock(block);
|
|
167
|
-
return chunkHHS6FMOU_cjs.weatherToUnity(weather);
|
|
168
|
-
},
|
|
169
|
-
narrative: (block) => {
|
|
170
|
-
const narr = chunkHHS6FMOU_cjs.compileNarrativeBlock(block);
|
|
171
|
-
return chunkHHS6FMOU_cjs.narrativeToUnity(narr);
|
|
172
|
-
},
|
|
173
|
-
payment: (block) => {
|
|
174
|
-
const pay = chunkHHS6FMOU_cjs.compilePaymentBlock(block);
|
|
175
|
-
return chunkHHS6FMOU_cjs.paymentToUnity(pay);
|
|
176
|
-
},
|
|
177
|
-
healthcare: (block) => {
|
|
178
|
-
const h = chunkHHS6FMOU_cjs.compileHealthcareBlock(block);
|
|
179
|
-
return chunkHHS6FMOU_cjs.healthcareToUnity(h);
|
|
180
|
-
},
|
|
181
|
-
robotics: (block) => {
|
|
182
|
-
const r = chunkHHS6FMOU_cjs.compileRoboticsBlock(block);
|
|
183
|
-
return chunkHHS6FMOU_cjs.roboticsToUnity(r);
|
|
184
|
-
},
|
|
185
|
-
iot: (block) => chunkHHS6FMOU_cjs.iotToUnity(chunkHHS6FMOU_cjs.compileIoTBlock(block)),
|
|
186
|
-
dataviz: (block) => chunkHHS6FMOU_cjs.datavizToUnity(chunkHHS6FMOU_cjs.compileDataVizBlock(block)),
|
|
187
|
-
education: (block) => chunkHHS6FMOU_cjs.educationToUnity(chunkHHS6FMOU_cjs.compileEducationBlock(block)),
|
|
188
|
-
music: (block) => chunkHHS6FMOU_cjs.musicToUnity(chunkHHS6FMOU_cjs.compileMusicBlock(block)),
|
|
189
|
-
architecture: (block) => chunkHHS6FMOU_cjs.architectureToUnity(chunkHHS6FMOU_cjs.compileArchitectureBlock(block)),
|
|
190
|
-
web3: (block) => chunkHHS6FMOU_cjs.web3ToUnity(chunkHHS6FMOU_cjs.compileWeb3Block(block)),
|
|
191
|
-
procedural: (block) => chunkHHS6FMOU_cjs.proceduralToUnity(chunkHHS6FMOU_cjs.compileProceduralBlock(block)),
|
|
192
|
-
rendering: (block) => chunkHHS6FMOU_cjs.renderingToUnity(chunkHHS6FMOU_cjs.compileRenderingBlock(block)),
|
|
193
|
-
navigation: (block) => chunkHHS6FMOU_cjs.navigationToUnity(chunkHHS6FMOU_cjs.compileNavigationBlock(block)),
|
|
194
|
-
input: (block) => chunkHHS6FMOU_cjs.inputToUnity(chunkHHS6FMOU_cjs.compileInputBlock(block))
|
|
195
|
-
},
|
|
196
|
-
(block) => `// Domain block: ${block.domain}/${block.keyword} "${this.escapeStringValue(block.name, "CSharp")}"`
|
|
197
|
-
);
|
|
198
|
-
for (const line of compiled) {
|
|
199
|
-
for (const l of line.split("\n")) {
|
|
200
|
-
this.emit(l);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
compileEnvironment(env) {
|
|
205
|
-
this.emit("// === Environment ===");
|
|
206
|
-
for (const prop of env.properties) {
|
|
207
|
-
if (prop.key === "preset" || prop.key === "skybox") {
|
|
208
|
-
this.emit(`RenderSettings.skybox = Resources.Load<Material>("Skybox/${prop.value}");`);
|
|
209
|
-
} else if (prop.key === "fog" && typeof prop.value === "object") {
|
|
210
|
-
const fog = prop.value;
|
|
211
|
-
this.emit("RenderSettings.fog = true;");
|
|
212
|
-
if (fog.color) this.emit(`RenderSettings.fogColor = ${this.toColor(fog.color)};`);
|
|
213
|
-
if (fog.near !== void 0) this.emit(`RenderSettings.fogStartDistance = ${fog.near}f;`);
|
|
214
|
-
if (fog.far !== void 0) this.emit(`RenderSettings.fogEndDistance = ${fog.far}f;`);
|
|
215
|
-
} else if (prop.key === "ambient_light") {
|
|
216
|
-
this.emit(`RenderSettings.ambientIntensity = ${prop.value}f;`);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
this.emit("");
|
|
220
|
-
}
|
|
221
|
-
compileLight(light) {
|
|
222
|
-
const varName = this.sanitizeName(light.name);
|
|
223
|
-
this.emit(`// Light: ${this.escapeStringValue(light.name, "CSharp")}`);
|
|
224
|
-
this.emit(
|
|
225
|
-
`var ${varName}GO = new GameObject("${this.escapeStringValue(light.name, "CSharp")}");`
|
|
226
|
-
);
|
|
227
|
-
this.emit(`${varName}GO.transform.SetParent(transform);`);
|
|
228
|
-
this.emit(`var ${varName} = ${varName}GO.AddComponent<Light>();`);
|
|
229
|
-
const typeMap = {
|
|
230
|
-
directional: "LightType.Directional",
|
|
231
|
-
point: "LightType.Point",
|
|
232
|
-
spot: "LightType.Spot",
|
|
233
|
-
area: "LightType.Area"
|
|
234
|
-
};
|
|
235
|
-
this.emit(`${varName}.type = ${typeMap[light.lightType] || "LightType.Directional"};`);
|
|
236
|
-
for (const prop of light.properties) {
|
|
237
|
-
if (prop.key === "color") {
|
|
238
|
-
this.emit(`${varName}.color = ${this.toColor(prop.value)};`);
|
|
239
|
-
} else if (prop.key === "intensity") {
|
|
240
|
-
this.emit(`${varName}.intensity = ${prop.value}f;`);
|
|
241
|
-
} else if (prop.key === "position" && Array.isArray(prop.value)) {
|
|
242
|
-
this.emit(`${varName}GO.transform.position = ${this.toVector3(prop.value)};`);
|
|
243
|
-
} else if (prop.key === "cast_shadow" || prop.key === "castShadow") {
|
|
244
|
-
this.emit(
|
|
245
|
-
`${varName}.shadows = ${prop.value ? "LightShadows.Soft" : "LightShadows.None"};`
|
|
246
|
-
);
|
|
247
|
-
} else if (prop.key === "angle") {
|
|
248
|
-
this.emit(`${varName}.spotAngle = ${prop.value * (180 / Math.PI)}f;`);
|
|
249
|
-
} else if (prop.key === "distance") {
|
|
250
|
-
this.emit(`${varName}.range = ${prop.value}f;`);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
this.emit("");
|
|
254
|
-
}
|
|
255
|
-
compileCamera(camera) {
|
|
256
|
-
this.emit("// === Camera ===");
|
|
257
|
-
this.emit("var cam = Camera.main;");
|
|
258
|
-
this.emit(`cam.fieldOfView = ${this.findProp(camera.properties, "fov") || 60}f;`);
|
|
259
|
-
const pos = this.findProp(camera.properties, "position");
|
|
260
|
-
if (pos) this.emit(`cam.transform.position = ${this.toVector3(pos)};`);
|
|
261
|
-
const lookAt = this.findProp(camera.properties, "look_at") || this.findProp(camera.properties, "lookAt");
|
|
262
|
-
if (lookAt) this.emit(`cam.transform.LookAt(${this.toVector3(lookAt)});`);
|
|
263
|
-
const near = this.findProp(camera.properties, "near");
|
|
264
|
-
if (near) this.emit(`cam.nearClipPlane = ${near}f;`);
|
|
265
|
-
const far = this.findProp(camera.properties, "far");
|
|
266
|
-
if (far) this.emit(`cam.farClipPlane = ${far}f;`);
|
|
267
|
-
this.emit("");
|
|
268
|
-
}
|
|
269
|
-
compileObject(obj, parentVar) {
|
|
270
|
-
const varName = this.sanitizeName(obj.name);
|
|
271
|
-
const meshType = this.findObjProp(obj, "geometry") || this.findObjProp(obj, "mesh") || this.findObjProp(obj, "type") || "cube";
|
|
272
|
-
const isText = meshType === "text";
|
|
273
|
-
const isSparkles = meshType === "sparkles";
|
|
274
|
-
const isModel = meshType === "model" || !!this.findObjProp(obj, "model") || !!this.findObjProp(obj, "src") || !!this.findObjProp(obj, "source");
|
|
275
|
-
this.emit(`// Object: ${this.escapeStringValue(obj.name, "CSharp")}`);
|
|
276
|
-
if (isText) {
|
|
277
|
-
this.emit(
|
|
278
|
-
`var ${varName}GO = new GameObject("${this.escapeStringValue(obj.name, "CSharp")}");`
|
|
279
|
-
);
|
|
280
|
-
this.emit(`${varName}GO.transform.SetParent(${parentVar});`);
|
|
281
|
-
this.emit(`var ${varName}TM = ${varName}GO.AddComponent<TextMesh>();`);
|
|
282
|
-
const text = this.findObjProp(obj, "text");
|
|
283
|
-
if (text) this.emit(`${varName}TM.text = "${text}";`);
|
|
284
|
-
const fontSize = this.findObjProp(obj, "font_size");
|
|
285
|
-
if (fontSize) this.emit(`${varName}TM.fontSize = ${Math.round(fontSize * 100)};`);
|
|
286
|
-
const color = this.findObjProp(obj, "color");
|
|
287
|
-
if (color) this.emit(`${varName}TM.color = ${this.toColor(color)};`);
|
|
288
|
-
} else if (isModel) {
|
|
289
|
-
const src = this.findObjProp(obj, "model") || this.findObjProp(obj, "src") || this.findObjProp(obj, "source");
|
|
290
|
-
if (src) {
|
|
291
|
-
this.emit(`var ${varName}GO = Instantiate(Resources.Load<GameObject>("Models/${src}"));`);
|
|
292
|
-
} else {
|
|
293
|
-
this.emit(`// WARNING: geometry "model" without source \u2014 placeholder cube`);
|
|
294
|
-
this.emit(`var ${varName}GO = GameObject.CreatePrimitive(PrimitiveType.Cube);`);
|
|
295
|
-
}
|
|
296
|
-
this.emit(
|
|
297
|
-
`${varName}GO.name = "${this.escapeStringValue(obj.name, "CSharp")}";`
|
|
298
|
-
);
|
|
299
|
-
this.emit(`${varName}GO.transform.SetParent(${parentVar});`);
|
|
300
|
-
} else if (isSparkles) {
|
|
301
|
-
this.emit(
|
|
302
|
-
`// Sparkles: use ParticleSystem for "${this.escapeStringValue(obj.name, "CSharp")}"`
|
|
303
|
-
);
|
|
304
|
-
this.emit(
|
|
305
|
-
`var ${varName}GO = new GameObject("${this.escapeStringValue(obj.name, "CSharp")}");`
|
|
306
|
-
);
|
|
307
|
-
this.emit(`${varName}GO.transform.SetParent(${parentVar});`);
|
|
308
|
-
this.emit(`${varName}GO.AddComponent<ParticleSystem>();`);
|
|
309
|
-
} else {
|
|
310
|
-
const primitiveMap = {
|
|
311
|
-
cube: "PrimitiveType.Cube",
|
|
312
|
-
box: "PrimitiveType.Cube",
|
|
313
|
-
sphere: "PrimitiveType.Sphere",
|
|
314
|
-
cylinder: "PrimitiveType.Cylinder",
|
|
315
|
-
plane: "PrimitiveType.Plane",
|
|
316
|
-
capsule: "PrimitiveType.Capsule"
|
|
317
|
-
};
|
|
318
|
-
const primitive = primitiveMap[meshType] || "PrimitiveType.Cube";
|
|
319
|
-
this.emit(`var ${varName}GO = GameObject.CreatePrimitive(${primitive});`);
|
|
320
|
-
this.emit(
|
|
321
|
-
`${varName}GO.name = "${this.escapeStringValue(obj.name, "CSharp")}";`
|
|
322
|
-
);
|
|
323
|
-
this.emit(`${varName}GO.transform.SetParent(${parentVar});`);
|
|
324
|
-
}
|
|
325
|
-
const pos = this.findObjProp(obj, "position");
|
|
326
|
-
if (pos) this.emit(`${varName}GO.transform.localPosition = ${this.toVector3(pos)};`);
|
|
327
|
-
const rot = this.findObjProp(obj, "rotation");
|
|
328
|
-
if (rot) this.emit(`${varName}GO.transform.localEulerAngles = ${this.toVector3(rot)};`);
|
|
329
|
-
const scale = this.findObjProp(obj, "scale");
|
|
330
|
-
if (scale) this.emit(`${varName}GO.transform.localScale = ${this.toVector3(scale)};`);
|
|
331
|
-
const size = this.findObjProp(obj, "size");
|
|
332
|
-
if (size && !isText) {
|
|
333
|
-
if (Array.isArray(size)) {
|
|
334
|
-
this.emit(`${varName}GO.transform.localScale = ${this.toVector3(size)};`);
|
|
335
|
-
} else {
|
|
336
|
-
this.emit(`${varName}GO.transform.localScale = Vector3.one * ${size}f;`);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
const material = this.findObjProp(obj, "material");
|
|
340
|
-
if (material && typeof material === "object" && !isText && !isModel) {
|
|
341
|
-
this.emit(`var ${varName}Mat = ${varName}GO.GetComponent<Renderer>().material;`);
|
|
342
|
-
const mat = material;
|
|
343
|
-
if (mat.color) this.emit(`${varName}Mat.color = ${this.toColor(mat.color)};`);
|
|
344
|
-
if (mat.roughness !== void 0)
|
|
345
|
-
this.emit(`${varName}Mat.SetFloat("_Smoothness", ${1 - mat.roughness}f);`);
|
|
346
|
-
if (mat.metalness !== void 0)
|
|
347
|
-
this.emit(`${varName}Mat.SetFloat("_Metallic", ${mat.metalness}f);`);
|
|
348
|
-
if (mat.emissive) {
|
|
349
|
-
this.emit(`${varName}Mat.EnableKeyword("_EMISSION");`);
|
|
350
|
-
this.emit(`${varName}Mat.SetColor("_EmissionColor", ${this.toColor(mat.emissive)});`);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
if (obj.traits) {
|
|
354
|
-
for (const trait of obj.traits) {
|
|
355
|
-
if (trait.name === "collidable") {
|
|
356
|
-
this.emit(`// Collider already present from primitive`);
|
|
357
|
-
} else if (trait.name === "physics" || trait.name === "grabbable") {
|
|
358
|
-
this.emit(`var ${varName}RB = ${varName}GO.AddComponent<Rigidbody>();`);
|
|
359
|
-
if (trait.config?.mass) this.emit(`${varName}RB.mass = ${trait.config.mass}f;`);
|
|
360
|
-
} else if (trait.name === "portal") {
|
|
361
|
-
this.emit(
|
|
362
|
-
`// Portal: "${trait.config?.destination}" \u2014 implement via SceneManager.LoadScene()`
|
|
363
|
-
);
|
|
364
|
-
} else if (trait.name === "plane_detection") {
|
|
365
|
-
this.emit(`// @plane_detection \u2014 AR Foundation: ARPlaneManager`);
|
|
366
|
-
this.emit(`// ${varName}GO.AddComponent<UnityEngine.XR.ARFoundation.ARPlaneManager>();`);
|
|
367
|
-
} else if (trait.name === "mesh_detection") {
|
|
368
|
-
this.emit(`// @mesh_detection \u2014 AR Foundation: ARMeshManager`);
|
|
369
|
-
} else if (trait.name === "anchor") {
|
|
370
|
-
this.emit(`// @anchor \u2014 AR Foundation: ARAnchorManager`);
|
|
371
|
-
} else if (trait.name === "persistent_anchor" || trait.name === "shared_anchor") {
|
|
372
|
-
this.emit(
|
|
373
|
-
`// @${this.escapeStringValue(trait.name, "CSharp")} \u2014 Azure Spatial Anchors or AR Foundation`
|
|
374
|
-
);
|
|
375
|
-
} else if (trait.name === "occlusion") {
|
|
376
|
-
this.emit(`// @occlusion \u2014 AR Foundation: AROcclusionManager`);
|
|
377
|
-
} else if (trait.name === "light_estimation") {
|
|
378
|
-
this.emit(
|
|
379
|
-
`// @light_estimation \u2014 AR Foundation: ARCameraManager.requestedLightEstimation`
|
|
380
|
-
);
|
|
381
|
-
} else if (trait.name === "geospatial" || trait.name === "geospatial_anchor" || trait.name === "terrain_anchor" || trait.name === "rooftop_anchor") {
|
|
382
|
-
this.emit(
|
|
383
|
-
`// @${this.escapeStringValue(trait.name, "CSharp")} \u2014 ARCore Geospatial API`
|
|
384
|
-
);
|
|
385
|
-
} else if (trait.name === "cloth") {
|
|
386
|
-
this.emit(`var ${varName}Cloth = ${varName}GO.AddComponent<Cloth>();`);
|
|
387
|
-
if (trait.config?.stiffness)
|
|
388
|
-
this.emit(`${varName}Cloth.stretchingStiffness = ${trait.config.stiffness}f;`);
|
|
389
|
-
if (trait.config?.damping)
|
|
390
|
-
this.emit(`${varName}Cloth.damping = ${trait.config.damping}f;`);
|
|
391
|
-
} else if (trait.name === "wind") {
|
|
392
|
-
this.emit(`var ${varName}Wind = ${varName}GO.AddComponent<WindZone>();`);
|
|
393
|
-
if (trait.config?.strength)
|
|
394
|
-
this.emit(`${varName}Wind.windMain = ${trait.config.strength}f;`);
|
|
395
|
-
if (trait.config?.turbulence)
|
|
396
|
-
this.emit(`${varName}Wind.windTurbulence = ${trait.config.turbulence}f;`);
|
|
397
|
-
} else if (trait.name === "fluid" || trait.name === "soft_body" || trait.name === "rope" || trait.name === "chain" || trait.name === "buoyancy" || trait.name === "destruction") {
|
|
398
|
-
this.emit(
|
|
399
|
-
`// @${this.escapeStringValue(trait.name, "CSharp")} \u2014 custom physics: ${JSON.stringify(trait.config || {})}`
|
|
400
|
-
);
|
|
401
|
-
} else if (trait.name === "reverb_zone") {
|
|
402
|
-
this.emit(`var ${varName}Reverb = ${varName}GO.AddComponent<AudioReverbZone>();`);
|
|
403
|
-
if (trait.config?.decay_time)
|
|
404
|
-
this.emit(`${varName}Reverb.decayTime = ${trait.config.decay_time}f;`);
|
|
405
|
-
} else if (trait.name === "audio_occlusion") {
|
|
406
|
-
this.emit(`${varName}GO.AddComponent<AudioLowPassFilter>();`);
|
|
407
|
-
this.emit(`// @audio_occlusion \u2014 raycast-based low-pass filter`);
|
|
408
|
-
} else if (trait.name === "ambisonics" || trait.name === "hrtf" || trait.name === "audio_portal" || trait.name === "audio_material" || trait.name === "head_tracked_audio") {
|
|
409
|
-
this.emit(
|
|
410
|
-
`// @${this.escapeStringValue(trait.name, "CSharp")} \u2014 spatial audio: ${JSON.stringify(trait.config || {})}`
|
|
411
|
-
);
|
|
412
|
-
} else if (trait.name === "gaussian_splat" || trait.name === "nerf" || trait.name === "volumetric_video" || trait.name === "point_cloud" || trait.name === "photogrammetry") {
|
|
413
|
-
this.emit(
|
|
414
|
-
`// @${this.escapeStringValue(trait.name, "CSharp")} \u2014 volumetric renderer: ${JSON.stringify(trait.config || {})}`
|
|
415
|
-
);
|
|
416
|
-
} else if (trait.name === "eye_tracking") {
|
|
417
|
-
this.emit(`// @eye_tracking \u2014 XR Interaction Toolkit: XREyeInteractor`);
|
|
418
|
-
} else if (trait.name === "hand_tracking") {
|
|
419
|
-
this.emit(`// @hand_tracking \u2014 XR Hands: XRHandTrackingSubsystem`);
|
|
420
|
-
} else if (trait.name === "body_tracking") {
|
|
421
|
-
this.emit(`// @body_tracking \u2014 XR Body Tracking subsystem`);
|
|
422
|
-
} else if (trait.name === "face_tracking") {
|
|
423
|
-
this.emit(`// @face_tracking \u2014 AR Foundation: ARFaceManager`);
|
|
424
|
-
} else if (trait.name === "accessible") {
|
|
425
|
-
this.emit(
|
|
426
|
-
`// @accessible(role: "${trait.config?.role || "generic"}") \u2014 Unity Accessibility`
|
|
427
|
-
);
|
|
428
|
-
} else if (trait.name === "spatial_persona" || trait.name === "shareplay") {
|
|
429
|
-
this.emit(
|
|
430
|
-
`// @${this.escapeStringValue(trait.name, "CSharp")} \u2014 visionOS-specific; use Mirror/Photon for Unity multiplayer`
|
|
431
|
-
);
|
|
432
|
-
} else if (trait.name === "object_tracking") {
|
|
433
|
-
this.emit(`// @object_tracking \u2014 AR Foundation: ARTrackedObjectManager`);
|
|
434
|
-
} else if (trait.name === "scene_reconstruction") {
|
|
435
|
-
this.emit(`// @scene_reconstruction \u2014 AR Foundation: ARMeshManager`);
|
|
436
|
-
} else if (trait.name === "eye_tracked") {
|
|
437
|
-
this.emit(`// @eye_tracked \u2014 XR Interaction Toolkit: XREyeInteractor`);
|
|
438
|
-
} else if (trait.name === "eye_hand_fusion") {
|
|
439
|
-
this.emit(`// @eye_hand_fusion \u2014 combine XREyeInteractor + XRHandInteractorController`);
|
|
440
|
-
} else if (trait.name === "controlnet") {
|
|
441
|
-
const model = trait.config?.model || "canny";
|
|
442
|
-
this.emit(`// @controlnet(model: "${model}") \u2014 route to inference API or Unity Sentis`);
|
|
443
|
-
} else if (trait.name === "ai_texture_gen") {
|
|
444
|
-
const style = trait.config?.style || "photorealistic";
|
|
445
|
-
this.emit(`// @ai_texture_gen(style: "${style}") \u2014 Unity Sentis or external API`);
|
|
446
|
-
} else if (trait.name === "diffusion_realtime") {
|
|
447
|
-
this.emit(`// @diffusion_realtime \u2014 Unity Sentis real-time diffusion pipeline`);
|
|
448
|
-
} else if (trait.name === "ai_upscaling") {
|
|
449
|
-
const factor = trait.config?.factor || 2;
|
|
450
|
-
this.emit(`// @ai_upscaling(${factor}x) \u2014 Unity Sentis super-resolution model`);
|
|
451
|
-
} else if (trait.name === "ai_inpainting") {
|
|
452
|
-
this.emit(`// @ai_inpainting \u2014 Unity Sentis or API-based inpainting`);
|
|
453
|
-
} else if (trait.name === "neural_link" || trait.name === "neural_forge") {
|
|
454
|
-
this.emit(
|
|
455
|
-
`// @${this.escapeStringValue(trait.name, "CSharp")} \u2014 ${JSON.stringify(trait.config || {})}`
|
|
456
|
-
);
|
|
457
|
-
} else if (trait.name === "embedding_search" || trait.name === "ai_npc_brain" || trait.name === "vector_db") {
|
|
458
|
-
this.emit(
|
|
459
|
-
`// @${this.escapeStringValue(trait.name, "CSharp")} \u2014 AI knowledge: use external service or on-device model`
|
|
460
|
-
);
|
|
461
|
-
} else if (trait.name === "vision" || trait.name === "ai_vision") {
|
|
462
|
-
this.emit(
|
|
463
|
-
`// @${this.escapeStringValue(trait.name, "CSharp")} \u2014 Unity Barracuda / Sentis vision model`
|
|
464
|
-
);
|
|
465
|
-
} else if (trait.name === "spatial_awareness") {
|
|
466
|
-
this.emit(`// @spatial_awareness \u2014 AR Foundation scene understanding`);
|
|
467
|
-
} else if (trait.name === "neural_animation") {
|
|
468
|
-
this.emit(`// @neural_animation \u2014 Motion Matching (com.unity.animation.rigging)`);
|
|
469
|
-
} else {
|
|
470
|
-
this.emit(
|
|
471
|
-
`// @${this.escapeStringValue(trait.name, "CSharp")}: ${JSON.stringify(trait.config || {})}`
|
|
472
|
-
);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
if (obj.children) {
|
|
477
|
-
for (const child of obj.children) {
|
|
478
|
-
this.compileObject(child, `${varName}GO.transform`);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
this.emit("");
|
|
482
|
-
}
|
|
483
|
-
compileSpatialGroup(group, parentVar) {
|
|
484
|
-
const varName = this.sanitizeName(group.name);
|
|
485
|
-
this.emit(`// Spatial Group: ${this.escapeStringValue(group.name, "CSharp")}`);
|
|
486
|
-
this.emit(
|
|
487
|
-
`var ${varName}GO = new GameObject("${this.escapeStringValue(group.name, "CSharp")}");`
|
|
488
|
-
);
|
|
489
|
-
this.emit(`${varName}GO.transform.SetParent(${parentVar});`);
|
|
490
|
-
for (const prop of group.properties) {
|
|
491
|
-
if (prop.key === "position" && Array.isArray(prop.value)) {
|
|
492
|
-
this.emit(`${varName}GO.transform.localPosition = ${this.toVector3(prop.value)};`);
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
for (const obj of group.objects) {
|
|
496
|
-
this.compileObject(obj, `${varName}GO.transform`);
|
|
497
|
-
}
|
|
498
|
-
if (group.groups) {
|
|
499
|
-
for (const sub of group.groups) {
|
|
500
|
-
this.compileSpatialGroup(sub, `${varName}GO.transform`);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
this.emit("");
|
|
504
|
-
}
|
|
505
|
-
compileAudio(audio) {
|
|
506
|
-
const varName = this.sanitizeName(audio.name);
|
|
507
|
-
this.emit(`// Audio: ${this.escapeStringValue(audio.name, "CSharp")}`);
|
|
508
|
-
this.emit(
|
|
509
|
-
`var ${varName}GO = new GameObject("${this.escapeStringValue(audio.name, "CSharp")}");`
|
|
510
|
-
);
|
|
511
|
-
this.emit(`${varName}GO.transform.SetParent(transform);`);
|
|
512
|
-
this.emit(`var ${varName}AS = ${varName}GO.AddComponent<AudioSource>();`);
|
|
513
|
-
for (const prop of audio.properties) {
|
|
514
|
-
if (prop.key === "src" || prop.key === "source") {
|
|
515
|
-
this.emit(`${varName}AS.clip = Resources.Load<AudioClip>("Audio/${prop.value}");`);
|
|
516
|
-
} else if (prop.key === "volume") {
|
|
517
|
-
this.emit(`${varName}AS.volume = ${prop.value}f;`);
|
|
518
|
-
} else if (prop.key === "loop") {
|
|
519
|
-
this.emit(`${varName}AS.loop = ${prop.value};`);
|
|
520
|
-
} else if (prop.key === "spatial") {
|
|
521
|
-
this.emit(`${varName}AS.spatialBlend = ${prop.value ? "1.0f" : "0.0f"};`);
|
|
522
|
-
} else if (prop.key === "position" && Array.isArray(prop.value)) {
|
|
523
|
-
this.emit(`${varName}GO.transform.position = ${this.toVector3(prop.value)};`);
|
|
524
|
-
} else if (prop.key === "distance") {
|
|
525
|
-
this.emit(`${varName}AS.maxDistance = ${prop.value}f;`);
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
this.emit(`${varName}AS.Play();`);
|
|
529
|
-
this.emit("");
|
|
530
|
-
}
|
|
531
|
-
compileZone(zone) {
|
|
532
|
-
const varName = this.sanitizeName(zone.name);
|
|
533
|
-
this.emit(`// Zone: ${this.escapeStringValue(zone.name, "CSharp")}`);
|
|
534
|
-
this.emit(
|
|
535
|
-
`var ${varName}GO = new GameObject("${this.escapeStringValue(zone.name, "CSharp")}");`
|
|
536
|
-
);
|
|
537
|
-
this.emit(`${varName}GO.transform.SetParent(transform);`);
|
|
538
|
-
for (const prop of zone.properties) {
|
|
539
|
-
if (prop.key === "position" && Array.isArray(prop.value)) {
|
|
540
|
-
this.emit(`${varName}GO.transform.position = ${this.toVector3(prop.value)};`);
|
|
541
|
-
} else if (prop.key === "shape" && prop.value === "box") {
|
|
542
|
-
this.emit(`var ${varName}Col = ${varName}GO.AddComponent<BoxCollider>();`);
|
|
543
|
-
this.emit(`${varName}Col.isTrigger = true;`);
|
|
544
|
-
} else if (prop.key === "shape" && prop.value === "sphere") {
|
|
545
|
-
this.emit(`var ${varName}Col = ${varName}GO.AddComponent<SphereCollider>();`);
|
|
546
|
-
this.emit(`${varName}Col.isTrigger = true;`);
|
|
547
|
-
} else if (prop.key === "size" && Array.isArray(prop.value)) {
|
|
548
|
-
this.emit(
|
|
549
|
-
`${varName}GO.GetComponent<Collider>().bounds.size == ${this.toVector3(prop.value)}; // Set via scale`
|
|
550
|
-
);
|
|
551
|
-
} else if (prop.key === "radius") {
|
|
552
|
-
this.emit(`${varName}GO.GetComponent<SphereCollider>().radius = ${prop.value}f;`);
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
if (zone.handlers?.length) {
|
|
556
|
-
this.emit(
|
|
557
|
-
`// Zone handlers: ${zone.handlers.map((h) => h.event).join(", ")} \u2014 implement via OnTriggerEnter/Exit`
|
|
558
|
-
);
|
|
559
|
-
}
|
|
560
|
-
this.emit("");
|
|
561
|
-
}
|
|
562
|
-
compileTimeline(timeline) {
|
|
563
|
-
const varName = this.sanitizeName(timeline.name);
|
|
564
|
-
this.emit(`private IEnumerator ${varName}Routine()`);
|
|
565
|
-
this.emit("{");
|
|
566
|
-
this.indentLevel++;
|
|
567
|
-
let lastTime = 0;
|
|
568
|
-
for (const entry of timeline.entries) {
|
|
569
|
-
const delay = entry.time - lastTime;
|
|
570
|
-
if (delay > 0) {
|
|
571
|
-
this.emit(`yield return new WaitForSeconds(${delay}f);`);
|
|
572
|
-
}
|
|
573
|
-
if (entry.action.kind === "animate") {
|
|
574
|
-
this.emit(`// Animate "${entry.action.target}" \u2014 use DOTween or AnimationCurve`);
|
|
575
|
-
const props = entry.action.properties;
|
|
576
|
-
for (const [key, value] of Object.entries(props)) {
|
|
577
|
-
this.emit(`// ${key}: ${JSON.stringify(value)}`);
|
|
578
|
-
}
|
|
579
|
-
} else if (entry.action.kind === "emit") {
|
|
580
|
-
this.emit(`// Emit event: "${entry.action.event}"`);
|
|
581
|
-
} else if (entry.action.kind === "call") {
|
|
582
|
-
this.emit(`// Call: ${entry.action.method}(${entry.action.args?.join(", ") || ""})`);
|
|
583
|
-
}
|
|
584
|
-
lastTime = entry.time;
|
|
585
|
-
}
|
|
586
|
-
if (timeline.loop) {
|
|
587
|
-
this.emit(`StartCoroutine(${varName}Routine()); // loop`);
|
|
588
|
-
}
|
|
589
|
-
this.indentLevel--;
|
|
590
|
-
this.emit("}");
|
|
591
|
-
this.emit("");
|
|
592
|
-
}
|
|
593
|
-
compileEffects(effects) {
|
|
594
|
-
this.emit("// === Post-Processing (configure via URP Volume) ===");
|
|
595
|
-
for (const effect of effects.effects) {
|
|
596
|
-
this.emit(`// Effect: ${effect.effectType} \u2014 ${JSON.stringify(effect.properties)}`);
|
|
597
|
-
}
|
|
598
|
-
this.emit("");
|
|
599
|
-
}
|
|
600
|
-
compileTransition(tr) {
|
|
601
|
-
const varName = this.sanitizeName(tr.name);
|
|
602
|
-
this.emit(`public void ${varName}()`);
|
|
603
|
-
this.emit("{");
|
|
604
|
-
this.indentLevel++;
|
|
605
|
-
for (const prop of tr.properties) {
|
|
606
|
-
if (prop.key === "target") {
|
|
607
|
-
this.emit(`// Load scene: "${prop.value}"`);
|
|
608
|
-
this.emit(`UnityEngine.SceneManagement.SceneManager.LoadScene("${prop.value}");`);
|
|
609
|
-
} else if (prop.key === "effect") {
|
|
610
|
-
this.emit(`// Transition effect: ${prop.value}`);
|
|
611
|
-
} else if (prop.key === "duration") {
|
|
612
|
-
this.emit(`// Duration: ${prop.value}s`);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
this.indentLevel--;
|
|
616
|
-
this.emit("}");
|
|
617
|
-
this.emit("");
|
|
618
|
-
}
|
|
619
|
-
compileUI(ui) {
|
|
620
|
-
this.emit("// === UI Setup ===");
|
|
621
|
-
this.emit("// Create Canvas for HUD overlay");
|
|
622
|
-
this.emit('var canvasGO = new GameObject("HoloUI");');
|
|
623
|
-
this.emit("canvasGO.transform.SetParent(transform);");
|
|
624
|
-
this.emit("var canvas = canvasGO.AddComponent<Canvas>();");
|
|
625
|
-
this.emit("canvas.renderMode = RenderMode.ScreenSpaceOverlay;");
|
|
626
|
-
this.emit("canvasGO.AddComponent<CanvasScaler>();");
|
|
627
|
-
this.emit("");
|
|
628
|
-
for (const el of ui.elements) {
|
|
629
|
-
const varName = this.sanitizeName(el.name);
|
|
630
|
-
const elType = el.properties.find((p) => p.key === "type")?.value;
|
|
631
|
-
this.emit(
|
|
632
|
-
`// UI Element: ${this.escapeStringValue(el.name, "CSharp")} (${elType})`
|
|
633
|
-
);
|
|
634
|
-
this.emit(
|
|
635
|
-
`var ${varName}GO = new GameObject("${this.escapeStringValue(el.name, "CSharp")}");`
|
|
636
|
-
);
|
|
637
|
-
this.emit(`${varName}GO.transform.SetParent(canvasGO.transform);`);
|
|
638
|
-
if (elType === "text") {
|
|
639
|
-
this.emit(`var ${varName}Text = ${varName}GO.AddComponent<Text>();`);
|
|
640
|
-
const text = el.properties.find((p) => p.key === "text")?.value;
|
|
641
|
-
if (text) this.emit(`${varName}Text.text = "${text}";`);
|
|
642
|
-
} else if (elType === "progress") {
|
|
643
|
-
this.emit(`var ${varName}Slider = ${varName}GO.AddComponent<Slider>();`);
|
|
644
|
-
}
|
|
645
|
-
this.emit("");
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
// ─── Helpers ───────────────────────────────────────────────────────────
|
|
649
|
-
emit(line) {
|
|
650
|
-
this.lines.push(this.options.indent.repeat(this.indentLevel) + line);
|
|
651
|
-
}
|
|
652
|
-
sanitizeName(name) {
|
|
653
|
-
return name.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
654
|
-
}
|
|
655
|
-
toVector3(arr) {
|
|
656
|
-
if (Array.isArray(arr) && arr.length >= 3) {
|
|
657
|
-
return `new Vector3(${arr[0]}f, ${arr[1]}f, ${arr[2]}f)`;
|
|
658
|
-
}
|
|
659
|
-
if (Array.isArray(arr) && arr.length === 2) {
|
|
660
|
-
return `new Vector2(${arr[0]}f, ${arr[1]}f)`;
|
|
661
|
-
}
|
|
662
|
-
return `new Vector3(${arr}f, ${arr}f, ${arr}f)`;
|
|
663
|
-
}
|
|
664
|
-
toColor(value) {
|
|
665
|
-
if (typeof value === "string" && value.startsWith("#")) {
|
|
666
|
-
const hex = value.slice(1);
|
|
667
|
-
const r = parseInt(hex.substring(0, 2), 16) / 255;
|
|
668
|
-
const g = parseInt(hex.substring(2, 4), 16) / 255;
|
|
669
|
-
const b = parseInt(hex.substring(4, 6), 16) / 255;
|
|
670
|
-
return `new Color(${r.toFixed(3)}f, ${g.toFixed(3)}f, ${b.toFixed(3)}f)`;
|
|
671
|
-
}
|
|
672
|
-
return `Color.white`;
|
|
673
|
-
}
|
|
674
|
-
toCSharpType(value) {
|
|
675
|
-
if (typeof value === "number") return Number.isInteger(value) ? "int" : "float";
|
|
676
|
-
if (typeof value === "boolean") return "bool";
|
|
677
|
-
if (typeof value === "string") return "string";
|
|
678
|
-
if (Array.isArray(value)) return "object[]";
|
|
679
|
-
return "object";
|
|
680
|
-
}
|
|
681
|
-
toCSharpValue(value) {
|
|
682
|
-
if (typeof value === "number") return Number.isInteger(value) ? `${value}` : `${value}f`;
|
|
683
|
-
if (typeof value === "boolean") return value ? "true" : "false";
|
|
684
|
-
if (typeof value === "string") return `"${this.escapeStringValue(value, "CSharp")}"`;
|
|
685
|
-
if (value === null) return "null";
|
|
686
|
-
return "null";
|
|
687
|
-
}
|
|
688
|
-
findProp(props, key) {
|
|
689
|
-
return props?.find((p) => p.key === key)?.value;
|
|
690
|
-
}
|
|
691
|
-
findObjProp(obj, key) {
|
|
692
|
-
return obj.properties?.find((p) => p.key === key)?.value;
|
|
693
|
-
}
|
|
694
|
-
};
|
|
695
|
-
}
|
|
696
|
-
});
|
|
697
|
-
|
|
698
|
-
exports.UnityCompiler_exports = UnityCompiler_exports;
|
|
699
|
-
exports.init_UnityCompiler = init_UnityCompiler;
|
|
700
|
-
//# sourceMappingURL=chunk-7KPI4EKH.cjs.map
|
|
701
|
-
//# sourceMappingURL=chunk-7KPI4EKH.cjs.map
|