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 SingularSelector(AssetManager assets, string themeName, Vector2 position, Anchor anchor, Option option) : base(themeName, position, 0) { TextDictionary assetDictionary = new TextDictionary(assets.GetText("selector")); string optionTheme = assetDictionary.LookupString(themeName, "optionTheme"); blinkRate = assetDictionary.LookupInt32(themeName, "blinkRate"); if (assetDictionary.CheckPropertyExists(themeName, "sound")) sound = new SoundObject(assets.GetSFX(assetDictionary.LookupString(themeName, "sound"))); option.Initialize(assets, optionTheme); //this.position *= GraphicsConstants.VIEWPORT_DIMENSIONS / GraphicsConstants.DEFAULT_DIMENSIONS; this.Position -= GraphicsHelper.ComputeAnchorOrigin(anchor, option.Dimensions / GraphicsConstants.VIEWPORT_DIMENSIONS); this.option = option; IntValue = 0; timer = 0; 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"); } }
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; }