Skip to content

Commit

Permalink
エディタースクリプトを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
o-tr committed Aug 2, 2024
1 parent 680f876 commit 4cc1515
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Runtime/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions Runtime/Editor/HorizontalLayoutEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using jp.ootr.common;
using UnityEditor;

namespace jp.ootr.WeatherWidget.Editor
{
[CustomEditor(typeof(HorizontalLayout))]
public class HorizontalLayoutEditor : UnityEditor.Editor
{
private bool _debug;
public override void OnInspectorGUI()
{
var script = (HorizontalLayout)target;

_debug = EditorGUILayout.ToggleLeft("Debug", _debug);
if (_debug)
{
base.OnInspectorGUI();
return;
}
EditorGUI.BeginChangeCheck();
EditorGUILayout.LabelField("WeatherWidget", EditorStyle.UiTitle);

EditorGUILayout.Space();

EditorGUILayout.LabelField("Forecast Count");
script.forecastCount = (int)EditorGUILayout.Slider(script.forecastCount, 3, 7);

if (!EditorGUI.EndChangeCheck()) return;
EditorUtility.SetDirty(script);
}
}
}
3 changes: 3 additions & 0 deletions Runtime/Editor/HorizontalLayoutEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Runtime/jp.ootr.WeatherWidget/Scripts/HorizontalLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class HorizontalLayout : Copy
[SerializeField] private TextMeshProUGUI tempText;
[SerializeField] private TextMeshProUGUI popText;
[SerializeField] private TextMeshProUGUI overviewText;
[SerializeField] private int forecastCount;
[SerializeField] public int forecastCount;

protected override void OnWeatherLoadSuccess(WeatherData data)
{
Expand Down
6 changes: 1 addition & 5 deletions WeatherScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
launchedFromSDKPipeline: 0
completedSDKPipeline: 0
blueprintId: wrld_a9c7d59d-2a8f-4489-aa7a-a51eb6fbbb38
blueprintId:
contentType: 1
assetBundleUnityVersion:
fallbackStatus: 0
Expand Down Expand Up @@ -705,10 +705,6 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 3519630885417581180, guid: ade2b3e357669fe40a82979e908a520c, type: 3}
propertyPath: weatherApiUrl.url
value: https://weather.ootr.jp/api?geoPosId=130010
objectReference: {fileID: 0}
- target: {fileID: 3519630885417581180, guid: ade2b3e357669fe40a82979e908a520c, type: 3}
propertyPath: serializationData.Prefab
value:
Expand Down

0 comments on commit 4cc1515

Please sign in to comment.