public void LoadFromModel(Model.GenerationConfig config, ConfigViewModel viewModel) { viewModel.FontIndex.Value = config.FontIndex; viewModel.FontName.Value = config.FontName; viewModel.TextPath.String = config.TextPath; viewModel.ExportPath.String = config.ExportPath; viewModel.SheetName.String = config.SheetName; viewModel.FontSize.Value = config.FontSize; viewModel.TextureSize.Value = config.TextureSize; viewModel.OutlineSize.Value = config.OutlineSize; viewModel.OutlineSampling.Value = config.OutlineSampling; viewModel.FontColor.Value = ToAsdColor(config.FontColor); viewModel.OutlineColor.Value = ToAsdColor(config.OutlineColor); }
public Model.GenerationConfig ConvertToModel(ConfigViewModel viewModel) { return(new Model.GenerationConfig { FontIndex = viewModel.FontIndex.Value, FontName = viewModel.FontName.Value, TextPath = viewModel.TextPath.String, ExportPath = viewModel.ExportPath.String, SheetName = viewModel.SheetName.String, FontSize = viewModel.FontSize.Value, TextureSize = viewModel.TextureSize.Value, OutlineSize = viewModel.OutlineSize.Value, OutlineSampling = viewModel.OutlineSampling.Value, FontColor = ToModelColor(viewModel.FontColor.Value), OutlineColor = ToModelColor(viewModel.OutlineColor.Value), }); }
public ToolRenderer() { TryLoadFont( new[] { "C:\\Windows\\Fonts\\meiryo.ttc", "/Library/Fonts/ヒラギノ丸ゴ Pro W4.otf", "/Library/Fonts/ヒラギノ丸ゴ ProN W4.ttc", "/System/Library/Fonts/ヒラギノ丸ゴ ProN W4.ttc", } ); var name2path = Model.Helper.GetFontPairs(); foreach (var np in name2path) { fontPairs.Add(np); } fontListStr = string.Join(";", fontPairs.Select(_ => _.Name)); viewModel = new ConfigViewModel(); strConverter = new StringConverter(); converter = new ConfigConverter(strConverter); viewModel.FontName.Value = fontPairs[selectedFont].Name; viewModel.OnNeedToUpdatePreview .Throttle(TimeSpan.FromSeconds(1)) .Subscribe(x => { Generator.GeneratePreviewAsync(converter.ConvertToModel(viewModel)) .ContinueWith(p => { previewPath = p.Result; isReloadRequired = true; }); }); }