@@ -23,6 +23,7 @@ public class PackAndSendWindow : EditorWindow
2323
2424 private void OnFocus ( )
2525 {
26+ // Get info of States status on server when window got focus
2627 var states = GameObject . FindGameObjectWithTag ( "States" ) ;
2728 if ( states != null )
2829 {
@@ -32,6 +33,7 @@ private void OnFocus()
3233 }
3334 }
3435
36+ // Get iinfo from server about State status
3537 private async void reloadServerInfo ( )
3638 {
3739 HttpClient client = new HttpClient ( ) ;
@@ -54,6 +56,7 @@ private async void reloadServerInfo()
5456
5557 private void OnGUI ( )
5658 {
59+ // Find Status object
5760 if ( _webConnection != null )
5861 {
5962 DrawPackAndSend ( ) ;
@@ -71,16 +74,19 @@ private void DrawStateListError()
7174
7275 private async void DrawPackAndSend ( )
7376 {
77+ // Scroll zone if content would be higher than window hight
7478 _statesScroll = EditorGUILayout . BeginScrollView ( _statesScroll , GUILayout . ExpandHeight ( false ) ) ;
7579
7680 GUILayout . Label ( "Version on the server:" , EditorStyles . boldLabel ) ;
7781 EditorGUI . indentLevel ++ ;
7882
83+ // Field of presentation States for this App on Server
7984 EditorGUILayout . BeginHorizontal ( ) ;
8085 GUILayout . Space ( EditorGUI . indentLevel * 30 ) ;
8186 GUILayout . Label ( "Already loaded on the server: " + ( serverStatus ? "Yes" : "No" ) , GUILayout . ExpandWidth ( false ) ) ;
8287 EditorGUILayout . EndHorizontal ( ) ;
8388
89+ // Show States on server if it has them for this app
8490 if ( serverStatus ) {
8591 EditorGUILayout . BeginHorizontal ( ) ;
8692 GUILayout . Space ( EditorGUI . indentLevel * 15 ) ;
@@ -104,19 +110,23 @@ private async void DrawPackAndSend()
104110
105111 GUILayout . Space ( 40 ) ;
106112
113+ // Block with current local information fron State object
107114 GUILayout . Label ( "Pack and Send to the server:" , EditorStyles . boldLabel ) ;
108115 EditorGUI . indentLevel = 1 ;
109116
117+ // App name field
110118 EditorGUILayout . BeginHorizontal ( ) ;
111119 GUILayout . Space ( EditorGUI . indentLevel * 30 ) ;
112120 GUILayout . Label ( "Application name: " + _webConnection . GameName ) ;
113121 EditorGUILayout . EndHorizontal ( ) ;
114122
123+ // Server URL field
115124 EditorGUILayout . BeginHorizontal ( ) ;
116125 GUILayout . Space ( EditorGUI . indentLevel * 30 ) ;
117126 GUILayout . Label ( "Send to: http://" + _webConnection . BaseURL + "/" ) ;
118127 EditorGUILayout . EndHorizontal ( ) ;
119128
129+ // Local States field
120130 EditorGUILayout . BeginHorizontal ( ) ;
121131 GUILayout . Space ( EditorGUI . indentLevel * 15 ) ;
122132 statesOpend = EditorGUILayout . Foldout ( statesOpend , "States:" , true ) ;
@@ -139,9 +149,13 @@ private async void DrawPackAndSend()
139149 EditorGUILayout . EndScrollView ( ) ;
140150 GUILayout . Space ( 20 ) ;
141151
152+ // Check that local and server data are different
142153 if ( ! CheckUniq ( ) ) {
154+
155+ //if yes, draw Pack and send button
143156 if ( Buttons . PackAndSend ( ) )
144157 {
158+ // Pack States and other info to JSON
145159 List < string > states = new List < string > ( ) ;
146160 for ( int i = 0 ; i < _webConnection . GetLenght ( ) ; i ++ )
147161 {
@@ -154,6 +168,7 @@ private async void DrawPackAndSend()
154168 statesList = states
155169 } ) ;
156170
171+ // And send to server
157172 HttpClient client = new HttpClient ( ) ;
158173
159174 HttpRequestMessage request = new HttpRequestMessage ( HttpMethod . Post , "http://" + _webConnection . BaseURL + "/api/add_states/add" ) ;
@@ -166,6 +181,7 @@ private async void DrawPackAndSend()
166181 }
167182 } else
168183 {
184+ // if not, draw "All up to date!" phrase
169185 GUIStyle style = new GUIStyle ( ) ;
170186 style . normal . textColor = Color . green ;
171187 style . fontSize = 17 ;
@@ -175,6 +191,7 @@ private async void DrawPackAndSend()
175191 }
176192 }
177193
194+ // check that States on server are differ from States on plugin
178195 private bool CheckUniq ( )
179196 {
180197 List < string > states = new List < string > ( ) ;
0 commit comments