Ejemplo n.º 1
0
    public void SetPuppetMaster(puppet.PuppetMaster master)
    {
        m_puppetMaster = master;

        m_puppetMaster.RegisterNotificationSubscriber (new puppet.ReceiveNotificationsCallbackType
                                                       (NotificationUpdate));

        /*
        Gtk.TreeViewColumn userColumn = new Gtk.TreeViewColumn ();
        userColumn.Title = "User";
        Gtk.CellRendererText userColumnCell = new Gtk.CellRendererText ();
        userColumn.PackStart (userColumnCell, true);
        userColumn.SetCellDataFunc (userColumnCell, new Gtk.TreeCellDataFunc (RenderUser));

        Gtk.TreeViewColumn statusColumn = new Gtk.TreeViewColumn ();
        statusColumn.Title = "Status";
        Gtk.CellRendererText statusColumnCell = new Gtk.CellRendererText ();
        statusColumn.PackStart (statusColumnCell, true);
        statusColumn.SetCellDataFunc (statusColumnCell, new Gtk.TreeCellDataFunc (RenderStatus));

        m_userStore = new Gtk.ListStore (typeof (string));

        treeViewUsers.Model = m_userStore;
        treeViewUsers.AppendColumn (userColumn);
        //treeViewUsers.AppendColumn (statusColumn);

        ShowAll ();
        */
    }
Ejemplo n.º 2
0
 public bool PushUserInterface(GameObject obj)
 {
     if (!isClient)
     {
         return(true);
     }
     if (!userInterfaceList.Contains(obj))
     {
         puppet ui = obj.GetComponent <puppet>();
         if (ui)
         {
             if (userInterfaceList.Count != 0)
             {
                 GameObject obj_last = userInterfaceList[userInterfaceList.Count - 1];
                 if (obj_last)
                 {
                     puppet ui_last = obj_last.GetComponent <puppet>();
                     if (ui_last)
                     {
                         ui_last.SetActiv(false);
                     }
                 }
             }
             ui.SetActiv(true);
             userInterfaceList.Add(obj);
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 3
0
    public void NotificationUpdate(puppet.NotificationEventArgs msg)
    {
        Console.WriteLine ("MSG: {0}", msg.Notification);
        if (msg.UserName != null)
        {
            if (msg.Notification.StartsWith ("REGISTERED"))
            {
                //puppet.UserStatus u = new puppet.UserStatus (msg.UserName, "online");
                m_userStore.AppendValues (msg.UserName);
            }
            else if (msg.Notification.StartsWith ("DISCONNECT"))
            {
                // TODO: mark user disconnected
                /*foreach (object[] o in m_userStore)
                {
                    if (o[0].Equals (msg.UserName))
                    {
                        o[1] = "offline";
                    }
                }*/
            }
        }

        Gtk.Application.Invoke (delegate {
            TextIter iterator = textMain.Buffer.EndIter;
            textMain.Buffer.Insert(ref iterator, String.Format ("\n{0}", msg.Notification));
            textMain.ScrollToIter(textMain.Buffer.EndIter, 0, false, 0, 0);
        });
    }
Ejemplo n.º 4
0
 public void PopUserInterface()
 {
     if (!isClient)
     {
         return;
     }
     if (userInterfaceList.Count > 0)
     {
         GameObject obj_last = userInterfaceList[userInterfaceList.Count - 1];
         if (obj_last)
         {
             puppet ui_last = obj_last.GetComponent <puppet>();
             if (ui_last)
             {
                 ui_last.SetActiv(false);
                 userInterfaceList.Remove(obj_last);
             }
             GameObject obj = userInterfaceList[userInterfaceList.Count - 1];
             if (obj)
             {
                 puppet ui = obj.GetComponent <puppet>();
                 if (ui)
                 {
                     ui.SetActiv(true);
                 }
             }
         }
     }
 }