@needle-tools/needle-component-compiler 1.6.1 → 1.6.2
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/Changelog.md +3 -0
- package/package.json +1 -1
- package/src/component-compiler.js +3 -1
- package/src/component-compiler.ts +2 -1
- package/src/test.ts +12 -6
package/Changelog.md
CHANGED
|
@@ -4,6 +4,9 @@ All notable changes to this package will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.6.2] - 2022-07-11
|
|
8
|
+
- fix ``@type`` for class declaration
|
|
9
|
+
|
|
7
10
|
## [1.6.1] - 2022-07-10
|
|
8
11
|
- add using ``types.json`` json file that will be generated from Unity
|
|
9
12
|
- change ``@type`` annotiation to only work without braces to be consistent
|
package/package.json
CHANGED
|
@@ -290,9 +290,11 @@ function run(program, outputDir, sourceFile) {
|
|
|
290
290
|
newContext.appendLine("{");
|
|
291
291
|
newContext.indentLevel += 1;
|
|
292
292
|
// newContext.appendLine("// source: " + path.resolve(sourceFile.fileName));
|
|
293
|
-
var typeName =
|
|
293
|
+
var typeName = "UnityEngine.MonoBehaviour";
|
|
294
294
|
if (typeof inheritsComponent === "string")
|
|
295
295
|
typeName = inheritsComponent;
|
|
296
|
+
if (lastTypeFound)
|
|
297
|
+
typeName = lastTypeFound;
|
|
296
298
|
console.log(name_2 + " inherits " + typeName);
|
|
297
299
|
newContext.appendLine("public partial class " + name_2 + " : " + typeName);
|
|
298
300
|
newContext.appendLine("{");
|
|
@@ -312,8 +312,9 @@ export function run(program: ts.Program, outputDir: string, sourceFile: ts.Sourc
|
|
|
312
312
|
newContext.appendLine("{");
|
|
313
313
|
newContext.indentLevel += 1;
|
|
314
314
|
// newContext.appendLine("// source: " + path.resolve(sourceFile.fileName));
|
|
315
|
-
let typeName =
|
|
315
|
+
let typeName = "UnityEngine.MonoBehaviour";
|
|
316
316
|
if (typeof inheritsComponent === "string") typeName = inheritsComponent;
|
|
317
|
+
if(lastTypeFound) typeName = lastTypeFound;
|
|
317
318
|
console.log(name + " inherits " + typeName);
|
|
318
319
|
newContext.appendLine("public partial class " + name + " : " + typeName);
|
|
319
320
|
newContext.appendLine("{");
|
package/src/test.ts
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
+
//@type UnityEngine.MonoBehaviour
|
|
2
|
+
export class ButtonObject extends Interactable implements IPointerClickHandler, ISerializable {
|
|
3
|
+
|
|
4
|
+
//@type UnityEngine.Transform[]
|
|
5
|
+
myType?: SceneFXWindow;
|
|
6
|
+
}
|
|
1
7
|
|
|
2
8
|
// import { Behaviour } from "needle.tiny.engine/engine-components/Component";
|
|
3
9
|
// import { RoomEntity } from "./Room";
|
|
4
10
|
|
|
5
|
-
import { Behaviour } from "needle.tiny.engine/engine-components/Component";
|
|
11
|
+
// import { Behaviour } from "needle.tiny.engine/engine-components/Component";
|
|
6
12
|
|
|
7
|
-
export class MyNewScript extends DriveClient
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
13
|
+
// export class MyNewScript extends DriveClient
|
|
14
|
+
// {
|
|
15
|
+
// //@type test
|
|
16
|
+
// texture : RenderTexture;
|
|
17
|
+
// }
|
|
12
18
|
|
|
13
19
|
// namespace Hello.World
|
|
14
20
|
// {
|