Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
 public static object GetName(object This, ScriptObjectLink objLink, object[] parameters)
 {
     return(Controller.ActivePlayer.Name);
 }
Example #7
0
 public static object GetTypes(object This, ScriptObjectLink objLink, object[] parameters)
 {
     return(GetMoveModel(This).Types);
 }
Example #8
0
 public static object GetDescription(object This, ScriptObjectLink objLink, object[] parameters)
 {
     return(GetMoveModel(This).Description);
 }
Example #9
0
        public static object SomeFunction(object This, ScriptObjectLink objLink, object[] parameters)
        {
            var test = objLink.GetReference(nameof(pokemonRef));

            return(NetUndefined.Instance);
        }
Example #10
0
        public static object Constructor(object This, ScriptObjectLink objLink, object[] parameters)
        {
            objLink.SetReference(nameof(pokemonRef), GameInstance.LoadedSave.PartyPokemon[0]);

            return(NetUndefined.Instance);
        }