コード例 #1
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is MUnitSaveData))
        {
            return;
        }

        MUnitSaveData mData = (MUnitSaveData)data;

        this.id = mData.id;

        if (mData.cache != null)
        {
            this.cache = (MUnitCacheData)mData.cache.clone();
        }
        else
        {
            this.cache = null;
        }

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

        this.mIndex = mData.mIndex;
    }
コード例 #2
0
ファイル: MUnitUseLogic.cs プロジェクト: shineTeam7/home3
    /** 保存缓存 */
    public void saveCache(MUnitSaveData saveData, int type)
    {
        if (saveData.cache == null)
        {
            (saveData.cache = new MUnitCacheData()).initDefault();
        }

        _fightLogic.saveCache(saveData.cache, type);
    }
コード例 #3
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        MUnitSaveData mData = (MUnitSaveData)data;

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

        if (mData.cache != null)
        {
            if (this.cache == null)
            {
                return(false);
            }
            if (!this.cache.dataEquals(mData.cache))
            {
                return(false);
            }
        }
        else
        {
            if (this.cache != null)
            {
                return(false);
            }
        }

        if (mData.equips != null)
        {
            if (this.equips == null)
            {
                return(false);
            }
            if (!this.equips.dataEquals(mData.equips))
            {
                return(false);
            }
        }
        else
        {
            if (this.equips != null)
            {
                return(false);
            }
        }

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

        return(true);
    }
コード例 #4
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is MUnitSaveData))
        {
            return;
        }

        MUnitSaveData mData = (MUnitSaveData)data;

        this.id     = mData.id;
        this.cache  = mData.cache;
        this.equips = mData.equips;
        this.mIndex = mData.mIndex;
    }
コード例 #5
0
 /** 通过saveData初始化useData */
 private void initMUnitUseBySave(MUnitUseData uData, MUnitSaveData sData)
 {
     uData.mIndex = sData.mIndex;
     uData.id     = sData.id;
     uData.equips = sData.equips;      //引用传递
 }