Example #1
0
 public MRMPrim(IObject obj, MRMPrimFactory factory)
 {
     _factory = factory;
     _id = obj.GlobalID;
     _factory.RegisterPrim(this);
     SetUpExistingObj(obj, factory);
 }
Example #2
0
 public MRMPrim(IObject obj, MRMPrimFactory factory)
 {
     _factory = factory;
     _id      = obj.GlobalID;
     _factory.RegisterPrim(this);
     SetUpExistingObj(obj, factory);
 }
Example #3
0
        internal void Start(IKernel k, IConfig config, string configFile, UUID hostID, bool stopQueues)
        {
            Host.Object.Say("Starting MRMSystem.");
            string oldDir = Environment.CurrentDirectory;

            _shutdown   = false;
            _stopQueues = stopQueues;

            BindClasses(k, config, configFile, hostID);

            _queueFactory = k.Get <IAsynchQueueFactory>();
            _primFactory  = k.Get <IPrimFactory>() as MRMPrimFactory;
            k.Get <IView>();
            Logger.Debug("View created.");
            k.Get <IModel>();
            Logger.Debug("Model created.");
            _controller = k.Get <IControl>();
            Logger.Debug("Control created.");


            //World.OnChat += (world, args) => {
            //    if (args.Sender.GlobalID.Equals(Host.Object.OwnerId) && args.Text.ToUpper().Equals("CLEAR"))
            //        _controller.Clear(args.Sender.Name, args.Sender.GlobalID);
            //};
            if (Host.Object.Exists)
            {
                Host.Object.Say(AppDomain.CurrentDomain.FriendlyName + " started.");
            }
        }
        public TouchButton(MRMPrimFactory factory, string name, IPermissions permissions, params UUID[] ids)
        {
            _name = name;
            _factory = factory;
            _listeners = new List<EntityTouchedDelegate>();
            _permissions = permissions;

            foreach (var obj in ids.Select<UUID, IObject>(id => factory.GetIObject(id)))
                RegisterPrim(obj);
        }
        public TouchButton(MRMPrimFactory factory, string name, IPermissions permissions, params UUID[] ids)
        {
            _name        = name;
            _factory     = factory;
            _listeners   = new List <EntityTouchedDelegate>();
            _permissions = permissions;

            foreach (var obj in ids.Select <UUID, IObject>(id => factory.GetIObject(id)))
            {
                RegisterPrim(obj);
            }
        }
        public TouchButton(MRMPrimFactory factory, string name, IPermissions permissions)
        {
            _name = name;
            _factory = factory;
            _listeners = new List<EntityTouchedDelegate>();
            _permissions = permissions;

            factory.OnButtonRegistered += (id, registeredName) => {
                if (registeredName.Equals(name))
                    RegisterPrim(factory.GetIObject(id));
            };
            if (factory.ButtonPrims.ContainsKey(name)) {
                IEnumerable<UUID> objects = factory.ButtonPrims[Name].ToArray();
                foreach (var obj in objects.Select<UUID, IObject>(id => factory.GetIObject(id)))
                    RegisterPrim(obj);
            }
        }
Example #7
0
        public MRMPrim(MRMPrimFactory factory, string name, Vector3 position, Color colour = default(Color), Vector3 scale = default(Vector3), PrimType shape = PrimType.Unknown, Quaternion rotation = default(Quaternion))
        {
            _exists   = true;
            _editable = true;
            _factory  = factory;
            _name     = name;
            _obj      = factory.RegisterPrim(this, name, position);
            _id       = _obj.GlobalID;
            _child    = !ID.Equals(_obj.Root.GlobalID);

            Glow     = 0d;
            Name     = _name;
            Colour   = !colour.Equals(default(Color)) ? colour : Color.White;
            Shape    = !shape.Equals(PrimType.Unknown) ? shape : PrimType.Box;
            Rotation = !rotation.Equals(default(Quaternion)) ? rotation : Quaternion.Identity;
            Scale    = !scale.Equals(default(Vector3)) ? scale : new Vector3(.5f, .5f, .5f);

            _updateListener = Update;
            factory.Update += _updateListener;
        }
        public TouchButton(MRMPrimFactory factory, string name, IPermissions permissions)
        {
            _name        = name;
            _factory     = factory;
            _listeners   = new List <EntityTouchedDelegate>();
            _permissions = permissions;

            factory.OnButtonRegistered += (id, registeredName) => {
                if (registeredName.Equals(name))
                {
                    RegisterPrim(factory.GetIObject(id));
                }
            };
            if (factory.ButtonPrims.ContainsKey(name))
            {
                IEnumerable <UUID> objects = factory.ButtonPrims[Name].ToArray();
                foreach (var obj in objects.Select <UUID, IObject>(id => factory.GetIObject(id)))
                {
                    RegisterPrim(obj);
                }
            }
        }
Example #9
0
        private void SetUpExistingObj(IObject obj, MRMPrimFactory factory)
        {
            _obj      = obj;
            _exists   = true;
            _editable = true;
            _name     = _obj.Name;
            _pos      = _obj.WorldPosition;
            _child    = !ID.Equals(obj.Root.GlobalID);
            bool attachment = _obj.IsAttachment;

            Vector3 shift = new Vector3();

            if (attachment && !_child)
            {
                //ATTACH_HUD_CENTER_2	    31	 HUD Center 2
                //ATTACH_HUD_TOP_RIGHT	    32	 HUD Top Right
                //ATTACH_HUD_TOP_CENTER	    33	 HUD Top
                //ATTACH_HUD_TOP_LEFT	    34	 HUD Top Left
                //ATTACH_HUD_CENTER_1	    35	 HUD Center
                //ATTACH_HUD_BOTTOM_LEFT	36	 HUD Bottom Left
                //ATTACH_HUD_BOTTOM	        37	 HUD Bottom
                //ATTACH_HUD_BOTTOM_RIGHT	38	 HUD Bottom Right
                switch (factory.World.Avatars.First(avatar => _obj.OwnerId.Equals(avatar.GlobalID)).Attachments.First(attach => attach.Asset.GlobalID.Equals(_obj.GlobalID)).Location)
                {
                case 31: shift = new Vector3(0f, .5f, .5f); break;

                case 32: shift = new Vector3(0f, 0f, 1f); break;

                case 33: shift = new Vector3(0f, .5f, 1f); break;

                case 34: shift = new Vector3(0f, 1f, 1f); break;

                case 35: shift = new Vector3(0f, .5f, .5f); break;

                case 36: shift = new Vector3(0f, 1f, 0f); break;

                case 37: shift = new Vector3(0f, .5f, 0f); break;
                    //case 38: shift = new Vector3(0f, 0f, 0f); break;
                }
            }
            _factory.Update += () => {
                if (InWorld)
                {
                    if (!_editable)
                    {
                        _name   = Name;
                        _pos    = Pos;
                        _scale  = Scale;
                        _shape  = Shape;
                        _colour = Colour;
                    }
                    if (attachment && !_child)
                    {
                        Vector3 scale = _obj.Scale;
                        if (scale.Y < 1 && scale.Z < 1)
                        {
                            Vector3 local    = _obj.OffsetPosition + shift;
                            Vector3 newLocal = local;

                            float y = scale.Y / 2;
                            float z = scale.Z / 2;

                            //TODO Look into using texture stretch data to figure out screen ratio
                            //if (local.Y + y > .5f)
                            //    newLocal.Y = .5f - y;
                            //else
                            if (local.Y - y < 0f)
                            {
                                newLocal.Y = y;
                            }

                            if (local.Z + z > 1f)
                            {
                                newLocal.Z = 1 - z;
                            }
                            else if (local.Z - z < 0f)
                            {
                                newLocal.Z = z;
                            }

                            //TODO Look into using texture stretch data to figure out screen ratio
                            if (local != newLocal)
                            {
                                _obj.WorldPosition = newLocal - shift;
                            }
                        }
                    }
                }
            };

            _updateListener = Update;
            factory.Update += _updateListener;
        }
Example #10
0
 public MRMPrim(UUID id, MRMPrimFactory factory)
 {
     _factory = factory;
     _id      = id;
     SetUpExistingObj(_factory.RegisterPrim(this, id), factory);
 }
Example #11
0
        public MRMPrim(MRMPrimFactory factory, string name, Vector3 position, Color colour = default(Color), Vector3 scale = default(Vector3), PrimType shape = PrimType.Unknown, Quaternion rotation = default(Quaternion))
        {
            _exists = true;
            _editable = true;
            _factory = factory;
            _name = name;
            _obj = factory.RegisterPrim(this, name, position);
            _id = _obj.GlobalID;
            _child = !ID.Equals(_obj.Root.GlobalID);

            Glow = 0d;
            Name = _name;
            Colour = !colour.Equals(default(Color)) ? colour : Color.White;
            Shape = !shape.Equals(PrimType.Unknown) ? shape : PrimType.Box;
            Rotation = !rotation.Equals(default(Quaternion)) ? rotation : Quaternion.Identity;
            Scale = !scale.Equals(default(Vector3)) ? scale : new Vector3(.5f, .5f, .5f);

            _updateListener = Update;
            factory.Update += _updateListener;
        }
Example #12
0
 public MRMPrim(UUID id, MRMPrimFactory factory)
 {
     _factory = factory;
     _id = id;
     SetUpExistingObj(_factory.RegisterPrim(this, id), factory);
 }
Example #13
0
        private void SetUpExistingObj(IObject obj, MRMPrimFactory factory)
        {
            _obj = obj;
            _exists = true;
            _editable = true;
            _name = _obj.Name;
            _pos =  _obj.WorldPosition;
            _child = !ID.Equals(obj.Root.GlobalID);
            bool attachment = _obj.IsAttachment;

            Vector3 shift = new Vector3();
            if (attachment && !_child) {
                //ATTACH_HUD_CENTER_2	    31	 HUD Center 2
                //ATTACH_HUD_TOP_RIGHT	    32	 HUD Top Right
                //ATTACH_HUD_TOP_CENTER	    33	 HUD Top
                //ATTACH_HUD_TOP_LEFT	    34	 HUD Top Left
                //ATTACH_HUD_CENTER_1	    35	 HUD Center
                //ATTACH_HUD_BOTTOM_LEFT	36	 HUD Bottom Left
                //ATTACH_HUD_BOTTOM	        37	 HUD Bottom
                //ATTACH_HUD_BOTTOM_RIGHT	38	 HUD Bottom Right
                switch (factory.World.Avatars.First(avatar => _obj.OwnerId.Equals(avatar.GlobalID)).Attachments.First(attach => attach.Asset.GlobalID.Equals(_obj.GlobalID)).Location) {
                    case 31: shift = new Vector3(0f, .5f, .5f); break;
                    case 32: shift = new Vector3(0f, 0f, 1f); break;
                    case 33: shift = new Vector3(0f, .5f, 1f); break;
                    case 34: shift = new Vector3(0f, 1f, 1f); break;
                    case 35: shift = new Vector3(0f, .5f, .5f); break;
                    case 36: shift = new Vector3(0f, 1f, 0f); break;
                    case 37: shift = new Vector3(0f, .5f, 0f); break;
                    //case 38: shift = new Vector3(0f, 0f, 0f); break;
                }
            }
            _factory.Update += () => {
                if (InWorld) {
                    if (!_editable) {
                        _name = Name;
                        _pos = Pos;
                        _scale = Scale;
                        _shape = Shape;
                        _colour = Colour;
                    }
                    if (attachment && !_child) {
                        Vector3 scale = _obj.Scale;
                        if (scale.Y < 1 && scale.Z < 1) {
                            Vector3 local = _obj.OffsetPosition + shift;
                            Vector3 newLocal = local;

                            float y = scale.Y / 2;
                            float z = scale.Z / 2;

                            //TODO Look into using texture stretch data to figure out screen ratio
                            //if (local.Y + y > .5f)
                            //    newLocal.Y = .5f - y;
                            //else
                            if (local.Y - y < 0f)
                                newLocal.Y = y;

                            if (local.Z + z > 1f)
                                newLocal.Z = 1 - z;
                            else if (local.Z - z < 0f)
                                newLocal.Z = z;

                            //TODO Look into using texture stretch data to figure out screen ratio
                            if (local != newLocal)
                                _obj.WorldPosition = newLocal - shift;
                        }
                    }
                }
            };

            _updateListener = Update;
            factory.Update += _updateListener;
        }
Example #14
0
        public ChatButton(MRMPrimFactory factory, string name) {
            _name = name;
            _factory = factory;

        }
Example #15
0
 public ChatButton(MRMPrimFactory factory, string name)
 {
     _name = name;
     _factory = factory;
 }