Пример #1
0
        public List <int>[] Build(LabyrinthData labyrinth, AssetInfo info, IsometricMode mode, IAssetManager assets)
        {
            if (labyrinth == null)
            {
                throw new ArgumentNullException(nameof(labyrinth));
            }
            _labId = labyrinth.Id;
            _mode  = mode;

            _layout.Load(labyrinth, info, _mode, BuildProperties(), _paletteId, assets);
            int rows = (_layout.TileCount + _tilesPerRow - 1) / _tilesPerRow;

            if (Framebuffer != null)
            {
                Framebuffer.Width  = (uint)(_width * _tilesPerRow);
                Framebuffer.Height = (uint)(_height * rows);
            }

            Update();

            return(mode switch
            {
                IsometricMode.Floors => _layout.FloorFrames,
                IsometricMode.Ceilings => _layout.CeilingFrames,
                IsometricMode.Walls => _layout.WallFrames,
                IsometricMode.Contents => _layout.ContentsFrames,
                _ => null
            });
Пример #2
0
        protected override void OnMeasureItem(MeasureItemEventArgs e)
        {
            base.OnMeasureItem(e);
            Image image = LabyrinthData.ElementImages.Images[LabyrinthData.GetImageIndex((ElementType)this.Items[e.Index])];

            e.ItemHeight = image.Height;
        }
Пример #3
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            base.OnDrawItem(e);
            if (e.Index == -1)
            {
                return;
            }
            e.DrawBackground();
            if ((e.State & DrawItemState.Focus) == DrawItemState.Focus)
            {
                e.DrawFocusRectangle();
            }
            ElementType type  = (ElementType)this.Items[e.Index];
            string      s     = type.ToString();
            Image       image = LabyrinthData.ElementImages.Images[LabyrinthData.GetImageIndex(type)];

            e.Graphics.DrawImage(image, e.Bounds.Location);
            Rectangle bounds = e.Bounds;

            bounds.X     += LabyrinthData.ElementImages.ImageSize.Width;
            bounds.Width -= LabyrinthData.ElementImages.ImageSize.Width;
            SolidBrush solidBrush = new SolidBrush(e.ForeColor);

            e.Graphics.DrawString(s, e.Font, (Brush)solidBrush, (RectangleF)bounds, this.fFormat);
        }
Пример #4
0
        public object Load(BinaryReader br, long streamLength, string name, AssetInfo config)
        {
            var labyrinth = new LabyrinthData();

            LabyrinthData.Serialize(labyrinth, new GenericBinaryReader(br), streamLength);
            return(labyrinth);
        }
Пример #5
0
 private void update_results(SearchResult[] results, ListView control)
 {
     control.BeginUpdate();
     control.Items.Clear();
     if (results.Length != 0)
     {
         ArrayList arrayList = new ArrayList();
         foreach (SearchResult result in results)
         {
             arrayList.Add((object)new ListViewItem(result.Data.ToString())
             {
                 SubItems =
                 {
                     result.Data.GetType().Name,
                     result.Details != null ? result.Details.ToString() : ""
                 },
                 ImageIndex = LabyrinthData.GetImageIndex(result.Data),
                 Tag        = (object)result
             });
         }
         control.Items.AddRange((ListViewItem[])arrayList.ToArray(typeof(ListViewItem)));
     }
     else
     {
         ListViewItem listViewItem = control.Items.Add("No results were found.");
         listViewItem.ImageIndex = 0;
         listViewItem.ForeColor  = SystemColors.GrayText;
     }
     control.EndUpdate();
 }
Пример #6
0
 public MapRenderable3D(MapDataId mapId, MapData3D mapData, LabyrinthData labyrinthData, Vector3 tileSize) : base(Handlers)
 {
     _mapId         = mapId;
     _mapData       = mapData;
     _labyrinthData = labyrinthData;
     _tileSize      = tileSize;
 }
Пример #7
0
 public LogicalMap3D(MapData3D mapData,
                     LabyrinthData labyrinth,
                     MapChangeCollection tempChanges,
                     MapChangeCollection permChanges) : base(mapData, tempChanges, permChanges)
 {
     _mapData   = mapData ?? throw new ArgumentNullException(nameof(mapData));
     _labyrinth = labyrinth ?? throw new ArgumentNullException(nameof(labyrinth));
 }
Пример #8
0
 private Image get_element_icon(Element e)
 {
     if (this.TopLevelControl is MainForm)
     {
         return(LabyrinthData.ElementImages.Images[LabyrinthData.GetImageIndex(e.Type)]);
     }
     return((Image)null);
 }
Пример #9
0
        public MapRenderable3D(MapId mapId, MapData3D mapData, LabyrinthData labyrinthData, Vector3 tileSize)
        {
            On <SlowClockEvent>(OnSlowClock);
            On <SortMapTilesEvent>(e => _isSorting = e.IsSorting);
            On <LoadPaletteEvent>(e => { });

            _mapId         = mapId;
            _mapData       = mapData;
            _labyrinthData = labyrinthData;
            _tileSize      = tileSize;
        }
Пример #10
0
    public static List <TiledProperty> BuildIsoTileProperties(LabyrinthData labyrinth, int index, IsometricMode isoMode)
    {
        var properties = new List <TiledProperty>();

        if (index == 0) // First tile always blank
        {
            return(properties);
        }

        if (isoMode is IsometricMode.Floors or IsometricMode.Ceilings)
        {
            var floor = labyrinth.FloorAndCeilings[index - 1];
            if (floor == null)
            {
                return(properties);
            }
            properties.Add(new(Prop.Flags, floor.Properties.ToString()));
            properties.Add(new(Prop.Unk1, floor.Unk1));
            properties.Add(new(Prop.Unk2, floor.Unk2));
            properties.Add(new(Prop.Unk3, floor.Unk3));
            properties.Add(new(Prop.Unk5, floor.Unk5));
            properties.Add(new(Prop.Unk8, floor.Unk8));
        }

        if (isoMode == IsometricMode.Walls)
        {
            var wall = labyrinth.Walls[index - 1];
            if (wall == null)
            {
                return(properties);
            }
            properties.Add(new(Prop.AutoGfx, wall.AutoGfxType));
            properties.Add(new(Prop.Collision, wall.Collision));
            properties.Add(new(Prop.Flags, wall.Properties.ToString()));
            properties.Add(new(Prop.Unk9, wall.Unk9));
        }

        if (isoMode == IsometricMode.Contents)
        {
            var group = labyrinth.ObjectGroups[index - 1];
            properties.Add(new(Prop.AutoGfx, group.AutoGraphicsId));
            var objects = group.SubObjects
                          .Where(x => x != null)
                          .Select(x => x.ObjectInfoNumber >= labyrinth.Objects.Count ? null : labyrinth.Objects[x.ObjectInfoNumber])
                          .Where(x => x != null)
                          .ToList();

            properties.Add(new(Prop.Collision, string.Join("; ", objects.Select(x => x.Collision))));
            properties.Add(new(Prop.Flags, string.Join("; ", objects.Select(x => x.Properties))));
            properties.Add(new(Prop.Unk7, string.Join("; ", objects.Select(x => x.Unk7))));
        }

        return(properties);
    }
Пример #11
0
 private void RightClickPaste_Click(object sender, EventArgs e)
 {
     try
     {
         this.import_data(Clipboard.GetDataObject());
     }
     catch (Exception ex)
     {
         LabyrinthData.Log((object)ex);
     }
 }
Пример #12
0
 private void RightClickSelectAll_Click(object sender, EventArgs e)
 {
     try
     {
         this.ContentBox.SelectAll();
     }
     catch (Exception ex)
     {
         LabyrinthData.Log((object)ex);
     }
 }
Пример #13
0
 private void RightClickCopy_Click(object sender, EventArgs e)
 {
     try
     {
         Clipboard.SetDataObject((object)new DataObject(DataFormats.Rtf, (object)this.ContentBox.SelectedRtf), true);
     }
     catch (Exception ex)
     {
         LabyrinthData.Log((object)ex);
     }
 }
Пример #14
0
 private void EmailLbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     try
     {
         Process.Start("mailto:" + this.EmailLbl.Text);
     }
     catch (Exception ex)
     {
         LabyrinthData.Log((object)ex);
     }
 }
Пример #15
0
 private void DetailsBox_LinkClicked(object sender, LinkClickedEventArgs e)
 {
     try
     {
         Process.Start(e.LinkText);
     }
     catch (Exception ex)
     {
         LabyrinthData.Log((object)ex);
     }
 }
Пример #16
0
 private void FilenameLbl_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     try
     {
         Process.Start(this.FilenameLbl.Text);
     }
     catch (Exception ex)
     {
         LabyrinthData.Log((object)ex);
         int num = (int)MessageBox.Show(ex.Message, "Labyrinth", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
 }
Пример #17
0
 public MergeElementsDlg()
 {
     this.InitializeComponent();
     this.ElementList.SmallImageList     = LabyrinthData.ElementImages;
     this.ElementList.ListViewItemSorter = (IComparer) new ListViewSorter();
     foreach (Element element in LabyrinthData.Project.Elements)
     {
         ListViewItem listViewItem = this.ElementList.Items.Add(element.Name);
         listViewItem.ImageIndex = LabyrinthData.GetImageIndex(element.Type);
         listViewItem.Tag        = (object)element;
     }
     this.light_ok();
 }
Пример #18
0
 private void ToolBar_ButtonClick(object sender, ToolBarButtonClickEventArgs e)
 {
     try
     {
         if (e.Button == this.TextBtn)
         {
             this.fShowText = !this.fShowText;
             this.update_annotations();
         }
         else if (e.Button == this.LinkBtn)
         {
             this.fShowLink = !this.fShowLink;
             this.update_annotations();
         }
         else if (e.Button == this.SketchBtn)
         {
             this.fShowSketch = !this.fShowSketch;
             this.update_annotations();
         }
         else
         {
             if (e.Button != this.ExportBtn)
             {
                 return;
             }
             string str1 = "HTML Files|*.html|Text Files|*.txt";
             try
             {
                 SaveFileDialog saveFileDialog = new SaveFileDialog();
                 saveFileDialog.FileName = LabyrinthData.Project.Name + " Annotations";
                 saveFileDialog.Filter   = str1;
                 if (saveFileDialog.ShowDialog() != DialogResult.OK)
                 {
                     return;
                 }
                 string       str2 = this.export_annotations(saveFileDialog.FilterIndex == 1);
                 StreamWriter text = File.CreateText(saveFileDialog.FileName);
                 text.WriteLine(str2);
                 text.Close();
             }
             catch (Exception ex)
             {
                 LabyrinthData.Log((object)ex);
             }
         }
     }
     catch (Exception ex)
     {
         LabyrinthData.Log((object)ex);
     }
 }
Пример #19
0
        private string export_to_html_diary()
        {
            string str1 = "<html>" + Environment.NewLine + LabyrinthData.HTMLHeader(this.fTimeline.Name) + Environment.NewLine + "<body>" + Environment.NewLine + "<p class=header>" + this.fTimeline.Name + "</p>" + Environment.NewLine;

            foreach (TimelinePoint point in this.fTimeline.Points)
            {
                str1 = str1 + "<p class=pointheader>" + point.Name + "</p>" + Environment.NewLine;
                switch (point.UseSchedule)
                {
                case ScheduleType.Date:
                    str1 = str1 + "<p class=schedule>" + point.Schedule.ToShortDateString() + "</p>" + Environment.NewLine;
                    break;

                case ScheduleType.DateTime:
                    string   str2      = str1;
                    string[] strArray1 = new string[7];
                    strArray1[0] = str2;
                    strArray1[1] = "<p class=schedule>";
                    string[] strArray2       = strArray1;
                    int      index1          = 2;
                    DateTime schedule        = point.Schedule;
                    string   shortDateString = schedule.ToShortDateString();
                    strArray2[index1] = shortDateString;
                    strArray1[3]      = " ";
                    string[] strArray3 = strArray1;
                    int      index2    = 4;
                    schedule = point.Schedule;
                    string str3 = schedule.ToString("HH:mm");
                    strArray3[index2] = str3;
                    strArray1[5]      = "</p>";
                    strArray1[6]      = Environment.NewLine;
                    str1 = string.Concat(strArray1);
                    break;
                }
                foreach (TimelineItem timelineItem in point.Items)
                {
                    Element element = this.get_element(timelineItem.ElementID);
                    str1 = str1 + "<p class=annotationtitle>" + Environment.NewLine;
                    if (element != null)
                    {
                        str1 = str1 + element.Name + ": ";
                    }
                    str1 = str1 + timelineItem.Annotation.Title + Environment.NewLine;
                    str1 = str1 + "</p>" + Environment.NewLine;
                    str1 = str1 + "<p class=annotationcontent>" + Environment.NewLine;
                    str1 = str1 + timelineItem.Annotation.Content.Replace("\n", "<br>") + Environment.NewLine;
                    str1 = str1 + "</p>" + Environment.NewLine;
                }
            }
            return(str1 + "</body>" + Environment.NewLine + "</html>");
        }
Пример #20
0
 protected void OnElementModified(ElementEventArgs e)
 {
     try
     {
         if (this.ElementModified == null)
         {
             return;
         }
         this.ElementModified((object)this, e);
     }
     catch (Exception ex)
     {
         LabyrinthData.Log((object)ex);
     }
 }
Пример #21
0
 protected void OnStructureModified(StructureEventArgs e)
 {
     try
     {
         if (this.StructureModified == null)
         {
             return;
         }
         this.StructureModified((object)this, e);
     }
     catch (Exception ex)
     {
         LabyrinthData.Log((object)ex);
     }
 }
Пример #22
0
 protected void OnBackColorClick(EventArgs e)
 {
     try
     {
         if (this.BackColorClick == null)
         {
             return;
         }
         this.BackColorClick((object)this, e);
     }
     catch (Exception ex)
     {
         LabyrinthData.Log((object)ex);
     }
 }
Пример #23
0
 protected void OnTimelineActivated(TimelineEventArgs e)
 {
     try
     {
         if (this.TimelineActivated == null)
         {
             return;
         }
         this.TimelineActivated((object)this, e);
     }
     catch (Exception ex)
     {
         LabyrinthData.Log((object)ex);
     }
 }
Пример #24
0
 private void ToolBar_ButtonClick(object sender, ToolBarButtonClickEventArgs e)
 {
     try
     {
         if (e.Button == this.NewBtn)
         {
             this.TaskNew_Click(sender, (EventArgs)e);
         }
         else if (e.Button == this.DeleteBtn)
         {
             this.TaskDelete_Click(sender, (EventArgs)e);
         }
         else if (e.Button == this.PropertiesBtn)
         {
             this.TaskProperties_Click(sender, (EventArgs)e);
         }
         else
         {
             if (e.Button != this.ExportBtn)
             {
                 return;
             }
             string str1 = "HTML Files|*.html|Text Files|*.txt";
             try
             {
                 SaveFileDialog saveFileDialog = new SaveFileDialog();
                 saveFileDialog.FileName = LabyrinthData.Project.Name + " Tasks";
                 saveFileDialog.Filter   = str1;
                 if (saveFileDialog.ShowDialog() != DialogResult.OK)
                 {
                     return;
                 }
                 string       str2 = this.export_tasks(saveFileDialog.FilterIndex == 1);
                 StreamWriter text = File.CreateText(saveFileDialog.FileName);
                 text.WriteLine(str2);
                 text.Close();
             }
             catch (Exception ex)
             {
                 LabyrinthData.Log((object)ex);
             }
         }
     }
     catch (Exception ex)
     {
         LabyrinthData.Log((object)ex);
     }
 }
Пример #25
0
 private void draw_row_headers(Graphics g, Rectangle rect)
 {
     for (int e_index = 0; e_index != this.fTimeline.ElementIDs.Count; ++e_index)
     {
         Element element = this.get_element(this.fTimeline.ElementIDs[e_index]);
         RectangleF layoutRectangle = this.rect_for_cell(e_index, -1, rect);
         Image image = LabyrinthData.ElementImages.Images[LabyrinthData.GetImageIndex(element.Type)];
         Rectangle rect1 = new Rectangle(new Point((int)layoutRectangle.X, (int)layoutRectangle.Top + ((int)layoutRectangle.Height - image.Height) / 2), image.Size);
         g.DrawImage(image, rect1);
         g.DrawRectangle(SystemPens.ControlDark, layoutRectangle.X, layoutRectangle.Y, layoutRectangle.Width, layoutRectangle.Height);
         Font font = element == this.SelectedElement ? this.fBoldFont : this.Font;
         layoutRectangle.X += (float)rect1.Width;
         layoutRectangle.Width -= (float)rect1.Width;
         g.DrawString(element.Name, font, SystemBrushes.ControlText, layoutRectangle, this.fRowHdrFormat);
     }
 }
Пример #26
0
 protected override void OnPaint(PaintEventArgs e)
 {
     try
     {
         base.OnPaint(e);
         Rectangle backRect = this.get_back_rect();
         e.Graphics.FillRectangle((Brush) new SolidBrush(this.fColor2), backRect);
         e.Graphics.DrawRectangle(SystemPens.ControlText, backRect);
         Rectangle foreRect = this.get_fore_rect();
         e.Graphics.FillRectangle((Brush) new SolidBrush(this.fColor1), foreRect);
         e.Graphics.DrawRectangle(SystemPens.ControlText, foreRect);
     }
     catch (Exception ex)
     {
         LabyrinthData.Log((object)ex);
     }
 }
Пример #27
0
        private void update_items()
        {
            SelectionRange selectionRange = this.Calendar.SelectionRange;

            this.ItemList.BeginUpdate();
            this.ItemList.Items.Clear();
            ArrayList arrayList = new ArrayList();

            foreach (Timeline timeline in LabyrinthData.Project.Timelines)
            {
                foreach (TimelinePoint point in timeline.Points)
                {
                    if (point.UseSchedule != ScheduleType.None && point.Schedule >= selectionRange.Start && point.Schedule <= selectionRange.End)
                    {
                        foreach (TimelineItem timelineItem in point.Items)
                        {
                            Element element = (Element)null;
                            int     index   = LabyrinthData.Project.Elements.IndexOf(timelineItem.ElementID);
                            if (index != -1)
                            {
                                element = LabyrinthData.Project.Elements[index];
                            }
                            arrayList.Add((object)new ListViewItem(timelineItem.Annotation.Title)
                            {
                                SubItems =
                                {
                                    element != null ? element.Name : "",
                                    point.Name,
                                    timeline.Name
                                },
                                ImageIndex = LabyrinthData.GetImageIndex((Annotation)timelineItem.Annotation),
                                Tag        = (object)timelineItem
                            });
                        }
                    }
                }
            }
            this.ItemList.Items.AddRange((ListViewItem[])arrayList.ToArray(typeof(ListViewItem)));
            if (this.ItemList.Items.Count == 0)
            {
                ListViewItem listViewItem = this.ItemList.Items.Add("No timeline items");
                listViewItem.ForeColor  = SystemColors.GrayText;
                listViewItem.ImageIndex = -1;
            }
            this.ItemList.EndUpdate();
        }
Пример #28
0
 private void update_details()
 {
     this.SizeValLbl.Text         = "-";
     this.CreatedValLbl.Text      = "-";
     this.LastModifiedValLbl.Text = "-";
     this.LastAccessedValLbl.Text = "-";
     this.AttributesValLbl.Text   = "-";
     try
     {
         FileInfo fileInfo = new FileInfo(this.FilenameLbl.Text);
         if (!fileInfo.Exists)
         {
             return;
         }
         string   str1             = fileInfo.Length >= 1024L ? (fileInfo.Length >= 1048576L ? (fileInfo.Length >= 1073741824L ? ((double)fileInfo.Length / 1073741824.0).ToString("F1") + " Gb" : ((double)fileInfo.Length / 1048576.0).ToString("F1") + " Mb") : ((double)fileInfo.Length / 1024.0).ToString("F1") + " kb") : fileInfo.Length.ToString() + " bytes";
         DateTime dateTime         = fileInfo.CreationTime;
         string   shortDateString1 = dateTime.ToShortDateString();
         string   str2             = ", ";
         dateTime = fileInfo.CreationTime;
         string shortTimeString1 = dateTime.ToShortTimeString();
         string str3             = shortDateString1 + str2 + shortTimeString1;
         dateTime = fileInfo.LastWriteTime;
         string shortDateString2 = dateTime.ToShortDateString();
         string str4             = ", ";
         dateTime = fileInfo.LastWriteTime;
         string shortTimeString2 = dateTime.ToShortTimeString();
         string str5             = shortDateString2 + str4 + shortTimeString2;
         dateTime = fileInfo.LastAccessTime;
         string shortDateString3 = dateTime.ToShortDateString();
         string str6             = ", ";
         dateTime = fileInfo.LastAccessTime;
         string shortTimeString3 = dateTime.ToShortTimeString();
         string str7             = shortDateString3 + str6 + shortTimeString3;
         string str8             = fileInfo.Attributes.ToString();
         this.SizeValLbl.Text         = str1;
         this.CreatedValLbl.Text      = str3;
         this.LastModifiedValLbl.Text = str5;
         this.LastAccessedValLbl.Text = str7;
         this.AttributesValLbl.Text   = str8;
     }
     catch (Exception ex)
     {
         LabyrinthData.Log((object)ex);
     }
 }
Пример #29
0
 protected override void OnMeasureItem(MeasureItemEventArgs e)
 {
     try
     {
         if (e.Index == -1 || e.Index >= this.Items.Count)
         {
             return;
         }
         Annotation a = this.Items[e.Index] as Annotation;
         if (a == null)
         {
             return;
         }
         e.ItemHeight = Annotations.MeasureHeight(a, this.Width, this.Font, e.Graphics);
     }
     catch (Exception ex)
     {
         LabyrinthData.Log((object)ex);
     }
 }
Пример #30
0
    public List <int>[] Build(LabyrinthData labyrinth, AssetInfo info, IsometricMode mode, IAssetManager assets)
    {
        if (labyrinth == null)
        {
            throw new ArgumentNullException(nameof(labyrinth));
        }
        _labId = labyrinth.Id;
        _mode  = mode;

        _layout.Load(labyrinth, info, _mode, BuildProperties(), _paletteId, assets);
        ResizeFramebuffer();
        Update();

        return(mode switch
        {
            IsometricMode.Floors => _layout.FloorFrames,
            IsometricMode.Ceilings => _layout.CeilingFrames,
            IsometricMode.Walls => _layout.WallFrames,
            IsometricMode.Contents => _layout.ContentsFrames,
            _ => null
        });