Пример #1
0
        /// <summary>
        /// change column to x coordinate, row to y coordinate.
        /// </summary>
        private void SetPanelPosition(PanelView panel, int column, int row, int columnIndex, int rowIndex, float deltaUp = 0f)
        {
            float x = -PanelView.WIDTH * FrameModel.WIDTH_PANEL_NUM / 2 + PanelView.WIDTH / 2 + column * PanelView.WIDTH;
            float y = -PanelView.HEIGHT * FrameModel.HEIGHT_VISIBLE_PANEL_NUM / 2 + PanelView.HEIGHT / 2 + row * PanelView.HEIGHT;

            panel.SetPositionWithCoordinate(x, y + deltaUp, columnIndex, rowIndex);
        }
Пример #2
0
        public void AddBundleModel(List <PanelModel> panelModels, float deltaUp = 0f)
        {
            IncrementCoordinate();
            int row = DecrementHiddenPanelNumByColumn();

            for (var column = 0; column < panelModels.Count; column++)
            {
                PanelView panel = Instantiate <PanelView>(panelSkeleton);
                panel.Initialize(panelModels[column], false);
                SetPanelPosition(panel, column, row, column, 0, deltaUp);
                SetActions(panel);
                panel.SetParent(frame);
                panelViewModels[column].Insert(0, panel);
            }
        }
Пример #3
0
 public void BundleModelWithView(List <List <PanelModel> > panelModels)
 {
     panelViewModels = new List <List <PanelView> >();
     for (var column = 0; column < panelModels.Count; column++)
     {
         panelViewModels.Add(new List <PanelView>());
         for (var row = 0; row < panelModels[column].Count; row++)
         {
             if (panelModels[column][row] == null)
             {
                 continue;
             }
             PanelView panel = Instantiate <PanelView>(panelSkeleton);
             panel.Initialize(panelModels[column][row], false);
             SetPanelPosition(panel, column, row, column, row);
             SetActions(panel);
             panel.SetParent(frame);
             panelViewModels[column].Add(panel);
         }
     }
 }
Пример #4
0
 public PanelBunlder Build(RectTransform frame, PanelView panelSkeleton)
 {
     this.frame         = frame;
     this.panelSkeleton = panelSkeleton;
     return(this);
 }
Пример #5
0
 private void SetActions(PanelView panel)
 {
     panel.OnSwapLeft  = SwapLeft;
     panel.OnSwapRight = SwapRight;
 }