Class ResourceManager
Manages a Resource value and eventually updates a Progress Bar automatically.
Inherited Members
Namespace: TetraCreations.ProgressBarSystem
Assembly: cs.temp.dll.dll
Syntax
public class ResourceManager : ValueManager
Properties
HasProgressBar
Determines if the manager has a reference to a ProgressBar.
Declaration
public bool HasProgressBar { get; }
Property Value
Type | Description |
---|---|
bool |
HasRegeneration
Determines if the manager has a reference to a ResourceRegeneration.
Declaration
public bool HasRegeneration { get; }
Property Value
Type | Description |
---|---|
bool |
ProgressBar
Returns the ProgressBar synchronized with this ResourceManager.
Declaration
public ProgressBar ProgressBar { get; protected set; }
Property Value
Type | Description |
---|---|
ProgressBar |
Regeneration
Set/Get the ResourceRegeneration component.
Declaration
public ResourceRegeneration Regeneration { get; set; }
Property Value
Type | Description |
---|---|
ResourceRegeneration |
Resource
Get / Set the current Resource being managed.
Declaration
public Resource Resource { get; set; }
Property Value
Type | Description |
---|---|
Resource |
Methods
Initialize()
Sets the initial values, initializes the ProgressBar, add ValueChangedEvent listener to update it.
Initializes the ResourceRegeneration.
Declaration
public override void Initialize()
Overrides
InitializeProgressBar()
Initialize the ProgressBar Component with the initial values and the Resource.
Declaration
protected virtual void InitializeProgressBar()
InitializeRegeneration()
Initialize the Regeneration Component if it has the same Resource.
Declaration
protected virtual void InitializeRegeneration()
OnProgressBarChanged()
Raise ProgressBarChangedEvent and pass the ProgressBar as parameter.
Declaration
protected virtual void OnProgressBarChanged()
SetProgressBar(ProgressBar)
Replace the current Progress Bar with another one.
This will call UnsetProgressBar() to remove listeners from the current ProgressBar.
Declaration
public virtual void SetProgressBar(ProgressBar progressBar)
Parameters
Type | Name | Description |
---|---|---|
ProgressBar | progressBar |
SetRegenerationProgressBar()
When the ProgressBar has changed we need to set it in the ResourceRegeneration.
Declaration
protected virtual void SetRegenerationProgressBar()
SetResourceDefaultValues()
Sets PrecisionTolerance, AllowValueIncrease, AllowValueDecrease from the Resource.
Declaration
protected virtual void SetResourceDefaultValues()
SetResourceForReferences()
Sets the Resource inisde the ProgressBar and the ResourceRegeneration.
Declaration
protected virtual void SetResourceForReferences()
UnsetProgressBar()
Remove all events listeners of the ProgressBar.
Declaration
public virtual void UnsetProgressBar()
Events
ProgressBarChangedEvent
Raised when setting a new ProgressBar
Declaration
public event EventHandler<ProgressBarChangedEventArgs> ProgressBarChangedEvent
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><ProgressBarChangedEventArgs> |