Ejemplo n.º 1
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is SystemPartData))
        {
            return;
        }

        SystemPartData mData = (SystemPartData)data;

        this.version                       = mData.version;
        this.serverTime                    = mData.serverTime;
        this.isBlock                       = mData.isBlock;
        this.flowStep                      = mData.flowStep;
        this.keepSave                      = mData.keepSave;
        this.clientRandomSeeds             = mData.clientRandomSeeds;
        this.clientRandomSeedIndex         = mData.clientRandomSeedIndex;
        this.clientOfflineWorkReceiveIndex = mData.clientOfflineWorkReceiveIndex;
        this.gmCommandSet                  = mData.gmCommandSet;
        this.gmType              = mData.gmType;
        this.serverBornCode      = mData.serverBornCode;
        this.serverStartTime     = mData.serverStartTime;
        this.logQueue            = mData.logQueue;
        this.nextDailyTime       = mData.nextDailyTime;
        this.createDate          = mData.createDate;
        this.clientRandomSeedKey = mData.clientRandomSeedKey;
    }
Ejemplo n.º 2
0
 /// <summary>
 /// 回池
 /// </summary>
 protected override void toRelease(DataPool pool)
 {
     this.version                       = null;
     this.serverTime                    = 0L;
     this.isBlock                       = false;
     this.flowStep                      = 0;
     this.keepSave                      = null;
     this.clientRandomSeeds             = null;
     this.clientRandomSeedIndex         = 0;
     this.clientOfflineWorkReceiveIndex = 0;
     this.gmCommandSet                  = null;
     this.gmType              = 0;
     this.serverBornCode      = 0;
     this.serverStartTime     = 0L;
     this.logQueue            = null;
     this.nextDailyTime       = 0L;
     this.createDate          = null;
     this.clientRandomSeedKey = 0;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns true if the given parameter name appears more than one on the list of arguments.
        /// </summary>
        public static bool IsArgumentDuplicated(SimpleList <Pair <string, string> > arguments, string parameterName)
        {
            var set = SSet.Create <string>(10, true);

            SSet.Clear(set);
            for (int i = 0; i < arguments.Count; i++)
            {
                var key = arguments[i].Key;
                if (string.Equals(key, parameterName, StringComparison.InvariantCultureIgnoreCase))
                {
                    if (SSet.Contains(set, key))
                    {
                        return(true);
                    }
                    else
                    {
                        SSet.Add(set, key);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 4
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        SystemPartData mData = (SystemPartData)data;

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

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

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

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

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

        if (mData.clientRandomSeeds != null)
        {
            if (this.clientRandomSeeds == null)
            {
                return(false);
            }
            if (this.clientRandomSeeds.Length != mData.clientRandomSeeds.Length)
            {
                return(false);
            }
            int[] clientRandomSeedsT   = this.clientRandomSeeds;
            int[] clientRandomSeedsR   = mData.clientRandomSeeds;
            int   clientRandomSeedsLen = clientRandomSeedsT.Length;
            for (int clientRandomSeedsI = 0; clientRandomSeedsI < clientRandomSeedsLen; ++clientRandomSeedsI)
            {
                int clientRandomSeedsU = clientRandomSeedsT[clientRandomSeedsI];
                int clientRandomSeedsV = clientRandomSeedsR[clientRandomSeedsI];
                if (clientRandomSeedsU != clientRandomSeedsV)
                {
                    return(false);
                }
            }
        }
        else
        {
            if (this.clientRandomSeeds != null)
            {
                return(false);
            }
        }

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

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

        if (mData.gmCommandSet != null)
        {
            if (this.gmCommandSet == null)
            {
                return(false);
            }
            if (this.gmCommandSet.size() != mData.gmCommandSet.size())
            {
                return(false);
            }
            SSet <string> gmCommandSetR = mData.gmCommandSet;
            if (!this.gmCommandSet.isEmpty())
            {
                string[] gmCommandSetVKeys = this.gmCommandSet.getKeys();
                for (int gmCommandSetVI = gmCommandSetVKeys.Length - 1; gmCommandSetVI >= 0; --gmCommandSetVI)
                {
                    if (gmCommandSetVKeys[gmCommandSetVI] != null)
                    {
                        string gmCommandSetV = gmCommandSetVKeys[gmCommandSetVI];
                        if (!gmCommandSetR.contains(gmCommandSetV))
                        {
                            return(false);
                        }
                    }
                }
            }
        }
        else
        {
            if (this.gmCommandSet != null)
            {
                return(false);
            }
        }

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

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

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

        if (mData.logQueue != null)
        {
            if (this.logQueue == null)
            {
                return(false);
            }
            if (this.logQueue.size() != mData.logQueue.size())
            {
                return(false);
            }
            SQueue <InfoLogData> logQueueT = this.logQueue;
            SQueue <InfoLogData> logQueueR = mData.logQueue;
            int logQueueLen = logQueueT.size();
            for (int logQueueI = 0; logQueueI < logQueueLen; ++logQueueI)
            {
                InfoLogData logQueueU = logQueueT.get(logQueueI);
                InfoLogData logQueueV = logQueueR.get(logQueueI);
                if (logQueueV != null)
                {
                    if (logQueueU == null)
                    {
                        return(false);
                    }
                    if (!logQueueU.dataEquals(logQueueV))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (logQueueU != null)
                    {
                        return(false);
                    }
                }
            }
        }
        else
        {
            if (this.logQueue != null)
            {
                return(false);
            }
        }

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

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

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

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

        BaseData versionT = stream.readDataFullNotNull();

        if (versionT != null)
        {
            if (versionT is SaveVersionData)
            {
                this.version = (SaveVersionData)versionT;
            }
            else
            {
                this.version = new SaveVersionData();
                if (!(versionT.GetType().IsAssignableFrom(typeof(SaveVersionData))))
                {
                    stream.throwTypeReadError(typeof(SaveVersionData), versionT.GetType());
                }
                this.version.shadowCopy(versionT);
            }
        }
        else
        {
            this.version = null;
        }

        this.serverTime = stream.readLong();

        this.isBlock = stream.readBoolean();

        this.flowStep = stream.readInt();

        this.keepSave = (KeepSaveData)stream.createData(KeepSaveData.dataID);
        this.keepSave.readBytesFull(stream);

        if (stream.readBoolean())
        {
            int clientRandomSeedsLen = stream.readLen();
            if (this.clientRandomSeeds == null || this.clientRandomSeeds.Length != clientRandomSeedsLen)
            {
                this.clientRandomSeeds = new int[clientRandomSeedsLen];
            }
            int[] clientRandomSeedsT = this.clientRandomSeeds;
            for (int clientRandomSeedsI = 0; clientRandomSeedsI < clientRandomSeedsLen; ++clientRandomSeedsI)
            {
                int clientRandomSeedsV;
                clientRandomSeedsV = stream.readInt();

                clientRandomSeedsT[clientRandomSeedsI] = clientRandomSeedsV;
            }
        }
        else
        {
            this.clientRandomSeeds = null;
        }

        this.clientRandomSeedIndex = stream.readInt();

        this.clientOfflineWorkReceiveIndex = stream.readInt();

        if (stream.readBoolean())
        {
            int gmCommandSetLen = stream.readLen();
            if (this.gmCommandSet != null)
            {
                this.gmCommandSet.clear();
                this.gmCommandSet.ensureCapacity(gmCommandSetLen);
            }
            else
            {
                this.gmCommandSet = new SSet <string>();
            }

            SSet <string> gmCommandSetT = this.gmCommandSet;
            for (int gmCommandSetI = gmCommandSetLen - 1; gmCommandSetI >= 0; --gmCommandSetI)
            {
                string gmCommandSetV;
                gmCommandSetV = stream.readUTF();

                gmCommandSetT.add(gmCommandSetV);
            }
        }
        else
        {
            this.gmCommandSet = null;
        }

        this.gmType = stream.readInt();

        this.serverBornCode = stream.readInt();

        this.serverStartTime = stream.readLong();

        int logQueueLen = stream.readLen();

        if (this.logQueue != null)
        {
            this.logQueue.clear();
            this.logQueue.ensureCapacity(logQueueLen);
        }
        else
        {
            this.logQueue = new SQueue <InfoLogData>();
        }

        SQueue <InfoLogData> logQueueT = this.logQueue;

        for (int logQueueI = logQueueLen - 1; logQueueI >= 0; --logQueueI)
        {
            InfoLogData logQueueV;
            BaseData    logQueueVT = stream.readDataFullNotNull();
            if (logQueueVT != null)
            {
                if (logQueueVT is InfoLogData)
                {
                    logQueueV = (InfoLogData)logQueueVT;
                }
                else
                {
                    logQueueV = new InfoLogData();
                    if (!(logQueueVT.GetType().IsAssignableFrom(typeof(InfoLogData))))
                    {
                        stream.throwTypeReadError(typeof(InfoLogData), logQueueVT.GetType());
                    }
                    logQueueV.shadowCopy(logQueueVT);
                }
            }
            else
            {
                logQueueV = null;
            }

            logQueueT.offer(logQueueV);
        }

        this.nextDailyTime = stream.readLong();

        this.createDate = (DateData)stream.createData(DateData.dataID);
        this.createDate.readBytesFull(stream);

        this.clientRandomSeedKey = stream.readInt();

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

        SystemPartData mData = (SystemPartData)data;

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

        this.serverTime = mData.serverTime;

        this.isBlock = mData.isBlock;

        this.flowStep = mData.flowStep;

        if (mData.keepSave != null)
        {
            this.keepSave = (KeepSaveData)BytesControl.createData(KeepSaveData.dataID);
            this.keepSave.copy(mData.keepSave);
        }
        else
        {
            this.keepSave = null;
            nullObjError("keepSave");
        }

        if (mData.clientRandomSeeds != null)
        {
            int[] clientRandomSeedsR   = mData.clientRandomSeeds;
            int   clientRandomSeedsLen = clientRandomSeedsR.Length;
            if (this.clientRandomSeeds == null || this.clientRandomSeeds.Length != clientRandomSeedsLen)
            {
                this.clientRandomSeeds = new int[clientRandomSeedsLen];
            }
            BytesControl.arrayCopy(mData.clientRandomSeeds, this.clientRandomSeeds, clientRandomSeedsLen);
        }
        else
        {
            this.clientRandomSeeds = null;
        }

        this.clientRandomSeedIndex = mData.clientRandomSeedIndex;

        this.clientOfflineWorkReceiveIndex = mData.clientOfflineWorkReceiveIndex;

        if (mData.gmCommandSet != null)
        {
            if (this.gmCommandSet != null)
            {
                this.gmCommandSet.clear();
                this.gmCommandSet.ensureCapacity(mData.gmCommandSet.size());
            }
            else
            {
                this.gmCommandSet = new SSet <string>();
            }

            SSet <string> gmCommandSetT = this.gmCommandSet;
            if (!mData.gmCommandSet.isEmpty())
            {
                string[] gmCommandSetVKeys = mData.gmCommandSet.getKeys();
                for (int gmCommandSetVI = gmCommandSetVKeys.Length - 1; gmCommandSetVI >= 0; --gmCommandSetVI)
                {
                    if (gmCommandSetVKeys[gmCommandSetVI] != null)
                    {
                        string gmCommandSetV = gmCommandSetVKeys[gmCommandSetVI];
                        string gmCommandSetU;
                        gmCommandSetU = gmCommandSetV;

                        gmCommandSetT.add(gmCommandSetU);
                    }
                }
            }
        }
        else
        {
            this.gmCommandSet = null;
        }

        this.gmType = mData.gmType;

        this.serverBornCode = mData.serverBornCode;

        this.serverStartTime = mData.serverStartTime;

        if (mData.logQueue != null)
        {
            if (this.logQueue != null)
            {
                this.logQueue.clear();
                this.logQueue.ensureCapacity(mData.logQueue.size());
            }
            else
            {
                this.logQueue = new SQueue <InfoLogData>();
            }

            SQueue <InfoLogData> logQueueT = this.logQueue;
            if (!mData.logQueue.isEmpty())
            {
                InfoLogData[] logQueueVValues = mData.logQueue.getValues();
                int           logQueueVMark   = mData.logQueue.getMark();
                int           logQueueVStart  = mData.logQueue.getStart();
                for (int logQueueVI = 0, logQueueVLen = mData.logQueue.length(); logQueueVI < logQueueVLen; ++logQueueVI)
                {
                    InfoLogData logQueueV = logQueueVValues[(logQueueVI + logQueueVStart) & logQueueVMark];
                    InfoLogData logQueueU;
                    if (logQueueV != null)
                    {
                        logQueueU = (InfoLogData)logQueueV.clone();
                    }
                    else
                    {
                        logQueueU = null;
                        nullObjError("logQueueU");
                    }

                    logQueueT.offer(logQueueU);
                }
            }
        }
        else
        {
            this.logQueue = null;
            nullObjError("logQueue");
        }

        this.nextDailyTime = mData.nextDailyTime;

        if (mData.createDate != null)
        {
            this.createDate = (DateData)BytesControl.createData(DateData.dataID);
            this.createDate.copy(mData.createDate);
        }
        else
        {
            this.createDate = null;
            nullObjError("createDate");
        }

        this.clientRandomSeedKey = mData.clientRandomSeedKey;
    }
Ejemplo n.º 7
0
 /// <summary>
 /// Set是否为空
 /// </summary>
 public bool func_SetIsEmpty(TriggerExecutor e, TriggerArg a, SSet <object> map)
 {
     return(map.isEmpty());
 }
Ejemplo n.º 8
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        this.version = (SaveVersionData)stream.readDataSimpleNotNull();

        this.serverTime = stream.readLong();

        this.isBlock = stream.readBoolean();

        this.flowStep = stream.readInt();

        this.keepSave = (KeepSaveData)stream.createData(KeepSaveData.dataID);
        this.keepSave.readBytesSimple(stream);

        if (stream.readBoolean())
        {
            int clientRandomSeedsLen = stream.readLen();
            if (this.clientRandomSeeds == null || this.clientRandomSeeds.Length != clientRandomSeedsLen)
            {
                this.clientRandomSeeds = new int[clientRandomSeedsLen];
            }
            int[] clientRandomSeedsT = this.clientRandomSeeds;
            for (int clientRandomSeedsI = 0; clientRandomSeedsI < clientRandomSeedsLen; ++clientRandomSeedsI)
            {
                int clientRandomSeedsV;
                clientRandomSeedsV = stream.readInt();

                clientRandomSeedsT[clientRandomSeedsI] = clientRandomSeedsV;
            }
        }
        else
        {
            this.clientRandomSeeds = null;
        }

        this.clientRandomSeedIndex = stream.readInt();

        this.clientOfflineWorkReceiveIndex = stream.readInt();

        if (stream.readBoolean())
        {
            int gmCommandSetLen = stream.readLen();
            if (this.gmCommandSet != null)
            {
                this.gmCommandSet.clear();
                this.gmCommandSet.ensureCapacity(gmCommandSetLen);
            }
            else
            {
                this.gmCommandSet = new SSet <string>();
            }

            SSet <string> gmCommandSetT = this.gmCommandSet;
            for (int gmCommandSetI = gmCommandSetLen - 1; gmCommandSetI >= 0; --gmCommandSetI)
            {
                string gmCommandSetV;
                gmCommandSetV = stream.readUTF();

                gmCommandSetT.add(gmCommandSetV);
            }
        }
        else
        {
            this.gmCommandSet = null;
        }

        this.gmType = stream.readInt();

        this.serverBornCode = stream.readInt();

        this.serverStartTime = stream.readLong();

        int logQueueLen = stream.readLen();

        if (this.logQueue != null)
        {
            this.logQueue.clear();
            this.logQueue.ensureCapacity(logQueueLen);
        }
        else
        {
            this.logQueue = new SQueue <InfoLogData>();
        }

        SQueue <InfoLogData> logQueueT = this.logQueue;

        for (int logQueueI = logQueueLen - 1; logQueueI >= 0; --logQueueI)
        {
            InfoLogData logQueueV;
            logQueueV = (InfoLogData)stream.readDataSimpleNotNull();

            logQueueT.offer(logQueueV);
        }

        this.nextDailyTime = stream.readLong();

        this.createDate = (DateData)stream.createData(DateData.dataID);
        this.createDate.readBytesSimple(stream);

        this.clientRandomSeedKey = stream.readInt();
    }
Ejemplo n.º 9
0
 /// <summary>
 /// Set包含
 /// </summary>
 public bool func_SetContains(TriggerExecutor e, TriggerArg a, SSet <object> map, object key)
 {
     return(map.contains(key));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Set清空
 /// </summary>
 public void func_SetClear(TriggerExecutor e, TriggerArg a, SSet <object> map)
 {
     map.clear();
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Set删除
 /// </summary>
 public bool func_SetRemove(TriggerExecutor e, TriggerArg a, SSet <object> map, object key)
 {
     return(map.remove(key));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Set添加
 /// </summary>
 public void func_SetAdd(TriggerExecutor e, TriggerArg a, SSet <object> map, object key)
 {
     map.add(key);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 获取Set长度
 /// </summary>
 public int func_GetSetSize(TriggerExecutor e, TriggerArg a, SSet <object> value)
 {
     return(value.size());
 }