This repository has been archived by the owner on Jan 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All campaign loader tasks now inherit from the same base class
- Loading branch information
Showing
8 changed files
with
107 additions
and
16 deletions.
There are no files selected for viewing
Submodule Centrifuge.Distance
updated
from 8f2904 to 17b8e4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,64 @@ | ||
using Distance.AdventureMaker.Loader.Steps; | ||
using Centrifuge.Distance.Game; | ||
using Distance.AdventureMaker.Loader.Steps; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
namespace Distance.AdventureMaker.Loader | ||
{ | ||
public class CampaignLoaderLogic : MonoBehaviour | ||
{ | ||
private CampaignListing listing; | ||
private CampaignExtractor extractor; | ||
private CampaignReader reader; | ||
private CampaignLoader loader; | ||
|
||
public void Start() | ||
{ | ||
loader = new CampaignLoader(); | ||
} | ||
|
||
public IEnumerator Run(Task.Status status) | ||
{ | ||
foreach (LoaderTask task in loader) | ||
{ | ||
yield return Task.Wrap(task.Run(status, loader)); | ||
} | ||
} | ||
|
||
public abstract class LoaderTask | ||
{ | ||
public abstract IEnumerator Run(Task.Status status, CampaignLoader loader); | ||
} | ||
|
||
public sealed class CampaignLoader : IEnumerable<LoaderTask> | ||
{ | ||
private readonly Queue<LoaderTask> tasks; | ||
|
||
public CampaignWorkspaceSetup WorkspaceSetup { get; } | ||
|
||
public CampaignListing Listing { get; } | ||
|
||
public CampaignExtractor Extractor { get; } | ||
|
||
public CampaignImporter Importer { get; } | ||
|
||
public CampaignLoader() | ||
{ | ||
tasks = new Queue<LoaderTask>(); | ||
|
||
tasks.Enqueue(WorkspaceSetup = new CampaignWorkspaceSetup()); | ||
tasks.Enqueue(Listing = new CampaignListing()); | ||
tasks.Enqueue(Extractor = new CampaignExtractor()); | ||
tasks.Enqueue(Importer = new CampaignImporter()); | ||
} | ||
|
||
public IEnumerator<LoaderTask> GetEnumerator() | ||
{ | ||
return tasks.GetEnumerator(); | ||
} | ||
|
||
IEnumerator IEnumerable.GetEnumerator() | ||
{ | ||
return GetEnumerator(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
namespace Distance.AdventureMaker.Loader.Steps | ||
using Centrifuge.Distance.Game; | ||
using System.Collections; | ||
using static Distance.AdventureMaker.Loader.CampaignLoaderLogic; | ||
|
||
namespace Distance.AdventureMaker.Loader.Steps | ||
{ | ||
public class CampaignExtractor | ||
public class CampaignExtractor : LoaderTask | ||
{ | ||
public override IEnumerator Run(Task.Status status, CampaignLoader loader) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Centrifuge.Distance.Game; | ||
using System.Collections; | ||
using static Distance.AdventureMaker.Loader.CampaignLoaderLogic; | ||
|
||
namespace Distance.AdventureMaker.Loader.Steps | ||
{ | ||
public class CampaignImporter : LoaderTask | ||
{ | ||
public override IEnumerator Run(Task.Status status, CampaignLoader loader) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
namespace Distance.AdventureMaker.Loader.Steps | ||
using Centrifuge.Distance.Game; | ||
using System.Collections; | ||
using static Distance.AdventureMaker.Loader.CampaignLoaderLogic; | ||
|
||
namespace Distance.AdventureMaker.Loader.Steps | ||
{ | ||
public class CampaignListing | ||
public class CampaignListing : LoaderTask | ||
{ | ||
public override IEnumerator Run(Task.Status status, CampaignLoader loader) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
Distance.AdventureMaker/Loader/Steps/CampaignWorkspaceSetup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Centrifuge.Distance.Game; | ||
using System.Collections; | ||
using static Distance.AdventureMaker.Loader.CampaignLoaderLogic; | ||
|
||
namespace Distance.AdventureMaker.Loader.Steps | ||
{ | ||
public class CampaignWorkspaceSetup : LoaderTask | ||
{ | ||
public override IEnumerator Run(Task.Status status, CampaignLoader loader) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
} | ||
} |