Esempio n. 1
0
        public GhostInputReplayer(Game game, GhostData data)
            : base(game)
        {
            Data = data;

            On.Celeste.Input.Initialize += HookInput;
            HookInput(null);
        }
Esempio n. 2
0
        public GhostManager(Player player, Level level)
            : base(Vector2.Zero)
        {
            Player = player;

            Tag = Tags.HUD;

            // Read and add all ghosts.
            GhostData.ForAllGhosts(level.Session, (i, ghostData) => {
                Ghost ghost = new Ghost(player, ghostData);
                level.Add(ghost);
                Ghosts.Add(ghost);
                return(true);
            });
        }
Esempio n. 3
0
        public Ghost(Player player, GhostData data)
            : base(player.Position)
        {
            Player = player;
            Data   = data;

            Depth = 1;

            Sprite           = new PlayerSprite(player.Sprite.Mode);
            Sprite.HairCount = player.Sprite.HairCount;
            Add(Hair         = new PlayerHair(Sprite));
            Add(Sprite);

            Hair.Color = Player.NormalHairColor;

            Name = new GhostName(this, Data?.Name ?? "");
        }
Esempio n. 4
0
        public static List <GhostData> ReadAllGhosts(Session session, List <GhostData> list = null)
        {
            if (list == null)
            {
                list = new List <GhostData>();
            }

            foreach (string filePath in GetAllGhostFilePaths(session))
            {
                GhostData ghost = new GhostData(filePath).Read();
                if (ghost == null)
                {
                    continue;
                }
                list.Add(ghost);
            }

            return(list);
        }
Esempio n. 5
0
 public static void ForAllGhosts(Session session, Func <int, GhostData, bool> cb)
 {
     if (cb == null)
     {
         return;
     }
     string[] filePaths = GetAllGhostFilePaths(session);
     for (int i = 0; i < filePaths.Length; i++)
     {
         GhostData ghost = new GhostData(filePaths[i]).Read();
         if (ghost == null)
         {
             continue;
         }
         if (!cb(i, ghost))
         {
             break;
         }
     }
 }