public override void Print(LuaPrinterContext printer, string parent) { var(ident, define) = printer.GetIdentifier(); printer.WriteLine($"{(define ? "local " : "")}{ident} = {TypeInitExpression(Value.Type)}"); Value.PrintSetter(printer, ident); printer.WriteLine($"{parent}.{property.Name} = {ident}"); printer.FreeIdentifier(ident); }
public override void Print(LuaPrinterContext printer, string parent) { var(ident, define) = printer.GetIdentifier(); printer.WriteLine($"{(define ? "local " : "")}{ident} = {TypeInitExpression(type)}"); foreach (var obj in Values) { printer.WriteLine($"{ident}:Add({ObjToString(obj)}"); } printer.WriteLine($"{parent}.{property.Name} = {ident}"); printer.FreeIdentifier(ident); }
public override void Print(LuaPrinterContext printer, string parent) { var(ident, define) = printer.GetIdentifier(); printer.WriteLine($"{(define ? "local " : "")}{ident} = {TypeInitExpression(type)}"); foreach (var obj in Objects) { var(objIdent, objDefine) = printer.GetIdentifier(); printer.WriteLine($"{(objDefine ? "local " : "")}{objIdent} = {TypeInitExpression(obj.Type)}"); obj.PrintSetter(printer, objIdent); printer.WriteLine($"{ident}:Add({objIdent})"); printer.FreeIdentifier(objIdent); if (printer.ElementProperty != null) { var src = obj.Create(); if (src is UiWidget uw && !string.IsNullOrWhiteSpace(uw.ID)) { printer.WriteLine($"{printer.ElementProperty}[{ToLiteral(uw.ID)}] = {objIdent}"); } } } printer.WriteLine($"{parent}.{property.Name} = {ident}"); printer.FreeIdentifier(ident); }
public override void Print(LuaPrinterContext printer, string parent) { printer.WriteLine($"{parent}.{property.Name} = {ObjToString(Value)}"); }