示例#1
0
    // Note that this is called only when explicitly saving/loading a coordinate.
    public override void OnCoordinate(ChaFile f, ChaFileCoordinate co, bool isLoad)
    {
        var map = f.dict.Get <GuidMap>("guidmap");

        map.baseprefix    = null;
        coordRewriter.map = map;
        if (isLoad)
        {
            coordRewriter.ToFake(co);
        }
        else
        {
            coordRewriter.FromFake(co);
        }
    }
示例#2
0
    // rewrite our fake ids to the actual real ones again
    public override void OnCardSave(ChaFile f, BinaryWriter w, List <object> blocks, bool nopng)
    {
        var map = f.dict.Get <GuidMap>("guidmap");

        map.items.Clear();
        map.baseprefix     = null;
        coordRewriter.map  = map;
        customRewriter.map = map;
        foreach (var b in blocks)
        {
            var coords = b as ChaFileCoordinate[];
            if (coords != null)
            {
                for (int i = 0; i < coords.Length; i++)
                {
                    map.baseprefix = "coordinate[" + i + "]";
                    coordRewriter.FromFake(coords[i]);
                }
            }
            else if (b is ChaFileCustom)
            {
                map.baseprefix = "custom";
                customRewriter.FromFake(b);
            }
        }
    }