/// <summary> /// Sets the primary set, which in this case is just the sprite's title. /// </summary> /// <param name="setName">The name of the set.</param> void InternalSetSet(string setName) { if (StringComparer.OrdinalIgnoreCase.Equals(_currentSet, setName)) { return; } _currentSet = setName; var grhData = GetSetGrhData(_bodyName, setName); if (grhData == null) { return; } _grh.SetGrh(grhData, AnimType.Loop, _currentTime); }
/// <summary> /// Reads the state of the object from an <see cref="IValueReader"/>. Values should be read in the exact /// same order as they were written. /// </summary> /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param> void IPersistable.ReadState(IValueReader reader) { PersistableHelper.Read(this, reader); // Manually handle the WaveNoise sprite var grhIndex = reader.ReadGrhIndex(_valueKeyWaveNoise); _waveNoise.SetGrh(grhIndex); }
/// <summary> /// Reads the state of the object from an <see cref="IValueReader"/>. Values should be read in the exact /// same order as they were written. /// </summary> /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param> public virtual void ReadState(IValueReader reader) { var grhIndex = reader.ReadGrhIndex(_grhIndexKeyName); if (!grhIndex.IsInvalid) { _grh.SetGrh(grhIndex); } PersistableHelper.Read(this, reader); }
/// <summary> /// Sets the primary set, which in this case is just the sprite's title. /// </summary> /// <param name="setName">The name of the set.</param> /// <param name="animType">The AnimType to use.</param> void InternalSetSet(string setName, AnimType animType = AnimType.Loop) { _currentSet = setName; var grhData = GetSetGrhData(_bodyName, setName); if (grhData == null) { return; } if (_bodyGrh.GrhData == grhData) { return; } _bodyGrh.SetGrh(grhData, animType, _currentTime); }
/// <summary> /// Handles initialization of the GameScreen. This will be invoked after the GameScreen has been /// completely and successfully added to the ScreenManager. It is highly recommended that you /// use this instead of the constructor. This is invoked only once. /// </summary> public override void Initialize() { base.Initialize(); PlayMusic = false; // Create the background sprite _background = new Grh(); var bgGrhData = GrhInfo.GetData("Background", "menu"); if (bgGrhData != null) _background.SetGrh(bgGrhData); else { const string errmsg = "Failed to find menu background image for screen `{0}` - background will not be drawn."; if (log.IsErrorEnabled) log.ErrorFormat(errmsg, this); Debug.Fail(string.Format(errmsg, this)); } }