コード例 #1
0
        public QuestionWindow(MainWindow mainWindow, Container container)
        {
            InitializeComponent();
            _container              = container;
            _drawHelper             = _container.GetInstance <IDrawHelper>();
            isClose                 = true;
            SoulData.CurrentRanking = 1;
            SetInfoForUser();
            _drawHelper.DrawScalesForCircle(drawingArea.Children);
            SetTotalRankings(SoulData.Alternatives.Count);
            MainWindow     = mainWindow;
            Alternatives   = new List <Label>();
            ItemsForMoving = new List <Rectangle>();
            Source         = new QuestionSource(SoulData.Alternatives.Count);
            UpdateAlternatives(SoulData.Alternatives);
            var startAlternatives = ChooseAlternativesForComparison(SoulData.CurrentRanking);

            UpdateStorage(startAlternatives);
            UpdateItemsForMoving(startAlternatives);
            _drawHelper.DrawCircleGrid(drawingArea);
            _drawHelper.HideCircleGrid(drawingArea.Children);
            _drawHelper.DrawNumericScalesForCircle(body);
            ChangeSectorsOnCircle();
            ChangeColorForGradation();
            gradationCombobox.ItemsSource = new object[6] {
                5, 10, 20, 50, 100, 500
            };
            this.Title       += $"{SoulData.CurrentRanking}/{SoulData.TotalRankings}";
            progressInfo.Text = $"{SoulData.CurrentRanking}/{SoulData.TotalRankings}";
            startInfo.Content = $"Перетягніть кружечки-альтернативи на круг переваг:";
        }
コード例 #2
0
ファイル: TextPortion.cs プロジェクト: Foxbow74/my-busycator
        public void SplitByLines(float _width, EFonts _font, float _newLineIndent, IDrawHelper _drawHelper)
        {
            var textLines = new List <TextLine>();

            var paragraphs = Text.Split(new[] { Environment.NewLine, "\t" }, StringSplitOptions.RemoveEmptyEntries);

            var sb = new StringBuilder();

            foreach (var paragraph in paragraphs)
            {
                sb.Clear();
                var x = _newLineIndent;

                var tl = new TextLine(x, Highlights);
                textLines.Add(tl);

                var part           = paragraph.Split(Punctuation);
                var processedChars = 0;
                for (var partIndex = 0; partIndex < part.Length; partIndex++)
                {
                    var addStr = part[partIndex];
                    processedChars += addStr.Length;
                    addStr         += (processedChars == 0 || processedChars >= paragraph.Length)
                                                        ? ""
                                                        : paragraph[processedChars].ToString(CultureInfo.InvariantCulture);
                    processedChars++;
                    var size = _drawHelper.MeasureString(_font, addStr);

                    if (size.Width > (_width - x))
                    {
                        tl.Text = sb.ToString();
                        sb.Clear();
                        x  = 0;
                        tl = new TextLine(x, Highlights);
                        textLines.Add(tl);
                    }
                    sb.Append(addStr);
                    x += size.Width;
                }

                if (sb.Length > 0)
                {
                    tl.Text = sb.ToString();
                }
            }
            m_textLines = textLines.ToArray();
        }
コード例 #3
0
ファイル: TextPortion.cs プロジェクト: Foxbow74/my-busycator
		public void SplitByLines(float _width, EFonts _font, float _newLineIndent, IDrawHelper _drawHelper)
		{
			var textLines = new List<TextLine>();

			var paragraphs = Text.Split(new[] {Environment.NewLine, "\t"}, StringSplitOptions.RemoveEmptyEntries);

			var sb = new StringBuilder();
			foreach (var paragraph in paragraphs)
			{
				sb.Clear();
				var x = _newLineIndent;

				var tl = new TextLine(x, Highlights);
				textLines.Add(tl);

				var part = paragraph.Split(Punctuation);
				var processedChars = 0;
				for (var partIndex = 0; partIndex < part.Length; partIndex++)
				{
					var addStr = part[partIndex];
					processedChars += addStr.Length;
					addStr += (processedChars == 0 || processedChars >= paragraph.Length)
					          	? ""
					          	: paragraph[processedChars].ToString(CultureInfo.InvariantCulture);
					processedChars++;
					var size = _drawHelper.MeasureString(_font, addStr);

					if (size.Width > (_width - x))
					{
						tl.Text = sb.ToString();
						sb.Clear();
						x = 0;
						tl = new TextLine(x, Highlights);
						textLines.Add(tl);
					}
					sb.Append(addStr);
					x += size.Width;
				}

				if (sb.Length > 0)
				{
					tl.Text = sb.ToString();
				}
			}
			m_textLines = textLines.ToArray();
		}
コード例 #4
0
ファイル: TileHelper.cs プロジェクト: Foxbow74/my-busycator
		public static void Init(IResourceProvider _resourceProvider, IDrawHelper _drawHelper)
		{
			Rp = _resourceProvider;
			DrawHelper = _drawHelper;

            Rp.RegisterFont(EFonts.COMMON, Constants.RESOURCES_FONT_FILE, 12);
            Rp.RegisterFont(EFonts.SMALL, Constants.RESOURCES_FONT_FILE, 8);

            AllTiles.Add(ETileset.NONE, new TileSet(Rp.CreateTile(0,0,FColor.Empty)));

			if (Constants.GAME_MODE && World.XResourceRoot.TileSets.Count > 0)
			{
				foreach (var xTileSet in World.XResourceRoot.TileSets)
				{
					var set = new TileSet();
					AllTiles.Add(xTileSet.Tileset, set);
					var array = xTileSet.Children.OrderBy(_info => _info.Order).ToArray();
					for (var index = 0; index < array.Length; index++)
					{
						var tileInfo = array[index];
						var atile = Rp.CreateTile(tileInfo.Cx, tileInfo.Cy, tileInfo.Color.GetFColor());
						TileSetInfoProvider.SetOpacity(xTileSet.Tileset, index, tileInfo.Opacity);
						set.AddTile(atile);
					}
				}
				foreach (var xTileSet in World.XResourceRoot.TerrainSets)
				{
					var set = new TileSet();
					AllTerrainTilesets.Add(xTileSet.Terrains, set);
					foreach (var tileInfo in xTileSet.Children.OrderBy(_info => _info.Order))
					{
						set.AddTile(Rp.CreateTile(tileInfo.Cx, tileInfo.Cy, tileInfo.Color.GetFColor()));
					}
				}
			}
			else
			{
                throw new ApplicationException("База ресурсов не содержит информации от тайлах.");
            }
		}
コード例 #5
0
        public static void Init(IResourceProvider _resourceProvider, IDrawHelper _drawHelper)
        {
            Rp         = _resourceProvider;
            DrawHelper = _drawHelper;

            Rp.RegisterFont(EFonts.COMMON, Constants.RESOURCES_FONT_FILE, 12);
            Rp.RegisterFont(EFonts.SMALL, Constants.RESOURCES_FONT_FILE, 8);

            AllTiles.Add(ETileset.NONE, new TileSet(Rp.CreateTile(0, 0, FColor.Empty)));

            if (Constants.GAME_MODE && World.XResourceRoot.TileSets.Count > 0)
            {
                foreach (var xTileSet in World.XResourceRoot.TileSets)
                {
                    var set = new TileSet();
                    AllTiles.Add(xTileSet.Tileset, set);
                    var array = xTileSet.Children.OrderBy(_info => _info.Order).ToArray();
                    for (var index = 0; index < array.Length; index++)
                    {
                        var tileInfo = array[index];
                        var atile    = Rp.CreateTile(tileInfo.Cx, tileInfo.Cy, tileInfo.Color.GetFColor());
                        TileSetInfoProvider.SetOpacity(xTileSet.Tileset, index, tileInfo.Opacity);
                        set.AddTile(atile);
                    }
                }
                foreach (var xTileSet in World.XResourceRoot.TerrainSets)
                {
                    var set = new TileSet();
                    AllTerrainTilesets.Add(xTileSet.Terrains, set);
                    foreach (var tileInfo in xTileSet.Children.OrderBy(_info => _info.Order))
                    {
                        set.AddTile(Rp.CreateTile(tileInfo.Cx, tileInfo.Cy, tileInfo.Color.GetFColor()));
                    }
                }
            }
            else
            {
                throw new ApplicationException("База ресурсов не содержит информации от тайлах.");
            }
        }
コード例 #6
0
ファイル: UIBlock.cs プロジェクト: Foxbow74/my-busycator
		public static void Init(IDrawHelper _drawHelper) { DrawHelper = _drawHelper; }
コード例 #7
0
 /// <summary>
 /// Register <see cref="IDrawHelper"/>.
 /// </summary>
 /// <param name="drawHelper"> Instance of <paramref name="drawHelper"/> to register. </param>
 protected static void RegisterIDrawHelper(IDrawHelper drawHelper)
 {
     AwesomeInventoryServiceProvider.AddService(typeof(IDrawHelper), drawHelper);
 }
コード例 #8
0
 public static void Init(IDrawHelper _drawHelper)
 {
     DrawHelper = _drawHelper;
 }
コード例 #9
0
 public StrategyHelper(IDrawHelper drawHelper)
 {
     this.drawHelper = drawHelper;
 }