diff --git a/src/Luban.Job.Cfg/Source/JobController.cs b/src/Luban.Job.Cfg/Source/JobController.cs index d33d4ff..a8d82ad 100644 --- a/src/Luban.Job.Cfg/Source/JobController.cs +++ b/src/Luban.Job.Cfg/Source/JobController.cs @@ -151,7 +151,7 @@ namespace Luban.Job.Cfg errMsg = "--output_data_resource_list_file missing"; return false; } - if (genTypes.Contains("data_json_monolithic") && string.IsNullOrWhiteSpace(options.OutputDataJsonMonolithicFile)) + if (genTypes.Contains("output_data_json_monolithic_file") && string.IsNullOrWhiteSpace(options.OutputDataJsonMonolithicFile)) { errMsg = "--output_data_json_monolithic_file missing"; return false; @@ -660,60 +660,7 @@ export class Vector2 { { var fileContent = new List { - @" -class Vector2: - def __init__(self, x, y): - self.x = x - self.y = y - self.a = Vector4(1,2,3,4) - def __str__(self): - return '{%g,%g}' % (self.x, self.y) - - @staticmethod - def fromJson(_json_): - x = _json_['x'] - y = _json_['y'] - if (x == None or y == None): - raise Exception() - return Vector2(x, y) - - -class Vector3: - def __init__(self, x, y, z): - self.x = x - self.y = y - self.z = z - def __str__(self): - return '{%f,%f,%f}' % (self.x, self.y, self.z) - @staticmethod - def fromJson(_json_): - x = _json_['x'] - y = _json_['y'] - z = _json_['z'] - if (x == None or y == None or z == None): - raise Exception() - return Vector3(x, y, z) - -class Vector4: - def __init__(self, x, y, z, w): - self.x = x - self.y = y - self.z = z - self.w = w - def __str__(self): - return '{%g,%g,%g,%g}' % (self.x, self.y, self.z, self.w) - - @staticmethod - def fromJson(_json_): - x = _json_['x'] - y = _json_['y'] - z = _json_['z'] - w = _json_['w'] - if (x == None or y == None or z == None or w == None): - raise Exception() - return Vector4(x, y, z, w) - -" + PYTHON_VECTOR_DEFINES }; foreach (var type in exportTypes) @@ -775,60 +722,8 @@ class Vector4: @" from enum import Enum import abc - -class Vector2: - def __init__(self, x, y): - self.x = x - self.y = y - self.a = Vector4(1,2,3,4) - def __str__(self): - return '{%g,%g}' % (self.x, self.y) - - @staticmethod - def fromJson(_json_): - x = _json_['x'] - y = _json_['y'] - if (x == None or y == None): - raise Exception() - return Vector2(x, y) - - -class Vector3: - def __init__(self, x, y, z): - self.x = x - self.y = y - self.z = z - def __str__(self): - return '{%f,%f,%f}' % (self.x, self.y, self.z) - @staticmethod - def fromJson(_json_): - x = _json_['x'] - y = _json_['y'] - z = _json_['z'] - if (x == None or y == None or z == None): - raise Exception() - return Vector3(x, y, z) - -class Vector4: - def __init__(self, x, y, z, w): - self.x = x - self.y = y - self.z = z - self.w = w - def __str__(self): - return '{%g,%g,%g,%g}' % (self.x, self.y, self.z, self.w) - - @staticmethod - def fromJson(_json_): - x = _json_['x'] - y = _json_['y'] - z = _json_['z'] - w = _json_['w'] - if (x == None or y == None or z == None or w == None): - raise Exception() - return Vector4(x, y, z, w) - -" +", + PYTHON_VECTOR_DEFINES, }; foreach (var type in exportTypes) @@ -913,7 +808,7 @@ class Vector4: tasks.Add(Task.Run(() => { var content = FileHeaderUtil.ConcatAutoGenerationHeader(render.RenderAny(c), ELanguage.CS); - var file = RenderFileUtil.GetDefTypePath(c.FullName, ELanguage.GO); + var file = RenderFileUtil.GetDefTypePath(c.FullName, ELanguage.CS); var md5 = CacheFileUtil.GenMd5AndAddCache(file, content); genCodeFilesInOutputCodeDir.Add(new FileInfo() { FilePath = file, MD5 = md5 }); })); @@ -1096,5 +991,59 @@ class Vector4: agent.Session.ReplyRpc(rpc, res); } + + private const string PYTHON_VECTOR_DEFINES = @" +class Vector2: + def __init__(self, x, y): + self.x = x + self.y = y + def __str__(self): + return '{%g,%g}' % (self.x, self.y) + + @staticmethod + def fromJson(_json_): + x = _json_['x'] + y = _json_['y'] + if (x == None or y == None): + raise Exception() + return Vector2(x, y) + + +class Vector3: + def __init__(self, x, y, z): + self.x = x + self.y = y + self.z = z + def __str__(self): + return '{%f,%f,%f}' % (self.x, self.y, self.z) + @staticmethod + def fromJson(_json_): + x = _json_['x'] + y = _json_['y'] + z = _json_['z'] + if (x == None or y == None or z == None): + raise Exception() + return Vector3(x, y, z) + +class Vector4: + def __init__(self, x, y, z, w): + self.x = x + self.y = y + self.z = z + self.w = w + def __str__(self): + return '{%g,%g,%g,%g}' % (self.x, self.y, self.z, self.w) + + @staticmethod + def fromJson(_json_): + x = _json_['x'] + y = _json_['y'] + z = _json_['z'] + w = _json_['w'] + if (x == None or y == None or z == None or w == None): + raise Exception() + return Vector4(x, y, z, w) + +"; } } diff --git a/src/Luban.Job.Proto/Source/JobController.cs b/src/Luban.Job.Proto/Source/JobController.cs index 1b2b37b..58b4046 100644 --- a/src/Luban.Job.Proto/Source/JobController.cs +++ b/src/Luban.Job.Proto/Source/JobController.cs @@ -162,28 +162,28 @@ export namespace {ass.TopModule} {{ @" export interface ISerializable { - serialize(_buf_: Bright.Serialization.ByteBuf) : void - deserialize(_buf_: Bright.Serialization.ByteBuf) : void + serialize(_buf_: Bright.Serialization.ByteBuf): void + deserialize(_buf_: Bright.Serialization.ByteBuf): void } export abstract class BeanBase implements ISerializable { - abstract getTypeId() : number + abstract getTypeId(): number abstract serialize(_buf_: Bright.Serialization.ByteBuf): void abstract deserialize(_buf_: Bright.Serialization.ByteBuf): void } export abstract class Protocol implements ISerializable { - abstract getTypeId() : number + abstract getTypeId(): number abstract serialize(_buf_: Bright.Serialization.ByteBuf): void abstract deserialize(_buf_: Bright.Serialization.ByteBuf): void } export class Vector2 { - x: number; - y: number; + x: number + y: number constructor(x: number, y: number) { - this.x = x; - this.y = y; + this.x = x + this.y = y } to(_buf_: Bright.Serialization.ByteBuf) { @@ -192,21 +192,21 @@ export class Vector2 { } static from(_buf_: Bright.Serialization.ByteBuf): Vector2 { - let x = _buf_.ReadFloat(); - let y = _buf_.ReadFloat(); - return new Vector2(x, y); + let x = _buf_.ReadFloat() + let y = _buf_.ReadFloat() + return new Vector2(x, y) } } export class Vector3 { - x: number; - y: number; - z: number; + x: number + y: number + z: number constructor(x: number, y: number, z: number) { - this.x = x; - this.y = y; - this.z = z; + this.x = x + this.y = y + this.z = z } to(_buf_: Bright.Serialization.ByteBuf) { @@ -216,23 +216,23 @@ export class Vector2 { } static from(_buf_: Bright.Serialization.ByteBuf): Vector3 { - let x = _buf_.ReadFloat(); - let y = _buf_.ReadFloat(); - let z = _buf_.ReadFloat(); - return new Vector3(x, y, z); + let x = _buf_.ReadFloat() + let y = _buf_.ReadFloat() + let z = _buf_.ReadFloat() + return new Vector3(x, y, z) } } export class Vector4 { - x: number; - y: number; - z: number; - w: number; + x: number + y: number + z: number + w: number constructor(x: number, y: number, z: number, w: number) { - this.x = x; - this.y = y; - this.z = z; - this.w = w; + this.x = x + this.y = y + this.z = z + this.w = w } to(_buf_: Bright.Serialization.ByteBuf) { @@ -243,11 +243,11 @@ export class Vector2 { } static from(_buf_: Bright.Serialization.ByteBuf): Vector4 { - let x = _buf_.ReadFloat(); - let y = _buf_.ReadFloat(); - let z = _buf_.ReadFloat(); - let w = _buf_.ReadFloat(); - return new Vector4(x, y, z, w); + let x = _buf_.ReadFloat() + let y = _buf_.ReadFloat() + let z = _buf_.ReadFloat() + let w = _buf_.ReadFloat() + return new Vector4(x, y, z, w) } }