56 lines
No EOL
1.6 KiB
C#
56 lines
No EOL
1.6 KiB
C#
|
|
using System.Collections.Generic;
|
|
using System.Text.Json;
|
|
using ZoFo.GameCore.GameManagers.NetworkManager;
|
|
using ZoFo.GameCore.GameManagers.NetworkManager.Updates;
|
|
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using System;
|
|
using ZoFo.GameCore.GameObjects;
|
|
using ZoFo.GameCore.GameObjects.MapObjects;
|
|
|
|
namespace ZoFo.GameCore
|
|
{
|
|
public class Client
|
|
{
|
|
ClientNetworkManager networkManager;
|
|
|
|
public bool IsConnected { get { return networkManager.IsConnected; } }
|
|
public Client()
|
|
{
|
|
networkManager = new ClientNetworkManager();
|
|
networkManager.GetDataSent += OnDataSend;
|
|
}
|
|
|
|
public void OnDataSend(string data)
|
|
{
|
|
List<IUpdateData> updateDatas = JsonSerializer.Deserialize<List<IUpdateData>>(data);
|
|
// тут будет switch
|
|
foreach (var item in updateDatas)
|
|
{
|
|
/* switch (item.UpdateType) Здесь нужно отлавливать и регистрировать
|
|
{
|
|
case "Tile":
|
|
MapObject map = new MapObject();
|
|
|
|
break;
|
|
}*/
|
|
}
|
|
|
|
}
|
|
public void GameEndedUnexpectedly() { }
|
|
public void JoinRoom(string ip)
|
|
{
|
|
networkManager.JoinRoom(ip);
|
|
}
|
|
public void JoinYourself() { networkManager.JoinYourself(); }
|
|
internal void Update(GameTime gameTime)
|
|
{
|
|
}
|
|
internal void Draw(SpriteBatch spriteBatch)
|
|
{
|
|
|
|
}
|
|
}
|
|
} |