Daniele Bartolini 9 лет назад
Родитель
Сommit
07b09e3c49
3 измененных файлов с 11 добавлено и 11 удалено
  1. 0 8
      src/device/console_server.cpp
  2. 3 3
      tools/api/engine_api.vala
  3. 8 0
      tools/level_editor/level_editor.vala

+ 0 - 8
src/device/console_server.cpp

@@ -61,14 +61,6 @@ void ConsoleServer::error(TCPSocket client, const char* msg)
 	send(client, string_stream::c_str(ss));
 }
 
-void ConsoleServer::success(TCPSocket client, const char* msg)
-{
-	TempAllocator4096 ta;
-	StringStream ss(ta);
-	ss << "{\"type\":\"success\",\"message\":\"" << msg << "\"}";
-	send(client, string_stream::c_str(ss));
-}
-
 void ConsoleServer::send(const char* json)
 {
 	for (u32 i = 0; i < vector::size(_clients); ++i)

+ 3 - 3
tools/api/engine_api.vala

@@ -29,17 +29,17 @@ namespace Crown
 
 		public string reload(string type, string name)
 		{
-			return "{\"type\":\"reload\",\"resource_type\":\"%s\",\"resource_name\":\"%s\"}".printf(type, name);
+			return command({ "reload", type, name });
 		}
 
 		public string pause()
 		{
-			return "{\"type\":\"pause\"}";
+			return command({ "pause" });
 		}
 
 		public string unpause()
 		{
-			return "{\"type\":\"unpause\"}";
+			return command({ "unpause" });
 		}
 	}
 }

+ 8 - 0
tools/level_editor/level_editor.vala

@@ -528,6 +528,14 @@ namespace Crown
 
 					_level.on_selection(ids);
 				}
+				else if (msg_type == "error")
+				{
+					_console_view.loge("Editor", "Error: " + (string)msg["message"]);
+				}
+				else
+				{
+					_console_view.loge("Editor", "Unknown message type: " + msg_type);
+				}
 			}
 			catch (Error e)
 			{