private void ShowDepFor(LevelUIComponent level, int row) { int[] deps = level.GetDeps(); for (int i = 0; i < deps.Length; i++) { Vector2 delta = (Vector2.up * 20); Vector2 start = FindLoc(deps[i], row) - delta; Vector2 end = (Vector2)level.Rect.position + delta; DependencyUIComponent comp = Instantiate(DependecyComp); comp.Rect.SetParent(Dependencies); comp.Show(start, end); dependecies.Add(comp); } }
public void LoadData(LevelModel[] levels) { Levels = new LevelUIComponent[levels.Length]; float delta = LevelPanel.WIDTH / (1 + levels.Length); for (int i = 0; i < levels.Length; i++) { LevelUIComponent comp = Instantiate(LevelComp); comp.Rect.SetParent(Rect); comp.Rect.localScale = Vector3.one; comp.Rect.localPosition = new Vector2(delta * (i + 1) - (LevelPanel.WIDTH / 2), 0); comp.Load(levels[i]); Levels[i] = comp; } }