Skip to content

Commit 8245389

Browse files
authored
Merge pull request #4 from ADONE-Games/cleanup/refactor-codebase
ソース整理
2 parents 3215b60 + 9505ef3 commit 8245389

28 files changed

Lines changed: 1481 additions & 1109 deletions

Assets/ResolutionCalcCache/Editor/ProjectSetting.cs

Lines changed: 24 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
// using System.IO;
2-
3-
using System.Collections.Generic;
41
using System.Text;
52

63
using UnityEditor;
74

85
using UnityEngine;
96

7+
108
namespace ADONEGames.ResolutionCalcCache.Editor
119
{
1210
/// <summary>
@@ -94,6 +92,29 @@ public override void OnGUI( string searchContext )
9492
// EditorGUILayout.LabelField( $"Screen.width: {Screen.width}, Screen.height: {Screen.height}" );
9593
// EditorGUILayout.LabelField( $"Screen.mainWindowDisplayInfo.width: {Screen.mainWindowDisplayInfo.width}, Screen.mainWindowDisplayInfo.height: {Screen.mainWindowDisplayInfo.height}" );
9694

95+
// var typeResult = false;
96+
// foreach( var assembly in AppDomain.CurrentDomain.GetAssemblies() )
97+
// {
98+
// foreach( var type in assembly.GetTypes() )
99+
// {
100+
// if( !type.Name.Equals( "ResolutionCategory" ) )
101+
// continue;
102+
103+
// typeResult = true;
104+
// break;
105+
// }
106+
// if( typeResult )
107+
// break;
108+
// }
109+
// if( typeResult )
110+
// {
111+
// EditorGUILayout.LabelField( $"ResolutionCategory: {typeResult}" );
112+
// }
113+
// else
114+
// {
115+
// EditorGUILayout.LabelField( $"ResolutionCategory: null" );
116+
// }
117+
97118
}
98119

99120
/// <summary>
@@ -112,90 +133,4 @@ public static SettingsProvider CreateMyCustomSettingsProvider()
112133
return provider;
113134
}
114135
}
115-
116-
117-
internal class ResolutionCalcCacheSystemData
118-
{
119-
private const string AssetPath = "../ProjectSettings/ResolutionCalcCacheSystemData.asset";
120-
121-
public List<string> ResolutionDataTyepNames = new();
122-
123-
public static ResolutionCalcCacheSystemData Create()
124-
{
125-
var instance = new ResolutionCalcCacheSystemData();
126-
instance.GetSearchType();
127-
return instance;
128-
}
129-
130-
public void GetSearchType()
131-
{
132-
ResolutionDataTyepNames ??= new List<string>();
133-
134-
{
135-
// 仮リスト
136-
ResolutionDataTyepNames.Add( "aaa" );
137-
ResolutionDataTyepNames.Add( "bbb" );
138-
return;
139-
}
140-
141-
var assembly = typeof( ResolutionCalcCacheSystemData ).Assembly; // 仮
142-
var types = assembly.GetTypes();
143-
144-
foreach( var type in types )
145-
{
146-
if( !type.IsValueType ) continue;
147-
if( !type.IsEnum ) continue;
148-
149-
ResolutionDataTyepNames.Add( type.Name );
150-
}
151-
}
152-
}
153-
154-
// [assembly: Dependency(typeof(ResolutionCalcCacheSystemData))]
155-
internal class ResolutionCalcCacheSystemDataEditor : ScriptableObject
156-
{
157-
[SerializeField]
158-
private ResolutionCalcCacheSystemData _systemData;
159-
160-
[SerializeField]
161-
private int _systemDataSelectIndex;
162-
163-
164-
private GUIContent _refreshIconContent;
165-
166-
public void OnGUI()
167-
{
168-
_systemData ??= ResolutionCalcCacheSystemData.Create();
169-
170-
_refreshIconContent ??= EditorGUIUtility.IconContent( "d_Refresh" );
171-
172-
using( var check = new EditorGUI.ChangeCheckScope() )
173-
using( new EditorGUILayout.HorizontalScope( "box" ) )
174-
{
175-
EditorGUILayout.LabelField( "Edit ResolutionType" );
176-
var selectIndex = EditorGUILayout.Popup( _systemDataSelectIndex, _systemData.ResolutionDataTyepNames.ToArray() );
177-
if( check.changed )
178-
{
179-
Undo.RecordObject( this, "Change ResolutionCalcCache-SystemDataIndex" );
180-
_systemDataSelectIndex = selectIndex;
181-
182-
// EditorUtility.SetDirty( this );
183-
}
184-
185-
if( GUILayout.Button( new GUIContent( "", _refreshIconContent.image ), GUILayout.Width( 20 ), GUILayout.Height( 20 ) ) )
186-
{
187-
_systemData.GetSearchType();
188-
}
189-
}
190-
}
191-
192-
public static ResolutionCalcCacheSystemDataEditor Create()
193-
{
194-
var instance = CreateInstance<ResolutionCalcCacheSystemDataEditor>();
195-
instance._systemData = ResolutionCalcCacheSystemData.Create();
196-
instance.hideFlags |= HideFlags.HideAndDontSave;
197-
198-
return instance;
199-
}
200-
}
201136
}

0 commit comments

Comments
 (0)