【RPG Maker MV 仿新仙剑 战斗场景UI (八)】

news/2024/5/18 14:45:28 标签: ui, javascript, 游戏程序, 技术美术

RPG Maker MV 仿新仙剑 战斗场景UI 八

  • 状态及装备场景
  • 代码
  • 效果

状态及装备场景

本计划在战斗场景中直接制作的,但考虑到在战斗场景中加入太多的窗口这不太合适,操作也繁琐,因此直接使用其他场景。

代码

javascript">Pal_Window_EquipStatus.prototype.drawNewParam = function(paramId) {
	this.drawText(this._tempActor.param(paramId), 500, 14+32*this._actorState.indexOf(paramId), 110, 'left');
};
al_Window_EquipStatus.prototype.drawCurrentParam = function(paramId) {
	this.drawText(this._actor.param(paramId), 400, 14+32*this._actorState.indexOf(paramId), 110, 'left');
};

这里由于之前测试通过,因此去掉绘制数值上的**+9999**。

javascript">Pal_Scene_Battle.prototype.commandStates = function() {
	SceneManager.push(Scene_Status);
};
Pal_Scene_Battle.prototype.commandEquip = function() {
	SceneManager.push(Pal_Scene_Equip);
};

直接前往这两个场景,显示数据信息。

为了保证场景之间跳转后之前的操作保留(看上去),因此在对应场景中添加如下代码:

javascript">Scene_Status.prototype.popScene = function() {
	switch(SceneManager._stack[1].name){
		case "Scene_Menu":
		break;
		case "Pal_Scene_Battle":
		SceneManager.scene_windows.command1_active=false;
		SceneManager.scene_windows.command2_active=true;
		SceneManager.scene_windows.command3_active=false;
		SceneManager.scene_windows.command1_index=3;
		SceneManager.scene_windows.command2_index=4;
		SceneManager.scene_windows.command3_index=-1;
		break;
		default:
		break;
	}
	 Scene_ItemBase.prototype.popScene.call(this);
};
Pal_Scene_Equip.prototype.popScene = function() {
	switch(SceneManager._stack[1].name){
		case "Scene_Menu":
		SceneManager.scene_windows.command1_active=false;
		SceneManager.scene_windows.command2_active=true;
		SceneManager.scene_windows.command3_active=false;
		SceneManager.scene_windows.command1_index=2;
		SceneManager.scene_windows.command2_index=1;
		SceneManager.scene_windows.command3_index=-1;
		break;
		case "Pal_Scene_Battle":
		SceneManager.scene_windows.command1_active=false;
		SceneManager.scene_windows.command2_active=false;
		SceneManager.scene_windows.command3_active=true;
		SceneManager.scene_windows.command1_index=3;
		SceneManager.scene_windows.command2_index=0;
		SceneManager.scene_windows.command3_index=2;
		break;
		default:
		break;
	}
	 Scene_ItemBase.prototype.popScene.call(this);
};

这是在场景管理器中设置跳转后的操作信息,涉及到返回的场景有战斗场景主菜单场景

javascript">Pal_Scene_Battle.prototype.initWindons = function() {
    if(!SceneManager.scene_windows.command1_active){
		if(!SceneManager.scene_windows.command2_active){
			if(SceneManager.scene_windows.command3_active){
				this._actorCommandWindow._index=SceneManager.scene_windows.command1_index;
				this.commandOther();
				this._otherCommandWindow._index=SceneManager.scene_windows.command2_index;
				this.commandOperateItem();
				this._itemCommandWindow._index=SceneManager.scene_windows.command3_index;
				this._actorCommandWindow.deactivate();
				this._otherCommandWindow.deactivate();
				SceneManager.initScene_windows()
			}
		}else{//从状态场景返回战斗场景
			this._actorCommandWindow._index=SceneManager.scene_windows.command1_index;
			this.commandOther();
			this._otherCommandWindow._index=SceneManager.scene_windows.command2_index;
			this._actorCommandWindow.deactivate();
			SceneManager.initScene_windows();
		}
	}
};
/** 
 * 开始队伍命令选择
 */
Pal_Scene_Battle.prototype.startPartyCommandSelection = function() {
    this._statusWindow.deselect();
    this._statusWindow.open();
	this.refreshStatus();
    this._actorCommandWindow.close();
	this.selectNextCommand();
	this.initWindons();
};

然后再对应的场景使用即可,不过现在发现问题还挺多的,比如会有明显的UI跳动痕迹,显示不自然等,后续慢慢优化吧!
主菜单场景的就不发出来了,那个写出来比战斗的场景简单太多了!

效果

这效果其实还挺有喜剧效果的。
在这里插入图片描述
将窗口打开的速度降低的最低后,可以看到最先出现的就是状态的显示。
在这里插入图片描述
正常来说应该先显示人物的战斗指令的,但看来没有先显示,同时额外战斗的指令窗口打开的也很有喜感,是在慢慢的不断拉开的效果,同时默认可以看到就在道具这个选项上,但这是从状态返回的啊;所有全部展开后,才跳到状态选项,所有会有UI跳动的情况。
在这里插入图片描述
这里可以看到额外物品的指令窗口是同步打开的,这里看着非常明显,但战斗的指令窗口却得等到这两个窗口全部展开后才能显示,之后就是指令下标的跳转,及UI的变动。
不知道大家有什么好的优化手段,可以提出来,学习学习大家的先进经验!!!


http://www.niftyadmin.cn/n/5448070.html

相关文章

unity 多屏幕操作

想了解基础操作请移步:(重点是大佬写的好,这里就不再赘述) Unity 基础 之 使用 Display 简单的实现 多屏幕显示的效果_unity display-CSDN博客 在panel上也可以通过获取 Canvas,来达到切换多屏幕的操作, …

论文:Zero-Shot Entity Linking by Reading Entity Descriptions翻译笔记(阅读实体描述、实体链接)

文章目录 论文题目:通过阅读实体描述实现零样本实体链接摘要1 介绍2 零点实体链接2.1 审查: 实体链接2.2 任务定义2.3 与其他 EL 任务的关系 3 数据集构建4 实体链接模型4.1 生成候选4.2 候选排序 5 适应目标世界6 实验6.1 基线6.2 对未知实体和新世界6.…

ASP.NET-Global.asax使用详解

本文介绍了如何使用Global.asax文件来增强ASP.NET Web应用程序的功能。首先,介绍了Global.asax文件的作用和基本功能。接着,详细探讨了在Global.asax中实现定时任务、应用程序级别的错误处理、应用程序启动和结束时执行特定逻辑等功能。随后,…

tornado上传文件

简介 在 Tornado web 框架中,上传图片通常涉及创建一个表单,让用户选择文件并上传。Tornado 通过其 RequestHandler 类来处理这些请求,你可以重写 post 方法来接收上传的文件。 后端 import os import tornado.ioloop import tornado.web …

深入了解Kimi:月之暗面科技有限公司的创新智能助手

无极低码 :https://wheart.cn 更多人工智能工具请访问无极低码: 程序员资源中心 - 无极低码、编程技术、解决方案、源码下载、可视化技术、前端 在这个快速发展的数字时代,人工智能技术正逐渐渗透到我们生活的方方面面。月之暗面科技有限公司…

JavaEE--小Demo--数据库建立

目录 实验准备 本次所要新建的文件 实验步骤 step1-demo.sql 1.在resources文件夹下新建demo.sql文件 2.打开此目录,并运行命令提示符 3.打开数据库mysql -uroot -p 4.创建数据库create database demo; 5.使用数据库use demo; 6.导入数据source demo.sql;…

YAML-02-yml 配置文件 java 整合使用 yamlbeans + snakeyaml + jackson-dataformat-yaml

java 中处理 yml 的开源组件是什么? 在Java中处理YAML(YAML Aint Markup Language)格式的开源组件有很多,其中一些比较常用的包括: SnakeYAML: SnakeYAML 是一个Java库,用于解析和生成YAML格式…

【MySQL系列】Public Key Retrieval is not allowed

💝💝💝欢迎来到我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。 推荐:kwan 的首页,持续学…