本帖最后由 815208129 于 2022-8-8 11:23 编辑
关于item的界面一个很重要的一点就是 item的id得是valid(合法合规的).
但是t社偷懒,没给这个op.
注意到item_id 本质是一个大于零的整数,于是根据最后一个itm_item_end,使用is_between这个op两边夹住这个item
本界面是用于联机的界面,如果需要改为单机应用,需要修改一下
演示效果:
a1界面
("admin_item_select", prsntf_manual_end_only, 0, # allow admins to spawn any item for themselves
[(ti_on_presentation_load,
[(set_fixed_point_multiplier, 1000),
(create_mesh_overlay, reg0, "mesh_mp_ui_welcome_panel"),
(position_set_x, pos1, 560),
(position_set_y, pos1, 300),
(overlay_set_position, reg0, pos1),
(position_set_x, pos2, 600),
(position_set_y, pos2, 800),
(overlay_set_size, reg0, pos2),
(position_set_x, pos2, 900),
(position_set_y, pos2, 900),
(create_text_overlay, reg1, "str_item_id"),
(overlay_set_color, reg1, 0xFFFFFF),
(position_set_x, pos1, 625),
(position_set_y, pos1, 400),
(overlay_set_position, reg1, pos1),
(overlay_set_size, reg1, pos2),
(create_number_box_overlay, "$g_presentation_obj_admin_item_select", all_items_begin, all_items_end),
(position_set_x, pos1, 725),
(position_set_y, pos1, 400),
(overlay_set_position, "$g_presentation_obj_admin_item_select", pos1),
(overlay_set_size, "$g_presentation_obj_admin_item_select", pos2),
(val_clamp, "$g_presentation_admin_item_id", all_items_begin, all_items_end),
(overlay_set_val, "$g_presentation_obj_admin_item_select", "$g_presentation_admin_item_id"),
(str_store_item_name, s1, "$g_presentation_admin_item_id"),
(create_button_overlay, "$g_presentation_obj_admin_item_equip", "str_spawn_s1", tf_center_justify),
(overlay_set_color, "$g_presentation_obj_admin_item_equip", 0xFFFFFF),
(position_set_x, pos1, 650),
(position_set_y, pos1, 360),
(overlay_set_position, "$g_presentation_obj_admin_item_equip", pos1),
(position_set_x, pos1, 1200),
(position_set_y, pos1, 1200),
(overlay_set_size, "$g_presentation_obj_admin_item_equip", pos1),
(create_button_overlay, "$g_presentation_obj_admin_item_done", "str_done"),
(overlay_set_color, "$g_presentation_obj_admin_item_done", 0xFFFFFF),
(position_set_x, pos1, 870),
(position_set_y, pos1, 320),
(overlay_set_position, "$g_presentation_obj_admin_item_done", pos1),
(overlay_set_size, "$g_presentation_obj_admin_item_done", pos2),
## OrientSea : better menu for admin select item
(assign, ":item_mesh_size", 800),
(position_set_x, pos12, ":item_mesh_size"),
(position_set_y, pos12, ":item_mesh_size"),
(assign, ":item_image_size", 800),
(position_set_x, pos13, ":item_image_size"),
(position_set_y, pos13, ":item_image_size"),
(assign, ":cur_x", 50),
(assign, ":cur_y", 600),
(assign, ":offset", 100),
(assign, ":item_image_offset", 50),
# (assign, "$es_page_num", 0),
(val_clamp, "$es_page_num", 0, 51),
(store_mul, ":page_index", "$es_page_num", 20),
(store_add, ":item_id", ":page_index", all_items_begin),
(try_for_range, ":slot_no", 0, 20),
(create_image_button_overlay, ":overlay_id", "mesh_mp_inventory_choose", "mesh_mp_inventory_choose"),
(overlay_set_size, ":overlay_id", pos12),
(position_set_x, pos1, ":cur_x"),
(position_set_y, pos1, ":cur_y"),
(overlay_set_position, ":overlay_id", pos1),
(is_between, ":item_id", 0, all_items_end),
(create_mesh_overlay_with_item_id, reg15, ":item_id"),
(overlay_set_size, reg15, pos13),
(store_add, ":item_pos_x", ":cur_x", ":item_image_offset"),
(store_add, ":item_pos_y", ":cur_y", ":item_image_offset"),
(position_set_x, pos1, ":item_pos_x"),
(position_set_y, pos1, ":item_pos_y"),
(overlay_set_position, reg15, pos1),
(store_mod, ":remain",":slot_no", 4),
(try_begin),
(eq, ":remain", 3),
(assign, ":cur_x", 50),
(val_sub, ":cur_y", ":offset"),
(else_try),
(val_add, ":cur_x", ":offset"),
(try_end),
(troop_set_slot, "trp_chat_overlay_ring_buffer_5", ":slot_no", ":overlay_id"),
(troop_set_slot, "trp_chat_overlay_ring_buffer_6", ":slot_no", ":item_id"),
(val_add, ":item_id", 1),
(try_end),
## OrientSea : combo label to up/down page
(create_combo_label_overlay, reg10),
(position_set_x, pos1, 250),
(position_set_y, pos1, 40),
(overlay_set_position, reg10, pos1),
(assign, "$g_presentation_obj_admin_panel_scene", reg10),
(store_sub, ":item_count", all_items_end, all_items_begin),
(store_div, ":page_num", ":item_count", 20),
(val_add, ":page_num", 1),
(assign, reg30, ":page_num"),
(try_for_range, reg20, 0, ":page_num"),
(str_store_string, s10, "@X{reg20}"),
(overlay_add_item, "$g_presentation_obj_admin_panel_scene", s10),
(try_end),
(overlay_set_val, "$g_presentation_obj_admin_panel_scene", "$es_page_num"),
(create_button_overlay, "$g_presentation_credits_obj_2", "@+10"),
(position_set_x, pos1, 300),
(position_set_y, pos1, 90),
(overlay_set_position, "$g_presentation_credits_obj_2", pos1),
(overlay_set_color, "$g_presentation_credits_obj_2", 0xFFFFFF),
(overlay_set_size, "$g+g_presentation_credits_obj_2", pos2),
(create_button_overlay, "$g_presentation_credits_obj_3", "@-10"),
(position_set_x, pos1, 150),
(position_set_y, pos1, 90),
(overlay_set_position, "$g_presentation_credits_obj_3", pos1),
(overlay_set_color, "$g_presentation_credits_obj_3", 0xFFFFFF),
(overlay_set_size, "$g_presentation_credits_obj_3", pos2),
(create_mesh_overlay, reg5, "mesh_mp_ui_welcome_panel"),
(position_set_x, pos1, 50),
(position_set_y, pos1, 80),
(overlay_set_position, reg5, pos1),
(position_set_x, pos2, 670),
(position_set_y, pos2, 600),
(overlay_set_size, reg5, pos2),
(presentation_set_duration, 999999),
]),
(ti_on_presentation_event_state_change,
[
(store_trigger_param_1, ":object"),
(store_trigger_param_2, ":value"),
(try_begin),
(eq, ":object", "$g_presentation_obj_admin_item_select"),
(store_trigger_param_2, "$g_presentation_admin_item_id"),
(str_store_item_name, s1, "$g_presentation_admin_item_id"),
(overlay_set_text, "$g_presentation_obj_admin_item_equip", "str_spawn_s1"),
(else_try),
(eq, ":object", "$g_presentation_obj_admin_item_equip"),
(is_between, "$g_presentation_admin_item_id", all_items_begin, all_items_end),
(multiplayer_send_int_to_server, client_event_admin_equip_item, "$g_presentation_admin_item_id"),
(else_try),
(eq, ":object", "$g_presentation_credits_obj_2"),
(val_add, "$es_page_num", 10),
(val_clamp, "$es_page_num", 0, 51),
(start_presentation, "prsnt_admin_item_select"),
(else_try),
(eq, ":object", "$g_presentation_credits_obj_3"),
(val_sub, "$es_page_num", 10),
(val_clamp, "$es_page_num", 0, 51),
(start_presentation, "prsnt_admin_item_select"),
(else_try),
(eq, ":object", "$g_presentation_obj_admin_panel_scene"),
(assign, "$es_page_num", ":value"),
(start_presentation, "prsnt_admin_item_select"),
(else_try),
(eq, ":object", "$g_presentation_obj_admin_item_done"),
(presentation_set_duration, 0),
(try_end),
]),
(ti_on_presentation_mouse_press, [
(store_trigger_param_1, ":object"),
# (store_trigger_param_2, ":mouse_button"), # 0 = left button, 1 = right button, 2 = middle button
(try_begin),
(assign, ":max_slot_no", 20),
(try_for_range, ":slot_no", 0, ":max_slot_no"),
(troop_slot_eq, "trp_chat_overlay_ring_buffer_5", ":slot_no", ":object"),
(troop_get_slot, ":item_id", "trp_chat_overlay_ring_buffer_6", ":slot_no"),
(gt, ":item_id", 0),
(overlay_set_val, "$g_presentation_obj_admin_item_select", ":item_id"),
(assign, "$g_presentation_admin_item_id", ":item_id"),
(str_store_item_name, s1, ":item_id"),
(overlay_set_text, "$g_presentation_obj_admin_item_equip", "str_spawn_s1"),
(assign, ":max_slot_no", -1),
(try_end),
(try_end),
]),
(ti_on_presentation_run,
[(store_trigger_param_1, ":current_time"),
(try_begin),
(gt, ":current_time", 200),
(key_clicked, key_escape),
(presentation_set_duration, 0),
(try_end),
]),
]),
|