Buenas! Tengo toda una librería de JavaScript que permite hacer matemática de origami. Mi necesidad es usar esa librería en C# para incluirla en Unity. Hay alguna manera de envolver toda una librería de JS para usarla en C# o mejor reescribo toda la librería en C#?
Abajo adjunto una parte del código que quiero pasar de JavaScript a C#
Código: php
El problema es que la librería tiene más de 20.000 líneas de código... Dejo el link de la librería: No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Abajo adjunto una parte del código que quiero pasar de JavaScript a C#
/* Math (c) Kraft, MIT License */
/**
* Math (c) Kraft
*/
/**
* type checking
*/
/**
* one way to improve these input finders is to search in all indices
* of the arguments list, right now it assumes THIS is the only thing
* you're passing in. in the case that it isn't and there's an object
* in the first slot, it won't find the valid data in the second.
*/
/**
* @description get the type of an object, which includes the custom types in this library.
* @param {any} any object
* @returns {string} the type name
* @linkcode Math ./src/types/typeof.js 17
*/
const typeOf = function (obj) {
switch (obj.constructor.name) {
case "vector":
case "matrix":
case "segment":
case "ray":
case "line":
case "circle":
case "ellipse":
case "rect":
case "polygon": return obj.constructor.name;
}
if (typeof obj === "object") {
if (obj.radius != null) { return "circle"; }
if (obj.width != null) { return "rect"; }
if (obj.x != null || typeof obj[0] === "number") { return "vector"; }
// line ray segment
if (obj[0] != null && obj[0].length && (typeof obj[0].x === "number" || typeof obj[0][0] === "number")) { return "segment"; }
if (obj.vector != null && obj.origin != null) { return "line"; } // or ray
}
return undefined;
};
El problema es que la librería tiene más de 20.000 líneas de código... Dejo el link de la librería: No tienes permitido ver los links. Registrarse o Entrar a mi cuenta