コード例 #1
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;
            }
        }
コード例 #2
0
        public FlagToggleSwitch(Vector2 position, int id, bool onlyOn, bool onlyOff, bool silent, string flag)
            : base(position)
        {
            this.id      = id;
            this.onlyOn  = onlyOn;
            this.onlyOff = onlyOff;
            this.flag    = flag;
            this.silent  = silent;

            Collider = new Hitbox(16f, 24f, -8f, -12f);

            Add(new PlayerCollider(OnPlayer));
            Add(sprite = spriteBank.Create("pandorasBoxFlagTooggleSwitch"));
            //Add(sprite = GFX.SpriteBank.Create("coreFlipSwitch"));

            Depth = 2000;
        }
コード例 #3
0
        private static void CustomizeCrystalHeart(OuiChapterPanel panel)
        {
            // customize heart gem icon
            string animId = null;

            // our sprite ID will be "AltSidesHelper_<heart sprite path keyified>"
            var data = AreaData.Get(panel.Area);
            AltSidesHelperMode mode = GetModeMetaForAltSide(data);

            if (mode != null)
            {
                Logger.Log("AltSidesHelper", $"Found meta for \"{data.SID}\" when customising UI heart.");
                if (mode.OverrideHeartTextures)
                {
                    animId = mode.ChapterPanelHeartIcon.DialogKeyify();
                    Logger.Log("AltSidesHelper", $"Will change UI heart sprite for \"{data.SID}\".");
                }
            }

            if (animId != null)
            {
                if (HeartSpriteBank.Has(animId))
                {
                    Logger.Log("AltSidesHelper", $"Replacing UI heart sprite for \"{data.SID}\".");
                    Sprite heartSprite = HeartSpriteBank.Create(animId);
                    var    selfdata    = new DynData <OuiChapterPanel>(panel);
                    var    oldheart    = selfdata.Get <HeartGemDisplay>("heart");
                    bool   prevVisible = oldheart.Sprites[0].Visible;
                    oldheart.Sprites[0] = heartSprite;
                    heartSprite.CenterOrigin();
                    heartSprite.Play("spin");
                    heartSprite.Visible      = prevVisible || oldheart.Sprites[1].Visible || oldheart.Sprites[2].Visible;
                    selfdata["AsHeartDirty"] = true;
                }
            }
        }
コード例 #4
0
        private static void CustomizeCrystalHeart(OuiChapterPanel panel)
        {
            // customize heart gem icon
            string animId = null;

            // our sprite ID will be "AltSidesHelper_<heart sprite path keyified>"
            // log duplicate entries for a map
            AltSidesHelperMeta parentHelperMeta = GetMetaForAreaData(AreaData.Get(GetMetaForAreaData(AreaData.Get(panel.Area))?.AltSideData?.For));

            if (parentHelperMeta != null)
            {
                foreach (var mode in parentHelperMeta.Sides)
                {
                    if (mode.Map.Equals(panel.Area.SID))
                    {
                        animId = mode.ChapterPanelHeartIcon.DialogKeyify();
                    }
                }
            }

            if (animId != null)
            {
                if (HeartSpriteBank.Has(animId))
                {
                    Sprite heartSprite = HeartSpriteBank.Create(animId);
                    var    selfdata    = new DynData <OuiChapterPanel>(panel);
                    var    oldheart    = selfdata.Get <HeartGemDisplay>("heart");
                    bool   prevVisible = oldheart.Sprites[0].Visible;
                    oldheart.Sprites[0] = heartSprite;
                    heartSprite.CenterOrigin();
                    heartSprite.Play("spin");
                    heartSprite.Visible      = prevVisible;
                    selfdata["AsHeartDirty"] = true;
                }
            }
        }
コード例 #5
0
        // When a new Strawberry is "added" to a scene, we need it to initialize certain features, most of them visual in nature.
        public override void Added(Scene scene)
        {
            base.Added(scene);

            sprite = spriteBank.Create("springCollabGlassBerry");
            Add(sprite);

            if (!isOwned)
            {
                sprite.Play("idle");
            }
            else
            {
                sprite.Play("idleGhost");
            }

            // Strawberries have certain special effects during their animation sequence.
            // This adds a handler to enable this.
            sprite.OnFrameChange = OnAnimate;

            // A Wiggler is capable of "shaking" and "pulsing" sprites.
            // This Wiggler adjusts the sprite's Scale when triggered.
            wiggler = Wiggler.Create
                      (
                0.4f,
                4f,
                delegate(float v) {
                sprite.Scale = Vector2.One * (1f + v * 0.35f);
            },
                false,
                false
                      );
            Add(wiggler);

            // Bloom makes bright things brighter!
            // The default BloomPoint for a vanilla Strawberry is
            // alpha = (this.Golden || this.Moon || this.isGhostBerry) ? 0.5f : 1f
            // radius = 12f
            bloom = new BloomPoint(isOwned ? 0.25f : 0.5f, 12f);
            Add(bloom);

            // Strawberries give off light. This is the vanilla VertexLight.
            light      = new VertexLight(Color.White, 1f, 16, 24);
            lightTween = light.CreatePulseTween();
            Add(light);
            Add(lightTween);

            // While we're here, a seeded Strawberry must be allowed to initialize its Seeds.
            if (Seeds != null && Seeds.Count > 0 && !SceneAs <Level>().Session.GetFlag(gotSeedFlag))
            {
                foreach (GenericStrawberrySeed seed in Seeds)
                {
                    scene.Add(seed);
                }

                // If we added the seeds, we don't want to see or touch the strawberry, do we?
                Visible       = false;
                Collidable    = false;
                bloom.Visible = light.Visible = false;
            }

            // Let's be polite and turn down the bloom a little bit if the base level has bloom.
            if (SceneAs <Level>().Session.BloomBaseAdd > 0.1f)
            {
                bloom.Alpha *= 0.5f;
            }

            // The Glass Berry's gimmick is that it breaks if the player dashes while carrying it.
            // So we need a generic DashListener.
            Add(new DashListener {
                OnDash = OnDash
            });
        }