public SharedState(Module.Control control) { _control = control; _toggles = new Dictionary <string, IToggle>(); _stateButtons = new List <IButton>(); }
public SharedState(Module.Control control) { _control = control; _toggles = new Dictionary<string, IToggle>(); _stateButtons = new List<IButton>(); }
public IndividualState(Module.Control control, IKeyTableFactory tableFactory) { _control = control; _state = new Dictionary <string, string>(); _selectedEntities = new Dictionary <string, IControlEntity>(); _toggles = tableFactory.MakeKeyTable <Dictionary <string, Toggle> >(); _stateButtons = tableFactory.MakeKeyTable <List <IButton> >(); }
public IndividualState(Module.Control control, IKeyTableFactory tableFactory) { _control = control; _state = new Dictionary<string, string>(); _selectedEntities = new Dictionary<string, IControlEntity>(); _toggles = tableFactory.MakeKeyTable<Dictionary<string, Toggle>>(); _stateButtons = tableFactory.MakeKeyTable<List<IButton>>(); }
public RoutingTable(IButton button, Module.Control control, IPrimFactory primFactory) { _selectedButtons = new HashSet <UUID>(); _factory = primFactory; _control = control; _button = button; foreach (var prim in button.Prims) { control.Record.MakeMapped <IEntity>(new MappableEntity(prim)); } button.OnTouched += (source, args) => { if (_selectedButtons.Contains(source)) { primFactory[source].Glow = 0d; _selectedButtons.Remove(source); if (_selectedButtons.Count == 0) { control.State.ResetState(args.AvatarName, args.AvatarID); } } else { string state = control.State.GetState(args.AvatarName, args.AvatarID); if (state.Equals(SandboxControl.EPSelected) || state.Equals(SandboxControl.RouterSelected)) { ILogicEntity selectedNode = control.State.GetSelectedEntity(args.AvatarName, args.AvatarID); _control.HostPrim.Say("Displaying forwarding table for " + selectedNode.Name); control.Model.DisplayForwardingTable(selectedNode.ID, new Parameters(), source); control.State.ResetState(args.AvatarName, args.AvatarID); } else { _selectedButtons.Add(source); if (!_prims.Contains(source)) { control.Record.MakeMapped <IEntity>(new MappableEntity(primFactory[source])); _prims.Add(source); } primFactory[source].Glow = control.ToggleGlow; control.State.SetState(SandboxControl.DisplayTableSelected, args.AvatarName, args.AvatarID); } } }; control.State.OnStateChange += (source, args) => { if (!args.NewState.Equals(SandboxControl.DisplayTableSelected)) { ResetSelected(); } }; }
public RoutingTable(IButton button, Module.Control control, IPrimFactory primFactory) { _selectedButtons = new HashSet<UUID>(); _factory = primFactory; _control = control; _button = button; foreach (var prim in button.Prims) { control.Record.MakeMapped<IEntity>(new MappableEntity(prim)); prim.Glow = 0d; if (prim.IsAttachment) prim.Colour = Color.LightGray; } button.OnTouched += (source, args) => { IPrim p = primFactory[source]; if (_selectedButtons.Contains(source)) { p.Glow = 0d; if (p.IsAttachment) p.Colour = Color.LightGray; _selectedButtons.Remove(source); if (_selectedButtons.Count == 0) control.State.ResetState(args.AvatarName, args.AvatarID); } else { string state = control.State.GetState(args.AvatarName, args.AvatarID); if (state.Equals(SandboxControl.EPSelected) || state.Equals(SandboxControl.RouterSelected)) { ILogicEntity selectedNode = control.State.GetSelectedEntity(args.AvatarName, args.AvatarID); _control.HostPrim.Say("Displaying forwarding table for " + selectedNode.Name); control.Model.DisplayForwardingTable(selectedNode.ID, new Parameters(), source); control.State.ResetState(args.AvatarName, args.AvatarID); } else { _selectedButtons.Add(source); if (!_prims.Contains(source)) { control.Record.MakeMapped<IEntity>(new MappableEntity(primFactory[source])); _prims.Add(source); } p.Glow = control.ToggleGlow; if (p.IsAttachment) p.Colour = Color.White; control.State.SetState(SandboxControl.DisplayTableSelected, args.AvatarName, args.AvatarID); } } }; control.State.OnStateChange += (source, args) => { if (!args.NewState.Equals(SandboxControl.DisplayTableSelected)) ResetSelected(); }; }
public CreateTopologyState(Module.Control control) : base(control) { }