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


C# Session.SendData方法代码示例

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


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

示例1: TryRedeemVoucher

        public static bool TryRedeemVoucher(SqlDatabaseClient MySqlClient, Session Session, string Code)
        {
            lock (mSyncRoot)
            {
                VoucherValueData ValueData = GetVoucherValue(Code);

                if (ValueData == null)
                {
                    return false;
                }

                if (ValueData.ValueCredits > 0)
                {
                    Session.CharacterInfo.UpdateCreditsBalance(MySqlClient, ValueData.ValueCredits);
                    Session.SendData(CreditsBalanceComposer.Compose(Session.CharacterInfo.CreditsBalance));
                }

                if (ValueData.ValuePixels > 0)
                {
                    Session.CharacterInfo.UpdateActivityPointsBalance(MySqlClient, ValueData.ValuePixels);
                    Session.SendData(ActivityPointsBalanceComposer.Compose(Session.CharacterInfo.ActivityPointsBalance, ValueData.ValuePixels));
                }

                if (ValueData.ValueFurni.Count > 0)
                {
                    Dictionary<int, List<uint>> NotifyItems = new Dictionary<int, List<uint>>();

                    foreach (uint ItemId in ValueData.ValueFurni)
                    {
                        Item Item = ItemFactory.CreateItem(MySqlClient, ItemId, Session.CharacterId, string.Empty,
                            string.Empty, 0, false);

                        if (Item != null)
                        {
                            int NotifyTabId = Item.Definition.Type == ItemType.WallItem ? 2 : 1;

                            Session.InventoryCache.Add(Item);
                            Session.NewItemsCache.MarkNewItem(MySqlClient, NotifyTabId, Item.Id);

                            if (!NotifyItems.ContainsKey(NotifyTabId))
                            {
                                NotifyItems.Add(NotifyTabId, new List<uint>());
                            }

                            NotifyItems[NotifyTabId].Add(Item.Id);
                        }
                    }

                    if (NotifyItems.Count > 0)
                    {
                        Session.SendData(InventoryRefreshComposer.Compose());
                        Session.SendData(InventoryNewItemsComposer.Compose(new Dictionary<int, List<uint>>(NotifyItems)));
                    }
                }

                MarkVoucherUsed(Code);
                return true;
            }
        }
开发者ID:BjkGkh,项目名称:BobbaRP,代码行数:59,代码来源:VoucherManager.cs

示例2: AlertRoom

        private static void AlertRoom(Session Session, ClientMessage Message)
        {
            if (!Session.HasRight("moderation_tool"))
            {
                return;
            }

            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

            if (Instance == null)
            {
                Session.SendData(NotificationMessageComposer.Compose("Could not send room alert."));
                return;
            }

            int Unknown1 = Message.PopWiredInt32();
            int AlertMode = Message.PopWiredInt32();
            string AlertMessage = Message.PopString();
            bool IsCaution = AlertMode != 3;

            Instance.SendModerationAlert(AlertMessage, IsCaution);

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                ModerationLogs.LogModerationAction(MySqlClient, Session, "Sent room " + (IsCaution ? "caution" : "message"),
                    "Room " + Instance.Info.Name + " (ID " + Instance.RoomId + "): '" + AlertMessage + "'");
            }
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:28,代码来源:ModerationHandler.cs

示例3: BanUser

        private static void BanUser(Session Session, ClientMessage Message)
        {
            if (!Session.HasRight("moderation_tool"))
            {
                return;
            }

            uint UserId = Message.PopWiredUInt32();
            string MessageText = Message.PopString();
            double Length = (Message.PopWiredInt32() * 3600);

            Session TargetSession = SessionManager.GetSessionByCharacterId(UserId);

            if (TargetSession == null || TargetSession.HasRight("moderation_tool"))
            {
                Session.SendData(NotificationMessageComposer.Compose("This user is not online or you do not have permission to ban them.\nPlease use housekeeping to ban users that are offline."));
                return;
            }

            SessionManager.StopSession(TargetSession.Id);

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                ModerationBanManager.BanUser(MySqlClient, UserId, MessageText, Session.CharacterId, Length);
                ModerationLogs.LogModerationAction(MySqlClient, Session, "Banned user",
                    "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ") for " +
                    Length + " hours: '" + MessageText + "'");
            }
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:29,代码来源:ModerationHandler.cs

示例4: HandleExchangeRedemption

        private static bool HandleExchangeRedemption(Session Session, Item Item, RoomInstance Instance, ItemEventType Event, int RequestData, uint Opcode)
        {
            switch (Event)
            {
                case ItemEventType.Interact:

                    int ItemValue = 0;
                    int.TryParse(Item.Flags, out ItemValue);

                    using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                    {
                        if (ItemValue != 0)
                        {
                            Session.CharacterInfo.UpdateCreditsBalance(MySqlClient, ItemValue);
                            Session.SendData(CreditsBalanceComposer.Compose(Session.CharacterInfo.CreditsBalance));
                        }

                        Item.RemovePermanently(MySqlClient);
                    }

                    Instance.TakeItem(Item.Id);
                    Instance.RegenerateRelativeHeightmap();
                    break;
            }

            return true;
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:27,代码来源:ExchangeHandler.cs

示例5: OnSessionLatencyTest

        private static void OnSessionLatencyTest(Session Session, ClientMessage Message)
        {
            // Sesion timer sends a number to the server and expects it right back.
            // Maybe something to do with latency testing... or a keepalive?
            // Seems like a waste of bandwith since we're using pinging

            Session.SendData(LatencyTestResponseComposer.Compose(Message.PopWiredInt32()));
        }
开发者ID:BjkGkh,项目名称:BobbaRP,代码行数:8,代码来源:Global.cs

示例6: InitCrypto

        private static void InitCrypto(Session Session, ClientMessage Message)
        {
            if (Session.Authenticated)
            {
                return;
            }

            Session.SendData(SessionParamsComposer.Compose());
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:9,代码来源:Handshake.cs

示例7: TradeAccept

        private static void TradeAccept(Session Session, ClientMessage Message)
        {
            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);

            if (Instance == null)
            {
                return;
            }

            Trade Trade = Instance.TradeManager.GetTradeForUser(Session.CharacterId);

            if (Trade == null || !Trade.AcceptTrade(Trade.UserOne == Session.CharacterId))
            {
                return;
            }

            ServerMessage TradeAcceptState = TradeAcceptStateComposer.Compose(Session.CharacterId, true);
            ServerMessage TradeFinalizing = (Trade.TradeStage == TradeStage.Finalizing ? TradeFinalizingComposer.Compose()
                : null);

            Session.SendData(TradeAcceptState);

            if (TradeFinalizing != null)
            {
                Session.SendData(TradeFinalizing);
            }

            Session TargetSession = SessionManager.GetSessionByCharacterId(Trade.UserOne == Session.CharacterId ?
                Trade.UserTwo : Trade.UserOne);

            if (TargetSession != null)
            {
                TargetSession.SendData(TradeAcceptState);

                if (TradeFinalizing != null)
                {
                    TargetSession.SendData(TradeFinalizing);
                }
            }
        }
开发者ID:BjkGkh,项目名称:BobbaRP,代码行数:40,代码来源:TradeHandler.cs

示例8: EnterRoom

        public static void EnterRoom(Session Session, RoomInstance Instance)
        {
            if (!Session.RoomAuthed || Session.RoomJoined || Session.AbsoluteRoomId != Instance.RoomId)
            {
                return;
            }

            Session.SendData(RoomUrlComposer.Compose("http://www.meth0d.org/Reality"));
            Session.SendData(RoomEntryModelComposer.Compose(Instance.Model.Id, Instance.Info.Id));

            if (Instance.Info.Type == RoomType.Flat)
            {
                Dictionary<string, string> Decorations = Instance.Info.Decorations;

                foreach (KeyValuePair<string, string> Decoration in Decorations)
                {
                    Session.SendData(RoomDecorationComposer.Compose(Decoration.Key, Decoration.Value));
                }

                Session.SendData(RoomRatingInfoComposer.Compose((Session.RatedRoomsCache.HasRatedRoom(Instance.RoomId) || Instance.CheckUserRights(Session, true)) ? Instance.Info.Score : -1));
                Session.SendData(RoomEventInfoComposer.Compose(Instance.Event));
            }
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:23,代码来源:RoomHandler.cs

示例9: ActivateEffect

        private static void ActivateEffect(Session Session, ClientMessage Message)
        {
            AvatarEffect Effect = Session.AvatarEffectCache.GetEffect(Message.PopWiredInt32(), false, true);

            // If we do not have an effect that needs activating OR if we already have an effect
            // of this sort which IS activated, stop.
            if (Effect == null || Session.AvatarEffectCache.HasEffect(Effect.SpriteId, true))
            {
                return;
            }

            Effect.Activate();
            Session.SendData(UserEffectActivatedComposer.Compose(Effect));
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:14,代码来源:Inventory.cs

示例10: GetIgnoredUsers

        private static void GetIgnoredUsers(Session Session, ClientMessage Message)
        {
            ReadOnlyCollection<uint> IgnoredUsers = Session.IgnoreCache.List;
            List<string> Names = new List<string>();

            foreach (uint IgnoredUser in IgnoredUsers)
            {
                string Name = CharacterResolverCache.GetNameFromUid(IgnoredUser);

                if (Name != "Unknown User" && !Names.Contains(Name))
                {
                    Names.Add(Name);
                }
            }

            Session.SendData(IgnoredUserListComposer.Compose(Names));
        }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:17,代码来源:Handshake.cs

示例11: GetPopularRooms

        private static void GetPopularRooms(Session Session, ClientMessage Message)
        {
            if (Session.HasRight("hotel_admin"))
            {
                ServerMessage Response = TryGetResponseFromCache(0, Message);

                if (Response != null)
                {
                    Session.SendData(Response);
                    return;
                }

                int Category = -1;
                int.TryParse(Message.PopString(), out Category);

                IEnumerable<RoomInstance> Rooms =
                    (from RoomInstance in RoomManager.RoomInstances
                     where RoomInstance.Value.Info.Type == RoomType.Flat &&
                        RoomInstance.Value.CachedNavigatorUserCount > 0 &&
                        (Category == -1 || RoomInstance.Value.Info.CategoryId == Category)
                     orderby RoomInstance.Value.CachedNavigatorUserCount descending
                     select RoomInstance.Value).Take(50);

                Response = NavigatorRoomListComposer.Compose(Category, 1, string.Empty, Rooms.ToList());
                AddToCacheIfNeeded(0, Message, Response);
                Session.SendData(Response);
            }
        }
开发者ID:BjkGkh,项目名称:BobbaRP,代码行数:28,代码来源:Navigator.cs

示例12: GetUserInfo

 private static void GetUserInfo(Session Session, ClientMessage Message)
 {
     Session.SendData(UserObjectComposer.Compose(Session));
     Session.SendData(AchievementScoreUpdateComposer.Compose(Session.CharacterInfo.Score));
 }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:5,代码来源:Handshake.cs

示例13: GetSubscriptionData

 private static void GetSubscriptionData(Session Session, ClientMessage Message)
 {
     Session.SendData(SubscriptionStatusComposer.Compose(Session.SubscriptionManager));
 }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:4,代码来源:Handshake.cs

示例14: GetBalance

 private static void GetBalance(Session Session, ClientMessage Message)
 {
     Session.SendData(CreditsBalanceComposer.Compose(Session.CharacterInfo.CreditsBalance));
     Session.SendData(ActivityPointsBalanceComposer.Compose(Session.CharacterInfo.ActivityPointsBalance, 0));
 }
开发者ID:DaimOwns,项目名称:ProRP,代码行数:5,代码来源:Handshake.cs

示例15: RemoveFavorite

        private static void RemoveFavorite(Session Session, ClientMessage Message)
        {
            uint RoomId = Message.PopWiredUInt32();

            if (Session.FavoriteRoomsCache.RemoveRoomFromFavorites(RoomId))
            {
                Session.SendData(NavigatorFavoriteRoomsChanged.Compose(RoomId, false));
            }

            ClearCacheGroup(Session.CharacterId);
        }
开发者ID:BjkGkh,项目名称:BobbaRP,代码行数:11,代码来源:Navigator.cs


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