Exemple #1
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        PlayerLoginData mData = (PlayerLoginData)data;

        if (this.playerID != mData.playerID)
        {
            return(false);
        }

        if (this.name != mData.name)
        {
            return(false);
        }

        if (this.sex != mData.sex)
        {
            return(false);
        }

        if (this.vocation != mData.vocation)
        {
            return(false);
        }

        if (this.isOnline != mData.isOnline)
        {
            return(false);
        }

        return(true);
    }
Exemple #2
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        base.toReadBytesFull(stream);

        stream.startReadObj();

        BaseData roleT = stream.readDataFullNotNull();

        if (roleT != null)
        {
            if (roleT is PlayerLoginData)
            {
                this.role = (PlayerLoginData)roleT;
            }
            else
            {
                this.role = new PlayerLoginData();
                if (!(roleT.GetType().IsAssignableFrom(typeof(PlayerLoginData))))
                {
                    stream.throwTypeReadError(typeof(PlayerLoginData), roleT.GetType());
                }
                this.role.shadowCopy(roleT);
            }
        }
        else
        {
            this.role = null;
        }

        stream.endReadObj();
    }
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        base.toReadBytesFull(stream);

        stream.startReadObj();

        int rolesLen = stream.readLen();

        if (this.roles != null)
        {
            this.roles.clear();
            this.roles.ensureCapacity(rolesLen);
        }
        else
        {
            this.roles = new SList <PlayerLoginData>();
        }

        SList <PlayerLoginData> rolesT = this.roles;

        for (int rolesI = rolesLen - 1; rolesI >= 0; --rolesI)
        {
            PlayerLoginData rolesV;
            BaseData        rolesVT = stream.readDataFullNotNull();
            if (rolesVT != null)
            {
                if (rolesVT is PlayerLoginData)
                {
                    rolesV = (PlayerLoginData)rolesVT;
                }
                else
                {
                    rolesV = new PlayerLoginData();
                    if (!(rolesVT.GetType().IsAssignableFrom(typeof(PlayerLoginData))))
                    {
                        stream.throwTypeReadError(typeof(PlayerLoginData), rolesVT.GetType());
                    }
                    rolesV.shadowCopy(rolesVT);
                }
            }
            else
            {
                rolesV = null;
            }

            rolesT.add(rolesV);
        }

        this.serverBornCode = stream.readInt();

        stream.endReadObj();
    }
    /// <summary>
    /// 转文本输出
    /// </summary>
    protected override void toWriteDataString(DataWriter writer)
    {
        base.toWriteDataString(writer);

        writer.writeTabs();
        writer.sb.Append("roles");
        writer.sb.Append(':');
        writer.sb.Append("List<PlayerLoginData>");
        if (this.roles != null)
        {
            SList <PlayerLoginData> rolesT = this.roles;
            int rolesLen = rolesT.size();
            writer.sb.Append('(');
            writer.sb.Append(rolesLen);
            writer.sb.Append(')');
            writer.writeEnter();
            writer.writeLeftBrace();
            for (int rolesI = 0; rolesI < rolesLen; ++rolesI)
            {
                PlayerLoginData rolesV = rolesT.get(rolesI);
                writer.writeTabs();
                writer.sb.Append(rolesI);
                writer.sb.Append(':');
                if (rolesV != null)
                {
                    rolesV.writeDataString(writer);
                }
                else
                {
                    writer.sb.Append("PlayerLoginData=null");
                }

                writer.writeEnter();
            }
            writer.writeRightBrace();
        }
        else
        {
            writer.sb.Append("=null");
        }

        writer.writeEnter();
        writer.writeTabs();
        writer.sb.Append("serverBornCode");
        writer.sb.Append(':');
        writer.sb.Append(this.serverBornCode);

        writer.writeEnter();
    }
Exemple #5
0
        public Match(string roomUUID, string playerOneUUID, string playerOneToken, string playerOneName, string playerTwoUUID, string playerTwoToken, string playerTwoName)
        {
            matchData = new MatchData(roomUUID);

            PlayerLoginData playerOne = new PlayerLoginData(playerOneUUID, playerOneToken, playerOneName, PlayerEnum.Player1, TeamEnum.Team1);
            PlayerLoginData playerTwo = new PlayerLoginData(playerTwoUUID, playerTwoToken, playerTwoName, PlayerEnum.Player2, TeamEnum.Team2);

            Team teamOne = new Team(new Player(playerOne), TeamEnum.Team1);
            Team teamTwo = new Team(new Player(playerTwo), TeamEnum.Team2);

            teams.Add(teamOne);
            teams.Add(teamTwo);

            Game = new Game(teams);
        }
Exemple #6
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is PlayerLoginData))
        {
            return;
        }

        PlayerLoginData mData = (PlayerLoginData)data;

        this.playerID = mData.playerID;
        this.name     = mData.name;
        this.sex      = mData.sex;
        this.vocation = mData.vocation;
        this.isOnline = mData.isOnline;
    }
Exemple #7
0
    /** 创角成功 */
    public virtual void onCreatePlayerSuccess(PlayerLoginData pData)
    {
        Ctrl.print("创建角色成功");

        _playerList.add(pData);

        if (ShineSetting.openCheck)
        {
            if (_stepTool.isComplete(PlayerLogin))
            {
                Ctrl.errorLog("step不该已完成:PlayerLogin");
            }
        }

        _stepTool.completeStep(CheckCreatePlayer);
    }
        public override void onCreatePlayerSuccess(PlayerLoginData pData)
        {
            if (!_g19)
            {
                _m19 = instance.Type.GetMethod("onCreatePlayerSuccess", 1);
                _g19 = true;
            }

            if (_m19 != null && !_b19)
            {
                _b19   = true;
                _p1[0] = pData;
                appdomain.Invoke(_m19, instance, _p1);
                _p1[0] = null;
                _b19   = false;
            }
            else
            {
                base.onCreatePlayerSuccess(pData);
            }
        }
Exemple #9
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        base.toReadBytesSimple(stream);

        this.role = (PlayerLoginData)stream.readDataSimpleNotNull();
    }
Exemple #10
0
    /// <summary>
    /// 回池
    /// </summary>
    protected override void toRelease(DataPool pool)
    {
        base.toRelease(pool);

        this.role = null;
    }
Exemple #11
0
 public Discard0OutMessage(IAgentBase sender, PlayerLoginData plData)
     : base(sender, ServiceType.Login, 2022)
 {
     Request        = new __RPC_Login_Discard0_ARG_PlayerLoginData_plData__();
     Request.PlData = plData;
 }
Exemple #12
0
 public void Discard0(PlayerLoginData plData)
 {
     //do nothing
 }