Пример #1
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is RolePartData))
        {
            return;
        }

        RolePartData mData = (RolePartData)data;

        this.playerID           = mData.playerID;
        this.name               = mData.name;
        this.userID             = mData.userID;
        this.uid                = mData.uid;
        this.createAreaID       = mData.createAreaID;
        this.platform           = mData.platform;
        this.isAdult            = mData.isAdult;
        this.sex                = mData.sex;
        this.vocation           = mData.vocation;
        this.level              = mData.level;
        this.exp                = mData.exp;
        this.currencies         = mData.currencies;
        this.currenciesMax      = mData.currenciesMax;
        this.totalAddCurrencies = mData.totalAddCurrencies;
        this.fightForce         = mData.fightForce;
    }
Пример #2
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is PlayerListData))
        {
            return;
        }

        PlayerListData mData = (PlayerListData)data;

        this.system      = mData.system;
        this.func        = mData.func;
        this.activity    = mData.activity;
        this.role        = mData.role;
        this.scene       = mData.scene;
        this.character   = mData.character;
        this.social      = mData.social;
        this.bag         = mData.bag;
        this.mail        = mData.mail;
        this.quest       = mData.quest;
        this.guide       = mData.guide;
        this.friend      = mData.friend;
        this.equip       = mData.equip;
        this.team        = mData.team;
        this.union       = mData.union;
        this.achievement = mData.achievement;
        this.pet         = mData.pet;
    }
Пример #3
0
 /// <summary>
 /// 回池
 /// </summary>
 protected override void toRelease(DataPool pool)
 {
     this.system      = null;
     this.func        = null;
     this.activity    = null;
     this.role        = null;
     this.scene       = null;
     this.character   = null;
     this.social      = null;
     this.bag         = null;
     this.mail        = null;
     this.quest       = null;
     this.guide       = null;
     this.friend      = null;
     this.equip       = null;
     this.team        = null;
     this.union       = null;
     this.achievement = null;
     this.pet         = null;
 }
Пример #4
0
    /** 创建单人角色 */
    protected virtual PlayerListData createSinglePlayer(CreatePlayerData createData)
    {
        Player player = GameC.player;

        player.newInitData();

        RolePartData rolePartData = player.role.getPartData();

        //设置基础键组
        rolePartData.playerID     = 1;
        rolePartData.name         = createData.name;
        rolePartData.userID       = 1;
        rolePartData.uid          = getVisitorUID();
        rolePartData.createAreaID = 1;
        rolePartData.platform     = PlatformType.Visitor;
        rolePartData.isAdult      = true;

        SystemPartData systemPartData = player.system.getPartData();

        systemPartData.createDate = DateData.getNow();      //记录创建时间

        //逻辑相关
        player.role.doCreatePlayer(createData);

        //创建调用
        player.onNewCreate();

        //创建角色日志
        GameC.log.createPlayer(player);

        PlayerListData listData = player.createListData();

        player.writeListData(listData);

        return(listData);
    }
Пример #5
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        this.system = (SystemPartData)stream.readDataSimpleNotNull();

        this.func = (FuncPartData)stream.readDataSimpleNotNull();

        this.activity = (ActivityPartData)stream.readDataSimpleNotNull();

        this.role = (RolePartData)stream.readDataSimpleNotNull();

        this.scene = (ScenePartData)stream.readDataSimpleNotNull();

        this.character = (CharacterPartData)stream.readDataSimpleNotNull();

        this.social = (SocialPartData)stream.readDataSimpleNotNull();

        this.bag = (BagPartData)stream.readDataSimpleNotNull();

        this.mail = (MailPartData)stream.readDataSimpleNotNull();

        this.quest = (QuestPartData)stream.readDataSimpleNotNull();

        this.guide = (GuidePartData)stream.readDataSimpleNotNull();

        this.friend = (FriendPartData)stream.readDataSimpleNotNull();

        this.equip = (EquipPartData)stream.readDataSimpleNotNull();

        this.team = (TeamPartData)stream.readDataSimpleNotNull();

        this.union = (UnionPartData)stream.readDataSimpleNotNull();

        this.achievement = (AchievementPartData)stream.readDataSimpleNotNull();

        this.pet = (PetPartData)stream.readDataSimpleNotNull();
    }
Пример #6
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        RolePartData mData = (RolePartData)data;

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

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

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

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

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

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

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

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

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

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

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

        if (mData.currencies != null)
        {
            if (this.currencies == null)
            {
                return(false);
            }
            if (this.currencies.Length != mData.currencies.Length)
            {
                return(false);
            }
            long[] currenciesT   = this.currencies;
            long[] currenciesR   = mData.currencies;
            int    currenciesLen = currenciesT.Length;
            for (int currenciesI = 0; currenciesI < currenciesLen; ++currenciesI)
            {
                long currenciesU = currenciesT[currenciesI];
                long currenciesV = currenciesR[currenciesI];
                if (currenciesU != currenciesV)
                {
                    return(false);
                }
            }
        }
        else
        {
            if (this.currencies != null)
            {
                return(false);
            }
        }

        if (mData.currenciesMax != null)
        {
            if (this.currenciesMax == null)
            {
                return(false);
            }
            if (this.currenciesMax.Length != mData.currenciesMax.Length)
            {
                return(false);
            }
            long[] currenciesMaxT   = this.currenciesMax;
            long[] currenciesMaxR   = mData.currenciesMax;
            int    currenciesMaxLen = currenciesMaxT.Length;
            for (int currenciesMaxI = 0; currenciesMaxI < currenciesMaxLen; ++currenciesMaxI)
            {
                long currenciesMaxU = currenciesMaxT[currenciesMaxI];
                long currenciesMaxV = currenciesMaxR[currenciesMaxI];
                if (currenciesMaxU != currenciesMaxV)
                {
                    return(false);
                }
            }
        }
        else
        {
            if (this.currenciesMax != null)
            {
                return(false);
            }
        }

        if (mData.totalAddCurrencies != null)
        {
            if (this.totalAddCurrencies == null)
            {
                return(false);
            }
            if (this.totalAddCurrencies.Length != mData.totalAddCurrencies.Length)
            {
                return(false);
            }
            long[] totalAddCurrenciesT   = this.totalAddCurrencies;
            long[] totalAddCurrenciesR   = mData.totalAddCurrencies;
            int    totalAddCurrenciesLen = totalAddCurrenciesT.Length;
            for (int totalAddCurrenciesI = 0; totalAddCurrenciesI < totalAddCurrenciesLen; ++totalAddCurrenciesI)
            {
                long totalAddCurrenciesU = totalAddCurrenciesT[totalAddCurrenciesI];
                long totalAddCurrenciesV = totalAddCurrenciesR[totalAddCurrenciesI];
                if (totalAddCurrenciesU != totalAddCurrenciesV)
                {
                    return(false);
                }
            }
        }
        else
        {
            if (this.totalAddCurrencies != null)
            {
                return(false);
            }
        }

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

        return(true);
    }
Пример #7
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is RolePartData))
        {
            return;
        }

        RolePartData mData = (RolePartData)data;

        this.playerID = mData.playerID;

        this.name = mData.name;

        this.userID = mData.userID;

        this.uid = mData.uid;

        this.createAreaID = mData.createAreaID;

        this.platform = mData.platform;

        this.isAdult = mData.isAdult;

        this.sex = mData.sex;

        this.vocation = mData.vocation;

        this.level = mData.level;

        this.exp = mData.exp;

        if (mData.currencies != null)
        {
            long[] currenciesR   = mData.currencies;
            int    currenciesLen = currenciesR.Length;
            if (this.currencies == null || this.currencies.Length != currenciesLen)
            {
                this.currencies = new long[currenciesLen];
            }
            BytesControl.arrayCopy(mData.currencies, this.currencies, currenciesLen);
        }
        else
        {
            this.currencies = null;
            nullObjError("currencies");
        }

        if (mData.currenciesMax != null)
        {
            long[] currenciesMaxR   = mData.currenciesMax;
            int    currenciesMaxLen = currenciesMaxR.Length;
            if (this.currenciesMax == null || this.currenciesMax.Length != currenciesMaxLen)
            {
                this.currenciesMax = new long[currenciesMaxLen];
            }
            BytesControl.arrayCopy(mData.currenciesMax, this.currenciesMax, currenciesMaxLen);
        }
        else
        {
            this.currenciesMax = null;
            nullObjError("currenciesMax");
        }

        if (mData.totalAddCurrencies != null)
        {
            long[] totalAddCurrenciesR   = mData.totalAddCurrencies;
            int    totalAddCurrenciesLen = totalAddCurrenciesR.Length;
            if (this.totalAddCurrencies == null || this.totalAddCurrencies.Length != totalAddCurrenciesLen)
            {
                this.totalAddCurrencies = new long[totalAddCurrenciesLen];
            }
            BytesControl.arrayCopy(mData.totalAddCurrencies, this.totalAddCurrencies, totalAddCurrenciesLen);
        }
        else
        {
            this.totalAddCurrencies = null;
            nullObjError("totalAddCurrencies");
        }

        this.fightForce = mData.fightForce;
    }
Пример #8
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is PlayerListData))
        {
            return;
        }

        PlayerListData mData = (PlayerListData)data;

        if (mData.system != null)
        {
            this.system = (SystemPartData)mData.system.clone();
        }
        else
        {
            this.system = null;
            nullObjError("system");
        }

        if (mData.func != null)
        {
            this.func = (FuncPartData)mData.func.clone();
        }
        else
        {
            this.func = null;
            nullObjError("func");
        }

        if (mData.activity != null)
        {
            this.activity = (ActivityPartData)mData.activity.clone();
        }
        else
        {
            this.activity = null;
            nullObjError("activity");
        }

        if (mData.role != null)
        {
            this.role = (RolePartData)mData.role.clone();
        }
        else
        {
            this.role = null;
            nullObjError("role");
        }

        if (mData.scene != null)
        {
            this.scene = (ScenePartData)mData.scene.clone();
        }
        else
        {
            this.scene = null;
            nullObjError("scene");
        }

        if (mData.character != null)
        {
            this.character = (CharacterPartData)mData.character.clone();
        }
        else
        {
            this.character = null;
            nullObjError("character");
        }

        if (mData.social != null)
        {
            this.social = (SocialPartData)mData.social.clone();
        }
        else
        {
            this.social = null;
            nullObjError("social");
        }

        if (mData.bag != null)
        {
            this.bag = (BagPartData)mData.bag.clone();
        }
        else
        {
            this.bag = null;
            nullObjError("bag");
        }

        if (mData.mail != null)
        {
            this.mail = (MailPartData)mData.mail.clone();
        }
        else
        {
            this.mail = null;
            nullObjError("mail");
        }

        if (mData.quest != null)
        {
            this.quest = (QuestPartData)mData.quest.clone();
        }
        else
        {
            this.quest = null;
            nullObjError("quest");
        }

        if (mData.guide != null)
        {
            this.guide = (GuidePartData)mData.guide.clone();
        }
        else
        {
            this.guide = null;
            nullObjError("guide");
        }

        if (mData.friend != null)
        {
            this.friend = (FriendPartData)mData.friend.clone();
        }
        else
        {
            this.friend = null;
            nullObjError("friend");
        }

        if (mData.equip != null)
        {
            this.equip = (EquipPartData)mData.equip.clone();
        }
        else
        {
            this.equip = null;
            nullObjError("equip");
        }

        if (mData.team != null)
        {
            this.team = (TeamPartData)mData.team.clone();
        }
        else
        {
            this.team = null;
            nullObjError("team");
        }

        if (mData.union != null)
        {
            this.union = (UnionPartData)mData.union.clone();
        }
        else
        {
            this.union = null;
            nullObjError("union");
        }

        if (mData.achievement != null)
        {
            this.achievement = (AchievementPartData)mData.achievement.clone();
        }
        else
        {
            this.achievement = null;
            nullObjError("achievement");
        }

        if (mData.pet != null)
        {
            this.pet = (PetPartData)mData.pet.clone();
        }
        else
        {
            this.pet = null;
            nullObjError("pet");
        }
    }
Пример #9
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

        BaseData systemT = stream.readDataFullNotNull();

        if (systemT != null)
        {
            if (systemT is SystemPartData)
            {
                this.system = (SystemPartData)systemT;
            }
            else
            {
                this.system = new SystemPartData();
                if (!(systemT.GetType().IsAssignableFrom(typeof(SystemPartData))))
                {
                    stream.throwTypeReadError(typeof(SystemPartData), systemT.GetType());
                }
                this.system.shadowCopy(systemT);
            }
        }
        else
        {
            this.system = null;
        }

        BaseData funcT = stream.readDataFullNotNull();

        if (funcT != null)
        {
            if (funcT is FuncPartData)
            {
                this.func = (FuncPartData)funcT;
            }
            else
            {
                this.func = new FuncPartData();
                if (!(funcT.GetType().IsAssignableFrom(typeof(FuncPartData))))
                {
                    stream.throwTypeReadError(typeof(FuncPartData), funcT.GetType());
                }
                this.func.shadowCopy(funcT);
            }
        }
        else
        {
            this.func = null;
        }

        BaseData activityT = stream.readDataFullNotNull();

        if (activityT != null)
        {
            if (activityT is ActivityPartData)
            {
                this.activity = (ActivityPartData)activityT;
            }
            else
            {
                this.activity = new ActivityPartData();
                if (!(activityT.GetType().IsAssignableFrom(typeof(ActivityPartData))))
                {
                    stream.throwTypeReadError(typeof(ActivityPartData), activityT.GetType());
                }
                this.activity.shadowCopy(activityT);
            }
        }
        else
        {
            this.activity = null;
        }

        BaseData roleT = stream.readDataFullNotNull();

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

        BaseData sceneT = stream.readDataFullNotNull();

        if (sceneT != null)
        {
            if (sceneT is ScenePartData)
            {
                this.scene = (ScenePartData)sceneT;
            }
            else
            {
                this.scene = new ScenePartData();
                if (!(sceneT.GetType().IsAssignableFrom(typeof(ScenePartData))))
                {
                    stream.throwTypeReadError(typeof(ScenePartData), sceneT.GetType());
                }
                this.scene.shadowCopy(sceneT);
            }
        }
        else
        {
            this.scene = null;
        }

        BaseData characterT = stream.readDataFullNotNull();

        if (characterT != null)
        {
            if (characterT is CharacterPartData)
            {
                this.character = (CharacterPartData)characterT;
            }
            else
            {
                this.character = new CharacterPartData();
                if (!(characterT.GetType().IsAssignableFrom(typeof(CharacterPartData))))
                {
                    stream.throwTypeReadError(typeof(CharacterPartData), characterT.GetType());
                }
                this.character.shadowCopy(characterT);
            }
        }
        else
        {
            this.character = null;
        }

        BaseData socialT = stream.readDataFullNotNull();

        if (socialT != null)
        {
            if (socialT is SocialPartData)
            {
                this.social = (SocialPartData)socialT;
            }
            else
            {
                this.social = new SocialPartData();
                if (!(socialT.GetType().IsAssignableFrom(typeof(SocialPartData))))
                {
                    stream.throwTypeReadError(typeof(SocialPartData), socialT.GetType());
                }
                this.social.shadowCopy(socialT);
            }
        }
        else
        {
            this.social = null;
        }

        BaseData bagT = stream.readDataFullNotNull();

        if (bagT != null)
        {
            if (bagT is BagPartData)
            {
                this.bag = (BagPartData)bagT;
            }
            else
            {
                this.bag = new BagPartData();
                if (!(bagT.GetType().IsAssignableFrom(typeof(BagPartData))))
                {
                    stream.throwTypeReadError(typeof(BagPartData), bagT.GetType());
                }
                this.bag.shadowCopy(bagT);
            }
        }
        else
        {
            this.bag = null;
        }

        BaseData mailT = stream.readDataFullNotNull();

        if (mailT != null)
        {
            if (mailT is MailPartData)
            {
                this.mail = (MailPartData)mailT;
            }
            else
            {
                this.mail = new MailPartData();
                if (!(mailT.GetType().IsAssignableFrom(typeof(MailPartData))))
                {
                    stream.throwTypeReadError(typeof(MailPartData), mailT.GetType());
                }
                this.mail.shadowCopy(mailT);
            }
        }
        else
        {
            this.mail = null;
        }

        BaseData questT = stream.readDataFullNotNull();

        if (questT != null)
        {
            if (questT is QuestPartData)
            {
                this.quest = (QuestPartData)questT;
            }
            else
            {
                this.quest = new QuestPartData();
                if (!(questT.GetType().IsAssignableFrom(typeof(QuestPartData))))
                {
                    stream.throwTypeReadError(typeof(QuestPartData), questT.GetType());
                }
                this.quest.shadowCopy(questT);
            }
        }
        else
        {
            this.quest = null;
        }

        BaseData guideT = stream.readDataFullNotNull();

        if (guideT != null)
        {
            if (guideT is GuidePartData)
            {
                this.guide = (GuidePartData)guideT;
            }
            else
            {
                this.guide = new GuidePartData();
                if (!(guideT.GetType().IsAssignableFrom(typeof(GuidePartData))))
                {
                    stream.throwTypeReadError(typeof(GuidePartData), guideT.GetType());
                }
                this.guide.shadowCopy(guideT);
            }
        }
        else
        {
            this.guide = null;
        }

        BaseData friendT = stream.readDataFullNotNull();

        if (friendT != null)
        {
            if (friendT is FriendPartData)
            {
                this.friend = (FriendPartData)friendT;
            }
            else
            {
                this.friend = new FriendPartData();
                if (!(friendT.GetType().IsAssignableFrom(typeof(FriendPartData))))
                {
                    stream.throwTypeReadError(typeof(FriendPartData), friendT.GetType());
                }
                this.friend.shadowCopy(friendT);
            }
        }
        else
        {
            this.friend = null;
        }

        BaseData equipT = stream.readDataFullNotNull();

        if (equipT != null)
        {
            if (equipT is EquipPartData)
            {
                this.equip = (EquipPartData)equipT;
            }
            else
            {
                this.equip = new EquipPartData();
                if (!(equipT.GetType().IsAssignableFrom(typeof(EquipPartData))))
                {
                    stream.throwTypeReadError(typeof(EquipPartData), equipT.GetType());
                }
                this.equip.shadowCopy(equipT);
            }
        }
        else
        {
            this.equip = null;
        }

        BaseData teamT = stream.readDataFullNotNull();

        if (teamT != null)
        {
            if (teamT is TeamPartData)
            {
                this.team = (TeamPartData)teamT;
            }
            else
            {
                this.team = new TeamPartData();
                if (!(teamT.GetType().IsAssignableFrom(typeof(TeamPartData))))
                {
                    stream.throwTypeReadError(typeof(TeamPartData), teamT.GetType());
                }
                this.team.shadowCopy(teamT);
            }
        }
        else
        {
            this.team = null;
        }

        BaseData unionT = stream.readDataFullNotNull();

        if (unionT != null)
        {
            if (unionT is UnionPartData)
            {
                this.union = (UnionPartData)unionT;
            }
            else
            {
                this.union = new UnionPartData();
                if (!(unionT.GetType().IsAssignableFrom(typeof(UnionPartData))))
                {
                    stream.throwTypeReadError(typeof(UnionPartData), unionT.GetType());
                }
                this.union.shadowCopy(unionT);
            }
        }
        else
        {
            this.union = null;
        }

        BaseData achievementT = stream.readDataFullNotNull();

        if (achievementT != null)
        {
            if (achievementT is AchievementPartData)
            {
                this.achievement = (AchievementPartData)achievementT;
            }
            else
            {
                this.achievement = new AchievementPartData();
                if (!(achievementT.GetType().IsAssignableFrom(typeof(AchievementPartData))))
                {
                    stream.throwTypeReadError(typeof(AchievementPartData), achievementT.GetType());
                }
                this.achievement.shadowCopy(achievementT);
            }
        }
        else
        {
            this.achievement = null;
        }

        BaseData petT = stream.readDataFullNotNull();

        if (petT != null)
        {
            if (petT is PetPartData)
            {
                this.pet = (PetPartData)petT;
            }
            else
            {
                this.pet = new PetPartData();
                if (!(petT.GetType().IsAssignableFrom(typeof(PetPartData))))
                {
                    stream.throwTypeReadError(typeof(PetPartData), petT.GetType());
                }
                this.pet.shadowCopy(petT);
            }
        }
        else
        {
            this.pet = null;
        }

        stream.endReadObj();
    }
Пример #10
0
    public override void setData(BaseData data)
    {
        base.setData(data);

        _d = (RolePartData)data;
    }