本文整理汇总了C#中Coroutine.Resume方法的典型用法代码示例。如果您正苦于以下问题:C# Coroutine.Resume方法的具体用法?C# Coroutine.Resume怎么用?C# Coroutine.Resume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Coroutine
的用法示例。
在下文中一共展示了Coroutine.Resume方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FetchMaterials
public static bool FetchMaterials(uint craftingId, uint qty, bool expand = false)
{
using (Core.Memory.TemporaryCacheState(false))
{
RaptureAtkUnitManager.Update();
GameObjectManager.Update();
//Check to see if we have it selected
var isKnown = (CraftingManager.CurrentRecipeId == (ushort) craftingId);
//Logging.Write(CraftingManager.CurrentRecipeId);
//It's not selected. So try and select it.
if (!isKnown)
{
var coroutine = new Coroutine(() => CraftingManager.SetRecipe(craftingId));
while (!coroutine.IsFinished)
{
Thread.Sleep(33);
coroutine.Resume();
}
}
RaptureAtkUnitManager.Update();
GameObjectManager.Update();
//Check if we've selected it again
isKnown = (CraftingManager.CurrentRecipeId == (ushort) craftingId);
//Logging.Write(isKnown);
//We know it, so we go fetch the materials
if (isKnown)
{
var recipe = CraftingManager.CurrentRecipe;
foreach (var i in recipe.Ingredients)
{
if (i.ItemId != 0) //Keep getting a 0 ID ingredient here for some reason?!
{
var iname = DataManager.GetItem(i.ItemId).EnglishName;
var totalreq = i.TotalNeeded*qty;
if (expand) //Check if we're expanding the recipe
{
var rec = Recipes.Recipes.getRecipe(iname, Core.Me.CurrentJob);
//See if we know it in current job.
if (rec.Id != 0)
{
if (FetchMaterials(rec.Id, totalreq, true))
{
Crafty.OrderForm.AddOrder(rec.Id, rec.Name, totalreq,
Recipes.Recipes.GetJob(rec.Id)); //Add it if we know it!
}
}
else if (Recipes.Recipes.getRecipe(iname).Count > 0)
//Check if we've got it on our other jobs
{
foreach (var r in Recipes.Recipes.getRecipe(iname))
{
if (FetchMaterials(r.Id, totalreq, true))
{
Crafty.OrderForm.AddOrder(r.Id, r.Name, totalreq,
Recipes.Recipes.GetJob(r.Id));
break;
}
}
}
else //Add the material if we don't know how to make it.
{
AddMaterial(iname, totalreq);
}
}
else
{
AddMaterial(iname, totalreq);
}
}
}
return true;
}
return false;
}
}