先啰嗦几句,若赶时间的话请直接跳至第二段...。从0.890开始M&B的ModuleSystem里增加了这个presentations.py。因为论坛里的入门教程是808时代的,没有关于这方面的介绍,所以一直以来几乎没见过和此相关的功能或者mod,我也只知道这个是用来做一些图形界面的,没研究过。直到前一段时间看了暗暗和rubik利用presentations做的血条和兵力条之后,才对此产生了兴趣。研究了一段时间有一点点心得体会,和大家分享一下,作为抛砖引玉罢~ 希望各位高手也能讲讲心得,指出文中的错误、补充不足。
这个presentations.py提供的功能确实很强大,我们可以在游戏界面里,即平行于显示器屏幕的这个二维平面中(下文均简称为“视平面”)的任意位置添加文字和模型。在一个presentation里,每个被加入的对象都有自己的id,利用operations中相应的一些命令可以针对每个对象进行旋转、缩放、定位、变色等操作,也可以动态表现这些变化过程,从而获得如淡入、淡出、位移、转动等特殊效果。只要你乐意,做出个动画片都行。
第一部分:operations中相关的操作符以及其含义、用法解释
先来逐个分析一下operations中关于presentation的一些操作了解它们的含义,后面可能都会用到:
start_presentation = 900
# (start_presentation, <presentation_id>),
#功能:用来启动presentation的命令。
#格式:(start_presentation, "prsnt_battle"),
#说明:"prsnt_battle"是需要启动的presentation的id。"prsnt"是必需的前缀,"battle"是其在presentations.py中的id名称(战场小地图)。
#说明2:两个不同id的presentation不能被同时启动,即启动后一个时前一个会自动关闭。
start_background_presentation = 901
# (start_background_presentation, <presentation_id>),
#can only be used in game menus
#功能:只能在game_menus.py中使用,从字面意思看就是用一个presentation来当作菜单的背景。
#格式:(start_background_presentation, "prsnt_background"),
#问题:搞这么麻烦~我直接把背景的贴图改掉不就得了?
回答:利用这个可以更灵活的控制背景图案的变化,甚至可以为菜单做一个动态的背景图。
presentation_set_duration = 902
# (presentation_set_duration, <duration-in-1/100-seconds>),
#there must be an active presentation
#功能:设置当前presentation的运行时间。
#格式:(presentation_set_duration, 999999),
#说明:时间单位为百分之一秒。特殊的操作是将时间设为0,则会立即停止当前的presentation。一般情况下这个时间都设置为一个较大的值如999999,必要时利用0值的设置即可关闭之。
create_text_overlay = 910
# (create_text_overlay, <destination>, <string_id>),
#returns overlay id
#功能:建立一个文本对象
#格式:(create_text_overlay, reg1, "str_sample_banner", tf_center_justify),
#说明:当前创建的对象在presentation中的id会储存在reg1中,也可以使用自定的全局变量"$xxx"代替reg1。"str_sample_banner"是文字的内容,也可以使用如"@...."这样的快捷字符串,或者事先将文字内容存在诸如"s1"等此类字符串变量中在这里直接调用s1。
#tf_center_justify为文字的排版格式,详见第二部分。
create_mesh_overlay = 911
# (create_mesh_overlay, <destination>, <mesh_id>),
#returns overlay id
#功能:建立一个网格(模型)对象。
#格式:(create_mesh_overlay, reg1, "mesh_flag_infantry"),
#说明:创建的对象id储存在reg1中。 "mesh_flag_infantry"是所用的mesh,需要事先在module_meshes.py做好定义。不确定是否支持带有骨骼的mesh,这个我没试过。
create_button_overlay = 912
# (create_button_overlay, <destination>, <string_id>),
#returns overlay id
#功能:建立一个文本按钮。
#格式:(create_button_overlay, reg1 , "@Next Page", tf_center_justify),
#说明:创建的按钮对象id储存在reg1中。这样的按钮在鼠标滑过时会高亮显示,点击可以触发关联内容,本文第二部分会详细介绍。
create_image_button_overlay = 913
# (create_image_button_overlay, <destination>, <mesh_id>, <mesh_id>),
#returns overlay id. second mesh is the pressed button mesh
#功能:建立一个图形按钮。
#格式:(create_image_button_overlay, reg1, "mesh_banner_1", "mesh_banner_1_down"),
#说明:创建的按钮对象id储存在reg1中。"mesh_banner_1"为所用的mesh,"mesh_banner_1_down"是当点击此按钮时替换显示的mesh以表现按钮下沉的效果。两处也可以使用相同的mesh。和上面的create_button_overlay同样都能生成一个button,不同的是这里用图形代替了文字当作按钮。例如挑选旗帜时那些旗帜的图案都是image_button
create_slider_overlay = 914
# (create_slider_overlay, <destination>, <min_value>, <max_value>),
#returns overlay id
#功能:建立一个滑动条。
#格式: (create_slider_overlay, reg1, 0, 100),
#说明:滑动条对象id储存在reg1中,0是滑动条最左端的值(最小),100是最右端的值(最大)。如编辑人物脸型时那些滑动条。
create_progress_overlay = 915
# (create_progress_overlay, <destination>, <min_value>, <max_value>),
#returns overlay id
#功能:建立一个进度条,如开始游戏读取数据时的进度条。
#格式:(create_progress_overlay, reg1, 0, 100),
#说明:同create_slider_overlay
create_combo_button_overlay = 916
# (create_combo_button_overlay, <destination>),
#returns overlay id
#功能:暂时不明。
create_text_box_overlay = 917
# (create_text_box_overlay, <destination>),
#returns overlay id
#功能:暂时不明。
create_check_box_overlay = 918
# (create_check_box_overlay, <destination>),
#returns overlay id
#功能:建立一个选择块。
#格式:(create_check_box_overlay, reg1, "mesh_checkbox_off", "mesh_checkbox_on"),
#说明:选择块对象id储存在reg1中,"mesh_checkbox_off"是未被选中时的mesh,"mesh_checkbox_on"是被选中后的mesh。两个mesh可以相同,但为了方便区别其状态还是用不同的mesh吧。
overlay_set_text = 920
# (overlay_set_text, <overlay_id>, <string_id>),
#功能:还没用过,应该是给某已经创建的对象贴上文字。
#格式:(overlay_set_text, reg1, "str_wc"),
#说明:reg1是目标对象的id,"str_wc"是文字内容。
overlay_set_color = 921
# (overlay_set_color, <overlay_id>, <color>),
#color in RGB format like 0xRRGGBB (put hexadecimal values for RR GG and BB parts)
#功能:为指定对象设置颜色。
#格式:(overlay_set_color, "$flag", 0xff0000),
#说明:"$flag"是目标对象的id,0xff0000是16进制的颜色单位,当前为红色。本帖后面会附上一个简单的16进制色码表方便大家查色。如果你有photoshop,点击工具栏下端的颜色块打开调色框,调色框下方就有当前颜色的16进制码。
#特别注意:如果给mesh对象设置颜色,则该mesh在brfedit中mat选项卡里的shader类型和下方那些勾选项必须是特定类型。这方面我不太熟悉,根据自己的经验,只发现了simple_shader+201326593的组合可以被overlay_set_color应用颜色,其它设置还没成功过。如果你有自己的发现,请跟帖说明,谢谢分享。见注①。
overlay_set_alpha = 922
# (overlay_set_alpha, <overlay_id>, <alpha>),
#alpha in A format like 0xAA (put hexadecimal values for AA part)
#功能:为指定对象设置alpha值。alpha值得两个极端为0x00(对象完全消失)和0xff(对象完全显示)
#格式: (overlay_set_alpha, "$flag", 0xff),
#说明:"$flag"为目标对象id,0xff为alpha值(完全显示)
#特别注意:和overlay_set_color一样,同样需要特别注意的是如果应用对象是mesh,该mesh必须有特定的设置,否则功能无效。见注①。
overlay_set_hilight_color = 923
# (overlay_set_hilight_color, <overlay_id>, <color>),
#color in RGB format like 0xRRGGBB (put hexadecimal values for RR GG and BB parts)
#功能:没有仔细测试过效果,看字面意思就是给指定的对象设置高光色彩
#格式:(overlay_set_hilight_color, "$flag",0xff0000),
#说明:"$flag"为目标对象id,0xff0000高光颜色
overlay_set_hilight_alpha = 924
# (overlay_set_hilight_alpha, <overlay_id>, <alpha>),
#alpha in A format like 0xAA (put hexadecimal values for AA part)
#功能:同上没有测试过效果,字面意思是给指定的对象设置高光alpha值(透明色)
#格式: (overlay_set_hilight_alpha, "$flag", 0xff),
#说明:"$flag"为目标对象id,0xff为alpha值
overlay_set_size = 925
# (overlay_set_size, <overlay_id>, <position_no>),
#position's x and y values are used
#功能:设置对象尺寸
#格式:(overlay_set_size, reg1, pos1),
#说明:reg1是目标对象的id,pos1的x,y坐标值为该目标对象在屏幕中的宽和高。通常在overlay_set_size之前会先用(position_set_x, pos1, 100),(position_set_y, pos1, 100),来设置需要的宽和高。
#说明2:这种缩放是以目标对象的几何中心为原点行进的,当对象的size发生变化时其自身原点所在位置也会改变。
#求助:关于度量的单位我也有点拿不准,似乎是像素点。视平面的左下角是坐标原点,x轴坐标值向右增大,y轴坐标值向上增大。反向则为负值。整个视平面的宽和高似乎是1000x1000,但有时又比较小像是800x800的。这里我的确还比较晕,还在靠不断目测来调整定位对象。请各位路过的高手暂停锻炼 指点迷津!
overlay_set_position = 926
# (overlay_set_position, <overlay_id>, <position_no>),
#position's x and y values are used
#功能:设置对象在视平面中的位置,会使指定对象的原点和pos1重叠。
#格式:(overlay_set_position, reg1, pos1),
#说明:reg1是目标对象的id,其原点位置在创建此模型时的全局坐标原点。pos1的x,y坐标值对应视平面上的坐标位置。
overlay_set_val = 927
# (overlay_set_val, <overlay_id>, <value>),
#can be used for sliders, combo buttons and check boxes
#功能:设置对象的值,只用于sliders, combo buttons和check boxes
#格式:(overlay_set_val, reg1, 0),
#说明:reg1是目标对象的id。0是当前设置的值,以目标对象的取值范围为准。
overlay_set_boundaries = 928
# (overlay_set_boundaries, <overlay_id>, <min_value>, <max_value>),
#功能:没用过,效果不明。
#格式:(overlay_set_boundaries, reg1, 0, 100),
#说明:reg1是目标对象的id,0是最小值,100是最大值。
overlay_set_area_size = 929
# (overlay_set_area_size, <overlay_id>, <position_no>),
#position's x and y values are used
#功能:没用过效果不明。
#格式:(overlay_set_area_size, reg1, pos1),
#说明:pos1的x,y坐标值为设定的宽和高。
overlay_set_mesh_rotation = 930
# (overlay_set_mesh_rotation, <overlay_id>, <position_no>),
#position's rotation values are used for rotations around x, y and z axis
#功能:旋转目标对象
#格式:(overlay_set_mesh_rotation, “$fan”, pos1),
#说明: “$fan”为目标对象id,pos1的x,y,z均可作为旋转轴。
#说明2:通常需要在之前用比如(position_rotate_x,pos1,30),来在对应坐标轴上旋转pos1,30是旋转的角度。这样当使用(overlay_set_mesh_rotation, “$fan”, pos1), 之后,"$fan”就会以自己的x坐标轴为轴旋转30度。
overlay_add_item = 931
# (overlay_add_item, <overlay_id>, <string_id>),
# adds an item to the combo box
#功能:给对象添加文字。
#格式: (overlay_add_item, "$house", "str_wc"),
#说明:"$house"是目标对象的id,"str_wc"是文字内容。
overlay_animate_to_color = 932
# (overlay_animate_to_color, <overlay_id>, <duration-in-1/1000-seconds>, <color>),
#alpha value will not be used
#功能:使指定对象在指定时间内渐变到指定颜色,动画效果。
#格式:(overlay_animate_to_color, reg1, 1000, 0xff0000),
#说明:reg1是目标对象的id。1000是花费时间,单位为1/1000秒,即当前为1秒。0xff0000是最终变化到的颜色。
#特别注意:如果对象是mesh,需要有特定的shader和勾选项设置,否则变色指令无效。见注①。
overlay_animate_to_alpha = 933
# (overlay_animate_to_alpha, <overlay_id>, <duration-in-1/1000-seconds>, <color>),
#only alpha value will be used
#功能:使指定对象在指定时间内渐变其alpha值。动画效果。
#格式:(overlay_animate_to_alpha, reg1, 1000, 0x00),
#说明:reg1是目标对象的id。1000是花费时间,单位为1/1000秒,即当前为1秒。0x00是最终渐变到的alpha值,0x00为全部隐藏,指定对象会失去光泽变为全黑。0xff为全部显示,指定对象色彩饱满。
#特别注意:如果对象是mesh,需要有特定的shader和勾选项设置,否则变色指令无效。见注①。
overlay_animate_to_highlight_color = 934
# (overlay_animate_to_highlight_color, <overlay_id>, <duration-in-1/1000-seconds>, <color>),
#alpha value will not be used
#功能:使指定对象在指定时间内渐变到高亮色彩。动画效果。
#格式:(overlay_animate_to_highlight_color, reg1, 1000, 0xff0000),
#说明:reg1是目标对象的id。1000是花费时间,单位为1/1000秒,即当前为1秒。
#特别注意:如果对象是mesh,需要有特定的shader和勾选项设置,否则变色指令无效。见注①。
overlay_animate_to_highlight_alpha = 935
# (overlay_animate_to_highlight_alpha, <overlay_id>, <duration-in-1/1000-seconds>, <color>),
#only alpha value will be used
#功能:使指定对象在指定时间内渐变高光alpha值(透明色)。动画效果。
#格式:(overlay_animate_to_highlight_alpha, reg1, 1000, 0x00),
#说明:reg1是目标对象的id。1000是花费时间,单位为1/1000秒,即当前为1秒。
#特别注意:如果对象是mesh,需要有特定的shader和勾选项设置,否则变色指令无效。见注①。
overlay_animate_to_size = 936
# (overlay_animate_to_size, <overlay_id>, <duration-in-1/1000-seconds>, <position_no>),
#position's x and y values are used as
#功能:使指定对象在指定时间内渐变到指定大小。动画效果。
#格式:(overlay_animate_to_size, reg1, 1000, pos1),
#说明:reg1是目标对象的id。1000是花费时间,单位为1/1000秒,即当前为1秒。pos1的x,y值为目标对象最终达到的宽和高。
#说明2:这种缩放是以目标对象的几何中心为原点行进的,当对象的size发生变化时其自身原点所在位置也会改变。
overlay_animate_to_position = 937
# (overlay_animate_to_position, <overlay_id>, <duration-in-1/1000-seconds>, <position_no>),
#position's x and y values are used as
#功能:使指定对象在指定时间内逐渐移动到指定位置。动画效果。
#格式:(overlay_animate_to_size, reg1, 1000, pos1),
#说明:reg1是目标对象的id。1000是花费时间,单位为1/1000秒,即当前为1秒。pos1的x,y值为目标对象最终到达的坐标位置。最终目标对象自身原点与pos1位置重叠。
create_image_button_overlay_with_tableau_material = 938
# (create_image_button_overlay_with_tableau_material, <destination>, <mesh_id>, <tableau_material_id>, <value>),
#returns overlay id. value is passed to tableau_material
# when mesh_id is -1, a default mesh is generated automatically
#功能:建立一个图案基于tableau_material的图形按钮。
#格式:(create_image_button_overlay_with_tableau_material, reg1, "mesh_color_picker", "tableau_color_picker", 0xff0000),
#说明:新建对象的id储存在reg1中,"mesh_color_picker"是此对象使用的mesh,"tableau_color_picker"是应用在"mesh_color_picker"上的图案,0xff0000为该对象的颜色。
#说明2:如果"mesh_color_picker"部分值为-1,即没有指定mesh,则系统会自动生成一个mesh和tableau_material匹配。
create_mesh_overlay_with_tableau_material = 939
# (create_mesh_overlay_with_tableau_material, <destination>, <mesh_id>, <tableau_material_id>, <value>),
#returns overlay id. value is passed to tableau_material
# when mesh_id is -1, a default mesh is generated automatically
#功能:建立一个图案基于tableau_material的图形对象。
#格式:(create_mesh_overlay_with_tableau_material, reg1, "mesh_color_picker", "tableau_color_picker", 0xff0000),
#说明:新建对象的id储存在reg1中,"mesh_color_picker"是此对象使用的mesh,"tableau_color_picker"是应用在"mesh_color_picker"上的图案,0xff0000为该对象的颜色。
#说明2:如果"mesh_color_picker"部分值为-1,即没有指定mesh,则系统会自动生成一个mesh和tableau_material匹配。
create_game_button_overlay = 940
# (create_game_button_overlay, <destination>, <string_id>),
#returns overlay id
#功能:似乎和create_button_overlay的效果类似,不知道有什么区别。
#格式:(create_game_button_overlay, reg1, "str_push_ups"),
#说明:新建对象的id储存在reg1中,"str_push_ups"为文字内容。
QUOTE:
注:
①用simple_shader+33558785的组合似乎能适应这里所有对mesh的颜色和alpha值的操作。—— 暗暗十分
第二部分:header_presentations.py以及module_presentations.py的参数解释及其结构和功能分析。
看完了operations中相关操作的用法,再来了解一下另外两个和presentation相关的.py文件。这样挨个看下去似乎有点枯燥,不过还好这部分的内容并不多(写完了发现也不少-___-!),而且把它们集中在一起也方便在需要的时候查阅。在了解这些系统提供的功能支持的同时,也可以想想自己能利用这些做出点儿什么。
一、header_presentations.py中关于文字排版的几条Text flags。
tf_left_align = 0x00000004
#含义:相对所在位置左端对齐。
#说明:同一个对象中的文字会以此对象在视平面中的position为起点、由左至右在视平面中水平排列,达到视平面右端后会自动向下换行、并转回起点的x坐标位置继续由左至右排列。
#说明2:超过1行的文字对象会用其垂直高度的中心来对准该对象所在的位置点,而不是一直以第一行文字为准对齐。
tf_right_align = 0x00000008
#含义:相对所在位置右端对齐。
#说明:同一个对象中的文字会以此对象在视平面中的position为起点、由右至左在视平面中水平排列,达到视平面左端后会自动向下换行、并转回起点的x坐标位置继续由右至左排列。
#说明2:超过1行的文字对象会用其垂直高度的中心来对准该对象所在的位置点,而不是一直以第一行文字为准对齐。
tf_center_justify = 0x00000010
#含义:相对所在位置中心对齐。
#说明:同一个对象中的文字会以此对象在视平面中的position为起点、同时向左、右两边在视平面中水平排列,达到视平面左或右端后会自动向下换行、并转回起点的x坐标位置继续同时向左、右两边排列。
#说明2:超过1行的文字对象会用其垂直高度的中心来对准该对象所在的位置点,而不是一直以第一行文字为准对齐。
tf_double_space = 0x00000800
#含义:使用双倍行距。
#说明:使每行文字的行距加大。具体数值似乎没法定义。一般多行文字用double_space的话看起来比较合适。
tf_vertical_align_center = 0x00001000
#含义:相对视平面中心对齐。
#说明:同一个对象中的文字会以视平面的中央点为起点、同时向左、右两边在视平面中水平排列,达到视平面左或右端后会自动向下换行、并转回起点的x坐标位置继续同时向左、右两边排列。
#说明2:超过1行的文字对象会用其垂直高度的中心来对准该对象所在的位置点,而不是一直以第一行文字为准对齐。
tf_scrollable = 0x00002000
#含义:从字面意思猜可能是某种文字滚动出现的效果。为啥是猜呢。。
#说明:因为我一用这个就被弹出游戏-____-! 求解。
prsntf_read_only = 0x00000001
#含义:屏蔽当前的presentation对鼠标点击等互动操作的反应。
#说明:比如兵力条、血条这类只需要看的presentation。其实只要没有在presentation中设定互动的触发,加不加这个prsntf_read_only似乎没什么影响。
二、module_presentations.py中每个presentation的结构和各个部分的功能。
1. 这个文件开头是其它几个相关的模板文件,注意其中header都不可编辑。如果需要在这里引用其它文件中的参数,就按照"from 文件名 import *”的格式添加即可。
2. 接下来被#注释起来的部分是对presentation模板中各个部分含义的解释。看下面这个例子,它的主干结构其实很简单:
("game_credits",prsntf_read_only,mesh_load_window,[ ]),
1 ) 模板id。用于在其他文件中引用这个模板。如:(start_presentation, "prsnt_battle"),
2 ) 模板标识。可用的标识在header_presentations.py可查。其实目前只有prsntf_read_only这一个。
3 ) 模板背景mesh。可用的mesh必须在module_meshes.py中做好定义。
4 ) 触发器列表。可用的触发器在header_triggers.py中可查,内容写书格式和普通的触发器相同。目前共有4种:
ti_on_presentation_load #在当前presentation启动时触发一次。
ti_on_presentation_run #在当前presentation运行过程中持续触发。
ti_on_presentation_event_state_change #在鼠标点击当前presentation中某按钮对象时触发。
ti_on_presentation_mouse_enter_leave #在鼠标指向/离开当前presentation中某对象时触发。
即:
1 ) 模板id= "game_credits"
2 ) 模板标识= prsntf_read_only
3 ) 模板背景mesh= mesh_load_window
4 ) 触发器列表= [... ...] #(其中... ...为省略的触发器列表内容)
3. 继续往下就是模板列表,presentations = [... ...](直到整个文件末尾),[]中包含的是所有的presentation模板。每个独立的模板都用"("和"),"作为起始和结束。
现在我们用一个结构较完整的presentation模板来对其各个部分的结构和功能做针对性的说明。这是最常用的战场小地图的presentation模板:
("battle",0,0,[ #模板id、模板标识和背景mesh。为0就是不做设置。
(ti_on_presentation_load, #在启动时触发。见注②。
[(set_fixed_point_multiplier, 1000), #设置参数精确度,默认为1,通常建议设置为1000。主要针对对象的位置设置,具体单位我拿不准,求解。
(assign, "$g_formation_infantry_selected", 0), #设置所用到的变量等等。见注③。
(assign, "$g_formation_archers_selected", 0),
(assign, "$g_formation_cavalry_selected", 0),
(assign, "$g_presentation_battle_active", 1),
#接下来就是一些具体操作。
(str_clear, s7),
(try_for_agents, ":agent_no"),
(agent_set_slot, ":agent_no", slot_agent_map_overlay_id, 0),
(try_end),
(position_set_x, pos1, 0), #设置pos的x坐标值。
(create_image_button_overlay, "$g_presentation_obj_1", "mesh_white_plane", "mesh_white_plane"), #创建一个图形按钮对象,其id储存在"$g_presentation_obj_1"中,所用mesh为"white_plane"。
(position_set_y, pos1, 653), #设置pos的y坐标值。
(overlay_set_position, "$g_presentation_obj_1", pos1), #把对象"$g_presentation_obj_1"放置在指定的位置。
... ...
(presentation_set_duration, 999999), #设置当前presentation的运行时限为999999。单位:1/100秒。
]),
(ti_on_presentation_event_state_change, #当某可操作的对象(如按钮)被点击时触发。见注②。
[(store_trigger_param_1, ":cur_object"), #获得被点击的对象id
(store_trigger_param_2, ":value"), #当被点击的对象是滑动条、选择块等时使用。普通按钮对象不需要。
... ...
(try_begin),
(eq, ":cur_object", "$g_presentation_obj_4"), #如果被点击的对象是"$g_presentation_obj_4"则继续以下内容。
(assign, ":update_listeners", 1),
(assign, "$g_formation_infantry_selected", ":value"),
(try_begin),
(eq, ":value", 1),
(overlay_animate_to_alpha, "$g_presentation_obj_1", 250, 0x44),
(else_try),
(overlay_animate_to_alpha, "$g_presentation_obj_1", 250, 0),
(try_end),
(else_try),
(eq, ":cur_object", "$g_presentation_obj_5"), #如果被点击的对象是"$g_presentation_obj_5"则继续以下内容。
(assign, ":update_listeners", 1),
(assign, "$g_formation_archers_selected", ":value"),
(try_begin),
(eq, ":value", 1),
(overlay_animate_to_alpha, "$g_presentation_obj_2", 250, 0x44),
(else_try),
(overlay_animate_to_alpha, "$g_presentation_obj_2", 250, 0),
(try_end),
(else_try),
... ...
... ...
(try_end),
]),
(ti_on_presentation_mouse_enter_leave, #当鼠标指向/离开当前对象时触发。见注②。
[(store_trigger_param_1, ":cur_object"), #获取当前对象id
(store_trigger_param_2, ":enter_leave"), #获取鼠标状态。0为指向,1为离开。
(try_begin),
(eq, ":cur_object", "$g_presentation_obj_1"), #如果当前对象为"$g_presentation_obj_1"则继续一下操作。
(try_begin),
(eq, ":enter_leave", 0), #当鼠标指向"$g_presentation_obj_1"
(overlay_animate_to_color, "$g_presentation_infantry_movement", 250, 0xFFFFFF),#指定对象用0.25秒的时间渐变到白色。
(overlay_animate_to_color, "$g_presentation_infantry_riding", 250, 0xFFFFFF),
(overlay_animate_to_color, "$g_presentation_infantry_weapon_usage", 250, 0xFFFFFF),
(overlay_animate_to_color, "$g_presentation_obj_7", 250, 0xFFFFFF),
(else_try),
(overlay_animate_to_color, "$g_presentation_infantry_movement", 250, 0),#反之则渐变到黑色。
(overlay_animate_to_color, "$g_presentation_infantry_riding", 250, 0),
(overlay_animate_to_color, "$g_presentation_infantry_weapon_usage", 250, 0),
(overlay_animate_to_color, "$g_presentation_obj_7", 250, 0),
(try_end),
(else_try),
... ...
... ...
(try_end),
]),
(ti_on_presentation_run, #在当前presentation运行时持续触发。见注②。
[(store_trigger_param_1, ":cur_time"), #获取当前presentation已经运行的时间,单位1/100秒。
(try_begin), #如果在当前presentation运行时按下了下列某个按键
(this_or_next|game_key_clicked, gk_infantry_hear),
(this_or_next|game_key_clicked, gk_archers_hear),
(this_or_next|game_key_clicked, gk_cavalry_hear),
(this_or_next|game_key_clicked, gk_everyone_hear),
(game_key_clicked, gk_reverse_order_group),
(call_script, "script_update_order_panel_checked_classes"), #则执行脚本"update_order_panel_checked_classes"
(try_end),
... ...
... ...
]),
]),
QUOTE:
注:
②这里的每个触发器中不能再继续套用 (0, 0, 0, [], [])、或者 (0, [])这样的独立触发器。
③有时候我们需要在一个presentation创建很多对象,每个对象的id都需要用一个全局变量来储存。这样就会面临一个问题:过多的全局变量会给游戏系统增加额外的负担、使整体效率降低。
实际上系统预设了很多presentation专用的全局变量,如下:
"$g_presentation_credits_obj_1" ~ "$g_presentation_credits_obj_12"
"$g_presentation_obj_1" ~ "$g_presentation_obj_39"
算算总共有51个,因为不会有两个presentation同时运行,所以这些变量都可以在不同id的presentation中反复使用。除非你要做动画片,不然51个肯定够了。实在不够的话还可以用reg1~reg63这些系统常用的存储器。除非为了便于记忆或者有特殊需要,都推荐使用上述这些全局变量。
“也可以在每个presentation注释一下这个presentation里的$g_presentation_obj_1 ~ $g_presentation_obj_x 分别是什么(开始赋值的时候注释一下就可以了). 就不会和其他presentation里的混淆了.” —— rubik
第三部分:实战练习。
QUOTE:
附录:
16进制色码表,bmp格式:
色码表.rar
(2008-11-29 18:10:17, Size: 333 kB, Downloads: 1)
[ 本帖最后由 oolonglgx 于 2008-11-29 18:11 编辑 ]
我也来说两句 查看全部评论 相关评论