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


C# PlayerBussiness.GetMarryRoomInfoSingle方法代码示例

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


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

示例1: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            //if (client.Player.CurrentGame != null)
            //{
            //    client.Player.CurrentGame.RemovePlayer(client.Player);
            //}
            //if(client.Player.CurrentMarryRoom != null)
            //{
            //    client.Player.CurrentMarryRoom.RemovePlayer(client.Player);
            //}

            MarryRoom room = null;
            string msg = "";

            int id = packet.ReadInt();
            string pwd = packet.ReadString();
            int sceneID = packet.ReadInt();

            if (id != 0)
            {
                room = MarryRoomMgr.GetMarryRoombyID(id, pwd == null ? "" : pwd, ref msg);
            }
            else
            { 
                if(client.Player.PlayerCharacter.IsCreatedMarryRoom)
                {
                    MarryRoom[] rooms = MarryRoomMgr.GetAllMarryRoom();

                    foreach (MarryRoom r in rooms)
                    {
                        if (r.Info.GroomID == client.Player.PlayerCharacter.ID || r.Info.BrideID == client.Player.PlayerCharacter.ID)
                        {
                            room = r;
                            break;
                        }
                    }
                }

                if (room == null && client.Player.PlayerCharacter.SelfMarryRoomID != 0)
                {
                    client.Player.Out.SendMarryRoomLogin(client.Player, false);
                    MarryRoomInfo info = null;
                    using(PlayerBussiness db = new PlayerBussiness())
                    {
                        info = db.GetMarryRoomInfoSingle(client.Player.PlayerCharacter.SelfMarryRoomID);
                    }

                    if (info != null)
                    {
                        client.Player.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("MarryRoomLoginHandler.RoomExist",info.ServerID,client.Player.PlayerCharacter.SelfMarryRoomID));
                        return 0;
                    }
                }
            }

            if (room != null)
            {
                if(room.CheckUserForbid(client.Player.PlayerCharacter.ID))
                {
                    client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("MarryRoomLoginHandler.Forbid"));
                    client.Player.Out.SendMarryRoomLogin(client.Player, false);
                    return 1;
                }

                if (room.RoomState == eRoomState.FREE)
                {
                    if (room.AddPlayer(client.Player))
                    {
                        client.Player.MarryMap = sceneID;

                        GSPacketIn pkg = client.Player.Out.SendMarryRoomLogin(client.Player, true);

                        room.SendMarryRoomInfoUpdateToScenePlayers(room);

                        return 0;
                    }
                }
                else
                {
                    client.Player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("MarryRoomLoginHandler.AlreadyBegin"));
                }

                client.Player.Out.SendMarryRoomLogin(client.Player, false);

            }
            else
            {
                client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation(string.IsNullOrEmpty(msg) ? "MarryRoomLoginHandler.Failed" : msg));
                client.Player.Out.SendMarryRoomLogin(client.Player, false);
            }

            return 1;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:93,代码来源:MarryRoomLoginHandler.cs


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