当前位置: 首页>>代码示例>>C#>>正文


C# ElementType类代码示例

本文整理汇总了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;
 }
开发者ID:JerreS,项目名称:AsmResolver,代码行数:7,代码来源:MsCorLibTypeSignature.cs

示例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);
        }
开发者ID:mildsauce45,项目名称:NowItsOurTurn,代码行数:34,代码来源:RimuldarGeneralBehavior.cs

示例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();
 }
开发者ID:whztt07,项目名称:BIM-IFC,代码行数:25,代码来源:SlabPerimeterCalculator.cs

示例4: Element

        public Element(ElementType elementType, ElementType opposingElementName, short priority, Color buttonColor)
        {
            OpposingElementName = opposingElementName;
            Priority = priority;

            ElementType = elementType;
        }
开发者ID:DaOnlyOwner,项目名称:PrototypeSuccessor,代码行数:7,代码来源:Element.cs

示例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;
 }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:17,代码来源:ISOCD3766ShapeParameterBCalculator.cs

示例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.");
 }
开发者ID:JerreS,项目名称:AsmResolver,代码行数:35,代码来源:DataBlobSignature.cs

示例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;
        }
开发者ID:JatinR,项目名称:quest,代码行数:34,代码来源:Elements.cs

示例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;
 }
开发者ID:redomex,项目名称:LevertPokemon,代码行数:35,代码来源:PokemonArchetype.cs

示例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;
		}
	}
开发者ID:dggriffin,项目名称:Rain-Rain-Ritual,代码行数:29,代码来源:InputHandler.cs

示例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;
        }
开发者ID:nhtera,项目名称:Home,代码行数:31,代码来源:Elements.cs

示例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;
     }
 }
开发者ID:Geramy,项目名称:TFAGame,代码行数:26,代码来源:Element.cs

示例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);
		}

	}
开发者ID:sirbrialliance,项目名称:2016-ggj,代码行数:31,代码来源:Wizard.cs

示例13: Element

 public Element( ElementType type )
 {
     this.type = type;
      this.atomicMass = ElementMass[type];
      this.atomicNumber = (int) type;
      this.symbol = Symbols[type];
 }
开发者ID:ghostmonk,项目名称:CSharpTutorials,代码行数:7,代码来源:Element.cs

示例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;
        }
开发者ID:sinelaw,项目名称:HtmlTextBlock,代码行数:34,代码来源:Stylelist.cs

示例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;
        }
开发者ID:s-endres,项目名称:TestCasesExample,代码行数:27,代码来源:SeleniumGetMethods.cs


注:本文中的ElementType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。