local Data = {
[ID_MAP] = {
label = "MENU_MAP",
icon = "ui_cell_icon_map"
},
[ID_MISSIONS] = {
label = "MENU_MISSIONS",
icon = "ui_cell_icon_missions"
},
[ID_POWERS] = {
label = "MENU_POWERS",
icon = "ui_cell_icon_saintsbook",
can_wrap = false
},
[ID_REWARDS] = {
label = "MENU_UPGRADES",
icon = "ui_cell_icon_rewards"
},
--[[
[ID_MUSIC] = {
label = "MENU_MUSIC",
icon = "ui_cell_icon_music"
},
[ID_CAMERA] = {
label = "MENU_CAMERA",
icon = "ui_cell_icon_camera"
},
[ID_PHONE] = {
label = "MENU_PHONE",
icon = "ui_cell_icon_phone"
},
[ID_CASH] = {
label = "MENU_CACHE",
icon = "ui_cell_icon_cash",
},
[ID_EXTRAS] = {
label = "MENU_EXTRAS",
icon = "ui_cell_icon_extras",
},
--]]
[ID_STATS] = {
label = "MENU_STATS",
icon = "ui_cell_icon_stats",
},
[ID_TOMES] = {
label = "MENU_COLLECTION",
icon = "ui_cell_icon_tomes",
},
}
PING_RED = 300
PING_GREEN = 150
COLOR_PIP_EMPTY = {R=57/255, G=57/255, B=57/255}
COLOR_PIP_ACT1 = {R=230/255, G=230/255, B=230/255}
COLOR_PIP_ACT2 = {R=230/255, G=230/255, B=230/255}
COLOR_PIP_ACT3 = {R=230/255, G=230/255, B=230/255}
local Menu
local Hint_bar
local Input_tracker
local Mouse_input_tracker
local Cell_menu_main_doc_h = -1
local New_item_idx = 0
local Current_idx = 0
local Found_homie = false
local Online_check_thread = -1
local Ping_thread_h = 0
Cell_rewards_to_map = false
Cell_mission_to_map = false
-- Used by a data responder to indicate there is at least one eligible homie to be called from the cell phone
function cell_phone_found_homie()
Found_homie = true
end
function populate_data_is_enabled()
Found_homie = false
-- Data request for homies in cell phone - if there are none, disable that screen
vint_dataresponder_request("cell_phone_pad_populate", "cell_phone_found_homie", 0, 0)
if Found_homie == false then
--Data[ID_PHONE].is_enabled = false
end
-- cannot do missions in machina mode
if cell_machinima_is_recording() then
Data[ID_MISSIONS].is_enabled = false
end
-- camera allowed
if cell_allow_camera() == false then
--Data[ID_CAMERA].is_enabled = false
end
--Check if prologue is complete before we bring the quest log online
if game_is_prologue_complete() ~= true then
Data[ID_MISSIONS].is_enabled = false
Data[ID_MISSIONS].label = "MENU_MISSIONS_HIDDEN"
else
Data[ID_MISSIONS].label = "MENU_MISSIONS"
end
--if Data[ID_MISSIONS].new_items == 0 then
-- Data[ID_MISSIONS].is_enabled = false
--end
if mission_is_complete("mFlightTutorial") ~= true then
Data[ID_REWARDS].is_enabled = false
Data[ID_REWARDS].label = "MENU_MISSIONS_HIDDEN"
else
Data[ID_REWARDS].label = "MENU_UPGRADES"
end
if (game_get_in_progress_type() == 1 or cell_is_phone_disabled()) then -- 1 = Activities
--Data[ID_PHONE].is_enabled = false
end
-- -- disable based on mission completion
-- if cell_is_mission_complete("m03") then
-- -- nothing locked
-- elseif cell_is_mission_complete("m02") then
-- -- lock saints book
-- Data[ID_POWERS].is_enabled = false
-- else
-- -- lock map, missions, saints book, upgrades, music, and phone
-- Data[ID_MAP].is_enabled = false
-- Data[ID_MISSIONS].is_enabled = false
-- Data[ID_POWERS].is_enabled = false
-- Data[ID_REWARDS].is_enabled = false
-- Data[ID_MUSIC].is_enabled = false
-- Data[ID_PHONE].is_enabled = false
-- Data[ID_CASH].is_enabled = false
-- end
-- Check if any super powers are available
if game_is_any_super_power_unlocked() == false then
Data[ID_POWERS].is_enabled = false
Data[ID_POWERS].label = "MENU_POWERS_HIDDEN"
else
Data[ID_POWERS].label = "MENU_POWERS"
end
if game_is_prologue_complete(true) ~= true then
Data[ID_TOMES].is_enabled = false
Data[ID_TOMES].label = "MENU_MISSIONS_HIDDEN"
else
Data[ID_TOMES].label = "MENU_COLLECTION"
end
-- if the map is disabled for mission or some other state, don't allow it
if cell_is_map_disabled() then
Data[ID_MAP].is_enabled = false
end
-- if we are in an activity, then disable everything but the map because we might run out of bitmap instances
if game_is_any_activity_active() then
Data[ID_MISSIONS].is_enabled = false
Data[ID_POWERS].is_enabled = false
Data[ID_REWARDS].is_enabled = false
Data[ID_STATS].is_enabled = false
Data[ID_TOMES].is_enabled = false
end
end
function cell_menu_main_init()
vint_force_lua_gc() --Force Garbage Collection
-- Find our documents...
Cell_menu_main_doc_h = vint_document_find("cell_menu_main")
--Hide safe frame...
local safe_frame_h = vint_object_find("safe_frame", 0, Cell_menu_main_doc_h)
vint_set_property(safe_frame_h, "visible", false)
-- Setup input tracker.+
Input_tracker = Vdo_input_tracker:new()
Input_tracker:add_input("map", "cell_menu_main_button_b", 50)
Input_tracker:add_input("select", "cell_menu_main_button_a", 50)
Input_tracker:add_input("back", "cell_menu_main_button_b", 50)
Input_tracker:add_input("nav_up", "cell_menu_main_nav", 50)
Input_tracker:add_input("nav_down", "cell_menu_main_nav", 50)
Input_tracker:add_input("nav_left", "cell_menu_main_nav", 50)
Input_tracker:add_input("nav_right", "cell_menu_main_nav", 50)
-- Setup Button Hints
Hint_bar = Vdo_hint_bar:new("hint_bar", 0, Cell_menu_main_doc_h)
local hint_data = {
{CTRL_MENU_BUTTON_B, "MENU_BACK"},
}
Hint_bar:set_hints(hint_data)
game_UI_audio_play("UI_Cell_Activate")
vint_dataresponder_request("cell_menu_main_new_items", "cell_menu_main_set_new", 0)
vint_dataresponder_request("cell_menu_state_dr", "cell_menu_handle_state", 0)
-- Populate Data::is_enabled fields
-- Do this after above data responder requests, as new item count may determine button availability
populate_data_is_enabled()
Menu = Vdo_cell_menu:new("cell_menu")
--Populate menu and play highlight animation
Menu:populate_menu(Data)
--Hide the ping group until we're in coop on PC
local ping_grp_h = vint_object_find("ping_grp", 0, Cell_menu_main_doc_h)
vint_set_property(ping_grp_h, "visible", false)
if game_is_prologue_complete() == true then
local rage_grp_h = vint_object_find("rage_meter", 0, Cell_menu_main_doc_h)
vint_set_property(rage_grp_h, "visible", true)
end
if game_get_platform() == "PC" then
Hint_bar:set_visible(true)
Hint_bar:set_highlight(0)
Mouse_input_tracker = Vdo_input_tracker:new()
Menu:add_mouse_inputs("cell_menu_main", Mouse_input_tracker)
Hint_bar:add_mouse_inputs("cell_menu_main", Mouse_input_tracker)
Mouse_input_tracker:subscribe(false)
if coop_is_active() == true then
vint_set_property(ping_grp_h, "visible", true)
-- poll the ping every 2 seconds until the HUB is closed
Ping_thread_h = thread_new("cell_menu_main_ping_thread")
end
end
-- set up data items for player status
vint_dataitem_add_subscription("sr2_local_player_respect", "update", "cell_menu_main_respect_update")
vint_dataitem_add_subscription("sr2_local_player_status_infrequent", "update", "cell_menu_main_cash_update")
cell_menu_main_cluster_update()
-- Localize top bar text
local power_txt_h = vint_object_find("power_txt", 0, Cell_menu_main_doc_h)
local cache_txt_h = vint_object_find("cache_txt", 0, Cell_menu_main_doc_h)
local cluster_txt_h = vint_object_find("cluster_txt", 0, Cell_menu_main_doc_h)
vint_set_property(power_txt_h, "text_tag", "RESPECT_WIDGET_LABEL")
vint_set_property(cluster_txt_h, "text_tag", "HUB_CLUSTERS")
vint_set_property(cache_txt_h, "text_tag", "MENU_CACHE")
-- Resize text to fit grey boxes
resize_text_element(power_txt_h, 60)
resize_text_element(cluster_txt_h, 83)
resize_text_element(cache_txt_h, 125)
local top_bar_anim_h = vint_object_find("top_bar_anim", 0, Cell_menu_main_doc_h)
lua_play_anim(top_bar_anim_h, 0)
local trans_in_anim_h = vint_object_find("trans_in_anim", 0, Cell_menu_main_doc_h)
lua_play_anim(trans_in_anim_h, 0)
Cell_rewards_to_map = false
--local cache_meter_in_anim_h = vint_object_find("cache_meter_in_anim", 0, Cell_menu_main_doc_h)
--lua_play_anim(cache_meter_in_anim_h, 0)
local cache_meter_grp_h = vint_object_find("cache_meter_grp", 0, Cell_menu_main_doc_h)
vint_set_property(cache_meter_grp_h, "visible", false)
--show tutorial: powers, challenges, or map
cell_foreground_update_tutorial("hub")
cell_foreground_update_tutorial("access_map")
cell_foreground_update_tutorial("open_menu")
--Set Localized Text for Satan meter:
local satan_wrath_text_h = vint_object_find("rage_txt", 0, Cell_menu_main_doc_h)
vint_set_property( satan_wrath_text_h, "text_tag", "CELL_MAIN_SATANS_WRATH" )
end
function cell_menu_main_cleanup()
if Online_check_thread ~= -1 then
thread_kill(Online_check_thread)
end
-- Nuke all button subscriptions
Input_tracker:remove_all()
Input_tracker:subscribe(false)
if Mouse_input_tracker ~= nil then
Mouse_input_tracker:remove_all()
Mouse_input_tracker:subscribe(false)
end
Menu:cleanup()
thread_kill(Ping_thread_h)
Ping_thread_h = 0
--kill the audio drone
ui_audio_post_event("UI_Hub_Exit")
Hint_bar:cleanup()
vint_force_lua_gc() --Force Garbage Collection
end
function cell_menu_main_nav(event)
if event == "nav_up" then
Menu:nav_up()
elseif event == "nav_down" then
Menu:nav_down()
elseif event == "nav_left" then
Menu:nav_left()
elseif event == "nav_right" then
Menu:nav_right()
end
local cache_meter_grp_h = vint_object_find("cache_meter_grp", 0, Cell_menu_main_doc_h)
vint_set_property(cache_meter_grp_h, "visible", false)
--[[
if Menu:get_id() == ID_CASH then
vint_set_property(cache_meter_grp_h, "tint", COLOR_CELL_CACHE_METER_ID_CASH.R, COLOR_CELL_CACHE_METER_ID_CASH.G, COLOR_CELL_CACHE_METER_ID_CASH.B)
else
vint_set_property(cache_meter_grp_h, "tint", COLOR_CELL_CACHE_METER_ID_ELSE.R, COLOR_CELL_CACHE_METER_ID_ELSE.G, COLOR_CELL_CACHE_METER_ID_ELSE.B)
end
]]--
end
function cell_menu_main_out(event, acceleration)
-- 2nd pop for cell_foreground doc
pop_screen()
pop_screen()
end
function cell_menu_main_button_b(event, acceleration)
cell_menu_main_lost_focus()
cell_transition_screen(CELL_STATE_OUT, CELL_SCREEN_NONE, CELL_SCREEN_MAIN, cell_menu_main_out)
cell_foreground_update_tutorial("off")
end
function cell_menu_main_button_a(event, acceleration)
--TODO: Check to see if tween is done before you move to next screen.
local current_id = Menu:get_id()
-- Pause_map_from_menu is initialized in cell_foreground
Pause_map_from_menu = true
Rewards_from_menu = true
Missions_from_menu = true
cell_menu_handle_state(current_id, true)
end
function cell_menu_main_mouse_click(event, target_handle)
local hint_index = Hint_bar:get_hint_index(target_handle)
if hint_index == 1 then
cell_menu_main_button_b()
end
-- If the target_handle matches a button, activate it
if Menu:select_button(target_handle) == true then
cell_menu_main_button_a()
end
end
function cell_menu_main_mouse_move(event, target_handle)
Hint_bar:set_highlight(0)
local hint_index = Hint_bar:get_hint_index(target_handle)
if hint_index ~= 0 then
Hint_bar:set_highlight(hint_index)
game_UI_audio_play("UI_Cell_Nav")
end
-- If the target_handle matches a button, highlight it and play a sound
if Menu:select_button(target_handle) == true then
game_UI_audio_play("UI_Cell_Nav")
--[[
local cache_meter_grp_h = vint_object_find("cache_meter_grp", 0, Cell_menu_main_doc_h)
if Menu:get_id() == ID_CASH then
vint_set_property(cache_meter_grp_h, "tint", 0, 0, 0)
else
vint_set_property(cache_meter_grp_h, "tint", .86, .86, .86)
end
--]]
end
end
function cell_menu_check_online_for_camera()
Input_tracker:subscribe(false)
if game_get_platform() == "PC" then
Mouse_input_tracker:subscribe(false)
end
online_and_privilege_validator_begin(false, true, true, false, true) -- Check we're signed in and we have content permissions
while Online_validator_result == ONLINE_VALIDATOR_IN_PROGRESS do
thread_yield()
end
Input_tracker:subscribe(true)
if game_get_platform() == "PC" then
Mouse_input_tracker:subscribe(true)
end
cell_menu_main_unlock_controls()
if Online_validator_result ~= ONLINE_VALIDATOR_PASSED then
return
end
if main_menu_check_user_content() == false then
dialog_box_message("MENU_TITLE_WARNING", "USER_CONTENT_PRIV_DENIED")
return
end
push_screen("cell_camera")
Online_check_thread = -1
end
function cell_menu_handle_state(state, from_input)
-- Don't push on a new screen if we've asked this one to close
if cell_is_closing() then
return
end
-- If we are in a different state than -1, then we need the phone to "load that application"
--Lose focus...
cell_menu_main_lost_focus()
-- New quest prompt is shown on the hud, open the quest log
local hud_msg_doc_h = vint_document_find("hud_msg")
if pause_map_crib_exit() == false and hud_msg_doc_h ~= nil and Hud_msg_new_quest_displayed == true then
--HVS_RCK - If we're doing the challenge tutorial, we don't want to skip this step
if challenge_tutorial_mode_is_active() == false then
state = ID_MISSIONS
end
Hud_msg_new_quest_displayed = false
end
Current_idx = state
local safe_frame_h = vint_object_find("safe_frame", 0, Cell_menu_main_doc_h)
--If in tutorial mode - go to the main menu if we did NOT select a screen "from input"
if state == -1 or (Powers_main_tutorial_enable == true and from_input ~= true) then
--DEFAULT VIEW
vint_set_property(safe_frame_h, "visible", true)
-- Make the foreground and background show up with the frame
cell_show_frame()
--Transition to main screen
cell_transition_screen(CELL_STATE_PORTRAIT, CELL_SCREEN_MAIN, CELL_SCREEN_NONE, cell_menu_main_gained_focus)
else
if state == ID_MAP then
push_screen("pause_map")
ui_audio_post_event("UI_Hub_Menu_Forward")
elseif state == ID_MISSIONS then
push_screen("cell_missions")
ui_audio_post_event("UI_Hub_Menu_Forward")
elseif state == ID_POWERS then
push_screen("powers_main")
ui_audio_post_event("UI_Hub_Menu_Forward")
elseif state == ID_REWARDS then
push_screen("cell_rewards")
ui_audio_post_event("UI_Hub_Menu_Forward")
--[[
--elseif state == ID_MUSIC then
-- push_screen("cell_music_sub")
-- ui_audio_post_event("UI_Hub_Menu_Forward")
--elseif state == ID_CAMERA then
-- ui_audio_post_event("UI_Hub_Menu_Forward")
-- Online_check_thread = thread_new("cell_menu_check_online_for_camera")
--elseif state == ID_PHONE then
-- push_screen("cell_phone")
-- ui_audio_post_event("UI_Hub_Menu_Forward")
elseif state == ID_EXTRAS then
push_screen("cell_extras")
ui_audio_post_event("UI_Hub_Menu_Forward")
elseif state == ID_CASH then
push_screen("store_crib_cash")
ui_audio_post_event("UI_Hub_Menu_Forward")
--]]
elseif state == ID_STATS then
push_screen("cell_stats")
ui_audio_post_event("UI_Hub_Menu_Forward")
elseif state == ID_TOMES then
push_screen("col_main")
ui_audio_post_event("UI_Hub_Menu_Forward")
else
--This shouldn't get hit, keeping as a fail safe against bogus states
--DEFAULT VIEW
vint_set_property(safe_frame_h, "visible", true)
-- Make the foreground and background show up with the frame
cell_show_frame()
--Play intro anim here
--Transition to main screen
cell_transition_screen(CELL_STATE_PORTRAIT, CELL_SCREEN_MAIN, CELL_SCREEN_NONE, cell_menu_main_gained_focus)
end
end
end
-- progress is float 0-1 that shows progress to next new item (cash only)
-- interaction is bool, player interaction required (cash only)
function cell_menu_main_set_new(new_items, progress, interaction)
--if New_item_idx < 6 and New_item_idx ~= ID_CASH and New_item_idx ~= ID_MISSIONS then
-- HVS_JPM no more cash option
if New_item_idx < 6 then
Data[New_item_idx].new_items = new_items
--[[
elseif New_item_idx == ID_CASH then
--dataresponer returns cash amount. If we have cash then show a 1.
--if new_items > 0 then
-- Data[New_item_idx].new_items = 1
--else
-- Data[New_item_idx].new_items = 0
--end
Data[ New_item_idx ].progress = progress
Data[ New_item_idx ].player_interaction_required = interaction
--]]
end
New_item_idx = New_item_idx + 1
end
function cell_menu_main_respect_update(di_h)
--HVS_RCK - This has got really gross because the design changed and all the pips are no longer in order for levels 1-15...
-- Let's just deal with it.
local respect_total, respect_progress, respect_level, show_upgrades, force_show_respect, highest_scene = vint_dataitem_get(di_h)
local power_level_txt_h = vint_object_find("power_level_txt", 0, Cell_menu_main_doc_h)
respect_level = respect_level + 1
if game_is_prologue_complete() == true then
local rage_grp_h = vint_object_find("rage_meter", 0, Cell_menu_main_doc_h)
local rage_grp_1_h = vint_object_find("00-05", rage_grp_h, Cell_menu_main_doc_h)
local rage_grp_1_pips_h = vint_object_find("pips00-05", rage_grp_1_h, Cell_menu_main_doc_h)
local rage_grp_2_h = vint_object_find("06-11", rage_grp_h, Cell_menu_main_doc_h)
local rage_grp_2_pips_h = vint_object_find("pips06-11", rage_grp_2_h, Cell_menu_main_doc_h)
local rage_grp_3_h = vint_object_find("12-17", rage_grp_h, Cell_menu_main_doc_h)
local rage_grp_3_pips_h = vint_object_find("pips12-17", rage_grp_3_h, Cell_menu_main_doc_h)
local pip_h = vint_object_find("pip_00", rage_grp_1_pips_h, Cell_menu_main_doc_h)
--vint_set_property(pip_h,"tint", COLOR_PIP_ACT1.R, COLOR_PIP_ACT1.G, COLOR_PIP_ACT1.B)
local border_left_h = vint_object_find("border_left", rage_grp_h, Cell_menu_main_doc_h)
vint_set_property(border_left_h,"tint", COLOR_PIP_ACT1.R, COLOR_PIP_ACT1.G, COLOR_PIP_ACT1.B)
local border_right_h = vint_object_find("border_right", rage_grp_h, Cell_menu_main_doc_h)
if respect_level < 15 then
vint_set_property(border_right_h,"tint", COLOR_PIP_EMPTY.R, COLOR_PIP_EMPTY.G, COLOR_PIP_EMPTY.B)
else
vint_set_property(border_right_h,"tint", COLOR_PIP_ACT3.R, COLOR_PIP_ACT3.G, COLOR_PIP_ACT3.B)
end
if respect_level >= 15 then
respect_progress = 1.0
end
local respect_progress_in_rads = -1 * (360 * respect_progress) * 3.14 / 180
local rage_respect_meter_h = vint_object_find("rage_respect_meter", 0, Cell_menu_main_doc_h)
vint_set_property(rage_respect_meter_h, "end_angle", respect_progress_in_rads)
local color = COLOR_PIP_EMPTY
for i = 0, 5 do
if i <= respect_level then
color = COLOR_PIP_ACT1
else
color = COLOR_PIP_EMPTY
end
local h = vint_object_find("pip_0"..i, rage_grp_1_pips_h, Cell_menu_main_doc_h)
--vint_set_property(h,"alpha",1)
vint_set_property(h,"tint", color.R, color.G, color.B)
vint_set_property(h,"visible",true)
end
if highest_scene >= 1 then
color = COLOR_PIP_ACT2
local h = vint_object_find("pip_06", rage_grp_2_pips_h, Cell_menu_main_doc_h)
vint_set_property(h,"tint", color.R, color.G, color.B)
vint_set_property(h,"visible",true)
end
for i = 7, 11 do
if i <= (respect_level+1) then
color = COLOR_PIP_ACT1
else
color = COLOR_PIP_EMPTY
end
if i >= 10 then
local h = vint_object_find("pip_"..i, rage_grp_2_pips_h, Cell_menu_main_doc_h)
vint_set_property(h,"tint", color.R, color.G, color.B)
vint_set_property(h,"visible",true)
else
local h = vint_object_find("pip_0"..i, rage_grp_2_pips_h, Cell_menu_main_doc_h)
vint_set_property(h,"tint", color.R, color.G, color.B)
vint_set_property(h,"visible",true)
end
end
if highest_scene >= 2 then
color = COLOR_PIP_ACT2
local h = vint_object_find("pip_12", rage_grp_3_pips_h, Cell_menu_main_doc_h)
vint_set_property(h,"tint", color.R, color.G, color.B)
vint_set_property(h,"visible",true)
end
for i = 13, 17 do
if i <= (respect_level+2) then
color = COLOR_PIP_ACT3
else
color = COLOR_PIP_EMPTY
end
local h = vint_object_find("pip_"..i, rage_grp_3_pips_h, Cell_menu_main_doc_h)
vint_set_property(h,"tint", color.R, color.G, color.B)
vint_set_property(h,"visible",true)
if i == 17 then
local final_pips_visibility = true
if color == COLOR_PIP_EMPTY then
final_pips_visibility = false
end
--local final_pips_color = vint_get_property(final_pip, "tint")
local final_a = vint_object_find("final_glow_a", rage_grp_h, Cell_menu_main_doc_h)
--vint_set_property(final_a,"tint", color.R, color.G, color.B)
vint_set_property(final_a,"visible",final_pips_visibility)
local final_b = vint_object_find("final_glow_b", rage_grp_h, Cell_menu_main_doc_h)
--vint_set_property(final_b,"tint", color.R, color.G, color.B)
vint_set_property(final_b,"visible",final_pips_visibility)
end
end
end
if mission_is_complete("mFlightTutorial") ~= true then
respect_level = 0
end
vint_set_property(power_level_txt_h, "text_tag", var_to_string(respect_level))
end
function cell_menu_main_cluster_update()
local cluster_num_txt_h = vint_object_find("cluster_num_txt", 0, Cell_menu_main_doc_h)
vint_set_property(cluster_num_txt_h, "text_tag", var_to_string(game_get_orbs_banked()))
end
function cell_menu_main_cash_update(di_h)
local cash = vint_dataitem_get(di_h)
local cash_txt_h = vint_object_find("cache_num_txt", 0, Cell_menu_main_doc_h)
vint_set_property(cash_txt_h, "text_tag", "{GAME_CASH}" .. format_cash(cash))
end
function cell_menu_main_unlock_controls()
Input_tracker:subscribe(true)
if Mouse_input_tracker ~= nil then
Mouse_input_tracker:subscribe(true)
end
end
function cell_menu_main_lock_controls()
Input_tracker:subscribe(false)
if Mouse_input_tracker ~= nil then
Mouse_input_tracker:subscribe(false)
end
end
function cell_menu_main_lost_focus()
Input_tracker:subscribe(false)
if Mouse_input_tracker ~= nil then
Mouse_input_tracker:subscribe(false)
end
end
function cell_menu_main_gained_focus()
--Refresh hints incase user switched between gamepad and keyboard/mouse
local hint_data = {
{CTRL_MENU_BUTTON_B, "MENU_BACK"},
}
Hint_bar:set_hints(hint_data)
cell_menu_main_unlock_controls()
vint_set_property(vint_object_find("safe_frame"), "visible", true)
New_item_idx = 0
vint_dataresponder_request("cell_menu_main_new_items", "cell_menu_main_set_new", 0)
Menu:populate_menu(Data, Current_idx)
--cell_menu_main_cache_meter_update(Data[ID_CASH].progress)
--glitch
--glitch_cell()
end
function cell_menu_main_animate_in()
if Menu then
Menu:animate_in()
end
end
function cell_menu_main_cache_meter_update(meter_pct)
local meter_clip_h = vint_object_find("meter_clip", 0, Cell_menu_main_doc_h)
local meter_fill_img_h = vint_object_find("meter_fill_img", 0, Cell_menu_main_doc_h)
local meter_pulse_anim_h = vint_object_find("cache_meter_pulse_anim", 0, Cell_menu_main_doc_h)
local meter_clip_width, meter_clip_height = vint_get_property(meter_clip_h, "clip_size")
local METER_MAX = 109
local new_value = (meter_pct) * METER_MAX
if meter_pct ~= 1 then --if 1 then set it to full
local incriment = METER_MAX/16
for i = 0, METER_MAX, incriment do
if new_value >= i and new_value < (i + incriment) then
new_value = i
end
end
--Tint meter white
vint_set_property(meter_fill_img_h, "tint", COLOR_CELL_CACHE_METER_FILL.R, COLOR_CELL_CACHE_METER_FILL.G, COLOR_CELL_CACHE_METER_FILL.B)
--Pause pulse anim
vint_set_property(meter_pulse_anim_h, "is_paused", true)
else
--We're full
vint_set_property(meter_fill_img_h, "tint", COLOR_SAINTS_PURPLE.R, COLOR_SAINTS_PURPLE.G, COLOR_SAINTS_PURPLE.B)
lua_play_anim(meter_pulse_anim_h, 0)
end
vint_set_property(meter_clip_h, "clip_size", new_value, meter_clip_height)
end
function cell_menu_main_trans_to_pause_map()
--pop off screen
Cell_rewards_to_map = true
pop_screen()
push_screen("pause_map")
end
-------------------------------------------------------------------------------
-- Get ping every 2 seconds until cell phone is closed
--
function cell_menu_main_ping_thread()
while true do
cell_menu_main_set_ping(game_get_coop_ping())
delay(2)
end
end
-------------------------------------------------------------------------------
-- Sets connection strength for coop PC
--
function cell_menu_main_set_ping(ping)
local ping_grp_h = vint_object_find("ping_grp", 0 , Cell_menu_main_doc_h)
local ping_txt_h = vint_object_find("ping_txt", 0, Cell_menu_main_doc_h)
local bars = {}
local num_bars = 0
local color = COLOR_PING_GREY
vint_set_property(ping_txt_h, "text_tag", ping.." ms ")
-- turn all bars "off"
for i = 1, 5 do
local h = vint_object_find("bar_img_"..i, ping_grp_h, Cell_menu_main_doc_h)
vint_set_property(h, "alpha", .33)
bars[i] = h
end
-- determing how many bars and what color to show
if ping <= PING_GREEN then
if ping < 100 then
num_bars = 5
else
num_bars = 4
end
color = COLOR_PING_GREEN
elseif ping > PING_GREEN and ping < PING_RED then
num_bars = 3
color = COLOR_PING_YELLOW
else
if ping < 400 then
num_bars = 2
else
num_bars = 1
end
color = COLOR_PING_RED
if ping > 999 then
vint_set_property(ping_txt_h, "text_tag", "999 ms ")
end
end
-- turn bars "on"
for i = 1, num_bars do
vint_set_property(bars[i], "alpha", 1)
end
--set color and show grp
vint_set_property(ping_grp_h,"tint", color.R, color.G, color.B)
vint_set_property(ping_grp_h,"visible", true)
end