Exemplo n.º 1
0
    public void ConnectToServer()
    {
#if UNITY_WEBGL && !UNITY_EDITOR
        ServerServiceHelper.InitializeClient <WebglGameClient>(gameData.ipAdress, gameData.port, gameData.userName);
#else
        ServerServiceHelper.InitializeClient <TcpGameClient>(gameData.ipAdress, gameData.port, gameData.userName);
#endif
    }
Exemplo n.º 2
0
    public void OnDraw(PointerEventData eventData)
    {
        var pixels = PointerDataToPixelPos(eventData);

        tex.SetPixel(pixels.x, pixels.y, col);
        tex.Apply();
        ServerPixel pixel = new ServerPixel(pixels.x, pixels.y, new ServerColor(Convert.ToByte(col.r * 255), Convert.ToByte(col.g * 255), Convert.ToByte(col.b * 255), Convert.ToByte(col.a * 255)));

        ServerServiceHelper.SendPixelUpdate(pixel);
    }
Exemplo n.º 3
0
    public void Start()
    {
#if UNITY_WEBGL && !UNITY_EDITOR
        _ = ServerServiceHelper.CreateClient <WebglGameClient>();
#else
        _ = ServerServiceHelper.CreateClient <TcpGameClient>();
#endif

        lazyScriptHandler = FindObjectOfType <LazyScriptHandler>();
        paintBoard        = FindObjectOfType <PaintCanvas>();
        ServerServiceHelper.RegisterChatCallBacks(RecieveChatMessage, UserJoinedMessage);
        ServerServiceHelper.RegisterGameCallBacks(RecievePixelUpdate);
    }
 public void SendChatMessage(string message)
 {
     ServerServiceHelper.SendChatMessage(message);
 }