public ChatButtonSetupSingle(IPrimFactory factory, IPrim host)
        {
            _host  = host;
            _owner = host.Owner;
            _cont  = true;

            _boundButtons     = new HashSet <string>();
            _requestedButtons = new HashSet <string>();

            Random r = new Random();

            _channel = r.Next(int.MinValue, -1);

            factory.AddChannelListener(_channel, (button, id, text, channel) => {
                string[] msg = text.Split(',');
                UUID owner;
                if (msg.Length == 2 && msg[0].Equals(INIT) && UUID.TryParse(msg[1], out owner) && owner.Equals(_owner))
                {
                    _boundButtons.Add(button);
                    if (_requestedButtons.Contains(button))
                    {
                        _requestedButtons.Remove(button);
                        if (ButtonRegistered != null)
                        {
                            ButtonRegistered(button, _owner);
                        }
                    }
                }
            });

            NotifyChannel();
        }
        public ChatButtonSetupSingle(IPrimFactory factory, IPrim host)
        {
            _host = host;
            _owner = host.Owner;
            _cont = true;

            _boundButtons = new HashSet<string>();
            _requestedButtons = new HashSet<string>();

            Random r = new Random();
            _channel = r.Next(int.MinValue, -1);

            factory.AddChannelListener(_channel, (button, id, text, channel) => {
                string[] msg = text.Split(',');
                UUID owner;
                if (msg.Length == 2 && msg[0].Equals(INIT) && UUID.TryParse(msg[1], out owner) && owner.Equals(_owner)) {
                    _boundButtons.Add(button);
                    if (_requestedButtons.Contains(button)) {
                        _requestedButtons.Remove(button);
                        if (ButtonRegistered != null)
                            ButtonRegistered(button, _owner);
                    }
                }
            });

            NotifyChannel();
        }
示例#3
0
 public Dialog(IPrim prim, IPrimFactory factory)
 {
     _prim = prim;
     _primFactory = factory;
     _receivedText = new Dictionary<UUID, string>();
     _primFactory.AddChannelListener(ChatChannel, (name, id, text, channel) => {
         if (_receivedText.ContainsKey(id))
             _receivedText[id] = text;
     });
 }
示例#4
0
 public Dialog(IPrim prim, IPrimFactory factory)
 {
     _prim         = prim;
     _primFactory  = factory;
     _receivedText = new Dictionary <UUID, string>();
     _primFactory.AddChannelListener(ChatChannel, (name, id, text, channel) => {
         if (_receivedText.ContainsKey(id))
         {
             _receivedText[id] = text;
         }
     });
 }
示例#5
0
        /// <param name="user">The user to display the dialog for.</param>
        /// <param name="id">The ID of the user to display the dialog for.</param>
        /// <param name="entity">The entity to display the dialog from.</param>
        public void Show(string user, UUID id, string msg, string[] buttons)
        {
            if (!_receivedText.ContainsKey(id))
            {
                _receivedText.Add(id, null);
            }
            else
            {
                _receivedText[id] = null;
            }

            int chan = _random.Next(int.MinValue, -1);

            _primFactory.AddChannelListener(chan, ButtonPressed);
            _prim.Dialogue(id, msg, buttons, chan);
        }