Game Development Reference
In-Depth Information
Concept of Loading Jobs
At this point, we have an attractive splash dialog that does not provide much in
terms of processing functionality. The next thing on the agenda is to create a
mechanism where jobs can be designed and plugged into the job manager for exe-
cution. If you have not figured it out yet, we need an interface to do this!
The interface ILoadingJob is described in the following code and should be fairly
simple to understand. The StatusText property will be called by the job manager to
update progress messages. The load method takes a MethodInvoker that is used to
relay update requests back to the job manager during loading (more on this later).
The following code implements the ILoadingJob interface.
public interface ILoadingJob
{
string StatusText
{
get;
}
LoadingResult Load(MethodInvoker refreshInvoker);
}
The load method also returns a result code that indicates the success or failure of the
job. The result codes are described in the following. The values are self-explanatory,
and the job manager can handle each code in a certain way, depending on the
implementation.
public enum LoadingResult
{
Success,
Warning,
Failure
}
The success code is fairly trivial; generally, this result will be ignored and process-
ing will continue. The warning code can be used to alert the user if a potential
problem or risk is identified and leave it up to her to react to it. The error code can
be used to halt further processing and perform a rollback if desired.
Search Nedrilad ::




Custom Search