예제 #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();
        }
    }
예제 #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());
    }