Terraria 1.4.0.5 Source Code

This commit is contained in:
MikeyIsBaeYT 2021-10-26 12:45:26 -04:00
commit 05205f009e
1059 changed files with 563450 additions and 0 deletions

View file

@ -0,0 +1,28 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.CustomSky
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Terraria.Graphics.Effects
{
public abstract class CustomSky : GameEffect
{
public abstract void Update(GameTime gameTime);
public abstract void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth);
public abstract bool IsActive();
public abstract void Reset();
public virtual Color OnTileColor(Color inColor) => inColor;
public virtual float GetCloudAlpha() => 1f;
public override bool IsVisible() => true;
}
}

View file

@ -0,0 +1,69 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.EffectManager`1
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using System.Collections.Generic;
namespace Terraria.Graphics.Effects
{
public abstract class EffectManager<T> where T : GameEffect
{
protected bool _isLoaded;
protected Dictionary<string, T> _effects = new Dictionary<string, T>();
public bool IsLoaded => this._isLoaded;
public T this[string key]
{
get
{
T obj;
return this._effects.TryGetValue(key, out obj) ? obj : default (T);
}
set => this.Bind(key, value);
}
public void Bind(string name, T effect)
{
this._effects[name] = effect;
if (!this._isLoaded)
return;
effect.Load();
}
public void Load()
{
if (this._isLoaded)
return;
this._isLoaded = true;
foreach (T obj in this._effects.Values)
obj.Load();
}
public T Activate(string name, Vector2 position = default (Vector2), params object[] args)
{
T effect = this._effects.ContainsKey(name) ? this._effects[name] : throw new MissingEffectException("Unable to find effect named: " + name + ". Type: " + (object) typeof (T) + ".");
this.OnActivate(effect, position);
effect.Activate(position, args);
return effect;
}
public void Deactivate(string name, params object[] args)
{
T effect = this._effects.ContainsKey(name) ? this._effects[name] : throw new MissingEffectException("Unable to find effect named: " + name + ". Type: " + (object) typeof (T) + ".");
this.OnDeactivate(effect);
effect.Deactivate(args);
}
public virtual void OnActivate(T effect, Vector2 position)
{
}
public virtual void OnDeactivate(T effect)
{
}
}
}

View file

@ -0,0 +1,17 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.EffectPriority
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.Graphics.Effects
{
public enum EffectPriority
{
VeryLow,
Low,
Medium,
High,
VeryHigh,
}
}

View file

@ -0,0 +1,49 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.Filter
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Terraria.Graphics.Shaders;
namespace Terraria.Graphics.Effects
{
public class Filter : GameEffect
{
public bool Active;
private ScreenShaderData _shader;
public bool IsHidden;
public Filter(ScreenShaderData shader, EffectPriority priority = EffectPriority.VeryLow)
{
this._shader = shader;
this._priority = priority;
}
public void Update(GameTime gameTime)
{
this._shader.UseGlobalOpacity(this.Opacity);
this._shader.Update(gameTime);
}
public void Apply() => this._shader.Apply();
public ScreenShaderData GetShader() => this._shader;
public override void Activate(Vector2 position, params object[] args)
{
this._shader.UseGlobalOpacity(this.Opacity);
this._shader.UseTargetPosition(position);
this.Active = true;
}
public override void Deactivate(params object[] args) => this.Active = false;
public bool IsInUse() => this.Active || (double) this.Opacity > 0.0;
public bool IsActive() => this.Active;
public override bool IsVisible() => (double) this.GetShader().CombinedOpacity > 0.0 && !this.IsHidden;
}
}

View file

@ -0,0 +1,197 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.FilterManager
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using Terraria.IO;
namespace Terraria.Graphics.Effects
{
public class FilterManager : EffectManager<Filter>
{
private const float OPACITY_RATE = 1f;
private LinkedList<Filter> _activeFilters = new LinkedList<Filter>();
private int _filterLimit = 16;
private EffectPriority _priorityThreshold;
private int _activeFilterCount;
private bool _captureThisFrame;
public event Action OnPostDraw;
public FilterManager()
{
Main.Configuration.OnLoad += (Action<Preferences>) (preferences =>
{
this._filterLimit = preferences.Get<int>("FilterLimit", 16);
EffectPriority result;
if (!Enum.TryParse<EffectPriority>(preferences.Get<string>("FilterPriorityThreshold", "VeryLow"), out result))
return;
this._priorityThreshold = result;
});
Main.Configuration.OnSave += (Action<Preferences>) (preferences =>
{
preferences.Put("FilterLimit", (object) this._filterLimit);
preferences.Put("FilterPriorityThreshold", (object) Enum.GetName(typeof (EffectPriority), (object) this._priorityThreshold));
});
}
public override void OnActivate(Filter effect, Vector2 position)
{
if (this._activeFilters.Contains(effect))
{
if (effect.Active)
return;
if (effect.Priority >= this._priorityThreshold)
--this._activeFilterCount;
this._activeFilters.Remove(effect);
}
else
effect.Opacity = 0.0f;
if (effect.Priority >= this._priorityThreshold)
++this._activeFilterCount;
if (this._activeFilters.Count == 0)
{
this._activeFilters.AddLast(effect);
}
else
{
for (LinkedListNode<Filter> node = this._activeFilters.First; node != null; node = node.Next)
{
Filter filter = node.Value;
if (effect.Priority <= filter.Priority)
{
this._activeFilters.AddAfter(node, effect);
return;
}
}
this._activeFilters.AddLast(effect);
}
}
public void BeginCapture(RenderTarget2D screenTarget1, Color clearColor)
{
if (this._activeFilterCount == 0 && this.OnPostDraw == null)
{
this._captureThisFrame = false;
}
else
{
this._captureThisFrame = true;
Main.instance.GraphicsDevice.SetRenderTarget(screenTarget1);
Main.instance.GraphicsDevice.Clear(clearColor);
}
}
public void Update(GameTime gameTime)
{
LinkedListNode<Filter> node = this._activeFilters.First;
int count = this._activeFilters.Count;
int num = 0;
LinkedListNode<Filter> next;
for (; node != null; node = next)
{
Filter filter = node.Value;
next = node.Next;
bool flag = false;
if (filter.Priority >= this._priorityThreshold)
{
++num;
if (num > this._activeFilterCount - this._filterLimit)
{
filter.Update(gameTime);
flag = true;
}
}
if (filter.Active & flag)
filter.Opacity = Math.Min(filter.Opacity + (float) (gameTime.ElapsedGameTime.TotalSeconds * 1.0), 1f);
else
filter.Opacity = Math.Max(filter.Opacity - (float) (gameTime.ElapsedGameTime.TotalSeconds * 1.0), 0.0f);
if (!filter.Active && (double) filter.Opacity == 0.0)
{
if (filter.Priority >= this._priorityThreshold)
--this._activeFilterCount;
this._activeFilters.Remove(node);
}
}
}
public void EndCapture(
RenderTarget2D finalTexture,
RenderTarget2D screenTarget1,
RenderTarget2D screenTarget2,
Color clearColor)
{
if (!this._captureThisFrame)
return;
LinkedListNode<Filter> linkedListNode = this._activeFilters.First;
int count = this._activeFilters.Count;
Filter filter1 = (Filter) null;
RenderTarget2D renderTarget2D = screenTarget1;
GraphicsDevice graphicsDevice = Main.instance.GraphicsDevice;
int num = 0;
if ((double) Main.player[Main.myPlayer].gravDir == -1.0)
{
RenderTarget2D renderTarget = screenTarget2;
graphicsDevice.SetRenderTarget(renderTarget);
graphicsDevice.Clear(clearColor);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, (Effect) null, Matrix.Invert(Main.GameViewMatrix.EffectMatrix));
Main.spriteBatch.Draw((Texture2D) renderTarget2D, Vector2.Zero, Color.White);
Main.spriteBatch.End();
renderTarget2D = screenTarget2;
}
LinkedListNode<Filter> next;
for (; linkedListNode != null; linkedListNode = next)
{
Filter filter2 = linkedListNode.Value;
next = linkedListNode.Next;
if (filter2.Priority >= this._priorityThreshold)
{
++num;
if (num > this._activeFilterCount - this._filterLimit && filter2.IsVisible())
{
if (filter1 != null)
{
RenderTarget2D renderTarget = renderTarget2D != screenTarget1 ? screenTarget1 : screenTarget2;
graphicsDevice.SetRenderTarget(renderTarget);
graphicsDevice.Clear(clearColor);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
filter1.Apply();
Main.spriteBatch.Draw((Texture2D) renderTarget2D, Vector2.Zero, Main.ColorOfTheSkies);
Main.spriteBatch.End();
renderTarget2D = renderTarget2D != screenTarget1 ? screenTarget1 : screenTarget2;
}
filter1 = filter2;
}
}
}
graphicsDevice.SetRenderTarget(finalTexture);
graphicsDevice.Clear(clearColor);
if ((double) Main.player[Main.myPlayer].gravDir == -1.0)
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, (Effect) null, Main.GameViewMatrix.EffectMatrix);
else
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
if (filter1 != null)
{
filter1.Apply();
Main.spriteBatch.Draw((Texture2D) renderTarget2D, Vector2.Zero, Main.ColorOfTheSkies);
}
else
Main.spriteBatch.Draw((Texture2D) renderTarget2D, Vector2.Zero, Color.White);
Main.spriteBatch.End();
for (int index = 0; index < 8; ++index)
graphicsDevice.Textures[index] = (Texture) null;
if (this.OnPostDraw == null)
return;
this.OnPostDraw();
}
public bool HasActiveFilter() => (uint) this._activeFilters.Count > 0U;
public bool CanCapture() => this.HasActiveFilter() || this.OnPostDraw != null;
}
}

View file

@ -0,0 +1,13 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.Filters
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.Graphics.Effects
{
public static class Filters
{
public static FilterManager Scene = new FilterManager();
}
}

View file

@ -0,0 +1,39 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.GameEffect
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
namespace Terraria.Graphics.Effects
{
public abstract class GameEffect
{
public float Opacity;
protected bool _isLoaded;
protected EffectPriority _priority;
public bool IsLoaded => this._isLoaded;
public EffectPriority Priority => this._priority;
public void Load()
{
if (this._isLoaded)
return;
this._isLoaded = true;
this.OnLoad();
}
public virtual void OnLoad()
{
}
public abstract bool IsVisible();
public abstract void Activate(Vector2 position, params object[] args);
public abstract void Deactivate(params object[] args);
}
}

View file

@ -0,0 +1,18 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.MissingEffectException
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using System;
namespace Terraria.Graphics.Effects
{
public class MissingEffectException : Exception
{
public MissingEffectException(string text)
: base(text)
{
}
}
}

View file

@ -0,0 +1,29 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.Overlay
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Terraria.Graphics.Effects
{
public abstract class Overlay : GameEffect
{
public OverlayMode Mode = OverlayMode.Inactive;
private RenderLayers _layer = RenderLayers.All;
public RenderLayers Layer => this._layer;
public Overlay(EffectPriority priority, RenderLayers layer)
{
this._priority = priority;
this._layer = layer;
}
public abstract void Draw(SpriteBatch spriteBatch);
public abstract void Update(GameTime gameTime);
}
}

View file

@ -0,0 +1,113 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.OverlayManager
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
namespace Terraria.Graphics.Effects
{
public class OverlayManager : EffectManager<Overlay>
{
private const float OPACITY_RATE = 1f;
private LinkedList<Overlay>[] _activeOverlays = new LinkedList<Overlay>[Enum.GetNames(typeof (EffectPriority)).Length];
private int _overlayCount;
public OverlayManager()
{
for (int index = 0; index < this._activeOverlays.Length; ++index)
this._activeOverlays[index] = new LinkedList<Overlay>();
}
public override void OnActivate(Overlay overlay, Vector2 position)
{
LinkedList<Overlay> activeOverlay = this._activeOverlays[(int) overlay.Priority];
if (overlay.Mode == OverlayMode.FadeIn || overlay.Mode == OverlayMode.Active)
return;
if (overlay.Mode == OverlayMode.FadeOut)
{
activeOverlay.Remove(overlay);
--this._overlayCount;
}
else
overlay.Opacity = 0.0f;
if (activeOverlay.Count != 0)
{
foreach (Overlay overlay1 in activeOverlay)
overlay1.Mode = OverlayMode.FadeOut;
}
activeOverlay.AddLast(overlay);
++this._overlayCount;
}
public void Update(GameTime gameTime)
{
LinkedListNode<Overlay> next;
for (int index = 0; index < this._activeOverlays.Length; ++index)
{
for (LinkedListNode<Overlay> node = this._activeOverlays[index].First; node != null; node = next)
{
Overlay overlay = node.Value;
next = node.Next;
overlay.Update(gameTime);
switch (overlay.Mode)
{
case OverlayMode.FadeIn:
overlay.Opacity += (float) (gameTime.ElapsedGameTime.TotalSeconds * 1.0);
if ((double) overlay.Opacity >= 1.0)
{
overlay.Opacity = 1f;
overlay.Mode = OverlayMode.Active;
break;
}
break;
case OverlayMode.Active:
overlay.Opacity = Math.Min(1f, overlay.Opacity + (float) (gameTime.ElapsedGameTime.TotalSeconds * 1.0));
break;
case OverlayMode.FadeOut:
overlay.Opacity -= (float) (gameTime.ElapsedGameTime.TotalSeconds * 1.0);
if ((double) overlay.Opacity <= 0.0)
{
overlay.Opacity = 0.0f;
overlay.Mode = OverlayMode.Inactive;
this._activeOverlays[index].Remove(node);
--this._overlayCount;
break;
}
break;
}
}
}
}
public void Draw(SpriteBatch spriteBatch, RenderLayers layer)
{
if (this._overlayCount == 0)
return;
bool flag = false;
for (int index = 0; index < this._activeOverlays.Length; ++index)
{
for (LinkedListNode<Overlay> linkedListNode = this._activeOverlays[index].First; linkedListNode != null; linkedListNode = linkedListNode.Next)
{
Overlay overlay = linkedListNode.Value;
if (overlay.Layer == layer && overlay.IsVisible())
{
if (!flag)
{
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, (Effect) null, Main.Transform);
flag = true;
}
overlay.Draw(spriteBatch);
}
}
}
if (!flag)
return;
spriteBatch.End();
}
}
}

View file

@ -0,0 +1,16 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.OverlayMode
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.Graphics.Effects
{
public enum OverlayMode
{
FadeIn,
Active,
FadeOut,
Inactive,
}
}

View file

@ -0,0 +1,14 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.Overlays
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.Graphics.Effects
{
public static class Overlays
{
public static OverlayManager Scene = new OverlayManager();
public static OverlayManager FilterFallback = new OverlayManager();
}
}

View file

@ -0,0 +1,22 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.RenderLayers
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.Graphics.Effects
{
public enum RenderLayers
{
Sky,
Landscape,
Background,
InWorldUI,
BackgroundWater,
Walls,
TilesAndNPCs,
Entities,
ForegroundWater,
All,
}
}

View file

@ -0,0 +1,64 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.SimpleOverlay
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria.Graphics.Shaders;
namespace Terraria.Graphics.Effects
{
public class SimpleOverlay : Overlay
{
private Asset<Texture2D> _texture;
private ScreenShaderData _shader;
public Vector2 TargetPosition = Vector2.Zero;
public SimpleOverlay(
string textureName,
ScreenShaderData shader,
EffectPriority priority = EffectPriority.VeryLow,
RenderLayers layer = RenderLayers.All)
: base(priority, layer)
{
this._texture = Main.Assets.Request<Texture2D>(textureName == null ? "" : textureName, (AssetRequestMode) 1);
this._shader = shader;
}
public SimpleOverlay(
string textureName,
string shaderName = "Default",
EffectPriority priority = EffectPriority.VeryLow,
RenderLayers layer = RenderLayers.All)
: base(priority, layer)
{
this._texture = Main.Assets.Request<Texture2D>(textureName == null ? "" : textureName, (AssetRequestMode) 1);
this._shader = new ScreenShaderData(Main.ScreenShaderRef, shaderName);
}
public ScreenShaderData GetShader() => this._shader;
public override void Draw(SpriteBatch spriteBatch)
{
this._shader.UseGlobalOpacity(this.Opacity);
this._shader.UseTargetPosition(this.TargetPosition);
this._shader.Apply();
spriteBatch.Draw(this._texture.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.ColorOfTheSkies);
}
public override void Update(GameTime gameTime) => this._shader.Update(gameTime);
public override void Activate(Vector2 position, params object[] args)
{
this.TargetPosition = position;
this.Mode = OverlayMode.FadeIn;
}
public override void Deactivate(params object[] args) => this.Mode = OverlayMode.FadeOut;
public override bool IsVisible() => (double) this._shader.CombinedOpacity > 0.0;
}
}

View file

@ -0,0 +1,89 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.SkyManager
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Collections.Generic;
namespace Terraria.Graphics.Effects
{
public class SkyManager : EffectManager<CustomSky>
{
public static SkyManager Instance = new SkyManager();
private float _lastDepth;
private LinkedList<CustomSky> _activeSkies = new LinkedList<CustomSky>();
public void Reset()
{
foreach (CustomSky customSky in this._effects.Values)
customSky.Reset();
this._activeSkies.Clear();
}
public void Update(GameTime gameTime)
{
LinkedListNode<CustomSky> next;
for (int index = 0; index < Main.dayRate; ++index)
{
for (LinkedListNode<CustomSky> node = this._activeSkies.First; node != null; node = next)
{
CustomSky customSky = node.Value;
next = node.Next;
customSky.Update(gameTime);
if (!customSky.IsActive())
this._activeSkies.Remove(node);
}
}
}
public void Draw(SpriteBatch spriteBatch) => this.DrawDepthRange(spriteBatch, float.MinValue, float.MaxValue);
public void DrawToDepth(SpriteBatch spriteBatch, float minDepth)
{
if ((double) this._lastDepth <= (double) minDepth)
return;
this.DrawDepthRange(spriteBatch, minDepth, this._lastDepth);
this._lastDepth = minDepth;
}
public void DrawDepthRange(SpriteBatch spriteBatch, float minDepth, float maxDepth)
{
foreach (CustomSky activeSky in this._activeSkies)
activeSky.Draw(spriteBatch, minDepth, maxDepth);
}
public void DrawRemainingDepth(SpriteBatch spriteBatch)
{
this.DrawDepthRange(spriteBatch, float.MinValue, this._lastDepth);
this._lastDepth = float.MinValue;
}
public void ResetDepthTracker() => this._lastDepth = float.MaxValue;
public void SetStartingDepth(float depth) => this._lastDepth = depth;
public override void OnActivate(CustomSky effect, Vector2 position)
{
this._activeSkies.Remove(effect);
this._activeSkies.AddLast(effect);
}
public Color ProcessTileColor(Color color)
{
foreach (CustomSky activeSky in this._activeSkies)
color = activeSky.OnTileColor(color);
return color;
}
public float ProcessCloudAlpha()
{
float num = 1f;
foreach (CustomSky activeSky in this._activeSkies)
num *= activeSky.GetCloudAlpha();
return MathHelper.Clamp(num, 0.0f, 1f);
}
}
}