Пример #1
0
 public WordCloudData(WordCloudData toCopy)
     : this(toCopy.PathedObject, toCopy.startDegree, toCopy.endDegree, extractWords(toCopy))
 {
     this.center = toCopy.center;
 }
Пример #2
0
 public WordData(WordCloudData parent, String text)
 {
     this.Text = text;
     this.Parent = parent;
 }
Пример #3
0
 private static List<String> extractWords(WordCloudData data)
 {
     List<String> words = new List<string>();
     foreach (WordData word in data.Words)
     {
         words.Add(word.Text);
     }
     return words;
 }
Пример #4
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     wordClouds.Remove(editingCloud);
     editingCloud = null;
     UpdateWordClouds();
 }
Пример #5
0
        private void PlatformDialogcs_Load(object sender, EventArgs e)
        {
            segments = new List<Point>();
            foreach (XNAPoint point in PlatformData.Segments)
            {
                segments.Add(new Point(point.X, point.Y));
            }
            nudFallTime.Value = new Decimal(PlatformData.FallTime);
            checkBoxSafe.Checked = PlatformData.SafePlatform;
            checkBoxStart.Checked = PlatformData == MapData.startPlatform;
            checkBoxInvisible.Checked = PlatformData.Invisible;
            nudSpeed.Value = PlatformData.Repeats;
            checkBoxItem.Checked = PlatformData.Item != null;
            nudSlide.Value = new Decimal(PlatformData.Slide);
            if (PlatformData.Item != null)
            {
                textBoxItemName.Text = PlatformData.Item.Name;
                comboBoxItemTexture.Text = PlatformData.Item.ImageName;
                itemOffset = new Point(PlatformData.ItemOffset.X, PlatformData.ItemOffset.Y);
            }
            else
            {
                textBoxItemName.Text = "";
                comboBoxItemTexture.Text = "";
                itemOffset = new Point();
            }

            comboBoxNextLevel.Items.Clear();
            comboBoxNextLevel.Items.Add("None");
            foreach (MapData map in EditorState.Game.Maps)
            {
                comboBoxNextLevel.Items.Add(map.Name);
            }
            if (PlatformData.NextMap != null)
            {
                comboBoxNextLevel.SelectedIndex = EditorState.Game.Maps.IndexOf(PlatformData.NextMap) + 1;
            }
            else
            {
                comboBoxNextLevel.SelectedIndex = 0;
            }

            editingCloud = null;
            originalWordClouds.Clear();
            wordClouds.Clear();
            foreach (WordCloudData wordCloud in MapData.WordClouds)
            {
                if (wordCloud.PathedObject == PlatformData)
                {
                    originalWordClouds.Add(wordCloud);
                    wordClouds.Add(new WordCloudData(wordCloud));
                }
            }
            UpdateWordClouds();

            if (wordClouds.Count > 0)
            {
                comboBoxWordClouds.SelectedIndex = 0;
            }
            else
            {
                comboBoxWordClouds.SelectedIndex = -1;
            }

            draw();
        }
Пример #6
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     saveWordCloud();
     textBoxWords.Text = "";
     if (comboBoxWordClouds.SelectedIndex >= 0 && comboBoxWordClouds.SelectedIndex < wordClouds.Count)
     {
         editingCloud = wordClouds[comboBoxWordClouds.SelectedIndex];
         nudFrom.Value = new Decimal(editingCloud.StartDegree);
         nudTo.Value = new Decimal(editingCloud.EndDegree);
         nudOffsetX.Value = new Decimal(editingCloud.Center.X);
         nudOffsetY.Value = new Decimal(editingCloud.Center.Y);
         foreach (WordData word in editingCloud.Words)
         {
             if (textBoxWords.Text != "")
             {
                 textBoxWords.Text += "\r\n";
             }
             textBoxWords.Text += word.Text;
         }
     }
 }
Пример #7
0
        private void DrawWordCloud(Graphics g, WordCloudData wordCloud)
        {
            Font smallFont = new Font("Arial", 7);
            Pen linePen = new Pen(Color.DarkBlue, 5);
            Pen dashPen = Pens.Black;

            if (wordCloud.PathedObject.GetType() == typeof(CirclePath))
            {
                CirclePath path = (CirclePath)wordCloud.PathedObject;
                Point center = MapPointOnCanvas(path.center);
                g.DrawEllipse(dashPen, center.X - CIRCLE_DRAW_RADIUS, center.Y - CIRCLE_DRAW_RADIUS,
                    CIRCLE_DRAW_RADIUS * 2, CIRCLE_DRAW_RADIUS * 2);
            }
            else
            {
                g.DrawLine(linePen, MapPointOnCanvas(wordCloud.StartPosition),
                    MapPointOnCanvas(wordCloud.EndPosition));
            }

            foreach (WordData word in wordCloud.Words)
            {
                for (int i = 0; i < word.points.Count; i++)
                {
                    int lastIndex = i == 0 ? word.points.Count - 1 : i - 1;
                    Point p1 = MapPointOnCanvas(word.points[lastIndex]);
                    Point p2 = MapPointOnCanvas(word.points[i]);
                    g.DrawEllipse(Pens.Black, new Rectangle(p1.X - 2, p1.Y - 2, 4, 4));
                }
                DrawPath(g, word, dashPen);

                g.DrawString(word.Text, smallFont, Brushes.Black,
                    MapPointOnCanvas(word.GetPosition(Degree)));
            }
        }