Exemple #1
0
        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);
        }
Exemple #2
0
 public void UpdateViews(BasicModel model)
 {
     _Title.text       = "#" + ItemIndex + " [id:" + model.id + "]";
     _Background.color = model.color;
 }
Exemple #3
0
 void ComputeModelSize(BasicModel model)
 {
     //model.computedFlexibleWidth = _Params.GetFlexibleWidthFromWeight(model.weight);
     model.computedPreferredWidth = _Params.GetCellWidthFor(model);
 }
Exemple #4
0
 public float GetCellWidthFor(BasicModel model)
 {
     return(model.weight * DefaultItemSize);
 }