Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from Jacob-Mango/feature/ghosticons
feature/ghosticons
- Loading branch information
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...s/5_Mission/CommunityFramework/GUI/InventoryNew/Inherited/AttachmentCategoriesContainer.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
modded class AttachmentCategoriesContainer | ||
{ | ||
override void LoadAttachmentCategoriesIcon(SlotsContainer items_cont, string icon_name, int slot_number) | ||
{ | ||
SlotsIcon icon = items_cont.GetSlotIcon(slot_number); | ||
ImageWidget image_widget = icon.GetGhostSlot(); | ||
image_widget.Show(true); | ||
|
||
string path = "CfgSlots" + " Slot_" + InventorySlots.GetSlotName(icon.GetSlotID()); | ||
|
||
if ( GetGame().ConfigIsExisting( path + " modGhostIcon" ) && GetGame().ConfigGetText( path + " modGhostIcon", icon_name ) && icon_name != "" ) | ||
{ | ||
image_widget.LoadImageFile(0, icon_name); | ||
|
||
if (m_Body.Count() > (slot_number + 2)) | ||
{ | ||
ClosableContainer c = ClosableContainer.Cast(m_Body.Get(slot_number + 2)); | ||
icon.GetRadialIconPanel().Show(true); | ||
if (c && c.IsOpened()) | ||
{ | ||
icon.GetRadialIconClosed().Show(false); | ||
icon.GetRadialIcon().Show(true); | ||
} | ||
else | ||
{ | ||
icon.GetRadialIcon().Show(false); | ||
icon.GetRadialIconClosed().Show(true); | ||
} | ||
} | ||
} else | ||
{ | ||
super.LoadAttachmentCategoriesIcon(items_cont, icon_name, slot_number); | ||
} | ||
} | ||
}; |
38 changes: 38 additions & 0 deletions
38
JM/CF/Scripts/5_Mission/CommunityFramework/GUI/InventoryNew/Inherited/Attachments.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
modded class Attachments | ||
{ | ||
override void InitAttachmentGrid(int att_row_index) | ||
{ | ||
super.InitAttachmentGrid(att_row_index); | ||
|
||
for (int i = 0; i < m_AttachmentSlotNames.Count(); i++) | ||
{ | ||
SlotsIcon icon2 = SlotsContainer.Cast(m_AttachmentsContainer.Get((i / ITEMS_IN_ROW))).GetSlotIcon(i % ITEMS_IN_ROW); | ||
WidgetEventHandler.GetInstance().RegisterOnDoubleClick(icon2.GetPanelWidget(), m_Parent, "DoubleClick"); | ||
|
||
string path = "CfgSlots" + " Slot_" + m_AttachmentSlotNames[i]; | ||
|
||
//Show different magazine icon for firearms and pistols | ||
if (m_AttachmentSlotNames[i] == "magazine") | ||
{ | ||
if (!m_Entity.IsInherited(Pistol_Base)) | ||
path = "CfgSlots" + " Slot_" + "magazine2"; | ||
} | ||
|
||
string icon_name = ""; | ||
if (GetGame().ConfigIsExisting(path + " modGhostIcon") && GetGame().ConfigGetText(path + " modGhostIcon", icon_name) && icon_name != "") | ||
{ | ||
icon2.GetGhostSlot().LoadImageFile(0, icon_name); | ||
|
||
int slot_id = InventorySlots.GetSlotIdFromString(m_AttachmentSlotNames[i]); | ||
m_AttachmentSlots.Insert(slot_id, icon2); | ||
icon2.SetSlotID(slot_id); | ||
|
||
EntityAI item = m_Entity.GetInventory().FindAttachment(slot_id); | ||
if (item) | ||
AttachmentAdded(item, m_AttachmentSlotNames[i], m_Entity); | ||
else | ||
icon2.Clear(); | ||
} | ||
} | ||
} | ||
}; |