예제 #1
0
 public static void ParseData(byte[] data, CSProcessingData recordData)
 {
     using (MemoryStream ms = new MemoryStream(data))
         using (BinaryReader reader = new BinaryReader(ms))
         {
             recordData.isAuto = BufferHelper.ReadBoolean(reader);
             int taskCount = BufferHelper.ReadInt32(reader);
             for (int i = 0; i < taskCount; i++)
             {
                 int            taskIndex = BufferHelper.ReadInt32(reader);
                 ProcessingTask pt        = new ProcessingTask();
                 int            itemCount = BufferHelper.ReadInt32(reader);
                 for (int j = 0; j < itemCount; j++)
                 {
                     ItemIdCount po = new ItemIdCount();
                     po.protoId = BufferHelper.ReadInt32(reader);
                     po.count   = BufferHelper.ReadInt32(reader);
                     pt.itemList.Add(po);
                 }
                 pt.runCount  = BufferHelper.ReadInt32(reader);
                 pt.m_CurTime = BufferHelper.ReadSingle(reader);
                 pt.m_Time    = BufferHelper.ReadSingle(reader);
                 recordData.mTaskTable[taskIndex] = pt;
             }
         }
 }
예제 #2
0
    void RPC_S2C_InitDataProcessing(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        CSProcessingData recordData = (CSProcessingData)_ColonyObj._RecordData;

        recordData.m_CurDeleteTime = stream.Read <float>();
        recordData.m_CurRepairTime = stream.Read <float>();
        recordData.m_DeleteTime    = stream.Read <float>();
        recordData.m_Durability    = stream.Read <float>();
        recordData.m_RepairTime    = stream.Read <float>();
        recordData.m_RepairValue   = stream.Read <float>();
        //--to do init tasktable
        byte[] dataArray = stream.Read <byte[]>();
        CSProcessing.ParseData(dataArray, recordData);
    }
예제 #3
0
    //  <CETC> Assign Record Data
    public bool AssignData(int id, int type, ref CSDefaultData refData)
    {
        // Personnel
        if (type == CSConst.dtPersonnel)
        {
            if (m_PersonnelDatas.ContainsKey(id))
            {
                Debug.Log("The Personnel Data ID [" + id.ToString() + "] is exist.");
                refData = m_PersonnelDatas[id];
                return(false);
            }
            else
            {
                refData    = new CSPersonnelData();
                refData.ID = id;
                m_PersonnelDatas.Add(id, refData as CSPersonnelData);
                return(true);
            }
        }
        // Object
        else
        {
            if (m_ObjectDatas.ContainsKey(id))
            {
                Debug.Log("The Object data ID [" + id.ToString() + "] is exist.");
                refData = m_ObjectDatas[id];
                return(false);
            }
            else
            {
                switch (type)
                {
                case CSConst.dtAssembly:
                    refData = new CSAssemblyData();
                    break;

                case CSConst.dtStorage:
                    refData = new CSStorageData();
                    break;

                case CSConst.dtEngineer:
                    refData = new CSEngineerData();
                    break;

                case CSConst.dtEnhance:
                    refData = new CSEnhanceData();
                    break;

                case CSConst.dtRepair:
                    refData = new CSRepairData();
                    break;

                case CSConst.dtRecyle:
                    refData = new CSRecycleData();
                    break;

                case CSConst.dtppCoal:
                    refData = new CSPPCoalData();
                    break;

                case CSConst.dtDwelling:
                    refData = new CSDwellingsData();
                    break;

                case CSConst.dtFactory:
                    refData = new CSFactoryData();
                    break;

                case CSConst.dtProcessing:
                    refData = new CSProcessingData();
                    break;

                default:
                    //refData = new CSDefaultData();
                    refData = new CSObjectData();
                    break;
                }

                refData.ID = id;
                m_ObjectDatas.Add(id, refData as CSObjectData);
                return(true);
            }
        }
    }
예제 #4
0
    public bool AssignData(int id, int type, ref CSDefaultData refData, ColonyBase _colony)
    {
        if (_colony != null && _colony._RecordData != null)
        {
            refData = _colony._RecordData;
            return(false);
        }
        else
        {
            switch (type)
            {
            case CSConst.dtAssembly:
                refData = new CSAssemblyData();
                break;

            case CSConst.dtStorage:
                refData = new CSStorageData();
                break;

            case CSConst.dtEngineer:
                refData = new CSEngineerData();
                break;

            case CSConst.dtEnhance:
                refData = new CSEnhanceData();
                break;

            case CSConst.dtRepair:
                refData = new CSRepairData();
                break;

            case CSConst.dtRecyle:
                refData = new CSRecycleData();
                break;

            case CSConst.dtppCoal:
                refData = new CSPPCoalData();
                break;

            case CSConst.dtppSolar:
                refData = new CSPPSolarData();
                break;

            case CSConst.dtDwelling:
                refData = new CSDwellingsData();
                break;

            case CSConst.dtFarm:
                refData = new CSFarmData();
                break;

            case CSConst.dtFactory:
                refData = new CSFactoryData();
                break;

            case CSConst.dtProcessing:
                refData = new CSProcessingData();
                break;

            case CSConst.dtTrade:
                refData = new CSTradeData();
                break;

            case CSConst.dtTrain:
                refData = new CSTrainData();
                break;

            case CSConst.dtCheck:
                refData = new CSCheckData();
                break;

            case CSConst.dtTreat:
                refData = new CSTreatData();
                break;

            case CSConst.dtTent:
                refData = new CSTentData();
                break;

            case CSConst.dtppFusion:
                refData = new CSPPFusionData();
                break;

            default:
                refData = new CSDefaultData();
                break;
            }
            refData.ID = id;
            return(true);
        }
    }
예제 #5
0
 //CSProcessingData _MyData;
 public ColonyProcessing(ColonyNetwork network)
 {
     SetNetwork(network);
     _RecordData = new CSProcessingData();
     //_MyData = (CSProcessingData)_RecordData;
 }