Beispiel #1
0
    public static void UpdateRecording()
    {
        if (!fa.useGhosts)
        {
            return;
        }
        if (recording && xa.player != null)
        {
            //Debug.Log("Updating recording");
            GhostFrame frame = new GhostFrame();
            frame.pos.x     = xa.player.transform.position.x;
            frame.pos.y     = xa.player.transform.position.y;
            frame.timestamp = fa.speedrunTime;
            frame.ani       = fa.playerAni;
            frame.dir       = 2 * xa.playerDir;
            frames.Add(frame);

            if (frames.Count >= 200)
            {
                //let's do an upload
                if (DBFuncs.self != null)
                {
                    string s = FramesToString(frames);
                    frames = new List <GhostFrame>();
                    DBFuncs.self.UploadGhostAttempt(s, false, false);
                }
            }
        }
    }
Beispiel #2
0
        public void Write(BinaryWriter writer)
        {
            lock (ChunkMap) {
                foreach (IChunk chunk in ChunkMap.Values)
                {
                    if (chunk != null && chunk.IsValid && chunk.IsSendable)
                    {
                        GhostFrame.WriteChunk(writer, chunk.Write, GetChunkID(chunk.GetType()));
                    }
                }
            }

            if (Extra != null)
            {
                writer.Write(Extra);
            }

            writer.WriteNullTerminatedString(GhostFrame.End);
        }