private void GenerateUpdateMethod(TypeBlock typeBlock, UnityTypeDetails details) { typeBlock.Method($"public override void Update({details.FullyQualifiedName} data)", mb => { mb.TextList(details.FieldDetails.Select(fd => fieldTypeHandler.ToUiFieldUpdate(fd, "data"))); }); }
private void GenerateDebugMethod(TypeBlock typeBlock, UnityComponentDetails details) { typeBlock.Method("protected override void WriteDebugInfo()", mb => { mb.Line($"UnityEngine.Debug.Log(\"{details.Name} generated from '{details.SchemaFilePath}' with Component ID '{details.ComponentId}'\");"); }); }
private void GenerateConstructor(TypeBlock typeBlock, UnityTypeDetails details) { typeBlock.Method($"public {details.Name}Renderer(string label) : base(label)", mb => { foreach (var field in details.FieldDetails) { mb.TextList(fieldTypeHandler.ToFieldInitialisation(field, "Container")); } }); }
private void GenerateUpdateMethod(TypeBlock typeBlock, UnityComponentDetails details) { typeBlock.Method("public override void Update(EntityManager manager, Entity entity)", mb => { mb.Line($"AuthoritativeToggle.value = manager.HasComponent<{details.Name}.HasAuthority>(entity);"); mb.Line($"var component = manager.GetComponentData<{details.Name}.Component>(entity);"); mb.TextList(details.FieldDetails.Select(fd => typeGenerator.ToUiFieldUpdate(fd, "component"))); }); }
private void GenerateConstructor(TypeBlock typeBlock, UnityComponentDetails details) { typeBlock.Method($"public {details.Name}Renderer() : base()", mb => { mb.Line($"ComponentFoldout.text = \"{details.Name}\";"); mb.Line($"AuthoritativeToggle.SetEnabled(false);"); foreach (var field in details.FieldDetails) { mb.TextList(typeGenerator.ToFieldInitialisation(field, "ComponentFoldout")); } mb.Line($"InjectComponentIcon(\"{GetComponentIcon(details)}\");"); }); }