예제 #1
0
        private void OnTerminateFriendship(IClientAPI client, UUID agentID, UUID exfriendID)
        {
            FriendsService.Delete(agentID, exfriendID.ToString());
            FriendsService.Delete(exfriendID, agentID.ToString());

            // Update local cache
            UpdateFriendsCache(agentID);

            client.SendTerminateFriend(exfriendID);

            //
            // Notify the friend
            //

            // Try local
            if (LocalFriendshipTerminated(exfriendID, agentID))
            {
                return;
            }

            UserInfo friendSession = m_Scenes[0].RequestModuleInterface <IAgentInfoService>().GetUserInfo(exfriendID.ToString());

            if (friendSession != null && friendSession.IsOnline)
            {
                GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.CurrentRegionID);
                AsyncMessagePostService.Post(region.RegionHandle, SyncMessageHelper.FriendTerminated(
                                                 agentID, exfriendID, region.RegionHandle));
            }
        }
예제 #2
0
        private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List <UUID> callingCardFolders)
        {
            m_log.DebugFormat("[FRIENDS]: {0} denied friendship to {1}", agentID, friendID);

            FriendsService.Delete(agentID, friendID.ToString());
            FriendsService.Delete(friendID, agentID.ToString());

            //
            // Notify the friend
            //

            // Try local
            if (LocalFriendshipDenied(agentID, client.Name, friendID))
            {
                return;
            }

            UserInfo friendSession = m_Scenes[0].RequestModuleInterface <IAgentInfoService>().GetUserInfo(friendID.ToString());

            if (friendSession != null && friendSession.IsOnline)
            {
                GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.CurrentRegionID);
                AsyncMessagePostService.Post(region.RegionHandle, SyncMessageHelper.FriendshipDenied(
                                                 agentID, client.Name, friendID, region.RegionHandle));
            }
        }
예제 #3
0
 void OnDrawGizmos()
 {
     if (Application.isPlaying)
     {
         GridService.DrawGizmos();
     }
 }
예제 #4
0
        private void ForwardFriendshipOffer(UUID agentID, UUID friendID, GridInstantMessage im)
        {
            // !!!!!!!! This is a hack so that we don't have to keep state (transactionID/imSessionID)
            // We stick this agent's ID as imSession, so that it's directly available on the receiving end
            im.imSessionID = im.fromAgentID;

            // Try the local sim
            UserAccount account = UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, agentID);

            im.fromAgentName = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName;

            if (LocalFriendshipOffered(friendID, im))
            {
                return;
            }

            // The prospective friend is not here [as root]. Let's forward.
            UserInfo friendSession = m_Scenes[0].RequestModuleInterface <IAgentInfoService>().GetUserInfo(friendID.ToString());

            if (friendSession != null && friendSession.IsOnline)
            {
                GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.CurrentRegionID);
                AsyncMessagePostService.Post(region.RegionHandle, SyncMessageHelper.FriendshipOffered(
                                                 agentID, friendID, im, region.RegionHandle));
            }
            // If the prospective friend is not online, he'll get the message upon login.
        }
예제 #5
0
    public void SpawnEnemy()
    {
        int x = GridService.WIDTH - 1;

        if (UnityEngine.Random.Range(0, 2) == 0)
        {
            x = 0;
        }

        // find lowest possible block to spawn on
        int lowestY = -1;

        for (int y = GridService.HEIGHT - 1; y >= 0; y--)
        {
            if (GridService.GetInstance().Get(x, y) == null)
            {
                lowestY = y;
            }
            else
            {
                Transform next = GridService.GetInstance().Get(x, y);
                if (next != null && next.gameObject.name == "StoppedCell")
                {
                    break;
                }
            }
        }
        if (lowestY >= 0)
        {
            Instantiate(enemy, new Vector3(x, lowestY), Quaternion.identity);
        }
    }
예제 #6
0
        public void Slice_Layout_With_Area_Same_Size_As_Two_Tiles_Horizontal()
        {
            const string inputPath = @"./Layouts/04.bmp";
            var          layout    = Image.FromFile(inputPath);

            var loggerMock = new Mock <ILogger <GridService> >();
            var sut        = new GridService(loggerMock.Object);
            var result     = sut.Slice(layout, TileWidth);
            var elements   = result.GetElements().ToArray();

            elements.Should().HaveCount(3);

            var firstElement  = elements[0];
            var secondElement = elements[1];
            var thirdElement  = elements[2];

            firstElement.Coordinate.X.Should().Be(0);
            firstElement.Coordinate.Y.Should().Be(0);

            secondElement.Coordinate.X.Should().Be(50);
            secondElement.Coordinate.Y.Should().Be(0);

            thirdElement.Coordinate.X.Should().Be(150);
            thirdElement.Coordinate.Y.Should().Be(0);

            new Bitmap(firstElement.Value).Height.Should().Be(100);
            new Bitmap(firstElement.Value).Width.Should().Be(50);

            new Bitmap(secondElement.Value).Height.Should().Be(100);
            new Bitmap(secondElement.Value).Width.Should().Be(100);

            new Bitmap(thirdElement.Value).Height.Should().Be(100);
            new Bitmap(thirdElement.Value).Width.Should().Be(50);
        }
예제 #7
0
        public void RemoveFriendship(IClientAPI client, UUID exfriendID)
        {
            if (!DeleteFriendship(client.AgentId, exfriendID))
            {
                client.SendAlertMessage("Unable to terminate friendship on this sim.");
            }

            // Update local cache
            RecacheFriends(client);

            client.SendTerminateFriend(exfriendID);

            //
            // Notify the friend
            //

            // Try local
            if (LocalFriendshipTerminated(client.AgentId, exfriendID))
            {
                return;
            }

            PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
            if (friendSessions != null && friendSessions.Length > 0)
            {
                PresenceInfo friendSession = friendSessions[0];
                if (friendSession != null)
                {
                    GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
                    m_FriendsSimConnector.FriendshipTerminated(region, client.AgentId, exfriendID);
                }
            }
        }
예제 #8
0
        public void GivenABlockOfColouredPixels_AndPixelPositionInBlockGiven__WhenFloodCalledWithPixelPos_ThenAdjacentPixelsAreReturned()
        {
            _colourGridService = new GridService(4, _startIndexPosition);
            var expectedColour         = "red";
            var expectedNewFloodColour = "white";
            var start = 1;
            var end   = 2;

            _colourGridService.FillRow(expectedColour, 1, start, end);
            _colourGridService.FillRow(expectedColour, 2, start, end);

            _colourGridService.FloodBlockWithColour(expectedNewFloodColour, new PixelPosition {
                X = 1, Y = 1
            });

            Assert.That(_colourGridService.GetPixelColour(new PixelPosition {
                X = 2, Y = 1
            }), Is.EqualTo(expectedNewFloodColour));
            Assert.That(_colourGridService.GetPixelColour(new PixelPosition {
                X = 1, Y = 1
            }), Is.EqualTo(expectedNewFloodColour));
            Assert.That(_colourGridService.GetPixelColour(new PixelPosition {
                X = 1, Y = 2
            }), Is.EqualTo(expectedNewFloodColour));
            Assert.That(_colourGridService.GetPixelColour(new PixelPosition {
                X = 2, Y = 2
            }), Is.EqualTo(expectedNewFloodColour));
        }
예제 #9
0
        public App()
        {
            InitializeComponent();
            IGridService gridService = new GridService();

            MainPage = new MainPage(new MainPageViewModel(gridService));
        }
예제 #10
0
        private void OnApproveFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List <UUID> callingCardFolders)
        {
            m_log.DebugFormat("[FRIENDS]: {0} accepted friendship from {1}", agentID, friendID);

            FriendsService.StoreFriend(agentID, friendID.ToString(), 1);
            FriendsService.StoreFriend(friendID, agentID.ToString(), 1);

            // Update the local cache
            UpdateFriendsCache(agentID);

            //
            // Notify the friend
            //

            // Try Local
            if (LocalFriendshipApproved(agentID, client.Name, friendID))
            {
                client.SendAgentOnline(new UUID[] { friendID });
                return;
            }

            // The friend is not here
            PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
            if (friendSessions != null && friendSessions.Length > 0)
            {
                PresenceInfo friendSession = friendSessions[0];
                if (friendSession != null)
                {
                    GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
                    m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
                    client.SendAgentOnline(new UUID[] { friendID });
                }
            }
        }
예제 #11
0
        private void ForwardFriendshipOffer(UUID agentID, UUID friendID, GridInstantMessage im)
        {
            // !!!!!!!! This is a hack so that we don't have to keep state (transactionID/imSessionID)
            // We stick this agent's ID as imSession, so that it's directly available on the receiving end
            im.imSessionID = im.fromAgentID;

            // Try the local sim
            UserAccount account = UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, agentID);

            im.fromAgentName = (account == null) ? "Unknown" : account.FirstName + " " + account.LastName;

            if (LocalFriendshipOffered(friendID, im))
            {
                return;
            }

            // The prospective friend is not here [as root]. Let's forward.
            PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
            if (friendSessions != null && friendSessions.Length > 0)
            {
                PresenceInfo friendSession = friendSessions[0];
                if (friendSession != null)
                {
                    GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
                    m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
                }
            }
            // If the prospective friend is not online, he'll get the message upon login.
        }
예제 #12
0
        protected override async Task OnInitializedAsync()
        {
            Action <IGridColumnCollection <InvitationViewModel> > columns = c =>
            {
                c.Add(o => o.Id).Titled("Id").Sortable(true);
                c.Add(o => o.To).Titled("To").Sortable(true);
                c.Add(o => o.SentBy).Titled("By").Sortable(true);
                c.Add(o => o.SentAt).Titled("Sent").Sortable(true);
                c.Add(o => o.Error).Titled("Error").Sortable(true);
                c.Add(o => o.AcceptedAt).Titled("Accepted").Sortable(true);
                c.Add().Titled("Expired").RenderValueAs(i => i.Expired.ToString()).Sortable(true);
            };

            var query = new QueryDictionary <StringValues>();

            query.Add("grid-page", "1");

            var client = new GridClient <InvitationViewModel>(q => GridService.GetRows(columns, q), query, false, "grid", columns);

            Grid = client.Grid;

            // Set new items to grid
            Task = client.UpdateGrid();
            await Task;
        }
예제 #13
0
        private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List <UUID> callingCardFolders)
        {
            m_log.DebugFormat("[FRIENDS]: {0} denied friendship to {1}", agentID, friendID);

            FriendsService.Delete(agentID, friendID.ToString());
            FriendsService.Delete(friendID, agentID.ToString());

            //
            // Notify the friend
            //

            // Try local
            if (LocalFriendshipDenied(agentID, client.Name, friendID))
            {
                return;
            }

            PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
            if (friendSessions != null && friendSessions.Length > 0)
            {
                PresenceInfo friendSession = friendSessions[0];
                if (friendSession != null)
                {
                    GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
                    if (region != null)
                    {
                        m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
                    }
                    else
                    {
                        m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
                    }
                }
            }
        }
예제 #14
0
        public void CountOfTargetBeingGreenWithSetTargetSellAfterGenerateShouldReturnRigthCount()
        {
            // Arrange
            var grid = MockGrid.Context();

            var gridService       = new GridService(grid);
            var cellActionService = new CellActionService(gridService);
            var twoDGridService   = new TwoDGridActionService(grid, cellActionService);

            var targetY            = 2;
            var targetX            = 2;
            var numberOfGeneration = 15;

            twoDGridService.SetNeighboursToAllCells();
            twoDGridService.SetTargetCell(targetY, targetX);

            // Act
            twoDGridService.Generate(numberOfGeneration);

            // Assert
            twoDGridService
            .GetCountOfTargetBeingGreen()
            .Should()
            .Be(14);
        }
예제 #15
0
        private void OnTerminateFriendship(IClientAPI client, UUID agentID, UUID exfriendID)
        {
            FriendsService.Delete(agentID, exfriendID.ToString());
            FriendsService.Delete(exfriendID, agentID.ToString());

            // Update local cache
            UpdateFriendsCache(agentID);

            client.SendTerminateFriend(exfriendID);

            //
            // Notify the friend
            //

            // Try local
            if (LocalFriendshipTerminated(exfriendID))
            {
                return;
            }

            PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
            if (friendSessions != null && friendSessions.Length > 0)
            {
                PresenceInfo friendSession = friendSessions[0];
                if (friendSession != null)
                {
                    GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
                    m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
                }
            }
        }
예제 #16
0
        public void AddFriendship(IClientAPI client, UUID friendID)
        {
            StoreFriendships(client.AgentId, friendID);

            // Update the local cache
            RecacheFriends(client);

            //
            // Notify the friend
            //

            // Try Local
            if (LocalFriendshipApproved(client.AgentId, client.Name, friendID))
            {
                client.SendAgentOnline(new UUID[] { friendID });
                return;
            }

            // The friend is not here
            PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
            if (friendSessions != null && friendSessions.Length > 0)
            {
                PresenceInfo friendSession = friendSessions[0];
                if (friendSession != null)
                {
                    GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
                    m_FriendsSimConnector.FriendshipApproved(region, client.AgentId, client.Name, friendID);
                    client.SendAgentOnline(new UUID[] { friendID });
                }
            }
        }
예제 #17
0
    public override void GetDesiredSteering(SteeringResult rst)
    {
        if (Finish)
        {
            return;
        }
        if (Vector3d.SqrDistance(Target, Self.Position) < FixedMath.One / 100)
        {
            Finish = true;
            GridService.Clear(Target, Self as SceneObject);
            GridService.TagAs(Self.Position, Self as SceneObject, GridService.NodeType.BeTaken);
            return;
        }
        if (GridService.IsNotEmptyBy(Target) != Self)
        {
            GridService.SearchNearEmptyPoint(Target, out Target);
            GridService.TagAs(Target, Self as SceneObject, GridService.NodeType.FlagAsTarget);
        }

        Vector3d dir             = Target - Self.Position;
        Vector3d desiredVelocity = dir.Normalize() * Self.Speed;
        var      acc             = (desiredVelocity - Self.Velocity) / (LockFrameMgr.FixedFrameTime);

        rst.DesiredSteering = acc;
    }
예제 #18
0
        public void SetNeighboursToAllCellsShouldSetEightNeighboursToMiddleCells()
        {
            // Arrange
            var grid = MockGrid.Context();

            var gridService       = new GridService(grid);
            var cellActionService = new CellActionService(gridService);
            var twoDGridService   = new TwoDGridActionService(grid, cellActionService);

            // Act
            twoDGridService.SetNeighboursToAllCells();

            // Assert
            grid[1][2]
            .Neighbours
            .Count
            .Should()
            .Be(8);

            grid[2][2]
            .Neighbours
            .Count
            .Should()
            .Be(8);
        }
예제 #19
0
        public Services(IConfigSource config, string configName, WebApp webApp)
        {
            m_log.Debug("[Wifi]: Services Starting...");

            m_WebApp = webApp;

            m_ServerAdminPassword = webApp.RemoteAdminPassword;
            //m_log.DebugFormat("[Services]: RemoteAdminPassword is {0}", m_ServerAdminPassword);
            m_LastStatisticsUpdate = new DateTime();

            // Create the necessary services
            m_UserAccountService    = new UserAccountService(config);
            m_AuthenticationService = new PasswordAuthenticationService(config);
            m_InventoryService      = new InventoryService(config);
            m_GridService           = new GridService(config);
            m_GridUserService       = new GridUserService(config);
            m_AvatarService         = new AvatarService(config);

            // Create the "God" account if it doesn't exist
            CreateGod();

            // Connect to our outgoing mail server for password forgetfulness
            m_Client = new SmtpClient(m_WebApp.SmtpHost, m_WebApp.SmtpPort);
            if (m_WebApp.SmtpPort == 25)
            {
                m_Client.EnableSsl = false;
            }
            else
            {
                m_Client.EnableSsl = true;
            }
            m_Client.Credentials    = new NetworkCredential(m_WebApp.SmtpUsername, m_WebApp.SmtpPassword);
            m_Client.SendCompleted += new SendCompletedEventHandler(SendCompletedCallback);
        }
예제 #20
0
        protected virtual bool ForwardFriendshipOffer(UUID agentID, UUID friendID, GridInstantMessage im)
        {
            // !!!!!!!! This is a hack so that we don't have to keep state (transactionID/imSessionID)
            // We stick this agent's ID as imSession, so that it's directly available on the receiving end
            im.imSessionID   = im.fromAgentID;
            im.fromAgentName = GetFriendshipRequesterName(agentID);

            // Try the local sim
            if (LocalFriendshipOffered(friendID, im))
            {
                return(true);
            }

            // The prospective friend is not here [as root]. Let's forward.
            PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
            if (friendSessions != null && friendSessions.Length > 0)
            {
                PresenceInfo friendSession = friendSessions[0];
                if (friendSession != null)
                {
                    GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
                    m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
                    return(true);
                }
            }
            // If the prospective friend is not online, he'll get the message upon login.
            return(false);
        }
예제 #21
0
        public void GivenAnInvalidPixelPosition_WhenFillPixelIsCalled_ThenExceptionThrown()
        {
            _colourGridService = new GridService(4, _startIndexPosition);

            Assert.Throws <ApplicationException>(() => _colourGridService.FillPixel("red", new PixelPosition {
                X = 9, Y = 9
            }));
        }
예제 #22
0
        public GameViewModel(ScoringService scoringService, GridService gridService)
        {
            _scoringService = scoringService;
            _gridService    = gridService;
            Cells           = new ObservableCollection <GridCell>();

            StartGame.Execute(null);
        }
예제 #23
0
 // returns the singleton instance
 // if the class hasn't been instatiated, it does so
 public static GridService GetInstance()
 {
     if (instance == null)
     {
         instance = new GridService();
     }
     return(instance);
 }
예제 #24
0
        private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
        {
            m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target);

            FriendInfo[] friends = GetFriends(remoteClient.AgentId);
            if (friends.Length == 0)
            {
                return;
            }

            // Let's find the friend in this user's friend list
            FriendInfo friend = GetFriend(friends, target);

            if (friend != null) // Found it
            {
                // Store it on the DB
                if (!StoreRights(requester, target, rights))
                {
                    remoteClient.SendAlertMessage("Unable to grant rights.");
                    return;
                }

                // Store it in the local cache
                int myFlags = friend.MyFlags;
                friend.MyFlags = rights;

                // Always send this back to the original client
                remoteClient.SendChangeUserRights(requester, target, rights);

                //
                // Notify the friend
                //

                // Try local
                if (LocalGrantRights(requester, target, myFlags, rights))
                {
                    return;
                }

                PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
                if (friendSessions != null && friendSessions.Length > 0)
                {
                    PresenceInfo friendSession = friendSessions[0];
                    if (friendSession != null)
                    {
                        GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
                        // TODO: You might want to send the delta to save the lookup
                        // on the other end!!
                        m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
                    }
                }
            }
            else
            {
                m_log.DebugFormat("[FRIENDS MODULE]: friend {0} not found for {1}", target, requester);
            }
        }
예제 #25
0
        public override void RelocateRegion(GridVector location)
        {
            RegionInfo ri = GetRegionInfo();

            ri.Location = location;
            GridService.RegisterRegion(ri);
            GridPosition = location;
            RegionStorage?.RegisterRegion(ri);
        }
예제 #26
0
        public void CanDetectGameOverState(string gridText, bool gameOver)
        {
            var service = new GridService(new RandomService());
            var grid    = ParseGrid(gridText);

            var canMove = service.CanBeMoved(grid);

            canMove.Should().Be(!gameOver);
        }
예제 #27
0
        public void  CaculateLastAlignment()
        {
            if (_npcs.Count == 0)
            {
                return;
            }
            int x, y;

            GridService.GetCoordinate(_commander.Position, out x, out y);
            int radius = 1;
            int index  = _npcs.Count - 1;

            while (true)
            {
                for (int i = radius; i >= -radius; i--)
                {
                    for (int j = radius; j >= -radius; j--)
                    {
                        if (i != radius && i != -radius)
                        {
                            if (j == radius || j == -radius)
                            {
                                if (GridService.IsEmpty(j + x, i + y))
                                {
                                    for (int k = 0; k < _npcs.Count; k++)
                                    {
                                        if (_npcs[k].AlignmentX != j || _npcs[k].AlignmentY != i)
                                        {
                                            _npcs[index].AlignmentX = j;
                                            _npcs[index].AlignmentY = i;
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (GridService.IsEmpty(j + x, i + y))
                            {
                                for (int k = 0; k < _npcs.Count; k++)
                                {
                                    if (_npcs[k].AlignmentX != j || _npcs[k].AlignmentY != i)
                                    {
                                        _npcs[index].AlignmentX = j;
                                        _npcs[index].AlignmentY = i;
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
                radius++;
            }
        }
예제 #28
0
        private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
        {
            if (!m_Friends.ContainsKey(remoteClient.AgentId))
            {
                return;
            }

            m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target);
            // Let's find the friend in this user's friend list
            UserFriendData fd     = m_Friends[remoteClient.AgentId];
            FriendInfo     friend = null;

            foreach (FriendInfo fi in fd.Friends)
            {
                if (fi.Friend == target.ToString())
                {
                    friend = fi;
                }
            }

            if (friend != null) // Found it
            {
                // Store it on the DB
                FriendsService.StoreFriend(requester, target.ToString(), rights);

                // Store it in the local cache
                int myFlags = friend.MyFlags;
                friend.MyFlags = rights;

                // Always send this back to the original client
                remoteClient.SendChangeUserRights(requester, target, rights);

                //
                // Notify the friend
                //

                // Try local
                if (LocalGrantRights(requester, target, myFlags, rights))
                {
                    return;
                }

                PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
                if (friendSessions != null && friendSessions.Length > 0)
                {
                    PresenceInfo friendSession = friendSessions[0];
                    if (friendSession != null)
                    {
                        GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
                        // TODO: You might want to send the delta to save the lookup
                        // on the other end!!
                        m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
                    }
                }
            }
        }
 public GridServiceProvider()
 {
     //ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
     SetupResolver();
     GetServiceURL(_conFigHelper.LOGIN_DOMAIN);
     if (_serviceUrls != null)
     {
         _gridService = new bLoyal.Connectors.Grid.GridService(_serviceUrls.GridApiUrl, _conFigHelper.ACCESS_KEY);
     }
 }
예제 #30
0
        public void GivenAPixelPositionAndColour_WhenFillPixelIsCalled_PixelShouldBeExpectedColour()
        {
            _colourGridService = new GridService(4, _startIndexPosition);
            var expectedColour = "red";
            var pixelPosition  = new PixelPosition {
                X = 1, Y = 2
            };

            _colourGridService.FillPixel(expectedColour, pixelPosition);
            Assert.That(_colourGridService.GetPixelColour(pixelPosition), Is.EqualTo(expectedColour));
        }