Exemple #1
0
        protected override SlotItem GetSlot(int index)
        {
            SplineRoad roadFromId = SplineManager.GetRoadFromId(index);

            if (!roadFromId.IsValid)
            {
                return(null);
            }
            return(new SlotItem(index, roadFromId.Entry));
        }
Exemple #2
0
 private void SetSplineRoad(SplineRoad splineRoad)
 {
     this.m_splineRoad = splineRoad;
     base.SetSpline(splineRoad);
     this.m_paramRoadWidth.Enabled = this.m_splineRoad.IsValid;
     if (this.m_splineRoad.IsValid)
     {
         this.m_paramRoadWidth.Value = this.m_splineRoad.Width;
     }
 }
Exemple #3
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();
        }
Exemple #4
0
 private void UpdateList()
 {
     this.treeView.BeginUpdate();
     this.treeView.Nodes.Clear();
     this.imageList.Images.Clear();
     for (int i = 0; i < 8; i++)
     {
         SplineRoad roadFromId = SplineManager.GetRoadFromId(i);
         bool       flag       = false;
         string     text       = null;
         string     text2      = null;
         if (roadFromId.IsValid)
         {
             SplineInventory.Entry entry = roadFromId.Entry;
             if (entry.IsValid)
             {
                 text2 = entry.IconName;
                 if (!this.imageList.Images.ContainsKey(text2))
                 {
                     this.imageList.Images.Add(text2, entry.Icon);
                 }
                 text = entry.DisplayName;
                 flag = true;
             }
         }
         if (!flag)
         {
             text2 = "empty16";
             if (!this.imageList.Images.ContainsKey(text2))
             {
                 this.imageList.Images.Add(text2, Resources.empty16);
             }
             text = Localizer.Localize("PARAM_EMPTY");
         }
         SplineTreeItem tag      = new SplineTreeItem(i, roadFromId);
         TreeNode       treeNode = this.treeView.Nodes.Add(text);
         treeNode.ImageKey         = text2;
         treeNode.SelectedImageKey = text2;
         treeNode.Tag = tag;
     }
     this.UpdateSelection();
     this.treeView.EndUpdate();
 }
Exemple #5
0
 private void AssignSplineId(int id, SplineInventory.Entry entry)
 {
     Win32.SetRedraw(this, false);
     UndoManager.RecordUndo();
     if (!entry.IsValid)
     {
         SplineManager.DestroyRoad(id);
     }
     else
     {
         SplineRoad splineRoad = SplineManager.GetRoadFromId(id);
         if (!splineRoad.IsValid)
         {
             splineRoad = SplineManager.CreateRoad(id);
         }
         splineRoad.Entry = entry;
         splineRoad.UpdateSpline();
     }
     UndoManager.CommitUndo();
     this.UpdateList();
     Win32.SetRedraw(this, true);
     this.Refresh();
 }
Exemple #6
0
 public SplineTreeItem(int id, SplineRoad spline)
 {
     this.m_id     = id;
     this.m_spline = spline;
 }