Holds a link back into the scripting engine to set fields of a script object.
예제 #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;
        }
예제 #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;
        }
예제 #3
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;
        }
예제 #4
0
파일: Entity.cs 프로젝트: nilllzz/Pokemon3D
        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;
        }
예제 #5
0
 public static object SomeFunction(object This, ScriptObjectLink objLink, object[] parameters)
 {
     var test = objLink.GetReference(nameof(pokemonRef));
     return NetUndefined.Instance;
 }
예제 #6
0
        public static object Constructor(object This, ScriptObjectLink objLink, object[] parameters)
        {
            objLink.SetReference(nameof(pokemonRef), GameInstance.LoadedSave.PartyPokemon[0]);

            return NetUndefined.Instance;
        }