#include "Content\\ShellScripts\\stddefs.h" #include "Content\\ShellScripts\\listboxes.script" #include "Content\\ShellScripts\\Multiplayer\\mc_listboxes.script" #include "Content\\ShellScripts\\buttons.script" #include "Content\\ShellScripts\\common_shell.script" #include "Content\\ShellScripts\\ShellFunctionHeaders.hpp" #include "Content\\ShellScripts\\editbox.script" #include "Content\\ShellScripts\\NetParams.h" main { GUI_CREATE { font3d gFont3d = FPATH localize$(IDS_F_SERVER_LABEL) int MAX_MCCB_ITEMS = 30 int MAX_MCCB_COLUMNS = 2 int k int x object i_cursor=s_cursor int show_info = false int sender_is_me = false int player_count = 0 int player_id[16] int last_player_count = 0 // 16 kick and ban buttons object o_kick_button[16] object o_ban_button[16] for (x = 0; x < 16; x++) { o_kick_button[x] = s_text3dglowbutton o_kick_button[x].location = 315,170 + 18 * x o_kick_button[x].text = localize$(IDS_DS_KICK) o_kick_button[x].frame = false o_kick_button[x].typeface = localize$(IDS_F_SERVER_LABEL) initialize(o_kick_button[x]) o_kick_button[x].region = 0,0 to 32, 12 o_kick_button[x].theight = 0 deactivate(o_kick_button[x]) o_ban_button[x] = s_text3dglowbutton o_ban_button[x].location = 355,170 + 18 * x o_ban_button[x].text = localize$(IDS_DS_BAN) o_ban_button[x].frame = false o_ban_button[x].typeface = localize$(IDS_F_SERVER_LABEL) initialize(o_ban_button[x]) o_ban_button[x].region = 0,0 to 32, 12 o_ban_button[x].theight = 0 deactivate(o_ban_button[x]) } object o_show_button = s_multistatepane o_show_button.total_states = 3 o_show_button.textsize = 1 o_show_button.text = localize$(IDS_DS_SHOW) o_show_button.file = WPATH "button_reg_200x27m_3state.tga" o_show_button.location = 570, 490, 20 initialize(o_show_button) activate(o_show_button) object o_disconnect_button = s_multistatepane o_disconnect_button.total_states = 3 o_disconnect_button.textsize = 1 o_disconnect_button.text = localize$(IDS_DS_DISCONNECT) o_disconnect_button.file = WPATH "button_reg_200x27m_3state.tga" o_disconnect_button.location = 570, 520, 20 initialize(o_disconnect_button) object o_stop_button = s_multistatepane o_stop_button.total_states = 3 o_stop_button.textsize = 1 o_stop_button.text = localize$(IDS_DS_STOP) o_stop_button.file = WPATH "button_main_200x41m_3state.tga" o_stop_button.location = 570, 550, 20 initialize(o_stop_button) object o_chat_box = s_mc_listbox o_chat_box.location = 20,490,1 o_chat_box.boxFont3d = FPATH localize$(IDS_F_CHAT_BOX) //MUST BE INITIALIZED o_chat_box.itemWidth = 526 - 16 //MUST BE INITIALIZED o_chat_box.itemHeight = 1 //This refers to the height of a step (or scroll distance in pixels) defined by you. NOT the height of all items o_chat_box.itemHeight_padding = 4//10 o_chat_box.list_size = 0 //MAX_MCCB_ITEMS o_chat_box.NUM_OF_COLUMNS = 1 o_chat_box.column_header_height = 0 //MUST BE INITIALIZED o_chat_box.max_displayed = 529-463//30 // max number of itemheight's. maz_displayed*itemheight = height of listbox //MUST BE INITIALIZED o_chat_box.uniform_item_height = 0 o_chat_box.SelectedHighlightColor = packcolor (51, 55, 115, 0) //CAN BE INITIALIZED o_chat_box.boxhighlightColor = packcolor (0,0,0,0) //CAN BE INITIALIZED o_chat_box.selectedColor = packcolor (255,255,255,0) //CAN BE INITIALIZED o_chat_box.itemhighlightcolor = packcolor (255,255,255,255) o_chat_box.label = localize$(IDS_DS_CHAT) //CAN BE INITIALIZED o_chat_box.labelFont3d = FPATH localize$(IDS_F_SERVER_LABEL) //CAN BE INITIALIZED o_chat_box.offsetLabel = 0,-18 //CAN BE INITIALIZED offsetLabel of text from button = 0,-25 o_chat_box.buttonwidth = 16 //CAN BE INITIALIZED o_chat_box.first_delay = 10 //time delay value n/60; for the buttons o_chat_box.second_delay = 1 //time delay value n/60; for the buttons o_chat_box.column[0].location.x = 3 o_chat_box.column[0].fontcolor = packcolor (255,255,255,255) o_chat_box.column[0].fontAlignment = just_left for x = 0;x < MAX_MCCB_ITEMS; x++ { o_chat_box.list_order[x] = x o_chat_box.column[0].list_item[x] = "" } initialize (o_chat_box) object o_chat_entry = s_editbox o_chat_entry.location = 20,566,50 o_chat_entry.boxValue = "" //CAN BE INITIALIZED holds the contents of the edit box o_chat_entry.boxWidth = 528 //MUST BE INTIALIZED width of the edit field of the box o_chat_entry.boxHeight = 20 //MUST BE INTIALIZED height of the edit field of the box// o_chat_entry.boxtextlimit = 100 o_chat_entry.boxFont3d = FPATH localize$(IDS_F_CHAT_ENTRY) //MUST BE INTIALIZED o_chat_entry.boxTextOffset = 3,3 //CAN BE INITIALIZED o_chat_entry.labelFont3d = FPATH localize$(IDS_F_SERVER_LABEL) //MUST BE INTIALIZED o_chat_entry.offset = -190,0 //CAN BE INITIALIZED offset of text from button o_chat_entry.Auto_Update = FALSE o_chat_entry.keyboard_sound = TRUE enableIME(true, o_chat_entry) initialize (o_chat_entry) sender_is_me = TRUE framerate = 10 string server_name string mission_name string game_name = $$m_gameTypeStr$$ callback($$GetCurrentMissionName$$,mission_name) callback($$GetCurrentGameName$$,server_name) int max_player_param = MAX_PLAYERS_PARAMETER int max_player = callback($$GetLocalNetworkMissionParamater$$, max_player_param) } GUI_DRAW { setpencolor(0xff000000) drawrect 0, 0 to getresx(), getresy() print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 15,7 print3d localize$(IDS_DS_TITLE) string time callback($$GetRealTime$$,time) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 640,7 print3d time callback($$GetRealDate$$,time) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 720,7 print3d time print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 100,50 print3d localize$(IDS_DS_SERVER_NAME) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 220,50 print3d server_name print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 100,70 print3d localize$(IDS_DS_GAME_TYPE) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 220,70 print3d game_name print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 100,90 print3d localize$(IDS_DS_MAP) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 220,90 print3d mission_name print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 450,50 print3d localize$(IDS_DS_TIME_REMAINING) callback($$GetGameTime$$,time) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 600,50 print3d time print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 450,70 print3d localize$(IDS_DS_NUM_PLAYERS) int player_slot = callback($$GetPlayerCount$$) int player_bps[16] int player_in[16] int player_out[16] int total_bps = 0 int total_in = 0 int total_out = 0 player_count = 0 for (x = 0; x < player_slot; x++) { if (callback($$IsPlayerValid$$,x)) { player_id[player_count] = x player_bps[player_count] = callback($$GetPlayersbps$$, player_id[player_count]) total_bps += player_bps[player_count] player_in[player_count] = callback($$GetPlayersIncommingPacketsPerSecond$$, player_id[player_count]) total_in += player_in[player_count] player_out[player_count] = callback($$GetPlayersOutgoingPacketsPerSecond$$, player_id[player_count]) total_out += player_out[player_count] player_count++ } } print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 600,70 print3d conv$(player_count) "/" conv$(max_player) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 210,120 print3d localize$(IDS_DS_SERVER_BPS) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 360,120 print3d total_bps print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 480,120 print3d localize$(IDS_DS_PPS_IN) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 540,120 print3d total_in print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 570,120 print3d localize$(IDS_DS_PPS_OUT) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 630,120 print3d total_out if (show_info) { print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 15,150 print3d "#" print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 35,150 print3d localize$(IDS_DS_PLAYER_NAME) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 175,150 print3d localize$(IDS_DS_BPS) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 230,150 print3d localize$(IDS_DS_PING) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 270,150 print3d localize$(IDS_DS_IN) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 295,150 print3d localize$(IDS_DS_OUT) string player_name int player_ping for (x = 0; x < player_count; x++) { int player_num = x + 1 print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 15,170 + 18 * x print3d player_num callback($$GetPlayerName$$, player_id[x], player_name) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 35,170 + 18 * x print3d player_name print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 175,170 + 18 * x print3d conv$(player_bps[x]) player_ping = callback($$GetPlayerPing$$, player_id[x]) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 230,170 + 18 * x print3d conv$(player_ping) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 270,170 + 18 * x print3d conv$(player_in[x]) print3d_attributes = gFont3d, 0xffffffff, 1,0,1,0,0 print3d_position = 295,170 + 18 * x print3d conv$(player_out[x]) } if (player_count != last_player_count) { for (x = 0; x < player_count; x++) { activate(o_kick_button[x]) activate(o_ban_button[x]) } for (x = player_count; x < 16; x++) { deactivate(o_kick_button[x]) deactivate(o_ban_button[x]) } last_player_count = player_count } } } GUI_EXECUTE { if $$m_currentChatCount$$ > 0 { string temp_val = $$m_chatFrom$$[$$m_currentChatCount$$-1] ":> " $$m_chatArray$$[$$m_currentChatCount$$-1] if equal$(temp_val,o_chat_box.column[0].list_item[$$m_currentChatCount$$-1]) { } else { o_chat_box.list_size = $$m_currentChatCount$$ for x = 0;x < $$m_currentChatCount$$; x++ { o_chat_box.column[0].list_item[x] = $$m_chatFrom$$[x] ":> " $$m_chatArray$$[x] } if (o_chat_box.o_thumbslider.thumb_pressed == false) { play 3 o_chat_box.reset_location = 2 } else { o_chat_box.reset_location = 1 } initialize (o_chat_box) focus(o_chat_entry) } } if sender_is_me == TRUE { focus(o_chat_entry) sender_is_me = FALSE } } GUI_MAILBOX { for (x = 0; x < player_count; x++) { if (sender == o_kick_button[x]) { callback($$KickPlayer$$, player_id[x]) } if (sender == o_ban_button[x]) { callback($$BanPlayer$$, player_id[x]) } } if (sender == o_show_button) { if (show_info) { o_show_button.text = localize$(IDS_DS_SHOW) show_info = false for (x = 0; x < player_count; x++) { deactivate(o_kick_button[x]) deactivate(o_ban_button[x]) } } else { o_show_button.text = localize$(IDS_DS_HIDE) show_info = true for (x = 0; x < player_count; x++) { activate(o_kick_button[x]) activate(o_ban_button[x]) } } } if (sender == o_disconnect_button) { callback($$Shell_CallbackHandler$$, ShellDisconnectDedicatedServer) } if (sender == o_stop_button) { callback($$Shell_CallbackHandler$$, ShellExitDedicatedServer) } if ((sender == o_chat_entry) && (getmessage() == 1)) { int out_going_count = 0 for int loopit = 0; loopit < 255; loopit++ { if (callback($$IsPlayerConnectionValid$$,loopit)) { $$m_outgiongChatToPlayer$$[out_going_count] = loopit out_going_count++ } } $$m_outgoingChatToPlayerCount$$ = out_going_count $$m_outgoingChat$$ = o_chat_entry.boxvalue sender_is_me = true callback($$SendBroadcastChat$$) o_chat_entry.boxvalue = "" initialize(o_chat_entry) sender_is_me = true } } GUI_CHAR { play 2 // plays o_chat_entry's sound effect of typing if getchar() > 0 o_chat_entry.boxValue = o_chat_entry.boxValue chr$(getchar()) focus(o_chat_entry) o_chat_entry.highlight = false } GUI_DESTROY { focus(NULL) } } s_cursor { GUI_CREATE { pane p_pointer = GPATH "mouse_pointer.tga" alphamode(p_pointer) = am_alpha_alphainvalpha origin(p_pointer) = 0, 0 location.z = 255 } GUI_DRAW { render p_pointer, mouse.x, mouse.y } }