Пример #1
0
        public override void Init()
        {
            _keyboardSettings = _settingsService.GetSettings <ChartsSettings>().Keyboard;

            Account = _tradingService.CurrentAccount;

            _instrument = _tradingService.GetInstrument(_marketEpic);

            _currency          = _instrument.InstrumentData.currencies.First().code;
            DoublePlacesFactor = _instrument.SnapshotData.doublePlacesFactor;
            ScalingFactor      = _instrument.SnapshotData.scalingFactor;

            Title = _instrument.InstrumentData.name;

            LoadMarketSettings();

            PivotPoints = _tradingService.GetPivotPoints(_marketEpic);

            _tradingService.SubscribeToChartCandle();

            foreach (var position in _tradingService.Positions.Where(p => p.Instrument.Epic == _marketEpic))
            {
                AddPosition(position);
            }

            Messenger.Default.Register <PositionAddedMessage>(this, _marketEpic, PositionAddedMessageReceived);
            Messenger.Default.Register <PositionDeletedMessage>(this, _marketEpic, PositionDeletedMessageReceived);
            Messenger.Default.Register <SettingsChangedMessage>(this, SettingsUpdated);
        }
Пример #2
0
        public KeyboardSettingsViewModel(KeyboardSettings keyboardSettings)
        {
            BuyKey      = null;
            SellKey     = null;
            CloseAllKey = null;

            if (keyboardSettings == null)
            {
                return;
            }

            if (keyboardSettings.BuyKey != null)
            {
                BuyKey = keyboardSettings.BuyKey.Key;
            }

            if (keyboardSettings.SellKey != null)
            {
                SellKey = keyboardSettings.SellKey.Key;
            }

            if (keyboardSettings.CloseAllKey != null)
            {
                CloseAllKey = keyboardSettings.CloseAllKey.Key;
            }
        }
Пример #3
0
        public KeyboardSettings Validate()
        {
            var ks = new KeyboardSettings();

            if (BuyKey.HasValue)
            {
                ks.BuyKey = new KeyValue {
                    Key = BuyKey.Value
                }
            }
            ;

            if (SellKey.HasValue)
            {
                ks.SellKey = new KeyValue {
                    Key = SellKey.Value
                }
            }
            ;

            if (CloseAllKey.HasValue)
            {
                ks.CloseAllKey = new KeyValue {
                    Key = CloseAllKey.Value
                }
            }
            ;

            return(ks);
        }
    }
}
Пример #4
0
 public ApplicationSettings()
 {
     ActionCenter = new ActionCenterSettings();
     Audio        = new AudioSettings();
     Browser      = new BrowserSettings();
     Keyboard     = new KeyboardSettings();
     Mouse        = new MouseSettings();
     Service      = new ServiceSettings();
     Taskbar      = new TaskbarSettings();
 }
Пример #5
0
    public static void CreateMyAsset()
    {
        KeyboardSettings asset = ScriptableObject.CreateInstance <KeyboardSettings>();

        AssetDatabase.CreateAsset(asset, "Assets/Data/KeyboardSetups/NewKeyboardSetup.asset");
        AssetDatabase.SaveAssets();

        EditorUtility.FocusProjectWindow();

        Selection.activeObject = asset;
    }
Пример #6
0
        public static Dictionary<Buttons, Keys> GetKeyboardDictionary(KeyboardSettings keyboard)
        {
            Dictionary<Buttons, Keys> dictionary =
                new Dictionary<Buttons, Keys>();

            dictionary.Add(Buttons.A, keyboard.A);
            dictionary.Add(Buttons.B, keyboard.B);
            dictionary.Add(Buttons.X, keyboard.X);
            dictionary.Add(Buttons.Y, keyboard.Y);

            return dictionary;
        }
Пример #7
0
 // Use this for initialization
 void Awake()
 {
     if (Instance == null)
     {
         DontDestroyOnLoad(gameObject);
         Instance         = this;
         KeyboardSettings = new KeyboardSettings();
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
Пример #8
0
 public AppSettings()
 {
     ActionCenter = new ActionCenterSettings();
     Applications = new ApplicationSettings();
     Audio        = new AudioSettings();
     Browser      = new BrowserSettings();
     Keyboard     = new KeyboardSettings();
     Mouse        = new MouseSettings();
     Proctoring   = new ProctoringSettings();
     Security     = new SecuritySettings();
     Server       = new ServerSettings();
     Service      = new ServiceSettings();
     Taskbar      = new TaskbarSettings();
 }
Пример #9
0
    /// <summary>
    /// 初始化键盘设置的回调函数
    /// </summary>
    public void InitKeyboardSettingsCallBack(string context)
    {
        if (string.IsNullOrEmpty(context))
        {
            Debug.LogError("Init keyboard config error ! Null config string");
        }

        try
        {
            KeyboardSettings kss = JsonUtility.FromJson <KeyboardSettings>(context);
            foreach (var k in kss.keyboardEntities)
            {
                keyboardEntities.Add(k.id, k);
            }
        }catch (Exception e)
        {
            Debug.LogError(e.Message);
        }
    }
Пример #10
0
    /// <summary>
    /// 保存当前按钮配置
    /// </summary>
    /// <param name="data"></param>
    private void InputConfigSaveListener(EventData data)
    {
        bool onePlayer = true;
        //将InputManager中的数据更新为最新
        List <Text> inputFields = data.Param as List <Text>;

        foreach (var t in inputFields)
        {
            int    id      = 0;
            string gameKey = null;
            if (t.gameObject.name.EndsWith("_Player2"))
            {
                //id=1,玩家2
                id        = 1;
                onePlayer = false;
            }
            //Text_xxx形式
            gameKey = t.name.Split('_')[1];
            GameKey key = (GameKey)Enum.Parse(typeof(GameKey), gameKey, true);
            InputManager.Instance.SetGameKey(id, key, t.text);
        }

        if (onePlayer)
        {
            //排除一种情况。单人配置存储后,本身是合法的。但是与双人配置冲突,此时自动调整双人配置,保证manager中的配置一直都是合法的
            List <string> bucket0 = new List <string>();
            List <string> bucket1 = new List <string>();
            foreach (GameKey gk in Enum.GetValues(typeof(GameKey)))
            {
                string key = InputManager.Instance.GetGamekey(0, gk);
                bucket0.Add(key);
            }

            foreach (GameKey gk in Enum.GetValues(typeof(GameKey)))
            {
                string key = InputManager.Instance.GetGamekey(1, gk);

                if (bucket0.Exists((v) => { return(v.Equals(key)); }))
                {
                    //这个gk 要改值
                    InputManager.Instance.SetGameKey(1, gk, "");
                }
                else
                {
                    bucket1.Add(key);
                }
            }

            foreach (GameKey gk in Enum.GetValues(typeof(GameKey)))
            {
                string key = InputManager.Instance.GetGamekey(1, gk);
                if (key.Equals(""))
                {
                    foreach (KeyCode kc in Enum.GetValues(typeof(KeyCode)))
                    {
                        if (kc != KeyCode.None &&
                            !bucket1.Exists((v) => { return(v.Equals(kc.ToString())); }) &&
                            !bucket0.Exists((v) => { return(v.Equals(kc.ToString())); }))
                        {
                            InputManager.Instance.SetGameKey(1, gk, kc.ToString());
                            bucket1.Add(kc.ToString());
                            break;
                        }
                    }
                }
            }
        }
        //将最新数据存储到persistent文件夹中,保持内存中和磁盘中一致

        List <KeyboardEntity> kbe = new List <KeyboardEntity>();

        for (int playerId = 0; playerId < 2; playerId++)
        {
            kbe.Add(GetPlayerKeyboardSetting(playerId));
        }
        KeyboardSettings kbs = new KeyboardSettings();

        kbs.keyboardEntities = kbe;
        string context = JsonUtility.ToJson(kbs, true);

        DataManager.Instance.SaveData("KeyboardSettings", context);
    }
Пример #11
0
 private void SettingsUpdated(SettingsChangedMessage message)
 {
     _keyboardSettings = _settingsService.GetSettings <ChartsSettings>().Keyboard;
 }
 public KeyboardInterceptor(KeyboardSettings settings, ILogger logger)
 {
     this.logger   = logger;
     this.settings = settings;
 }
Пример #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NvdaDriverOptions"/> class.
        /// </summary>
        public NvdaDriverOptions()
        {
            GeneralSettings = new GeneralSettings
            {
                Language = NvdaLanguage.English,
                PlayStartAndExitSounds = true,
            };

            SpeechSettings = new SpeechSettings
            {
                AutoDialectSwitching       = false,
                AutoLanguageSwitching      = true,
                IncludeUnicodeDescriptions = true,
                PunctuationLevel           = PunctuationLevel.Some,
                SayCapForCapitals          = false,
                UseSpellingFunctionality   = true,
            };

            DocumentFormattingSettings = new DocumentFormattingSettings
            {
                ReportFontName             = false,
                ReportFontSize             = false,
                ReportFontAttributes       = false,
                ReportEmphasis             = false,
                ReportStyle                = false,
                ReportColor                = false,
                ReportComments             = true,
                ReportRevisions            = true,
                ReportSpellingErrors       = true,
                ReportPage                 = true,
                ReportLineNumber           = false,
                ReportLineIndentation      = false,
                ReportParagraphIndentation = false,
                ReportLineSpacing          = false,
                ReportAlignment            = false,
                ReportTables               = true,
                ReportTableHeaders         = true,
                ReportTableCellCoords      = true,
                ReportBorderColor          = false,
                ReportBorderStyle          = false,
                ReportHeadings             = true,
                ReportLinks                = true,
                ReportLists                = true,
                ReportBlockQuotes          = true,
                ReportLandmarks            = true,
                ReportFrames               = true,
                ReportClickable            = true,
                DetectFormatAfterCursor    = false,
                IncludeLayoutTables        = false,
            };

            InputCompositionSettings = new InputCompositionSettings
            {
                AutoReportAllCandidates   = true,
                AnnounceSelectedCandidate = true,
                AlwaysIncludeShortCharacterDescriptionInCandidateName = true,
                ReportReadingStringChanges     = true,
                ReportCompositionStringChanges = true,
            };

            KeyboardSettings = new KeyboardSettings
            {
                KeyboardLayout          = KeyboardLayout.Desktop,
                SpeakTypedCharacters    = true,
                SpeakTypedWords         = false,
                SpeechInterruptForEnter = true,
            };

            PresentationSettings = new PresentationSettings
            {
                ReportTooltips                  = false,
                ReportHelpBalloons              = true,
                ReportKeyboardShortcuts         = true,
                ReportObjectPositionInformation = true,
                GuessObjectPositionInformationWhenUnavailable = false,
                ReportObjectDescriptions = true,
                ProgressBarUpdates       = new ProgressBarUpdateSettings
                {
                    ProgressBarOutputMode        = ProgressBarOutputMode.Beep,
                    ReportBackgroundProgressBars = false,
                },
                ReportDynamicContentChanges = true,
            };

            ReviewCursorSettings = new ReviewCursorSettings
            {
                FollowFocus      = true,
                FollowCaret      = true,
                FollowMouse      = false,
                SimpleReviewMode = true,
            };

            BrowseModeSettings = new BrowseModesSettings
            {
                MaxLineLength                = 100,
                LinesPerPage                 = 25,
                UseScreenLayout              = true,
                AutoSayAllOnPageLoad         = true,
                AutoPassThroughOnCaretMove   = false,
                AutoPassThroughOnFocusChange = true,
                TrapNonCommandGestures       = true,
            };
        }
Пример #14
0
 public KeyboardInterceptor(ILogger logger, INativeMethods nativeMethods, KeyboardSettings settings)
 {
     this.logger        = logger;
     this.nativeMethods = nativeMethods;
     this.settings      = settings;
 }