A game about forced loneliness, made by TACStudios
1using System; 2using System.Collections.Generic; 3 4namespace Unity.VisualScripting 5{ 6 public class NestrerUnitWidget<TNesterUnit> : UnitWidget<TNesterUnit> 7 where TNesterUnit : class, INesterUnit 8 { 9 public NestrerUnitWidget(FlowCanvas canvas, TNesterUnit unit) : base(canvas, unit) { } 10 11 protected override IEnumerable<DropdownOption> contextOptions 12 { 13 get 14 { 15 var childReference = reference.ChildReference(unit, false); 16 17 if (childReference != null) 18 { 19 yield return new DropdownOption((Action)(() => window.reference = childReference), "Open"); 20 yield return new DropdownOption((Action)(() => GraphWindow.OpenTab(childReference)), "Open in new window"); 21 } 22 23 foreach (var baseOption in base.contextOptions) 24 { 25 yield return baseOption; 26 } 27 } 28 } 29 30 protected override void OnDoubleClick() 31 { 32 if (unit.graph.zoom == 1) 33 { 34 var childReference = reference.ChildReference(unit, false); 35 36 if (childReference != null) 37 { 38 if (e.ctrlOrCmd) 39 { 40 GraphWindow.OpenTab(childReference); 41 } 42 else 43 { 44 window.reference = childReference; 45 } 46 } 47 48 e.Use(); 49 } 50 else 51 { 52 base.OnDoubleClick(); 53 } 54 } 55 } 56}