예제 #1
0
        public void HookPageGrafUpdate(On.Menu.SlugcatSelectMenu.SlugcatPage.orig_GrafUpdate orig, SlugcatSelectMenu.SlugcatPage instance, float timeStacker)
        {
            float num   = instance.Scroll(timeStacker);
            float num2  = instance.UseAlpha(timeStacker);
            float depth = instance.slugcatDepth;

            if (instance.HasMark)
            {
                float num3 = Mathf.Lerp(instance.lastMarkAlpha, instance.markAlpha, timeStacker) * num2;
                if (instance.slugcatNumber == 2)
                {
                    num3 *= ((!(instance is SlugcatSelectMenu.SlugcatPageContinue)) ? 0f : Mathf.Pow(Mathf.InverseLerp(4f, 14f, (float)(instance as SlugcatSelectMenu.SlugcatPageContinue).saveGameData.cycle), 3.5f));
                }
                Vector2 a = new Vector2(instance.MidXpos + num * instance.ScrollMagnitude, instance.imagePos.y + 150f) + instance.markOffset;
                a -= instance.slugcatImage.CamPos(timeStacker) * 80f / depth;
                a -= new Vector2(0, artOffset);
                instance.markSquare.x     = a.x;
                instance.markSquare.y     = a.y;
                instance.markSquare.alpha = Mathf.Pow(num3, 0.75f);
                instance.markGlow.x       = a.x;
                instance.markGlow.y       = a.y;
                instance.markGlow.scale   = Mathf.Lerp(3f, 3.3f, Mathf.Pow(num3, 0.2f)) + ((!instance.HasGlow) ? 0f : -0.5f) + Mathf.Lerp(-0.1f, 0.1f, UnityEngine.Random.value) * instance.markFlicker;
                instance.markGlow.alpha   = ((instance.slugcatNumber != 0) ? 0.6f : 0.4f) * Mathf.Pow(num3, 0.75f);
            }
            if (instance.HasGlow)
            {
                float   num4 = Mathf.Lerp(0.8f, 1f, Mathf.Lerp(instance.lastGlowAlpha, instance.glowAlpha, timeStacker)) * num2 * Mathf.Lerp(instance.lastInposition, instance.inPosition, timeStacker);
                Vector2 a2   = new Vector2(instance.MidXpos + num * instance.ScrollMagnitude, instance.imagePos.y) + instance.glowOffset;
                a2 -= instance.slugcatImage.CamPos(timeStacker) * 80f / depth;
                a2 -= new Vector2(0, artOffset);
                instance.glowSpriteB.color = Color.Lerp(instance.effectColor, new Color(1f, 1f, 1f), 0.3f * num4);
                instance.glowSpriteB.x     = a2.x;
                instance.glowSpriteB.y     = a2.y;
                instance.glowSpriteB.scale = Mathf.Lerp(20f, 38f, Mathf.Pow(num4, 0.75f));
                instance.glowSpriteB.alpha = Mathf.Pow(num4, 0.25f) * Mathf.Lerp(0.394f, 0.406f, UnityEngine.Random.value * (1f - Mathf.Lerp(instance.lastGlowAlpha, instance.glowAlpha, timeStacker)));
                instance.glowSpriteA.color = Color.Lerp(instance.effectColor, new Color(1f, 1f, 1f), 0.9f * num4);
                instance.glowSpriteA.x     = a2.x;
                instance.glowSpriteA.y     = a2.y;
                instance.glowSpriteA.scale = Mathf.Lerp(10f, 17f, Mathf.Pow(num4, 1.2f));
                instance.glowSpriteA.alpha = num4 * 0.6f;
            }
            for (int i = 0; i < instance.slugcatImage.depthIllustrations.Count; i++)
            {
                Vector2 a3 = instance.slugcatImage.depthIllustrations[i].pos;
                a3   -= new Vector2(0, artOffset);
                a3   -= instance.slugcatImage.CamPos(timeStacker) * 80f / instance.slugcatImage.depthIllustrations[i].depth;
                a3   += instance.sceneOffset;
                a3.x += num * instance.ScrollMagnitude;
                instance.slugcatImage.depthIllustrations[i].sprite.x     = a3.x;
                instance.slugcatImage.depthIllustrations[i].sprite.y     = a3.y;
                instance.slugcatImage.depthIllustrations[i].sprite.alpha = instance.slugcatImage.depthIllustrations[i].alpha * num2;
            }
            for (int j = 0; j < instance.slugcatImage.flatIllustrations.Count; j++)
            {
                Vector2 a4 = instance.slugcatImage.flatIllustrations[j].pos;
                a4   -= new Vector2(0, artOffset);
                a4   += instance.sceneOffset;
                a4.x += num * instance.ScrollMagnitude;
                instance.slugcatImage.flatIllustrations[j].sprite.x     = a4.x;
                instance.slugcatImage.flatIllustrations[j].sprite.y     = a4.y;
                instance.slugcatImage.flatIllustrations[j].sprite.alpha = instance.slugcatImage.flatIllustrations[j].alpha * num2;
            }

            if (instance.slugcatImage.depthIllustrations.Count > 0)
            {
                int lastIndex = instance.slugcatImage.depthIllustrations.Count - 1;

                if (customArtSprite != null)
                {
                    customArtSprite.RemoveFromContainer();
                    Vector2 a3 = new Vector2(Futile.screen.width / 2, Futile.screen.height / 2);
                    a3 += new Vector2(0, (Futile.screen.height * 2) - artOffset);
                    customArtSprite.x      = a3.x;
                    customArtSprite.y      = a3.y;
                    customArtSprite.width  = 400f;
                    customArtSprite.height = 400f;
                    customArtSprite.y     += customArtSprite.height / 6;
                    instance.slugcatImage.depthIllustrations[lastIndex].sprite.container.AddChild(customArtSprite);
                    customArtSprite.MoveToBack();
                    customArtSprite.MoveInFrontOfOtherNode(instance.slugcatImage.depthIllustrations[lastIndex].sprite);
                }
            }
        }