Exemplo n.º 1
0
        public override void Initialize()
        {
            Fougerite.Hooks.OnChat += new Fougerite.Hooks.ChatHandlerDelegate(OnChat);
            Fougerite.Hooks.OnConsoleReceived += new Fougerite.Hooks.ConsoleHandlerDelegate(ConsoleReceived);
            Fougerite.Hooks.OnBlueprintUse += new Fougerite.Hooks.BlueprintUseHandlerDelagate(OnBlueprintUse);
            //Fougerite.Hooks.OnPluginInit += new Fougerite.Hooks.PluginInitHandlerDelegate(OnPluginInit);
            Fougerite.Hooks.OnChatReceived += new Fougerite.Hooks.ChatRecivedDelegate(OnChatReceived);
            Fougerite.Hooks.OnCommand += new Fougerite.Hooks.CommandHandlerDelegate(OnCommand);
            Fougerite.Hooks.OnPlayerConnected += new Fougerite.Hooks.ConnectionHandlerDelegate(OnPlayerConnected);
            Fougerite.Hooks.OnPlayerDisconnected += new Fougerite.Hooks.DisconnectionHandlerDelegate(OnPlayerDisconnected);
            Fougerite.Hooks.OnNPCKilled += new Fougerite.Hooks.KillHandlerDelegate(OnNPCKilled);
            Fougerite.Hooks.OnNPCHurt += new Fougerite.Hooks.HurtHandlerDelegate(OnNPCHurt);
            Fougerite.Hooks.OnPlayerKilled += new Fougerite.Hooks.KillHandlerDelegate(OnPlayerKilled);
            Fougerite.Hooks.OnPlayerHurt += new Fougerite.Hooks.HurtHandlerDelegate(OnPlayerHurt);
            Fougerite.Hooks.OnPlayerSpawned += new Fougerite.Hooks.PlayerSpawnHandlerDelegate(OnPlayerSpawned);
            Fougerite.Hooks.OnPlayerSpawning += new Fougerite.Hooks.PlayerSpawnHandlerDelegate(OnPlayerSpawning);
            Fougerite.Hooks.OnPlayerGathering += new Fougerite.Hooks.PlayerGatheringHandlerDelegate(OnPlayerGathering);
            Fougerite.Hooks.OnEntityHurt += new Fougerite.Hooks.EntityHurtDelegate(OnEntityHurt);
            Fougerite.Hooks.OnEntityDecay += new Fougerite.Hooks.EntityDecayDelegate(OnEntityDecay);
            Fougerite.Hooks.OnDoorUse += new Fougerite.Hooks.DoorOpenHandlerDelegate(OnDoorUse);
            Fougerite.Hooks.OnTablesLoaded += new Fougerite.Hooks.LootTablesLoaded(OnTablesLoaded);
            Fougerite.Hooks.OnItemsLoaded += new Fougerite.Hooks.ItemsDatablocksLoaded(OnItemsLoaded);
            Fougerite.Hooks.OnServerInit += new Fougerite.Hooks.ServerInitDelegate(OnServerInit);
            Fougerite.Hooks.OnServerShutdown += new Fougerite.Hooks.ServerShutdownDelegate(OnServerShutdown);

           

            string[] directories = Directory.GetDirectories("modules/V8Engine/plugins/");
            foreach (string directory in directories)
            {
                string pluginName = Path.GetFileName(directory);
                V8Plugin plugin = new V8Plugin(pluginName);

                
                plugins.Add(pluginName, plugin);

                // Load plugins when all modules are loaded.
                LoadPlugin(pluginName);
            }

            foreach (KeyValuePair<string, V8Plugin> plugin in plugins)
            {
                plugin.Value.Invoke("OnAllPluginsLoaded");
            }
        }
Exemplo n.º 2
0
 public Command(V8Plugin pPlugin)
 {
     plugin = pPlugin;
 }
Exemplo n.º 3
0
        public void SetModules(V8Plugin plugin)
        {
            plugin.engine.CreateBinding(typeof(float), "float", null, ScriptMemberSecurity.Locked);
            plugin.engine.RegisterType(typeof(UnityEngine.Vector3), null, true, ScriptMemberSecurity.Permanent); // Float pointing numbers
            plugin.engine.GlobalObject.SetProperty(typeof(UnityEngine.Vector3), V8PropertyAttributes.Locked);

            plugin.engine.GlobalObject.SetProperty(typeof(KeyValues), V8PropertyAttributes.Locked);

            plugin.engine.GlobalObject.SetProperty("File", fileApi, "File", true, ScriptMemberSecurity.Locked);
            plugin.engine.GlobalObject.SetProperty("Directory", directoryApi, "Directory", true, ScriptMemberSecurity.Locked);
            plugin.engine.GlobalObject.SetProperty("Server", Server.GetServer(), "Server", true, ScriptMemberSecurity.ReadWrite);
            plugin.engine.GlobalObject.SetProperty("Util", Util.GetUtil(), "Util", true, ScriptMemberSecurity.Locked);
            plugin.engine.GlobalObject.SetProperty("V8Engine", this, "V8Engine", true, ScriptMemberSecurity.Locked);
            plugin.engine.GlobalObject.SetProperty("Data", Data.GetData(), "Data", true, ScriptMemberSecurity.Locked);
            plugin.engine.GlobalObject.SetProperty("DataStore", DataStore.GetInstance(), "DataStore", true, ScriptMemberSecurity.Locked);
            plugin.engine.GlobalObject.SetProperty("Util", Util.GetUtil(), "Util", true, ScriptMemberSecurity.Locked);
            plugin.engine.GlobalObject.SetProperty("Web", new Web(), "Web", true, ScriptMemberSecurity.Locked);
            plugin.engine.GlobalObject.SetProperty("Time", plugin, "Time", true, ScriptMemberSecurity.Locked);
            plugin.engine.GlobalObject.SetProperty("World", World.GetWorld(), "World", true, ScriptMemberSecurity.ReadWrite);

        }