文本
文本

[[ --- --- Generated by EmmyLua(https://github.com/EmmyLua) --- Created by xuhongyan05. --- DateTime: 2023/1/…

[[ --- --- Generated by EmmyLua(https://github.com/EmmyLua) --- Created by xuhongyan05. --- DateTime: 2023/1/6 15:39 --- --- local G = require("hexm.client.G") --local event_consts = require("hexm.client.consts.event_consts") local layer_consts = require("hexm.client.ui.consts.layer_consts") local ListViewController = require("hexm.client.ui.controllers.listview_controller").ListViewController local ListViewItemController = require("hexm.client.ui.controllers.listview_controller").ListViewItemController local WindowBase = require("hexm.client.ui.struct.window_base").WindowBase local branch_consts = require("hexm.client.ui.windows.dialog_branches.branch_consts") local DialogsBranchesViewImpl = require("hexm.client.ui.windows.dialog_branches.dialogs_branches_window").DialogsBranchesViewImpl --local ui_consts = require("hexm.client.consts.ui_consts") --local stuff_misc = require("hexm.common.misc.stuff_misc") local ControllerBase = require("hexm.client.ui.struct.controller_base").ControllerBase local go_to_function = require("hexm.client.util.go_to_function") local interact_component_consts = require("hexm.common.consts.interact_component_consts") local consts = require("hexm.common.consts.consts") local mouse_consts = require("hexm.client.consts.mouse_consts") local G = require("hexm.client.G") local event_consts = require("hexm.client.consts.events") local layer_consts = require("hexm.client.ui.consts.layer_consts") local ListViewController = require("hexm.client.ui.controllers.listview_controller").ListViewController local ListViewItemController = require("hexm.client.ui.controllers.listview_controller").ListViewItemController local TaskEpisodeChoosePersonNodeView = require("hexm.client.ui.generated_view.task_episode_choose_person_node_view").TaskEpisodeChoosePersonNodeView local TaskNpcTalkChoosePageView = require("hexm.client.ui.generated_view.task_npc_talk_choose_page_2_view").TaskNpcTalkChoosePage2View local ControllerBase = require("hexm.client.ui.struct.controller_base").ControllerBase local ListModel = require("hexm.client.ui.struct.list_model").ListModel local WindowBase = require("hexm.client.ui.struct.window_base").WindowBase local npc_talk_options_consts = require("hexm.client.ui.windows.npc.npc_interact.npc_talk_options_consts") local npc_talk_option_implements = require("hexm.client.ui.windows.npc.npc_interact.npc_talk_option_implements") local camera_consts = require("hexm.client.consts.camera_consts") local common_condition = require("hexm.client.util.common_condition") local task_consts = require("hexm.common.consts.task_consts") local interact_consts = require("hexm.client.consts.interact_consts") local errcode = require("hexm.common.errcode") local interact_component_consts = require("hexm.common.consts.interact_component_consts") local consts = require("hexm.common.consts.consts") local mouse_consts = require("hexm.client.consts.mouse_consts") local G = require("hexm.client.G") local layer_consts = require("hexm.client.ui.consts.layer_consts") local WindowBase = require("hexm.client.ui.struct.window_base").WindowBase local NpcDialogControllerBase = require("hexm.client.ui.windows.npc.npc_dialogs.npc_dialog_controller_base").NpcDialogControllerBase --local utils = require("hexm.client.util.utils") --local cc_consts = require("hexm.client.ui.consts.cc_consts") local HomeSubtitlePageV3View = require("hexm.client.ui.generated_view.home_subtitle_page_v3_view").HomeSubtitlePageV3View local touch_consts = require("hexm.client.ui.consts.touch_consts") local event_consts = require("hexm.client.consts.event_consts") local keyboard_consts = require("hexm.client.consts.keyboard_consts") local dialog_consts = require("hexm.client.entities.local.space_members.dialogs2.dialog_consts") local consts = require("hexm.common.consts.consts") local mouse_consts = require("hexm.client.consts.mouse_consts") local mouse_consts = require("hexm.client.consts.mouse_consts") mouse_consts.SHOW_MOUSE_CUTSCENE_DIALOG = 101 mouse_consts.SHOW_MOUSE_BRANCH_DIALOG = 102 local CommonBranchSelectWindow = require("hexm.client.ui.windows.common.common_branch_select_window").CommonBranchSelectWindow function CommonBranchSelectWindow:destroy_object() local w = G.ui_manager:get_window_by_name("NpcTalkOptionsWindow") if w then w:pop_visible_flag("CommonBranchSelectWindow") w:on_reenter() end CommonBranchSelectWindow.super.destroy_object(self) end local CommonBranchSelectController = require("hexm.client.ui.windows.common.common_branch_select_window").CommonBranchSelectController function CommonBranchSelectController:init(kwargs) kwargs = kwargs or dict() CommonBranchSelectController.super.init(self, kwargs) self.view:play_anim("vx_in") self:register_listener() --self:refresh_view(kwargs) -- 打开侠名值界面 self.view.template_xiaming_btn_view:get_node("button_icon"):set_onClick(function(_) self:_open_xiaming_main_widnow() end) if G.main_player then local target_id = G.main_player:branch_select_get_interact_target_id() if target_id then local target = G.space:get_entity(target_id) if target then self.target_id = target_id target:try_push_interacting_flag(interact_component_consts.NPC_INTERACTING_FLAG_BRANCH_SELECT, true) end end end self:push_mouse_visible() end function CommonBranchSelectController:push_mouse_visible() if G.setting_manager:get_setting("play_mode") == consts.PLAY_MODE_DONGZUO then G.mouse_manager:push_show_mouse("branch_select", true, mouse_consts.SHOW_MOUSE_BRANCH_DIALOG) end end function CommonBranchSelectController:pop_mouse_visible() G.mouse_manager:pop_show_mouse("branch_select") end function CommonBranchSelectController:set_view_visible(is_visible) self.view:set_visible(is_visible) if self.relate_window then if not is_visible then self.relate_window:push_visible_flag(false, "CommonBranchSelectWindow") else self.relate_window:pop_visible_flag("CommonBranchSelectWindow") end end if is_visible then self:push_mouse_visible() else self:pop_mouse_visible() end end function CommonBranchSelectController:refresh_view(kwargs) self.view:play_anim("vx_in") self:set_view_visible(true) self.choose_callback = kwargs:get("choose_callback") self.branch_no = G.main_player:branch_select_get_branch_no() self.branch_sys_d = G.datam.branch_data:get(self.branch_no, dict()) self:use_selection_manager() self:set_template_adapter(function(data) return self:template_adapter(data) end) self:refresh_content() self:remove_timer("goto_timer") self:add_timer(function() self:handle_goto_func() end, 0.01, 0, 0, 0.01, "goto_timer") end function CommonBranchSelectController:get_list_view() return self.view.listview_branches end function CommonBranchSelectController:on_listen_click_choice(event, data) -- G.logger:info("mh", "[common_branch_select_controller] on_listen_click_choice data:%s", data) self.curr_select_option = data:get("option_no") local is_waiting_for_end = data:get("is_waiting_for_end") if is_waiting_for_end then local expand_id = self.branch_sys_d:get(string.format("expand_id_%d", self.curr_select_option)) G.net:call_server("rpc_branch_select_consume_token_stuff", expand_id) else -- 效果不太对 --self.view:play_anim("vx_out", nil, function() self:handle_choose_callback() end) self:handle_choose_callback() end end function CommonBranchSelectController:destroy_object() if self.target_id then local target = G.space:get_entity(self.target_id) if target then target:try_pop_interact_flag(interact_component_consts.NPC_INTERACTING_FLAG_BRANCH_SELECT) end end self:close_relate_window() self:pop_mouse_visible() CommonBranchSelectController.super.destroy_object(self) end local NpcDialogsHomeSubTitleController = require("hexm.client.ui.windows.npc.npc_dialogs.npc_dialog_home_subtitle_window").NpcDialogsHomeSubTitleController function NpcDialogsHomeSubTitleController:init(kwargs) NpcDialogsHomeSubTitleController.super.init(self, kwargs) self:add_touch() self.image_bg = self.view:get_node("imageview_bottom_jianbian") self.text_node = self.view:get_node("text_subtitle") self.original_text_color = self.text_node:get_color() self.button_zimu = self.view:get_node("button_1") self.skip_button = self.view:get_node("widget_zimu_bottom") self.button_zimu:set_touch_enabled(true) self.button_zimu:add_click_event_listener(function(...) return self:on_touch_ended(...) end) self.skip_button_timer = nil self.action_play_mode = G.setting_manager:get_setting("play_mode") if G.main_player then G.main_player.in_no_move_dialog = true end G.gui_dispatcher:dispatch(event_consts.E_UI_HIDE_MODE, dict(action = "push", flag = "dialog_hide", mode = 17)) G.gui_dispatcher:dispatch(event_consts.E_DIALOG_NO_MOVE_UI_PLAY, dict(visible = false, reason="dialog")) G.input_manager:activate_input_env_by_config(dialog_consts.CUTSCENE_INPUT_ENV_ID) if self.action_play_mode == consts.PLAY_MODE_DONGZUO then G.mouse_manager:push_show_mouse("cutscene_dialog", false, mouse_consts.SHOW_MOUSE_CUTSCENE_DIALOG) end end function NpcDialogsHomeSubTitleController:destroy_object() if G.main_player then G.main_player.in_no_move_dialog = false end if self._timeline then self._timeline:pop_cancel_synchronize() end self:clear_all_timer() G.gui_dispatcher:dispatch(event_consts.E_UI_HIDE_MODE, dict(action = "pop", flag = "dialog_hide")) G.gui_dispatcher:dispatch(event_consts.E_DIALOG_NO_MOVE_UI_PLAY, dict(visible = true, reason="dialog")) G.input_manager:deactivate_input_env_by_config(dialog_consts.CUTSCENE_INPUT_ENV_ID) G.ui_manager:add_touch_intercept_mask("dialog", 0.5) --关闭时增加一个不可点击的屏幕 G.mouse_manager:pop_show_mouse("cutscene_dialog") NpcDialogsHomeSubTitleController.super.destroy_object(self) end local TalkOptionItemController = require("hexm.client.ui.windows.npc.npc_interact.npc_talk_options_window").TalkOptionItemController function TalkOptionItemController:on_click(_) local function play_vx_task_click_cb() self.view:play_anim("vx_task_normal_into") local callback = self.data:get_callback() if callback and callable(callback) then callback(self) end end self.view:play_anim("vx_task_click", false, play_vx_task_click_cb) end local NpcTalkOptionsWindow = require("hexm.client.ui.windows.npc.npc_interact.npc_talk_options_window").NpcTalkOptionsWindow local NpcTalkOptionsController = require("hexm.client.ui.windows.npc.npc_interact.npc_talk_options_window").NpcTalkOptionsController local TalkOptionsListViewController = require("hexm.client.ui.windows.npc.npc_interact.npc_talk_options_window").TalkOptionsListViewController local NpcTalkOptionsModel = require("hexm.client.ui.windows.npc.npc_interact.npc_talk_options_window").NpcTalkOptionsModel function NpcTalkOptionsController:push_mouse_visible() if G.setting_manager:get_setting("play_mode") == consts.PLAY_MODE_DONGZUO then G.mouse_manager:push_show_mouse("talk_option", true, mouse_consts.SHOW_MOUSE_BRANCH_DIALOG) end end function NpcTalkOptionsController:pop_mouse_visible() G.mouse_manager:pop_show_mouse("talk_option") end function NpcTalkOptionsController:destroy_object() self:pop_mouse_visible() if self.model_options then self.model_options:destroy_object() end self:leave_camera() if self.target_id then local target_entity = G.space:get_entity(self.target_id) if target_entity then if target_entity.fake_server then target_entity.fake_server.dispatcher:dispatch(event_consts.E_TALK_CHOOSE_UI_CLOSE, dict()) else target_entity:call_server_entity_method("rpc_send_event_to_npc_ai", "E_TALK_CHOOSE_UI_CLOSE", dict()) end target_entity:try_pop_interact_flag(interact_component_consts.NPC_INTERACTING_FLAG_TALK_OPTIONS) end end G.mouse_manager:pop_show_mouse("talk_option") NpcTalkOptionsController.super.destroy_object(self) end function NpcTalkOptionsController:init(kwargs) kwargs = kwargs or dict() NpcTalkOptionsController.super.init(self, kwargs) self:on_enter() self.view.template_btn_info_2_view:set_visible(false) self.listview_options = self:create_child(TalkOptionsListViewController, self.view:get_node("listview_1")) self.target_id = kwargs:get("entity_id") if self.target_id then local target = G.space:get_entity(self.target_id) if target then target:try_push_interacting_flag(interact_component_consts.NPC_INTERACTING_FLAG_TALK_OPTIONS, true) end end local extra_data = kwargs:get("extra_data", dict()) if kwargs:get("model_options") then self.model_options = kwargs:get("model_options") else self.model_options = NpcTalkOptionsModel(G.main_player_id, kwargs:get("entity_id"), extra_data) end self.listview_options:set_model(self.model_options) self:_add_dispatcher(G.gui_dispatcher, event_consts.E_LEAVE_INTERACT_AREA_TOTALLY, function(e, d) self:on_leave_interact_area(e, d) end) self:_add_dispatcher(G.gui_dispatcher, event_consts.E_DIALOG_NO_MOVE_UI_PLAY, function(e,d) self:on_reenter(e, d) end) self:init_sys_d() self:enter_camera() self:play_enter_dialog() end function NpcTalkOptionsController:on_enter() self.view:play_anim("vx_in") self:push_mouse_visible() end function NpcTalkOptionsController:on_reenter(event, data) self:on_enter() end function NpcTalkOptionsController:play_enter_dialog() self:pop_mouse_visible() local dialog_no = self.options_sys_d:get("dialog_id") if not bool(dialog_no) then dialog_no = G.datam.npc_talk_option_default_params[1]:get("default_xianhua") end if type(dialog_no) == "list" then local idx = math.random(ialog_no) dialog_no = dialog_no[idx] end if G.space then G.space:start_dialogs(dialog_no, dict( target_id=self.target_id, stop_callback= function(finished) return self:on_enter_dialog_stop(finished) end )) end end function NpcTalkOptionsController:on_enter_dialog_stop(finished) -- G.logger:info("lk", "==================== on_enter_dialog_stop: %s", finished) if self:is_destroyed() then return end if bool(self.model_options:get_only_exit_option()) then self.window:close() -- 需要立刻退出,因为正常退出有淡出动效 --self.window:start_close() return end if #self.listview_options:get_items() <= 1 then -- 可能有其他选项,但是都被隐藏了,只有离开,那么也要立即退出 self.window:close() end self:push_mouse_visible() end function NpcTalkOptionsWindow:on_reenter() self.controller:on_reenter() end ]]

评论

—
[[ --- --- Generated by EmmyLua(https://github.com/EmmyLua) --- Created by xuhongyan05. -… | Where Winds Meet 数据库