public long char_idx;// 创建成功的角色id
 public override void Read(ByteArray by)
 {
     base.Read(by);
     result      = (eCreateCharResult)by.ReadByte();
     account_idx = by.ReadLong();
     char_idx    = by.ReadLong();
 }
Exemple #2
0
 public override void Read(ByteArray by)
 {
     base.Read(by);
     client_uid.Read(by);
     result    = (eCreateCharResult)by.ReadByte();
     char_idx  = by.ReadLong();
     char_name = by.ReadString();
 }
Exemple #3
0
        /// <summary>
        /// 创建角色
        /// </summary>
        private void OnCreateCharacter(PacketBase packet)
        {
            gs2ss.CreateCharacter msg = packet as gs2ss.CreateCharacter;

            CreateCharacterInfo create_info = new CreateCharacterInfo();

            create_info.spid      = msg.spid;
            create_info.ws_id     = ServerNetManager.Instance.srv_realm_idx;
            create_info.ss_id     = 0;
            create_info.fs_id     = 0;
            create_info.char_idx  = IdSharedManager.Instance.GetNextCharIdx();
            create_info.char_name = msg.name;
            create_info.char_type = (byte)msg.flags;

            long   account_idx = msg.account_idx;
            ushort gs_uid      = msg.server_uid.gs_uid;

            SQLCharHandle.CreateCharacter(account_idx, new DBID(msg.game_db_id), create_info, (res) =>
            {
                eCreateCharResult result = eCreateCharResult.E_FAILED_COMMONERROR;
                if (create_info.char_idx == res)
                {
                    result = eCreateCharResult.E_SUCCESS;
                }
                else
                {
                    switch (res)
                    {
                    case 0: result = eCreateCharResult.E_FAILED_INTERNALERROR; break;

                    case 1: result = eCreateCharResult.E_FAILED_CHARCOUNTLIMIT; break;

                    case 2: result = eCreateCharResult.E_FAILED_INVALIDPARAM_REPEATEDNAME; break;

                    case 3: result = eCreateCharResult.E_FAILED_COMMONERROR; break;
                    }
                }

                ss2gs.CreateCharacter rep_msg = PacketPools.Get(ss2gs.msg.CREATE_CHARACTER) as ss2gs.CreateCharacter;
                rep_msg.result      = result;
                rep_msg.account_idx = account_idx;
                rep_msg.char_idx    = create_info.char_idx;
                ServerNetManager.Instance.Send(gs_uid, rep_msg);
            }
                                          );
        }
Exemple #4
0
        /// <summary>
        /// 创建角色
        /// </summary>
        private void OnCreateCharacter(PacketBase packet)
        {
            ss2db.CreateCharacter msg = packet as ss2db.CreateCharacter;

            InterServerID       server_uid  = msg.server_uid;
            ClientUID           client_uid  = msg.client_uid;
            CreateCharacterInfo create_info = msg.data;

            create_info.char_idx = ServerNetManager.Instance.GetNextCharIdx();

            SQLCharHandle.CreateCharacter(msg.account_idx, create_info, (res) =>
            {
                eCreateCharResult result = eCreateCharResult.E_FAILED_COMMONERROR;
                if (create_info.char_idx == res)
                {
                    result = eCreateCharResult.E_SUCCESS;
                }
                else
                {
                    switch (res)
                    {
                    case 0: result = eCreateCharResult.E_FAILED_INTERNALERROR; break;

                    case 1: result = eCreateCharResult.E_FAILED_CHARCOUNTLIMIT; break;

                    case 2: result = eCreateCharResult.E_FAILED_INVALIDPARAM_REPEATEDNAME; break;

                    case 3: result = eCreateCharResult.E_FAILED_COMMONERROR; break;
                    }
                }

                db2ss.CreateCharacter rep_msg = PacketPools.Get(db2ss.msg.CREATE_CHARACTER) as db2ss.CreateCharacter;
                rep_msg.server_uid            = server_uid;
                rep_msg.client_uid            = client_uid;
                rep_msg.char_idx  = create_info.char_idx;
                rep_msg.char_name = create_info.char_name;
                rep_msg.result    = result;
                this.Send(rep_msg);
            }
                                          );
        }