查看: 2797|回复: 5

[有事请教] 在MZ中如何添加圆角矩形

[复制链接]
梦石
5
星屑
1843
在线时间
340 小时
注册时间
2014-4-1
回帖
211
发表于 2021-8-18 23:12:15 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
如题,比如说MZ自带会在各个选项中添加一个黑色半透明的矩形嘛,我就很好奇这个矩形能不能变成圆角矩形
梦石
2
星屑
18915
在线时间
1453 小时
注册时间
2017-4-16
回帖
216

MZ评测员开拓者

发表于 2021-8-19 11:19:01 | 显示全部楼层
可以改,改一个函数就行
个人RM交流群:568785370,目前在该群发布Ganfly系列插件
回复

使用道具 举报

梦石
0
星屑
14310
在线时间
2609 小时
注册时间
2013-6-10
回帖
1690
发表于 2021-8-19 15:56:47 | 显示全部楼层
肯定可以改,改哪个函数呢?
回复

使用道具 举报

梦石
0
星屑
7735
在线时间
1227 小时
注册时间
2008-12-14
回帖
504
发表于 2021-8-19 16:34:28 | 显示全部楼层
改 Window.prototype._setRectPartsGeometry = function(sprite, srect, drect, m)  这个函数
怎么改我还不知,再一个默认是有角这个概念的,只是有自己取角的方式。
需要购买本人MV插件必须先加wx好友。加不上wx就是本人忙,没时间卖。原则上太久以前的插件也不想卖,因为我也忘了,维护上会不给力。wx名:alskyif    本人插件地址:
   LCK_SRPG梦幻模拟战、火焰纹章类系统
   究极立绘ADV系统

   究极换装统合系统
   究极! 回想与CG系统
   消息文字的距离调整  
   自动返回上一张地图
回复

使用道具 举报

梦石
0
星屑
2585
在线时间
297 小时
注册时间
2021-5-4
回帖
97
发表于 2021-8-19 23:22:04 | 显示全部楼层
本帖最后由 MH-Pride 于 2021-8-19 23:31 编辑

直接跟系统一样用个圆角皮肤
js改圆角很麻烦 css就可以直接改
所以窗口矩形都是在
function Rectangle() {
    this.initialize(...arguments);
}

Rectangle.prototype = Object.create(PIXI.Rectangle.prototype);
Rectangle.prototype.constructor = Rectangle;

Rectangle.prototype.initialize = function(x, y, width, height) {
    PIXI.Rectangle.call(this, x, y, width, height);
};
然后他们都是基础PIXI.Rectangle.prototype
所以需要在这改
[pre lang="js"]var Rectangle = /** @class */ (function () {
            /**
             * @param {number} [x=0] - The X coordinate of the upper-left corner of the rectangle
             * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rectangle
             * @param {number} [width=0] - The overall width of this rectangle
             * @param {number} [height=0] - The overall height of this rectangle
             */
            function Rectangle(x, y, width, height) {
                if (x === void 0) { x = 0; }
                if (y === void 0) { y = 0; }
                if (width === void 0) { width = 0; }
                if (height === void 0) { height = 0; }
                /**
                 * @member {number}
                 * @default 0
                 */
                this.x = Number(x);
                /**
                 * @member {number}
                 * @default 0
                 */
                this.y = Number(y);
                /**
                 * @member {number}
                 * @default 0
                 */
                this.width = Number(width);
                /**
                 * @member {number}
                 * @default 0
                 */
                this.height = Number(height);
                /**
                 * The type of the object, mainly used to avoid `instanceof` checks
                 *
                 * @member {number}
                 * @readOnly
                 * @default PIXI.SHAPES.RECT
                 * @see PIXI.SHAPES
                 */
                this.type = exports.SHAPES.RECT;
            }
            Object.defineProperty(Rectangle.prototype, "left", {
                /**
                 * returns the left edge of the rectangle
                 *
                 * @member {number}
                 */
                get: function () {
                    return this.x;
                },
                enumerable: true,
                configurable: true
            });
            Object.defineProperty(Rectangle.prototype, "right", {
                /**
                 * returns the right edge of the rectangle
                 *
                 * @member {number}
                 */
                get: function () {
                    return this.x + this.width;
                },
                enumerable: true,
                configurable: true
            });
            Object.defineProperty(Rectangle.prototype, "top", {
                /**
                 * returns the top edge of the rectangle
                 *
                 * @member {number}
                 */
                get: function () {
                    return this.y;
                },
                enumerable: true,
                configurable: true
            });
            Object.defineProperty(Rectangle.prototype, "bottom", {
                /**
                 * returns the bottom edge of the rectangle
                 *
                 * @member {number}
                 */
                get: function () {
                    return this.y + this.height;
                },
                enumerable: true,
                configurable: true
            });
            Object.defineProperty(Rectangle, "EMPTY", {
                /**
                 * A constant empty rectangle.
                 *
                 * @static
                 * @constant
                 * @member {PIXI.Rectangle}
                 * @return {PIXI.Rectangle} An empty rectangle
                 */
                get: function () {
                    return new Rectangle(0, 0, 0, 0);
                },
                enumerable: true,
                configurable: true
            });
            /**
             * Creates a clone of this Rectangle
             *
             * @return {PIXI.Rectangle} a copy of the rectangle
             */
            Rectangle.prototype.clone = function () {
                return new Rectangle(this.x, this.y, this.width, this.height);
            };
            /**
             * Copies another rectangle to this one.
             *
             * @param {PIXI.Rectangle} rectangle - The rectangle to copy from.
             * @return {PIXI.Rectangle} Returns itself.
             */
            Rectangle.prototype.copyFrom = function (rectangle) {
                this.x = rectangle.x;
                this.y = rectangle.y;
                this.width = rectangle.width;
                this.height = rectangle.height;
                return this;
            };
            /**
             * Copies this rectangle to another one.
             *
             * @param {PIXI.Rectangle} rectangle - The rectangle to copy to.
             * @return {PIXI.Rectangle} Returns given parameter.
             */
            Rectangle.prototype.copyTo = function (rectangle) {
                rectangle.x = this.x;
                rectangle.y = this.y;
                rectangle.width = this.width;
                rectangle.height = this.height;
                return rectangle;
            };
            /**
             * Checks whether the x and y coordinates given are contained within this Rectangle
             *
             * @param {number} x - The X coordinate of the point to test
             * @param {number} y - The Y coordinate of the point to test
             * @return {boolean} Whether the x/y coordinates are within this Rectangle
             */
            Rectangle.prototype.contains = function (x, y) {
                if (this.width <= 0 || this.height <= 0) {
                    return false;
                }
                if (x >= this.x && x < this.x + this.width) {
                    if (y >= this.y && y < this.y + this.height) {
                        return true;
                    }
                }
                return false;
            };
            /**
             * Pads the rectangle making it grow in all directions.
             * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
             *
             * @param {number} [paddingX=0] - The horizontal padding amount.
             * @param {number} [paddingY=0] - The vertical padding amount.
             * @return {PIXI.Rectangle} Returns itself.
             */
            Rectangle.prototype.pad = function (paddingX, paddingY) {
                if (paddingX === void 0) { paddingX = 0; }
                if (paddingY === void 0) { paddingY = paddingX; }
                this.x -= paddingX;
                this.y -= paddingY;
                this.width += paddingX * 2;
                this.height += paddingY * 2;
                return this;
            };
            /**
             * Fits this rectangle around the passed one.
             *
             * @param {PIXI.Rectangle} rectangle - The rectangle to fit.
             * @return {PIXI.Rectangle} Returns itself.
             */
            Rectangle.prototype.fit = function (rectangle) {
                var x1 = Math.max(this.x, rectangle.x);
                var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);
                var y1 = Math.max(this.y, rectangle.y);
                var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);
                this.x = x1;
                this.width = Math.max(x2 - x1, 0);
                this.y = y1;
                this.height = Math.max(y2 - y1, 0);
                return this;
            };
            /**
             * Enlarges rectangle that way its corners lie on grid
             *
             * @param {number} [resolution=1] resolution
             * @param {number} [eps=0.001] precision
             * @return {PIXI.Rectangle} Returns itself.
             */
            Rectangle.prototype.ceil = function (resolution, eps) {
                if (resolution === void 0) { resolution = 1; }
                if (eps === void 0) { eps = 0.001; }
                var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;
                var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;
                this.x = Math.floor((this.x + eps) * resolution) / resolution;
                this.y = Math.floor((this.y + eps) * resolution) / resolution;
                this.width = x2 - this.x;
                this.height = y2 - this.y;
                return this;
            };
            /**
             * Enlarges this rectangle to include the passed rectangle.
             *
             * @param {PIXI.Rectangle} rectangle - The rectangle to include.
             * @return {PIXI.Rectangle} Returns itself.
             */
            Rectangle.prototype.enlarge = function (rectangle) {
                var x1 = Math.min(this.x, rectangle.x);
                var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);
                var y1 = Math.min(this.y, rectangle.y);
                var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);
                this.x = x1;
                this.width = x2 - x1;
                this.y = y1;
                this.height = y2 - y1;
                return this;
            };
            return Rectangle;[/pre]

点评

已经要涉及到PIXI了吗?插件新手还不是很理解,我当初以为js也可以和css一样可以很简单加个圆角,没想过到会那么复杂  发表于 2021-8-20 10:41
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部