设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1194|回复: 0
打印 上一主题 下一主题

[有事请教] 有没有大佬能帮改下这个代码?

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7202
在线时间
1030 小时
注册时间
2006-7-18
帖子
534
跳转到指定楼层
1
发表于 2023-4-13 10:38:13 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 雷影 于 2023-4-13 10:41 编辑

在网上找到的一个教学的代码?想进一步修改一下显示文字的内容.
想法1:显示队伍角色的简介内容(用来显示人物基本背景信息)
想法2:关联到公共事件中,显示公共事件里的文本(公共事件里倒是可以自己写用变量+条件分支来显示当前游戏进度的对话文本以及接下来的目标什么的文字)

JAVASCRIPT 代码复制
  1. var _Scene_Menu_create = Scene_Menu.prototype.create;
  2. Scene_Menu.prototype.create = function() {
  3.     _Scene_Menu_create.call(this);
  4.  
  5.     //创建自定义窗口,并将它加入主菜单界面
  6.     this._tipsWindow = new Window_Tips(0, 0);
  7.     this._tipsWindow.y = this._commandWindow.y + this._commandWindow.height + 5; //设置自定义窗口的Y坐标,由左上部的菜单命令窗口的Y轴坐标及其高度来决定
  8.     this.addWindow(this._tipsWindow);
  9. };
  10.  
  11. function Window_Tips() {
  12.     this.initialize.apply(this, arguments);
  13. }
  14.  
  15. Window_Tips.prototype = Object.create(Window_Base.prototype);
  16. Window_Tips.prototype.constructor = Window_Tips;
  17.  
  18. Window_Tips.prototype.initialize = function(x, y) {
  19.     var width = this.windowWidth();
  20.     var height = this.windowHeight();
  21.     Window_Base.prototype.initialize.call(this, x, y, width, height);
  22.     this.refresh();
  23. };
  24.  
  25. Window_Tips.prototype.windowWidth = function() {
  26.     return 240; //自定义窗口的宽度
  27. };
  28.  
  29. Window_Tips.prototype.windowHeight = function() {
  30.     return this.fittingHeight(4); //自定义窗口的高度:通过设定窗口要容纳的行数来自动计算高度
  31. };
  32.  
  33. Window_Tips.prototype.refresh = function() {
  34.     var x = this.textPadding();
  35.     var width = this.contents.width - this.textPadding() * 2;
  36.     this.contents.clear();
  37.  
  38.     //在这里绘制需要显示的内容
  39.     this.drawIcon(191, 0, 0);
  40.     this.drawTextEx("新的任务", 40, 0);
  41.     this.drawTextEx("找到老王头,拿\n到红色宝箱。", 0, 40);
  42. };
  43.  
  44. Window_Tips.prototype.open = function() {
  45.     this.refresh();
  46.     Window_Base.prototype.open.call(this);
  47. };

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-20 22:57

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表