public static object Constructor(object This, ScriptObjectLink objLink, object[] parameters) { if (TypeContract.Ensure(parameters, new[] { TypeContract.Number, TypeContract.Number })) { var x = (double)parameters[0]; var y = (double)parameters[1]; objLink.SetMember("x", x); objLink.SetMember("y", y); } return(NetUndefined.Instance); }
public static object GetData(object This, ScriptObjectLink objLink, object[] parameters) { if (TypeContract.Ensure(parameters, typeof(string))) { var instance = (EntityComponentWrapper)This; var entity = instance.parent.GetEntity(); var component = entity.GetComponent(instance.id); var dataKey = (string)parameters[0]; return(component.GetDataOrDefault(dataKey, "")); } return(NetUndefined.Instance); }
public static object Constructor(object This, ScriptObjectLink objLink, object[] parameters) { if (TypeContract.Ensure(parameters, new[] { typeof(string), typeof(int), typeof(int) }, 1)) { var helper = new ParameterHelper(parameters); string id = helper.Pop <string>(); objLink.SetMember("id", id); var moveModel = GetMoveModel(This); objLink.SetMember("PP", helper.Pop(moveModel.PP)); objLink.SetMember("maxPP", helper.Pop(moveModel.PP)); } return(NetUndefined.Instance); }
public static object GetComponent(object This, ScriptObjectLink objLink, object[] parameters) { if (TypeContract.Ensure(parameters, new[] { typeof(string) })) { var wrapper = (EntityWrapper)This; var entity = wrapper.GetEntity(); var component = new EntityComponentWrapper { parent = wrapper, id = parameters[0] as string }; return(component); } return(NetUndefined.Instance); }
public static object SetData(object This, ScriptObjectLink objLink, object[] parameters) { if (TypeContract.Ensure(parameters, new[] { typeof(string), typeof(string) })) { var instance = (EntityComponentWrapper)This; var entity = instance.parent.GetEntity(); var component = entity.GetComponent(instance.id); var dataKey = (string)parameters[0]; var dataValue = (string)parameters[1]; component.SetData(dataKey, dataValue); return(dataValue); } return(NetUndefined.Instance); }
public static object GetName(object This, ScriptObjectLink objLink, object[] parameters) { return(Controller.ActivePlayer.Name); }
public static object GetTypes(object This, ScriptObjectLink objLink, object[] parameters) { return(GetMoveModel(This).Types); }
public static object GetDescription(object This, ScriptObjectLink objLink, object[] parameters) { return(GetMoveModel(This).Description); }
public static object SomeFunction(object This, ScriptObjectLink objLink, object[] parameters) { var test = objLink.GetReference(nameof(pokemonRef)); return(NetUndefined.Instance); }
public static object Constructor(object This, ScriptObjectLink objLink, object[] parameters) { objLink.SetReference(nameof(pokemonRef), GameInstance.LoadedSave.PartyPokemon[0]); return(NetUndefined.Instance); }