当前位置: 首页>>代码示例>>C#>>正文


C# Client.GetUser方法代码示例

本文整理汇总了C#中Client.GetUser方法的典型用法代码示例。如果您正苦于以下问题:C# Client.GetUser方法的具体用法?C# Client.GetUser怎么用?C# Client.GetUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Client的用法示例。


在下文中一共展示了Client.GetUser方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetResponse

        public Response GetResponse(Client Client)
        {
            var Streams = GetStreamsForClient(Client);

            Response Response = new Response(950);
            Response.AppendInt32(Streams.Count);

            foreach (Stream Stream in Streams)
            {
                Stream.GetResponse(Response, Client.GetUser().HabboId);
            }

            return Response;
        }
开发者ID:devMextur,项目名称:BrickEmulator,代码行数:14,代码来源:StreamHandler.cs

示例2: GetResponse

        public void GetResponse(Client Client, Response Response)
        {
            var Effects = GetEffectsForUser(Client.GetUser().HabboId);

            Response.Initialize(460);
            Response.AppendInt32(Effects.Count);

            foreach (Effect Effect in Effects)
            {
                Effect.GetResponse(Response);
            }
        }
开发者ID:devMextur,项目名称:BrickEmulator,代码行数:12,代码来源:EffectsHandler.cs

示例3: GetStreamsForClient

        private List<Stream> GetStreamsForClient(Client Client)
        {
            var List = new List<Stream>();

            foreach (Stream Stream in (from stream in Streams orderby stream.RunningTime ascending select stream))
            {
                if (Stream.HabboId == Client.GetUser().HabboId)
                {
                    List.Add(Stream);
                    continue;
                }

                if (BrickEngine.GetMessengerHandler().HasFriend(Client.GetUser().HabboId, Stream.HabboId))
                {
                    List.Add(Stream);
                }
            }

            return (from stream in List orderby stream.RunningTime.TotalMinutes ascending select stream).ToList();
        }
开发者ID:devMextur,项目名称:BrickEmulator,代码行数:20,代码来源:StreamHandler.cs

示例4: RunEffect

        public void RunEffect(Client Client, Effect Effect)
        {
            Client.GetUser().HasFreeEffect = false;

            if (Effect != null)
            {
                if (Effect.RemainingTime == 0)
                {
                    return;
                }
            }

            Response Response = new Response(485);

            if (Client.GetUser().IsInRoom)
            {
                Response.AppendInt32(Client.GetUser().GetRoomUser().VirtualId);
            }

            if (Effect == null)
            {
                if (Client.GetUser().IsInRoom)
                {
                    Response.AppendInt32(-1);
                }

                RunningEffects.Remove(Client.GetUser().HabboId);
            }
            else
            {
                if (!Effect.IsActivated)
                {
                    ActivateEffect(Client, Effect);
                }

                if (Client.GetUser().IsInRoom)
                {
                    Response.AppendInt32(Effect.EffectId);
                }

                if (RunningEffects.ContainsKey(Client.GetUser().HabboId))
                {
                    RunningEffects[Effect.UserId] = Effect;
                }
                else
                {
                    RunningEffects.Add(Client.GetUser().HabboId, Effect);
                }
            }

            if (Client.GetUser().IsInRoom)
            {
                Client.SendRoomResponse(Response);
            }
        }
开发者ID:devMextur,项目名称:BrickEmulator,代码行数:55,代码来源:EffectsHandler.cs

示例5: RunFreeEffect

        public void RunFreeEffect(Client Client, int EffectId)
        {
            Client.GetUser().HasFreeEffect = true;

            if (EffectId > 0)
            {
                Dictionary<int, Object> Row = new Dictionary<int, object>();

                Row[0] = -1;
                Row[1] = Client.GetUser().HabboId;
                Row[2] = EffectId;
                Row[3] = int.MaxValue;
                Row[4] = string.Empty;

                Effect GeneratedEffect = new Effect(Row);

                if (RunningEffects.ContainsKey(Client.GetUser().HabboId))
                {
                    RunningEffects[Client.GetUser().HabboId] = GeneratedEffect;
                }
                else
                {
                    RunningEffects.Add(Client.GetUser().HabboId, GeneratedEffect);
                }
            }
            else
            {
                RunningEffects.Remove(Client.GetUser().HabboId);
            }

            if (Client.GetUser().IsInRoom)
            {
                Response Response = new Response(485);
                Response.AppendInt32(Client.GetUser().GetRoomUser().VirtualId);
                Response.AppendInt32(EffectId);
                Client.SendRoomResponse(Response);
            }
        }
开发者ID:devMextur,项目名称:BrickEmulator,代码行数:38,代码来源:EffectsHandler.cs

示例6: InsertEffect

        public void InsertEffect(Client Client, int EffectId, int Duration)
        {
            Dictionary<int, Object> Row = new Dictionary<int, object>();

            Row[0] = EffectIdCounter.Next;
            Row[1] = Client.GetUser().HabboId;
            Row[2] = EffectId;
            Row[3] = Duration;
            Row[4] = string.Empty;

            Effect Effect = new Effect(Row);

            Effects.Add(Effect.Id, Effect);

            Response Response = new Response(461);
            Response.AppendInt32(EffectId);
            Response.AppendInt32(Duration);
            Client.SendResponse(Response);

            using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
            {
                Reactor.SetQuery("INSERT INTO user_effects (user_id, effect_id, effect_length) VALUES (@habboid, @effectid, @length)");
                Reactor.AddParam("habboid", Client.GetUser().HabboId);
                Reactor.AddParam("effectid", EffectId);
                Reactor.AddParam("length", Duration);
                Reactor.ExcuteQuery();
            }
        }
开发者ID:devMextur,项目名称:BrickEmulator,代码行数:28,代码来源:EffectsHandler.cs

示例7: ShouldGetUser

        public void ShouldGetUser()
        {
            IRestRequest savedRequest = null;
            mockClient.Setup(trc => trc.Execute<User>(It.IsAny<IRestRequest>()))
                .Callback<IRestRequest>((request) => savedRequest = request)
                .Returns(new User());
            var client = mockClient.Object;

            client.GetUser();

            mockClient.Verify(trc => trc.Execute<User>(It.IsAny<IRestRequest>()), Times.Once);
            Assert.IsNotNull(savedRequest);
            Assert.AreEqual("user", savedRequest.Resource);
            Assert.AreEqual(Method.GET, savedRequest.Method);
            Assert.AreEqual(0, savedRequest.Parameters.Count);

            var content = "{\"id\": 12345, \"username\": \"api.test.user\", \"firstName\": \"Test\", \"lastName\": \"Api\",  \"status\": \"T\", \"balance\": 575.5,  \"company\": \"test company\","
                + "\"currency\": { \"id\": \"EUR\", \"htmlSymbol\": null }, \"timezone\": { \"area\": \"testarea\", \"dst\": 0, \"offset\": 0, \"timezone\": \"mytimezonename\"  }, \"subaccountType\": \"P\"}";

            var testClient = Common.CreateClient<User>(content, null, null);
            client = new Client(testClient);

            var user = client.GetUser();

            Assert.AreEqual(12345, user.Id);
            Assert.AreEqual("api.test.user", user.Username);
            Assert.AreEqual("Test", user.FirstName);
            Assert.AreEqual("Api", user.LastName);
            Assert.AreEqual(AccountStatus.Trial, user.Status);
            Assert.AreEqual(575.5, user.Balance);
            Assert.AreEqual("test company", user.Company);
            Assert.IsNotNull(user.Currency);
            Assert.AreEqual("EUR", user.Currency.Id);
            Assert.IsNull(user.Currency.HtmlSymbol);
            Assert.AreEqual("mytimezonename", user.Timezone.Name);
            Assert.AreEqual(SubAccountType.ParentUser, user.SubaccountType);
        }
开发者ID:foufure,项目名称:textmagic-rest-csharp,代码行数:37,代码来源:UserTests.cs

示例8: GiveBadge

        public void GiveBadge(Client Client, string BadgeCode)
        {
            Dictionary<int, Object> Row = new Dictionary<int,object>();

            Row[1] = Client.GetUser().HabboId;
            Row[2] = BadgeCode;
            Row[3] = 0;

            // Add @ cache
            Badges.Add(new Badge(Row));

            // Add @ database
            using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
            {
                Reactor.SetQuery("INSERT INTO user_badges (user_id, badge) VALUES (@habboid, @badge)");
                Reactor.AddParam("habboid", Client.GetUser().HabboId);
                Reactor.AddParam("badge", BadgeCode);
                Reactor.ExcuteQuery();
            }

            if (GetIdForBadge(BadgeCode) > 0)
            {
                Response ShowItem = new Response(832);
                ShowItem.AppendInt32(1);
                ShowItem.AppendInt32(4); // TabID
                ShowItem.AppendInt32(1);
                ShowItem.AppendInt32(GetIdForBadge(BadgeCode));
                Client.SendResponse(ShowItem);

                BrickEngine.GetItemReactor().AddNewUpdate(GetIdForBadge(BadgeCode), 4, Client.GetUser().HabboId);
            }
        }
开发者ID:devMextur,项目名称:BrickEmulator,代码行数:32,代码来源:BadgeHandler.cs

示例9: UpdateBadge

        public void UpdateBadge(Client Client, string BadgeCode, string UpdateBadgeCode)
        {
            Badge Badge = GetBadge(BadgeCode, Client.GetUser().HabboId);

            if (Badge == null)
            {
                return;
            }

            // Update @ cache
            Badge.BadgeCode = UpdateBadgeCode;

            // Update @ database
            using (QueryReactor Reactor = BrickEngine.GetQueryReactor())
            {
                Reactor.SetQuery("UPDATE user_badges SET badge = @newbadge WHERE user_id = @habboid AND badge = @badge LIMIT 1");
                Reactor.AddParam("newbadge", UpdateBadgeCode);
                Reactor.AddParam("habboid", Client.GetUser().HabboId);
                Reactor.AddParam("badge", BadgeCode);
                Reactor.ExcuteQuery();
            }

            if (GetIdForBadge(UpdateBadgeCode) > 0)
            {
                Response ShowItem = new Response(832);
                ShowItem.AppendInt32(1);
                ShowItem.AppendInt32(4); // TabID
                ShowItem.AppendInt32(1);
                ShowItem.AppendInt32(GetIdForBadge(BadgeCode));
                Client.SendResponse(ShowItem);

                BrickEngine.GetItemReactor().AddNewUpdate(GetIdForBadge(UpdateBadgeCode), 4, Client.GetUser().HabboId);
            }
        }
开发者ID:devMextur,项目名称:BrickEmulator,代码行数:34,代码来源:BadgeHandler.cs

示例10: GetMaxFriends

        public int GetMaxFriends(Client Client)
        {
            Membership.Membership Membership = Client.GetUser().GetMembership();

            if (Membership != null)
            {
                if (Membership.MemberScale == 0)
                {
                    return MAX_FRIENDS_BASIC;
                }
                else if (Membership.MemberScale == 1)
                {
                    return MAX_FRIENDS_VIP;
                }
            }

            return MAX_FRIENDS_DEFAULT;
        }
开发者ID:devMextur,项目名称:BrickEmulator,代码行数:18,代码来源:MessengerHandler.cs


注:本文中的Client.GetUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。