fix editor icon missings

This commit is contained in:
ByteWarsJedi 2024-12-10 21:09:29 +08:00
parent d6d2daa537
commit 49ff28d33c
2 changed files with 85 additions and 35 deletions

View File

@ -44,25 +44,75 @@ namespace DCFApixels.DragonECS.Unity.Internal
private Texture _labelIconMeta = null; private Texture _labelIconMeta = null;
internal Texture HelpIcon { get { return _helpIcon; } } private Texture2D _dummy;
internal Texture FileIcon { get { return _fileIcon; } } private Texture2D _dummyRed;
internal Texture MetaIDIcon { get { return _metaIDIcon; } } private Texture2D _dummyGreen;
internal Texture RepaireIcon { get { return _repaireIcon; } } private Texture2D _dummyYellow;
internal Texture ErrorIcon { get { return _errorIcon; } } private Texture2D Dummy
internal Texture WarningIcon { get { return _warningIcon; } } {
internal Texture PassIcon { get { return _passIcon; } } get { InitDummies(); return _dummy; }
}
private Texture2D DummyRed
{
get { InitDummies(); return _dummyRed; }
}
private Texture2D DummyGreen
{
get { InitDummies(); return _dummyGreen; }
}
private Texture2D DummyYellow
{
get { InitDummies(); return _dummyYellow; }
}
internal Texture UnlinkIcon { get { return _unlinkIcon; } } private void InitDummies()
internal Texture SearchIcon { get { return _searchIcon; } } {
internal Texture CloseIcon { get { return _closeIcon; } } if (_dummy != null) { return; }
internal Texture CloseIconOn { get { return _closeIconOn; } } EcsDebug.PrintWarning("Some icons are missing. The issue might be resolved by using \"Assets -> Reimport All\" or by deleting the \"*project_name*/Library\" folder and restarting Unity.");
internal Texture AuotsetIcon { get { return _auotsetIcon; } } Texture2D Create(Color color_)
internal Texture AutosetCascadeIcon { get { return _auotsetCascadeIcon; } } {
internal Texture VisibilityIconOn { get { return _visibilityIconOn; } } Texture2D result_ = new Texture2D(2, 2);
internal Texture VisibilityIconOff { get { return _visibilityIconOff; } } for (int i = 0; i < 2; i++)
internal Texture LabelIconType { get { return _labelIconType; } } {
internal Texture LabelIconMeta { get { return _labelIconMeta; } } for (int j = 0; j < 2; j++)
{
result_.SetPixel(i, j, color_);
}
}
result_.Apply();
return result_;
}
_dummy = Create(Color.white);
_dummyRed = Create(Color.red);
_dummyGreen = Create(Color.green);
_dummyYellow = Create(Color.yellow);
}
private static Texture Return(Texture icon, Texture dummy)
{
return icon == null ? dummy : icon;
}
internal Texture HelpIcon { get { return Return(_helpIcon, Dummy); } }
internal Texture FileIcon { get { return Return(_fileIcon, Dummy); } }
internal Texture MetaIDIcon { get { return Return(_metaIDIcon, Dummy); } }
internal Texture RepaireIcon { get { return Return(_repaireIcon, Dummy); } }
internal Texture ErrorIcon { get { return Return(_errorIcon, DummyRed); } }
internal Texture WarningIcon { get { return Return(_warningIcon, DummyYellow); } }
internal Texture PassIcon { get { return Return(_passIcon, DummyGreen); } }
internal Texture UnlinkIcon { get { return Return(_unlinkIcon, Dummy); } }
internal Texture SearchIcon { get { return Return(_searchIcon, Dummy); } }
internal Texture CloseIcon { get { return Return(_closeIcon, DummyRed); } }
internal Texture CloseIconOn { get { return Return(_closeIconOn, DummyRed); } }
internal Texture AuotsetIcon { get { return Return(_auotsetIcon, Dummy); } }
internal Texture AutosetCascadeIcon { get { return Return(_auotsetCascadeIcon, Dummy); } }
internal Texture VisibilityIconOn { get { return Return(_visibilityIconOn, Dummy); } }
internal Texture VisibilityIconOff { get { return Return(_visibilityIconOff, Dummy); } }
internal Texture LabelIconType { get { return Return(_labelIconType, Dummy); } }
internal Texture LabelIconMeta { get { return Return(_labelIconMeta, Dummy); } }
#endif #endif
} }
} }

View File

@ -12,20 +12,20 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2ce72fefbf3696f4fb3861773bd997df, type: 3} m_Script: {fileID: 11500000, guid: 2ce72fefbf3696f4fb3861773bd997df, type: 3}
m_Name: Icons m_Name: Icons
m_EditorClassIdentifier: m_EditorClassIdentifier:
_helpIcon: {fileID: 2800000, guid: e135cf23a5d53ce48a75e163b41e39d5, type: 3} _helpIcon: {fileID: 0}
_fileIcon: {fileID: 2800000, guid: 4f1ca6aa9d407844485856184c785946, type: 3} _fileIcon: {fileID: 0}
_metaIDIcon: {fileID: 2800000, guid: d3c6215cfdc36cb448661398160560a7, type: 3} _metaIDIcon: {fileID: 0}
_repaireIcon: {fileID: 2800000, guid: 561fcfb28d73d7c4f8c9fac36e8ece86, type: 3} _repaireIcon: {fileID: 0}
_errorIcon: {fileID: 2800000, guid: c67e8a1d6cb0e904590c7847368fe794, type: 3} _errorIcon: {fileID: 0}
_warningIcon: {fileID: 2800000, guid: 223d96e24d4b49f468b628cf9839584c, type: 3} _warningIcon:{fileID: 0}
_passIcon: {fileID: 2800000, guid: 0df5856dbbe53494aae23b959ca05ecc, type: 3} _passIcon: {fileID: 0}
_unlinkIcon: {fileID: 2800000, guid: 5baead89a941e034e9f44d63617d3246, type: 3} _unlinkIcon:{fileID: 0}
_searchIcon: {fileID: 2800000, guid: 239e73d04c7ba4649bc4cc10e70e62e5, type: 3} _searchIcon: {fileID: 0}
_closeIcon: {fileID: 2800000, guid: 8a708e50662813d4a99c107e6431a60b, type: 3} _closeIcon: {fileID: 0}
_closeIconOn: {fileID: 2800000, guid: 6a1d402595b00c24db2ba647fed93a5c, type: 3} _closeIconOn: {fileID: 0}
_auotsetIcon: {fileID: 2800000, guid: d01e651682f48b548b597714f47e14b9, type: 3} _auotsetIcon: {fileID: 0}
_auotsetCascadeIcon: {fileID: 2800000, guid: 8f9fb2a8877577940971d81a98aeaaaa, type: 3} _auotsetCascadeIcon: {fileID: 0}
_visibilityIconOn: {fileID: 2800000, guid: 9ce9d719a106be04fa4cf0c369c61e1c, type: 3} _visibilityIconOn: {fileID: 0}
_visibilityIconOff: {fileID: 2800000, guid: 1f25a5ca611092642a8ee4e08fafcd43, type: 3} _visibilityIconOff: {fileID: 0}
_labelIconType: {fileID: 2800000, guid: 5476d6e1435981e4cbc915a080f93ee6, type: 3} _labelIconType: {fileID: 0}
_labelIconMeta: {fileID: 2800000, guid: ebb82b09315bde749a10dfa45e64067c, type: 3} _labelIconMeta: {fileID: 0}