private static void InitCell(int idx, float value, float rotation) { UI.GridCell cell = UI.GridManager.Instance.Get(idx); cell.text.text = FormatNumberTruncate(value, 5); cell.text.fontSize = cell.text.rectTransform.rect.width * 0.2f; InitArrow(cell, rotation); }
protected unsafe void DisplayPi() { UIntPtr sizeUsize, nbActionsUsize; float * Pi = Drl.Instance.GetPi(&sizeUsize, &nbActionsUsize); int size = (int)sizeUsize; int nbActions = (int)nbActionsUsize; int cols = UI.GridManager.Instance.cols; for (int i = 0; i < size; i += nbActions) { int maxIdx = -1; float max = 0.0f; for (int j = 0; j < nbActions; ++j) { float val = *(Pi + i + j); if (maxIdx == -1 || val > max) { max = val; maxIdx = j; } } UI.GridCell cell = UI.GridManager.Instance.Get(i / nbActions); InitArrow(cell, MakeRotation(nbActions, maxIdx)); } }
private static void InitArrow(UI.GridCell cell, float rotation) { Color color = cell.arrow.color; color.a = 0.7f; cell.arrow.color = color; cell.arrow.transform.rotation = Quaternion.AngleAxis(rotation, Vector3.forward); cell.arrowContainer.sizeDelta = new Vector2(cell.image.rectTransform.rect.width * 0.3f, cell.image.rectTransform.rect.height * 0.3f); }