Пример #1
0
        internal bool Reconstruct(geometry_block_info_struct gbi)
        {
            int index = 0;

            byte[][] data = gbi.GeometryBlock;

            if (data == null)
            {
                return(false);
            }

            foreach (geometry_block_resource_block gb in gbi.Resources)
            {
                using (IO.EndianReader er = new BlamLib.IO.EndianReader(data[index]))
                {
                    switch (gb.Type.Value)
                    {
                        #region TagBlock
                    case (int)geometry_block_resource_type.TagBlock:
                        int count = gb.GetCount();
                        switch (gb.PrimaryLocater.Value)
                        {
                        case OffsetPlacements:
                            Placements.Resize(count);
                            Placements.Read(er);
                            break;

                        case OffsetDecalVertices:
                            DecalVertices.Resize(count);
                            DecalVertices.Read(er);
                            break;

                        case OffsetDecalIndices:
                            DecalIndices.Resize(count);
                            DecalIndices.Read(er);
                            break;

                        case OffsetSpriteVertices:
                            SpriteVertices.Resize(count);
                            SpriteVertices.Read(er);
                            break;

                        case OffsetSpriteIndices:
                            SpriteIndices.Resize(count);
                            SpriteIndices.Read(er);
                            break;
                        }
                        break;
                        #endregion
                    }
                }

                index++;
            }

            return(true);
        }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        this.count    = 0;
        this.komaList = new List <Koma>();

        for (int i = 1; i < 3; i++)
        {
            var strNum      = i.ToString().PadLeft(2, '0');
            var ousho       = GameObject.Find("OUSHO_" + strNum);
            var hisha       = GameObject.Find("HISHA_" + strNum);
            var kaku        = GameObject.Find("KAKU_" + strNum);
            var oushoWindow = GameObject.Find("OUSHO_" + strNum + "_WINDOW").GetComponent <RectTransform>();
            var hishaWindow = GameObject.Find("HISHA_" + strNum + "_WINDOW").GetComponent <RectTransform>();
            var kakuWindow  = GameObject.Find("KAKU_" + strNum + "_WINDOW").GetComponent <RectTransform>();
            this.komaList.Add(new Koma("Ousho", ousho, oushoWindow));
            this.komaList.Add(new Koma("Hisha", hisha, hishaWindow));
            this.komaList.Add(new Koma("Kaku", kaku, kakuWindow));
        }

        for (int i = 1; i < 5; i++)
        {
            var strNum       = i.ToString().PadLeft(2, '0');
            var kin          = GameObject.Find("KIN_" + strNum);
            var gin          = GameObject.Find("GIN_" + strNum);
            var keima        = GameObject.Find("KEIMA_" + strNum);
            var kyosha       = GameObject.Find("KYOSHA_" + strNum);
            var kinWindow    = GameObject.Find("KIN_" + strNum + "_WINDOW").GetComponent <RectTransform>();
            var ginWindow    = GameObject.Find("GIN_" + strNum + "_WINDOW").GetComponent <RectTransform>();
            var keimaWindow  = GameObject.Find("KEIMA_" + strNum + "_WINDOW").GetComponent <RectTransform>();
            var kyoshaWindow = GameObject.Find("KYOSHA_" + strNum + "_WINDOW").GetComponent <RectTransform>();
            this.komaList.Add(new Koma("Kin", kin, kinWindow));
            this.komaList.Add(new Koma("Gin", gin, ginWindow));
            this.komaList.Add(new Koma("Keima", keima, keimaWindow));
            this.komaList.Add(new Koma("Kyosha", kyosha, kyoshaWindow));
        }

        for (int i = 1; i < 19; i++)
        {
            var strNum   = i.ToString().PadLeft(2, '0');
            var fu       = GameObject.Find("FU_" + strNum);
            var fuWindow = GameObject.Find("FU_" + strNum + "_WINDOW").GetComponent <RectTransform>();
            this.komaList.Add(new Koma("Fu", fu, fuWindow));
        }

        var showWindow = false;

        if (!showWindow)
        {
            foreach (var koma in this.komaList)
            {
                koma.Window.gameObject.SetActive(false);
            }
        }

        this.placements   = new Placements();
        this.lightManager = new LightManager();
    }
Пример #3
0
        protected XbimMatrix3D PlacementOf(IIfcProduct p)
        {
            XbimPlacementTree tree;

            if (!Placements.TryGetValue(p.Model, out tree))
            {
                tree = new XbimPlacementTree(p.Model, false);
                Placements.Add(p.Model, tree);
            }
            return(XbimPlacementTree.GetTransform(p, tree, Engine));
        }
Пример #4
0
 public static Rectangle FloatItem(Rectangle What, Rectangle Within, Placements Placement, int Padding)
 {
     if ((Placement & Placements.Top) == Placements.Top)
         What.Y = Within.Y + Padding;
     if ((Placement & Placements.Bottom) == Placements.Bottom)
         What.Y = Within.Y + Within.Height - What.Height - Padding;
     if ((Placement & Placements.Left) == Placements.Left)
         What.X = Within.X + Padding;
     if ((Placement & Placements.Right) == Placements.Right)
         What.X = Within.X + Within.Width - What.Width - Padding;
     return What;
 }
Пример #5
0
 /** Remove Placements for given Collision Object. */
 private void RemoveAllPlacementsForModels(ulong CollisionHash)
 {
     // Check if the placement has the collision hash,
     // If so, delete from list.
     for (int i = Placements.Count - 1; i >= 0; i--)
     {
         Placement Instance = Placements[i];
         if (Instance.Hash == CollisionHash)
         {
             Placements.RemoveAt(i);
         }
     }
 }
Пример #6
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id.GetHashCode();
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Category != null ? Category.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Placements != null ? Placements.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Countries != null ? Countries.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IsHidden.GetHashCode();
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ModeratorDescription != null ? ModeratorDescription.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)Applicability;
         return(hashCode);
     }
 }
Пример #7
0
 protected override void OnRender(DrawingContext drawingContext)
 {
     drawingContext.DrawGeometry(null, BondPen, Geometry);
     drawingContext.DrawLine(DashedPen, Placements.Last(), CurrentPoint);
     if (Unanchored)
     {
         NRingAdorner.DrawRingSize(drawingContext, Placements.Count, Placements.Last(), PixelsPerDip(),
                                   BondPen.Brush.Clone());
     }
     else
     {
         if (Placements.Count > 1)
         {
             NRingAdorner.DrawRingSize(drawingContext, Placements.Count - 1, Placements.Last(), PixelsPerDip(),
                                       BondPen.Brush.Clone());
         }
     }
 }
Пример #8
0
 public static Rectangle FloatItem(Rectangle What, Rectangle Within, Placements Placement, int Padding)
 {
     if ((Placement & Placements.Top) == Placements.Top)
     {
         What.Y = Within.Y + Padding;
     }
     if ((Placement & Placements.Bottom) == Placements.Bottom)
     {
         What.Y = Within.Y + Within.Height - What.Height - Padding;
     }
     if ((Placement & Placements.Left) == Placements.Left)
     {
         What.X = Within.X + Padding;
     }
     if ((Placement & Placements.Right) == Placements.Right)
     {
         What.X = Within.X + Within.Width - What.Width - Padding;
     }
     return(What);
 }
Пример #9
0
 public PlacementChar(char baseChar, Placements placement)
 {
     BaseChar  = baseChar;
     Placement = placement;
 }
 public void SetCapacity(int newSize)
 {
     Elements.Resize(newSize);
     TreeItems.Resize(newSize);
     Placements.Resize(newSize);
 }