コード例 #1
0
    public RecFrameDataSerial Serialize()
    {
        RecFrameDataSerial rtn = new RecFrameDataSerial();

        rtn.VId       = VId;
        rtn.Pos       = new Vector3Serial(Pos);
        rtn.Rot       = new QuaternionSerial(Rot);
        rtn.XMovement = XMovement;
        //rtn.ZMovement = ZMovement;
        rtn.FAngularVelocity = FAV;
        rtn.RAngularVelocity = RAV;
        rtn.FLSprL           = FLSprL;
        rtn.FRSprL           = FRSprL;
        rtn.RLSprL           = RLSprL;
        rtn.RRSprL           = RRSprL;
        rtn.FLGnd            = FLGnd;
        rtn.FRGnd            = FRGnd;
        rtn.RLGnd            = RLGnd;
        rtn.RRGnd            = RRGnd;
        if (Events != null)
        {
            rtn.Events = Events.ToArray();
        }
        return(rtn);
    }
コード例 #2
0
    public Recrdng(string filename)
    {
        Filename = filename;
        BinaryFormatter bf = new BinaryFormatter();

        if (File.Exists(Application.persistentDataPath + "/" + Filename))
        {
            FileStream    file      = File.Open(Application.persistentDataPath + "/" + Filename, FileMode.Open);
            RecrdngSerial rs        = (RecrdngSerial)bf.Deserialize(file);
            int           _vehCount = rs.Data.GetLength(1);
            Main.Instance.Vehicles = rs.Vehicles.ToList();
            FrameCount             = rs.Data.GetLength(0);
            Data = new List <List <RecFrameData> >();
            for (int f = 0; f < FrameCount; f++)
            {
                List <RecFrameData> lf = new List <RecFrameData>();
                for (int v = 0; v < _vehCount; v++)
                {
                    RecFrameData       rfd  = new RecFrameData();
                    RecFrameDataSerial rfds = rs.Data[f, v];
                    rfd.VId       = rfds.VId;
                    rfd.FAV       = (sbyte)rfds.FAngularVelocity;
                    rfd.RAV       = (sbyte)rfds.RAngularVelocity;
                    rfd.FLSprL    = rfds.FLSprL;
                    rfd.FRSprL    = rfds.FRSprL;
                    rfd.RLSprL    = rfds.RLSprL;
                    rfd.RRSprL    = rfds.RRSprL;
                    rfd.FLGnd     = rfds.FLGnd;
                    rfd.FRGnd     = rfds.FRGnd;
                    rfd.RLGnd     = rfds.RLGnd;
                    rfd.RRGnd     = rfds.RRGnd;
                    rfd.Pos       = rfds.Pos.V3;
                    rfd.Rot       = rfds.Rot.Decode;
                    rfd.XMovement = rfds.XMovement;
                    if (rfds.Events != null)
                    {
                        rfd.Events = rfds.Events.ToList();
                    }
                    //rfd.Event = new RecEvent {Type = (RecEventType)rfds.EventType, Data = rfds.EventData };
                    lf.Add(rfd);
                }
                Data.Add(lf);
            }
            file.Close();
            CurrFrame = 0;
        }
    }