Ejemplo n.º 1
0
    async Task GetCellsLoop()
    {
        var sleepTime = System.TimeSpan.FromMilliseconds(10);

        while (channel != null)
        {
            this.cellsResponce = await client.GetCellsAsync(new Lifegame.CellsRequest());

            Thread.Sleep(sleepTime);
            System.GC.Collect();
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 初期化
    /// </summary>
    void Initialize()
    {
        channel = new Channel($"127.0.0.1:50051", ChannelCredentials.Insecure);
        client  = new Lifegame.Lifegame.LifegameClient(channel);

        var size = client.GetFieldSize(new Lifegame.FieldSizeRequest());

        field.constraintCount = (int)size.Width;
        field.cellSize        = Vector2.one * (field.GetComponent <RectTransform>().rect.height / size.Height / 2);
        for (int i = 0; i < size.Height * size.Width; ++i)
        {
            this.cells.Add(Instantiate(cellPrefab, field.transform));
        }
        this.cellsResponce = client.GetCells(new Lifegame.CellsRequest());
    }