コード例 #1
0
        // Auto-align texture X offsets
        public virtual void OnTextureAlign(bool alignx, bool aligny)
        {
            mode.CreateUndo("Auto-align textures");
            mode.SetActionResult("Auto-aligned textures.");

            // Make sure the texture is loaded (we need the texture size)
            if (!base.Texture.IsImageLoaded)
            {
                base.Texture.LoadImage();
            }

            if (mode.IsSingleSelection)
            {
                // Clear all marks, this will align everything it can
                General.Map.Map.ClearMarkedSidedefs(false);
            }
            else
            {
                // Limit the alignment to selection only
                General.Map.Map.ClearMarkedSidedefs(true);
                List <Sidedef> sides = mode.GetSelectedSidedefs();
                foreach (Sidedef sd in sides)
                {
                    sd.Marked = false;
                }
            }

            SidedefPart part;

            if (this is VisualLower)
            {
                part = SidedefPart.Lower;
            }
            else if (this is VisualUpper)
            {
                part = SidedefPart.Upper;
            }
            else
            {
                part = SidedefPart.Middle;
            }

            // Do the alignment
            BuilderPlug.AutoAlignTextures(this.Sidedef, part, base.Texture, alignx, aligny, false);

            // Get the changed sidedefs
            List <Sidedef> changes = General.Map.Map.GetMarkedSidedefs(true);

            foreach (Sidedef sd in changes)
            {
                // Update the parts for this sidedef!
                if (mode.VisualSectorExists(sd.Sector))
                {
                    BaseVisualSector   vs    = (mode.GetVisualSector(sd.Sector) as BaseVisualSector);
                    VisualSidedefParts parts = vs.GetSidedefParts(sd);
                    parts.SetupAllParts();
                }
            }
        }
コード例 #2
0
        // This event is called when the plugin is initialized
        public override void OnInitialize()
        {
            base.OnInitialize();

            // Keep a static reference
            me = this;

            // Settings
            showvisualthings = 2;
            usegravity       = false;
            usehighlight     = true;
            LoadSettings();
        }