Ejemplo n.º 1
0
        /// <summary>
        /// Renders a new paper doll image for the specified player entity.
        /// </summary>
        /// <param name="layers">Flags controlling which layers of paper doll to draw.</param>
        /// <param name="playerEntity">Player entity to use for paper doll construction. Use null for live player entity.</param>
        public void Refresh(LayerFlags layers = LayerFlags.All, PlayerEntity playerEntity = null)
        {
            // Clear current item layout
            itemLayout.Clear();

            // Get current player entity if one not provided
            if (playerEntity == null)
            {
                playerEntity = GameManager.Instance.PlayerEntity;
            }

            // Racial override can suppress body and items
            bool suppressBody = false;
            RacialOverrideEffect racialOverride = GameManager.Instance.PlayerEffectManager.GetRacialOverrideEffect();

            if (racialOverride != null)
            {
                suppressBody = racialOverride.SuppressPaperDollBodyAndItems;
            }

            // Start rendering to paper doll target
            RenderTexture oldRT = RenderTexture.active;

            RenderTexture.active = target;
            GL.PushMatrix();
            GL.LoadPixelMatrix(0, target.width, target.height, 0);

            // Clear render target
            GL.Clear(true, true, Color.clear);

            if (!suppressBody)
            {
                // Cloak interior
                if ((layers & LayerFlags.CloakInterior) == LayerFlags.CloakInterior)
                {
                    BlitCloakInterior(playerEntity);
                }

                // Body
                if ((layers & LayerFlags.Body) == LayerFlags.Body)
                {
                    BlitBody(playerEntity);
                }

                // Items
                if ((layers & LayerFlags.Items) == LayerFlags.Items)
                {
                    BlitItems(playerEntity);
                }
            }

            // Copy render to new output
            paperDollTexture.ReadPixels(new Rect(0, 0, target.width, target.height), 0, 0);
            paperDollTexture.Apply();

            // Switch back to previous render target
            GL.PopMatrix();
            RenderTexture.active = oldRT;
        }
Ejemplo n.º 2
0
 private LayerChunk(LayerFlags flags, LayerTypes type, ushort childLevel, BlendModes blendMode, byte opacity, string name)
 {
     Flags      = flags;
     Type       = type;
     ChildLevel = childLevel;
     BlendMode  = blendMode;
     Opacity    = opacity;
     Name       = name;
 }
Ejemplo n.º 3
0
        public void SetLayerFlags(LayerFlags lyrf)
        {
            // If already set to this, return

            if (lyrf == m_lyrf)
            {
                return;
            }

            // Remove the appropriate items from the current selection

            ArrayList alsmiSelected = m_lvld.Selection;

            for (int imi = 0; imi < alsmiSelected.Count;)
            {
                IMapItem mi = (IMapItem)alsmiSelected[imi];
                if (mi is Tile)
                {
                    if ((lyrf & LayerFlags.Templates) == 0)
                    {
                        alsmiSelected.RemoveAt(imi);
                        continue;
                    }
                }
                else if (mi is Area)
                {
                    if ((lyrf & LayerFlags.Areas) == 0)
                    {
                        alsmiSelected.RemoveAt(imi);
                        continue;
                    }
                }
                else
                {
                    if ((lyrf & LayerFlags.Gobs) == 0)
                    {
                        alsmiSelected.RemoveAt(imi);
                        continue;
                    }
                }
                imi++;
            }
            m_lvld.Selection = alsmiSelected;

            // Set new flags and redraw

            m_lyrf = lyrf;
            Redraw();
        }
Ejemplo n.º 4
0
        public override void CopyFrom(DxfHandledObject from, CloneContext cloneContext)
        {
            base.CopyFrom(from, cloneContext);
            DxfLayer dxfLayer = (DxfLayer)from;

            this.string_9       = dxfLayer.string_9;
            this.layerFlags_0   = dxfLayer.layerFlags_0;
            this.bool_0         = dxfLayer.bool_0;
            this.color_0        = dxfLayer.color_0;
            this.transparency_0 = dxfLayer.transparency_0;
            this.LineType       = Class906.GetLineType(cloneContext, dxfLayer.LineType);
            this.short_0        = dxfLayer.short_0;
            this.bool_1         = dxfLayer.bool_1;
            this.bool_2         = dxfLayer.bool_2;
            if (dxfLayer.Handle != 16UL)
            {
                return;
            }
            this.SetHandle(16UL);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Renders a new paper doll image for the specified player entity.
        /// </summary>
        /// <param name="layers">Flags controlling which layers of paper doll to draw.</param>
        /// <param name="playerEntity">Player entity to use for paper doll construction. Use null for live player entity.</param>
        public void Refresh(LayerFlags layers = LayerFlags.All, PlayerEntity playerEntity = null)
        {
            // Get current player entity if one not provided
            if (playerEntity == null)
            {
                playerEntity = GameManager.Instance.PlayerEntity;
            }

            // Start rendering to paper doll target
            RenderTexture oldRT = RenderTexture.active;

            RenderTexture.active = target;

            // Clear render target
            GL.Clear(true, true, Color.clear);

            // Cloak interior
            if ((layers & LayerFlags.CloakInterior) == LayerFlags.CloakInterior)
            {
                BlitCloakInterior(playerEntity);
            }

            // Body
            if ((layers & LayerFlags.Body) == LayerFlags.Body)
            {
                BlitBody(playerEntity);
            }

            // Items
            if ((layers & LayerFlags.Items) == LayerFlags.Items)
            {
                BlitItems(playerEntity);
            }

            // Copy render to new output
            paperDollTexture.ReadPixels(new Rect(0, 0, target.width, target.height), 0, 0);
            paperDollTexture.Apply();

            // Switch back to previous render target
            RenderTexture.active = oldRT;
        }
Ejemplo n.º 6
0
 public static ExplicitBitVect LayeredFingerprint(ROMol mol,
                                                  LayerFlags layerFlags = (LayerFlags)(-1), int minPath     = 1, int maxPath = 7, int fpSize = 2048,
                                                  UInt_Vect atomCounts  = null, ExplicitBitVect setOnlyBits = null, bool branchedPaths = true, UInt_Vect fromAtoms = null)
 {
     return(RDKFuncs.LayeredFingerprintMol(mol, (uint)layerFlags, (uint)minPath, (uint)maxPath, (uint)fpSize, atomCounts, setOnlyBits, branchedPaths, fromAtoms));
 }
Ejemplo n.º 7
0
 public ArrayList HitTest(Rectangle rc, Size sizTile, TemplateDoc tmpd, LayerFlags lyrf)
 {
     ArrayList alsmi = new ArrayList();
     foreach (IMapItem mi in m_alsmi) {
         Point ptCenter = mi.GetCenterPoint(sizTile);
         if (rc.Contains(ptCenter)) {
             if (mi is Area) {
                 if ((lyrf & LayerFlags.Areas) != 0)
                     alsmi.Add(mi);
             } else if (mi is Tile) {
                 if ((lyrf & LayerFlags.Templates) != 0)
                     alsmi.Add(mi);
             } else {
                 if ((lyrf & LayerFlags.Gobs) != 0)
                     alsmi.Add(mi);
             }
         }
     }
     return alsmi;
 }
Ejemplo n.º 8
0
 public IMapItem HitTest(int x, int y, Size sizTile, TemplateDoc tmpd, LayerFlags lyrf)
 {
     // MapItems on top are first
     for (int i = m_alsmi.Count - 1; i >= 0; i--) {
         IMapItem mi = (IMapItem)m_alsmi[i];
         if (mi.HitTest(x, y, sizTile, tmpd)) {
             if (mi is Area) {
                 if ((lyrf & LayerFlags.Areas) != 0)
                     return mi;
             } else if (mi is Tile) {
                 if ((lyrf & LayerFlags.Templates) != 0)
                     return mi;
             } else {
                 if ((lyrf & LayerFlags.Gobs) != 0)
                     return mi;
             }
         }
     }
     return null;
 }
Ejemplo n.º 9
0
        public void DrawTileMap(Bitmap bm, ArrayList alsmiSelected, Size sizTile, TemplateDoc tmpd, LayerFlags lyrf)
        {
            // Draw background

            using (Graphics g = Graphics.FromImage(bm)) {
                Template tmplBackground = null;
                if (tmpd != null)
                    tmplBackground = tmpd.GetBackgroundTemplate();
                if (tmplBackground == null) {
                    g.FillRectangle(new SolidBrush(Color.Black), 0, 0, bm.Width, bm.Height);
                    for (int x = sizTile.Width; x < bm.Width; x += sizTile.Width) {
                        for (int y = sizTile.Height; y < bm.Height; y += sizTile.Height) {
                            bm.SetPixel(x, y, Color.BlanchedAlmond);
                        }
                    }
                } else {
                    for (int x = 0; x < bm.Width; x += tmplBackground.Bitmap.Width) {
                        for (int y = 0; y < bm.Height; y += tmplBackground.Bitmap.Height)
                            g.DrawImage(tmplBackground.Bitmap, x, y);
                    }
                }

                // Draw templates

                if ((lyrf & LayerFlags.Templates) != 0) {
                    foreach (IMapItem mi in m_alsmi) {
                        int x = (int)mi.tx * sizTile.Width;
                        int y = (int)mi.ty * sizTile.Height;
                        mi.Draw(g, x, y, sizTile, tmpd, LayerType.TileMap, alsmiSelected != null ? alsmiSelected.Contains(mi) : false);
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public void Draw(Bitmap bm, IMapItem miExclude, Size sizTile, TemplateDoc tmpd, LayerFlags lyrf)
        {
            ArrayList alsmiSelected = m_alsmiSelected;

            // Draw tile map
            DrawTileMap(bm, alsmiSelected, sizTile, tmpd, lyrf);

            // Draw other layers
            using (Graphics g = Graphics.FromImage(bm)) {
                for (LayerType layer = LayerType.Galaxite; layer < LayerType.End; layer++) {
                    if (layer == LayerType.Area) {
                        if ((lyrf & LayerFlags.Areas) == 0)
                            continue;
                    } else {
                        if ((lyrf & LayerFlags.Gobs) == 0)
                            continue;
                    }
                    foreach (IMapItem mi in m_alsmi) {
                        if (mi != miExclude) {
                            int x = (int)(mi.tx * sizTile.Width);
                            int y = (int)(mi.ty * sizTile.Height);
                            mi.Draw(g, x, y, sizTile, tmpd, layer, alsmiSelected != null ? alsmiSelected.Contains(mi) : false);
                        }
                    }
                }

                // Draw bounds
                Pen pen = new Pen(new SolidBrush(Color.FromArgb(0, 255, 0)));
                pen.Width = 2;
                g.DrawRectangle(pen, Bounds.X * sizTile.Width - pen.Width + 1, Bounds.Y * sizTile.Height - pen.Width + 1, Bounds.Width * sizTile.Width + pen.Width, Bounds.Height * sizTile.Height + pen.Width);
            }
        }
Ejemplo n.º 11
0
        public void SetLayerFlags(LayerFlags lyrf)
        {
            // If already set to this, return

            if (lyrf == m_lyrf)
                return;

            // Remove the appropriate items from the current selection

            ArrayList alsmiSelected = m_lvld.Selection;

            for (int imi = 0; imi < alsmiSelected.Count; ) {
                IMapItem mi = (IMapItem)alsmiSelected[imi];
                if (mi is Tile) {
                    if ((lyrf & LayerFlags.Templates) == 0) {
                        alsmiSelected.RemoveAt(imi);
                        continue;
                    }
                } else if (mi is Area) {
                    if ((lyrf & LayerFlags.Areas) == 0) {
                        alsmiSelected.RemoveAt(imi);
                        continue;
                    }
                } else {
                    if ((lyrf & LayerFlags.Gobs) == 0) {
                        alsmiSelected.RemoveAt(imi);
                        continue;
                    }
                }
                imi++;
            }
            m_lvld.Selection = alsmiSelected;

            // Set new flags and redraw

            m_lyrf = lyrf;
            Redraw();
        }
Ejemplo n.º 12
0
 static public bool HasFlag(this LayerFlags flags, LayerFlags flag)
 {
     return((flags & flag) != 0);
 }
Ejemplo n.º 13
0
        public void ParseCode(CodeValuePair codeValue)
        {
            switch (codeValue.Code)
            {
            case 2:

                Name = codeValue.Value;
                break;

            case 6:

                LineType = codeValue.Value;
                break;

            case 62:

                var value = codeValue.GetShort();

                if (value < 0)
                {
                    IsVisible = false;
                    Color     = new AciColor(Math.Abs(value));
                }
                else
                {
                    Color = new AciColor(value);
                }

                break;

            case 70:
                LayerFlag = (LayerFlags)codeValue.GetInt();

                if (LayerFlag == LayerFlags.Locked)
                {
                    IsLocked = true;
                }
                else if (LayerFlag == LayerFlags.Frozen)
                {
                    IsFrozen = true;
                }

                break;

            case 290:

                Plot = codeValue.GetBoolean();
                break;

            case 370:

                //LineWeight =
                break;

            case 390:

                break;

            case 347:

                break;

            case 420:
                Color24 = codeValue.GetInt();
                break;

            default:

                break;
            }
        }