Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 6168309

Browse files
Adding configurations to init project view
1 parent abd832f commit 6168309

File tree

1 file changed

+57
-5
lines changed

1 file changed

+57
-5
lines changed

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/InitProjectView.cs

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#pragma warning disable 649
2-
31
using System;
42
using System.Collections.Generic;
53
using System.Linq;
@@ -14,7 +12,9 @@ class InitProjectView : Subview
1412
{
1513
private const string NoRepoTitle = "No Git repository found for this project";
1614
private const string NoRepoDescription = "Initialize a Git repository to track changes and collaborate with others.";
17-
15+
16+
[SerializeField] private UserSettingsView userSettingsView = new UserSettingsView();
17+
[SerializeField] private GitPathView gitPathView = new GitPathView();
1818
[SerializeField] private bool isBusy;
1919
[SerializeField] private bool isPublished;
2020

@@ -24,15 +24,63 @@ public override void OnDataUpdate()
2424
MaybeUpdateData();
2525
}
2626

27+
public override void InitializeView(IView parent)
28+
{
29+
base.InitializeView(parent);
30+
userSettingsView.InitializeView(this);
31+
gitPathView.InitializeView(this);
32+
}
33+
34+
public override void OnEnable()
35+
{
36+
base.OnEnable();
37+
userSettingsView.OnEnable();
38+
gitPathView.OnEnable();
39+
}
40+
41+
public override void OnDisable()
42+
{
43+
base.OnDisable();
44+
userSettingsView.OnDisable();
45+
gitPathView.OnDisable();
46+
}
47+
48+
public override void OnDataUpdate()
49+
{
50+
base.OnDataUpdate();
51+
52+
if (userSettingsView != null)
53+
{
54+
userSettingsView.OnDataUpdate();
55+
}
56+
57+
if (gitPathView != null)
58+
{
59+
gitPathView.OnDataUpdate();
60+
}
61+
}
62+
2763
public override void OnRepositoryChanged(IRepository oldRepository)
2864
{
2965
base.OnRepositoryChanged(oldRepository);
66+
67+
userSettingsView.OnRepositoryChanged(oldRepository);
68+
gitPathView.OnRepositoryChanged(oldRepository);
69+
3070
Refresh();
3171
}
3272

3373
public override bool IsBusy
3474
{
35-
get { return isBusy; }
75+
get { return isBusy || userSettingsView.IsBusy || gitPathView.IsBusy; }
76+
}
77+
78+
public override void Refresh()
79+
{
80+
base.Refresh();
81+
82+
userSettingsView.Refresh();
83+
gitPathView.Refresh();
3684
}
3785

3886
public override void OnGUI()
@@ -66,6 +114,10 @@ public override void OnGUI()
66114
}
67115
EditorGUILayout.EndHorizontal();
68116

117+
gitPathView.OnGUI();
118+
119+
userSettingsView.OnGUI();
120+
69121
GUILayout.BeginVertical(Styles.GenericBoxStyle);
70122
{
71123
GUILayout.FlexibleSpace();
@@ -75,7 +127,7 @@ public override void OnGUI()
75127
GUILayout.BeginHorizontal();
76128
GUILayout.FlexibleSpace();
77129

78-
EditorGUI.BeginDisabledGroup(isBusy);
130+
EditorGUI.BeginDisabledGroup(IsBusy);
79131
{
80132
if (GUILayout.Button(Localization.InitializeRepositoryButtonText, "Button"))
81133
{

0 commit comments

Comments
 (0)