コード例 #1
0
        private void FillCategories(Inventory.Entry entry, IndentedComboBox.Item item)
        {
            if (!entry.IsDirectory)
            {
                return;
            }
            if (entry.Deleted)
            {
                return;
            }
            IndentedComboBox.Item item2 = new IndentedComboBox.Item();
            item2.Tag   = entry;
            item2.Text  = entry.DisplayName;
            item2.Image = entry.Icon;
            item.Add(item2);
            int num = 0;

            Inventory.Entry[] children = entry.Children;
            for (int i = 0; i < children.Length; i++)
            {
                Inventory.Entry entry2 = children[i];
                if (entry2.IsDirectory)
                {
                    this.FillCategories(entry2, item2);
                }
                else
                {
                    num++;
                }
            }
            if (num > 0)
            {
                item2.SubText = "(" + num + ")";
            }
        }
コード例 #2
0
        private void RefreshList()
        {
            base.BeginUpdate();
            base.Items.Clear();
            this.m_listItems.Clear();
            this.ClearImages();
            this.m_pendingIndex      = 0;
            this.m_pendingIndexBegin = 0;
            this.m_pendingIndexMid   = 0;
            this.m_pendingIndexEnd   = 0;
            this.m_pendingPass       = 0;
            List <KeyValuePair <Inventory.Entry, MemoryStream> > pendingImages;

            Monitor.Enter(pendingImages = this.m_pendingImages);
            try
            {
                if (this.m_entries != null)
                {
                    Inventory.Entry[] entries = this.m_entries;
                    for (int i = 0; i < entries.Length; i++)
                    {
                        Inventory.Entry entry = entries[i];
                        this.CreateItem(entry);
                    }
                }
            }
            finally
            {
                Monitor.Exit(pendingImages);
            }
            this.OnScroll();
            base.EndUpdate();
        }
コード例 #3
0
        public ListViewItem FindEntry(Inventory.Entry entry)
        {
            ListViewItem result;

            this.m_listItems.TryGetValue(entry, out result);
            return(result);
        }
コード例 #4
0
 private void InitializeComponent()
 {
     this.components    = new Container();
     this.label1        = new Label();
     this.buttonCancel  = new NomadButton();
     this.buttonOK      = new NomadButton();
     this.inventoryTree = new InventoryTree();
     base.SuspendLayout();
     this.label1.AutoSize                      = true;
     this.label1.Location                      = new Point(12, 9);
     this.label1.Name                          = "label1";
     this.label1.Size                          = new Size(156, 13);
     this.label1.TabIndex                      = 0;
     this.label1.Text                          = "PROMPT_INVENTORY_TEXT";
     this.buttonCancel.Anchor                  = (AnchorStyles.Bottom | AnchorStyles.Right);
     this.buttonCancel.DialogResult            = DialogResult.Cancel;
     this.buttonCancel.Location                = new Point(209, 273);
     this.buttonCancel.Name                    = "buttonCancel";
     this.buttonCancel.Size                    = new Size(75, 23);
     this.buttonCancel.TabIndex                = 3;
     this.buttonCancel.Text                    = "PROMPT_CANCEL";
     this.buttonCancel.UseVisualStyleBackColor = true;
     this.buttonOK.Anchor                      = (AnchorStyles.Bottom | AnchorStyles.Right);
     this.buttonOK.DialogResult                = DialogResult.OK;
     this.buttonOK.Enabled                     = false;
     this.buttonOK.Location                    = new Point(128, 273);
     this.buttonOK.Name                        = "buttonOK";
     this.buttonOK.Size                        = new Size(75, 23);
     this.buttonOK.TabIndex                    = 2;
     this.buttonOK.Text                        = "PROMPT_OK";
     this.buttonOK.UseVisualStyleBackColor     = true;
     this.inventoryTree.Anchor                 = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
     this.inventoryTree.HideSelection          = false;
     this.inventoryTree.ImageIndex             = 0;
     this.inventoryTree.Location               = new Point(15, 25);
     this.inventoryTree.Name                   = "inventoryTree";
     this.inventoryTree.Root                   = null;
     this.inventoryTree.SelectedImageIndex     = 0;
     this.inventoryTree.Size                   = new Size(269, 244);
     this.inventoryTree.TabIndex               = 1;
     this.inventoryTree.Value                  = null;
     this.inventoryTree.NodeMouseDoubleClick  += new TreeNodeMouseClickEventHandler(this.inventoryTree_NodeMouseDoubleClick);
     this.inventoryTree.ValueChanged          += new EventHandler(this.inventoryTree_ValueChanged);
     base.AcceptButton                         = this.buttonOK;
     base.AutoScaleDimensions                  = new SizeF(6f, 13f);
     base.AutoScaleMode                        = AutoScaleMode.Font;
     base.CancelButton                         = this.buttonCancel;
     base.ClientSize = new Size(296, 300);
     base.Controls.Add(this.buttonOK);
     base.Controls.Add(this.buttonCancel);
     base.Controls.Add(this.inventoryTree);
     base.Controls.Add(this.label1);
     base.Name          = "PromptInventory";
     base.StartPosition = FormStartPosition.CenterParent;
     this.Text          = "PROMPT_INVENTORY_TITLE";
     base.ResumeLayout(false);
     base.PerformLayout();
 }
コード例 #5
0
 private void RefreshList()
 {
     IndentedComboBox.Item selectedItem = this.categoryComboBox.SelectedItem;
     if (selectedItem != null)
     {
         Inventory.Entry entry = (Inventory.Entry)selectedItem.Tag;
         this.inventoryList.Entries = entry.Children;
     }
 }
コード例 #6
0
        public void RemoveEntry(Inventory.Entry entry)
        {
            ListViewItem listViewItem;

            this.m_listItems.TryGetValue(entry, out listViewItem);
            if (listViewItem == null)
            {
                return;
            }
            listViewItem.Remove();
        }
コード例 #7
0
 protected override void OnAssignSlot(int id, Inventory.Entry entry)
 {
     base.OnAssignSlot(id, entry);
     if (entry == null || !entry.IsValid)
     {
         CollectionManager.ClearMaskId(id);
         CollectionManager.AssignCollectionId(id, CollectionInventory.Entry.Null);
         return;
     }
     CollectionManager.AssignCollectionId(id, (CollectionInventory.Entry)entry);
 }
コード例 #8
0
 protected override void OnAssignSlot(int id, Inventory.Entry entry)
 {
     base.OnAssignSlot(id, entry);
     if (entry == null || !entry.IsValid)
     {
         TerrainManager.ClearTextureId(id);
         TerrainManager.AssignTextureId(id, TextureInventory.Entry.Null);
         return;
     }
     TerrainManager.AssignTextureId(id, (TextureInventory.Entry)entry);
 }
コード例 #9
0
 private IndentedComboBox.Item FindCategory(Inventory.Entry entry)
 {
     foreach (IndentedComboBox.Item current in this.categoryComboBox.GetItems())
     {
         Inventory.Entry entry2 = (Inventory.Entry)current.Tag;
         if (entry2.Pointer == entry.Pointer)
         {
             return(current);
         }
     }
     return(null);
 }
コード例 #10
0
 private void RefreshList()
 {
     IndentedComboBox.Item selectedItem = this.categoryComboBox.SelectedItem;
     if (selectedItem != null)
     {
         Inventory.Entry entry = (Inventory.Entry)selectedItem.Tag;
         this.objectList.Entries   = entry.Children;
         this.parentButton.Enabled = entry.Parent.IsValid;
         return;
     }
     this.parentButton.Enabled = false;
 }
コード例 #11
0
        private ListViewItem CreateItem(Inventory.Entry entry)
        {
            if (entry.Deleted)
            {
                return(null);
            }
            ListViewItem listViewItem = new ListViewItem(entry.DisplayName);

            this.m_listItems[entry] = listViewItem;
            listViewItem.Tag        = entry;
            base.Items.Add(listViewItem);
            return(listViewItem);
        }
コード例 #12
0
ファイル: InventoryTree.cs プロジェクト: NanoLP/FC3Editor
 private void FillNodes(Inventory.Entry root, TreeNodeCollection nodes)
 {
     Inventory.Entry[] children = root.Children;
     for (int i = 0; i < children.Length; i++)
     {
         Inventory.Entry entry = children[i];
         if ((!this.m_onlyDirectories || entry.IsDirectory) && !entry.Deleted)
         {
             TreeNode treeNode = this.CreateNode(entry);
             nodes.Add(treeNode);
             this.FillNodes(entry, treeNode.Nodes);
         }
     }
 }
コード例 #13
0
ファイル: InventoryTree.cs プロジェクト: NanoLP/FC3Editor
        private TreeNode CreateNode(Inventory.Entry entry)
        {
            TreeNode treeNode = new TreeNode();

            treeNode.Text = entry.DisplayName;
            treeNode.Tag  = entry;
            string iconName = entry.IconName;

            if (!this.imageList.Images.ContainsKey(iconName))
            {
                this.imageList.Images.Add(iconName, entry.Icon);
            }
            treeNode.ImageKey         = iconName;
            treeNode.SelectedImageKey = iconName;
            this.m_nodes.Add(entry, treeNode);
            return(treeNode);
        }
コード例 #14
0
ファイル: InventoryTree.cs プロジェクト: NanoLP/FC3Editor
        public void RemoveEntry(Inventory.Entry entry)
        {
            TreeNode treeNode;

            this.m_nodes.TryGetValue(entry, out treeNode);
            if (treeNode == null)
            {
                return;
            }
            Inventory.Entry[] children = entry.Children;
            for (int i = 0; i < children.Length; i++)
            {
                Inventory.Entry entry2 = children[i];
                this.RemoveEntry(entry2);
            }
            treeNode.Remove();
            this.m_nodes.Remove(entry);
        }
コード例 #15
0
ファイル: ParamSlotList.cs プロジェクト: NanoLP/FC3Editor
 private void AssignSlot(int id, Inventory.Entry entry)
 {
     Win32.SetRedraw(this, false);
     UndoManager.RecordUndo();
     this.OnAssignSlot(id, entry);
     UndoManager.CommitUndo();
     if (entry != null)
     {
         this.OnValueChanged(id);
     }
     else
     {
         this.OnValueChanged(-1);
     }
     this.UpdateList();
     Win32.SetRedraw(this, true);
     this.Refresh();
 }
コード例 #16
0
        public void Construct(Inventory.Entry entry, UIInventoryGrid uiGrid)
        {
            Point2 gridSize = uiGrid.inventory.gridSize;
            Graphic gridGraphic = uiGrid.gameObject.GetComponent<Graphic>();
            float slotSize = gridGraphic.rectTransform.rect.width / gridSize.x;

            this.entry = entry;

            this.gameObject.name = this.entry.item.title;
            this.sprite = this.entry.item.image;

            this.transform.SetParent(uiGrid.transform);

            this.rectTransform.pivot = new Vector2(0, 1);
            this.rectTransform.anchorMin = new Vector2(0, 1);
            this.rectTransform.anchorMax = new Vector2(0, 1);
            this.rectTransform.anchoredPosition = new Vector3(entry.position.x * slotSize, -entry.position.y * slotSize, 0);
            this.rectTransform.sizeDelta = new Vector2(this.entry.item.inventorySize.x * slotSize, this.entry.item.inventorySize.y * slotSize);
        }
コード例 #17
0
    private void Update()
    {
        if (_inventory == null || !pointerOver)
        {
            return;
        }

        ClearHighlights();

        var cell      = MouseCell();
        var mouseItem = PlayerController.instance.mouseItem;

        if (mouseItem != null)
        {
            SetRect(highlighter, cell.x, cell.y, mouseItem.info.invWidth, mouseItem.info.invHeight);
            List <int> coveredEntries;
            highlighter.gameObject.SetActive(_inventory.Fit(mouseItem, cell.x, cell.y, out coveredEntries));
            if (coveredEntries.Count > 1)
            {
                highlighter.color = Colors.InvItemHighlightForbid;
            }
            else
            {
                highlighter.color = Colors.InvItemHighlight;
                foreach (int entryIndex in coveredEntries)
                {
                    RawImage bg = itemsBackgrounds[entryIndex];
                    bg.color = Colors.InvItemHighlightSwap;
                }
            }
        }
        else
        {
            int entryIndex = _inventory.At(cell.x, cell.y);
            if (entryIndex != -1)
            {
                RawImage bg = itemsBackgrounds[entryIndex];
                bg.color = Colors.InvItemHighlight;
                Inventory.Entry entry = _inventory.entries[entryIndex];
                UI.ShowScreenLabel(Input.mousePosition, entry.item.GetDescription());
            }
        }
    }
コード例 #18
0
        public void AddEntry(Inventory.Entry entry)
        {
            ListViewItem listViewItem;

            this.m_listItems.TryGetValue(entry, out listViewItem);
            if (listViewItem == null)
            {
                listViewItem = this.CreateItem(entry);
                if (listViewItem == null)
                {
                    return;
                }
            }
            base.SelectedItems.Clear();
            if (listViewItem != null)
            {
                listViewItem.Selected = true;
            }
        }
コード例 #19
0
        protected override void OnAssignSlot(int id, Inventory.Entry entry)
        {
            base.OnAssignSlot(id, entry);
            if (entry == null || !entry.IsValid)
            {
                SplineManager.DestroyRoad(id);
                return;
            }
            SplineRoad splineRoad = SplineManager.GetRoadFromId(id);

            if (!splineRoad.IsValid)
            {
                splineRoad = SplineManager.CreateRoad(id);
            }
            SplineInventory.Entry entry2 = (SplineInventory.Entry)entry;
            splineRoad.Entry = entry2;
            splineRoad.Width = entry2.DefaultWidth;
            splineRoad.UpdateSpline();
        }
コード例 #20
0
ファイル: InventoryTree.cs プロジェクト: NanoLP/FC3Editor
        public void AddEntry(Inventory.Entry entry)
        {
            if (this.OnlyDirectories && !entry.IsDirectory)
            {
                return;
            }
            TreeNode treeNode;

            this.m_nodes.TryGetValue(entry.Parent, out treeNode);
            if (treeNode == null)
            {
                return;
            }
            TreeNode treeNode2 = this.CreateNode(entry);
            int      num       = -1;

            Inventory.Entry[] children = entry.Parent.Children;
            for (int i = 0; i < children.Length; i++)
            {
                Inventory.Entry entry2 = children[i];
                if (entry2 == entry)
                {
                    break;
                }
                TreeNode treeNode3;
                this.m_nodes.TryGetValue(entry2, out treeNode3);
                if (treeNode3 != null && treeNode3.Parent == treeNode)
                {
                    num = treeNode3.Index + 1;
                }
            }
            if (num == -1)
            {
                treeNode.Nodes.Add(treeNode2);
            }
            else
            {
                treeNode.Nodes.Insert(num, treeNode2);
            }
            this.FillNodes(entry, treeNode2.Nodes);
            this.Value = entry;
        }
コード例 #21
0
ファイル: ParamSlotList.cs プロジェクト: NanoLP/FC3Editor
        private void UpdateList()
        {
            List <SlotItem> list = new List <SlotItem>();

            for (int i = 0; i < this.SlotCount; i++)
            {
                SlotItem slot = this.GetSlot(i);
                if (slot != null)
                {
                    list.Add(slot);
                }
            }
            this.m_slots = list.ToArray();
            Inventory.Entry[] array = new Inventory.Entry[this.m_slots.Length];
            for (int j = 0; j < this.m_slots.Length; j++)
            {
                array[j] = this.m_slots[j].Entry;
            }
            this.inventoryList.Entries = array;
            this.labelCount.Text       = this.m_slots.Length + "/" + this.SlotCount;
            this.UpdateSelection();
        }
コード例 #22
0
 private bool IsValidEntry(Inventory.Entry entry)
 {
     return(entry != null && entry.IsValid);
 }
コード例 #23
0
 public TextureTreeItem(int id, Inventory.Entry entry)
 {
     this.m_id    = id;
     this.m_entry = entry;
 }
コード例 #24
0
 public SlotItem(int id, Inventory.Entry entry)
 {
     this.m_id    = id;
     this.m_entry = entry;
 }
コード例 #25
0
        protected override void OnDrawItem(DrawListViewItemEventArgs e)
        {
            if (base.View != View.Tile)
            {
                e.DrawDefault = true;
                return;
            }
            SizeF            sizeF            = new SizeF((float)this.m_imageSize, (float)this.m_imageSize);
            BufferedGraphics bufferedGraphics = BufferedGraphicsManager.Current.Allocate(e.Graphics, e.Bounds);
            Graphics         graphics         = bufferedGraphics.Graphics;

            graphics.Clear(this.BackColor);
            RectangleF rectangleF = e.Bounds;

            rectangleF.Inflate(-1f, -1f);
            if (e.Item.Selected)
            {
                using (SolidBrush solidBrush = new SolidBrush(SystemColors.Highlight))
                {
                    graphics.FillRectangle(solidBrush, rectangleF);
                }
            }
            if (e.Item.Focused)
            {
                using (Pen pen = new Pen(SystemColors.ActiveBorder, 1f))
                {
                    graphics.DrawRectangle(pen, rectangleF.X, rectangleF.Y, rectangleF.Width, rectangleF.Height);
                }
            }
            rectangleF.Inflate(-1f, -1f);
            string text = e.Item.Text;
            Font   font = this.Font;
            //SizeF sizeF2;
            //graphics.MeasureString(text, font).Height = sizeF2.Height + 2f;
            //graphics.MeasureString(text, font).Height = sizeF2.Height + 2f;

            RectangleF layoutRectangle = rectangleF;

            layoutRectangle.Height = rectangleF.Height - (float)this.m_imageSize - 8f;
            layoutRectangle.Y      = rectangleF.Bottom - layoutRectangle.Height;
            if (this.m_imageSize == 64)
            {
                layoutRectangle.Inflate(1.6f, 0f);
            }
            StringFormat stringFormat = new StringFormat();

            stringFormat.Alignment     = StringAlignment.Center;
            stringFormat.LineAlignment = StringAlignment.Near;
            stringFormat.Trimming      = StringTrimming.EllipsisCharacter;
            stringFormat.FormatFlags   = StringFormatFlags.LineLimit;
            Color color = e.Item.Selected ? SystemColors.HighlightText : this.ForeColor;

            using (SolidBrush solidBrush2 = new SolidBrush(color))
            {
                graphics.DrawString(text, font, solidBrush2, layoutRectangle, stringFormat);
            }
            Inventory.Entry key = (Inventory.Entry)e.Item.Tag;
            Image           thumbwait;

            this.m_listImages.TryGetValue(key, out thumbwait);
            if (thumbwait == null)
            {
                thumbwait = Resources.thumbwait;
            }
            if (thumbwait != null)
            {
                RectangleF rectangleF2 = new RectangleF(rectangleF.X + (rectangleF.Width - (float)thumbwait.Width) / 2f, rectangleF.Y + 4f + (sizeF.Height - (float)thumbwait.Height) / 2f, sizeF.Width, sizeF.Height);
                using (new SolidBrush(Color.Orange))
                {
                    graphics.DrawImage(thumbwait, rectangleF2.Location);
                }
            }
            bufferedGraphics.Render();
            bufferedGraphics.Dispose();
        }
コード例 #26
0
        public override void OnInspectorGUI()
        {
            Inventory self = (Inventory)target;

            // TODO: Make more sexy controls for this
            DrawDefaultInspector();

            self.gridSize = EditorGUITool.Point2Field("Grid size", self.gridSize);

            EditorGUITool.Space();

            // Draw selection info if applicable
            if(selectedEntry != null)
            {
                if(selectedEntry.item != null)
                {
                    EditorGUITool.Horizontal(() => {
                        GUILayout.Box("", GUILayout.Width(64), GUILayout.Height(64));

                        Rect thumbRect = GUILayoutUtility.GetLastRect();

                        thumbRect.x += 5;
                        thumbRect.y += 5;
                        thumbRect.width -= 10;
                        thumbRect.height -= 10;

                        EditorGUITool.DrawSprite(thumbRect, selectedEntry.item.thumbnail);

                        EditorGUITool.Vertical(() => {
                            EditorGUITool.Label(selectedEntry.item.title, true);
                            EditorGUITool.Label(selectedEntry.item.description);
                        });
                    });

                }
                else
                {
                    EditorGUITool.Label("ERROR: No item");
                }
            }

            EditorGUITool.Space();
            EditorGUITool.Space();

            // Only draw the grid editor if the grid is in use
            if(self.gridSize.x > 0 && self.gridSize.y > 0)
            {
                Rect rectBeforeGrid = GUILayoutUtility.GetLastRect();
                float buttonSize = Screen.width / self.gridSize.x;
                Inventory.Entry[,] grid = self.GetPopulatedGrid();

                // Draw the grid first
                for(int y = 0; y < self.gridSize.y; y++)
                {
                    for(int x = 0; x < self.gridSize.x; x++)
                    {
                        Rect boxPosition = new Rect(
                            x * buttonSize,
                            y * buttonSize + rectBeforeGrid.y,
                            buttonSize,
                            buttonSize
                        );

                        GUI.Box(boxPosition, "");
                    }
                }

                // Then draw all the entries
                for(int y = 0; y < self.gridSize.y; y++)
                {
                    for(int x = 0; x < self.gridSize.x; x++)
                    {
                        Inventory.Entry entry = grid[x,y];

                        if(entry != null && entry.item != null)
                        {
                            Rect buttonPosition = new Rect(
                                x * buttonSize,
                                y * buttonSize + rectBeforeGrid.y,
                                buttonSize * entry.item.inventorySize.x,
                                buttonSize * entry.item.inventorySize.y
                            );

                            Rect imagePosition = new Rect(
                                x * buttonSize + 5,
                                y * buttonSize + rectBeforeGrid.y + 5,
                                buttonSize * entry.item.inventorySize.x - 10,
                                buttonSize * entry.item.inventorySize.y - 10
                            );

                            if(GUI.Button(buttonPosition, ""))
                            {
                                selectedEntry = grid[x,y];
                            }

                            EditorGUITool.DrawSprite(imagePosition, entry.item.image);
                        }
                    }
                }

                // Fill the GUI space
                EditorGUITool.Space(buttonSize * self.gridSize.y + 40);
            }
        }
コード例 #27
0
 private void ImageThread()
 {
     while (true)
     {
         Inventory.Entry entry        = null;
         MemoryStream    memoryStream = null;
         List <KeyValuePair <Inventory.Entry, MemoryStream> > pendingImages;
         Monitor.Enter(pendingImages = this.m_pendingImages);
         try
         {
             if (this.m_pendingImages.Count > 0)
             {
                 entry        = this.m_pendingImages[0].Key;
                 memoryStream = this.m_pendingImages[0].Value;
                 this.m_pendingImages.RemoveAt(0);
             }
         }
         finally
         {
             Monitor.Exit(pendingImages);
         }
         if (entry == null)
         {
             Thread.Sleep(10);
         }
         else
         {
             Bitmap bitmap = new Bitmap(this.m_imageSize, this.m_imageSize);
             using (Graphics graphics = Graphics.FromImage(bitmap))
             {
                 if (entry.GetBackgroundColor().HasValue)
                 {
                     Brush brush = new SolidBrush(entry.GetBackgroundColor().Value);
                     graphics.FillRectangle(brush, new Rectangle(0, 0, this.m_imageSize, this.m_imageSize));
                     brush.Dispose();
                 }
                 graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                 Image image = null;
                 if (entry.IsDirectory)
                 {
                     image = Resources.folder_big;
                 }
                 else
                 {
                     if (memoryStream != null)
                     {
                         image = Image.FromStream(memoryStream);
                     }
                 }
                 if (image != null)
                 {
                     RectangleF rect = default(RectangleF);
                     rect.Width  = (float)Math.Min(image.Width, this.m_imageSize);
                     rect.Height = (float)Math.Min(image.Height, this.m_imageSize);
                     rect.X      = ((float)this.m_imageSize - rect.Width) / 2f;
                     rect.Y      = ((float)this.m_imageSize - rect.Height) / 2f;
                     graphics.DrawImage(image, rect);
                     image.Dispose();
                 }
                 Image thumbnailOverlay = entry.GetThumbnailOverlay();
                 if (thumbnailOverlay != null)
                 {
                     graphics.DrawImage(thumbnailOverlay, new Point(0, this.m_imageSize - thumbnailOverlay.Height));
                 }
                 string textOverlay = entry.GetTextOverlay();
                 if (!string.IsNullOrEmpty(textOverlay))
                 {
                     Font         font         = new Font("Arial", 8f);
                     Brush        brush2       = new SolidBrush(Color.Black);
                     Brush        brush3       = new SolidBrush(Color.White);
                     StringFormat stringFormat = new StringFormat();
                     stringFormat.Alignment     = StringAlignment.Far;
                     stringFormat.LineAlignment = StringAlignment.Far;
                     PointF origin   = new PointF((float)(this.m_imageSize - 1), (float)(this.m_imageSize - 1));
                     SizeF  size     = graphics.MeasureString(textOverlay, font, origin, stringFormat);
                     PointF location = new PointF(origin.X - size.Width, origin.Y - size.Height);
                     graphics.FillRectangle(brush2, new RectangleF(location, size));
                     graphics.DrawString(textOverlay, font, brush3, (float)(this.m_imageSize - 1), (float)(this.m_imageSize - 1), stringFormat);
                     font.Dispose();
                     brush2.Dispose();
                     brush3.Dispose();
                 }
             }
             if (memoryStream != null)
             {
                 memoryStream.Dispose();
             }
             List <KeyValuePair <Inventory.Entry, Image> > readyImages;
             Monitor.Enter(readyImages = this.m_readyImages);
             try
             {
                 this.m_readyImages.Add(new KeyValuePair <Inventory.Entry, Image>(entry, bitmap));
             }
             finally
             {
                 Monitor.Exit(readyImages);
             }
         }
     }
 }
コード例 #28
0
        private void flushTimer_Tick(object sender, EventArgs e)
        {
            if (this.m_readyImages.Count > 0)
            {
                List <KeyValuePair <Inventory.Entry, Image> > readyImages;
                Monitor.Enter(readyImages = this.m_readyImages);
                try
                {
                    int i = 0;
                    while (i < this.m_readyImages.Count)
                    {
                        KeyValuePair <Inventory.Entry, Image> keyValuePair = this.m_readyImages[i];
                        this.m_listImages[keyValuePair.Key] = keyValuePair.Value;
                        if (this.SlotMode)
                        {
                            IEnumerator enumerator = base.Items.GetEnumerator();
                            try
                            {
                                while (enumerator.MoveNext())
                                {
                                    ListViewItem listViewItem = (ListViewItem)enumerator.Current;
                                    if ((Inventory.Entry)listViewItem.Tag == keyValuePair.Key)
                                    {
                                        this.RedrawItem(listViewItem);
                                    }
                                }
                                goto IL_CD;
                            }
                            finally
                            {
                                IDisposable disposable = enumerator as IDisposable;
                                if (disposable != null)
                                {
                                    disposable.Dispose();
                                }
                            }
                            goto IL_B0;
                        }
                        goto IL_B0;
IL_CD:
                        i++;
                        continue;
IL_B0:
                        ListViewItem item;
                        if (this.m_listItems.TryGetValue(keyValuePair.Key, out item))
                        {
                            this.RedrawItem(item);
                            goto IL_CD;
                        }
                        goto IL_CD;
                    }
                    this.m_readyImages.Clear();
                }
                finally
                {
                    Monitor.Exit(readyImages);
                }
            }
            if (this.m_listImages.Count > 800)
            {
                this.CompactImages();
            }
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            int num  = 20;
            int num2 = 50;

            if (this.m_pendingPass == 0)
            {
                int num3 = Math.Min(base.Items.Count, this.m_pendingIndexEnd);
                num3 = Math.Min(num3, this.m_pendingIndex + num);
                num3 = Math.Min(num3, this.m_pendingIndex + num2 - this.m_pendingImages.Count);
                List <KeyValuePair <Inventory.Entry, MemoryStream> > pendingImages;
                Monitor.Enter(pendingImages = this.m_pendingImages);
                try
                {
                    while (this.m_pendingIndex < num3)
                    {
                        Inventory.Entry entry = (Inventory.Entry)base.Items[this.m_pendingIndex].Tag;
                        if (!this.m_listImages.ContainsKey(entry))
                        {
                            this.m_pendingImages.Add(new KeyValuePair <Inventory.Entry, MemoryStream>(entry, entry.GetThumbnailData()));
                            if (stopwatch.ElapsedMilliseconds > 70L)
                            {
                                break;
                            }
                        }
                        this.m_pendingIndex++;
                    }
                }
                finally
                {
                    Monitor.Exit(pendingImages);
                }
                if (this.m_pendingIndex == this.m_pendingIndexEnd)
                {
                    this.m_pendingPass  = 1;
                    this.m_pendingIndex = this.m_pendingIndexMid - 1;
                }
            }
            if (this.m_pendingPass == 1)
            {
                int num4 = this.m_pendingIndexBegin;
                num4 = Math.Max(num4, this.m_pendingIndex - num);
                num4 = Math.Max(num4, this.m_pendingIndex - num2 + this.m_pendingImages.Count);
                List <KeyValuePair <Inventory.Entry, MemoryStream> > pendingImages2;
                Monitor.Enter(pendingImages2 = this.m_pendingImages);
                try
                {
                    while (this.m_pendingIndex > num4)
                    {
                        Inventory.Entry entry2 = (Inventory.Entry)base.Items[this.m_pendingIndex].Tag;
                        if (!this.m_listImages.ContainsKey(entry2))
                        {
                            this.m_pendingImages.Add(new KeyValuePair <Inventory.Entry, MemoryStream>(entry2, entry2.GetThumbnailData()));
                            if (stopwatch.ElapsedMilliseconds > 70L)
                            {
                                break;
                            }
                        }
                        this.m_pendingIndex--;
                    }
                }
                finally
                {
                    Monitor.Exit(pendingImages2);
                }
                if (this.m_pendingIndex == this.m_pendingIndexBegin)
                {
                    this.m_pendingPass = 2;
                }
            }
        }
コード例 #29
0
 public CollectionTreeItem(int id, Inventory.Entry entry)
 {
     this.m_id    = id;
     this.m_entry = entry;
 }
コード例 #30
0
        private void objectTree_DragDrop(object sender, DragEventArgs e)
        {
            Win32.SendMessage(this.objectTree.Handle, 4378, 0, 0);
            if (e.Effect != DragDropEffects.Move)
            {
                return;
            }
            Point    pt     = this.objectTree.PointToClient(new Point(e.X, e.Y));
            TreeNode nodeAt = this.objectTree.GetNodeAt(pt);

            if (nodeAt == null)
            {
                return;
            }
            ObjectInventory.Entry entry;
            if (this.m_treeInsertMarkNode == null)
            {
                entry = (ObjectInventory.Entry)nodeAt.Tag;
            }
            else
            {
                entry = (ObjectInventory.Entry)nodeAt.Parent.Tag;
            }
            List <ObjectInventory.Entry> dragContent = this.GetDragContent(e.Data);

            foreach (ObjectInventory.Entry current in dragContent)
            {
                if (this.IsNotRootEntry(current))
                {
                    ObjectInventory.Entry entry2 = entry;
                    while (entry2 != null && entry2.IsValid)
                    {
                        if (entry2 == current)
                        {
                            return;
                        }
                        entry2 = (ObjectInventory.Entry)entry2.Parent;
                    }
                    this.objectTree.BeginUpdate();
                    this.objectList.BeginUpdate();
                    this.objectTree.RemoveEntry(current);
                    this.objectList.RemoveEntry(current);
                    current.Parent = entry;
                    if (this.m_treeInsertMarkNode != null)
                    {
                        int num = 0;
                        Inventory.Entry[] children = entry.Children;
                        for (int i = 0; i < children.Length; i++)
                        {
                            Inventory.Entry x = children[i];
                            if (x == (Inventory.Entry) this.m_treeInsertMarkNode.Tag)
                            {
                                entry.SetChildIndex(current, this.m_treeInsertMarkAfter ? (num + 1) : num);
                                break;
                            }
                            num++;
                        }
                    }
                    this.objectTree.AddEntry(current);
                    this.objectTree.EndUpdate();
                    this.objectList.EndUpdate();
                }
            }
        }
コード例 #31
0
ファイル: InventoryBox.cs プロジェクト: d3x0r/Voxelarium
		internal virtual void SetEntry( Inventory.Entry entry ) { this.activeEntry = entry; }
コード例 #32
0
ファイル: ParamSlotList.cs プロジェクト: NanoLP/FC3Editor
 protected virtual void OnAssignSlot(int id, Inventory.Entry entry)
 {
 }
コード例 #33
0
 private bool IsNotRootEntry(Inventory.Entry entry)
 {
     return(this.IsValidEntry(entry) && entry != ObjectInventory.Instance.Root);
 }