Beispiel #1
0
 public virtual void Initialize(List<Option> options, AssetManager assets, string themeName)
 {
     TextDictionary assetDictionary = new TextDictionary(assets.GetText("cursor"));
     this.options = options;
     try { cycleDelay = assetDictionary.LookupInt32(themeName, "cycleDelay"); }
     catch { cycleDelay = 1; }
     try { cycleInterval = assetDictionary.LookupInt32(themeName, "cycleInterval"); }
     catch { cycleInterval = 1; }
     spacing = assetDictionary.LookupSingle(themeName, "spacing");
     if (assetDictionary.CheckPropertyExists(themeName, "cycleSound"))
         cycleSound = new SoundObject(assets.GetSFX(assetDictionary.LookupString(themeName, "cycleSound")));
     if (assetDictionary.CheckPropertyExists(themeName, "selectSound"))
         selectSound = new SoundObject(assets.GetSFX(assetDictionary.LookupString(themeName, "selectSound")));
     selected = false;
 }
 public BackgroundParticleSettings(AssetManager assets, int actNumber)
 {
     TextDictionary td = new TextDictionary(assets.GetText("particles"));
     string act = "act" + actNumber;
     numParticles = td.LookupInt32(act, "numParticles");
     if (numParticles > 0)
     {
         rotationRateRange = td.LookupVector2(act, "rotationRateRange");
         scaleRange = td.LookupVector2(act, "scaleRange");
         colorLow = td.LookupColor(act, "colorLow");
         colorHigh = td.LookupColor(act, "colorHigh");
         texture = assets.GetTexture(td.LookupString(act, "texture"));
         distance = td.LookupSingle(act, "dist");
     }
 }
Beispiel #3
0
        public override void Initialize(List<Option> options, AssetManager assets, string themeName)
        {
            TextDictionary assetDictionary = new TextDictionary(assets.GetText("cursor"));
            base.Initialize(options, assets, themeName);

            graphic = assets.GetTexture(assetDictionary.LookupString(themeName, "graphic"));
            try { color = new Color(assetDictionary.LookupVector4(themeName, "color")); }
            catch { color = new Color(assetDictionary.LookupVector3(themeName, "color")); }
            offset = assetDictionary.LookupVector2(themeName, "offset");
            //optional
            bool anchorParseSuccess = Enum.TryParse<Anchor>(assetDictionary.LookupString(themeName, "anchor"), out anchor);
            if (!anchorParseSuccess)
                anchor = Anchor.TopLeft;
            try { smoothness = assetDictionary.LookupSingle(themeName, "smoothness"); }
            catch { smoothness = 0f; }
        }
Beispiel #4
0
        public static ParallaxBackgroundSet Build(AssetManager assets, Camera camera, Vector2 seamstressStart, string assetName)
        {
            TextDictionary assetDictionary = new TextDictionary(assets.GetText("parallax"));
            int layers = assetDictionary.LookupInt32(assetName, "layers");
            ParallaxBackground[] backgrounds = new ParallaxBackground[layers];
            BackgroundParticleSet particles = new BackgroundParticleSet(assets, camera.Dimensions, Convert.ToInt32(assetName.Substring(3)));
            int particleLayer = -1;
            for (int i = 0; i < layers; i++)
            {
                Texture2D tex;
                if (assetDictionary.CheckPropertyExists(assetName, "name" + i))
                    tex = assets.GetTexture(assetDictionary.LookupString(assetName, "name" + i));
                else
                    tex = assets.GetTexture(assetName + "_layer" + i);
                float dist, scale;
                Vector2 offset, velocity, repeat;
                Anchor anchor;
                try { dist = assetDictionary.LookupSingle(assetName, "dist" + i); }
                catch { dist = 1; }
                try { offset = assetDictionary.LookupVector2(assetName, "offset" + i); }
                catch { offset = Vector2.Zero; }
                try { velocity = assetDictionary.LookupVector2(assetName, "velocity" + i); }
                catch { velocity = Vector2.Zero; }
                try { scale = assetDictionary.LookupSingle(assetName, "scale" + i); }
                catch { scale = 1; }
                try { repeat = assetDictionary.LookupVector2(assetName, "repeat" + i); }
                catch { repeat = new Vector2(1, 0); }
                if (!assetDictionary.CheckPropertyExists(assetName, "anchor" + i) ||
                    !Enum.TryParse<Anchor>(assetDictionary.LookupString(assetName, "anchor" + i), out anchor))
                    anchor = Anchor.BottomLeft;
                backgrounds[i] = new ParallaxBackground(assets, tex, offset, velocity, dist, scale, anchor, repeat);
                if (dist > particles.Distance)
                    particleLayer = i;
            }
            ParallaxBackgroundSet pbs = new ParallaxBackgroundSet();
            pbs.backgrounds = backgrounds;
            pbs.camera = new Camera(camera.Dimensions, camera.Position, camera.Rotation, camera.Scale);
            pbs.color = assetDictionary.LookupColor(assetName, "color");
            pbs.particleLayer = particleLayer;
            pbs.particles = particles;
            pbs.seamstressStart = seamstressStart;

            return pbs;
        }