Пример #1
0
        public Element.Element Load(ElementType type, string name = "", string themePath = "")
        {
            string pth = themePath;
            Element.Element elem;
            if(pth == "") { pth = Path; }

            switch (type)
            {
                case ElementType.Button:
                    elem = new Element.Button(S, pth + "elements/button.html", name != "" ? name : "button");
                    break;

                case ElementType.List:
                    elem = new Element.List(S, pth + "elements/list.html", name != "" ? name : "list");
                    break;

                case ElementType.Panel:
                    elem = new Element.Panel(S, pth + "elements/panel.html", name != "" ? name : "panel");
                    break;

                case ElementType.Textbox:
                    elem = new Element.Textbox(S, pth + "elements/textbox.html", name != "" ? name : "textbox");
                    break;

                default:
                    elem = new Element.Element(S, pth, name);
                    break;
            }

            return elem;
        }
        /// <summary>
        /// Calculates the end hook angle 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)
        {
            RebarBendData bendData = null;
            if (element is Rebar)
                bendData = (element as Rebar).GetBendData();
            else if (element is RebarInSystem)
                bendData = (element as RebarInSystem).GetBendData();
            
            if (bendData != null)
            {
                if (bendData.HookLength1 > MathUtil.Eps())
                {
                    ElementId hookAtEndTypeId;
                    if (ParameterUtil.GetElementIdValueFromElement(element, BuiltInParameter.REBAR_ELEM_HOOK_END_TYPE, out hookAtEndTypeId) != null)
                    {
                        RebarHookType rebarHookType = element.Document.GetElement(hookAtEndTypeId) as RebarHookType;
                        if (rebarHookType != null)
                        {
							//HookAngle is measured in radians, so scale directly.
                            m_Angle = rebarHookType.HookAngle *180 / Math.PI;
                            return true;
                        }
                    }
                }
            }
            return false;
        }
 /// <summary>
 /// Calculates shape parameter A 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, "A", out m_ShapeParameterA) != null);
     if (ret)
         m_ShapeParameterA = UnitUtil.ScaleLength(m_ShapeParameterA);
     return ret;
 }
Пример #4
0
 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;
 }
Пример #5
0
 /// <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();
 }
        /// <summary>
        /// Initializes a new instance of the ClassBase class.
        /// </summary>
        /// <param name="document">
        /// The document that contains the element.
        /// </param>
        /// <param name="parent">
        /// The parent of the element.
        /// </param>
        /// <param name="type">
        /// The element type.
        /// </param>
        /// <param name="name">
        /// The name of this element.
        /// </param>
        /// <param name="header">
        /// The Xml header for this element.
        /// </param>
        /// <param name="attributes">
        /// The list of attributes attached to this element.
        /// </param>
        /// <param name="declaration">
        /// The declaration code for this element.
        /// </param>
        /// <param name="typeConstraints">
        /// The list of type constraints on the element.
        /// </param>
        /// <param name="unsafeCode">
        /// Indicates whether the element resides within a block of unsafe code.
        /// </param>
        /// <param name="generated">
        /// Indicates whether the code element was generated or written by hand.
        /// </param>
        internal ClassBase(
            CsDocument document, 
            CsElement parent, 
            ElementType type, 
            string name, 
            XmlHeader header, 
            ICollection<Attribute> attributes, 
            Declaration declaration, 
            ICollection<TypeParameterConstraintClause> typeConstraints, 
            bool unsafeCode, 
            bool generated)
            : base(document, parent, type, name, header, attributes, declaration, unsafeCode, generated)
        {
            Param.Ignore(document, parent, type, name, header, attributes, declaration, typeConstraints, unsafeCode, generated);

            this.typeConstraints = typeConstraints;

            // Set the parent of the type constraint clauses.
            if (typeConstraints != null)
            {
                Debug.Assert(typeConstraints.IsReadOnly, "The typeconstraints collection should be read-only.");

                foreach (TypeParameterConstraintClause constraint in typeConstraints)
                {
                    constraint.ParentElement = this;
                }
            }
        }
        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);
        }
Пример #8
0
 public void Read(ClrModuleReader reader)
 {
     this.Type = (ElementType)reader.Binary.ReadByte();
     byte padding = reader.Binary.ReadByte();
     this.Parent = reader.ReadCodedIndex<HasConstant>();
     this.Value = reader.ReadBlob();
 }
 /// <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;
 }
Пример #10
0
        /// <summary>
        /// Calculates temperature value for a space.
        /// </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 (!string.IsNullOrEmpty(m_Name))
            {
                string temperatureName, temperatureNameMax, temperatureNameMin;
                if (string.Compare(m_Name, "SpaceTemperatureSummer") == 0)
                {
                    temperatureName = "SpaceTemperatureSummer";
                    temperatureNameMax = "SpaceTemperatureSummerMax";
                    temperatureNameMin = "SpaceTemperatureSummerMin";
                }
                else if (string.Compare(m_Name, "SpaceTemperatureWinter") == 0)
                {
                    temperatureName = "SpaceTemperatureWinter";
                    temperatureNameMax = "SpaceTemperatureWinterMax";
                    temperatureNameMin = "SpaceTemperatureWinterMin";
                }
                else
                    return false;

                if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, temperatureName, out m_Temperature) != null)
                    return true;

                double maxValue = 0, minValue = 0;
                if ((ParameterUtil.GetDoubleValueFromElementOrSymbol(element, temperatureNameMax, out maxValue) != null) &&
                    (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, temperatureNameMin, out minValue) != null))
                {
                    m_Temperature = (maxValue + minValue) / 2.0;
                    return true;
                }
            }

            return false;
        }
Пример #11
0
        public Element(ElementType elementType, ElementType opposingElementName, short priority, Color buttonColor)
        {
            OpposingElementName = opposingElementName;
            Priority = priority;

            ElementType = elementType;
        }
Пример #12
0
 /// <summary>
 /// Calculates slope value for a beam.
 /// </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_Slope = extrusionCreationData.Slope;
     return true;
 }
Пример #13
0
        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;
        }
Пример #14
0
 private void RaiseOnTypeChange(int x, int y, ElementType newType)
 {
     if (null != OnTypeChange)
     {
         OnTypeChange(x, y, newType);
     }
 }
Пример #15
0
 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.");
 }
 /// <summary>
 /// Calculates span value for a beam.
 /// </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 || MathUtil.IsAlmostZero(extrusionCreationData.ScaledLength))
         return false;
     m_Span = extrusionCreationData.ScaledLength;
     return true;
 }
Пример #17
0
        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;
        }
Пример #18
0
 public void AddElement(ElementType type)
 {
     City city;
     if (cities.TryGetValue(this.Context.ConnectionId, out city)) {
         switch (type) {
             case ElementType.Business:
                 city.AddBusiness(1);
                 break;
             case ElementType.Electricity:
                 city.AddElectricCompany(1);
                 break;
             case ElementType.House:
                 city.AddHome(1);
                 break;
             case ElementType.Sewage:
                 city.AddSewagePlant(1);
                 break;
             case ElementType.Trash:
                 city.AddTrashIncinerator(1);
                 break;
             case ElementType.Water:
                 city.AddWaterTower(1);
                 break;
             default:
                 break;
         }
     }
 }
Пример #19
0
 private void SpecialMove(List<Player> targets)
 {
     foreach (Player t in targets) {//changes the element of the character randomly before attacking each target.
         element = RandomElement ();
         PrimaryMove (t);
     }
 }
Пример #20
0
    public CartoElement(Combinator combinator, Node value)
      : base(combinator, value)
    {
      string strValue = value.ToString().Trim();

      if (string.IsNullOrEmpty(strValue))
      {
        m_type = ElementType.Unknown;
        if (strValue != null)
          Value = "\"\"";
      }
      else if (strValue[0] == '#')
      {
        Value = strValue.Remove(0, 1);
        m_type = ElementType.Id;
      }
      else if (strValue[0] == '.')
      {
        Value = strValue.Remove(0, 1);
        m_type = ElementType.Class;
      }
      else if (strValue.Contains('*'))
      {
        m_type = ElementType.Wildchar;
      }
    }
Пример #21
0
 public Query(IWebDriver browser, ElementType selector, SelectorType locator = SelectorType.XPath, string text = null)
 {
     _browser = browser;
     Selector = selector.GetStringValue();
     Locator = locator;
     Text = text;
 }
        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;
        }
Пример #23
0
	// Update is called once per frame
	void Update ()
    {
        if(matchPossible == true)
        {
            // call match check here and allow the game to look for potential matches 
            matchCheck();
        }

        if (matchFound)
        {
            for(int i = 0; i < gList.Count; i++)
            {
                if(gList[i].isMatched == true)
                {
                    // just set the type as the gem type
                    t = gList[i].typ;

                    // Reposition the matched units and then change their type and color to allow for randomization
                    gList[i].typ = GameManager.GetRandomType();
                    gList[i].SetColor();
                    gList[i].transform.position = new Vector3(gList[i].transform.position.x, gList[i].transform.position.y + AboveGrid, gList[i].transform.position.z);
                    gList[i].GetComponent<Rigidbody2D>().gravityScale = 1;
                    gList[i].GetComponent<Rigidbody2D>().isKinematic = false;

                }
                //gList[i].GetComponent<Rigidbody>().useGravity = false;
                //gList[i].GetComponent<Rigidbody>().isKinematic = true;
            }
            Debug.Log(t);

            matchFound = false;
        }
	}
Пример #24
0
	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;
		}
	}
Пример #25
0
        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;
        }
Пример #26
0
	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);
		}

	}
Пример #27
0
 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;
     }
 }
Пример #28
0
 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;
 }
Пример #29
0
 public Element( ElementType type )
 {
     this.type = type;
      this.atomicMass = ElementMass[type];
      this.atomicNumber = (int) type;
      this.symbol = Symbols[type];
 }
Пример #30
0
 /// <summary>
 /// Calculates width 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_Width = extrusionCreationData.ScaledLength;
     return m_Width > MathUtil.Eps();
 }
Пример #31
0
 void Write(ElementType et)
 {
     Write((int)et);
 }
Пример #32
0
        private void OutputPolymesh(ElementType elementType, int polySize)
        {
            MeshUtils.Vertex v;
            MeshUtils.Face   f;
            MeshUtils.Edge   edge;
            int maxFaceCount = 0;
            int maxVertexCount = 0;
            int faceVerts, i;

            if (polySize < 3)
            {
                polySize = 3;
            }
            // Assume that the input data is triangles now.
            // Try to merge as many polygons as possible
            if (polySize > 3)
            {
                _mesh.MergeConvexFaces(_pool, polySize);
            }

            // Mark unused
            for (v = _mesh._vHead._next; v != _mesh._vHead; v = v._next)
            {
                v._n = MeshUtils.Undef;
            }

            // Create unique IDs for all vertices and faces.
            for (f = _mesh._fHead._next; f != _mesh._fHead; f = f._next)
            {
                f._n = MeshUtils.Undef;
                if (!f._inside)
                {
                    continue;
                }

                if (NoEmptyPolygons)
                {
                    var area = MeshUtils.FaceArea(f);
                    if (Math.Abs(area) < Real.Epsilon)
                    {
                        continue;
                    }
                }

                edge      = f._anEdge;
                faceVerts = 0;
                do
                {
                    v = edge._Org;
                    if (v._n == MeshUtils.Undef)
                    {
                        v._n = maxVertexCount;
                        maxVertexCount++;
                    }
                    faceVerts++;
                    edge = edge._Lnext;
                }while (edge != f._anEdge);

                Debug.Assert(faceVerts <= polySize);

                f._n = maxFaceCount;
                ++maxFaceCount;
            }

            _elementCount = maxFaceCount;
            if (elementType == ElementType.ConnectedPolygons)
            {
                maxFaceCount *= 2;
            }
            _elements = new int[maxFaceCount * polySize];

            _vertexCount = maxVertexCount;
            _vertices    = new ContourVertex[_vertexCount];

            // Output vertices.
            for (v = _mesh._vHead._next; v != _mesh._vHead; v = v._next)
            {
                if (v._n != MeshUtils.Undef)
                {
                    // Store coordinate
                    _vertices[v._n].Position = v._coords;
                    _vertices[v._n].Data     = v._data;
                }
            }

            // Output indices.
            int elementIndex = 0;

            for (f = _mesh._fHead._next; f != _mesh._fHead; f = f._next)
            {
                if (!f._inside)
                {
                    continue;
                }

                if (NoEmptyPolygons)
                {
                    var area = MeshUtils.FaceArea(f);
                    if (Math.Abs(area) < Real.Epsilon)
                    {
                        continue;
                    }
                }

                // Store polygon
                edge      = f._anEdge;
                faceVerts = 0;
                do
                {
                    v = edge._Org;
                    _elements[elementIndex++] = v._n;
                    faceVerts++;
                    edge = edge._Lnext;
                } while (edge != f._anEdge);
                // Fill unused.
                for (i = faceVerts; i < polySize; ++i)
                {
                    _elements[elementIndex++] = MeshUtils.Undef;
                }

                // Store polygon connectivity
                if (elementType == ElementType.ConnectedPolygons)
                {
                    edge = f._anEdge;
                    do
                    {
                        _elements[elementIndex++] = GetNeighbourFace(edge);
                        edge = edge._Lnext;
                    } while (edge != f._anEdge);
                    // Fill unused.
                    for (i = faceVerts; i < polySize; ++i)
                    {
                        _elements[elementIndex++] = MeshUtils.Undef;
                    }
                }
            }
        }
Пример #33
0
    public void InitCharacter(Character c)
    {
        //base character info
        m_baseCharacterData = c;

        //sprite & animations
        SpriteRenderer spriteRenderer = gameObject.GetComponent <SpriteRenderer>() as SpriteRenderer;

        spriteRenderer.sprite = c.sprite;

        Animator animator = gameObject.GetComponent <Animator>() as Animator;

        animator.runtimeAnimatorController = (RuntimeAnimatorController)c.idleAnimation;

        //element
        m_element = c.element;

        //attack type
        m_attackType = c.defaultAttackType;

        //stats
        m_stats = new Stat[System.Enum.GetValues(typeof(StatType)).Length];
        for (int i = 0; i < m_stats.Length; i++)
        {
            m_stats[i] = gameObject.AddComponent <Stat>() as Stat;
            m_stats[i].InitStat((StatType)i, c.baseStats[i], c.growingRatios[i]);
        }

        //damage
        m_damage = 0.0;

        //equipments
        m_weapon = null;
        Equip(c.weapon);
        m_armor = null;
        Equip(c.armor);
        m_accessory = null;
        Equip(c.accessory);
        m_garment = null;
        Equip(c.garment);

        //inventory
        m_inventory = new Item[Constants.MAX_InventorySize];
        foreach (Item i in c.inventory)
        {
            AddItem(i);
        }

        //keys
        m_keys = new int[System.Enum.GetValues(typeof(ElementType)).Length];
        for (int i = 0; i < m_keys.Length; i++)
        {
            m_keys[i] = 0;
        }

        //stones
        m_stones = new int[System.Enum.GetValues(typeof(ElementType)).Length];
        m_stones[(int)m_element] += 1;

        m_money = 0;

        //abilities
        m_abilities = new List <Ability>();
        foreach (Ability a in c.abilities)
        {
            AddAbility(a);
        }

        //effects
        m_activeEffects = new List <Effect>();

        //check static abilities activation
        AbilityManager.CheckStaticAbilitiesActivation(this);
    }
Пример #34
0
        private string ParameterValue(Parameter p)
        {
            test.p = p;

            string storageType = p.StorageType.ToString();
            string result      = (p.AsValueString() ?? "").Trim();

            if (string.IsNullOrWhiteSpace(result))
            {
                switch (p.StorageType)
                {
                case StorageType.Double:
                {
                    storageType = "double";
                    result      = p.AsValueString();
                    break;
                }

                case StorageType.ElementId:
                {
                    storageType = "element id";
                    ElementId id = new ElementId(p.AsElementId().IntegerValue);
                    Element   e  = _doc.GetElement(id);

                    result = e?.Name ?? "Null Element";
                    break;
                }

                case StorageType.Integer:
                {
                    storageType = "integer";
                    result      = p.AsInteger().ToString();
                    break;
                }

                case StorageType.None:
                {
                    storageType = "none";
                    result      = p.AsValueString();
                    break;
                }

                case StorageType.String:
                {
                    storageType = "string";
                    result      = p.AsString();
                    break;
                }
                }
            }


            if (p.StorageType == StorageType.ElementId && !firstPass[firstPassItem])
            {
                ElementArray ea = GetSimilarForElement(p.AsElementId());

                ElementType et = _doc.GetElement(p.AsElementId()) as ElementType;

                if (ea != null)
                {
                    firstPass[firstPassItem++] = true;

                    logMsgDbLn2("getting similar", et.Name + " :: " + et.FamilyName);

                    foreach (Element e in ea)
                    {
                        logMsgDbLn2("type", e.Name);
                    }
                }
            }

            UnitType      u  = UnitType.UT_Undefined;
            ParameterType pt = ParameterType.Acceleration;


            result  = result.PadRight(18);
            result += " :: " + storageType.ToString().PadRight(PAD_RIGHT);


            //not valid info
            result += " :: " + p.IsReadOnly.ToString().PadRight(PAD_RIGHT);

            // not valid info
            //			result += " :: " + p.UserModifiable.ToString().PadRight(PAD_RIGHT);

            // valid info
            //			result += " :: " + p.HasValue.ToString().PadRight(PAD_RIGHT);

            result += " :: " + p.Definition.ParameterType.ToString().PadRight(PAD_RIGHT);
            result += " :: " + p.Definition.UnitType.ToString().PadRight(PAD_RIGHT);


            try
            {
                result += " :: " + p.DisplayUnitType.ToString().PadRight(PAD_RIGHT + 6);
            }
            catch
            {
                result += " :: " + "(no unit type)".PadRight(PAD_RIGHT + 6);
            }

            result += " :: " + p.Definition.ParameterGroup.ToString().PadRight(PAD_RIGHT);


            return(result);
        }
Пример #35
0
 /// <summary>
 /// Initializes a new instance of the <code>ElementDescriptor</code> class.
 /// </summary>
 /// <param name="identifier"></param>
 /// <param name="name"></param>
 /// <param name="type"></param>
 public ElementDescriptor(long identifier, string name, ElementType type)
     : this(VInt.FromEncoded((ulong)identifier), name, type)
 {
 }
Пример #36
0
 /// <summary>
 /// Creates a new tag info with basic parameters.
 /// </summary>
 /// <param name="tagName"></param>
 /// <param name="flags"></param>
 /// <param name="innerWhiteSpace"></param>
 /// <param name="followingWhiteSpace"></param>
 /// <param name="type"></param>
 public AspTagInfo(string tagName, FormattingFlags flags, WhiteSpaceType innerWhiteSpace, WhiteSpaceType followingWhiteSpace, ElementType type)
 {
     SetTagName(tagName);
     _inner     = innerWhiteSpace;
     _following = followingWhiteSpace;
     _flags     = flags;
     _type      = type;
 }
Пример #37
0
 /// <summary>
 /// Creates a new tag info with basic parameters.
 /// </summary>
 /// <param name="tagName"></param>
 /// <param name="flags"></param>
 /// <param name="type"></param>
 public AspTagInfo(string tagName, FormattingFlags flags, ElementType type) : this(tagName, flags, WhiteSpaceType.CarryThrough, WhiteSpaceType.CarryThrough, type)
 {
 }
Пример #38
0
 public PathResult(ElementType element, float cost, ElementType[] path)
 {
     this.element = element;
     this.cost    = cost;
     this.path    = path;
 }
        /// <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 = UnitUtil.ScaleLength(m_ShapeParameterB);
            }
            return(ret);
        }
Пример #40
0
 public Node(Node parent, ElementType element, float givenCost)
 {
     this.parent    = parent;
     this.element   = element;
     this.givenCost = givenCost;
 }
Пример #41
0
 protected abstract DataFieldVM CreateEnumUnderlyingTypeField(ElementType elementType);
Пример #42
0
        internal string GetCnValue()
        {
            string givenName   = null;
            string surName     = null;
            string accountName = null;

            foreach (var property in ElementType.GetProperties())
            {
                var attr = property.GetAttribute <DirectoryPropertyAttribute>();

                if (attr == null)
                {
                    continue;
                }

                switch ((attr.Name ?? string.Empty).ToLower())
                {
                case "cn":
                {
                    return(Convert.ToString(property.GetValue(this, null)));
                }

                case "name":
                {
                    return(Convert.ToString(property.GetValue(this, null)));
                }

                case "samaccountname":
                {
                    accountName = Convert.ToString(property.GetValue(this, null));
                    break;
                }

                case "givenname":
                {
                    givenName = Convert.ToString(property.GetValue(this, null));
                    break;
                }

                case "sn":
                {
                    surName = Convert.ToString(property.GetValue(this, null));
                    break;
                }

                default:
                {
                    continue;
                }
                }

                if (!string.IsNullOrEmpty(accountName))
                {
                    return(accountName);
                }

                if (!string.IsNullOrEmpty(givenName) && !string.IsNullOrEmpty(surName))
                {
                    break;
                }
            }

            return(string.Concat(givenName, " ", surName));
        }
Пример #43
0
        /// <summary>
        /// Calculates load bearing value for a wall.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="calcValues">
        /// 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)
        {
            Wall wall = element as Wall;

            if (wall != null)
            {
                m_LoadBearing = wall.StructuralUsage == StructuralWallUsage.Bearing;
            }
            return(true);
        }
Пример #44
0
        /// <summary>
        /// Calculates number of risers for a stair.
        /// </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, EntryMap entryMap)
        {
            bool valid = true;

            if (StairsExporter.IsLegacyStairs(element))
            {
                double treadLength, treadLengthAtInnerSide, nosingLength, waistThickness = 0;
                int    numberOfRisers, numberOfTreads = 0;
                ExporterIFCUtils.GetLegacyStairsProperties(exporterIFC, element,
                                                           out numberOfRisers, out numberOfTreads,
                                                           out m_RiserHeight, out treadLength, out treadLengthAtInnerSide,
                                                           out nosingLength, out waistThickness);
            }
            else if (element is Stairs)
            {
                Stairs stairs = element as Stairs;
                m_RiserHeight = UnitUtil.ScaleLength(stairs.ActualRiserHeight);
            }
            else if (element is StairsRun)
            {
                StairsRun     stairsRun     = element as StairsRun;
                StairsRunType stairsRunType = stairsRun.Document.GetElement(stairsRun.GetTypeId()) as StairsRunType;
                m_RiserHeight = UnitUtil.ScaleLength(stairsRun.Height / stairsRun.ActualRisersNumber);
            }
            else
            {
                valid = false;
            }

            // Get override from parameter
            double riserHeightOverride = 0.0;

            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.RevitParameterName, out riserHeightOverride) != null ||
                ParameterUtil.GetDoubleValueFromElementOrSymbol(element, entryMap.CompatibleRevitParameterName, out riserHeightOverride) != null)
            {
                m_RiserHeight = UnitUtil.ScaleArea(riserHeightOverride);
            }

            return(valid);
        }
Пример #45
0
        /// <summary>
        /// Exports an element as IFC railing.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="element">
        /// The element to be exported.
        /// </param>
        /// <param name="geometryElement">
        /// The geometry element.
        /// </param>
        /// <param name="productWrapper">
        /// The ProductWrapper.
        /// </param>
        public static void ExportRailing(ExporterIFC exporterIFC, Element element, GeometryElement geomElem, string ifcEnumType, ProductWrapper productWrapper)
        {
            ElementType elemType    = element.Document.GetElement(element.GetTypeId()) as ElementType;
            IFCFile     file        = exporterIFC.GetFile();
            Options     geomOptions = GeometryUtil.GetIFCExportGeometryOptions();

            using (IFCTransaction transaction = new IFCTransaction(file))
            {
                using (PlacementSetter setter = PlacementSetter.Create(exporterIFC, element))
                {
                    using (IFCExtrusionCreationData ecData = new IFCExtrusionCreationData())
                    {
                        IFCAnyHandle           localPlacement = setter.LocalPlacement;
                        StairRampContainerInfo stairRampInfo  = null;
                        ElementId hostId     = GetStairOrRampHostId(exporterIFC, element as Railing);
                        Transform inverseTrf = Transform.Identity;
                        if (hostId != ElementId.InvalidElementId)
                        {
                            stairRampInfo = ExporterCacheManager.StairRampContainerInfoCache.GetStairRampContainerInfo(hostId);
                            IFCAnyHandle stairRampLocalPlacement = stairRampInfo.LocalPlacements[0];
                            Transform    relTrf = ExporterIFCUtils.GetRelativeLocalPlacementOffsetTransform(stairRampLocalPlacement, localPlacement);
                            inverseTrf = relTrf.Inverse;

                            IFCAnyHandle railingLocalPlacement = ExporterUtil.CreateLocalPlacement(file, stairRampLocalPlacement,
                                                                                                   inverseTrf.Origin, inverseTrf.BasisZ, inverseTrf.BasisX);
                            localPlacement = railingLocalPlacement;
                        }
                        ecData.SetLocalPlacement(localPlacement);

                        SolidMeshGeometryInfo solidMeshInfo = GeometryUtil.GetSplitSolidMeshGeometry(geomElem);
                        IList <Solid>         solids        = solidMeshInfo.GetSolids();
                        IList <Mesh>          meshes        = solidMeshInfo.GetMeshes();

                        Railing           railingElem   = element as Railing;
                        IList <ElementId> subElementIds = CollectSubElements(railingElem);

                        foreach (ElementId subElementId in subElementIds)
                        {
                            Element subElement = railingElem.Document.GetElement(subElementId);
                            if (subElement != null)
                            {
                                GeometryElement subElementGeom = GeometryUtil.GetOneLevelGeometryElement(subElement.get_Geometry(geomOptions), 0);

                                SolidMeshGeometryInfo subElementSolidMeshInfo = GeometryUtil.GetSplitSolidMeshGeometry(subElementGeom);
                                IList <Solid>         subElementSolids        = subElementSolidMeshInfo.GetSolids();
                                IList <Mesh>          subElementMeshes        = subElementSolidMeshInfo.GetMeshes();
                                foreach (Solid subElementSolid in subElementSolids)
                                {
                                    solids.Add(subElementSolid);
                                }
                                foreach (Mesh subElementMesh in subElementMeshes)
                                {
                                    meshes.Add(subElementMesh);
                                }
                            }
                        }

                        ElementId           catId               = CategoryUtil.GetSafeCategoryId(element);
                        BodyData            bodyData            = null;
                        BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true, ExportOptionsCache.ExportTessellationLevel.Medium);
                        //bodyExporterOptions.UseGroupsIfPossible = true;
                        //bodyExporterOptions.UseMappedGeometriesIfPossible = true;

                        if (solids.Count > 0 || meshes.Count > 0)
                        {
                            bodyData = BodyExporter.ExportBody(exporterIFC, element, catId, ElementId.InvalidElementId, solids, meshes, bodyExporterOptions, ecData);
                        }
                        else
                        {
                            IList <GeometryObject> geomlist = new List <GeometryObject>();
                            geomlist.Add(geomElem);
                            bodyData = BodyExporter.ExportBody(exporterIFC, element, catId, ElementId.InvalidElementId, geomlist, bodyExporterOptions, ecData);
                        }

                        IFCAnyHandle bodyRep = bodyData.RepresentationHnd;
                        if (IFCAnyHandleUtil.IsNullOrHasNoValue(bodyRep))
                        {
                            if (ecData != null)
                            {
                                ecData.ClearOpenings();
                            }
                            return;
                        }

                        IList <IFCAnyHandle> representations = new List <IFCAnyHandle>();
                        representations.Add(bodyRep);

                        IList <GeometryObject> geomObjects = new List <GeometryObject>();
                        foreach (Solid solid in solids)
                        {
                            geomObjects.Add(solid);
                        }
                        foreach (Mesh mesh in meshes)
                        {
                            geomObjects.Add(mesh);
                        }

                        Transform boundingBoxTrf = (bodyData.OffsetTransform != null) ? bodyData.OffsetTransform.Inverse : Transform.Identity;
                        boundingBoxTrf = inverseTrf.Multiply(boundingBoxTrf);
                        IFCAnyHandle boundingBoxRep = BoundingBoxExporter.ExportBoundingBox(exporterIFC, geomObjects, boundingBoxTrf);
                        if (boundingBoxRep != null)
                        {
                            representations.Add(boundingBoxRep);
                        }

                        IFCAnyHandle prodRep = IFCInstanceExporter.CreateProductDefinitionShape(file, null, null, representations);

                        IFCAnyHandle ownerHistory = ExporterCacheManager.OwnerHistoryHandle;

                        string instanceGUID        = GUIDUtil.CreateGUID(element);
                        string instanceName        = NamingUtil.GetNameOverride(element, NamingUtil.GetIFCName(element));
                        string instanceDescription = NamingUtil.GetDescriptionOverride(element, null);
                        string instanceObjectType  = NamingUtil.GetObjectTypeOverride(element, exporterIFC.GetFamilyName());
                        string instanceTag         = NamingUtil.GetTagOverride(element, NamingUtil.CreateIFCElementId(element));

                        string railingType = IFCValidateEntry.GetValidIFCType(element, ifcEnumType);

                        IFCAnyHandle railing = IFCInstanceExporter.CreateRailing(file, instanceGUID, ownerHistory,
                                                                                 instanceName, instanceDescription, instanceObjectType, ecData.GetLocalPlacement(),
                                                                                 prodRep, instanceTag, railingType);

                        bool associateToLevel = (hostId == ElementId.InvalidElementId);

                        productWrapper.AddElement(element, railing, setter, ecData, associateToLevel);
                        OpeningUtil.CreateOpeningsIfNecessary(railing, element, ecData, bodyData.OffsetTransform,
                                                              exporterIFC, ecData.GetLocalPlacement(), setter, productWrapper);

                        CategoryUtil.CreateMaterialAssociation(exporterIFC, railing, bodyData.MaterialIds);

                        // Create multi-story duplicates of this railing.
                        if (stairRampInfo != null)
                        {
                            stairRampInfo.AddComponent(0, railing);

                            List <IFCAnyHandle> stairHandles = stairRampInfo.StairOrRampHandles;
                            for (int ii = 1; ii < stairHandles.Count; ii++)
                            {
                                IFCAnyHandle railingLocalPlacement = stairRampInfo.LocalPlacements[ii];
                                if (!IFCAnyHandleUtil.IsNullOrHasNoValue(railingLocalPlacement))
                                {
                                    IFCAnyHandle railingHndCopy = CopyRailingHandle(exporterIFC, element, catId, railingLocalPlacement, railing);
                                    stairRampInfo.AddComponent(ii, railingHndCopy);
                                    productWrapper.AddElement(element, railingHndCopy, (IFCLevelInfo)null, ecData, false);
                                    CategoryUtil.CreateMaterialAssociation(exporterIFC, railingHndCopy, bodyData.MaterialIds);
                                }
                            }

                            ExporterCacheManager.StairRampContainerInfoCache.AddStairRampContainerInfo(hostId, stairRampInfo);
                        }
                    }
                    transaction.Commit();
                }
            }
        }
Пример #46
0
        Stream(ArrayList data, ElementType sym)
        {
            data.Add(new Snoop.Data.ClassSeparator(typeof(ElementType)));

            // no data at this level yet

            AnnotationSymbolType annoType = sym as AnnotationSymbolType;

            if (annoType != null)
            {
                Stream(data, annoType);
                return;
            }

            AreaReinforcementType areaReinforcementType = sym as AreaReinforcementType;

            if (areaReinforcementType != null)
            {
                Stream(data, areaReinforcementType);
                return;
            }

            AreaTagType areaTagType = sym as AreaTagType;

            if (areaTagType != null)
            {
                Stream(data, areaTagType);
                return;
            }

            BeamSystemType beamSystemType = sym as BeamSystemType;

            if (beamSystemType != null)
            {
                Stream(data, beamSystemType);
                return;
            }

            DimensionType dimType = sym as DimensionType;

            if (dimType != null)
            {
                Stream(data, dimType);
                return;
            }

            //TF
            FabricSheetType fabricST = sym as FabricSheetType;

            if (fabricST != null)
            {
                Stream(data, fabricST);
                return;
            }

            FabricWireType fabricWT = sym as FabricWireType;

            if (fabricWT != null)
            {
                Stream(data, fabricWT);
                return;
            }
            //TFEND

            GroupType groupType = sym as GroupType;

            if (groupType != null)
            {
                Stream(data, groupType);
                return;
            }

            HostObjAttributes hostAtt = sym as HostObjAttributes;

            if (hostAtt != null)
            {
                Stream(data, hostAtt);
                return;
            }

            InsertableObject insObj = sym as InsertableObject;

            if (insObj != null)
            {
                Stream(data, insObj);
                return;
            }

            LevelType levelType = sym as LevelType;

            if (levelType != null)
            {
                Stream(data, levelType);
                return;
            }

            LineAndTextAttrSymbol lineAndTextAttr = sym as LineAndTextAttrSymbol;

            if (lineAndTextAttr != null)
            {
                Stream(data, lineAndTextAttr);
                return;
            }

            LoadTypeBase loadTypeBase = sym as LoadTypeBase;

            if (loadTypeBase != null)
            {
                Stream(data, loadTypeBase);
                return;
            }

            MEPBuildingConstruction mepBldConst = sym as MEPBuildingConstruction;

            if (mepBldConst != null)
            {
                Stream(data, mepBldConst);
                return;
            }

            PathReinforcementType pathReinforcementType = sym as PathReinforcementType;

            if (pathReinforcementType != null)
            {
                Stream(data, pathReinforcementType);
                return;
            }

            RebarBarType rebarBarType = sym as RebarBarType;

            if (rebarBarType != null)
            {
                Stream(data, rebarBarType);
                return;
            }

            RebarCoverType rebarCoverType = sym as RebarCoverType;

            if (rebarCoverType != null)
            {
                Stream(data, rebarCoverType);
                return;
            }

            RebarHookType rebarHookType = sym as RebarHookType;

            if (rebarHookType != null)
            {
                Stream(data, rebarHookType);
                return;
            }

            RebarShape rebarShape = sym as RebarShape;

            if (rebarShape != null)
            {
                Stream(data, rebarShape);
                return;
            }

            RoomTagType roomTagType = sym as RoomTagType;

            if (roomTagType != null)
            {
                Stream(data, roomTagType);
                return;
            }

            SpaceTagType spaceTagType = sym as SpaceTagType;

            if (spaceTagType != null)
            {
                Stream(data, spaceTagType);
                return;
            }

            TrussType trussType = sym as TrussType;

            if (trussType != null)
            {
                Stream(data, trussType);
                return;
            }

            DistributionSysType distSysType = sym as DistributionSysType;

            if (distSysType != null)
            {
                Stream(data, distSysType);
                return;
            }

            MEPCurveType mepCurType = sym as MEPCurveType;

            if (mepCurType != null)
            {
                Stream(data, mepCurType);
                return;
            }

            FluidType fluidType = sym as FluidType;

            if (fluidType != null)
            {
                Stream(data, fluidType);
                return;
            }

            PipeScheduleType pipeSchedType = sym as PipeScheduleType;

            if (pipeSchedType != null)
            {
                Stream(data, pipeSchedType);
                return;
            }

            VoltageType voltType = sym as VoltageType;

            if (voltType != null)
            {
                Stream(data, voltType);
                return;
            }

            WireType wireType = sym as WireType;

            if (wireType != null)
            {
                Stream(data, wireType);
                return;
            }

            ModelTextType modelTxtType = sym as ModelTextType;

            if (modelTxtType != null)
            {
                Stream(data, modelTxtType);
                return;
            }
        }
Пример #47
0
 public FireElve(CardType cardType, ElementType element, int cardDamage, string cardName, CardProperty cardProperty, int cardId)
     : base(cardType, element, cardDamage, cardName, cardProperty, cardId)
 {
 }
Пример #48
0
        /// <summary>
        /// Create a Gutter.
        /// </summary>
        /// <param name="symbol">Gutter type</param>
        /// <param name="refArr">Gutter Reference array</param>
        /// <returns>Created Gutter</returns>
        protected override HostedSweep CreateHostedSweep(ElementType symbol, ReferenceArray refArr)
        {
            Gutter gutter = m_rvtDoc.Create.NewGutter(symbol as GutterType, refArr);

            return(gutter);
        }
Пример #49
0
 public bool HasElement(ElementType element, int number)
 {
     return(elementsInventory.ContainsKey(element) && elementsInventory [element] >= number);
 }
Пример #50
0
 public override int GetHashCode() =>
 ElementType.GetHashCode() ^ NumElements.GetHashCode();
Пример #51
0
 public Player(int id, string name, string desc, float hp, int speed, int attack, int defence, int level, int power, AblityTypes type, ElementType etype, float currentHealth)
 {
     this.ID          = id;
     this.Name        = name;
     this.Description = desc;
     this.HP          = hp;
     this.Speed       = speed;
     this.Attack      = attack;
     this.Defence     = defence;
     this.Level       = level;
     this.Power       = power;
     this.Type        = type;
     this.Etype       = etype;
 }
Пример #52
0
    void AttackAlgo(int row, int col, ElementType elementType, float dam)
    {
        TerrainType terrainType = CanvasUI.battleBoxes[row, col].GetTerrainType;

        if (CardManager.Instance.elementToTerrainType[elementType] == terrainType)//同类属性无伤害
        {
            AnimationManager.Instance.PlayDefenseAnime(CanvasUI.battleBoxes[row, col].transform.position);
            AudioManager.Instance.PlayVoice(defenseSoundEffect);
        }
        else if (CardManager.Instance.restraintTable[elementType] == terrainType)//克制属性正常伤害
        {
            AnimationManager.Instance.PlayAttackAnime(elementType, dam, CanvasUI.battleBoxes[row, col].transform.position);
            CheckBoxWithDamge(row, col, dam, elementType);
            //遍历行检测同属性
            for (int i = row - 1; i >= 0; i--)
            {
                if (terrainType == CanvasUI.battleBoxes[i, col].GetTerrainType)
                {
                    AnimationManager.Instance.PlayAttackAnime(elementType, dam, CanvasUI.battleBoxes[i, col].transform.position);
                    CheckBoxWithDamge(i, col, dam, elementType);
                }
                else
                {
                    break;
                }
            }
            for (int i = row + 1; i < 3; i++)
            {
                if (terrainType == CanvasUI.battleBoxes[i, col].GetTerrainType)
                {
                    AnimationManager.Instance.PlayAttackAnime(elementType, dam, CanvasUI.battleBoxes[i, col].transform.position);
                    CheckBoxWithDamge(i, col, dam, elementType);
                }
                else
                {
                    break;
                }
            }
            //遍历列检测同属性
            for (int j = col - 1; j >= 0; j--)
            {
                if (terrainType == CanvasUI.battleBoxes[row, j].GetTerrainType)
                {
                    AnimationManager.Instance.PlayAttackAnime(elementType, dam, CanvasUI.battleBoxes[row, j].transform.position);
                    CheckBoxWithDamge(row, j, dam, elementType);
                }
                else
                {
                    break;
                }
            }
            for (int j = col + 1; j < 3; j++)
            {
                if (terrainType == CanvasUI.battleBoxes[row, j].GetTerrainType)
                {
                    AnimationManager.Instance.PlayAttackAnime(elementType, dam, CanvasUI.battleBoxes[row, j].transform.position);
                    CheckBoxWithDamge(row, j, dam, elementType);
                }
                else
                {
                    break;
                }
            }
        }
        else//非克制属性伤害减半
        {
            AnimationManager.Instance.PlayAttackAnime(elementType, dam * 0.5f, CanvasUI.battleBoxes[row, col].transform.position);
            CheckBoxWithDamge(row, col, dam * 0.5f, elementType);
        }
    }
Пример #53
0
 public Enemy(int id, string name, string desc, float hp, int speed, int attack, int defence, int level, int power, AblityTypes type, int itemDroped, ElementType etype, float currentHp)
 {
     this.ID          = id;
     this.Name        = name;
     this.Description = desc;
     this.HP          = hp;
     this.Speed       = speed;
     this.Attack      = attack;
     this.Defence     = defence;
     this.Level       = level;
     this.Power       = power;
     this.Type        = type;
     this.ItemDroped  = itemDroped;
     this.Etype       = etype;
     this.CurrentHP   = currentHp;
 }
Пример #54
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIDocument uidoc = commandData.Application.ActiveUIDocument;
            Document   doc   = commandData.Application.ActiveUIDocument.Document;

            //get viewport
            TaskDialog.Show("GOA", "请选择视口作为样例.");
            Reference viewportref = uidoc.Selection.PickObject(ObjectType.Element, "选择图例.");
            Viewport  viewport    = doc.GetElement(viewportref.ElementId) as Viewport;

            if (viewport == null) // || viewport.Id.IntegerValue != (int)BuiltInCategory.OST_Viewports)
            {
                TaskDialog.Show("wrong", "未选中视口"); return(Result.Failed);
            }
            ElementId legendid = viewport.ViewId;

            //get titleBlock & name
            TaskDialog.Show("GOA", "请选择图框作为样例.");
            Reference      titleblockref      = uidoc.Selection.PickObject(ObjectType.Element, "选择图框.");
            FamilyInstance titleblock         = doc.GetElement(titleblockref.ElementId) as FamilyInstance;
            Category       titleblockcategory = titleblock.Category;

            if (titleblock == null || titleblockcategory.Id.IntegerValue != (int)BuiltInCategory.OST_TitleBlocks)
            {
                TaskDialog.Show("wrong", "未选中图框"); return(Result.Failed);
            }
            string titleblockname = titleblock.Symbol.Family.Name;

            //get viewsheet
            ElementId viewsheetid = titleblock.OwnerViewId;

            //get location(by boundingbox)
            XYZ    viewportposition   = viewport.GetBoxCenter();
            XYZ    titleblockposition = titleblock.get_BoundingBox(uidoc.ActiveView).Max;
            double distanceX          = titleblockposition.X - viewportposition.X;
            double distanceY          = titleblockposition.Y - viewportposition.Y;

            //get all titleBlocks
            FilteredElementCollector collector = new FilteredElementCollector(doc);

            collector.OfCategory(BuiltInCategory.OST_TitleBlocks).WhereElementIsNotElementType();
            if (collector == null)
            {
                TaskDialog.Show("wrond", "未找到图纸");
            }

            //prompt
            string prompt = "水平偏移:" + (distanceX * 304.8).ToString() + "\n垂直偏移:" + (distanceY * 304.8).ToString() + "\n同类型图框有:\n";
            List <FamilyInstance> titleblocks = new List <FamilyInstance>();

            foreach (Element ele in collector)
            {
                FamilyInstance tb = ele as FamilyInstance;
                if (tb == null)
                {
                    TaskDialog.Show("wrond", "未找到图框"); continue;
                }
                ViewSheet vs = doc.GetElement(tb.OwnerViewId) as ViewSheet;
                if (vs == null)
                {
                    TaskDialog.Show("wrond", "未找到图纸"); continue;
                }
                if (tb.Symbol.Family.Name == titleblockname)
                {
                    titleblocks.Add(tb); prompt += vs.Name; prompt += "\n";
                }
            }
            TaskDialog.Show("GOA", prompt);

            //dele all viewport
            FilteredElementCollector viewports = new FilteredElementCollector(doc);

            viewports.OfCategory(BuiltInCategory.OST_Viewports).WhereElementIsNotElementType();
            List <ElementId> deleids = new List <ElementId>();

            foreach (Element ele in viewports)
            {
                Viewport vp = ele as Viewport;
                if (vp.ViewId == legendid)
                {
                    deleids.Add(vp.Id);
                }
            }

            //get type
            FilteredElementCollector typecol = new FilteredElementCollector(doc);

            typecol.OfClass(typeof(ElementType));
            ElementType type = null;

            foreach (Element ele in typecol)
            {
                ElementType tmp = ele as ElementType;
                if (tmp == null)
                {
                    continue;
                }
                if (tmp.Name == "A-VIEW-NONE")
                {
                    type = tmp; break;
                }
            }
            if (type == null)
            {
                TaskDialog.Show("wrong", "未找到<A-VIEW-NONE>类型,请载入后重试.");
            }

            //create viewport and move
            using (Transaction transaction = new Transaction(doc))
            {
                transaction.Start("creat legends");
                doc.Delete(deleids);
                foreach (FamilyInstance tb in titleblocks)
                {
                    //if(tb.OwnerViewId == viewsheetid) {continue; }
                    XYZ postiontmp = tb.get_BoundingBox(doc.GetElement(tb.OwnerViewId) as ViewSheet).Max;
                    XYZ postion    = new XYZ(postiontmp.X - distanceX, postiontmp.Y - distanceY, postiontmp.Z);
                    if (Viewport.CanAddViewToSheet(doc, tb.OwnerViewId, legendid))
                    {
                        Viewport newvp = Viewport.Create(doc, tb.OwnerViewId, legendid, postion);
                        newvp.ChangeTypeId(type.Id);
                    }
                }

                transaction.Commit();
            }
            TaskDialog.Show("GOA", "生成成功.如果图框内已有一样的区位图会被删除并生成在新的位置.");


            return(Result.Succeeded);
        }
Пример #55
0
 /// <summary>
 /// Selects element to paint.
 /// </summary>
 public void SelectElement(ElementType elementType) => CurrentlySelectedElement = elementType;
Пример #56
0
 public Attack(int id, string name, string desc, int attackPower, int defencePower, int statusLevel, EffectType effect, ElementType etype, int levelRec, int count, bool IsAnItemAttack, Item item)
 {
     this.ID              = id;
     this.Name            = name;
     this.Description     = desc;
     this.AttackPower     = attackPower;
     this.Description     = desc;
     this.StatusLevel     = statusLevel;
     this.effectType      = effect;
     this.Etype           = etype;
     this.LevelRequirment = levelRec;
     this.Count           = count;
     this.isItemAttack    = IsAnItemAttack;
     this.ItemForAttack   = item;
 }
Пример #57
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SessionMapElement"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="type">The type.</param>
 /// <param name="subType">The subtype.</param>
 public SessionMapElement(string name, ElementType type, string subType)
     : this(name, type)
 {
     ElementSubtype = subType;
 }
Пример #58
0
 public override SimpleTreeNode ToSimpleTree()
 => new SimpleGroupNode(RQNameStrings.Pointer, ElementType.ToSimpleTree());
 /// <summary>
 /// Calculates cross area.
 /// </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)
     {
         double crossSectionArea = 0;
         ParameterUtil.GetDoubleValueFromElement(element, BuiltInParameter.HOST_AREA_COMPUTED, out crossSectionArea);
         m_Area = UnitUtil.ScaleArea(crossSectionArea);
         if (m_Area < MathUtil.Eps() * MathUtil.Eps() || m_Area < MathUtil.Eps())
         {
             ParameterUtil.GetDoubleValueFromElementOrSymbol(element, "IfcQtyCrossSectionArea", out crossSectionArea);
             m_Area = UnitUtil.ScaleArea(crossSectionArea);
             if (m_Area < MathUtil.Eps() * MathUtil.Eps() || m_Area < MathUtil.Eps())
             {
                 return(false);
             }
             else
             {
                 return(true);
             }
         }
     }
     else
     {
         m_Area = extrusionCreationData.ScaledArea;
     }
     return(m_Area > MathUtil.Eps() * MathUtil.Eps());
 }
Пример #60
0
        /// <summary>
        /// Exports a MEP family instance.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="element">The element.</param>
        /// <param name="geometryElement">The geometry element.</param>
        /// <param name="exportType">The export type of the element.
        /// <param name="ifcEnumType">The sub-type of the element.</param></param>
        /// <param name="productWrapper">The ProductWrapper.</param>
        /// <returns>True if an entity was created, false otherwise.</returns>
        public static bool Export(ExporterIFC exporterIFC, Element element, GeometryElement geometryElement,
                                  IFCExportType exportType, string ifcEnumType, ProductWrapper productWrapper)
        {
            IFCFile file = exporterIFC.GetFile();

            using (IFCTransaction tr = new IFCTransaction(file))
            {
                using (PlacementSetter setter = PlacementSetter.Create(exporterIFC, element))
                {
                    IFCAnyHandle localPlacementToUse = setter.LocalPlacement;
                    using (IFCExtrusionCreationData extraParams = new IFCExtrusionCreationData())
                    {
                        extraParams.SetLocalPlacement(localPlacementToUse);

                        ElementId catId = CategoryUtil.GetSafeCategoryId(element);

                        BodyExporterOptions bodyExporterOptions   = new BodyExporterOptions(true);
                        BodyData            bodyData              = null;
                        IFCAnyHandle        productRepresentation = RepresentationUtil.CreateAppropriateProductDefinitionShape(exporterIFC,
                                                                                                                               element, catId, geometryElement, bodyExporterOptions, null, extraParams, out bodyData);
                        if (IFCAnyHandleUtil.IsNullOrHasNoValue(productRepresentation))
                        {
                            extraParams.ClearOpenings();
                            return(false);
                        }

                        IFCAnyHandle   ownerHistory    = exporterIFC.GetOwnerHistoryHandle();
                        ElementId      typeId          = element.GetTypeId();
                        ElementType    type            = element.Document.GetElement(typeId) as ElementType;
                        FamilyTypeInfo currentTypeInfo = ExporterCacheManager.TypeObjectsCache.Find(typeId, false);

                        bool found = currentTypeInfo.IsValid();
                        if (!found)
                        {
                            string typeGUID            = GUIDUtil.CreateGUID(type);
                            string typeName            = NamingUtil.GetNameOverride(type, NamingUtil.GetIFCName(type));
                            string typeObjectType      = NamingUtil.GetObjectTypeOverride(type, NamingUtil.CreateIFCObjectName(exporterIFC, type));
                            string applicableOccurence = NamingUtil.GetOverrideStringValue(type, "IfcApplicableOccurrence", typeObjectType);
                            string typeDescription     = NamingUtil.GetDescriptionOverride(type, null);
                            string typeTag             = NamingUtil.GetTagOverride(type, NamingUtil.CreateIFCElementId(type));
                            string typeElementType     = NamingUtil.GetOverrideStringValue(type, "IfcElementType", typeName);

                            IList <IFCAnyHandle> repMapListOpt = new List <IFCAnyHandle>();

                            IFCAnyHandle styleHandle = FamilyExporterUtil.ExportGenericType(exporterIFC, exportType, ifcEnumType, typeGUID, typeName,
                                                                                            typeDescription, applicableOccurence, null, repMapListOpt, typeTag, typeElementType, element, type);
                            if (!IFCAnyHandleUtil.IsNullOrHasNoValue(styleHandle))
                            {
                                productWrapper.RegisterHandleWithElementType(type, styleHandle, null);

                                currentTypeInfo.Style = styleHandle;
                                ExporterCacheManager.TypeObjectsCache.Register(typeId, false, currentTypeInfo);
                            }
                        }
                        string instanceGUID        = GUIDUtil.CreateGUID(element);
                        string instanceName        = NamingUtil.GetNameOverride(element, NamingUtil.GetIFCName(element));
                        string instanceObjectType  = NamingUtil.GetObjectTypeOverride(element, NamingUtil.CreateIFCObjectName(exporterIFC, element));
                        string instanceDescription = NamingUtil.GetDescriptionOverride(element, null);
                        string instanceTag         = NamingUtil.GetTagOverride(element, NamingUtil.CreateIFCElementId(element));

                        bool roomRelated = !FamilyExporterUtil.IsDistributionFlowElementSubType(exportType);

                        ElementId roomId = ElementId.InvalidElementId;
                        if (roomRelated)
                        {
                            roomId = setter.UpdateRoomRelativeCoordinates(element, out localPlacementToUse);
                        }

                        IFCAnyHandle instanceHandle = null;

                        // For MEP objects
                        string exportEntityStr = exportType.ToString();
                        Common.Enums.IFCEntityType exportEntity;

                        if (String.Compare(exportEntityStr.Substring(exportEntityStr.Length - 4), "Type", true) == 0)
                        {
                            exportEntityStr = exportEntityStr.Substring(0, (exportEntityStr.Length - 4));
                        }
                        if (Enum.TryParse(exportEntityStr, out exportEntity))
                        {
                            // For MEP object creation
                            instanceHandle = IFCInstanceExporter.CreateGenericIFCEntity(exportEntity, file, instanceGUID, ownerHistory,
                                                                                        instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag);
                        }


                        if (IFCAnyHandleUtil.IsNullOrHasNoValue(instanceHandle))
                        {
                            return(false);
                        }

                        bool relatedToSpace = (roomId != ElementId.InvalidElementId);
                        productWrapper.AddElement(element, instanceHandle, setter, extraParams, !relatedToSpace);
                        if (relatedToSpace)
                        {
                            ExporterCacheManager.SpaceInfoCache.RelateToSpace(roomId, instanceHandle);
                        }

                        OpeningUtil.CreateOpeningsIfNecessary(instanceHandle, element, extraParams, null,
                                                              exporterIFC, localPlacementToUse, setter, productWrapper);

                        if (currentTypeInfo.IsValid())
                        {
                            ExporterCacheManager.TypeRelationsCache.Add(currentTypeInfo.Style, instanceHandle);
                        }

                        if (bodyData != null && bodyData.MaterialIds.Count != 0)
                        {
                            CategoryUtil.CreateMaterialAssociations(exporterIFC, instanceHandle, bodyData.MaterialIds);
                        }

                        ExporterCacheManager.MEPCache.Register(element, instanceHandle);

                        tr.Commit();
                    }
                }
            }
            return(true);
        }