Example #1
0
        private void buttonClear_Click(object sender, EventArgs e)
        {
            TextureTreeItem currentItem = this.GetCurrentItem();

            if (currentItem == null || currentItem.Id == 0)
            {
                return;
            }
            this.AssignTextureId(currentItem.Id, TextureInventory.Entry.Null);
        }
Example #2
0
        private void UpdateButtons()
        {
            TextureTreeItem textureTreeItem = (this.treeView.SelectedNode != null) ? ((TextureTreeItem)this.treeView.SelectedNode.Tag) : null;

            if (textureTreeItem != null)
            {
                this.buttonAssign.Enabled = true;
                this.buttonClear.Enabled  = (textureTreeItem.Entry.IsValid && textureTreeItem.Id > 0);
                return;
            }
            this.buttonAssign.Enabled = false;
            this.buttonClear.Enabled  = false;
        }
Example #3
0
        private void treeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TextureTreeItem currentItem = this.GetCurrentItem();

            if (currentItem == null)
            {
                this.OnValueChanged(-1);
            }
            else
            {
                this.OnValueChanged(currentItem.Id);
            }
            this.UpdateButtons();
        }
Example #4
0
        private void AssignToSelected()
        {
            TextureTreeItem currentItem = this.GetCurrentItem();

            if (currentItem == null)
            {
                return;
            }
            using (PromptInventory promptInventory = new PromptInventory())
            {
                promptInventory.Root  = TextureInventory.Instance.Root;
                promptInventory.Value = currentItem.Entry;
                if (promptInventory.ShowDialog(this) != DialogResult.Cancel)
                {
                    this.AssignTextureId(currentItem.Id, (TextureInventory.Entry)promptInventory.Value);
                }
            }
        }
Example #5
0
 private void UpdateList()
 {
     this.treeView.BeginUpdate();
     this.treeView.Nodes.Clear();
     this.imageList.Images.Clear();
     for (int i = 0; i < 4; i++)
     {
         TextureInventory.Entry textureEntryFromId = TerrainManager.GetTextureEntryFromId(i);
         string text;
         string text2;
         if (textureEntryFromId.IsValid)
         {
             text = textureEntryFromId.IconName;
             if (!this.imageList.Images.ContainsKey(text))
             {
                 this.imageList.Images.Add(text, textureEntryFromId.Icon);
             }
             text2 = textureEntryFromId.DisplayName;
         }
         else
         {
             text = "empty16";
             if (!this.imageList.Images.ContainsKey(text))
             {
                 this.imageList.Images.Add(text, Resources.empty16);
             }
             text2 = Localizer.Localize("PARAM_EMPTY");
         }
         TextureTreeItem tag      = new TextureTreeItem(i, textureEntryFromId);
         TreeNode        treeNode = this.treeView.Nodes.Add(text2);
         treeNode.ImageKey         = text;
         treeNode.SelectedImageKey = text;
         treeNode.Tag = tag;
     }
     this.UpdateSelection();
     this.treeView.EndUpdate();
 }
Example #6
0
 private void UpdateList()
 {
     this.treeView.BeginUpdate();
     this.treeView.Nodes.Clear();
     this.imageList.Images.Clear();
     for (int i = 0; i < 4; i++)
     {
         TextureInventory.Entry textureEntryFromId = TerrainManager.GetTextureEntryFromId(i);
         string text;
         string text2;
         if (textureEntryFromId.IsValid)
         {
             text = textureEntryFromId.IconName;
             if (!this.imageList.Images.ContainsKey(text))
             {
                 this.imageList.Images.Add(text, textureEntryFromId.Icon);
             }
             text2 = textureEntryFromId.DisplayName;
         }
         else
         {
             text = "empty16";
             if (!this.imageList.Images.ContainsKey(text))
             {
                 this.imageList.Images.Add(text, Resources.empty16);
             }
             text2 = Localizer.Localize("PARAM_EMPTY");
         }
         TextureTreeItem tag = new TextureTreeItem(i, textureEntryFromId);
         TreeNode treeNode = this.treeView.Nodes.Add(text2);
         treeNode.ImageKey = text;
         treeNode.SelectedImageKey = text;
         treeNode.Tag = tag;
     }
     this.UpdateSelection();
     this.treeView.EndUpdate();
 }