protected override object SerializeMessage <TMessage, TBuilder>(TMessage message)
        {
            DictionaryWriter writer = new DictionaryWriter();

            writer.WriteMessage(message);
            return(writer.ToDictionary());
        }
Esempio n. 2
0
        public override string GetNextWord()
        {
            var randomWordIndex = new Random().Next() % WordsData.Count;

            DictionaryWriter.IncrementEntityChoosingTimesCount(WordsData[randomWordIndex].Index);
            return(WordsData[randomWordIndex].FirstWord);
        }
 public MainViewModel(NextWordChooser nextWordChooser, IDictionary translator, DictionaryWriter dictionaryWriter, EntityBuilder entityBuilder, DictionaryType dictionaryType)
 {
     _nextWordChooser  = nextWordChooser;
     _translator       = translator;
     _dictionaryWriter = dictionaryWriter;
     _entityBuilder    = entityBuilder;
     _dictionaryType   = dictionaryType;
 }
Esempio n. 4
0
        protected override void SetUp()
        {
            base.SetUp();

            ownerDocument  = NewMock <IDocumentWriter>();
            valuesCache    = NewMock <IValuesCache>();
            objectWriter   = NewMock <IObjectWriter>();
            typeNamesCache = NewMock <ITypeNamesCache>();

            writer = new DictionaryWriter(ownerDocument, valuesCache, objectWriter, typeNamesCache);
        }
        public static DictionaryWriter GetWriter()
        {
            if (_dictionaryWriter != null)
            {
                return(_dictionaryWriter);
            }

            var dictionaryTypeToPathMap = DictionaryTypeToPathMapInitializer.GetMap();

            _dictionaryWriter = new DictionaryWriter(dictionaryTypeToPathMap.GetDictionaryPath(Config.Instance.DictionaryType));
            return(_dictionaryWriter);
        }
    private void Awake()
    {
        if (Instance == null)
        {
            DontDestroyOnLoad(gameObject);
            Instance = this;

            players = new List <PlayerScore>();
            path    = Application.persistentDataPath + "/scores.json";
            Debug.Log(path);

            if (!File.Exists(path))
            {
                File.WriteAllText(path, "");
            }

            UpdateScores();
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }
    }
Esempio n. 7
0
 public RandomNextWordChooser(IDictionary dictionary, DictionaryWriter dictionaryWriter)
     : base(dictionary, dictionaryWriter)
 {
 }
 protected NextWordChooser(IDictionary dictionary, DictionaryWriter dictionaryWriter)
 {
     DictionaryWriter = dictionaryWriter;
     WordsData        = dictionary.GetWords();
 }