private void registerTDrawingSurface(IJSValueConverterService converter) { converter.RegisterProxyConverter <TDrawingSurface>( (binding, obj, node) => { binding.SetFunction(nameof(obj.CreateSpritBatch), obj.CreateSpritBatch); }); }
private void registerTTexture(IJSValueConverterService converter) { converter.RegisterProxyConverter <TTexture>( (binding, obj, node) => { binding.SetFunction <SizeF>(nameof(obj.GetSize), () => obj.GetSize); }); }
private static void registerProxy(IJSValueConverterService converter) { converter.RegisterProxyConverter <HostingProxy>( (binding, obj, node) => { binding.SetFunction <string, string, Task <string> >("Dispatch", obj.Dispatch); } ); converter.RegisterTask <HostingProxy>(); converter.RegisterTask <string>(); }
private static void InjectDictionaryConverter(IJSValueConverterService service) { service.RegisterArrayConverter <string>(); service.RegisterProxyConverter <IDictionary <string, string> >( (binding, dict, node) => { DictionaryWrapper wrapper = new DictionaryWrapper(dict); binding.SetFunction <IEnumerable <string> >("GetKeys", wrapper.GetKeys); binding.SetMethod <string, string>("SetItem", wrapper.SetItem); binding.SetFunction <string, string>("GetItem", wrapper.GetItem); binding.SetFunction <string, bool>("ContainsKey", wrapper.ContainsKey); } ); }
private void registerTSprintBatch(IJSValueConverterService converter) { converter.RegisterProxyConverter <TSpritBatch>( (binding, obj, node) => { binding.SetMethod <PointF, string, Font, string, int>(nameof(obj.DrawText), obj.DrawText); binding.SetMethod <IEnumerable <PointF>, string, int>(nameof(obj.DrawLines), obj.DrawLines); binding.SetMethod <PointF, SizeF, string, int, bool>(nameof(obj.DrawEclipse), obj.DrawEclipse); binding.SetMethod <PointF, SizeF, TTexture, float>(nameof(obj.DrawImage), obj.DrawImage); binding.SetMethod <string, RectangleF>(nameof(obj.Fill), obj.Fill); binding.SetMethod <RectangleF, string, int, bool>(nameof(obj.DrawRectangle), obj.DrawRectangle); binding.SetMethod <PointF, PointF, PointF, string, int, bool>(nameof(obj.DrawTriangle), obj.DrawTriangle); binding.SetMethod <PointF>(nameof(obj.Translate), obj.Translate); binding.SetMethod <PointF>(nameof(obj.Scale), obj.Scale); binding.SetMethod <float>(nameof(obj.Rotate), obj.Rotate); binding.SetFunction <int>(nameof(obj.PushMatrix), obj.PushMatrix); binding.SetFunction <int>(nameof(obj.PopMatrix), obj.PopMatrix); binding.SetMethod(nameof(obj.ResetMatrix), obj.ResetMatrix); binding.SetMethod <BlendModeEnum, Effect>(nameof(obj.Begin), obj.Begin); binding.SetMethod(nameof(obj.End), obj.End); } ); }