From 94d649397f2be9b185feae0da1951b7d6dfc3ba0 Mon Sep 17 00:00:00 2001 From: Snippers Date: Mon, 5 Dec 2016 00:39:59 +0000 Subject: [PATCH] Bear slot UI & add readme (#11) * Add Readme * Add Bear Slotting UI Project --- README.md | 3 + addons/tm_slotting_ui/$PBOPREFIX$ | 1 + addons/tm_slotting_ui/config.cpp | 157 ++++++++++++++++++ addons/tm_slotting_ui/script_component.hpp | 5 + .../scripts/RscDisplayMultiplayerSetup.sqf | 44 +++++ .../scripts/RscDisplayRemoteMissions.sqf | 117 +++++++++++++ 6 files changed, 327 insertions(+) create mode 100644 README.md create mode 100644 addons/tm_slotting_ui/$PBOPREFIX$ create mode 100644 addons/tm_slotting_ui/config.cpp create mode 100644 addons/tm_slotting_ui/script_component.hpp create mode 100644 addons/tm_slotting_ui/scripts/RscDisplayMultiplayerSetup.sqf create mode 100644 addons/tm_slotting_ui/scripts/RscDisplayRemoteMissions.sqf diff --git a/README.md b/README.md new file mode 100644 index 00000000..9bcfdc4b --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# 1Tac Misc Project + +This project contains various config patches, and small tweaks intended for the Team One Tactical (1Tac) Arma 3 community. diff --git a/addons/tm_slotting_ui/$PBOPREFIX$ b/addons/tm_slotting_ui/$PBOPREFIX$ new file mode 100644 index 00000000..8b5a4b1c --- /dev/null +++ b/addons/tm_slotting_ui/$PBOPREFIX$ @@ -0,0 +1 @@ +x\tac1\addons\tm_slotting_ui \ No newline at end of file diff --git a/addons/tm_slotting_ui/config.cpp b/addons/tm_slotting_ui/config.cpp new file mode 100644 index 00000000..81d52ee0 --- /dev/null +++ b/addons/tm_slotting_ui/config.cpp @@ -0,0 +1,157 @@ +#include "script_component.hpp" + +class CfgPatches +{ + class ADDON + { + name = "Slotting UI Improvements"; + author = "Bear, Snippers"; + url = "http://www.teamonetactical.com"; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"tac1_tm_main","A3_UI_F"}; + VERSION_CONFIG; + }; +}; + +class CfgScriptPaths +{ + BEAR_MPLOBBY = "x\tac1\addons\tm_slotting_ui\scripts\"; +}; +class RscStandardDisplay; +class RscText; +class RscActiveText; +class RscListBox; +class RscListNBox; +class RscButtonMenu; +class RscChatListDefault +{ + x = "safezoneX + (19.8 * (((safezoneW / safezoneH) min 1.2) / 40)) + 0.45*(safezoneW - ((safezoneW / safezoneH) min 1.2))"; +}; +class RscDisplayRemoteMissions: RscStandardDisplay +{ + scriptName = "RscDisplayRemoteMissions"; + scriptPath = "BEAR_MPLOBBY"; + class controls + { + delete ButtonLog; + }; +}; +class RscDisplayMultiplayerSetup: RscStandardDisplay +{ + scriptName = "RscDisplayMultiplayerSetup"; + scriptPath = "BEAR_MPLOBBY"; + onLoad = "[""onLoad"",_this,""RscDisplayMultiplayerSetup"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"; + onUnload = "[""onUnload"",_this,""RscDisplayMultiplayerSetup"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"; + class controlsbackground + { + class RolesBackground: RscText + { + colorBackground[] = {0,0,0,0.3}; + idc = 1085; + x = "4.8 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (SafezoneX)"; + y = "6.8 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY)"; + w = "(14.9 * ( ((safezoneW / safezoneH) min 1.2) / 40)) + 0.45*(safezoneW - ((safezoneW / safezoneH) min 1.2))"; + h = "SafezoneH - (9 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25))"; + }; + class ChatBackground: RscText + { + colorBackground[] = {0,0,0,0.3}; + idc = 1086; + x = "safezoneX + (19.8 * ( ((safezoneW / safezoneH) min 1.2) / 40)) + 0.45*(safezoneW - ((safezoneW / safezoneH) min 1.2))"; + y = "17.2 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY) + 0.7*(safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))"; + w = "(19 * ( ((safezoneW / safezoneH) min 1.2) / 40)) + 0.55*(safezoneW - ((safezoneW / safezoneH) min 1.2))"; + h = "(5.6 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25))+ 0.3*(safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))"; + }; + class PlayersPoolBackground: RscText + { + colorBackground[] = {0,0,0,0.3}; + idc = 1087; + x = "safezoneX + (19.8 * ( ((safezoneW / safezoneH) min 1.2) / 40)) + 0.45*(safezoneW - ((safezoneW / safezoneH) min 1.2))"; + y = "6.8 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY)"; + w = "(19 * ( ((safezoneW / safezoneH) min 1.2) / 40)) + 0.55*(safezoneW - ((safezoneW / safezoneH) min 1.2))"; + h = "(10.3 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)) + 0.7*(safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))"; + }; + class SideBackground: RscText + { + colorBackground[] = {0,0,0,0.3}; + idc = 1084; + x = "1.2 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (SafezoneX)"; + y = "6.8 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY)"; + w = "(3.5 * ( ((safezoneW / safezoneH) min 1.2) / 40))"; + h = "SafezoneH - (9 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25))"; + }; + }; + class controls + { + class CA_ValueRoles: RscListBox + { + idc = 109; + colorAI[] = {0.67,0.24,0.24,1}; + colorNobody[] = {1,1,1,0.25}; + x = "4.8 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (SafezoneX)"; + w = "(14.9 * ( ((safezoneW / safezoneH) min 1.2) / 40)) + 0.45*(safezoneW - ((safezoneW / safezoneH) min 1.2))"; + h = "SafezoneH - (9 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25))"; + colorSelectBackground[] = {1,1,1,0.15}; + colorSelectBackground2[] = {1,1,1,0.15}; + y = "6.8 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY)"; + }; + class CA_ValuePool: RscListNBox + { + idc = 114; + canDrag = 1; + rows = 25; + sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; + x = "safezoneX + (19.8 * ( ((safezoneW / safezoneH) min 1.2) / 40)) + 0.45*(safezoneW - ((safezoneW / safezoneH) min 1.2))"; + w = "(19 * ( ((safezoneW / safezoneH) min 1.2) / 40)) + 0.55*(safezoneW - ((safezoneW / safezoneH) min 1.2))"; + h = "(10.3 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)) + 0.7*(safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))"; + colorSelectBackground[] = {1,1,1,0.15}; + colorSelectBackground2[] = {1,1,1,0.15}; + colorPictureSelected[] = {1,1,1,1}; + y = "6.8 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY)"; + }; + class CA_B_EnableAll: RscButtonMenu + { + y = "SafezoneY + SafezoneH - (2 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25))"; + w = "6.25 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + size = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + }; + class CA_B_Kick: RscButtonMenu + { + y = "SafezoneY + SafezoneH - (2 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25))"; + w = "6.25 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; + h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + x = "safezoneX + SafezoneW - (13.6 * (((safezoneW / safezoneH) min 1.2) / 40)) - ((safezoneX + SafezoneW - (7.25 * (((safezoneW / safezoneH) min 1.2) / 40))) - (safezoneX + SafezoneW - (13.6 * (((safezoneW / safezoneH) min 1.2) / 40))))"; + size = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + }; + class CA_B_West: RscActiveText + { + text = " "; + textHeight = 0.67; + }; + class CA_B_East: CA_B_West + { + text = " "; + }; + class CA_B_Guerrila: CA_B_West + { + text = " "; + }; + class CA_B_Civilian: CA_B_West + { + text = " "; + }; + class CA_B_Virtual: CA_B_West + { + text = " "; + }; + }; +}; +class cfgMods +{ + author = "76561198014669991"; + timepacked = "1442491890"; +}; +//}; diff --git a/addons/tm_slotting_ui/script_component.hpp b/addons/tm_slotting_ui/script_component.hpp new file mode 100644 index 00000000..c0d5ea07 --- /dev/null +++ b/addons/tm_slotting_ui/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT tm_slotting_ui + +#include "\x\tac1\addons\tm_main\script_mod.hpp" +#include "\x\tac1\addons\tm_main\script_macros.hpp" + diff --git a/addons/tm_slotting_ui/scripts/RscDisplayMultiplayerSetup.sqf b/addons/tm_slotting_ui/scripts/RscDisplayMultiplayerSetup.sqf new file mode 100644 index 00000000..efbbd08e --- /dev/null +++ b/addons/tm_slotting_ui/scripts/RscDisplayMultiplayerSetup.sqf @@ -0,0 +1,44 @@ +_mode = _this select 0; +_params = _this select 1; +_class = _this select 2; + +disableSerialization; + +switch _mode do +{ + case "onLoad": + { + _display = _params select 0; + + //Be sure chat is shown in case it was switched off in one of the preceding displays + showChat true; + + //--- set player's name + (_display displayctrl 701) ctrlSetText profileName; + [_display, 701] call (uinamespace getvariable 'BIS_fnc_setIDCStreamFriendly'); + + //toUpper Title + _control = _display displayctrl 1000; + _control ctrlSetText (toUpper (ctrlText _control)); + + //Count players - works but can be done better (wait until ListBox is filled, than count), or use event handler for changing count of ListBox + _display displayaddeventhandler + [ + "mousemoving", + " + _display = _this select 0; + (_display displayctrl 1015) ctrlsettext str ((lnbSize (_display displayctrl 114)) select 0); + " + ]; + + //Move focus to Roles, since OK button is disabled. We don't want to move focus to Disconnect button on client. + ctrlSetFocus (_display displayctrl 109); + }; + + case "onUnload": { + + //Hide chat to be sure it's hidden when returning back to Create Game + showChat false; + }; + +}; \ No newline at end of file diff --git a/addons/tm_slotting_ui/scripts/RscDisplayRemoteMissions.sqf b/addons/tm_slotting_ui/scripts/RscDisplayRemoteMissions.sqf new file mode 100644 index 00000000..27121aaa --- /dev/null +++ b/addons/tm_slotting_ui/scripts/RscDisplayRemoteMissions.sqf @@ -0,0 +1,117 @@ +disableserialization; + +_mode = _this select 0; +_params = _this select 1; +_class = _this select 2; + +switch _mode do { + + case "onLoad": { + _display = _params select 0; + + //--- set player's name + (_display displayctrl 109) ctrlSetText profileName; + [_display, 109] call (uinamespace getvariable 'BIS_fnc_setIDCStreamFriendly'); + + //Sets title and button texts toUpper + ["RscDisplayRemoteMissions",["RscText","RscTitle"],["PlayersName"]] call bis_fnc_toUpperDisplayTexts; + + //Hide chat, show mission summary + showChat false; + _missionSummary = (_display displayctrl 2300); + _missionSummary ctrlSetFade 0; + _missionSummary ctrlCommit 0; + _missionSummary ctrlEnable true; + + //Mission Summary button + _button = _display displayctrl 1085; + //_button ctrladdeventhandler ["buttonclick","with uinamespace do {['missionSummaryButton',_this,''] call RscDisplayRemoteMissions_script};"]; + _button ctrlSetBackgroundColor [1,1,1,1]; + _button ctrlSetTextColor [0,0,0,1]; + + //Chat button + //_button = _display displayctrl 1086; + //_button ctrladdeventhandler ["buttonclick","with uinamespace do {['chatButton',_this,''] call RscDisplayRemoteMissions_script};"]; + + //count missions + //_vel = lbSize (_display displayctrl 102); + + //debuglog _vel; + + //don't count New-Editor and New-Wizard + //_size = _size - 2; + //if(_size < 0) then {_size = 0;}; + //(_display displayctrl 1014) ctrlSetText (str _vel); + + //(_display displayctrl 101) ctrladdeventhandler ["lbselchanged","with uinamespace do {['mapChanged',_this,''] call RscDisplayRemoteMissions_script};"]; + }; + + //--- Mission Summary button + case "missionSummaryButton": { + + _missionSummaryButton = _params select 0; + _display = ctrlparent _missionSummaryButton; + _chatButton = _display displayctrl 1086; + + //Hide chat, show mission summary + showChat false; + _missionSummary = (_display displayctrl 2300); + _missionSummary ctrlSetFade 0; + _missionSummary ctrlCommit 0; + _missionSummary ctrlEnable true; + + //Set focus to MISSION SUMMARY button (change background and text colours of the tabs) + _missionSummaryButton ctrlSetBackgroundColor [1,1,1,1]; + _missionSummaryButton ctrlSetTextColor [0,0,0,1]; + _chatButton ctrlSetBackgroundColor [0,0,0,1]; + _chatButton ctrlSetTextColor [1,1,1,1]; + }; + + //--- Chat button + case "chatButton": { + + _chatButton = _params select 0; + _display = ctrlparent _chatButton; + _missionSummaryButton = _display displayctrl 1085; + + //Show chat, hide mission summary + showChat true; + _missionSummary = (_display displayctrl 2300); + _missionSummary ctrlSetFade 1; + _missionSummary ctrlCommit 0; + _missionSummary ctrlEnable false; + + //Set focus to CHAT button (change background and text colours of the tabs) + _chatButton ctrlSetBackgroundColor [1,1,1,1]; + _chatButton ctrlSetTextColor [0,0,0,1]; + _missionSummaryButton ctrlSetBackgroundColor [0,0,0,1]; + _missionSummaryButton ctrlSetTextColor [1,1,1,1]; + + }; + + /* + case "mapChanged": { + [] spawn + { + //_ctrl = _params select 0; + _display = ctrlparent (_params select 0); + + sleep 0.2; + + //count missions + _size = lbSize (_display displayctrl 102); + //don't count New-Editor and New-Wizard + _size = _size - 2; + if(_size < 0) then {_size = 0;}; + (_display displayctrl 1014) ctrlSetText (str _size); + }; + }; + */ + + case "onUnload": { + + //Hide chat to be sure it's hidden when returning back to Server List + showChat false; + }; + +}; \ No newline at end of file