コード例 #1
0
        private void buttonShortcut_Click(object sender, EventArgs e)
        {
            if (!_MacroNameValid)
            {
                return;
            }

            string desktopPath  = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            string macroName    = MacroName;
            string shortcutPath = Path.Combine(desktopPath, String.Format("Macro - {0}.lnk", macroName));

            ShellShortcut shortcut = new ShellShortcut(shortcutPath);

            string translatorFolder = SystemRegistry.GetInstallFolder();

            if (translatorFolder == null)
            {
                translatorFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            }

            shortcut.Arguments        = String.Format("-MACRO \"{0}\"", macroName);
            shortcut.Description      = "Launch Macro: " + macroName;
            shortcut.Path             = Path.Combine(translatorFolder, "Translator.exe");
            shortcut.WorkingDirectory = translatorFolder;
            //shortcut.WindowStyle = ProcessWindowStyle.Normal;

            shortcut.Save();
        }
コード例 #2
0
ファイル: Tray.cs プロジェクト: nagyist/IR-Server-Suite
        private void LoadSettings()
        {
            try
            {
                _autoRun = SystemRegistry.GetAutoRun("Media Center Blaster");
            }
            catch (Exception ex)
            {
                IrssLog.Error(ex);

                _autoRun = false;
            }

            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(ConfigurationFile);

                _serverHost = doc.DocumentElement.Attributes["ServerHost"].Value;
            }
            catch (FileNotFoundException)
            {
                IrssLog.Warn("Configuration file not found, using defaults");

                CreateDefaultSettings();
            }
            catch (Exception ex)
            {
                IrssLog.Error(ex);

                CreateDefaultSettings();
            }
        }
コード例 #3
0
ファイル: PauseMenu.cs プロジェクト: zhuowp/CrazyCore
 protected override void Start(SystemRegistry registry)
 {
     _input = registry.GetSystem <InputSystem>();
     _gs    = registry.GetSystem <GraphicsSystem>();
     _sls   = registry.GetSystem <SceneLoaderSystem>();
     _as    = registry.GetSystem <AssetSystem>();
 }
コード例 #4
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            List <string> networkPCs = Network.GetComputers(false);

            if (networkPCs == null)
            {
                MessageBox.Show(this, "No server names detected.", "Network Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
            else
            {
                comboBoxComputer.Items.Add("localhost");
                comboBoxComputer.Items.AddRange(networkPCs.ToArray());
            }

            _irBlastLocation = SystemRegistry.GetInstallFolder();

            if (String.IsNullOrEmpty(_irBlastLocation))
            {
                MessageBox.Show(this, "IR Server Suite install location not found, please re-install IR Server Suite",
                                "Application Location Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                return;
            }
        }
コード例 #5
0
        protected override void Start(SystemRegistry registry)
        {
            _input       = registry.GetSystem <InputSystem>();
            _ballState   = GameObject.GetComponent <BallState>();
            _audioSource = new AudioSourceComponent();
            GameObject.AddComponent(_audioSource);
            _audioSource.AudioClip = new AssetRef <WaveFile>("Audio/BoostNoise.wav");
            _audioSource.Gain      = 4.0f;

            var shs = registry.GetSystem <SynchronizationHelperSystem>();

            Task.Run(() =>
            {
                var particleChildPrefab = registry.GetSystem <AssetSystem>().Database.LoadAsset <SerializedPrefab>("Prefabs/LinearBoostParticles.prefab", false);
                var particleChild       = particleChildPrefab.Instantiate(registry.GetSystem <GameObjectQuerySystem>());
                var transformFollow     = new TransformFollow()
                {
                    Target = Transform
                };
                particleChild.AddComponent(transformFollow);
                _childParticleSystem = particleChild.GetComponent <ParticleSystem>();
            });

            _currentAvailableBoosts = MaxBoosts;
        }
コード例 #6
0
 protected override void Start(SystemRegistry registry)
 {
     _physics = registry.GetSystem <PhysicsSystem>();
     _gs      = registry.GetSystem <GraphicsSystem>();
     _input   = registry.GetSystem <InputSystem>();
     _time    = (float)Math.PI / 2f;
 }
コード例 #7
0
ファイル: PresetSystem.cs プロジェクト: radiomonter/Tanki_X
 public PresetSystem(SystemRegistry systemRegistry)
 {
     systemRegistry.RegisterSingleNode <CreateByRankConfigComponent>();
     systemRegistry.RegisterSingleNode <ItemsBuyCountLimitComponent>();
     systemRegistry.RegisterSingleNode <FirstBuySaleComponent>();
     systemRegistry.RegisterSingleNode <CreatedByRankItemComponent>();
 }
コード例 #8
0
        protected override void Attached(SystemRegistry registry)
        {
            _as             = registry.GetSystem <AssetSystem>();
            _meshData       = _as.Database.LoadAsset <MeshData>(_meshAsset.ID);
            _textureData    = _as.Database.LoadAsset <ImageSharpTexture>(_textureAsset.ID);
            _transform      = GameObject.Transform;
            _centeredBounds = _meshData.GetBoundingBox();
            _objectCenter   = _centeredBounds.GetCenter();

            // _gs.ExecuteOnMainThread(() =>
            // {
            //     InitializeContextObjects(_gs.Context, _gs.MaterialCache, _gs.BufferCache);
            // });


            // _gs = registry.GetSystem<GraphicsSystem>();
            // _ad = registry.GetSystem<AssetSystem>().Database;
            // _texstture = Texture.Get(_ad);
            // _mesh = Mesh.Get(_ad);
            // _centeredBoundingSphere = _mesh.GetBoundingSphere();
            // _centeredBoundingBox = _mesh.GetBoundingBox();
            // _gs.ExecuteOnMainThread(() =>
            // {
            //     InitializeContextObjects(_gs.Context, _gs.MaterialCache, _gs.BufferCache);
            // });
        }
コード例 #9
0
ファイル: ConsoleCommand.cs プロジェクト: zhuowp/ge
        public override void Execute(string args2, SystemRegistry registry)
        {
            string[] args = args2.Split(' ');
            Process  p    = new Process()
            {
                StartInfo = new ProcessStartInfo(args[0], string.Join(" ", args.Skip(1)))
                {
                    RedirectStandardOutput = true
                }
            };

            try
            {
                p.Start();
                Task.Run(() =>
                {
                    while (!p.StandardOutput.EndOfStream)
                    {
                        string output = p.StandardOutput.ReadLine();
                        Print(output);
                    }
                });
            }
            catch (Exception e)
            {
                Print("Error starting process");
                Print(e.ToString());
            }
        }
コード例 #10
0
 protected override void Start(SystemRegistry registry)
 {
     _levelLoadTrigger = GameObject.GetComponent <LevelLoadTrigger>();
     _levelLoadTrigger.LevelLoadTriggered += OnLevelLoadTriggered;
     _goqs = registry.GetSystem <GameObjectQuerySystem>();
     _sls  = registry.GetSystem <SceneLoaderSystem>();
 }
コード例 #11
0
 protected override void Start(SystemRegistry registry)
 {
     _collider             = GameObject.GetComponent <Collider>();
     _rollSource           = GameObject.GetComponent <AudioSourceComponent>();
     _thudSource           = new AudioSourceComponent();
     _thudSource.AudioClip = ThudClip;
     GameObject.AddComponent(_thudSource);
 }
コード例 #12
0
ファイル: ParticleSystem.cs プロジェクト: zhuowp/ge
 protected override void PostAttached(SystemRegistry registry)
 {
     _gs      = registry.GetSystem <GraphicsSystem>();
     _ad      = registry.GetSystem <AssetSystem>().Database;
     _texture = Texture.Get(_ad);
     _cameraDistanceComparer = new CameraDistanceComparer(_gs);
     _gs.ExecuteOnMainThread(() => InitializeContextObjects(_gs.Context, _gs.MaterialCache, _gs.BufferCache));
 }
コード例 #13
0
 protected override void PostAttached(SystemRegistry registry)
 {
     _as = registry.GetSystem <AssetSystem>();
     if (_mesh.GetRef() != null)
     {
         SetEntity(CreateEntity());
     }
 }
コード例 #14
0
ファイル: Skybox.cs プロジェクト: zhuowp/ge
        protected override void Attached(SystemRegistry registry)
        {
            _gs = registry.GetSystem <GraphicsSystem>();
            _as = registry.GetSystem <AssetSystem>();
            var ad = _as.Database;

            RecreateCubemapTexture();
            _gs.ExecuteOnMainThread(() => InitializeContextObjects(ad, _gs.Context));
        }
コード例 #15
0
ファイル: Processor.cs プロジェクト: nagyist/IR-Server-Suite
        /// <summary>
        /// Get a list of commands found in the Command Libraries.
        /// </summary>
        /// <returns>Available commands.</returns>
        public static Type[] GetLibraryCommands()
        {
            try
            {
                List <Type> commands = new List <Type>();

                string installFolder = SystemRegistry.GetInstallFolder();
                if (String.IsNullOrEmpty(installFolder))
                {
                    return(null);
                }

                string   folder = Path.Combine(installFolder, "Commands");
                string[] files  = Directory.GetFiles(folder, "*.dll", SearchOption.TopDirectoryOnly);

                foreach (string file in files)
                {
                    try
                    {
                        Assembly assembly = Assembly.LoadFrom(file);
                        Type[]   types    = assembly.GetExportedTypes();

                        foreach (Type type in types)
                        {
                            if (type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(Command)))
                            {
                                commands.Add(type);
                            }
                        }
                    }
                    catch (BadImageFormatException)
                    {
                        // Ignore Bad Image Format Exceptions, just keep checking for IR Server Plugins
                    }
                    catch (TypeLoadException)
                    {
                        // Ignore Type Load Exceptions, just keep checking for IR Server Plugins
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString(), "Command Error");
                    }
                }

                return(commands.ToArray());
            }
#if TRACE
            catch (Exception ex)
            {
                Trace.WriteLine(ex.ToString());
#else
            catch
            {
#endif
                return(null);
            }
        }
コード例 #16
0
ファイル: ConsoleCommand.cs プロジェクト: zhuowp/ge
        public override void Execute(string args, SystemRegistry registry)
        {
            var topLevelGOs = registry.GetSystem <GameObjectQuerySystem>().GetUnparentedGameObjects();

            foreach (var go in topLevelGOs)
            {
                PrintGo(go, 0);
            }
        }
コード例 #17
0
ファイル: Skybox.cs プロジェクト: zhuowp/ge
 protected override void Removed(SystemRegistry registry)
 {
     _vb?.Dispose();
     _ib?.Dispose();
     _material?.Dispose();
     _rasterizerState?.Dispose();
     _cubemapBinding?.Dispose();
     _cubemapBinding?.BoundTexture?.Dispose();
 }
コード例 #18
0
ファイル: CharacterController.cs プロジェクト: zhuowp/ge
 protected override void Attached(SystemRegistry registry)
 {
     _physics   = registry.GetSystem <PhysicsSystem>();
     Controller = new BEPUphysics.Character.CharacterController(
         Transform.Position,
         jumpSpeed: 8f,
         tractionForce: 1500
         );
 }
コード例 #19
0
ファイル: SetupForm.cs プロジェクト: nagyist/IR-Server-Suite
 private void checkBoxAutoRun_CheckedChanged(object sender, EventArgs e)
 {
     if (checkBoxAutoRun.Checked)
     {
         SystemRegistry.SetAutoRun("Media Center Blaster", Application.ExecutablePath);
     }
     else
     {
         SystemRegistry.RemoveAutoRun("Media Center Blaster");
     }
 }
コード例 #20
0
ファイル: Magnet.cs プロジェクト: zhuowp/CrazyCore
        protected override void Start(SystemRegistry registry)
        {
            _particleSystem = GameObject.GetComponent <ParticleSystem>();
            Collider collider = GameObject.GetComponent <Collider>();

            if (collider == null)
            {
                throw new InvalidOperationException("No collider on magnet " + GameObject.Name);
            }

            collider.Layer = registry.GetSystem <PhysicsSystem>().GetLayerByName("Magnet");
        }
コード例 #21
0
        private void SaveSettings()
        {
            try
            {
                if (_autoRun)
                {
                    SystemRegistry.SetAutoRun("Tray Launcher", Application.ExecutablePath);
                }
                else
                {
                    SystemRegistry.RemoveAutoRun("Tray Launcher");
                }
            }
            catch (Exception ex)
            {
                IrssLog.Error(ex);
            }

            try
            {
                Directory.CreateDirectory(ConfigurationDir);
            }
            catch (Exception ex)
            {
                IrssLog.Error(ex);
            }

            try
            {
                using (XmlTextWriter writer = new XmlTextWriter(ConfigurationFile, Encoding.UTF8))
                {
                    writer.Formatting  = Formatting.Indented;
                    writer.Indentation = 1;
                    writer.IndentChar  = (char)9;
                    writer.WriteStartDocument(true);
                    writer.WriteStartElement("settings"); // <settings>

                    writer.WriteAttributeString("ServerHost", _serverHost);
                    writer.WriteAttributeString("ProgramFile", _programFile);
                    writer.WriteAttributeString("LaunchOnLoad", _launchOnLoad.ToString());
                    writer.WriteAttributeString("OneInstanceOnly", _oneInstanceOnly.ToString());
                    writer.WriteAttributeString("RepeatsFocus", _repeatsFocus.ToString());
                    writer.WriteAttributeString("LaunchKeyCode", _launchKeyCode);

                    writer.WriteEndElement(); // </settings>
                    writer.WriteEndDocument();
                }
            }
            catch (Exception ex)
            {
                IrssLog.Error(ex);
            }
        }
コード例 #22
0
ファイル: MainMenu.cs プロジェクト: zhuowp/CrazyCore
        protected unsafe override void Start(SystemRegistry registry)
        {
            _assetSystem = registry.GetSystem <AssetSystem>();
            _sls         = registry.GetSystem <SceneLoaderSystem>();
            _gs          = registry.GetSystem <GraphicsSystem>();
            _audioSource = GameObject.GetComponent <AudioSourceComponent>();
            LoadFont();

            _gs.ImGuiRenderer.RecreateFontDeviceTexture(_gs.Context);

            _allScenes = _assetSystem.Database.GetAssetsOfType(typeof(SceneAsset));
        }
コード例 #23
0
            public override void Execute(string args, SystemRegistry registry)
            {
                var options = registry.GetSystem <ConsoleCommandSystem>()._commandOptions;

                Print("Availiable commands:");
                foreach (var option in options)
                {
                    string name    = option.Names.Last();
                    var    aliases = option.Names.Take(option.Names.Length - 1);
                    Print($"    {name}, ({string.Join(", ", aliases)})");
                }
            }
コード例 #24
0
ファイル: MeshRenderer.cs プロジェクト: nureyev/ge
 protected override void Attached(SystemRegistry registry)
 {
     _gs      = registry.GetSystem <GraphicsSystem>();
     _ad      = registry.GetSystem <AssetSystem>().Database;
     _texture = Texture.Get(_ad);
     _mesh    = Mesh.Get(_ad);
     _centeredBoundingSphere = _mesh.GetBoundingSphere();
     _centeredBoundingBox    = _mesh.GetBoundingBox();
     _gs.ExecuteOnMainThread(() =>
     {
         InitializeContextObjects(_gs.Context, _gs.MaterialCache, _gs.BufferCache);
     });
 }
コード例 #25
0
 private void buttonKeyHelp_Click(object sender, EventArgs e)
 {
     try
     {
         string file = Path.Combine(SystemRegistry.GetInstallFolder(), "IR Server Suite.chm");
         Help.ShowHelp(this, file, HelpNavigator.Topic, "Common\\keystrokes_info.html");
     }
     catch (Exception ex)
     {
         IrssLog.Error(ex);
         MessageBox.Show(this, ex.Message, "Failed to load help", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #26
0
 private void buttonHelp_Click(object sender, EventArgs e)
 {
     try
     {
         string file = Path.Combine(SystemRegistry.GetInstallFolder(), "IR Server Suite.chm");
         Help.ShowHelp(this, file, HelpNavigator.Topic, "Plugins\\TV3 Blaster Plugin\\index.html");
     }
     catch (Exception ex)
     {
         Log.Error(ex.ToString());
         MessageBox.Show(this, ex.Message, "Failed to load help", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #27
0
ファイル: AudioSourceComponent.cs プロジェクト: zhuowp/ge
 protected override void Attached(SystemRegistry registry)
 {
     _assetSystem = registry.GetSystem <AssetSystem>();
     _audioSystem = registry.GetSystem <AudioSystem>();
     _source      = _audioSystem.Engine.ResourceFactory.CreateAudioSource();
     OnTransformChanged(Transform);
     _source.Gain    = _gain;
     _source.Looping = Looping;
     if (_clipRef != null && !_clipRef.ID.IsEmpty)
     {
         GetBufferForRef();
     }
 }
コード例 #28
0
 private void toolStripMenuItemHelp_Click(object sender, EventArgs e)
 {
     try
     {
         string file = Path.Combine(SystemRegistry.GetInstallFolder(), "IR Server Suite.chm");
         Help.ShowHelp(this, file, HelpNavigator.Topic, "Virtual Remote\\index.html");
     }
     catch (Exception ex)
     {
         IrssLog.Error(ex);
         MessageBox.Show(this, ex.Message, "Failed to load help", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #29
0
ファイル: BallController.cs プロジェクト: zhuowp/CrazyCore
        protected override void Start(SystemRegistry registry)
        {
            _input   = registry.GetSystem <InputSystem>();
            _goqs    = registry.GetSystem <GameObjectQuerySystem>();
            _gs      = registry.GetSystem <GraphicsSystem>();
            _physics = registry.GetSystem <PhysicsSystem>();
            _ball    = _goqs.FindByName(BallName);
            if (_ball == null)
            {
                throw new InvalidOperationException("No Ball found in scene with name " + BallName);
            }

            _ballCollider = _ball.GetComponent <Collider>();
            _ballState    = _ball.GetComponent <BallState>();
        }
コード例 #30
0
 protected override void Start(SystemRegistry registry)
 {
     GameObject.RemoveComponent(this);
     _ccs = registry.GetSystem <ConsoleCommandSystem>();
     if (_ccs != null)
     {
         _ccs.Print += AddLine;
         _gs         = registry.GetSystem <GraphicsSystem>();
         _input      = registry.GetSystem <InputSystem>();
     }
     else
     {
         Enabled = false;
     }
 }