放置单位


你已经看见过我之前的游戏截图了,有一个放置单位的命令框,就是通过类似下列语句制作出来的:

注:这个教程与我制作的命令框只是原理一样,界面是不一样的。

uimainnew按照格式添加(这个文件在data3.bar自己提取):
<!--游戏界面图标--> <gadget name="Place" type="button" z="21" size1024="996 52 1022 78" mouseovertext="$$17092$$" foreground="" sound="UI_DefaultPregameClickSet" activateondown="" background="Art\ui\abilities\ability_Fire_Command"> <command>gadgetToggle("PlaceUnit1") editMode("PlaceUnit")</command> </gadget> <!--设定单位/建筑物,若缺少上述语句( editMode("PlaceUnit"))配合,会出现无法放置单位的情况。--> <gadget name="PlaceUnit1" type="gadget" size1024="822 100 1022 150" hidden="" moveable="" closebutton="" bevel="" titlebar="Barrack" windowzstyle="" closeonesc="" background="ui\editor\editor_background"> <gadget name="ProtoName" type="textField" scrollvert="" alphasort="" history="" sizerel1024="0 0 200 25" textcolor="0 0 0" textfont="Arial nobold nodrop" textfontsize="12"> <dropdown command="uiSetProtoCursor("Crossbowman", true)">弩手</dropdown> <dropdown command="uiSetProtoCursor("ypConsulateBestieros", true)">葡萄牙弩手</dropdown> <dropdown command="uiSetProtoCursor("Longbowman", true)">长弓手</dropdown> <dropdown command="uiSetProtoCursor("xpAenna", true)">艾那弓箭步兵</dropdown> <dropdown command="uiSetProtoCursor("xpWarBow", true)">鹰神弓兵</dropdown> <dropdown command="uiSetProtoCursor("xpMacehualtin", true)">掷石绳武士</dropdown> <dropdown command="uiSetProtoCursor("ypChuKoNu", true)">诸葛弩</dropdown> <dropdown command="uiSetProtoCursor("ypYumi", true)">玉米</dropdown> <dropdown command="uiSetProtoCursor("xpArrowKnight", true)">弓箭武士</dropdown> <dropdown command="uiSetProtoCursor("xpEagleKnight", true)">鹰游击武士</dropdown> <dropdown command="uiSetProtoCursor("Skirmisher", true)">散兵</dropdown> <dropdown command="uiSetProtoCursor("ypConsulateRogersRanger", true)">罗杰的射手</dropdown> <dropdown command="uiSetProtoCursor("ypConsulatePrussianNeedleGun", true)">护卫德国长枪兵</dropdown> <dropdown command="uiSetProtoCursor("Cacadore", true)">葡萄牙散兵</dropdown> <dropdown command="uiSetProtoCursor("Strelet", true)">俄国散兵</dropdown> <dropdown command="uiSetProtoCursor("xpMusketWarrior", true)">森林游荡者</dropdown> <dropdown command="uiSetProtoCursor("xpWarRifle", true)">瓦其那步枪兵</dropdown> <dropdown command="uiSetProtoCursor("ypArquebusier", true)">火绳枪兵</dropdown> <dropdown command="uiSetProtoCursor("ypNatMercGurkha", true)">廓尔喀兵</dropdown> <dropdown command="uiSetProtoCursor("ypNatMercGurkhaJemadar", true)">曼沙达尔廓尔喀兵</dropdown> <dropdown command="uiSetProtoCursor("xpTomahawk", true)">战斧兵</dropdown> <dropdown command="uiSetProtoCursor("Musketeer", true)">火鎗兵</dropdown> <dropdown command="uiSetProtoCursor("ypConsulateRedcoat", true)">红衣军</dropdown> <dropdown command="uiSetProtoCursor("ypConsulateStadhouders", true)">荷兰省长</dropdown> <dropdown command="uiSetProtoCursor("ypConsulateGuerreiros", true)">葡萄牙火枪手</dropdown> <dropdown command="uiSetProtoCursor("Janissary", true)">苏丹亲兵</dropdown> <dropdown command="uiSetProtoCursor("ypConsulateTufanciCorps", true)">土方其军团</dropdown> <dropdown command="uiSetProtoCursor("ypAshigaru", true)">日本火枪步兵</dropdown> <dropdown command="uiSetProtoCursor("ypSepoy", true)">印度兵</dropdown> <dropdown command="uiSetProtoCursor("ypspchuang", true)">黄坚</dropdown> <dropdown command="uiSetProtoCursor("单位或建筑调用名", true)">选项显示文字,需要输入中文字请将xml另存为,将编码改成UTF-8</dropdown> </gadget> </gadget>

请将xml文件另存为UTF-8格式,请将xml文件另存为UTF-8格式,请将xml文件另存为UTF-8格式,重要的事情说三遍。

传送门
  uimainnew.xml - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)
<?xml version="1.0" encoding="utf-8"?>

<layout>
	<gadget name="winLoseDisplay" type="textBox" size1024="20 230 1004 300" textcenterhoriz="" textfont="LargeIngame" textfontsize="24" textcolor="255 255 255" hidden=""/>
	<gadget name="winLoseDisplayIgnoresFade" type="textBox" size1024="20 230 1004 300" textcenterhoriz="" textfont="LargeIngame" textfontsize="24" textcolor="255 255 255" hidden=""/>
	<gadget name="victoryDisplay" type="textBox" textcolor="255 255 255" transparent="" textfont="LargeInGame" textfontsize="24" textcenterhoriz="" textcentervert="" size1024="82 206 962 498" z="9"/>
	<gadget name="victoryTimerDisplay0" type="formatText" textcolor="255 255 255" transparent="" textcentervert="" textcenterhoriz="" textfont="TimerDisplays" textfontsize="12" size1024="682 52 1022 84" z="7" background="ui\ingame\objective_counter" texturecoords="0.336594911937378 0 1 1"/>
	<gadget name="victoryTimerDisplay1" type="formatText" textcolor="255 255 255" transparent="" textcentervert="" textcenterhoriz="" textfont="TimerDisplays" textfontsize="12" size1024="682 52 1022 84" z="7" background="ui\ingame\objective_counter" texturecoords="0.336594911937378 0 1 1"/>
	<gadget name="victoryTimerDisplay2" type="formatText" textcolor="255 255 255" transparent="" textcentervert="" textcenterhoriz="" textfont="TimerDisplays" textfontsize="12" size1024="682 52 1022 84" z="7" background="ui\ingame\objective_counter" texturecoords="0.336594911937378 0 1 1"/>
	<gadget name="chatInput" type="gadget" size1024="4 472 382 496" background="ui\ingame\background_blue_c" hidden="" tilebackground="" windowzstyle="" closeonesc="" dontautoclose="">
		<gadget name="chatInputArtLeft" type="gadget" size1024="4 472 68 496" background="ui\ingame\in_game_chat_left"/>
		<gadget name="chatInputArtMiddle" type="gadget" size1024="68 472 318 496" background="ui\ingame\in_game_chat_mid" tilebackgroundhoriz="">
			<gadget name="chatInput-text" type="editBox" enterkey="" grabinput="" textfont="ChatInput" textfontsize="12" textcolor="255 255 255" size1024="4 474 382 497" enableime="" editboxmaxchars="100"/>
		</gadget>
		<gadget name="chatInputArtRight" type="gadget" size1024="318 472 382 496" background="ui\ingame\in_game_chat_right"/>
		<gadget name="chatInput-sendButton" size1024="-352 351 -256 383" type="stateButton" texturecoords="0 0 .75 1" textfont="InGameButtons" textfontsize="18" textcolor="255 208 0" statebuttonuseinternalstates="">
			<command>uiSendIngameChat</command>
			<stateentry background=""/>
			<stateentry background=""/>
			<stateentry background=""/>
			<stateentry background=""/>
		</gadget>
	</gadget>

<!--为了保证圣典打开本页面的时候流畅以及降低圣典体积,此处省略200KB语句,你直接把传送门的所说红色语句复制到最底下的</layout>上面就行。-->

<gadget name="NotifyTextDisplay" type="formattext" textfont="ChatOutline" textfontsize="12" textwrapoff="" background="ui\core_ui\shaded_dark" textcentervert="" textcenterhoriz="" textmarkup="" size1024="352 512 672 536" z="10" transparent=""> <gadget name="NotifyTextDisplay-spacer-left" backgroundalpha="1.0" type="gadget" background="ui\core_ui\shaded_dark" size1024="344 512 352 536" z="10" transparent=""/> <gadget name="NotifyTextDisplay-spacer-right" backgroundalpha="1.0" type="gadget" background="ui\core_ui\shaded_dark" size1024="672 512 680 536" z="10" transparent=""/> <gadget name="NotifyTextDisplay-border-top-left" backgroundalpha="1.0" type="gadget" background="ui\ingame\outline_top_left" size1024="341 509 344 512" z="11" texturecoords=".25 .25 1 1" transparent=""/> <gadget name="NotifyTextDisplay-border-top-middle" backgroundalpha="1.0" type="gadget" background="ui\ingame\outline_top_middle" size1024="344 509 680 512" tilebackgroundhoriz="" z="11" texturecoords="0 .25 1 1" transparent=""/> <gadget name="NotifyTextDisplay-border-top-right" backgroundalpha="1.0" type="gadget" background="ui\ingame\outline_top_right" size1024="680 509 683 512" z="11" texturecoords="0 .25 .75 1" transparent=""/> <gadget name="NotifyTextDisplay-border-side-left" backgroundalpha="1.0" type="gadget" background="ui\ingame\outline_side_left" size1024="341 512 344 536" tilebackgroundvert="" z="11" texturecoords=".25 0 1 1" transparent=""/> <gadget name="NotifyTextDisplay-border-side-right" backgroundalpha="1.0" type="gadget" background="ui\ingame\outline_side_right" size1024="680 512 683 536" tilebackgroundvert="" z="11" texturecoords="0 0 .75 1" transparent=""/> <gadget name="NotifyTextDisplay-border-bottom-left" backgroundalpha="1.0" type="gadget" background="ui\ingame\outline_bottom_left" size1024="341 536 344 539" z="11" texturecoords=".25 0 1 .75" transparent=""/> <gadget name="NotifyTextDisplay-border-bottom-middle" backgroundalpha="1.0" type="gadget" background="ui\ingame\outline_bottom_middle" size1024="344 536 680 539" tilebackgroundhoriz="" z="11" texturecoords="0 0 1 .75" transparent=""/> <gadget name="NotifyTextDisplay-border-bottom-right" backgroundalpha="1.0" type="gadget" background="ui\ingame\outline_bottom_right" size1024="680 536 683 539" z="11" texturecoords="0 0 .75 .75" transparent=""/> </gadget> <gadget name="clockTimer" type="clockTimer" size1024="290 -1 678 72" z="10" background="ui\ingame\warwick_timer_panel" texturecoords="0 0 0.759295499021526 0.574803149606299"> <gadget name="clockTimer_displayText" type="formatText" textcolor="255 255 255" textfontsize="11" textmarkup="" textfont="ChatOutline" textjustifyleft="" size1024="423 53 649 73" z="10"/> <gadget name="clockTimer_teamText" type="formatText" textcolor="255 255 255" textfontsize="11" textmarkup="" textfont="ChatOutline" textjustifyleft="" size1024="423 43 649 63" z="10"/> <gadget name="clockTimer_face" type="gadget" size1024="359 0 423 64" z="11"/> </gadget> <gadget name="serverMaintenanceButton" type="stateButton" z="16" size1024="834 2 870 34" clampforeground="" clampbackground="" activateondown="" texturecoords="0 0 1 1" textfont="SmallButtonFont" textfontsize="10" textcolor="255 255 255" hidden=""> <stateentry background="ui\eso\server_maintenence_a"/> <stateentry background="ui\eso\server_maintenence_b"/> </gadget> <gadget name="Place" type="button" z="21" size1024="996 52 1022 78" mouseovertext="$$17092$$" foreground="" sound="UI_DefaultPregameClickSet" activateondown="" background="Art\ui\abilities\ability_Fire_Command"> <command>gadgetToggle("PlaceUnit1") editMode("PlaceUnit")</command> </gadget> <gadget name="PlaceUnit1" type="gadget" size1024="822 100 1022 150" hidden="" moveable="" closebutton="" bevel="" titlebar="Barrack" windowzstyle="" closeonesc="" background="ui\editor\editor_background"> <gadget name="ProtoName" type="textField" scrollvert="" alphasort="" history="" sizerel1024="0 0 200 25" textcolor="0 0 0" textfont="Arial nobold nodrop" textfontsize="12"> <dropdown command="uiSetProtoCursor("Crossbowman", true)">弩手</dropdown> <dropdown command="uiSetProtoCursor("ypConsulateBestieros", true)">葡萄牙弩手</dropdown> <dropdown command="uiSetProtoCursor("Longbowman", true)">长弓手</dropdown> <dropdown command="uiSetProtoCursor("xpAenna", true)">艾那弓箭步兵</dropdown> <dropdown command="uiSetProtoCursor("xpWarBow", true)">鹰神弓兵</dropdown> <dropdown command="uiSetProtoCursor("xpMacehualtin", true)">掷石绳武士</dropdown> <dropdown command="uiSetProtoCursor("ypChuKoNu", true)">诸葛弩</dropdown> <dropdown command="uiSetProtoCursor("ypYumi", true)">玉米</dropdown> <dropdown command="uiSetProtoCursor("xpArrowKnight", true)">弓箭武士</dropdown> <dropdown command="uiSetProtoCursor("xpEagleKnight", true)">鹰游击武士</dropdown> <dropdown command="uiSetProtoCursor("Skirmisher", true)">散兵</dropdown> <dropdown command="uiSetProtoCursor("ypConsulateRogersRanger", true)">罗杰的射手</dropdown> <dropdown command="uiSetProtoCursor("ypConsulatePrussianNeedleGun", true)">护卫德国长枪兵</dropdown> <dropdown command="uiSetProtoCursor("Cacadore", true)">葡萄牙散兵</dropdown> <dropdown command="uiSetProtoCursor("Strelet", true)">俄国散兵</dropdown> <dropdown command="uiSetProtoCursor("xpMusketWarrior", true)">森林游荡者</dropdown> <dropdown command="uiSetProtoCursor("xpWarRifle", true)">瓦其那步枪兵</dropdown> <dropdown command="uiSetProtoCursor("ypArquebusier", true)">火绳枪兵</dropdown> <dropdown command="uiSetProtoCursor("ypNatMercGurkha", true)">廓尔喀兵</dropdown> <dropdown command="uiSetProtoCursor("ypNatMercGurkhaJemadar", true)">曼沙达尔廓尔喀兵</dropdown> <dropdown command="uiSetProtoCursor("xpTomahawk", true)">战斧兵</dropdown> <dropdown command="uiSetProtoCursor("Musketeer", true)">火鎗兵</dropdown> <dropdown command="uiSetProtoCursor("ypConsulateRedcoat", true)">红衣军</dropdown> <dropdown command="uiSetProtoCursor("ypConsulateStadhouders", true)">荷兰省长</dropdown> <dropdown command="uiSetProtoCursor("ypConsulateGuerreiros", true)">葡萄牙火枪手</dropdown> <dropdown command="uiSetProtoCursor("Janissary", true)">苏丹亲兵</dropdown> <dropdown command="uiSetProtoCursor("ypConsulateTufanciCorps", true)">土方其军团</dropdown> <dropdown command="uiSetProtoCursor("ypAshigaru", true)">日本火枪步兵</dropdown> <dropdown command="uiSetProtoCursor("ypSepoy", true)">印度兵</dropdown> <dropdown command="uiSetProtoCursor("ypspchuang", true)">黄坚</dropdown> <dropdown command="uiSetProtoCursor("单位或建筑调用名", true)">选项显示文字,需要输入中文字请将xml另存为,将编码改成UTF-8</dropdown> </gadget> </gadget> </layout>

效果图:

你也可以不添加图标,直接用快捷键调出来,在defaultkeymapy.xml增加快捷键,添加上<command>gadgetToggle("PlaceUnit1") editMode("PlaceUnit") </command>就可以了。 control-numpaddivide是Ctrl+数字键盘的*键
  Defaultkeymapy.xml.xml - 记事本 ____ X
文件(F)  编辑(E)  格式(O)  查看(V)  帮助(H)
<!-- converted from XMB to XML -->

<defaultkeymapy>
	<keymapgroup name="GeneralGameHotkeys" displayname="$$43347$$General Game Hotkeys">
		<keymapdata>
			<name>PlaceUnit</name>
			<displayname>PlaceUnit</displayname>
			<event>control-numpaddivide</event>
			<context>game</context>
			<command>gadgetToggle("PlaceUnit1") editMode("PlaceUnit")</command>
		</keymapdata>
		<keymapdata>
			<name>Move all Military</name>
			<displayname>$$68810$$Move all Military</displayname>
			<event>alt-y</event>
			<context>game</context>
			<command>editMode("moveAllMilitary") uiSetProtoCursor("WaypointFlag")</command>
		</keymapdata>
		<keymapdata>
			<name>Delete Selected Units</name>
			<displayname>$$43335$$Delete Selected Units</displayname>
			<event>delete</event>
			<context>game</context>
			<command>uiDeleteSelectedUnit</command>
		</keymapdata>
		<keymapdata>
			<name>Delete Selected Units Alt</name>
			<displayname>$$43379$$Delete Selected Units (alternate)</displayname>
			<event>numpadperiod</event>
			<context>game</context>
			<command>uiDeleteSelectedUnit2</command>
		</keymapdata>
		<keymapdata>
			<name>Show Chat Window</name>
			<displayname>$$43336$$Show Chat Window</displayname>
			<event>enter</event>
			<context>game</context>
			<command>uiShowChatWindow() uiIgnoreNextKey</command>
		</keymapdata>
		<keymapdata>
			<name>Show Objectives Dialog</name>
			<displayname>$$43337$$Show Objectives Dialog</displayname>
			<event>f3</event>
			<context>game</context>
			<command>uiShowObjectivesDialog</command>
		</keymapdata>









命令:

editMode("PlaceUnit")
放置单位
uiSetProtoCursor("XXXXXX", true)
设定单位或建筑,与editMode("PlaceUnit")一起使用。
uiCopyToClipboard
复制选中的单位
editMode("UnitPaste")
粘贴已复制的单位
editMode("PlaceWall") uiSetProtoCursor("WallConnector", true)
放置墙柱
fog()
除去战雾
blackmap()
除去黑色地图
gadgetToggle("gameprotopalette")
打开剧情编辑器的放置单位框
PS:勾选游戏记录后无法放置单位。

不要认为这个教程的内容能用于联机,你可以自己试试,看看是不是在联机的时候,把鼠标按到烂也不能放置一个单位。