Exemplo n.º 1
0
    public void initEnterData(SceneEnterData data)
    {
        if (!enabled)
        {
            return;
        }

        ScenePreInfoData preInfo = _scene.getPreInfo();

        if (preInfo != null)
        {
            RoleShowData[] signedPlayers = _scene.getPreInfo().signedPlayers;

            if (signedPlayers != null)
            {
                foreach (RoleShowData v in signedPlayers)
                {
                    _signedPlayers.put(v.playerID, v);
                }
            }
        }

        BattleSceneData bData = data.battleData;

        onRefreshBattleStateByServer(bData.state, bData.timeTick);

        if (_scene.isDriveAll())
        {
            //客户端场景,直接进入pre状态
            switchState(BattleStateType.Pre);
        }
    }
Exemplo n.º 2
0
    /** 添加场景角色 */
    public Role addRole(SceneRoleData data)
    {
        if (ShineSetting.openCheck)
        {
            if (_roleDic.contains(data.playerID))
            {
                Ctrl.throwError("场景角色重复添加", data.playerID);
                return(null);
            }
        }

        Role role = GameC.pool.rolePool.getOne();

        role.setData(data);
        role.setScene(_scene);

        role.enabled = true;

        _roleDic.put(role.playerID, role);

        if (role.playerID == GameC.player.role.playerID)
        {
            //设置
            _scene.setSelfRole(role);
        }

        role.init();

        onAddRole(role);

        return(role);
    }
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        base.toReadBytesSimple(stream);

        int dicLen = stream.readLen();

        if (this.dic != null)
        {
            this.dic.clear();
            this.dic.ensureCapacity(dicLen);
        }
        else
        {
            this.dic = new LongObjectMap <RoleSocialData>(dicLen);
        }

        LongObjectMap <RoleSocialData> dicT = this.dic;

        for (int dicI = dicLen - 1; dicI >= 0; --dicI)
        {
            RoleSocialData dicV;
            dicV = (RoleSocialData)stream.readDataSimpleNotNull();

            dicT.put(dicV.showData.playerID, dicV);
        }
    }
Exemplo n.º 4
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        base.toReadBytesSimple(stream);

        int roleGroupSimpleDataDicLen = stream.readLen();

        if (this.roleGroupSimpleDataDic != null)
        {
            this.roleGroupSimpleDataDic.clear();
            this.roleGroupSimpleDataDic.ensureCapacity(roleGroupSimpleDataDicLen);
        }
        else
        {
            this.roleGroupSimpleDataDic = new LongObjectMap <RoleGroupSimpleData>(roleGroupSimpleDataDicLen);
        }

        LongObjectMap <RoleGroupSimpleData> roleGroupSimpleDataDicT = this.roleGroupSimpleDataDic;

        for (int roleGroupSimpleDataDicI = roleGroupSimpleDataDicLen - 1; roleGroupSimpleDataDicI >= 0; --roleGroupSimpleDataDicI)
        {
            long roleGroupSimpleDataDicK;
            RoleGroupSimpleData roleGroupSimpleDataDicV;
            roleGroupSimpleDataDicK = stream.readLong();

            roleGroupSimpleDataDicV = (RoleGroupSimpleData)stream.readDataSimpleNotNull();

            roleGroupSimpleDataDicT.put(roleGroupSimpleDataDicK, roleGroupSimpleDataDicV);
        }
    }
Exemplo n.º 5
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        base.toCopy(data);

        if (!(data is RoleGroupToolData))
        {
            return;
        }

        RoleGroupToolData mData = (RoleGroupToolData)data;

        if (mData.simpleDatas != null)
        {
            if (this.simpleDatas != null)
            {
                this.simpleDatas.clear();
                this.simpleDatas.ensureCapacity(mData.simpleDatas.size());
            }
            else
            {
                this.simpleDatas = new LongObjectMap <RoleGroupSimpleData>(mData.simpleDatas.size());
            }

            LongObjectMap <RoleGroupSimpleData> simpleDatasT = this.simpleDatas;
            if (!mData.simpleDatas.isEmpty())
            {
                long   simpleDatasKFreeValue             = mData.simpleDatas.getFreeValue();
                long[] simpleDatasKKeys                  = mData.simpleDatas.getKeys();
                RoleGroupSimpleData[] simpleDatasVValues = mData.simpleDatas.getValues();
                for (int simpleDatasKI = simpleDatasKKeys.Length - 1; simpleDatasKI >= 0; --simpleDatasKI)
                {
                    long simpleDatasK = simpleDatasKKeys[simpleDatasKI];
                    if (simpleDatasK != simpleDatasKFreeValue)
                    {
                        RoleGroupSimpleData simpleDatasV = simpleDatasVValues[simpleDatasKI];
                        long simpleDatasW;
                        RoleGroupSimpleData simpleDatasU;
                        simpleDatasW = simpleDatasK;

                        if (simpleDatasV != null)
                        {
                            simpleDatasU = (RoleGroupSimpleData)simpleDatasV.clone();
                        }
                        else
                        {
                            simpleDatasU = null;
                            nullObjError("simpleDatasU");
                        }

                        simpleDatasT.put(simpleDatasW, simpleDatasU);
                    }
                }
            }
        }
        else
        {
            this.simpleDatas = null;
            nullObjError("simpleDatas");
        }
    }
Exemplo n.º 6
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        base.toCopy(data);

        if (!(data is CenterRoleGroupToolData))
        {
            return;
        }

        CenterRoleGroupToolData mData = (CenterRoleGroupToolData)data;

        if (mData.roleGroupSimpleDataDic != null)
        {
            if (this.roleGroupSimpleDataDic != null)
            {
                this.roleGroupSimpleDataDic.clear();
                this.roleGroupSimpleDataDic.ensureCapacity(mData.roleGroupSimpleDataDic.size());
            }
            else
            {
                this.roleGroupSimpleDataDic = new LongObjectMap <RoleGroupSimpleData>(mData.roleGroupSimpleDataDic.size());
            }

            LongObjectMap <RoleGroupSimpleData> roleGroupSimpleDataDicT = this.roleGroupSimpleDataDic;
            if (!mData.roleGroupSimpleDataDic.isEmpty())
            {
                long   roleGroupSimpleDataDicKFreeValue             = mData.roleGroupSimpleDataDic.getFreeValue();
                long[] roleGroupSimpleDataDicKKeys                  = mData.roleGroupSimpleDataDic.getKeys();
                RoleGroupSimpleData[] roleGroupSimpleDataDicVValues = mData.roleGroupSimpleDataDic.getValues();
                for (int roleGroupSimpleDataDicKI = roleGroupSimpleDataDicKKeys.Length - 1; roleGroupSimpleDataDicKI >= 0; --roleGroupSimpleDataDicKI)
                {
                    long roleGroupSimpleDataDicK = roleGroupSimpleDataDicKKeys[roleGroupSimpleDataDicKI];
                    if (roleGroupSimpleDataDicK != roleGroupSimpleDataDicKFreeValue)
                    {
                        RoleGroupSimpleData roleGroupSimpleDataDicV = roleGroupSimpleDataDicVValues[roleGroupSimpleDataDicKI];
                        long roleGroupSimpleDataDicW;
                        RoleGroupSimpleData roleGroupSimpleDataDicU;
                        roleGroupSimpleDataDicW = roleGroupSimpleDataDicK;

                        if (roleGroupSimpleDataDicV != null)
                        {
                            roleGroupSimpleDataDicU = (RoleGroupSimpleData)roleGroupSimpleDataDicV.clone();
                        }
                        else
                        {
                            roleGroupSimpleDataDicU = null;
                            nullObjError("roleGroupSimpleDataDicU");
                        }

                        roleGroupSimpleDataDicT.put(roleGroupSimpleDataDicW, roleGroupSimpleDataDicU);
                    }
                }
            }
        }
        else
        {
            this.roleGroupSimpleDataDic = null;
            nullObjError("roleGroupSimpleDataDic");
        }
    }
Exemplo n.º 7
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        base.toReadBytesSimple(stream);

        int simpleDatasLen = stream.readLen();

        if (this.simpleDatas != null)
        {
            this.simpleDatas.clear();
            this.simpleDatas.ensureCapacity(simpleDatasLen);
        }
        else
        {
            this.simpleDatas = new LongObjectMap <RoleGroupSimpleData>(simpleDatasLen);
        }

        LongObjectMap <RoleGroupSimpleData> simpleDatasT = this.simpleDatas;

        for (int simpleDatasI = simpleDatasLen - 1; simpleDatasI >= 0; --simpleDatasI)
        {
            long simpleDatasK;
            RoleGroupSimpleData simpleDatasV;
            simpleDatasK = stream.readLong();

            simpleDatasV = (RoleGroupSimpleData)stream.readDataSimpleNotNull();

            simpleDatasT.put(simpleDatasK, simpleDatasV);
        }
    }
Exemplo n.º 8
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        this.groupID = stream.readLong();

        this.exp = stream.readLong();

        int membersLen = stream.readLen();

        if (this.members != null)
        {
            this.members.clear();
            this.members.ensureCapacity(membersLen);
        }
        else
        {
            this.members = new LongObjectMap <PlayerRoleGroupMemberData>(membersLen);
        }

        LongObjectMap <PlayerRoleGroupMemberData> membersT = this.members;

        for (int membersI = membersLen - 1; membersI >= 0; --membersI)
        {
            PlayerRoleGroupMemberData membersV;
            membersV = (PlayerRoleGroupMemberData)stream.readDataSimpleNotNull();

            membersT.put(membersV.playerID, membersV);
        }
    }
Exemplo n.º 9
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is PlayerRoleGroupExData))
        {
            return;
        }

        PlayerRoleGroupExData mData = (PlayerRoleGroupExData)data;

        this.groupID = mData.groupID;

        this.exp = mData.exp;

        if (mData.members != null)
        {
            if (this.members != null)
            {
                this.members.clear();
                this.members.ensureCapacity(mData.members.size());
            }
            else
            {
                this.members = new LongObjectMap <PlayerRoleGroupMemberData>(mData.members.size());
            }

            LongObjectMap <PlayerRoleGroupMemberData> membersT = this.members;
            if (!mData.members.isEmpty())
            {
                PlayerRoleGroupMemberData[] membersVValues = mData.members.getValues();
                for (int membersVI = membersVValues.Length - 1; membersVI >= 0; --membersVI)
                {
                    PlayerRoleGroupMemberData membersV = membersVValues[membersVI];
                    if (membersV != null)
                    {
                        PlayerRoleGroupMemberData membersU;
                        if (membersV != null)
                        {
                            membersU = (PlayerRoleGroupMemberData)membersV.clone();
                        }
                        else
                        {
                            membersU = null;
                            nullObjError("membersU");
                        }

                        membersT.put(membersU.playerID, membersU);
                    }
                }
            }
        }
        else
        {
            this.members = null;
            nullObjError("members");
        }
    }
Exemplo n.º 10
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        base.toReadBytesFull(stream);

        stream.startReadObj();

        int dicLen = stream.readLen();

        if (this.dic != null)
        {
            this.dic.clear();
            this.dic.ensureCapacity(dicLen);
        }
        else
        {
            this.dic = new LongObjectMap <RoleSocialPoolData>(dicLen);
        }

        LongObjectMap <RoleSocialPoolData> dicT = this.dic;

        for (int dicI = dicLen - 1; dicI >= 0; --dicI)
        {
            long dicK;
            RoleSocialPoolData dicV;
            dicK = stream.readLong();

            BaseData dicVT = stream.readDataFullNotNull();
            if (dicVT != null)
            {
                if (dicVT is RoleSocialPoolData)
                {
                    dicV = (RoleSocialPoolData)dicVT;
                }
                else
                {
                    dicV = new RoleSocialPoolData();
                    if (!(dicVT.GetType().IsAssignableFrom(typeof(RoleSocialPoolData))))
                    {
                        stream.throwTypeReadError(typeof(RoleSocialPoolData), dicVT.GetType());
                    }
                    dicV.shadowCopy(dicVT);
                }
            }
            else
            {
                dicV = null;
            }

            dicT.put(dicK, dicV);
        }

        this.nextCutTime = stream.readLong();

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

        stream.startReadObj();

        int simpleDatasLen = stream.readLen();

        if (this.simpleDatas != null)
        {
            this.simpleDatas.clear();
            this.simpleDatas.ensureCapacity(simpleDatasLen);
        }
        else
        {
            this.simpleDatas = new LongObjectMap <RoleGroupSimpleData>(simpleDatasLen);
        }

        LongObjectMap <RoleGroupSimpleData> simpleDatasT = this.simpleDatas;

        for (int simpleDatasI = simpleDatasLen - 1; simpleDatasI >= 0; --simpleDatasI)
        {
            long simpleDatasK;
            RoleGroupSimpleData simpleDatasV;
            simpleDatasK = stream.readLong();

            BaseData simpleDatasVT = stream.readDataFullNotNull();
            if (simpleDatasVT != null)
            {
                if (simpleDatasVT is RoleGroupSimpleData)
                {
                    simpleDatasV = (RoleGroupSimpleData)simpleDatasVT;
                }
                else
                {
                    simpleDatasV = new RoleGroupSimpleData();
                    if (!(simpleDatasVT.GetType().IsAssignableFrom(typeof(RoleGroupSimpleData))))
                    {
                        stream.throwTypeReadError(typeof(RoleGroupSimpleData), simpleDatasVT.GetType());
                    }
                    simpleDatasV.shadowCopy(simpleDatasVT);
                }
            }
            else
            {
                simpleDatasV = null;
            }

            simpleDatasT.put(simpleDatasK, simpleDatasV);
        }

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

        stream.startReadObj();

        int roleGroupSimpleDataDicLen = stream.readLen();

        if (this.roleGroupSimpleDataDic != null)
        {
            this.roleGroupSimpleDataDic.clear();
            this.roleGroupSimpleDataDic.ensureCapacity(roleGroupSimpleDataDicLen);
        }
        else
        {
            this.roleGroupSimpleDataDic = new LongObjectMap <RoleGroupSimpleData>(roleGroupSimpleDataDicLen);
        }

        LongObjectMap <RoleGroupSimpleData> roleGroupSimpleDataDicT = this.roleGroupSimpleDataDic;

        for (int roleGroupSimpleDataDicI = roleGroupSimpleDataDicLen - 1; roleGroupSimpleDataDicI >= 0; --roleGroupSimpleDataDicI)
        {
            long roleGroupSimpleDataDicK;
            RoleGroupSimpleData roleGroupSimpleDataDicV;
            roleGroupSimpleDataDicK = stream.readLong();

            BaseData roleGroupSimpleDataDicVT = stream.readDataFullNotNull();
            if (roleGroupSimpleDataDicVT != null)
            {
                if (roleGroupSimpleDataDicVT is RoleGroupSimpleData)
                {
                    roleGroupSimpleDataDicV = (RoleGroupSimpleData)roleGroupSimpleDataDicVT;
                }
                else
                {
                    roleGroupSimpleDataDicV = new RoleGroupSimpleData();
                    if (!(roleGroupSimpleDataDicVT.GetType().IsAssignableFrom(typeof(RoleGroupSimpleData))))
                    {
                        stream.throwTypeReadError(typeof(RoleGroupSimpleData), roleGroupSimpleDataDicVT.GetType());
                    }
                    roleGroupSimpleDataDicV.shadowCopy(roleGroupSimpleDataDicVT);
                }
            }
            else
            {
                roleGroupSimpleDataDicV = null;
            }

            roleGroupSimpleDataDicT.put(roleGroupSimpleDataDicK, roleGroupSimpleDataDicV);
        }

        stream.endReadObj();
    }
Exemplo n.º 13
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

        this.groupID = stream.readLong();

        this.exp = stream.readLong();

        int membersLen = stream.readLen();

        if (this.members != null)
        {
            this.members.clear();
            this.members.ensureCapacity(membersLen);
        }
        else
        {
            this.members = new LongObjectMap <PlayerRoleGroupMemberData>(membersLen);
        }

        LongObjectMap <PlayerRoleGroupMemberData> membersT = this.members;

        for (int membersI = membersLen - 1; membersI >= 0; --membersI)
        {
            PlayerRoleGroupMemberData membersV;
            BaseData membersVT = stream.readDataFullNotNull();
            if (membersVT != null)
            {
                if (membersVT is PlayerRoleGroupMemberData)
                {
                    membersV = (PlayerRoleGroupMemberData)membersVT;
                }
                else
                {
                    membersV = new PlayerRoleGroupMemberData();
                    if (!(membersVT.GetType().IsAssignableFrom(typeof(PlayerRoleGroupMemberData))))
                    {
                        stream.throwTypeReadError(typeof(PlayerRoleGroupMemberData), membersVT.GetType());
                    }
                    membersV.shadowCopy(membersVT);
                }
            }
            else
            {
                membersV = null;
            }

            membersT.put(membersV.playerID, membersV);
        }

        stream.endReadObj();
    }
Exemplo n.º 14
0
    public override void afterReadData()
    {
        base.afterReadData();

        if (_d.inviteList == null)
        {
            _d.inviteList = new SList <InviteRoleGroupReceiveData>();
        }

        _inviteList = _d.inviteList;

        PlayerRoleGroup playerRoleGroup;

        PlayerRoleGroupData[] values;
        PlayerRoleGroupData   v;

        for (int i = (values = _d.groups.getValues()).Length - 1; i >= 0; --i)
        {
            if ((v = values[i]) != null)
            {
                playerRoleGroup = toCreatePlayerRoleGroup();
                playerRoleGroup.setGroupTool(this);
                playerRoleGroup.construct();
                playerRoleGroup.setData(v);

                _roleGroupDic.put(playerRoleGroup.groupID, playerRoleGroup);
                if (_config.isSingleJoin())
                {
                    _onlyOne = playerRoleGroup;
                }

                playerRoleGroup.init();
                playerRoleGroup.afterReadData();
            }
        }
    }
Exemplo n.º 15
0
    /// <summary>
    /// 添加角色社交数据
    /// </summary>
    public RoleSocialData addPlayerRoleSocial(long playerID, RoleSocialData data)
    {
        RoleSocialData oldData;

        if ((oldData = _roleSocialDic.get(playerID)) != null)
        {
            oldData.copy(data);
            return(oldData);
        }
        else
        {
            _roleSocialDic.put(playerID, data);
            return(data);
        }
    }
Exemplo n.º 16
0
    /** 设置绑定角色逻辑组 */
    public void setSignedLogics(CharacterUseLogic[] logics)
    {
        _logicDic = new LongObjectMap <CharacterUseLogic>();

        int i = 0;

        RoleShowData[] signedUnits = new RoleShowData[logics.Length];

        foreach (CharacterUseLogic v in logics)
        {
            _logicDic.put(v.getPlayerID(), v);
            signedUnits[i++] = v.createRoleShowData();
        }

        //设置指定角色组
        setSignedPlayers(signedUnits);
    }
Exemplo n.º 17
0
    private CachePageData getCachePageData(int subsectionIndex, int subsectionSubIndex)
    {
        long cacheKey = getCacheKey(subsectionIndex, subsectionSubIndex);

        CachePageData cachePageData;

        if (!_cachePageDataMap.contains(cacheKey))
        {
            _cachePageDataMap.put(cacheKey, cachePageData = new CachePageData());
            cachePageData.subsectionIndex    = subsectionIndex;
            cachePageData.subsectionSubIndex = subsectionSubIndex;
        }
        else
        {
            cachePageData = _cachePageDataMap.get(cacheKey);
        }

        return(cachePageData);
    }
Exemplo n.º 18
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        int friendsLen = stream.readLen();

        if (this.friends != null)
        {
            this.friends.clear();
            this.friends.ensureCapacity(friendsLen);
        }
        else
        {
            this.friends = new LongObjectMap <FriendData>(friendsLen);
        }

        LongObjectMap <FriendData> friendsT = this.friends;

        for (int friendsI = friendsLen - 1; friendsI >= 0; --friendsI)
        {
            FriendData friendsV;
            friendsV = (FriendData)stream.readDataSimpleNotNull();

            friendsT.put(friendsV.playerID, friendsV);
        }

        int blackListLen = stream.readLen();

        if (this.blackList != null)
        {
            this.blackList.clear();
            this.blackList.ensureCapacity(blackListLen);
        }
        else
        {
            this.blackList = new LongObjectMap <ContactData>(blackListLen);
        }

        LongObjectMap <ContactData> blackListT = this.blackList;

        for (int blackListI = blackListLen - 1; blackListI >= 0; --blackListI)
        {
            ContactData blackListV;
            blackListV = (ContactData)stream.readDataSimpleNotNull();

            blackListT.put(blackListV.playerID, blackListV);
        }

        int applyDicLen = stream.readLen();

        if (this.applyDic != null)
        {
            this.applyDic.clear();
            this.applyDic.ensureCapacity(applyDicLen);
        }
        else
        {
            this.applyDic = new LongObjectMap <ApplyAddFriendData>(applyDicLen);
        }

        LongObjectMap <ApplyAddFriendData> applyDicT = this.applyDic;

        for (int applyDicI = applyDicLen - 1; applyDicI >= 0; --applyDicI)
        {
            ApplyAddFriendData applyDicV;
            applyDicV = (ApplyAddFriendData)stream.readDataSimpleNotNull();

            applyDicT.put(applyDicV.playerID, applyDicV);
        }
    }
Exemplo n.º 19
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

        int friendsLen = stream.readLen();

        if (this.friends != null)
        {
            this.friends.clear();
            this.friends.ensureCapacity(friendsLen);
        }
        else
        {
            this.friends = new LongObjectMap <FriendData>(friendsLen);
        }

        LongObjectMap <FriendData> friendsT = this.friends;

        for (int friendsI = friendsLen - 1; friendsI >= 0; --friendsI)
        {
            FriendData friendsV;
            BaseData   friendsVT = stream.readDataFullNotNull();
            if (friendsVT != null)
            {
                if (friendsVT is FriendData)
                {
                    friendsV = (FriendData)friendsVT;
                }
                else
                {
                    friendsV = new FriendData();
                    if (!(friendsVT.GetType().IsAssignableFrom(typeof(FriendData))))
                    {
                        stream.throwTypeReadError(typeof(FriendData), friendsVT.GetType());
                    }
                    friendsV.shadowCopy(friendsVT);
                }
            }
            else
            {
                friendsV = null;
            }

            friendsT.put(friendsV.playerID, friendsV);
        }

        int blackListLen = stream.readLen();

        if (this.blackList != null)
        {
            this.blackList.clear();
            this.blackList.ensureCapacity(blackListLen);
        }
        else
        {
            this.blackList = new LongObjectMap <ContactData>(blackListLen);
        }

        LongObjectMap <ContactData> blackListT = this.blackList;

        for (int blackListI = blackListLen - 1; blackListI >= 0; --blackListI)
        {
            ContactData blackListV;
            BaseData    blackListVT = stream.readDataFullNotNull();
            if (blackListVT != null)
            {
                if (blackListVT is ContactData)
                {
                    blackListV = (ContactData)blackListVT;
                }
                else
                {
                    blackListV = new ContactData();
                    if (!(blackListVT.GetType().IsAssignableFrom(typeof(ContactData))))
                    {
                        stream.throwTypeReadError(typeof(ContactData), blackListVT.GetType());
                    }
                    blackListV.shadowCopy(blackListVT);
                }
            }
            else
            {
                blackListV = null;
            }

            blackListT.put(blackListV.playerID, blackListV);
        }

        int applyDicLen = stream.readLen();

        if (this.applyDic != null)
        {
            this.applyDic.clear();
            this.applyDic.ensureCapacity(applyDicLen);
        }
        else
        {
            this.applyDic = new LongObjectMap <ApplyAddFriendData>(applyDicLen);
        }

        LongObjectMap <ApplyAddFriendData> applyDicT = this.applyDic;

        for (int applyDicI = applyDicLen - 1; applyDicI >= 0; --applyDicI)
        {
            ApplyAddFriendData applyDicV;
            BaseData           applyDicVT = stream.readDataFullNotNull();
            if (applyDicVT != null)
            {
                if (applyDicVT is ApplyAddFriendData)
                {
                    applyDicV = (ApplyAddFriendData)applyDicVT;
                }
                else
                {
                    applyDicV = new ApplyAddFriendData();
                    if (!(applyDicVT.GetType().IsAssignableFrom(typeof(ApplyAddFriendData))))
                    {
                        stream.throwTypeReadError(typeof(ApplyAddFriendData), applyDicVT.GetType());
                    }
                    applyDicV.shadowCopy(applyDicVT);
                }
            }
            else
            {
                applyDicV = null;
            }

            applyDicT.put(applyDicV.playerID, applyDicV);
        }

        stream.endReadObj();
    }
Exemplo n.º 20
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is SocialPartData))
        {
            return;
        }

        SocialPartData mData = (SocialPartData)data;

        if (mData.singleChannels != null)
        {
            if (this.singleChannels != null)
            {
                this.singleChannels.clear();
                this.singleChannels.ensureCapacity(mData.singleChannels.size());
            }
            else
            {
                this.singleChannels = new IntObjectMap <ChatChannelData>(mData.singleChannels.size());
            }

            IntObjectMap <ChatChannelData> singleChannelsT = this.singleChannels;
            if (!mData.singleChannels.isEmpty())
            {
                int               singleChannelsKFreeValue = mData.singleChannels.getFreeValue();
                int[]             singleChannelsKKeys      = mData.singleChannels.getKeys();
                ChatChannelData[] singleChannelsVValues    = mData.singleChannels.getValues();
                for (int singleChannelsKI = singleChannelsKKeys.Length - 1; singleChannelsKI >= 0; --singleChannelsKI)
                {
                    int singleChannelsK = singleChannelsKKeys[singleChannelsKI];
                    if (singleChannelsK != singleChannelsKFreeValue)
                    {
                        ChatChannelData singleChannelsV = singleChannelsVValues[singleChannelsKI];
                        int             singleChannelsW;
                        ChatChannelData singleChannelsU;
                        singleChannelsW = singleChannelsK;

                        if (singleChannelsV != null)
                        {
                            singleChannelsU = (ChatChannelData)singleChannelsV.clone();
                        }
                        else
                        {
                            singleChannelsU = null;
                            nullObjError("singleChannelsU");
                        }

                        singleChannelsT.put(singleChannelsW, singleChannelsU);
                    }
                }
            }
        }
        else
        {
            this.singleChannels = null;
            nullObjError("singleChannels");
        }

        if (mData.multiChannels != null)
        {
            if (this.multiChannels != null)
            {
                this.multiChannels.clear();
                this.multiChannels.ensureCapacity(mData.multiChannels.size());
            }
            else
            {
                this.multiChannels = new IntObjectMap <LongObjectMap <ChatChannelData> >(mData.multiChannels.size());
            }

            IntObjectMap <LongObjectMap <ChatChannelData> > multiChannelsT = this.multiChannels;
            if (!mData.multiChannels.isEmpty())
            {
                int   multiChannelsKFreeValue = mData.multiChannels.getFreeValue();
                int[] multiChannelsKKeys      = mData.multiChannels.getKeys();
                LongObjectMap <ChatChannelData>[] multiChannelsVValues = mData.multiChannels.getValues();
                for (int multiChannelsKI = multiChannelsKKeys.Length - 1; multiChannelsKI >= 0; --multiChannelsKI)
                {
                    int multiChannelsK = multiChannelsKKeys[multiChannelsKI];
                    if (multiChannelsK != multiChannelsKFreeValue)
                    {
                        LongObjectMap <ChatChannelData> multiChannelsV = multiChannelsVValues[multiChannelsKI];
                        int multiChannelsW;
                        LongObjectMap <ChatChannelData> multiChannelsU;
                        multiChannelsW = multiChannelsK;

                        if (multiChannelsV != null)
                        {
                            multiChannelsU = new LongObjectMap <ChatChannelData>(multiChannelsV.size());
                            LongObjectMap <ChatChannelData> multiChannelsUT = multiChannelsU;
                            if (!multiChannelsV.isEmpty())
                            {
                                long              multiChannelsUKFreeValue = multiChannelsV.getFreeValue();
                                long[]            multiChannelsUKKeys      = multiChannelsV.getKeys();
                                ChatChannelData[] multiChannelsUVValues    = multiChannelsV.getValues();
                                for (int multiChannelsUKI = multiChannelsUKKeys.Length - 1; multiChannelsUKI >= 0; --multiChannelsUKI)
                                {
                                    long multiChannelsUK = multiChannelsUKKeys[multiChannelsUKI];
                                    if (multiChannelsUK != multiChannelsUKFreeValue)
                                    {
                                        ChatChannelData multiChannelsUV = multiChannelsUVValues[multiChannelsUKI];
                                        long            multiChannelsUW;
                                        ChatChannelData multiChannelsUU;
                                        multiChannelsUW = multiChannelsUK;

                                        if (multiChannelsUV != null)
                                        {
                                            multiChannelsUU = (ChatChannelData)multiChannelsUV.clone();
                                        }
                                        else
                                        {
                                            multiChannelsUU = null;
                                            nullObjError("multiChannelsUU");
                                        }

                                        multiChannelsUT.put(multiChannelsUW, multiChannelsUU);
                                    }
                                }
                            }
                        }
                        else
                        {
                            multiChannelsU = null;
                            nullObjError("multiChannelsU");
                        }

                        multiChannelsT.put(multiChannelsW, multiChannelsU);
                    }
                }
            }
        }
        else
        {
            this.multiChannels = null;
            nullObjError("multiChannels");
        }

        this.chatSendIndex = mData.chatSendIndex;
    }
Exemplo n.º 21
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is FriendPartData))
        {
            return;
        }

        FriendPartData mData = (FriendPartData)data;

        if (mData.friends != null)
        {
            if (this.friends != null)
            {
                this.friends.clear();
                this.friends.ensureCapacity(mData.friends.size());
            }
            else
            {
                this.friends = new LongObjectMap <FriendData>(mData.friends.size());
            }

            LongObjectMap <FriendData> friendsT = this.friends;
            if (!mData.friends.isEmpty())
            {
                FriendData[] friendsVValues = mData.friends.getValues();
                for (int friendsVI = friendsVValues.Length - 1; friendsVI >= 0; --friendsVI)
                {
                    FriendData friendsV = friendsVValues[friendsVI];
                    if (friendsV != null)
                    {
                        FriendData friendsU;
                        if (friendsV != null)
                        {
                            friendsU = (FriendData)friendsV.clone();
                        }
                        else
                        {
                            friendsU = null;
                            nullObjError("friendsU");
                        }

                        friendsT.put(friendsU.playerID, friendsU);
                    }
                }
            }
        }
        else
        {
            this.friends = null;
            nullObjError("friends");
        }

        if (mData.blackList != null)
        {
            if (this.blackList != null)
            {
                this.blackList.clear();
                this.blackList.ensureCapacity(mData.blackList.size());
            }
            else
            {
                this.blackList = new LongObjectMap <ContactData>(mData.blackList.size());
            }

            LongObjectMap <ContactData> blackListT = this.blackList;
            if (!mData.blackList.isEmpty())
            {
                ContactData[] blackListVValues = mData.blackList.getValues();
                for (int blackListVI = blackListVValues.Length - 1; blackListVI >= 0; --blackListVI)
                {
                    ContactData blackListV = blackListVValues[blackListVI];
                    if (blackListV != null)
                    {
                        ContactData blackListU;
                        if (blackListV != null)
                        {
                            blackListU = (ContactData)blackListV.clone();
                        }
                        else
                        {
                            blackListU = null;
                            nullObjError("blackListU");
                        }

                        blackListT.put(blackListU.playerID, blackListU);
                    }
                }
            }
        }
        else
        {
            this.blackList = null;
            nullObjError("blackList");
        }

        if (mData.applyDic != null)
        {
            if (this.applyDic != null)
            {
                this.applyDic.clear();
                this.applyDic.ensureCapacity(mData.applyDic.size());
            }
            else
            {
                this.applyDic = new LongObjectMap <ApplyAddFriendData>(mData.applyDic.size());
            }

            LongObjectMap <ApplyAddFriendData> applyDicT = this.applyDic;
            if (!mData.applyDic.isEmpty())
            {
                ApplyAddFriendData[] applyDicVValues = mData.applyDic.getValues();
                for (int applyDicVI = applyDicVValues.Length - 1; applyDicVI >= 0; --applyDicVI)
                {
                    ApplyAddFriendData applyDicV = applyDicVValues[applyDicVI];
                    if (applyDicV != null)
                    {
                        ApplyAddFriendData applyDicU;
                        if (applyDicV != null)
                        {
                            applyDicU = (ApplyAddFriendData)applyDicV.clone();
                        }
                        else
                        {
                            applyDicU = null;
                            nullObjError("applyDicU");
                        }

                        applyDicT.put(applyDicU.playerID, applyDicU);
                    }
                }
            }
        }
        else
        {
            this.applyDic = null;
            nullObjError("applyDic");
        }
    }
Exemplo n.º 22
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is SceneEnterData))
        {
            return;
        }

        SceneEnterData mData = (SceneEnterData)data;

        if (mData.hero != null)
        {
            this.hero = (UnitData)mData.hero.clone();
        }
        else
        {
            this.hero = null;
        }

        if (mData.units != null)
        {
            if (this.units != null)
            {
                this.units.clear();
                this.units.ensureCapacity(mData.units.size());
            }
            else
            {
                this.units = new SList <UnitData>();
            }

            SList <UnitData> unitsT = this.units;
            if (!mData.units.isEmpty())
            {
                UnitData[] unitsVValues = mData.units.getValues();
                for (int unitsVI = 0, unitsVLen = mData.units.length(); unitsVI < unitsVLen; ++unitsVI)
                {
                    UnitData unitsV = unitsVValues[unitsVI];
                    UnitData unitsU;
                    if (unitsV != null)
                    {
                        unitsU = (UnitData)unitsV.clone();
                    }
                    else
                    {
                        unitsU = null;
                        nullObjError("unitsU");
                    }

                    unitsT.add(unitsU);
                }
            }
        }
        else
        {
            this.units = null;
            nullObjError("units");
        }

        if (mData.roles != null)
        {
            if (this.roles != null)
            {
                this.roles.clear();
                this.roles.ensureCapacity(mData.roles.size());
            }
            else
            {
                this.roles = new LongObjectMap <SceneRoleData>(mData.roles.size());
            }

            LongObjectMap <SceneRoleData> rolesT = this.roles;
            if (!mData.roles.isEmpty())
            {
                SceneRoleData[] rolesVValues = mData.roles.getValues();
                for (int rolesVI = rolesVValues.Length - 1; rolesVI >= 0; --rolesVI)
                {
                    SceneRoleData rolesV = rolesVValues[rolesVI];
                    if (rolesV != null)
                    {
                        SceneRoleData rolesU;
                        if (rolesV != null)
                        {
                            rolesU = (SceneRoleData)rolesV.clone();
                        }
                        else
                        {
                            rolesU = null;
                            nullObjError("rolesU");
                        }

                        rolesT.put(rolesU.playerID, rolesU);
                    }
                }
            }
        }
        else
        {
            this.roles = null;
            nullObjError("roles");
        }

        if (mData.selfBindFieldItemBags != null)
        {
            if (this.selfBindFieldItemBags != null)
            {
                this.selfBindFieldItemBags.clear();
                this.selfBindFieldItemBags.ensureCapacity(mData.selfBindFieldItemBags.size());
            }
            else
            {
                this.selfBindFieldItemBags = new IntObjectMap <FieldItemBagBindData>(mData.selfBindFieldItemBags.size());
            }

            IntObjectMap <FieldItemBagBindData> selfBindFieldItemBagsT = this.selfBindFieldItemBags;
            if (!mData.selfBindFieldItemBags.isEmpty())
            {
                FieldItemBagBindData[] selfBindFieldItemBagsVValues = mData.selfBindFieldItemBags.getValues();
                for (int selfBindFieldItemBagsVI = selfBindFieldItemBagsVValues.Length - 1; selfBindFieldItemBagsVI >= 0; --selfBindFieldItemBagsVI)
                {
                    FieldItemBagBindData selfBindFieldItemBagsV = selfBindFieldItemBagsVValues[selfBindFieldItemBagsVI];
                    if (selfBindFieldItemBagsV != null)
                    {
                        FieldItemBagBindData selfBindFieldItemBagsU;
                        if (selfBindFieldItemBagsV != null)
                        {
                            selfBindFieldItemBagsU = (FieldItemBagBindData)selfBindFieldItemBagsV.clone();
                        }
                        else
                        {
                            selfBindFieldItemBagsU = null;
                        }

                        selfBindFieldItemBagsT.put(selfBindFieldItemBagsU.instanceID, selfBindFieldItemBagsU);
                    }
                }
            }
        }
        else
        {
            this.selfBindFieldItemBags = null;
        }

        if (mData.bindVisionUnits != null)
        {
            if (this.bindVisionUnits != null)
            {
                this.bindVisionUnits.clear();
                this.bindVisionUnits.ensureCapacity(mData.bindVisionUnits.size());
            }
            else
            {
                this.bindVisionUnits = new IntObjectMap <UnitSimpleData>(mData.bindVisionUnits.size());
            }

            IntObjectMap <UnitSimpleData> bindVisionUnitsT = this.bindVisionUnits;
            if (!mData.bindVisionUnits.isEmpty())
            {
                int              bindVisionUnitsKFreeValue = mData.bindVisionUnits.getFreeValue();
                int[]            bindVisionUnitsKKeys      = mData.bindVisionUnits.getKeys();
                UnitSimpleData[] bindVisionUnitsVValues    = mData.bindVisionUnits.getValues();
                for (int bindVisionUnitsKI = bindVisionUnitsKKeys.Length - 1; bindVisionUnitsKI >= 0; --bindVisionUnitsKI)
                {
                    int bindVisionUnitsK = bindVisionUnitsKKeys[bindVisionUnitsKI];
                    if (bindVisionUnitsK != bindVisionUnitsKFreeValue)
                    {
                        UnitSimpleData bindVisionUnitsV = bindVisionUnitsVValues[bindVisionUnitsKI];
                        int            bindVisionUnitsW;
                        UnitSimpleData bindVisionUnitsU;
                        bindVisionUnitsW = bindVisionUnitsK;

                        if (bindVisionUnitsV != null)
                        {
                            bindVisionUnitsU = (UnitSimpleData)bindVisionUnitsV.clone();
                        }
                        else
                        {
                            bindVisionUnitsU = null;
                        }

                        bindVisionUnitsT.put(bindVisionUnitsW, bindVisionUnitsU);
                    }
                }
            }
        }
        else
        {
            this.bindVisionUnits = null;
        }

        if (mData.battleData != null)
        {
            this.battleData = (BattleSceneData)mData.battleData.clone();
        }
        else
        {
            this.battleData = null;
        }
    }
Exemplo n.º 23
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

        if (stream.readBoolean())
        {
            BaseData heroT = stream.readDataFullNotNull();
            if (heroT != null)
            {
                if (heroT is UnitData)
                {
                    this.hero = (UnitData)heroT;
                }
                else
                {
                    this.hero = new UnitData();
                    if (!(heroT.GetType().IsAssignableFrom(typeof(UnitData))))
                    {
                        stream.throwTypeReadError(typeof(UnitData), heroT.GetType());
                    }
                    this.hero.shadowCopy(heroT);
                }
            }
            else
            {
                this.hero = null;
            }
        }
        else
        {
            this.hero = null;
        }

        int unitsLen = stream.readLen();

        if (this.units != null)
        {
            this.units.clear();
            this.units.ensureCapacity(unitsLen);
        }
        else
        {
            this.units = new SList <UnitData>();
        }

        SList <UnitData> unitsT = this.units;

        for (int unitsI = unitsLen - 1; unitsI >= 0; --unitsI)
        {
            UnitData unitsV;
            BaseData unitsVT = stream.readDataFullNotNull();
            if (unitsVT != null)
            {
                if (unitsVT is UnitData)
                {
                    unitsV = (UnitData)unitsVT;
                }
                else
                {
                    unitsV = new UnitData();
                    if (!(unitsVT.GetType().IsAssignableFrom(typeof(UnitData))))
                    {
                        stream.throwTypeReadError(typeof(UnitData), unitsVT.GetType());
                    }
                    unitsV.shadowCopy(unitsVT);
                }
            }
            else
            {
                unitsV = null;
            }

            unitsT.add(unitsV);
        }

        int rolesLen = stream.readLen();

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

        LongObjectMap <SceneRoleData> rolesT = this.roles;

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

            rolesT.put(rolesV.playerID, rolesV);
        }

        if (stream.readBoolean())
        {
            int selfBindFieldItemBagsLen = stream.readLen();
            if (this.selfBindFieldItemBags != null)
            {
                this.selfBindFieldItemBags.clear();
                this.selfBindFieldItemBags.ensureCapacity(selfBindFieldItemBagsLen);
            }
            else
            {
                this.selfBindFieldItemBags = new IntObjectMap <FieldItemBagBindData>(selfBindFieldItemBagsLen);
            }

            IntObjectMap <FieldItemBagBindData> selfBindFieldItemBagsT = this.selfBindFieldItemBags;
            for (int selfBindFieldItemBagsI = selfBindFieldItemBagsLen - 1; selfBindFieldItemBagsI >= 0; --selfBindFieldItemBagsI)
            {
                FieldItemBagBindData selfBindFieldItemBagsV;
                if (stream.readBoolean())
                {
                    BaseData selfBindFieldItemBagsVT = stream.readDataFullNotNull();
                    if (selfBindFieldItemBagsVT != null)
                    {
                        if (selfBindFieldItemBagsVT is FieldItemBagBindData)
                        {
                            selfBindFieldItemBagsV = (FieldItemBagBindData)selfBindFieldItemBagsVT;
                        }
                        else
                        {
                            selfBindFieldItemBagsV = new FieldItemBagBindData();
                            if (!(selfBindFieldItemBagsVT.GetType().IsAssignableFrom(typeof(FieldItemBagBindData))))
                            {
                                stream.throwTypeReadError(typeof(FieldItemBagBindData), selfBindFieldItemBagsVT.GetType());
                            }
                            selfBindFieldItemBagsV.shadowCopy(selfBindFieldItemBagsVT);
                        }
                    }
                    else
                    {
                        selfBindFieldItemBagsV = null;
                    }
                }
                else
                {
                    selfBindFieldItemBagsV = null;
                }

                selfBindFieldItemBagsT.put(selfBindFieldItemBagsV.instanceID, selfBindFieldItemBagsV);
            }
        }
        else
        {
            this.selfBindFieldItemBags = null;
        }

        if (stream.readBoolean())
        {
            int bindVisionUnitsLen = stream.readLen();
            if (this.bindVisionUnits != null)
            {
                this.bindVisionUnits.clear();
                this.bindVisionUnits.ensureCapacity(bindVisionUnitsLen);
            }
            else
            {
                this.bindVisionUnits = new IntObjectMap <UnitSimpleData>(bindVisionUnitsLen);
            }

            IntObjectMap <UnitSimpleData> bindVisionUnitsT = this.bindVisionUnits;
            for (int bindVisionUnitsI = bindVisionUnitsLen - 1; bindVisionUnitsI >= 0; --bindVisionUnitsI)
            {
                int            bindVisionUnitsK;
                UnitSimpleData bindVisionUnitsV;
                bindVisionUnitsK = stream.readInt();

                if (stream.readBoolean())
                {
                    BaseData bindVisionUnitsVT = stream.readDataFullNotNull();
                    if (bindVisionUnitsVT != null)
                    {
                        if (bindVisionUnitsVT is UnitSimpleData)
                        {
                            bindVisionUnitsV = (UnitSimpleData)bindVisionUnitsVT;
                        }
                        else
                        {
                            bindVisionUnitsV = new UnitSimpleData();
                            if (!(bindVisionUnitsVT.GetType().IsAssignableFrom(typeof(UnitSimpleData))))
                            {
                                stream.throwTypeReadError(typeof(UnitSimpleData), bindVisionUnitsVT.GetType());
                            }
                            bindVisionUnitsV.shadowCopy(bindVisionUnitsVT);
                        }
                    }
                    else
                    {
                        bindVisionUnitsV = null;
                    }
                }
                else
                {
                    bindVisionUnitsV = null;
                }

                bindVisionUnitsT.put(bindVisionUnitsK, bindVisionUnitsV);
            }
        }
        else
        {
            this.bindVisionUnits = null;
        }

        if (stream.readBoolean())
        {
            BaseData battleDataT = stream.readDataFullNotNull();
            if (battleDataT != null)
            {
                if (battleDataT is BattleSceneData)
                {
                    this.battleData = (BattleSceneData)battleDataT;
                }
                else
                {
                    this.battleData = new BattleSceneData();
                    if (!(battleDataT.GetType().IsAssignableFrom(typeof(BattleSceneData))))
                    {
                        stream.throwTypeReadError(typeof(BattleSceneData), battleDataT.GetType());
                    }
                    this.battleData.shadowCopy(battleDataT);
                }
            }
            else
            {
                this.battleData = null;
            }
        }
        else
        {
            this.battleData = null;
        }

        stream.endReadObj();
    }
Exemplo n.º 24
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        if (stream.readBoolean())
        {
            this.hero = (UnitData)stream.readDataSimpleNotNull();
        }
        else
        {
            this.hero = null;
        }

        int unitsLen = stream.readLen();

        if (this.units != null)
        {
            this.units.clear();
            this.units.ensureCapacity(unitsLen);
        }
        else
        {
            this.units = new SList <UnitData>();
        }

        SList <UnitData> unitsT = this.units;

        for (int unitsI = unitsLen - 1; unitsI >= 0; --unitsI)
        {
            UnitData unitsV;
            unitsV = (UnitData)stream.readDataSimpleNotNull();

            unitsT.add(unitsV);
        }

        int rolesLen = stream.readLen();

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

        LongObjectMap <SceneRoleData> rolesT = this.roles;

        for (int rolesI = rolesLen - 1; rolesI >= 0; --rolesI)
        {
            SceneRoleData rolesV;
            rolesV = (SceneRoleData)stream.readDataSimpleNotNull();

            rolesT.put(rolesV.playerID, rolesV);
        }

        if (stream.readBoolean())
        {
            int selfBindFieldItemBagsLen = stream.readLen();
            if (this.selfBindFieldItemBags != null)
            {
                this.selfBindFieldItemBags.clear();
                this.selfBindFieldItemBags.ensureCapacity(selfBindFieldItemBagsLen);
            }
            else
            {
                this.selfBindFieldItemBags = new IntObjectMap <FieldItemBagBindData>(selfBindFieldItemBagsLen);
            }

            IntObjectMap <FieldItemBagBindData> selfBindFieldItemBagsT = this.selfBindFieldItemBags;
            for (int selfBindFieldItemBagsI = selfBindFieldItemBagsLen - 1; selfBindFieldItemBagsI >= 0; --selfBindFieldItemBagsI)
            {
                FieldItemBagBindData selfBindFieldItemBagsV;
                if (stream.readBoolean())
                {
                    selfBindFieldItemBagsV = (FieldItemBagBindData)stream.readDataSimpleNotNull();
                }
                else
                {
                    selfBindFieldItemBagsV = null;
                }

                selfBindFieldItemBagsT.put(selfBindFieldItemBagsV.instanceID, selfBindFieldItemBagsV);
            }
        }
        else
        {
            this.selfBindFieldItemBags = null;
        }

        if (stream.readBoolean())
        {
            int bindVisionUnitsLen = stream.readLen();
            if (this.bindVisionUnits != null)
            {
                this.bindVisionUnits.clear();
                this.bindVisionUnits.ensureCapacity(bindVisionUnitsLen);
            }
            else
            {
                this.bindVisionUnits = new IntObjectMap <UnitSimpleData>(bindVisionUnitsLen);
            }

            IntObjectMap <UnitSimpleData> bindVisionUnitsT = this.bindVisionUnits;
            for (int bindVisionUnitsI = bindVisionUnitsLen - 1; bindVisionUnitsI >= 0; --bindVisionUnitsI)
            {
                int            bindVisionUnitsK;
                UnitSimpleData bindVisionUnitsV;
                bindVisionUnitsK = stream.readInt();

                if (stream.readBoolean())
                {
                    bindVisionUnitsV = (UnitSimpleData)stream.readDataSimpleNotNull();
                }
                else
                {
                    bindVisionUnitsV = null;
                }

                bindVisionUnitsT.put(bindVisionUnitsK, bindVisionUnitsV);
            }
        }
        else
        {
            this.bindVisionUnits = null;
        }

        if (stream.readBoolean())
        {
            this.battleData = (BattleSceneData)stream.readDataSimpleNotNull();
        }
        else
        {
            this.battleData = null;
        }
    }
Exemplo n.º 25
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        base.toCopy(data);

        if (!(data is RoleSocialPoolToolData))
        {
            return;
        }

        RoleSocialPoolToolData mData = (RoleSocialPoolToolData)data;

        if (mData.dic != null)
        {
            if (this.dic != null)
            {
                this.dic.clear();
                this.dic.ensureCapacity(mData.dic.size());
            }
            else
            {
                this.dic = new LongObjectMap <RoleSocialPoolData>(mData.dic.size());
            }

            LongObjectMap <RoleSocialPoolData> dicT = this.dic;
            if (!mData.dic.isEmpty())
            {
                long   dicKFreeValue            = mData.dic.getFreeValue();
                long[] dicKKeys                 = mData.dic.getKeys();
                RoleSocialPoolData[] dicVValues = mData.dic.getValues();
                for (int dicKI = dicKKeys.Length - 1; dicKI >= 0; --dicKI)
                {
                    long dicK = dicKKeys[dicKI];
                    if (dicK != dicKFreeValue)
                    {
                        RoleSocialPoolData dicV = dicVValues[dicKI];
                        long dicW;
                        RoleSocialPoolData dicU;
                        dicW = dicK;

                        if (dicV != null)
                        {
                            dicU = (RoleSocialPoolData)dicV.clone();
                        }
                        else
                        {
                            dicU = null;
                            nullObjError("dicU");
                        }

                        dicT.put(dicW, dicU);
                    }
                }
            }
        }
        else
        {
            this.dic = null;
            nullObjError("dic");
        }

        this.nextCutTime = mData.nextCutTime;
    }
Exemplo n.º 26
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

        int singleChannelsLen = stream.readLen();

        if (this.singleChannels != null)
        {
            this.singleChannels.clear();
            this.singleChannels.ensureCapacity(singleChannelsLen);
        }
        else
        {
            this.singleChannels = new IntObjectMap <ChatChannelData>(singleChannelsLen);
        }

        IntObjectMap <ChatChannelData> singleChannelsT = this.singleChannels;

        for (int singleChannelsI = singleChannelsLen - 1; singleChannelsI >= 0; --singleChannelsI)
        {
            int             singleChannelsK;
            ChatChannelData singleChannelsV;
            singleChannelsK = stream.readInt();

            BaseData singleChannelsVT = stream.readDataFullNotNull();
            if (singleChannelsVT != null)
            {
                if (singleChannelsVT is ChatChannelData)
                {
                    singleChannelsV = (ChatChannelData)singleChannelsVT;
                }
                else
                {
                    singleChannelsV = new ChatChannelData();
                    if (!(singleChannelsVT.GetType().IsAssignableFrom(typeof(ChatChannelData))))
                    {
                        stream.throwTypeReadError(typeof(ChatChannelData), singleChannelsVT.GetType());
                    }
                    singleChannelsV.shadowCopy(singleChannelsVT);
                }
            }
            else
            {
                singleChannelsV = null;
            }

            singleChannelsT.put(singleChannelsK, singleChannelsV);
        }

        int multiChannelsLen = stream.readLen();

        if (this.multiChannels != null)
        {
            this.multiChannels.clear();
            this.multiChannels.ensureCapacity(multiChannelsLen);
        }
        else
        {
            this.multiChannels = new IntObjectMap <LongObjectMap <ChatChannelData> >(multiChannelsLen);
        }

        IntObjectMap <LongObjectMap <ChatChannelData> > multiChannelsT = this.multiChannels;

        for (int multiChannelsI = multiChannelsLen - 1; multiChannelsI >= 0; --multiChannelsI)
        {
            int multiChannelsK;
            LongObjectMap <ChatChannelData> multiChannelsV;
            multiChannelsK = stream.readInt();

            int multiChannelsVLen = stream.readLen();
            multiChannelsV = new LongObjectMap <ChatChannelData>(multiChannelsVLen);
            LongObjectMap <ChatChannelData> multiChannelsVT = multiChannelsV;
            for (int multiChannelsVI = multiChannelsVLen - 1; multiChannelsVI >= 0; --multiChannelsVI)
            {
                long            multiChannelsVK;
                ChatChannelData multiChannelsVV;
                multiChannelsVK = stream.readLong();

                BaseData multiChannelsVVT = stream.readDataFullNotNull();
                if (multiChannelsVVT != null)
                {
                    if (multiChannelsVVT is ChatChannelData)
                    {
                        multiChannelsVV = (ChatChannelData)multiChannelsVVT;
                    }
                    else
                    {
                        multiChannelsVV = new ChatChannelData();
                        if (!(multiChannelsVVT.GetType().IsAssignableFrom(typeof(ChatChannelData))))
                        {
                            stream.throwTypeReadError(typeof(ChatChannelData), multiChannelsVVT.GetType());
                        }
                        multiChannelsVV.shadowCopy(multiChannelsVVT);
                    }
                }
                else
                {
                    multiChannelsVV = null;
                }

                multiChannelsVT.put(multiChannelsVK, multiChannelsVV);
            }

            multiChannelsT.put(multiChannelsK, multiChannelsV);
        }

        this.chatSendIndex = stream.readInt();

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

        stream.startReadObj();

        int groupsLen = stream.readLen();

        if (this.groups != null)
        {
            this.groups.clear();
            this.groups.ensureCapacity(groupsLen);
        }
        else
        {
            this.groups = new LongObjectMap <PlayerRoleGroupData>(groupsLen);
        }

        LongObjectMap <PlayerRoleGroupData> groupsT = this.groups;

        for (int groupsI = groupsLen - 1; groupsI >= 0; --groupsI)
        {
            PlayerRoleGroupData groupsV;
            BaseData            groupsVT = stream.readDataFullNotNull();
            if (groupsVT != null)
            {
                if (groupsVT is PlayerRoleGroupData)
                {
                    groupsV = (PlayerRoleGroupData)groupsVT;
                }
                else
                {
                    groupsV = new PlayerRoleGroupData();
                    if (!(groupsVT.GetType().IsAssignableFrom(typeof(PlayerRoleGroupData))))
                    {
                        stream.throwTypeReadError(typeof(PlayerRoleGroupData), groupsVT.GetType());
                    }
                    groupsV.shadowCopy(groupsVT);
                }
            }
            else
            {
                groupsV = null;
            }

            groupsT.put(groupsV.groupID, groupsV);
        }

        int applyDicLen = stream.readLen();

        if (this.applyDic != null)
        {
            this.applyDic.clear();
            this.applyDic.ensureCapacity(applyDicLen);
        }
        else
        {
            this.applyDic = new LongObjectMap <PlayerApplyRoleGroupSelfData>(applyDicLen);
        }

        LongObjectMap <PlayerApplyRoleGroupSelfData> applyDicT = this.applyDic;

        for (int applyDicI = applyDicLen - 1; applyDicI >= 0; --applyDicI)
        {
            PlayerApplyRoleGroupSelfData applyDicV;
            BaseData applyDicVT = stream.readDataFullNotNull();
            if (applyDicVT != null)
            {
                if (applyDicVT is PlayerApplyRoleGroupSelfData)
                {
                    applyDicV = (PlayerApplyRoleGroupSelfData)applyDicVT;
                }
                else
                {
                    applyDicV = new PlayerApplyRoleGroupSelfData();
                    if (!(applyDicVT.GetType().IsAssignableFrom(typeof(PlayerApplyRoleGroupSelfData))))
                    {
                        stream.throwTypeReadError(typeof(PlayerApplyRoleGroupSelfData), applyDicVT.GetType());
                    }
                    applyDicV.shadowCopy(applyDicVT);
                }
            }
            else
            {
                applyDicV = null;
            }

            applyDicT.put(applyDicV.data.groupID, applyDicV);
        }

        this.canInviteInAbs = stream.readBoolean();

        int inviteListLen = stream.readLen();

        if (this.inviteList != null)
        {
            this.inviteList.clear();
            this.inviteList.ensureCapacity(inviteListLen);
        }
        else
        {
            this.inviteList = new SList <InviteRoleGroupReceiveData>();
        }

        SList <InviteRoleGroupReceiveData> inviteListT = this.inviteList;

        for (int inviteListI = inviteListLen - 1; inviteListI >= 0; --inviteListI)
        {
            InviteRoleGroupReceiveData inviteListV;
            BaseData inviteListVT = stream.readDataFullNotNull();
            if (inviteListVT != null)
            {
                if (inviteListVT is InviteRoleGroupReceiveData)
                {
                    inviteListV = (InviteRoleGroupReceiveData)inviteListVT;
                }
                else
                {
                    inviteListV = new InviteRoleGroupReceiveData();
                    if (!(inviteListVT.GetType().IsAssignableFrom(typeof(InviteRoleGroupReceiveData))))
                    {
                        stream.throwTypeReadError(typeof(InviteRoleGroupReceiveData), inviteListVT.GetType());
                    }
                    inviteListV.shadowCopy(inviteListVT);
                }
            }
            else
            {
                inviteListV = null;
            }

            inviteListT.add(inviteListV);
        }

        stream.endReadObj();
    }
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        base.toCopy(data);

        if (!(data is PlayerRoleGroupClientToolData))
        {
            return;
        }

        PlayerRoleGroupClientToolData mData = (PlayerRoleGroupClientToolData)data;

        if (mData.groups != null)
        {
            if (this.groups != null)
            {
                this.groups.clear();
                this.groups.ensureCapacity(mData.groups.size());
            }
            else
            {
                this.groups = new LongObjectMap <PlayerRoleGroupData>(mData.groups.size());
            }

            LongObjectMap <PlayerRoleGroupData> groupsT = this.groups;
            if (!mData.groups.isEmpty())
            {
                PlayerRoleGroupData[] groupsVValues = mData.groups.getValues();
                for (int groupsVI = groupsVValues.Length - 1; groupsVI >= 0; --groupsVI)
                {
                    PlayerRoleGroupData groupsV = groupsVValues[groupsVI];
                    if (groupsV != null)
                    {
                        PlayerRoleGroupData groupsU;
                        if (groupsV != null)
                        {
                            groupsU = (PlayerRoleGroupData)groupsV.clone();
                        }
                        else
                        {
                            groupsU = null;
                            nullObjError("groupsU");
                        }

                        groupsT.put(groupsU.groupID, groupsU);
                    }
                }
            }
        }
        else
        {
            this.groups = null;
            nullObjError("groups");
        }

        if (mData.applyDic != null)
        {
            if (this.applyDic != null)
            {
                this.applyDic.clear();
                this.applyDic.ensureCapacity(mData.applyDic.size());
            }
            else
            {
                this.applyDic = new LongObjectMap <PlayerApplyRoleGroupSelfData>(mData.applyDic.size());
            }

            LongObjectMap <PlayerApplyRoleGroupSelfData> applyDicT = this.applyDic;
            if (!mData.applyDic.isEmpty())
            {
                PlayerApplyRoleGroupSelfData[] applyDicVValues = mData.applyDic.getValues();
                for (int applyDicVI = applyDicVValues.Length - 1; applyDicVI >= 0; --applyDicVI)
                {
                    PlayerApplyRoleGroupSelfData applyDicV = applyDicVValues[applyDicVI];
                    if (applyDicV != null)
                    {
                        PlayerApplyRoleGroupSelfData applyDicU;
                        if (applyDicV != null)
                        {
                            applyDicU = (PlayerApplyRoleGroupSelfData)applyDicV.clone();
                        }
                        else
                        {
                            applyDicU = null;
                            nullObjError("applyDicU");
                        }

                        applyDicT.put(applyDicU.data.groupID, applyDicU);
                    }
                }
            }
        }
        else
        {
            this.applyDic = null;
            nullObjError("applyDic");
        }

        this.canInviteInAbs = mData.canInviteInAbs;

        if (mData.inviteList != null)
        {
            if (this.inviteList != null)
            {
                this.inviteList.clear();
                this.inviteList.ensureCapacity(mData.inviteList.size());
            }
            else
            {
                this.inviteList = new SList <InviteRoleGroupReceiveData>();
            }

            SList <InviteRoleGroupReceiveData> inviteListT = this.inviteList;
            if (!mData.inviteList.isEmpty())
            {
                InviteRoleGroupReceiveData[] inviteListVValues = mData.inviteList.getValues();
                for (int inviteListVI = 0, inviteListVLen = mData.inviteList.length(); inviteListVI < inviteListVLen; ++inviteListVI)
                {
                    InviteRoleGroupReceiveData inviteListV = inviteListVValues[inviteListVI];
                    InviteRoleGroupReceiveData inviteListU;
                    if (inviteListV != null)
                    {
                        inviteListU = (InviteRoleGroupReceiveData)inviteListV.clone();
                    }
                    else
                    {
                        inviteListU = null;
                        nullObjError("inviteListU");
                    }

                    inviteListT.add(inviteListU);
                }
            }
        }
        else
        {
            this.inviteList = null;
            nullObjError("inviteList");
        }
    }
Exemplo n.º 29
0
    private Unit toAddUnit(UnitData data)
    {
        if (data.instanceID <= 0)
        {
            Ctrl.throwError("单位流水ID未赋值", data.identity.type);
            return(null);
        }

        if (ShineSetting.openCheck)
        {
            if (_units.contains(data.instanceID))
            {
                Ctrl.throwError("单位已存在");
                return(null);
            }
        }

        bool canFight = BaseC.constlist.unit_canFight(data.identity.type) && !isSimple();

        if (canFight)
        {
            //没绑数据逻辑
            if (data.fightDataLogic == null)
            {
                UnitFightDataLogic dataLogic = GameC.pool.createUnitFightDataLogic();
                //主控标记
                dataLogic.isSelfControl = data.getFightIdentity().controlPlayerID == GameC.player.role.playerID;

                dataLogic.setData(data.fight, data.avatar);
                data.fightDataLogic = dataLogic;
            }
        }

        Unit unit = toCreateUnitByData(data);

        //双绑
        unit.setUnitData(data);
        unit.setScene(this);

        if (canFight)
        {
            data.fightDataLogic.setUnit(unit);
        }

        _units.put(data.instanceID, unit);

        //战斗单位
        if (canFight)
        {
            _fightUnits.put(data.instanceID, unit);
        }

        //是角色
        if (unit.isCharacter())
        {
            CharacterIdentityData iData = (CharacterIdentityData)data.identity;

            if (_config.instanceType == SceneInstanceType.FiniteBattleWithFrameSync)
            {
                _charactersByIndex.put(iData.syncIndex, unit);
            }

            _characters.put(iData.playerID, unit);
        }

        return(unit);
    }
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        base.toReadBytesSimple(stream);

        int groupsLen = stream.readLen();

        if (this.groups != null)
        {
            this.groups.clear();
            this.groups.ensureCapacity(groupsLen);
        }
        else
        {
            this.groups = new LongObjectMap <PlayerRoleGroupData>(groupsLen);
        }

        LongObjectMap <PlayerRoleGroupData> groupsT = this.groups;

        for (int groupsI = groupsLen - 1; groupsI >= 0; --groupsI)
        {
            PlayerRoleGroupData groupsV;
            groupsV = (PlayerRoleGroupData)stream.readDataSimpleNotNull();

            groupsT.put(groupsV.groupID, groupsV);
        }

        int applyDicLen = stream.readLen();

        if (this.applyDic != null)
        {
            this.applyDic.clear();
            this.applyDic.ensureCapacity(applyDicLen);
        }
        else
        {
            this.applyDic = new LongObjectMap <PlayerApplyRoleGroupSelfData>(applyDicLen);
        }

        LongObjectMap <PlayerApplyRoleGroupSelfData> applyDicT = this.applyDic;

        for (int applyDicI = applyDicLen - 1; applyDicI >= 0; --applyDicI)
        {
            PlayerApplyRoleGroupSelfData applyDicV;
            applyDicV = (PlayerApplyRoleGroupSelfData)stream.readDataSimpleNotNull();

            applyDicT.put(applyDicV.data.groupID, applyDicV);
        }

        this.canInviteInAbs = stream.readBoolean();

        int inviteListLen = stream.readLen();

        if (this.inviteList != null)
        {
            this.inviteList.clear();
            this.inviteList.ensureCapacity(inviteListLen);
        }
        else
        {
            this.inviteList = new SList <InviteRoleGroupReceiveData>();
        }

        SList <InviteRoleGroupReceiveData> inviteListT = this.inviteList;

        for (int inviteListI = inviteListLen - 1; inviteListI >= 0; --inviteListI)
        {
            InviteRoleGroupReceiveData inviteListV;
            inviteListV = (InviteRoleGroupReceiveData)stream.readDataSimpleNotNull();

            inviteListT.add(inviteListV);
        }
    }