Ejemplo n.º 1
0
        private bool GetNewHost()
        {
            bool     blnResult = false;
            Assembly assembly  = CompilerHelper.CompileCSharp(editForm, CSharpCode);

            if (assembly != null)
            {
                if (SecondLifeHost != null)
                {
                    SecondLifeHost.Dispose();
                }
                SecondLifeHost = null;

                SecondLifeHost                          = new SecondLifeHost(this.mainForm, assembly, editForm.FullPathName, editForm.guid);
                SecondLifeHost.OnChat                  += editForm.ChatHandler;
                SecondLifeHost.OnMessageLinked         += editForm.MessageLinkedHandler;
                SecondLifeHost.OnDie                   += new EventHandler(host_OnDie);
                SecondLifeHost.OnReset                 += new EventHandler(SecondLifeHost_OnReset);
                SecondLifeHost.OnListenChannelsChanged += new EventHandler(SecondLifeHost_OnListenChannelsChanged);

                SecondLifeHost.OnVerboseMessage += new SecondLifeHost.SecondLifeHostMessageHandler(host_OnVerboseMessage);
                SecondLifeHost.OnStateChange    += new SecondLifeHost.SecondLifeHostMessageHandler(host_OnStateChange);

                SecondLifeHost.State("default", true);

                blnResult = true;
            }
            return(blnResult);
        }
Ejemplo n.º 2
0
        public llDialogForm(SecondLifeHost host, SecondLife.String strObjectName, SecondLife.key id, SecondLife.String strOwner, SecondLife.String strMessage, SecondLife.list buttons, SecondLife.integer intChannel)
        {
            InitializeComponent();

            this.host       = host;
            this.Channel    = intChannel;
            this.OwnerName  = strOwner;
            this.ObjectName = strObjectName;
            this.id         = id;

            for (int intI = 1; intI <= 12; intI++)
            {
                Button button = this.Controls["Button" + intI] as Button;
                button.Visible = false;
            }

            this.label1.Text = strOwner + "'s '" + strObjectName + "'";
            this.label2.Text = strMessage.ToString().Replace("&", "&&");

            for (int intI = 1; intI <= buttons.Count; intI++)
            {
                Button button = this.Controls["Button" + intI] as Button;
                if (button == null)
                {
                    continue;
                }
                button.Text    = buttons[intI - 1].ToString().Replace("&", "&&");
                button.Visible = true;
                button.Click  += new EventHandler(button_Click);
            }
        }
Ejemplo n.º 3
0
        public llTextBoxForm(SecondLifeHost host, SecondLife.String strObjectName, SecondLife.key id, SecondLife.String strOwner, SecondLife.String strMessage, SecondLife.integer intChannel)
        {
            InitializeComponent();

            this.host       = host;
            this.Channel    = intChannel;
            this.OwnerName  = strOwner;
            this.ObjectName = strObjectName;
            this.id         = id;

            this.label1.Text = strMessage.ToString().Replace("&", "&&");
        }
Ejemplo n.º 4
0
        public PermissionsForm(SecondLifeHost host, string strObjectName, SecondLife.key id, string strOwner, SecondLife.key agent, int intPermissions)
        {
            InitializeComponent();

            this.host           = host;
            this.OwnerName      = strOwner;
            this.ObjectName     = strObjectName;
            this.agent          = agent;
            this.id             = id;
            this.intPermissions = intPermissions;

            StringBuilder sb = new StringBuilder();

            if ((intPermissions & SecondLife.PERMISSION_DEBIT) == SecondLife.PERMISSION_DEBIT)
            {
                sb.AppendLine("Take Linden dollars (L$) from you");
            }

            if ((intPermissions & SecondLife.PERMISSION_TAKE_CONTROLS) == SecondLife.PERMISSION_TAKE_CONTROLS)
            {
                sb.AppendLine("Act on your control inputs");
            }

            if ((intPermissions & SecondLife.PERMISSION_TRIGGER_ANIMATION) == SecondLife.PERMISSION_TRIGGER_ANIMATION)
            {
                sb.AppendLine("Animate your avatar");
            }

            if ((intPermissions & SecondLife.PERMISSION_ATTACH) == SecondLife.PERMISSION_ATTACH)
            {
                sb.AppendLine("Attach to your avatar");
            }

            if ((intPermissions & SecondLife.PERMISSION_CHANGE_LINKS) == SecondLife.PERMISSION_CHANGE_LINKS)
            {
                sb.AppendLine("Link and delink from other objects");
            }

            if ((intPermissions & SecondLife.PERMISSION_TRACK_CAMERA) == SecondLife.PERMISSION_TRACK_CAMERA)
            {
                sb.AppendLine("Track your camera");
            }

            if ((intPermissions & SecondLife.PERMISSION_CONTROL_CAMERA) == SecondLife.PERMISSION_CONTROL_CAMERA)
            {
                sb.AppendLine("Control your camera");
            }

            this.label1.Text = "'" + strObjectName + "', an object owned by '" + strOwner + "',\nwould like to:";
            this.label2.Text = sb.ToString();
        }
Ejemplo n.º 5
0
        private void SecondLifeHost_OnMessageLinked(object sender, SecondLifeHostMessageLinkedEventArgs e)
        {
            SecondLifeHost secondLifeHostSender = sender as SecondLifeHost;

            Guid ObjectGuid     = this.solutionExplorer.GetParentGuid(secondLifeHostSender.GUID);
            Guid RootObjectGuid = this.solutionExplorer.GetParentGuid(ObjectGuid);

            List <Guid> list;

            int intLinkNum = e.LinkIndex;

            switch (intLinkNum)
            {
            case 1:                     // LINK_ROOT  , root prim in linked set (but not in a single prim, which is 0)
                list = this.solutionExplorer.GetScripts(RootObjectGuid, false);
                break;

            case -1:                     // LINK_SET  , all prims in object
                list = this.solutionExplorer.GetScripts(RootObjectGuid, true);
                break;

            case -2:                     // LINK_ALL_OTHERS  ,  all other prims in object besides prim function is in
                list = this.solutionExplorer.GetScripts(RootObjectGuid, true);
                // remove scripts in prim itself, and below
                foreach (Guid guid in this.solutionExplorer.GetScripts(ObjectGuid, true))
                {
                    if (list.Contains(guid))
                    {
                        list.Remove(guid);
                    }
                }
                break;

            case -3:                     // LINK_ALL_CHILDREN  , all child prims in object
                list = this.solutionExplorer.GetScripts(RootObjectGuid, true);
                // remove root itself
                foreach (Guid guid in this.solutionExplorer.GetScripts(RootObjectGuid, false))
                {
                    if (list.Contains(guid))
                    {
                        list.Remove(guid);
                    }
                }
                break;

            case -4:                     // LINK_THIS
                /*
                 * From SL Wiki: "Causes the script to act only upon the prim the prim the script is in."
                 * This means LINK_THIS, links to every script in the prim, not just the caller.
                 * @author = MrSoundless
                 * @date = 28 April 2011
                 */
                list = new List <Guid>();
                //list.Add(secondLifeHostSender.guid); // 4 feb 2008
                list = this.solutionExplorer.GetScripts(ObjectGuid, true);                         // 28 april 2011
                break;

            default:                     // Link number
                Guid ObjectNrGuid = this.solutionExplorer.GetGuidFromObjectNr(ObjectGuid, intLinkNum);
                list = this.solutionExplorer.GetScripts(ObjectNrGuid, true);
                break;
            }

            // only send message to running scripts in list
            foreach (Form form in this.Children)
            {
                EditForm editForm = form as EditForm;
                if (editForm == null || editForm.IsDisposed)
                {
                    continue;
                }

                if (editForm.runtime == null)
                {
                    continue;
                }

                if (editForm.runtime.SecondLifeHost == null)
                {
                    continue;
                }

                if (list.Contains(editForm.guid))
                {
                    editForm.runtime.SecondLifeHost.LinkMessage(e);
                }
            }
        }