BasicModel CreateNewModel(int itemIndex) { int weight = UnityEngine.Random.Range(1, 1 + UnityEngine.Mathf.Clamp(UnityEngine.Mathf.RoundToInt(_CellTypesPanel.slider.value), 1, 10)); var m = new BasicModel() { id = _CurrentFreeID++, weight = weight }; m.aspectRatio = _RandomAspectRatiosTogglePanel.toggle.isOn ? UnityEngine.Random.Range(.4f, 1.6f) : 1f; return(m); }
public void UpdateViews(BasicModel model) { _Title.text = "#" + ItemIndex + " [id:" + model.id + "]"; _Background.color = model.color; }
void ComputeModelSize(BasicModel model) { //model.computedFlexibleWidth = _Params.GetFlexibleWidthFromWeight(model.weight); model.computedPreferredWidth = _Params.GetCellWidthFor(model); }
public float GetCellWidthFor(BasicModel model) { return(model.weight * DefaultItemSize); }