| 赞 | 37 |
| VIP | |
| 好人卡 | |
| 积分 | 41 |
| 经验 | |
| 最后登录 | 2026-8-3 |
| 在线时间 | 302 小时 |
- 梦石
- 0
- 星屑
- 4122
- 在线时间
- 302 小时
- 注册时间
- 2019-4-23
- 回帖
- 185
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 q3226257 于 2020-9-7 14:42 编辑
MZ新出,写个超级简单的插件来蹭下热度~~~~
效果如图,在事件栏备注一下名字就可以了:
特别注意,改插件依赖于 MZ 自带的插件:PluginBaseFunction
修复了文字显示背景未清除的Bug!!!
- /*:
- *
- *
- * @plugindesc headName
- * @author lh
- * @date 14:42
- * @target MZ
- * @base PluginBaseFunction
- *
- * @param front
- * @text 字体大小
- * @desc 绘制顶部文字的大小
- * @default 18
- * @type number
- *
- * @param width
- * @text 宽度
- * @desc 当名字比较长显示不下可以调大该值
- * @default 64
- * @type number
- *
- * @param height
- * @text 高度
- * @desc 默认是居中的,所以会影响padding值
- * @default 18
- * @type number
- *
- * @param bgColor
- * @text 背景颜色
- * @desc 背景颜色
- * @default rgba(0,0,0,0.5)
- * @type color
- *
- * @help
- * 事件栏备注:
- * <name:破坏神,2>
- *
- *
- *
- */
- const solve_HeadName = PluginManager.parameters('Solve_SimpleHeadName')
- solve_HeadName.width =parseInt(solve_HeadName.width)
- solve_HeadName.height =parseInt(solve_HeadName.height)
- function Sprite_HeadName() {
- this.initialize(...arguments);
- }
- Sprite_HeadName.prototype = Object.create(Sprite.prototype);
- Sprite_HeadName.prototype.constructor = Sprite_HeadName;
- Sprite_HeadName.prototype.initialize = function (deploy) {
- Sprite.prototype.initialize.call(this);
- this._deploy = deploy;
- this.bitmap = new Bitmap(solve_HeadName.width, solve_HeadName.height)
- };
- Sprite_HeadName.prototype.update = function () {
- Sprite.prototype.update.call(this);
- this.x = this._deploy.x - (solve_HeadName.width) / 2
- this.y = this._deploy.y - solve_HeadName.height - this._deploy.height
- this.z = this._deploy.z + 1
- this.opacity = this._deploy.opacity
- this.blendMode = this._deploy.blendMode
- this._bushDepth = this._deploy._bushDepth
- this.visible = this._deploy.visible;
- if (this.bitmap._headName === this.headName()) return
- this.bitmap.outlineWidth = 0
- this.bitmap.fontSize = solve_HeadName.front
- this.bitmap.clear()
- this.bitmap._headName = this.headName()
- let [name,color] =this.bitmap._headName.split(',')
- this.bitmap.textColor=ColorManager.textColor( parseInt(color)||0)
- // this.bitmap.clearRect(0, 0, solve_HeadName.width, solve_HeadName.height);
- this.bitmap.fillRoundRect(0,0, solve_HeadName.width, solve_HeadName.height,5,1,solve_HeadName.bgColor)
- this.bitmap.drawText(name, 0, 0, solve_HeadName.width, solve_HeadName.height, 'center')
- }
- Sprite_HeadName.prototype.headName = function () {
- let character = this._deploy._character;
- if (character && character.findMeta) {
- return character.findMeta("name") || ''
- }
- return '';
- }
- solve_HeadName.Sprite_Character_initialize = Sprite_Character.prototype.initialize
- Sprite_Character.prototype.initialize = function (character) {
- solve_HeadName.Sprite_Character_initialize.call(this, character);
- if (character && character.findMeta && character.findMeta("name")) {
- this._headSprite = new Sprite_HeadName(this)
- }
- };
- solve_HeadName.Sprite_Character_update = Sprite_Character.prototype.update
- Sprite_Character.prototype.update = function () {
- solve_HeadName.Sprite_Character_update.call(this);
- if (this._headSprite) {
- this.parent.addChild(this._headSprite)
- this._headSprite = undefined;
- }
- };
复制代码 |
评分
-
查看全部评分
|