-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix intel description being the same for all items (#53)
* Ensure to get description of local intel * Add comment * Fix names of intel editor attributes
- Loading branch information
Showing
7 changed files
with
149 additions
and
97 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
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
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
74 changes: 37 additions & 37 deletions
74
...ibutes/ODIN_IntelContentEditorAttribute.c → ...ributes/GME_IntelContentEditorAttribute.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 |
---|---|---|
@@ -1,38 +1,38 @@ | ||
[BaseContainerProps(), SCR_BaseEditorAttributeCustomTitle()] | ||
class GME_IntelContentAttribute : SCR_BasePresetsEditorAttribute | ||
{ | ||
override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager) | ||
{ | ||
SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item); | ||
if (!editableEntity) | ||
return null; | ||
IEntity owner = editableEntity.GetOwner(); | ||
if (!owner) | ||
return null; | ||
GME_IntelComponent intelComponent = GME_IntelComponent.Cast(owner.FindComponent(GME_IntelComponent)); | ||
if (!intelComponent) | ||
return null; | ||
return SCR_BaseEditorAttributeVar.GME_CreateString(intelComponent.GetContent()); | ||
} | ||
override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID) | ||
{ | ||
if (!var) | ||
return; | ||
SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item); | ||
IEntity owner = editableEntity.GetOwner(); | ||
if (!owner) | ||
return; | ||
GME_IntelComponent intelComponent = GME_IntelComponent.Cast(owner.FindComponent(GME_IntelComponent)); | ||
if (!intelComponent) | ||
return; | ||
intelComponent.SetContent(var.GME_GetString()); | ||
} | ||
[BaseContainerProps(), SCR_BaseEditorAttributeCustomTitle()] | ||
class GME_IntelContentEditorAttribute : SCR_BasePresetsEditorAttribute | ||
{ | ||
override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager) | ||
{ | ||
SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item); | ||
if (!editableEntity) | ||
return null; | ||
|
||
IEntity owner = editableEntity.GetOwner(); | ||
if (!owner) | ||
return null; | ||
|
||
GME_IntelComponent intelComponent = GME_IntelComponent.Cast(owner.FindComponent(GME_IntelComponent)); | ||
if (!intelComponent) | ||
return null; | ||
|
||
return SCR_BaseEditorAttributeVar.GME_CreateString(intelComponent.GetContent()); | ||
} | ||
|
||
override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID) | ||
{ | ||
if (!var) | ||
return; | ||
|
||
SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item); | ||
|
||
IEntity owner = editableEntity.GetOwner(); | ||
if (!owner) | ||
return; | ||
|
||
GME_IntelComponent intelComponent = GME_IntelComponent.Cast(owner.FindComponent(GME_IntelComponent)); | ||
if (!intelComponent) | ||
return; | ||
|
||
intelComponent.SetContent(var.GME_GetString()); | ||
} | ||
}; |
82 changes: 41 additions & 41 deletions
82
...tributes/ODIN_IntelTitleEditorAttribute.c → ...ttributes/GME_IntelTitleEditorAttribute.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 |
---|---|---|
@@ -1,41 +1,41 @@ | ||
//------------------------------------------------------------------------------------------------ | ||
[BaseContainerProps(), SCR_BaseEditorAttributeCustomTitle()] | ||
class GME_IntelTitleAttribute : SCR_BasePresetsEditorAttribute | ||
{ | ||
//------------------------------------------------------------------------------------------------ | ||
override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager) | ||
{ | ||
SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item); | ||
if (!editableEntity) | ||
return null; | ||
IEntity owner = editableEntity.GetOwner(); | ||
if (!owner) | ||
return null; | ||
GME_IntelComponent intelComponent = GME_IntelComponent.Cast(owner.FindComponent(GME_IntelComponent)); | ||
if (!intelComponent) | ||
return null; | ||
return SCR_BaseEditorAttributeVar.GME_CreateString(intelComponent.GetTitle()); | ||
} | ||
//------------------------------------------------------------------------------------------------ | ||
override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID) | ||
{ | ||
if (!var) | ||
return; | ||
SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item); | ||
IEntity owner = editableEntity.GetOwner(); | ||
if (!owner) | ||
return; | ||
GME_IntelComponent intelComponent = GME_IntelComponent.Cast(owner.FindComponent(GME_IntelComponent)); | ||
if (!intelComponent) | ||
return; | ||
intelComponent.SetTitle(var.GME_GetString()); | ||
} | ||
} | ||
//------------------------------------------------------------------------------------------------ | ||
[BaseContainerProps(), SCR_BaseEditorAttributeCustomTitle()] | ||
class GME_IntelTitleEditorAttribute : SCR_BasePresetsEditorAttribute | ||
{ | ||
//------------------------------------------------------------------------------------------------ | ||
override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager) | ||
{ | ||
SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item); | ||
if (!editableEntity) | ||
return null; | ||
|
||
IEntity owner = editableEntity.GetOwner(); | ||
if (!owner) | ||
return null; | ||
|
||
GME_IntelComponent intelComponent = GME_IntelComponent.Cast(owner.FindComponent(GME_IntelComponent)); | ||
if (!intelComponent) | ||
return null; | ||
|
||
return SCR_BaseEditorAttributeVar.GME_CreateString(intelComponent.GetTitle()); | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID) | ||
{ | ||
if (!var) | ||
return; | ||
|
||
SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item); | ||
|
||
IEntity owner = editableEntity.GetOwner(); | ||
if (!owner) | ||
return; | ||
|
||
GME_IntelComponent intelComponent = GME_IntelComponent.Cast(owner.FindComponent(GME_IntelComponent)); | ||
if (!intelComponent) | ||
return; | ||
|
||
intelComponent.SetTitle(var.GME_GetString()); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
addons/GME/Scripts/Game/GME/Editor/Containers/UIInfo/GME_EditableIntelUIInfo.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,10 @@ | ||
[BaseContainerProps()] | ||
class GME_EditableIntelUIInfo : SCR_EditableEntityUIInfo | ||
{ | ||
//------------------------------------------------------------------------------------------------ | ||
//! override without 'protected' keyword | ||
override void CopyFrom(SCR_UIName source) | ||
{ | ||
super.CopyFrom(source); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
addons/GME/Scripts/Game/GME/UI/Inventory/GME_IntelUIInfo.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,18 @@ | ||
[BaseContainerProps()] | ||
class GME_IntelUIInfo : SCR_InventoryUIInfo | ||
{ | ||
//------------------------------------------------------------------------------------------------ | ||
//! Function to override to get custom inventory name | ||
override string GetInventoryItemDescription(InventoryItemComponent item) | ||
{ | ||
GME_IntelComponent intelComponent = GME_IntelComponent.Cast(item.GetOwner().FindComponent(GME_IntelComponent)); | ||
if (!intelComponent) | ||
return super.GetInventoryItemDescription(item); | ||
|
||
string description = intelComponent.GetInventoryItemDescription(); | ||
if (description.IsEmpty()) | ||
return super.GetInventoryItemDescription(item); | ||
|
||
return description; | ||
} | ||
} |