예제 #1
0
        public void SetTransition(Vector2 _position)
        {
            if (inScreen)
            {
                using (DropDownDialog mapSelected = new DropDownDialog(".gmap", "Map", "Selected Map:"))
                {
                    MapObject mObject = mapInfo.MapObjects.AsQueryable().Where(x => x.DestinationBox.Contains(_position - Position)).FirstOrDefault();


                    mapSelected.ShowDialog();
                    DialogResult result  = mapSelected.DialogResult;
                    String       results = mapSelected.GetCleanText();

                    if (result == DialogResult.OK && results != "")
                    {
                        Tile t = cursor.Selected;
                        if (mObject == null)
                        {
                            MapObject obj = new MapObject();
                            obj.AddTile(t);
                            obj.SetType(MapTypeObject.Transition);
                            obj.Data = results;
                            mapInfo.MapObjects.Add(obj);
                        }
                        else if (mObject.Type == MapTypeObject.Transition)
                        {
                            mObject.AddTile(t);
                            mObject.SetType(MapTypeObject.Transition);
                            mObject.Data = results;
                        }
                    }
                }
            }
        }
예제 #2
0
 internal void SetMusic()
 {
     using (DropDownDialog musicDialog = new DropDownDialog(".mp3", "Music", "Choose Music:"))
     {
         DialogResult result = musicDialog.ShowDialog();
         if (result == DialogResult.OK)
         {
             mapInfo.Music = musicDialog.GetCleanText().Replace(".mp3", "");
         }
     }
 }
예제 #3
0
        private void FastGridUserHitCell(object sender, MouseEventArgs e, int rowIndex, FastColumn col)
        {
            if (e.Button != MouseButtons.Left || rowIndex < 0)
            {
                return;
            }

            var description = fastGrid.rows[rowIndex].ValueObject as TemplateDescription;

            if (col.PropertyName == description.Property(p => p.Close))
            {
                var templateDescription = fastGrid.GetRowValues <TemplateDescription>(false).ToList();
                if (description != null)
                {
                    ChartTemplate.DellChartTemplate(description.Name);
                    templateDescription.Remove(description);
                    fastGrid.DataBind(templateDescription);
                    fastGrid.Invalidate();
                }
            }
            else if (col.PropertyName == description.Property(p => p.Name))
            {
                var dropDownDialog = new DropDownDialog("Введите название",
                                                        fastGrid.GetRowValues <TemplateDescription>(false)
                                                        .Select(x => x.Name)
                                                        .Cast <object>()
                                                        .ToList(), false);
                dropDownDialog.SelectedText = description.Name;
                var dialogResult = dropDownDialog.ShowDialog();
                var newName      = dropDownDialog.SelectedText;
                if (dialogResult == DialogResult.Cancel || newName == description.Name)
                {
                    return;
                }
                if (!ChartTemplate.UpdateChartTemplateName(description.Name, newName))
                {
                    description.Name = newName;
                    fastGrid.UpdateRow(rowIndex, description);
                    fastGrid.InvalidateRow(rowIndex);
                }
                else
                {
                    Rebind();
                }
            }
            else if (col.PropertyName == description.Property(p => p.IndicatorsCount))
            {
                if (description != null)
                {
                    ShowTooltip(string.Format("Шаблон \"{0}\" содержит индикаторы", description.Name),
                                string.Join(Environment.NewLine, description.IndicatorNames), e.X, e.Y);
                }
            }
        }
예제 #4
0
 public static E LoadFileGameObject(string _fileExt, string _folderName)
 {
     using (DropDownDialog fDialog = new DropDownDialog(_fileExt, "Map", $"Load ({_fileExt})"))
     {
         DialogResult dg = fDialog.ShowDialog();
         if (dg == DialogResult.OK)
         {
             String fileName = fDialog.GetField();
             return(DeserializeObject(File.ReadAllText(fileName)));
         }
         throw new NoFileSelectedException();
     }
 }
예제 #5
0
        public static bool ShowComboDialog(string caption, List <object> items, out object selected, out string inputText,
                                           FormStartPosition startPosition, bool listStyle)
        {
            selected  = null;
            inputText = null;
            var ddd = new DropDownDialog(caption, items, listStyle)
            {
                StartPosition = startPosition
            };

            if (ddd.ShowDialog() == DialogResult.OK)
            {
                selected  = ddd.SelectedItem;
                inputText = ddd.SelectedText;
                return(true);
            }
            return(false);
        }