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(); }
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(); }
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(); }