using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using Alastri.Scripting;
using Alastri.BlockModel.Engine.CustomVariables;
//block model 1 has a "parcel1" variable
public class Parcel1 : ITextCustomVariable
{
public string GetText(CustomVariablesContext context)
{
string parcel = context.T("mtype"); //block model 1 field
return ParcelResolver.Parcel(parcel);
}
}
//block model 2 has a "parcel2" variable
public class Parcel2 : ITextCustomVariable
{
public string GetText(CustomVariablesContext context)
{
string parcel = context.T("ioretype"); // block model 2 field
return ParcelResolver.Parcel(parcel);
}
}
//parcel logic is wrapped up in the static ParcelResolver class
public static class ParcelResolver
{
private static List<string> _oreList = new List<string>
{
"hg", "hg1", "bl1", "mg", "lg", "lg1", "lg2", "mw"
};
public static string Parcel(string parcel)
{
if(_oreList.Contains(parcel.ToLower())) return "ore";
else return "waste";
}
} |