Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if not SimpleMenu then
- SimpleMenu = class()
- function SimpleMenu:init(title, message, options)
- self.dialog_data = { title = title, text = message, button_list = {},
- id = tostring(math.random(0,0xFFFFFFFF)) }
- self.visible = false
- for _,opt in ipairs(options) do
- local elem = {}
- elem.text = opt.text
- opt.data = opt.data or nil
- opt.callback = opt.callback or nil
- elem.callback_func = callback(self, self, "_do_callback",
- { data = opt.data,
- callback = opt.callback})
- elem.cancel_button = opt.is_cancel_button or false
- if opt.is_focused_button then
- self.dialog_data.focus_button = #self.dialog_data.button_list+1
- end
- table.insert(self.dialog_data.button_list, elem)
- end
- return self
- end
- function SimpleMenu:_do_callback(info)
- if info.callback then
- if info.data then
- info.callback(info.data)
- else
- info.callback()
- end
- end
- self.visible = false
- end
- function SimpleMenu:show()
- if self.visible then
- return
- end
- self.visible = true
- managers.system_menu:show(self.dialog_data)
- end
- function SimpleMenu:hide()
- if self.visible then
- managers.system_menu:close(self.dialog_data.id)
- self.visible = false
- return
- end
- end
- end
- patched_update_input = patched_update_input or function (self, t, dt )
- if self._data.no_buttons then
- return
- end
- local dir, move_time
- local move = self._controller:get_input_axis( "menu_move" )
- if( self._controller:get_input_bool( "menu_down" )) then
- dir = 1
- elseif( self._controller:get_input_bool( "menu_up" )) then
- dir = -1
- end
- if dir == nil then
- if move.y > self.MOVE_AXIS_LIMIT then
- dir = 1
- elseif move.y < -self.MOVE_AXIS_LIMIT then
- dir = -1
- end
- end
- if dir ~= nil then
- if( ( self._move_button_dir == dir ) and self._move_button_time and ( t < self._move_button_time + self.MOVE_AXIS_DELAY ) ) then
- move_time = self._move_button_time or t
- else
- self._panel_script:change_focus_button( dir )
- move_time = t
- end
- end
- self._move_button_dir = dir
- self._move_button_time = move_time
- local scroll = self._controller:get_input_axis( "menu_scroll" )
- -- local sdir
- if( scroll.y > self.MOVE_AXIS_LIMIT ) then
- self._panel_script:scroll_up()
- -- sdir = 1
- elseif( scroll.y < -self.MOVE_AXIS_LIMIT ) then
- self._panel_script:scroll_down()
- -- sdir = -1
- end
- end
- managers.system_menu.DIALOG_CLASS.update_input = patched_update_input
- managers.system_menu.GENERIC_DIALOG_CLASS.update_input = patched_update_input
- add_job = add_job or function(data)
- local difficulty_id = tweak_data:difficulty_to_index( data.difficulty )
- table.insert( managers.crimenet._presets, { job_id = data.job_id, difficulty_id = difficulty_id, difficulty = data.difficulty, chance = 1 } )
- managers.crimenet._MAX_ACTIVE_JOBS = managers.crimenet._MAX_ACTIVE_JOBS + 1
- end
- show_menu = show_menu or function(menu)
- menu:show()
- end
- mission = mission or function(job_id)
- local difficulty_opts = {
- { text = "Normal", callback = add_job, data = { difficulty = "normal", job_id = job_id } },
- { text = "Hard", callback = add_job, data = { difficulty = "hard", job_id = job_id } },
- { text = "Very Hard", callback = add_job, data = { difficulty = "overkill", job_id = job_id } },
- { text = "Overkill", callback = add_job, data = { difficulty = "overkill_145", job_id = job_id } },
- { text = "Mega Extreme Mode (Deathwish)", callback = add_job, data = "overkill_290", job_id = job_id } },
- { text = "Cancel", is_cancel_button = true},
- }
- local difficulty_menu = SimpleMenu:new("Mission Selector", "Choose Difficulty", difficulty_opts)
- difficulty_menu:show()
- end
- --Menu Contractor
- bain = bain or {
- { text = "Jewelry Store", callback = mission, data = "jewelry_store" },
- { text = "Bank Heist: Gold*", callback = mission, data = "branchbank_gold" },
- { text = "Bank Heist: Cash", callback = mission, data = "branchbank_cash" },
- { text = "Bank Heist: Deposit", callback = mission, data = "branchbank_deposit" },
- { text = "Bank Heist*", callback = mission, data="branchbank" },
- { text = "Diamond Store", callback = mission, data="family" },
- { text = "Jewelry Store (Pro Job)*", callback = mission, data = "jewelry_store_prof" },
- { text = "Bank Heist: Gold (Pro Job)", callback = mission, data = "branchbank_gold_prof" },
- { text = "Bank Heist: Cash (Pro Job)*", callback = mission, data = "branchbank_cash_prof" },
- { text = "Bank Heist: Deposit (Pro Job)*", callback = mission, data = "branchbank_deposit_prof" },
- { text = "Bank Heist (Pro Job)", callback = mission, data = "branchbank_prof" },
- { text = "Diamond Store (Pro Job)*", callback = mission, data = "family_prof" },
- { text = "Cancel", is_cancel_button = true },
- }
- bainmenu = bainmenu or SimpleMenu:new("Mission Selector", "Choose Map", bain)
- hector = hector or {
- { text = "Watchdogs", callback = mission, data = "watchdogs" },
- { text = "Fire Starter", callback = mission, data = "firestarter" },
- { text = "Rats", callback = mission, data = "alex" },
- { text = "Watchdogs (Pro Job)", callback = mission, data = "watchdogs_prof" },
- { text = "Fire Starter (Pro Job)", callback = mission, data = "firestarter_prof" },
- { text = "Rats (Pro Job)", callback = mission, data = "alex_prof" },
- { text = "Cancel", is_cancel_button = true},
- }
- hectormenu = hectormenu or SimpleMenu:new("Mission Selector", "Choose Map", hector)
- elephant = elephant or {
- { text = "Framing Frame", callback = mission, data = "framing_frame" },
- { text = "Big Oil*", callback = mission, data = "welcome_to_the_jungle" },
- { text = "Framing Frame (Pro Job)", callback = mission, data = "mallcrasher" },
- { text = "Big Oil (Pro Job)", callback = mission, data = "welcome_to_the_jungle_prof" },
- { text = "Cancel", is_cancel_button = true},
- }
- elephantmenu = elephantmenu or SimpleMenu:new("Mission Selector", "Choose Map",elephant)
- vlad = vlad or {
- { text = "Four Stores", callback = mission, data = "four_stores" },
- { text = "Mallcrasher", callback = mission, data = "mallcrasher" },
- { text = "Nightclub", callback = mission, data = "nightclub" },
- { text = "Ukrainian Job*", callback = mission, data= "ukrainian_job" },
- { text = "Four Stores (Pro Job)*", callback = mission, data = "four_stores_prof" },
- { text = "Mallcrasher (Pro Job)*", callback = mission, data = "mallcrasher_prof" },
- { text = "Nightclub (Pro Job)*", callback = mission, data = "nightclub_prof" },
- { text = "Ukrainian Job (Pro Job)", callback = mission, data= "ukrainian_job_prof" },
- { text = "Cancel", is_cancel_button = true},
- }
- vladmenu = vladmenu or SimpleMenu:new("Mission Selector", "Choose Map",vlad)
- rootopts = rootopts or {
- { text = "Bain", callback = show_menu, data = bainmenu},
- { text = "Hector", callback = show_menu, data = hectormenu},
- { text = "The Elephant", callback = show_menu, data = elephantmenu},
- { text = "Vlad", callback = show_menu, data = vladmenu},
- { text = "Cancel", is_cancel_button = true},
- }
- if not rootmenu then
- managers.crimenet._NEW_JOB_MIN_TIME = 0
- managers.crimenet._NEW_JOB_MAX_TIME = 0
- managers.crimenet._presets = { }
- managers.crimenet._active_jobs = { }
- managers.crimenet._MAX_ACTIVE_JOBS = 0
- rootmenu = rootmenu or SimpleMenu:new("Mission Selector", "Choose Contractor", rootopts)
- end
- rootmenu:show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement