2024-05-03 21:21:21 +08:00
using UnityEngine ;
2024-05-04 01:29:32 +08:00
namespace DCFApixels.DragonECS.Unity.Internal
2024-05-03 21:21:21 +08:00
{
2024-05-04 01:29:32 +08:00
internal class Icons : Config < Icons >
2024-05-03 21:21:21 +08:00
{
2024-06-13 18:04:47 +08:00
//Everything inside #if UNITY_EDITOR is not serialized in the release build
2024-05-04 01:29:32 +08:00
#if UNITY_EDITOR
2024-05-03 21:21:21 +08:00
[SerializeField]
2024-06-25 23:33:46 +08:00
private Texture _helpIcon = null ;
2024-05-03 21:21:21 +08:00
[SerializeField]
2024-10-01 18:04:53 +08:00
private Texture _fileIcon = null ;
2024-10-12 14:37:21 +08:00
[SerializeField]
private Texture _metaIDIcon = null ;
2024-10-19 00:05:07 +08:00
[SerializeField]
private Texture _repaireIcon = null ;
2024-10-01 18:04:53 +08:00
2024-05-03 21:21:21 +08:00
[SerializeField]
2024-10-01 18:04:53 +08:00
private Texture _errorIcon = null ;
[SerializeField]
private Texture _warningIcon = null ;
[SerializeField]
private Texture _passIcon = null ;
2024-05-03 21:21:21 +08:00
[SerializeField]
2024-06-25 23:33:46 +08:00
private Texture _unlinkIcon = null ;
2024-05-03 21:21:21 +08:00
[SerializeField]
2024-10-01 18:04:53 +08:00
private Texture _searchIcon = null ;
[SerializeField]
private Texture _closeIcon = null ;
[SerializeField]
private Texture _closeIconOn = null ;
[SerializeField]
2024-06-25 23:33:46 +08:00
private Texture _auotsetIcon = null ;
2024-05-03 21:21:21 +08:00
[SerializeField]
2024-06-25 23:33:46 +08:00
private Texture _auotsetCascadeIcon = null ;
2024-06-13 18:04:47 +08:00
[SerializeField]
2024-06-25 23:33:46 +08:00
private Texture _visibilityIconOn = null ;
2024-06-13 18:04:47 +08:00
[SerializeField]
2024-06-25 23:33:46 +08:00
private Texture _visibilityIconOff = null ;
2024-06-13 18:04:47 +08:00
[SerializeField]
2024-06-25 23:33:46 +08:00
private Texture _labelIconType = null ;
2024-06-13 18:04:47 +08:00
[SerializeField]
2024-06-25 23:33:46 +08:00
private Texture _labelIconMeta = null ;
2024-10-01 18:04:53 +08:00
2024-06-13 18:04:47 +08:00
2024-12-10 21:09:29 +08:00
private Texture2D _dummy ;
private Texture2D _dummyRed ;
private Texture2D _dummyGreen ;
private Texture2D _dummyYellow ;
2024-10-01 18:04:53 +08:00
2024-12-10 21:09:29 +08:00
private Texture2D Dummy
{
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 ; }
}
2024-10-01 18:04:53 +08:00
2024-12-10 21:09:29 +08:00
private void InitDummies ( )
{
if ( _dummy ! = null ) { return ; }
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." ) ;
Texture2D Create ( Color color_ )
{
Texture2D result_ = new Texture2D ( 2 , 2 ) ;
for ( int i = 0 ; i < 2 ; i + + )
{
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 ) ; } }
2024-05-04 01:29:32 +08:00
#endif
2024-05-03 21:21:21 +08:00
}
2024-12-10 21:09:29 +08:00
}