Ejemplo n.º 1
0
        // Constructor
        public TextEditor2ViewModel(PluginManager pluginManager, IStateInfo koreFile)
        {
            _pluginManager = pluginManager;
            KoreFile       = koreFile;

            _state       = KoreFile.PluginState as ITextState;
            GameAdapters = pluginManager.GetGameAdapters().Select(ga => new GameAdapter(ga)).ToList();

            // TODO: Implement game adapter persistence
            SelectedGameAdapter = GameAdapters.FirstOrDefault();
            SelectedZoomLevel   = 1;

            if (Keyboard.IsKeyDown(Key.LeftShift))
            {
                SelectedGameAdapter = GameAdapters.FirstOrDefault(ga => ga.Adapter.PluginId == Guid.Parse("84D2BD62-7AC6-459B-B3BB-3A65855135F6")) ?? GameAdapters.First();
                SelectedZoomLevel   = 2;
            }
            else if (Keyboard.IsKeyDown(Key.LeftAlt))
            {
                SelectedGameAdapter = GameAdapters.FirstOrDefault(ga => ga.Adapter.PluginId == Guid.Parse("B344166C-F1BE-49B2-9ADC-38771D0A15DA")) ?? GameAdapters.First();
                SelectedZoomLevel   = 1;
            }

            SelectedEntry = Entries?.FirstOrDefault();
        }
        // Constructor
        public TextEditor2ViewModel(KoreManager kore, KoreFileInfo koreFile)
        {
            _kore    = kore;
            KoreFile = koreFile;

            _adapter     = KoreFile.Adapter as ITextAdapter;
            GameAdapters = _kore.GetAdapters <IGameAdapter>().Select(ga => new GameAdapter(ga)).ToList();

            // TODO: Implement game adapter persistence
            SelectedGameAdapter = GameAdapters.FirstOrDefault();
            SelectedZoomLevel   = 1;

            if (Keyboard.IsKeyDown(Key.LeftShift))
            {
                SelectedGameAdapter = GameAdapters.FirstOrDefault(ga => ga.Adapter.GetType().GetCustomAttribute <PluginInfoAttribute>().ID == "84D2BD62-7AC6-459B-B3BB-3A65855135F6") ?? GameAdapters.First();
                SelectedZoomLevel   = 2;
            }
            else if (Keyboard.IsKeyDown(Key.LeftAlt))
            {
                SelectedGameAdapter = GameAdapters.FirstOrDefault(ga => ga.Adapter.GetType().GetCustomAttribute <PluginInfoAttribute>().ID == "B344166C-F1BE-49B2-9ADC-38771D0A15DA") ?? GameAdapters.First();
                SelectedZoomLevel   = 1;
            }

            // Direct entry loading is now dead since GameAdapters have become a thing
            //if (_adapter != null)
            //    Entries = new ObservableCollection<TextEntry>(_adapter.Entries);

            SelectedEntry = Entries?.FirstOrDefault();
        }
Ejemplo n.º 3
0
        // Constructor
        public TextEditor2ViewModel(FileManager fileManager, PluginLoader pluginLoader, KoreFileInfo koreFile)
        {
            _fileManager  = fileManager;
            _pluginLoader = pluginLoader;
            KoreFile      = koreFile;

            _adapter     = KoreFile.Adapter as ITextAdapter;
            GameAdapters = _pluginLoader.GetAdapters <IGameAdapter>().Select(ga => new GameAdapter(ga)).ToList();

            // TODO: Implement game adapter persistence
            SelectedGameAdapter = GameAdapters.FirstOrDefault();
            SelectedZoomLevel   = 1;

            if (Keyboard.IsKeyDown(Key.LeftShift))
            {
                SelectedGameAdapter = GameAdapters.FirstOrDefault(ga => ga.Adapter.GetType().GetCustomAttribute <PluginInfoAttribute>().ID == "84D2BD62-7AC6-459B-B3BB-3A65855135F6") ?? GameAdapters.First();
                SelectedZoomLevel   = 2;
            }
            else if (Keyboard.IsKeyDown(Key.LeftAlt))
            {
                SelectedGameAdapter = GameAdapters.FirstOrDefault(ga => ga.Adapter.GetType().GetCustomAttribute <PluginInfoAttribute>().ID == "B344166C-F1BE-49B2-9ADC-38771D0A15DA") ?? GameAdapters.First();
                SelectedZoomLevel   = 1;
            }

            SelectedEntry = Entries?.FirstOrDefault();
        }