本文整理汇总了C#中ElementType类的典型用法代码示例。如果您正苦于以下问题:C# ElementType类的具体用法?C# ElementType怎么用?C# ElementType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ElementType类属于命名空间,在下文中一共展示了ElementType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromElementType
public static MsCorLibTypeSignature FromElementType(MetadataHeader header, ElementType elementType)
{
var type = header.TypeSystem.GetMscorlibType(elementType);
if (type == null)
throw new ArgumentException("Element type " + elementType + " is not recognized as a valid corlib type signature.");
return type;
}
示例2: GetNextAction
public BattleCommand GetNextAction(Player[] party, Enemy[] allies, ElementType[] fieldEffect)
{
if (pressTheAdvantage.CanUse(fieldEffect))
{
var target = new Target { TheTarget = BehaviorHelpers.GetStrongestTarget(party), TargetType = TargetTypes.Single };
return CreateBattleCommand(target, pressTheAdvantage, CommandType.Ability);
}
if ((me.CurrentHP / (decimal)me.MaxHP) <= .5m && solarBeam.CanUse(fieldEffect))
{
var target = new Target { TheTarget = BehaviorHelpers.GetWeakestTarget(party), TargetType = TargetTypes.Single };
return CreateBattleCommand(target, solarBeam, CommandType.Ability);
}
if (party.All(p => !p.IsDead) && cleave.CanUse(fieldEffect))
{
var target = new Target { TargetType = TargetTypes.All };
return CreateBattleCommand(target, cleave, CommandType.Ability);
}
if (sliceAndDice.CanUse(fieldEffect))
{
var target = new Target { TheTarget = BehaviorHelpers.GetRandomTarget(party), TargetType = TargetTypes.Single };
return CreateBattleCommand(target, sliceAndDice, CommandType.Ability);
}
return CreateBattleCommand(new Target { TheTarget = BehaviorHelpers.GetRandomTarget(party), TargetType = TargetTypes.Single },
Ability.ATTACK,
CommandType.Attack);
}
示例3: Calculate
/// <summary>
/// Calculates perimeter for a slab.
/// </summary>
/// <param name="exporterIFC">
/// The ExporterIFC object.
/// </param>
/// <param name="extrusionCreationData">
/// The IFCExtrusionCreationData.
/// </param>
/// <param name="element">
/// The element to calculate the value.
/// </param>
/// <param name="elementType">
/// The element type.
/// </param>
/// <returns>
/// True if the operation succeed, false otherwise.
/// </returns>
public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
{
if (extrusionCreationData == null)
return false;
m_Perimeter = extrusionCreationData.ScaledOuterPerimeter;
return m_Perimeter > MathUtil.Eps();
}
示例4: Element
public Element(ElementType elementType, ElementType opposingElementName, short priority, Color buttonColor)
{
OpposingElementName = opposingElementName;
Priority = priority;
ElementType = elementType;
}
示例5: Calculate
/// <summary>
/// Calculates shape parameter B for a rebar.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC object.</param>
/// <param name="extrusionCreationData">The IFCExtrusionCreationData.</param>
/// <param name="element">The element to calculate the value.</param>
/// <param name="elementType">The element type.</param>
/// <returns>
/// True if the operation succeed, false otherwise.
/// </returns>
public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
{
bool ret = (ParameterUtil.GetDoubleValueFromElement(element, BuiltInParameterGroup.PG_GEOMETRY, "B", out m_ShapeParameterB) != null);
if (ret)
m_ShapeParameterB = m_ShapeParameterB * exporterIFC.LinearScale;
return ret;
}
示例6: InterpretData
public object InterpretData(ElementType constantType)
{
switch (constantType)
{
case ElementType.Boolean:
return Data[0] == 1;
case ElementType.Char:
return (char)BitConverter.ToUInt16(Data, 0);
case ElementType.I1:
return unchecked((sbyte)Data[0]);
case ElementType.I2:
return BitConverter.ToInt16(Data, 0);
case ElementType.I4:
return BitConverter.ToInt32(Data, 0);
case ElementType.I8:
return BitConverter.ToInt64(Data, 0);
case ElementType.U1:
return Data[0];
case ElementType.U2:
return BitConverter.ToUInt16(Data, 0);
case ElementType.U4:
return BitConverter.ToUInt32(Data, 0);
case ElementType.U8:
return BitConverter.ToUInt64(Data, 0);
case ElementType.R4:
return BitConverter.ToSingle(Data, 0);
case ElementType.R8:
return BitConverter.ToDouble(Data, 0);
case ElementType.String:
return Encoding.Unicode.GetString(Data);
case ElementType.Class:
return null;
}
throw new NotSupportedException("Unrecognized or unsupported constant type.");
}
示例7: Add
public void Add(ElementType t, string key, Element e)
{
if (string.IsNullOrEmpty(key))
{
throw new ArgumentException("Invalid object name");
}
if (m_allElements.ContainsKey(key))
{
// An element with this name already exists. This is OK if the new element
// is of the same type - then it will just override the previous element.
if (!m_elements[t].ContainsKey(key))
{
throw new Exception(string.Format(
"Element '{0}' of type '{1}' cannot override the existing element of type '{2}'",
key,
t,
m_allElements[key].ElemType));
}
// element is being overridden, so detach the event handler
m_allElements[key].Fields.NameChanged -= ElementNameChanged;
// remove old element from ordered elements list
m_elementsLists[t].Remove(m_elements[t][key]);
}
m_allElements[key] = e;
m_elements[t][key] = e;
m_elementsLists[t].Add(e);
e.Fields.NameChanged += ElementNameChanged;
}
示例8: PokemonArchetype
public PokemonArchetype(string name, int pokemonNumber, ElementType primaryType, ElementType secondaryType, string pokedexText, bool evolves,
int nextEvolutionPokemonNumber, int baseHealth, int baseAttack, int baseDefense,
int baseSpecialAttack, int baseSpecialDefense, int baseSpeed, int maxHealth, int maxAttack, int maxDefense,
int maxSpecialAttack, int maxSpecialDefense, int maxSpeed, Texture2D texture, Rectangle sourceRectangleBack,
Rectangle sourceRectangleFront, Rectangle sourceRectangleInventory1, Rectangle sourceRectangleInventory2,
ExperienceGroup experienceGroup, Dictionary<int, MoveArchetype> levelledMoves, Gender restrictedGender)
{
Name = name;
PokemonNumber = pokemonNumber;
PrimaryType = primaryType;
SecondaryType = secondaryType;
PokedexText = pokedexText;
Evolves = evolves;
NextEvolutionPokemonNumber = nextEvolutionPokemonNumber;
BaseStats.Add(Stats.Health, baseHealth);
BaseStats.Add(Stats.Defense, baseDefense);
BaseStats.Add(Stats.Attack, baseAttack);
BaseStats.Add(Stats.SpecialAttack, baseSpecialAttack);
BaseStats.Add(Stats.SpecialDefense, baseSpecialDefense);
BaseStats.Add(Stats.Speed, baseSpeed);
MaxStats.Add(Stats.Health, maxHealth);
MaxStats.Add(Stats.Defense, maxDefense);
MaxStats.Add(Stats.Attack, maxAttack);
MaxStats.Add(Stats.SpecialAttack, maxSpecialAttack);
MaxStats.Add(Stats.SpecialDefense, maxSpecialDefense);
MaxStats.Add(Stats.Speed, maxSpeed);
Texture = texture;
SourceRectangleBack = sourceRectangleBack;
SourceRectangleFront = sourceRectangleFront;
SourceRectangleInventory1 = sourceRectangleInventory1;
SourceRectangleInventory2 = sourceRectangleInventory2;
ExperienceGroup = experienceGroup;
LevelledMoves = levelledMoves;
RestrictedGender = restrictedGender;
}
示例9: VerifyBeat
bool VerifyBeat(ElementType type) {
System.DateTime inputTime = System.DateTime.Now;
float noteOfSignificanceLengthInSeconds = (float) (60 / metronome.BPM) * (float) (this.noteOfSignificance * 4);
float secondsSinceLastMeasure = (float)(inputTime - this.lastMeasure).TotalSeconds;
// ANTI-SPAM: If the user is spamming notes quicker than our "note of measure", return offbeat
if ((inputTime - this.lastInput).TotalSeconds < noteOfSignificanceLengthInSeconds) {
this.lastInput = inputTime;
//print("offBeat" + offbeats);
offbeats += 1;
ElementEvent (type, true);
return false;
}
this.lastInput = inputTime;
//How far the user's input was from falling on a noteOfSignificance, in seconds
float distanceOfUserInputFromNote = (Mathf.Abs ((float)(secondsSinceLastMeasure % 1) - noteOfSignificanceLengthInSeconds)) % noteOfSignificanceLengthInSeconds;
if (distanceOfUserInputFromNote <= inputThreshold ) {
return true;
} else {
print("offBeat" + offbeats);
offbeats += 1;
ElementEvent (type, true);
return false;
}
}
示例10: Load
public Element.Element Load(ElementType type, string name, string path = "")
{
string pth = path;
Element.Element elem;
if(pth == "") { pth = Path; }
switch (type)
{
case ElementType.Button:
elem = new Element.Button(R, pth + "elements/button.html", name);
break;
case ElementType.List:
elem = new Element.List(R, pth + "elements/list.html", name);
break;
case ElementType.Panel:
elem = new Element.Panel(R, pth + "elements/panel.html", name);
break;
case ElementType.Textbox:
elem = new Element.Textbox(R, pth + "elements/textbox.html", name);
break;
default:
elem = new Element.Element(R, pth, name);
break;
}
return elem;
}
示例11: Element
public Element(ElementData data, ElementType type)
{
Parent = null;
eType = type;
eData = data;
if(eData != null)
CurrentID = eData.ID.textureID;
Children = new List<Element>();
if (data == null)
return;
Width = eData.ImageData.Size.Width;
Height = eData.ImageData.Size.Height;
if (type == ElementType.Button)
{
ElementProperties OnClickProperty = GetProperty(data.Properties, ElementProperties.PropertyType.OnClick);
Bitmap click_img = null;
TextureID click_id = null;
if (OnClickProperty != null)
{
EventData = new ElementData[1];
EventData[0] = new ElementData(click_img, click_id, data.Properties);
EventData[0].ImageEventType = ElementEventType.MouseOver;
}
OnEvent += Element_OnEvent;
}
}
示例12: CastSpell
public void CastSpell(ElementType element, SpellType spellType) {
input.FreezeInput();
if (spellType == SpellType.Attack) {
var go = Instantiate(GameManager.Instance.attackEffcts[(int)element]);
go.name = "Spell";
go.transform.position = transform.position;
var spell = go.AddComponent<FlyingSpell>();
spell.type = spellType;
spell.element = element;
spell.ResetTo(this, target);
} else {
var go = Instantiate(GameManager.Instance.defendEffcts[(int)element]);
go.name = "Defense";
go.transform.position = transform.position;
var ds = go.AddComponent<DefenseSpell>();
ds.type = spellType;
ds.element = element;
//only one block at a time
foreach (var defense in defenses) {
Destructor.DoCleanup(defense.gameObject);
}
defenses.Clear();
defenses.Add(ds);
}
}
示例13: Element
public Element( ElementType type )
{
this.type = type;
this.atomicMass = ElementMass[type];
this.atomicNumber = (int) type;
this.symbol = Symbols[type];
}
示例14: CssHeaderStyleType
public CssHeaderStyleType(string header)
{
elements = ElementType.Unknown;
familyTag = false;
noOtherClassID = false;
tagID = "";
tagClass = "";
string k = header;
char lastChar = k[k.Length-1];
switch (lastChar)
{
case '+':
familyTag = true;
k = k.Substring(0, k.Length - 1);
break;
case '>':
noOtherClassID = true;
k = k.Substring(0, k.Length - 1);
break;
}
if (k.IndexOf('#') > -1)
tagID = Utils.ExtractAfter(ref k, '#');
if (k.IndexOf('.') > -1)
tagClass = Utils.ExtractAfter(ref k, '.');
if (k.IndexOf(':') > -1)
elements = CssHeaderStyleType.ElementsToCssElementType(
Utils.ExtractAfter(ref k, ':'));
tagName = k;
if (tagName.Trim() == "")
tagName = UnspecifiedTagName;
}
示例15: getElementValue
public static string getElementValue(this IWebElement pElement, ElementType pElementType)
{
string result;
switch (pElementType)
{
case ElementType.TextInput:
result = pElement.GetAttribute("value");
break;
case ElementType.Ddl:
result = new SelectElement(pElement).SelectedOption.Text;
break;
case ElementType.RadioBtn:
result = "";
break;
case ElementType.Btn:
result = "";
break;
case ElementType.CheckBox:
result = "";
break;
default:
result = "";
break;
}
return result;
}