示例#1
0
    virtual protected WorksiteSerializer Save()
    {
        WorksiteSerializer ws = GetWorksiteSerializer();

        ws.type = WorksiteType.Abstract;
        return(ws);
    }
示例#2
0
    override protected WorksiteSerializer Save()
    {
        if (workObject == null)
        {
            StopWork();
            return(null);
        }
        WorksiteSerializer ws = GetWorksiteSerializer();

        ws.type          = WorksiteType.CleanSite;
        ws.workObjectPos = workObject.pos;
        if (diggingMission)
        {
            ws.specificData = new byte[1] {
                1
            }
        }
        ;
        else
        {
            ws.specificData = new byte[1] {
                0
            }
        };
        return(ws);
    }
    override protected void Load(WorksiteSerializer ws)
    {
        LoadWorksiteData(ws);
        int res_id = 0;

        GameMaster.DeserializeByteArray <int>(ws.specificData, ref res_id);
        Set(GameMaster.mainChunk.GetBlock(ws.workObjectPos) as SurfaceBlock, ResourceType.GetResourceTypeById(res_id));
    }
示例#4
0
    override protected void Load(WorksiteSerializer ws)
    {
        LoadWorksiteData(ws);
        Set(GameMaster.mainChunk.GetBlock(ws.workObjectPos) as SurfaceBlock);
        GatherSiteSerializer gss = new GatherSiteSerializer();

        GameMaster.DeserializeByteArray(ws.specificData, ref gss);
        destructionTimer = gss.destructionTimer;
    }
示例#5
0
    protected WorksiteSerializer GetWorksiteSerializer()
    {
        WorksiteSerializer ws = new WorksiteSerializer();

        ws.workersCount = workersCount;
        ws.workflow     = workflow;
        ws.workSpeed    = workSpeed;
        return(ws);
    }
示例#6
0
    public static WorksiteSerializer[] StaticSave()
    {
        if (worksitesList.Count == 0)
        {
            return(new WorksiteSerializer[0]);
        }
        var wa = new WorksiteSerializer[worksitesList.Count];

        for (int i = 0; i < wa.Length; i++)
        {
            wa[i] = worksitesList[i].Save();
        }
        return(wa);
    }
示例#7
0
    override protected WorksiteSerializer Save()
    {
        if (workObject == null)
        {
            StopWork();
            return(null);
        }
        WorksiteSerializer ws = GetWorksiteSerializer();

        ws.type          = WorksiteType.DigSite;
        ws.workObjectPos = workObject.pos;
        ws.specificData  = new byte[] { dig == true ? (byte)1 : (byte)0 };
        return(ws);
    }
示例#8
0
    override protected WorksiteSerializer Save()
    {
        if (workObject == null)
        {
            StopWork();
            return(null);
        }
        WorksiteSerializer ws = GetWorksiteSerializer();

        ws.type          = WorksiteType.TunnelBuildingSite;
        ws.workObjectPos = workObject.pos;
        ws.specificData  = new byte[1] {
            signsMask
        };
        return(ws);
    }
    override protected WorksiteSerializer Save()
    {
        if (workObject == null)
        {
            StopWork();
            return(null);
        }
        WorksiteSerializer ws = GetWorksiteSerializer();

        ws.type          = WorksiteType.BlockBuildingSite;
        ws.workObjectPos = workObject.pos;
        using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
        {
            new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter().Serialize(stream, rtype.ID);
            ws.specificData = stream.ToArray();
        }
        return(ws);
    }
示例#10
0
    public ColonyControllerSerializer Save()
    {
        ColonyControllerSerializer ccs = new ColonyControllerSerializer();

        ccs.storageSerializer             = storage.Save();
        ccs.gears_coefficient             = gears_coefficient;
        ccs.labourEfficientcy_coefficient = labourEfficientcy_coefficient;
        ccs.happiness_coefficient         = happiness_coefficient;
        ccs.health_coefficient            = health_coefficient;
        ccs.birthrateCoefficient          = birthrateCoefficient;

        ccs.energyStored        = energyStored;
        ccs.energyCrystalsCount = energyCrystalsCount;
        ccs.worksites           = new List <WorksiteSerializer>();
        foreach (Worksite w in worksites)
        {
            if (w == null)
            {
                continue;
            }
            WorksiteSerializer wbs = w.Save();
            if (wbs == null)
            {
                continue;
            }
            ccs.worksites.Add(wbs);
        }
        ccs.freeWorkers          = freeWorkers;
        ccs.citizenCount         = citizenCount;
        ccs.deathCredit          = deathCredit;
        ccs.peopleSurplus        = peopleSurplus;
        ccs.housingTimer         = housingTimer;
        ccs.starvationTimer      = starvationTimer;
        ccs.starvationTime       = starvationTime;
        ccs.real_birthrate       = realBirthrate;
        ccs.birthrateCoefficient = birthrateCoefficient;
        return(ccs);
    }
示例#11
0
    override protected void Load(WorksiteSerializer ws)
    {
        LoadWorksiteData(ws);
        Set(GameMaster.mainChunk.GetBlock(ws.workObjectPos) as CubeBlock);
        int smask = ws.specificData[0];

        if ((smask & 1) != 0)
        {
            CreateSign(0);
        }
        if ((smask & 2) != 0)
        {
            CreateSign(1);
        }
        if ((smask & 4) != 0)
        {
            CreateSign(2);
        }
        if ((smask & 8) != 0)
        {
            CreateSign(3);
        }
    }
示例#12
0
 protected void LoadWorksiteData(WorksiteSerializer ws)
 {
     workersCount = ws.workersCount;
     workflow     = ws.workflow;
     workSpeed    = ws.workSpeed;
 }
示例#13
0
 virtual protected void Load(WorksiteSerializer ws)
 {
     LoadWorksiteData(ws);
 }
示例#14
0
 override protected void Load(WorksiteSerializer ws)
 {
     LoadWorksiteData(ws);
     Set(GameMaster.mainChunk.GetBlock(ws.workObjectPos) as SurfaceBlock, ws.specificData[0] == 1);
 }