Ejemplo n.º 1
0
        public string PrintClassInit(string className, string fieldName)
        {
            var printer = new LuaPrinterContext();

            printer.WriteLine($"{className} = class()");
            printer.WriteLine($"function {className}:CreateWidget()");
            printer.TabIn();
            printer.WriteLine($"self.{fieldName} = {UiComplexProperty.TypeInitExpression(Type)}");
            printer.WriteLine("self.Elements = {}");
            printer.ElementProperty = "self.Elements";
            PrintSetter(printer, $"self.{fieldName}");
            printer.ElementProperty = null;
            printer.TabOut();
            printer.WriteLine("end");
            printer.WriteLine($"function {className}:init(...)");
            printer.TabIn();
            printer.WriteLine("self:CreateWidget()");
            printer.WriteLine("if self.ctor ~= nil then");
            printer.TabIn();
            printer.WriteLine("self:ctor(...)");
            printer.TabOut();
            printer.WriteLine("end");
            printer.TabOut();
            printer.WriteLine("end");
            return(printer.GetString());
        }
Ejemplo n.º 2
0
 public void PrintSetter(LuaPrinterContext printer, string identifier)
 {
     foreach (var s in Setters)
     {
         s.Print(printer, identifier);
     }
 }
Ejemplo n.º 3
0
        public string PrintStylesheetInit()
        {
            var printer = new LuaPrinterContext();

            printer.WriteLine($"function CreateStylesheet()");
            printer.TabIn();
            printer.WriteLine("local stylesheet = ClrTypes.LibreLancer_Interface_Stylesheet.__new()");
            PrintSetter(printer, "stylesheet");
            printer.WriteLine("return stylesheet");
            printer.TabOut();
            printer.WriteLine("end");
            return(printer.GetString());
        }