Ejemplo n.º 1
0
    /// <summary>
    /// 写入字节流(完整版)
    /// </summary>
    protected override void toWriteBytesFull(BytesWriteStream stream)
    {
        base.toWriteBytesFull(stream);

        stream.startWriteObj();

        if (this.value != null)
        {
            stream.writeLen(this.value.size());
            if (!this.value.isEmpty())
            {
                TriggerObjData[] valueVValues = this.value.getValues();
                for (int valueVI = 0, valueVLen = this.value.length(); valueVI < valueVLen; ++valueVI)
                {
                    TriggerObjData valueV = valueVValues[valueVI];
                    if (valueV != null)
                    {
                        stream.writeDataFullNotNull(valueV);
                    }
                    else
                    {
                        nullObjError("valueV");
                    }
                }
            }
        }
        else
        {
            nullObjError("value");
        }

        stream.endWriteObj();
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 写入字节流(完整版)
    /// </summary>
    protected override void toWriteBytesFull(BytesWriteStream stream)
    {
        base.toWriteBytesFull(stream);

        stream.startWriteObj();

        stream.writeInt(this.id);

        if (this.args != null)
        {
            TriggerObjData[] argsT = this.args;
            stream.writeLen(argsT.Length);
            for (int argsVI = 0, argsVLen = argsT.Length; argsVI < argsVLen; ++argsVI)
            {
                TriggerObjData argsV = argsT[argsVI];
                if (argsV != null)
                {
                    stream.writeDataFullNotNull(argsV);
                }
                else
                {
                    nullObjError("argsV");
                }
            }
        }
        else
        {
            nullObjError("args");
        }

        stream.endWriteObj();
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        if (!base.toDataEquals(data))
        {
            return(false);
        }

        TriggerListData mData = (TriggerListData)data;

        if (mData.value != null)
        {
            if (this.value == null)
            {
                return(false);
            }
            if (this.value.size() != mData.value.size())
            {
                return(false);
            }
            SList <TriggerObjData> valueT = this.value;
            SList <TriggerObjData> valueR = mData.value;
            int valueLen = valueT.size();
            for (int valueI = 0; valueI < valueLen; ++valueI)
            {
                TriggerObjData valueU = valueT.get(valueI);
                TriggerObjData valueV = valueR.get(valueI);
                if (valueV != null)
                {
                    if (valueU == null)
                    {
                        return(false);
                    }
                    if (!valueU.dataEquals(valueV))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (valueU != null)
                    {
                        return(false);
                    }
                }
            }
        }
        else
        {
            if (this.value != null)
            {
                return(false);
            }
        }

        return(true);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        base.toCopy(data);

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

        TriggerListData mData = (TriggerListData)data;

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

            SList <TriggerObjData> valueT = this.value;
            if (!mData.value.isEmpty())
            {
                TriggerObjData[] valueVValues = mData.value.getValues();
                for (int valueVI = 0, valueVLen = mData.value.length(); valueVI < valueVLen; ++valueVI)
                {
                    TriggerObjData valueV = valueVValues[valueVI];
                    TriggerObjData valueU;
                    if (valueV != null)
                    {
                        valueU = (TriggerObjData)valueV.clone();
                    }
                    else
                    {
                        valueU = null;
                        nullObjError("valueU");
                    }

                    valueT.add(valueU);
                }
            }
        }
        else
        {
            this.value = null;
            nullObjError("value");
        }
    }
Ejemplo n.º 5
0
    /** 获取boolean值 */
    public bool getBoolean(TriggerObjData obj, TriggerArg arg)
    {
        if (obj.getDataID() == TriggerBooleanData.dataID)
        {
            return(((TriggerBooleanData)obj).value);
        }
        else if (obj.getDataID() == TriggerFuncData.dataID)
        {
            return(getBooleanFuncValue((TriggerFuncData)obj, arg));
        }

        throwError("不支持的数据类型,boolean", obj.getDataClassName());
        return(false);
    }
Ejemplo n.º 6
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        base.toReadBytesFull(stream);

        stream.startReadObj();

        int valueLen = stream.readLen();

        if (this.value != null)
        {
            this.value.clear();
            this.value.ensureCapacity(valueLen);
        }
        else
        {
            this.value = new SList <TriggerObjData>();
        }

        SList <TriggerObjData> valueT = this.value;

        for (int valueI = valueLen - 1; valueI >= 0; --valueI)
        {
            TriggerObjData valueV;
            BaseData       valueVT = stream.readDataFullNotNull();
            if (valueVT != null)
            {
                if (valueVT is TriggerObjData)
                {
                    valueV = (TriggerObjData)valueVT;
                }
                else
                {
                    valueV = new TriggerObjData();
                    if (!(valueVT.GetType().IsAssignableFrom(typeof(TriggerObjData))))
                    {
                        stream.throwTypeReadError(typeof(TriggerObjData), valueVT.GetType());
                    }
                    valueV.shadowCopy(valueVT);
                }
            }
            else
            {
                valueV = null;
            }

            valueT.add(valueV);
        }

        stream.endReadObj();
    }
Ejemplo n.º 7
0
    /** 获取String值 */
    public String getString(TriggerObjData obj, TriggerArg arg)
    {
        if (obj.getDataID() == TriggerStringData.dataID)
        {
            return(((TriggerStringData)obj).value);
        }
        else if (obj.getDataID() == TriggerFuncData.dataID)
        {
            return(getStringFuncValue((TriggerFuncData)obj, arg));
        }

        throwError("不支持的数据类型,String", obj.getDataClassName());
        return("");
    }
Ejemplo n.º 8
0
    /** 获取float值 */
    public float getFloat(TriggerObjData obj, TriggerArg arg)
    {
        if (obj.getDataID() == TriggerFloatData.dataID)
        {
            return(((TriggerFloatData)obj).value);
        }
        else if (obj.getDataID() == TriggerFuncData.dataID)
        {
            return(getFloatFuncValue((TriggerFuncData)obj, arg));
        }

        throwError("不支持的数据类型,float", obj.getDataClassName());
        return(0f);
    }
Ejemplo n.º 9
0
    /// <summary>
    /// 转文本输出
    /// </summary>
    protected override void toWriteDataString(DataWriter writer)
    {
        base.toWriteDataString(writer);

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

        writer.writeEnter();
        writer.writeTabs();
        writer.sb.Append("args");
        writer.sb.Append(':');
        writer.sb.Append("Array<TriggerObjData>");
        if (this.args != null)
        {
            TriggerObjData[] argsT = this.args;
            int argsLen            = argsT.Length;
            writer.sb.Append('(');
            writer.sb.Append(argsLen);
            writer.sb.Append(')');
            writer.writeEnter();
            writer.writeLeftBrace();
            for (int argsI = 0; argsI < argsLen; ++argsI)
            {
                TriggerObjData argsV = argsT[argsI];
                writer.writeTabs();
                writer.sb.Append(argsI);
                writer.sb.Append(':');
                if (argsV != null)
                {
                    argsV.writeDataString(writer);
                }
                else
                {
                    writer.sb.Append("TriggerObjData=null");
                }

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

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

        stream.startReadObj();

        this.id = stream.readInt();

        int argsLen = stream.readLen();

        if (this.args == null || this.args.Length != argsLen)
        {
            this.args = new TriggerObjData[argsLen];
        }
        TriggerObjData[] argsT = this.args;
        for (int argsI = 0; argsI < argsLen; ++argsI)
        {
            TriggerObjData argsV;
            BaseData       argsVT = stream.readDataFullNotNull();
            if (argsVT != null)
            {
                if (argsVT is TriggerObjData)
                {
                    argsV = (TriggerObjData)argsVT;
                }
                else
                {
                    argsV = new TriggerObjData();
                    if (!(argsVT.GetType().IsAssignableFrom(typeof(TriggerObjData))))
                    {
                        stream.throwTypeReadError(typeof(TriggerObjData), argsVT.GetType());
                    }
                    argsV.shadowCopy(argsVT);
                }
            }
            else
            {
                argsV = null;
            }

            argsT[argsI] = argsV;
        }

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

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

        TriggerFuncData mData = (TriggerFuncData)data;

        this.id = mData.id;

        if (mData.args != null)
        {
            TriggerObjData[] argsR = mData.args;
            int argsLen            = argsR.Length;
            if (this.args == null || this.args.Length != argsLen)
            {
                this.args = new TriggerObjData[argsLen];
            }
            TriggerObjData[] argsT = this.args;
            for (int argsI = 0; argsI < argsLen; ++argsI)
            {
                TriggerObjData argsV = argsR[argsI];
                TriggerObjData argsU;
                if (argsV != null)
                {
                    argsU = (TriggerObjData)argsV.clone();
                }
                else
                {
                    argsU = null;
                    nullObjError("argsU");
                }

                argsT[argsI] = argsU;
            }
        }
        else
        {
            this.args = null;
            nullObjError("args");
        }
    }
Ejemplo n.º 12
0
    /** 获取对象值 */
    public object getObj(TriggerObjData obj, TriggerArg arg)
    {
        try
        {
            switch (obj.getDataID())
            {
            case TriggerBooleanData.dataID:
            {
                return(((TriggerBooleanData)obj).value);
            }

            case TriggerIntData.dataID:
            {
                return(((TriggerIntData)obj).value);
            }

            case TriggerFloatData.dataID:
            {
                return(((TriggerFloatData)obj).value);
            }

            case TriggerLongData.dataID:
            {
                return(((TriggerLongData)obj).value);
            }

            case TriggerStringData.dataID:
            {
                return(((TriggerStringData)obj).value);
            }

            case TriggerFuncData.dataID:
            {
                return(getFuncValue((TriggerFuncData)obj, arg));
            }
            }
        }
        catch (Exception e)
        {
            errorLog("getObj出错", e);
        }

        return(null);
    }
Ejemplo n.º 13
0
    /// <summary>
    /// 转文本输出
    /// </summary>
    protected override void toWriteDataString(DataWriter writer)
    {
        base.toWriteDataString(writer);

        writer.writeTabs();
        writer.sb.Append("value");
        writer.sb.Append(':');
        writer.sb.Append("List<TriggerObjData>");
        if (this.value != null)
        {
            SList <TriggerObjData> valueT = this.value;
            int valueLen = valueT.size();
            writer.sb.Append('(');
            writer.sb.Append(valueLen);
            writer.sb.Append(')');
            writer.writeEnter();
            writer.writeLeftBrace();
            for (int valueI = 0; valueI < valueLen; ++valueI)
            {
                TriggerObjData valueV = valueT.get(valueI);
                writer.writeTabs();
                writer.sb.Append(valueI);
                writer.sb.Append(':');
                if (valueV != null)
                {
                    valueV.writeDataString(writer);
                }
                else
                {
                    writer.sb.Append("TriggerObjData=null");
                }

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

        writer.writeEnter();
    }
Ejemplo n.º 14
0
 /** 获取点快捷方式 */
 public PosData getPos(TriggerObjData obj, TriggerArg arg)
 {
     return((PosData)getObj(obj, arg));
 }
Ejemplo n.º 15
0
 /** 获取朝向快捷方式 */
 public DirData getDir(TriggerObjData obj, TriggerArg arg)
 {
     return((DirData)getObj(obj, arg));
 }
Ejemplo n.º 16
0
 /** 获取单位快捷方式 */
 public Unit getUnit(TriggerObjData obj, TriggerArg arg)
 {
     return((Unit)getObj(obj, arg));
 }
Ejemplo n.º 17
0
 /** 获取List值 */
 public SList <object> getList(TriggerObjData obj, TriggerArg arg)
 {
     return((SList <object>)getObj(obj, arg));
 }
Ejemplo n.º 18
0
 /** 获取Map值 */
 public SMap <object, object> getMap(TriggerObjData obj, TriggerArg arg)
 {
     return((SMap <object, object>)getObj(obj, arg));
 }
Ejemplo n.º 19
0
 /** 获取Set值 */
 public SSet <object> getSet(TriggerObjData obj, TriggerArg arg)
 {
     return((SSet <object>)getObj(obj, arg));
 }
Ejemplo n.º 20
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        if (!base.toDataEquals(data))
        {
            return(false);
        }

        TriggerFuncData mData = (TriggerFuncData)data;

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

        if (mData.args != null)
        {
            if (this.args == null)
            {
                return(false);
            }
            if (this.args.Length != mData.args.Length)
            {
                return(false);
            }
            TriggerObjData[] argsT = this.args;
            TriggerObjData[] argsR = mData.args;
            int argsLen            = argsT.Length;
            for (int argsI = 0; argsI < argsLen; ++argsI)
            {
                TriggerObjData argsU = argsT[argsI];
                TriggerObjData argsV = argsR[argsI];
                if (argsV != null)
                {
                    if (argsU == null)
                    {
                        return(false);
                    }
                    if (!argsU.dataEquals(argsV))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (argsU != null)
                    {
                        return(false);
                    }
                }
            }
        }
        else
        {
            if (this.args != null)
            {
                return(false);
            }
        }

        return(true);
    }