示例#1
0
        public static bool PlayCustomVignette(Session session, bool fromSaveData)
        {
            bool     playVignette = !fromSaveData && session.StartedFromBeginning;
            AreaData area         = AreaData.Get(session);
            MapMetaCompleteScreen screen;
            MapMetaTextVignette   text;

            if (playVignette && (screen = area.GetMeta()?.LoadingVignetteScreen) != null && screen.Atlas != null)
            {
                Engine.Scene = new CustomScreenVignette(session, meta: screen);
                return(true);
            }
            else if (playVignette && (text = area.GetMeta()?.LoadingVignetteText) != null && text.Dialog != null)
            {
                HiresSnow snow = null;
                if (Engine.Scene is Overworld)
                {
                    snow = (Engine.Scene as Overworld).Snow;
                }

                if (snow != null && text.SnowDirection != null)
                {
                    snow.Direction = text.SnowDirection;
                }

                Engine.Scene = new CustomTextVignette(session, text.Dialog, snow);
                return(true);
            }

            return(false);
        }
示例#2
0
 private void SetCrystalHeartSprite(On.Celeste.HeartGem.orig_Awake orig, HeartGem self, Scene scene)
 {
     orig(self, scene);
     if (!self.IsGhost && !self.IsFake)
     {
         var meta = GetModeMetaForAltSide(AreaData.Get((scene as Level).Session.Area));
         if (meta != null)
         {
             var selfdata = new DynData <HeartGem>(self);
             var sprite   = new Sprite(GFX.Game, meta.InWorldHeartIcon);
             sprite.CenterOrigin();
             sprite.AddLoop("idle", "", 0, new int[] { 0 });
             sprite.AddLoop("spin", "", 0.1f, new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 });
             sprite.AddLoop("fastspin", "", 0.1f);
             sprite.CenterOrigin();
             sprite.OnLoop = delegate(string anim) {
                 if (self.Visible && anim == "spin" && (bool)selfdata["autoPulse"])
                 {
                     Audio.Play("event:/game/general/crystalheart_pulse", self.Position);
                     self.ScaleWiggler.Start();
                     (scene as Level).Displacement.AddBurst(self.Position, 0.35f, 8f, 48f, 0.25f);
                 }
             };
             sprite.Play("spin");
             self.ScaleWiggler.RemoveSelf();
             self.ScaleWiggler = Wiggler.Create(0.5f, 4f, delegate(float f) {
                 sprite.Scale = Vector2.One * (1f + f * 0.25f);
             });
             self.Add(self.ScaleWiggler);
             ((Component)selfdata["sprite"]).RemoveSelf();
             selfdata["sprite"] = sprite;
             self.Add(sprite);
         }
     }
 }
示例#3
0
        private IEnumerator StartRoutine(string checkpoint = null)
        {
            Overworld.Maddy.Hide(false);
            Overworld.Mountain.EaseCamera(Area.ID, Data.MountainZoom, 1f);
            Add(new Coroutine(EaseOut(false)));
            yield return(0.2f);

            AreaData.Get(Area).Wipe(Overworld, false, null);
            Audio.SetMusic(null);
            Audio.SetAmbience(null);
            // TODO: Determine if the area should keep the overworld snow.
            if ((Area.ID == 0 || Area.ID == 9) && checkpoint == null && Area.Mode == AreaMode.Normal)
            {
                Overworld.RendererList.UpdateLists();
                Overworld.RendererList.MoveToFront(Overworld.Snow);
            }
            yield return(0.5f);

            try {
                LevelEnter.Go(new Session(Area, checkpoint), false);
            } catch (Exception e) {
                Mod.Logger.Log(LogLevel.Warn, "misc", $"Failed entering area {Area}");
                e.LogDetailed();

                string message = Dialog.Get("postcard_levelloadfailed");
                message = message.Replace("((player))", SaveData.Instance.Name);
                message = message.Replace("((sid))", Area.GetSID());

                LevelEnterExt.ErrorMessage = message;
                LevelEnter.Go(new Session(new AreaKey(1).SetSID("")), false);
            }
        }
示例#4
0
        private static void customizeCrystalHeart(OuiChapterPanel panel)
        {
            // customize heart gem icon
            string animId = null;

            string sid         = panel.Area.GetSID();
            string mapName     = sid.DialogKeyify();
            string mapLevelSet = AreaData.Get(sid)?.GetLevelSet().DialogKeyify();

            if (HeartSpriteBank.Has("crystalHeart_" + mapName))
            {
                // this map has a custom heart registered: use it.
                animId = "crystalHeart_" + mapName;
            }
            else if (HeartSpriteBank.Has("crystalHeart_" + mapLevelSet))
            {
                // this level set has a custom heart registered: use it.
                animId = "crystalHeart_" + mapLevelSet;
            }

            if (animId != null)
            {
                Sprite heartSprite = HeartSpriteBank.Create(animId);
                new DynData <OuiChapterPanel>(panel).Get <HeartGemDisplay>("heart").Sprites[0] = heartSprite;
                heartSprite.Play("spin");
                new DynData <OuiChapterPanel>(panel)["heartDirty"] = true;
            }
        }
示例#5
0
        private static void OnChapterPanelUpdateStats(On.Celeste.OuiChapterPanel.orig_UpdateStats orig, OuiChapterPanel self, bool wiggle,
                                                      bool?overrideStrawberryWiggle, bool?overrideDeathWiggle, bool?overrideHeartWiggle)
        {
            orig(self, wiggle, overrideStrawberryWiggle, overrideDeathWiggle, overrideHeartWiggle);

            if (Engine.Scene == overworldWrapper?.Scene)
            {
                AreaModeStats areaModeStats = self.DisplayedStats.Modes[(int)self.Area.Mode];
                DeathsCounter deathsCounter = new DynData <OuiChapterPanel>(self).Get <DeathsCounter>("deaths");
                deathsCounter.Visible = areaModeStats.Deaths > 0 && !AreaData.Get(self.Area).Interlude_Safe;

                // mod the death icon
                string pathToSkull = "CollabUtils2/skulls/" + self.Area.GetLevelSet();
                if (GFX.Gui.Has(pathToSkull))
                {
                    new DynData <DeathsCounter>(deathsCounter)["icon"] = GFX.Gui[pathToSkull];
                }
            }


            if (isPanelShowingLobby(self) || Engine.Scene == overworldWrapper?.Scene)
            {
                // turn strawberry counter into golden if there is no berry in the map
                if (AreaData.Get(self.Area).Mode[0].TotalStrawberries == 0)
                {
                    StrawberriesCounter strawberriesCounter = new DynData <OuiChapterPanel>(self).Get <StrawberriesCounter>("strawberries");
                    strawberriesCounter.Golden    = true;
                    strawberriesCounter.ShowOutOf = false;
                }
            }
        }
        public override void Added(Scene scene)
        {
            base.Added(scene);

            // read the matching texture
            if (string.IsNullOrEmpty(overrideTexture))
            {
                overrideTexture = AreaData.Get(scene).WoodPlatform;
            }
            MTexture platformTexture = GFX.Game["objects/woodPlatform/" + overrideTexture];

            textures = new MTexture[platformTexture.Width / 8];
            for (int i = 0; i < textures.Length; i++)
            {
                textures[i] = platformTexture.GetSubtexture(i * 8, 0, 8, 8);
            }

            // draw lines between all nodes
            Vector2 lineOffset = new Vector2(Width, Height + 4f) / 2f;

            scene.Add(new MovingPlatformLine(nodes[0] + lineOffset, nodes[1] + lineOffset));
            if (nodes.Length > 2)
            {
                for (int i = 1; i < nodes.Length - 1; i++)
                {
                    scene.Add(new MovingPlatformLine(nodes[i] + lineOffset, nodes[i + 1] + lineOffset));
                }

                if (mode == Mode.Loop || mode == Mode.LoopNoPause)
                {
                    scene.Add(new MovingPlatformLine(nodes[nodes.Length - 1] + lineOffset, nodes[0] + lineOffset));
                }
            }
        }
示例#7
0
        private void SetPoem()
        {
            string poem;

            if (this.Random.Next(100) == 0)
            {
                poem = Dialog.Clean($"RANDOHEART_FIXED_{Random.Next(int.Parse(Dialog.Clean("RANDOHEART_FIXED_COUNT")))}");
            }
            else
            {
                int    nounidx = Random.Next(int.Parse(Dialog.Clean("RANDOHEART_NOUN_COUNT")));
                var    adjidx  = Random.Next(int.Parse(Dialog.Clean("RANDOHEART_ADJ_COUNT")));
                string noun    = Dialog.Clean($"RANDOHEART_NOUN_{nounidx}");
                string adj;
                if (Dialog.Clean("RANDOHEART_GENDER") == "true")   // TODO less restrictive check
                {
                    string gender = Dialog.Clean($"RANDOHEART_NOUN_{nounidx}_GENDER");
                    adj = Dialog.Clean($"RANDOHEART_ADJ_{adjidx}_{gender}");
                }
                else
                {
                    adj = Dialog.Clean($"RANDOHEART_ADJ_{adjidx}");
                }
                poem = string.Format(Dialog.Get("RANDOHEART_ADJ_NOUN"), adj, noun);
            }
            var key = this.Key.GetSID().DialogKeyify() + "_A";

            AreaData.Get(this.Key).Mode[0].PoemID  = key;
            Dialog.Language.Dialog["POEM_" + key]  = poem;
            Dialog.Language.Cleaned["POEM_" + key] = poem;
        }
示例#8
0
        public override void Awake(Scene scene)
        {
            AreaData area = AreaData.Get(scene);

            if (area.CassetteSong == "-" || string.IsNullOrWhiteSpace(area.CassetteSong))
            {
                area.CassetteSong = null;
            }

            orig_Awake(scene);

            beatsPerTick = 4;
            ticksPerSwap = 2;
            beatIndexMax = 256;

            MapMetaCassetteModifier meta = area.GetMeta()?.CassetteModifier;

            if (meta != null)
            {
                if (meta.OldBehavior)
                {
                    tempoMult = meta.TempoMult;
                    maxBeat   = meta.Blocks;
                }
                leadBeats       = meta.LeadBeats;
                beatsPerTick    = meta.BeatsPerTick;
                ticksPerSwap    = meta.TicksPerSwap;
                beatIndexMax    = meta.BeatsMax;
                beatIndexOffset = meta.BeatIndexOffset;
            }
        }
示例#9
0
        public override void Update(Scene scene)
        {
            AreaData area = -1 < Area && Area < (AreaData.Areas?.Count ?? 0) ? AreaData.Get(Area) : null;
            MapMeta  meta = area?.GetMeta();

            bool wasFreeCam = inFreeCameraDebugMode;

            if (meta?.Mountain?.ShowCore ?? false)
            {
                Area = 9;
                orig_Update(scene);
                Area = area.ID;
            }
            else
            {
                orig_Update(scene);
            }

            Overworld overworld = scene as Overworld;

            if (!wasFreeCam && inFreeCameraDebugMode && (
                    ((overworld.Current ?? overworld.Next) is patch_OuiFileNaming naming && naming.UseKeyboardInput) ||
                    ((overworld.Current ?? overworld.Next) is OuiModOptionString stringInput && stringInput.UseKeyboardInput)))
            {
                // we turned on free cam mode (by pressing Space) while on an text entry screen using keyboard input... we should turn it back off.
                inFreeCameraDebugMode = false;
            }
        }
示例#10
0
        public new void CleanCheckpoints()
        {
            if (string.IsNullOrEmpty(SID) && (ID_Unsafe < 0 || AreaData.Areas.Count <= ID_Unsafe))
            {
                throw new Exception($"SaveData contains invalid AreaStats with no SID and out-of-range ID of {ID_Unsafe} / {AreaData.Areas.Count}");
            }

            AreaData area = AreaData.Get(ID);

            for (int i = 0; i < Modes.Length; i++)
            {
                AreaMode       areaMode       = (AreaMode)i;
                AreaModeStats  areaModeStats  = Modes[i];
                ModeProperties modeProperties = null;
                if (area.HasMode(areaMode))
                {
                    modeProperties = area.Mode[i];
                }

                HashSet <string> checkpoints = new HashSet <string>(areaModeStats.Checkpoints);
                areaModeStats.Checkpoints.Clear();

                if (modeProperties != null && modeProperties.Checkpoints != null)
                {
                    foreach (CheckpointData checkpointData in modeProperties.Checkpoints)
                    {
                        if (checkpoints.Contains(checkpointData.Level))
                        {
                            areaModeStats.Checkpoints.Add(checkpointData.Level);
                        }
                    }
                }
            }
        }
示例#11
0
        private IEnumerator Routine()
        {
            if (ErrorMessage != null)
            {
                string message = ErrorMessage;
                ErrorMessage = null;
                return(ErrorRoutine(message));
            }

            if (AreaData.Get(session) == null)
            {
                string message = Dialog.Get("postcard_levelgone")
                                 .Replace("((player))", SaveData.Instance.Name)
                                 .Replace("((sid))", session.Area.GetSID())
                ;
                return(ErrorRoutine(message));
            }

            AreaData areaData = AreaData.Get(session);
            MapMeta  areaMeta = areaData.GetMeta();

            if (areaMeta != null && areaData.GetLevelSet() != "Celeste" &&
                Dialog.Has(areaData.Name + "_postcard") &&
                session.StartedFromBeginning && !fromSaveData &&
                session.Area.Mode == AreaMode.Normal &&
                (!SaveData.Instance.Areas[session.Area.ID].Modes[0].Completed || SaveData.Instance.DebugMode))
            {
                return(EnterWithPostcardRoutine(Dialog.Get(areaData.Name + "_postcard"), areaMeta.PostcardSoundID));
            }

            return(orig_Routine());
        }
示例#12
0
        private void MakeFrankenTilesets(RandoSettings settings)
        {
            var fgPaths = new List <string>();
            var bgPaths = new List <string>();
            var atPaths = new List <string>();

            foreach (var map in settings.EnabledMaps)
            {
                var meta   = AreaData.Get(map).GetMeta();
                var fgPath = meta?.ForegroundTiles;
                var bgPath = meta?.BackgroundTiles;
                var atPath = meta?.AnimatedTiles;
                if (!string.IsNullOrEmpty(fgPath) && !fgPaths.Contains(fgPath))
                {
                    fgPaths.Add(fgPath);
                }
                if (!string.IsNullOrEmpty(bgPath) && !bgPaths.Contains(bgPath))
                {
                    bgPaths.Add(bgPath);
                }
                if (!string.IsNullOrEmpty(atPath) && !atPaths.Contains(atPath))
                {
                    atPaths.Add(atPath);
                }
            }

            CombineAutotilers(GFX.FGAutotiler, fgPaths, settings);
            CombineAutotilers(GFX.BGAutotiler, bgPaths, settings);
            CombineAnimatedTiles(GFX.AnimatedTilesBank, atPaths, settings);
        }
示例#13
0
        public static AltSidesHelperMode GetModeMetaForAltSide(AreaData data)
        {
            if (data == null)
            {
                return(null);
            }
            AltSidesHelperMeta parentHelperMeta = GetMetaForAreaData(AreaData.Get(GetMetaForAreaData(AreaData.Get(data.SID))?.AltSideData?.For));

            if (parentHelperMeta != null)
            {
                foreach (var mode in parentHelperMeta.Sides)
                {
                    if (mode.Map.Equals(data.SID))
                    {
                        return(mode);
                    }
                }
            }
            // check for a-side overrides too
            AltSidesHelperMeta helperMeta = GetMetaForAreaData(data);

            if (helperMeta != null)
            {
                foreach (var mode in helperMeta.Sides)
                {
                    if (mode.OverrideVanillaSideData)
                    {
                        return(mode);
                    }
                }
            }
            return(null);
        }
示例#14
0
        private IEnumerator StartRoutine(string checkpoint = null)
        {
            int checkpointAreaSplit = checkpoint?.IndexOf('|') ?? -1;

            if (checkpointAreaSplit >= 0)
            {
                Area       = AreaDataExt.Get(checkpoint.Substring(0, checkpointAreaSplit))?.ToKey(Area.Mode) ?? Area;
                checkpoint = checkpoint.Substring(checkpointAreaSplit + 1);
            }

            EnteringChapter = true;
            Overworld.Maddy.Hide(false);
            Overworld.Mountain.EaseCamera(Area.ID, Data.MountainZoom, 1f);
            Add(new Coroutine(EaseOut(false)));
            yield return(0.2f);

            ScreenWipe.WipeColor = Color.Black;
            AreaData.Get(Area).Wipe(Overworld, false, null);
            Audio.SetMusic(null);
            Audio.SetAmbience(null);
            // TODO: Determine if the area should keep the overworld snow.
            if ((Area.ID == 0 || Area.ID == 9) && checkpoint == null && Area.Mode == AreaMode.Normal)
            {
                Overworld.RendererList.UpdateLists();
                Overworld.RendererList.MoveToFront(Overworld.Snow);
            }
            yield return(0.5f);

            LevelEnter.Go(new Session(Area, checkpoint), false);
        }
示例#15
0
        public new void CleanCheckpoints()
        {
            AreaData area = AreaData.Get(ID);

            for (int i = 0; i < Modes.Length; i++)
            {
                AreaMode       areaMode       = (AreaMode)i;
                AreaModeStats  areaModeStats  = Modes[i];
                ModeProperties modeProperties = null;
                if (area.HasMode(areaMode))
                {
                    modeProperties = area.Mode[i];
                }

                HashSet <string> checkpoints = new HashSet <string>(areaModeStats.Checkpoints);
                areaModeStats.Checkpoints.Clear();

                if (modeProperties != null && modeProperties.Checkpoints != null)
                {
                    foreach (CheckpointData checkpointData in modeProperties.Checkpoints)
                    {
                        if (checkpoints.Contains(checkpointData.Level))
                        {
                            areaModeStats.Checkpoints.Add(checkpointData.Level);
                        }
                    }
                }
            }
        }
示例#16
0
            public static void UpdateText(string details, string state = null, Session session = null)
            {
                Language language = null;

                if (!(Dialog.Languages?.TryGetValue("english", out language) ?? false))
                {
                    language = null;
                }

                if (session == null)
                {
                    session = (Engine.Scene as Level)?.Session;
                }

                string area = "";

                if (session != null)
                {
                    area = AreaData.Get(session).Name;
                    area = area?.DialogCleanOrNull(language) ?? area;
                }

                lock (DiscordPresence) {
                    DiscordPresence.details = FillText(details, session, area);
                    DiscordPresence.state   = FillText(state, session, area);
                }

                if (Worker == null)
                {
                    return;
                }
                lock (Queue) {
                    Queue.Enqueue(UpdatePresence);
                }
            }
        public static void Reload()
        {
            // ChapterSelect only updates the ID.
            string lastAreaSID = AreaData.Get(SaveData.Instance.LastArea.ID)?.ToKey().GetSID() ?? AreaKey.Default.GetSID();

            // Note: SaveData.Instance.LastArea is reset by AreaData.Interlude_Safe -> SaveData.LevelSetStats realizing that AreaOffset == -1
            // Store the "resolved" last selected area in a local variable, then re-set it after reloading.

            // Reload all maps.
            Everest.Content.Recrawl();
            AreaData.Unload();
            AreaData.Load();
            AreaData.ReloadMountainViews();

            // Fake a save data reload to resync the save data to the new area list.
            AreaData lastArea = AreaDataExt.Get(lastAreaSID);

            SaveData.Instance.LastArea = lastArea?.ToKey() ?? AreaKey.Default;
            SaveData.Instance.BeforeSave();
            SaveData.Instance.AfterInitialize();

            Overworld overworld = (Engine.Scene.Entities.FindFirst <Oui>())?.Overworld;

            if (overworld == null)
            {
                return;
            }
            if (overworld.Mountain.Area >= AreaData.Areas.Count)
            {
                overworld.Mountain.EaseCamera(0, AreaData.Areas[0].MountainIdle, null, true);
            }
            overworld.ReloadMenus((Overworld.StartMode)(-1));
        }
示例#18
0
        private IEnumerator EaseOut(Oui next)
        {
            OuiChapterSelectIcon selected = null;

            if (next is OuiChapterPanel)
            {
                (selected = icons[area]).Select();
            }

            bool isVanilla = currentLevelSet == "Celeste";

            foreach (OuiChapterSelectIcon icon in icons)
            {
                AreaData area = AreaData.Get(icon.Area);
                if (area == null || area.GetLevelSet() != currentLevelSet)
                {
                    continue;
                }

                if (selected != icon)
                {
                    icon.Hide();
                }

                if (isVanilla)
                {
                    yield return(0.01f);
                }
            }

            Visible = false;
            yield break;
        }
示例#19
0
        public new void OnLevelStart()
        {
            Level level = Scene as Level;
            MapMetaCassetteModifier meta = AreaData.Get(level.Session).GetMeta()?.CassetteModifier;

            if (meta != null && meta.OldBehavior)
            {
                currentIndex = maxBeat - 1 - ((beatIndex / beatsPerTick) % maxBeat);
            }
            else
            {
                maxBeat   = level.CassetteBlockBeats;
                tempoMult = level.CassetteBlockTempo;

                if (beatIndex % (beatsPerTick * ticksPerSwap) > ((beatsPerTick * ticksPerSwap) / 2))
                {
                    currentIndex = maxBeat - 2;
                }
                else
                {
                    currentIndex = maxBeat - 1;
                }
            }

            SilentUpdateBlocks();
        }
示例#20
0
        private static bool shouldDisplaySpeedBerryColumn()
        {
            if (CollabModule.Instance.Settings.BestTimeToDisplayInJournal == CollabSettings.BestTimeInJournal.SpeedBerry)
            {
                foreach (AreaStats item in SaveData.Instance.Areas_Safe)
                {
                    // start going through all maps belonging to the collab level set, or to a lobby level set belonging to this collab.
                    bool belongsToCollab = false;

                    if (item.LevelSet == SaveData.Instance.LevelSet)
                    {
                        belongsToCollab = true;
                    }
                    else
                    {
                        string lobby = LobbyHelper.GetLobbyForLevelSet(item.LevelSet);
                        if (lobby != null && AreaData.Get(lobby).GetLevelSet() == SaveData.Instance.LevelSet)
                        {
                            belongsToCollab = true;
                        }
                    }

                    if (belongsToCollab && CollabMapDataProcessor.SpeedBerries.ContainsKey(item.GetSID()))
                    {
                        // this level has a speed berry!
                        return(true);
                    }
                }
            }

            // either we disabled speed berries in the journal, or just went through all maps without finding any...
            return(false);
        }
示例#21
0
        public override void Update()
        {
            lock (AssetReloadHelper.AreaReloadLock) {
                orig_Update();

                if (string.IsNullOrEmpty(Audio.CurrentMusic))
                {
                    // don't change music if no music is currently playing
                    return;
                }

                if (SaveData.Instance != null && (IsCurrent <OuiChapterSelect>() || IsCurrent <OuiChapterPanel>() || IsCurrent <OuiMapList>() || IsCurrent <OuiMapSearch>()))
                {
                    string backgroundMusic = AreaData.Get(SaveData.Instance.LastArea)?.GetMeta()?.Mountain?.BackgroundMusic;
                    if (backgroundMusic != null)
                    {
                        // current map has custom background music
                        Audio.SetMusic(backgroundMusic);
                        customizedChapterSelectMusic = true;
                    }
                    else
                    {
                        // current map has no custom background music
                        restoreNormalMusicIfCustomized();
                    }
                }
                else
                {
                    // no save is loaded or we are not in chapter select
                    restoreNormalMusicIfCustomized();
                }
            }
        }
        private static void onSaveDataAfterInitialize(On.Celeste.SaveData.orig_AfterInitialize orig, SaveData self)
        {
            orig(self);

            foreach (string collabName in collabNames)
            {
                // be sure that all lobbies are unlocked.
                LevelSetStats stats = self.GetLevelSetStatsFor($"{collabName}/0-Lobbies");
                if (stats != null && (stats.UnlockedAreas > 0 || AreaData.Get($"{collabName}/0-Lobbies/0-Prologue") == null))   // we at least completed Prologue.
                {
                    stats.UnlockedAreas = stats.Areas.Count - 1;
                }
            }

            if (self.CurrentSession_Safe == null || !self.CurrentSession_Safe.InArea)
            {
                // we aren't in a level; check if we have a hidden level set selected (this should only happen with Alt-F4).
                string lobby = GetLobbyForLevelSet(self.LastArea_Safe.GetLevelSet());
                if (lobby != null)
                {
                    // we are! we should change the selected level to the matching lobby instead.
                    self.LastArea_Safe = AreaData.Get(lobby).ToKey();
                }
            }
        }
示例#23
0
        public AltSideTitle(Session session) : base()
        {
            AreaData areaData = AreaData.Get(session);
            string   name     = areaData.SID.DialogKeyify();

            if (Dialog.Has(name + "_altsides_remix_intro"))
            {
                // look for a list: "{name}_altsides_remix_intro"
                text = Dialog.Get(name + "_altsides_remix_intro").Split(new string[] { "{break}" }, System.StringSplitOptions.RemoveEmptyEntries);
            }
            else
            {
                // use the Everest format
                // level, artist, album
                text = new string[] {
                    Dialog.Get(areaData.Name) + " " + Dialog.Get(name + "_remix"),
                    Dialog.Get("remix_by") + " " + Dialog.Get(name + "_remix_artist"),
                    Dialog.Has(name + "_remix_album") ? Dialog.Get(name + "_remix_album") : Dialog.Get("remix_album")
                };
            }
            fade    = new float[text.Length];
            offsets = new float[text.Length];
            Tag     = Tags.HUD;
            Visible = true;
        }
示例#24
0
        private bool FixReturnFromAltSide(On.Celeste.OuiChapterPanel.orig_IsStart orig, OuiChapterPanel self, Overworld overworld, Overworld.StartMode start)
        {
            AreaData newArea = null;
            AreaData old;

            if (start == Overworld.StartMode.AreaComplete || start == Overworld.StartMode.AreaQuit)
            {
                AreaData area = AreaData.Get(SaveData.Instance.LastArea.ID);
                old = area;
                var meta = GetMetaForAreaData(area);
                if (meta?.AltSideData.IsAltSide ?? false)
                {
                    area = AreaData.Get(meta.AltSideData.For) ?? area;
                    if (area != null)
                    {
                        newArea = area;
                        SaveData.Instance.LastArea.ID = area.ID;
                        int returningSide = 0;                         //last unlocked mode
                        if (!area.Interlude_Safe && area.HasMode(AreaMode.BSide) && (SaveData.Instance.Areas_Safe[area.ID].Cassette || SaveData.Instance.DebugMode || SaveData.Instance.CheatMode))
                        {
                            returningSide++;
                        }
                        if (!area.Interlude_Safe && area.HasMode(AreaMode.CSide) && SaveData.Instance.UnlockedModes >= 3)
                        {
                            returningSide++;
                        }

                        var asideAltSideMeta = GetMetaForAreaData(area);
                        foreach (var mode in asideAltSideMeta.Sides)
                        {
                            if (!mode.OverrideVanillaSideData)
                            {
                                returningSide++;
                                if (mode.Map.Equals(old.GetSID()))
                                {
                                    break;
                                }
                            }
                        }

                        returningAltSide = returningSide;
                        SaveData.Instance.LastArea_Safe.ID = old.ID;
                    }
                }
            }
            var ret = orig(self, overworld, start);

            if (newArea != null)
            {
                //self.Data = newArea;
                SaveData.Instance.LastArea_Safe.ID = newArea.ID;
                shouldResetStats = false;
                resetMethod.Invoke(self, new object[] { });
                shouldResetStats = true;
            }
            returningAltSide = -1;

            return(ret);
        }
示例#25
0
        private IEnumerator Routine()
        {
            if (targetSID != null && AreaData.Get(targetSID) == null)
            {
                // we are returning to a map that does not exist!
                Logger.Log(LogLevel.Warn, "CollabUtils2/LevelExitToLobby", $"We are trying to return to a nonexistent lobby: {targetSID}!");
                targetSID  = null;
                targetRoom = null;

                // try detecting the lobby. if we don't succeed, targetSID will stay null and we will return to map.
                string lobbySID = LobbyHelper.GetLobbyForLevelSet(SaveData.Instance.CurrentSession_Safe.Area.GetLevelSet());
                if (lobbySID == null)
                {
                    lobbySID = LobbyHelper.GetLobbyForGym(SaveData.Instance.CurrentSession_Safe.Area.GetSID());
                }
                if (lobbySID != null)
                {
                    Logger.Log(LogLevel.Warn, "CollabUtils2/LevelExitToLobby", $"We will be returning to the detected lobby for the current map instead: {lobbySID}.");
                    targetSID = lobbySID;
                }
            }

            Session oldSession = SaveData.Instance.CurrentSession_Safe;
            Session newSession = null;

            if (targetSID != null)
            {
                newSession                      = new Session(AreaData.Get(targetSID).ToKey());
                newSession.FirstLevel           = false;
                newSession.StartedFromBeginning = false;
                newSession.Level                = targetRoom ?? newSession.MapData.StartLevel().Name;
                newSession.RespawnPoint         = targetRoom == null ? (Vector2?)null : targetSpawnPoint;
                SaveData.Instance.StartSession(newSession);
            }

            UserIO.SaveHandler(file: true, settings: true);
            while (UserIO.Saving)
            {
                yield return(null);
            }
            while (SaveLoadIcon.OnScreen)
            {
                yield return(null);
            }

            SaveData.Instance.CurrentSession_Safe = oldSession;

            if (targetSID == null)
            {
                // failsafe: if there is no lobby to return to, return to map instead.
                Engine.Scene = new OverworldLoader(
                    exitMode == LevelExit.Mode.Completed ? Overworld.StartMode.AreaComplete : Overworld.StartMode.AreaQuit);
            }
            else
            {
                new DynData <Session>(newSession)["pauseTimerUntilAction"] = true;
                LevelEnter.Go(newSession, false);
            }
        }
示例#26
0
        public override IEnumerator Enter(Oui from)
        {
            // Fix "out of bounds" level selection.
            int areaOffs = SaveData.Instance.GetLevelSetStats().AreaOffset;
            int areaMax  = Math.Max(areaOffs, SaveData.Instance.UnlockedAreas);

            area = Calc.Clamp(area, areaOffs, areaMax);

            Visible = true;
            EaseCamera();
            display = true;

            journalEnabled = Celeste.PlayMode == Celeste.PlayModes.Debug || (SaveData.Instance?.CheatMode ?? false);
            for (int i = 0; i <= SaveData.Instance.UnlockedAreas && !journalEnabled; i++)
            {
                if (SaveData.Instance.Areas[i].Modes[0].TimePlayed > 0L && !AreaData.Get(i).Interlude)
                {
                    journalEnabled = true;
                }
            }

            OuiChapterSelectIcon unselected = null;

            if (from is OuiChapterPanel)
            {
                (unselected = icons[area]).Unselect();
            }

            currentLevelSet = SaveData.Instance?.GetLevelSet() ?? "Celeste";
            foreach (OuiChapterSelectIcon icon in icons)
            {
                AreaData area = AreaData.Areas[icon.Area];
                if (area.GetLevelSet() != currentLevelSet)
                {
                    continue;
                }

                int index = area.ToKey().ID;
                if (index <= Math.Max(1, SaveData.Instance.UnlockedAreas) && icon != unselected)
                {
                    icon.Position = icon.HiddenPosition;
                    icon.Show();
                    icon.AssistModeUnlockable = false;
                }
                else if (SaveData.Instance.AssistMode && index == SaveData.Instance.UnlockedAreas + 1)
                {
                    icon.Position = icon.HiddenPosition;
                    icon.Show();
                    icon.AssistModeUnlockable = true;
                }

                // yield return 0.01f; // Originally returns 0.01f
            }

            if (from is OuiChapterPanel)
            {
                yield return(0.25f);
            }
        }
 private IEnumerator Routine()
 {
     if (AreaData.Get(session.Area) == null)
     {
         return(LevelGoneRoutine());
     }
     return(orig_Routine());
 }
        private bool IsExternal(Gem gem)
        {
            string[] arr = gem.ID.Split('/');
            Array.Resize(ref arr, arr.Length - 2); // Drop room name and gem index
            string SID = string.Join("/", arr);

            return(SID != AreaData.Get(SceneAs <Level>().Session).SID);
        }
示例#29
0
        public void ctor(Mode mode, Session session, HiresSnow snow = null)
        {
            // Restore to metadata of A-Side.
            AreaData.Get(session).RestoreASideAreaData();

            orig_ctor(mode, session, snow);
            Everest.Events.Level.Exit(Engine.Scene as Level, this, mode, session, snow);
        }
示例#30
0
        public override void Update()
        {
            lock (AssetReloadHelper.AreaReloadLock) {
                orig_Update();

                // if the mountain model is currently fading, use the one currently displayed, not the one currently selected, which is different if the fade isn't done yet.
                AreaData currentAreaData       = null;
                string   currentlyDisplayedSID = (Mountain?.Model as patch_MountainModel)?.PreviousSID;
                if (currentlyDisplayedSID != null)
                {
                    // use the settings of the currently displayed mountain
                    currentAreaData = patch_AreaData.Get(currentlyDisplayedSID);
                }
                else if (SaveData.Instance != null)
                {
                    // use the settings of the currently selected map
                    currentAreaData = AreaData.Get(SaveData.Instance.LastArea);
                }
                MapMetaMountain mountainMetadata = currentAreaData?.GetMeta()?.Mountain;

                Snow3D.Visible = mountainMetadata?.ShowSnow ?? true;

                if (string.IsNullOrEmpty(Audio.CurrentMusic))
                {
                    // don't change music if no music is currently playing
                    return;
                }

                if (SaveData.Instance != null && (IsCurrent <OuiChapterSelect>() || IsCurrent <OuiChapterPanel>() ||
                                                  IsCurrent <OuiMapList>() || IsCurrent <OuiMapSearch>() || IsCurrent <OuiJournal>()))
                {
                    string backgroundMusic    = mountainMetadata?.BackgroundMusic;
                    string backgroundAmbience = mountainMetadata?.BackgroundAmbience;
                    if (backgroundMusic != null || backgroundAmbience != null)
                    {
                        // current map has custom background music
                        Audio.SetMusic(backgroundMusic ?? "event:/music/menu/level_select");
                        Audio.SetAmbience(backgroundAmbience ?? "event:/env/amb/worldmap");
                        customizedChapterSelectMusic = true;
                    }
                    else
                    {
                        // current map has no custom background music
                        restoreNormalMusicIfCustomized();
                    }

                    foreach (KeyValuePair <string, float> musicParam in mountainMetadata?.BackgroundMusicParams ?? new Dictionary <string, float>())
                    {
                        Audio.SetMusicParam(musicParam.Key, musicParam.Value);
                    }
                }
                else
                {
                    // no save is loaded or we are not in chapter select
                    restoreNormalMusicIfCustomized();
                }
            }
        }
 public ActionResult GetArea(int cityId)
 {
     AreaData ad = new AreaData();
     List<Area> list = new List<Area>();
     Dictionary<string, object> dic = new Dictionary<string, object>();
     foreach (var i in ad.Get().ToList().Where(a => a.cityId == cityId))
     {
         list.Add(new Area()
         {
             num = i.num,
             AreaName = i.AreaName
         });
     }
     dic.Add("list", list);
     return Json(dic);
 }