예제 #1
0
        public void Clean(GameObjectsSet gOS)
        {
            Action <List <CellData> > cAction = (arr) =>
            {
                if (arr != null)
                {
                    arr.RemoveAll((c) =>
                    {
                        return(!BubbleGrid.ok(c.Row, c.Column, vertSize, horSize));
                    });

                    if (gOS)
                    {
                        arr.RemoveAll((c) =>
                        {
                            return(!gOS.ContainID(c.ID));
                        });
                    }
                }
            };

            cAction(featuredCells);
            cAction(overlays);
            SetAsDirty();
        }
예제 #2
0
 /// <summary>
 /// Create boosterholder, if not created
 /// </summary>
 /// <param name="goSet"></param>
 public void CreateBoosterHolder(GameObjectsSet goSet)
 {
     if (BoostHolder == null)
     {
         BoostHolder = new BoostersHolder(goSet, SaveData, savePrefix);
     }
 }
예제 #3
0
        /// <summary>
        /// Remove all non-existent cells data from board
        /// </summary>
        /// <param name="gOS"></param>
        public void Clean(GameObjectsSet gOS)
        {
            Action <List <CellData> > cAction = (arr) =>
            {
                if (arr != null)
                {
                    arr.RemoveAll((c) =>
                    {
                        return((c.Column >= horSize) && (c.Row >= vertSize));
                    });

                    if (gOS)
                    {
                        arr.RemoveAll((c) =>
                        {
                            return(!gOS.ContainID(c.ID));
                        });
                    }
                }
            };

            cAction(featuredCells);
            cAction(blockedCells);
            cAction(overlayCells);
            cAction(disabledCells);
            cAction(underlayCells);
            cAction(dynamicBlockerCells);
            cAction(staticBlockerCells);
            if (matchObjects != null)
            {
                matchObjects.RemoveAll((m) => { return(!gOS.ContainMatchID(m)); });
            }
            SetAsDirty();
        }
예제 #4
0
        public BoostersHolder(GameObjectsSet goSet, bool saveData, string savePrefix)
        {
            this.saveData   = saveData;
            this.savePrefix = savePrefix;

            IList <BoosterObjectData> bDataList = goSet.BoosterObjects;

            boosters = new List <Booster>();
            foreach (var item in bDataList)
            {
                boosters.Add(new Booster(item, saveData, savePrefix));
            }
            Debug.Log("Boosters count: " + boosters.Count);
        }
 public void AddFeaturedCell(CellData cd)
 {
     if (featuredCells == null)
     {
         featuredCells = new List <CellData>(1);
     }
     AddCell(featuredCells, cd);
     if (cd != null && GameObjectsSet.IsEmptyObject(cd.ID))
     {
         if (overlays == null)
         {
             overlays = new List <CellData>(1);
         }
         AddCell(overlays, cd);
     }
 }
        public void OpenMainBrushPanel_Click()
        {
            Debug.Log("open main brush click");
            BubbleGrid        grid = GameBoard.Instance.grid;
            LevelConstructSet lcs  = GameBoard.Instance.gcSet.GetLevelConstructSet(BubblesPlayer.CurrentLevel);

            ScrollPanelController sRC = MainBrushContainer.ScrollPanel;

            if (sRC) //
            {
                sRC.CloseScrollPanel(true, null);
            }
            else
            {
                CloseOpenedPanels();
                //instantiate ScrollRectController
                sRC = MainBrushContainer.InstantiateScrollPanel();
                sRC.textCaption.text = "Main brush panel";

                List <BaseObjectData> mData = new List <BaseObjectData>();
                mData.Add(lcs.Matchset.Empty);
                if (lcs.Matchset.MainObjects != null)
                {
                    foreach (var item in lcs.Matchset.MainObjects)
                    {
                        mData.Add(item);
                    }
                }

                //create main bubbles brushes
                for (int i = 0; i < mData.Count; i++)
                {
                    BaseObjectData mD = mData[i];
                    CreateButton(smallButtonPrefab, sRC.scrollContent, mD.ObjectImage, () =>
                    {
                        Debug.Log("Click on Button <" + mD.ID + "...> ");
                        mainBrush             = (!GameObjectsSet.IsEmptyObject(mD.ID)) ? lcs.Matchset.GetMainObject(mD.ID) : lcs.Matchset.Empty;
                        mainBrushImage.sprite = mainBrush.ObjectImage;
                        SelectMainBrush();
                    });
                }
                sRC.OpenScrollPanel(null);
            }
        }
예제 #7
0
        public override void OnInspectorGUI()
        {
            mS = (GameObjectsSet)target;

            #region default
            EditorGUILayout.BeginVertical("box");
            EditorGUI.indentLevel += 1;
            EditorGUILayout.Space();
            if (showDefault = EditorGUILayout.Foldout(showDefault, "Default Inspector"))
            {
                DrawDefaultInspector();
            }
            EditorGUILayout.Space();
            EditorGUI.indentLevel -= 1;
            EditorGUILayout.EndVertical();
            #endregion default
            serializedObject.Update();

            serializedObject.ApplyModifiedProperties();
        }
        private void AddCell(List <CellData> list, CellData cd)
        {
            if (list.Count > 0)
            {
                list.RemoveAll((c) => { return((cd.Column == c.Column) && (cd.Row == c.Row)); });
            }
            if (!GameObjectsSet.IsEmptyObject(cd.ID))
            {
                list.Add(cd);
            }
            else
            {
                Debug.Log("empty");
            }

            SetAsDirty();
            if (list == featuredCells)
            {
                Debug.Log(featuredCells.Count);
            }
        }
예제 #9
0
        public BubbleGrid(LevelConstructSet lcSet, GameObjectsSet goSet, Transform parent, int sortingOrder, GameMode gMode)
        {
            Debug.Log("new grid ");
            this.lcSet        = lcSet;
            this.parent       = parent;
            this.gMode        = gMode;
            this.sortingOrder = sortingOrder;

            vertSize   = lcSet.VertSize;
            horSize    = lcSet.HorSize;
            this.goSet = goSet;
            prefab     = this.goSet.gridCellPrefab;

            Cells = new List <GridCell>(vertSize * horSize);
            Rows  = new List <Row <GridCell> >(vertSize);

            BubleRadius = prefab.GetComponent <CircleCollider2D>().radius;
            yStart      = Camera.main.orthographicSize - BubleRadius; Debug.Log("yStart: " + yStart + " radius : " + BubleRadius);

            xStep   = BubleRadius * 2.0f;          //
            yStep   = xStep * Mathf.Sin(60.0f * Mathf.Deg2Rad);
            cOffset = (1 - horSize) * BubleRadius; // offset from center

            for (int i = 0; i > -vertSize; i--)
            {
                AddRow();
            }

            for (int i = 0; i < Rows.Count; i++)
            {
                for (int j = 0; j < Rows[i].Length; j++)
                {
                    Rows[i][j].Init(i, j, Rows, gMode);
                }
            }

            SetObjectsData(lcSet.featuredCells, lcSet.overlays, gMode);
            Debug.Log("create cells: " + Cells.Count);
            Instance = this;
        }
예제 #10
0
        public MatchGrid(LevelConstructSet lcSet, GameObjectsSet goSet, Transform parent, int sortingOrder, GameMode gMode)
        {
            Instance = this;
            Debug.Log("new grid ");
            this.lcSet        = lcSet;
            this.parent       = parent;
            this.gMode        = gMode;
            this.sortingOrder = sortingOrder;

            vertSize   = lcSet.VertSize;
            horSize    = lcSet.HorSize;
            this.goSet = goSet;
            prefab     = goSet.gridCellEven;
            cellSize   = prefab.GetComponent <BoxCollider2D>().size;

            float deltaX = lcSet.DistX;
            float deltaY = lcSet.DistY;
            float scale  = lcSet.Scale;

            parent.localScale = new Vector3(scale, scale, scale);

            Cells = new List <GridCell>(vertSize * horSize);
            Rows  = new List <Row <GridCell> >(vertSize);

            yOffset = 0;
            xStep   = (cellSize.x + deltaX);
            yStep   = (cellSize.y + deltaY);

            cOffset = (1 - horSize) * xStep / 2.0f; // offset from center by x-axe
            yStart  = (vertSize - 1) * yStep / 2.0f;

            //instantiate cells
            for (int i = 0; i < vertSize; i++)
            {
                AddRow();
            }
            SetObjectsData(lcSet, gMode);
            Debug.Log("create cells: " + Cells.Count);
        }
예제 #11
0
        public void OpenOverBrushPanel_Click()
        {
            Debug.Log("open over brush click");

            ScrollPanelController sRC = OverBrushContainer.ScrollPanel;

            if (sRC) //
            {
                sRC.CloseScrollPanel(true, null);
            }
            else
            {
                CloseOpenedPanels();
                //instantiate ScrollRectController
                sRC = OverBrushContainer.InstantiateScrollPanel();
                sRC.textCaption.text = "Over brush panel";

                List <BaseObjectData> mData = new List <BaseObjectData>();
                mData.Add(GOSet.Empty);
                if (GOSet.OverlayObjects != null)
                {
                    mData.AddRange(GOSet.OverlayObjects.GetBaseList());
                }

                //create over brushes
                for (int i = 0; i < mData.Count; i++)
                {
                    BaseObjectData mD = mData[i];
                    CreateButton(smallButtonPrefab, sRC.scrollContent, mD.ObjectImage, () =>
                    {
                        Debug.Log("Click on Button <" + mD.ID + "...> ");
                        overBrush             = (!GameObjectsSet.IsEmptyObject(mD.ID)) ? GOSet.GetOverlayObject(mD.ID) : GOSet.Empty;
                        overBrushImage.sprite = overBrush.ObjectImage;
                        SelectOverBrush();
                    });
                }
                sRC.OpenScrollPanel(null);
            }
        }
예제 #12
0
        public void Rebuild(LevelConstructSet lcSet, GameObjectsSet goSet, int sortingOrder, GameMode gMode)
        {
            Debug.Log("rebuild ");

            this.lcSet = lcSet;
            vertSize   = lcSet.VertSize;
            horSize    = lcSet.HorSize;
            this.goSet = goSet;
            List <CellData> featCells = lcSet.featuredCells;

            Cells.ForEach((c) => { c.DestroyGridObjects(); });

            List <GridCell> tempCells = Cells;

            Cells = new List <GridCell>(vertSize * horSize + horSize);
            Rows  = new List <Row <GridCell> >(vertSize);
            float cOffset = (1 - horSize) * BubleRadius; // offfset from center

            // create rows
            GridCell       cell;
            Row <GridCell> row;
            int            cellCounter = 0;
            bool           isEven      = false;
            int            ri          = 0;

            for (int i = 0; i > -vertSize; i--)
            {
                isEven = (ri % 2 == 0);
                row    = new Row <GridCell>((isEven) ? horSize : horSize - 1);
                float eo = (isEven) ? 0 : BubleRadius;
                for (int j = 0; j < row.Length; j++)
                {
                    Vector3 pos = new Vector3(j * xStep + eo + cOffset, yStart + i * yStep, 0);
                    if (tempCells != null && cellCounter < tempCells.Count)
                    {
                        cell = tempCells[cellCounter];
                        cell.transform.localPosition = pos;
                        cellCounter++;
                    }
                    else
                    {
                        cell = UnityEngine.Object.Instantiate(this.goSet.gridCellPrefab).GetComponent <GridCell>();
                        cell.transform.parent        = parent;
                        cell.transform.localPosition = pos;
                        cell.transform.localScale    = Vector3.one;
                    }
                    Cells.Add(cell);
                    row[j] = cell;
                    cell.GetComponent <SpriteRenderer>().enabled = (i > -vertSize);
                }
                Rows.Add(row);
                ri++;
            }

            if (cellCounter < tempCells.Count)
            {
                for (int i = cellCounter; i < tempCells.Count; i++)
                {
                    UnityEngine.Object.Destroy(tempCells[i].gameObject);
                }
            }

            for (int i = 0; i < Rows.Count; i++)
            {
                bool isService     = (i < serviceRowsCount);
                bool isTopBjectRow = (i == serviceRowsCount);
                Rows[i].IsSeviceRow    = isService;
                Rows[i].isTopObjectRow = isTopBjectRow;

                for (int j = 0; j < Rows[i].Length; j++)
                {
                    Rows[i][j].Init(i, j, Rows, gMode);
                }
            }

            SetObjectsData(lcSet.featuredCells, lcSet.overlays, gMode);
            Debug.Log("rebuild cells: " + Cells.Count);
        }
예제 #13
0
        public Sprite GetImage(GameObjectsSet mSet)
        {
            BaseObjectData bD = mSet.GetObject(ID);

            return((bD != null) ? bD.GuiImage : null);
        }
        //#region gift
        //public void OpenGiftPanel_Click()
        //{
        //    Debug.Log("open click");
        //    ScrollPanelController sRC = GiftPanelContainer.ScrollPanel;
        //    if (sRC) //
        //    {
        //        if (sRC) sRC.CloseScrollPanel(true, null);
        //    }
        //    else
        //    {
        //        //instantiate ScrollRectController
        //        sRC = GiftPanelContainer.InstantiateScrollPanel();
        //        sRC.textCaption.text = "Gift panel";

        //        LevelConstructSet lcSet = GameBoard.Instance.gcSet.GetLevelConstructSet(BubblesPlayer.CurrentLevel);
        //        GameConstructSet gcSet = GameBoard.Instance.gcSet;
        //        GiftConstruct levelGift = gcSet.gift;

        //        //create life gift
        //        IncDecInputPanel.Create(sRC.scrollContent, IncDecPanelPrefab, "Life", levelGift.Life.ToString(),
        //            () => { levelGift.AddLifes(1); },
        //            () => { levelGift.AddLifes(-1); },
        //            (val) => { int res; bool good = int.TryParse(val, out res); if (good) { levelGift.SetLifesCount(res); }},
        //            () => { return levelGift.Life.ToString(); },
        //            null);

        //        //create coins gift
        //        IncDecInputPanel.Create(sRC.scrollContent, IncDecPanelPrefab, "Coins", levelGift.Coins.ToString(),
        //        () => { levelGift.AddCoins(1); },
        //        () => { levelGift.AddCoins(-1); },
        //        (val) => { int res; bool good = int.TryParse(val, out res); if (good) { levelGift.SetCoinsCount(res); } },
        //        () => { return levelGift.Coins.ToString(); },
        //        null);

        //        //create booster gift
        //        GameObjectsSet goSet = lcSet.Matchset;
        //        IList<BoosterObjectData> bDataL = goSet.BoosterObjects;
        //        foreach (var item in bDataL)
        //        {
        //            int id = item.ID;
        //            IncDecInputPanel.Create(sRC.scrollContent, IncDecPanelPrefab, "Booster", levelGift.GetBoosterCount(id).ToString(),
        //            () => { levelGift.AddBooster(id); },
        //            () => { levelGift.RemoveBooster(id); },
        //            (val) => { int res; bool good = int.TryParse(val, out res); if (good) { levelGift.SetBoosterCount(res, id); } },
        //            () => { return levelGift.GetBoosterCount(id).ToString(); },
        //            item.GuiImage);
        //        }

        //        sRC.OpenScrollPanel(null);
        //    }
        //}
        //#endregion gift

        #region mission
        public void OpenMissionPanel_Click()
        {
            Debug.Log("open mission click");
            BubbleGrid grid = GameBoard.Instance.grid;

            ScrollPanelController sRC = MissionPanelContainer.ScrollPanel;

            if (sRC) //
            {
                sRC.CloseScrollPanel(true, null);
            }
            else
            {
                CloseOpenedPanels();
                //instantiate ScrollRectController
                sRC = MissionPanelContainer.InstantiateScrollPanel();
                sRC.textCaption.text = "Mission panel";

                LevelConstructSet lcSet        = GameBoard.Instance.gcSet.GetLevelConstructSet(BubblesPlayer.CurrentLevel);
                MissionConstruct  levelMission = lcSet.levelMission;

                //create mission moves constrain
                IncDecInputPanel.Create(sRC.scrollContent, IncDecPanelPrefab, "Moves", levelMission.MovesConstrain.ToString(),
                                        () => { levelMission.AddMoves(1); },
                                        () => { levelMission.AddMoves(-1); },
                                        (val) => { int res; bool good = int.TryParse(val, out res); if (good)
                                                   {
                                                       levelMission.SetMovesCount(res);
                                                   }
                                        },
                                        () => { return(levelMission.MovesConstrain.ToString()); },
                                        null);

                //create time constrain
                IncDecInputPanel.Create(sRC.scrollContent, IncDecPanelPrefab, "Time", levelMission.TimeConstrain.ToString(),
                                        () => { levelMission.AddTime(1); },
                                        () => { levelMission.AddTime(-1); },
                                        (val) => { int res; bool good = int.TryParse(val, out res); if (good)
                                                   {
                                                       levelMission.SetTime(res);
                                                   }
                                        },
                                        () => { return(levelMission.TimeConstrain.ToString()); },
                                        null);

                //description input field
                IncDecInputPanel.Create(sRC.scrollContent, InputTextPanelMissionPrefab, "Description", levelMission.Description,
                                        null,
                                        null,
                                        (val) => { levelMission.SetDescription(val); },
                                        () => { return(levelMission.Description); },
                                        null);

                // create clean top row check box condition
                IncDecInputPanel.Create(sRC.scrollContent, TogglePanelMissionPrefab, "Clean top row", null,
                                        levelMission.LoopTopRow,
                                        null,
                                        null,
                                        null,
                                        (val) => { levelMission.SetLoopTopRow(val); },
                                        null,
                                        null);

                // create raise anchor check box condition
                IncDecInputPanel.Create(sRC.scrollContent, TogglePanelMissionPrefab, "Raise anchor", null,
                                        levelMission.RaiseAnchor,
                                        null,
                                        null,
                                        null,
                                        (val) => { levelMission.SetRaiseAnchor(val); },
                                        null,
                                        null);


                //create object targets
                GameObjectsSet         goSet  = lcSet.Matchset;
                IList <BaseObjectData> tDataL = goSet.TargetObjects;
                foreach (var item in tDataL)
                {
                    if (item != null)
                    {
                        Debug.Log("target ID: " + item.ID);
                        int id = item.ID;
                        IncDecInputPanel.Create(sRC.scrollContent, IncDecTogglePanelMissionPrefab, "Target", levelMission.GetTargetCount(id).ToString(),
                                                levelMission.GetTargetCount(id) == 10000,
                                                () => { levelMission.AddTarget(id, 1); },
                                                () => { levelMission.RemoveTarget(id, 1); },
                                                (val) => { int res; bool good = int.TryParse(val, out res); if (good)
                                                           {
                                                               levelMission.SetTargetCount(id, res);
                                                           }
                                                },
                                                (val) => { if (val)
                                                           {
                                                               levelMission.SetTargetCount(id, 10000);
                                                           }
                                                           else
                                                           {
                                                               levelMission.SetTargetCount(id, 0);
                                                           } },
                                                () => { return(levelMission.GetTargetCount(id).ToString()); }, // grid.GetObjectsCountByID(id).ToString()); },
                                                item.GuiImage);
                    }
                }

                sRC.OpenScrollPanel(null);
            }
        }
        public void OpenGridSettingsPanel_Click()
        {
            Debug.Log("open grid settings click");
            BubbleGrid grid = GameBoard.Instance.grid;

            ScrollPanelController sRC = GridPanelContainer.ScrollPanel;

            if (sRC) //
            {
                if (sRC)
                {
                    sRC.CloseScrollPanel(true, null);
                }
            }
            else
            {
                CloseOpenedPanels();
                //instantiate ScrollRectController
                sRC = GridPanelContainer.InstantiateScrollPanel();
                sRC.textCaption.text = "Grid panel";

                LevelConstructSet lcSet        = GameBoard.Instance.gcSet.GetLevelConstructSet(BubblesPlayer.CurrentLevel);
                MissionConstruct  levelMission = lcSet.levelMission;

                //create  vert size block
                IncDecInputPanel.Create(sRC.scrollContent, IncDecGridPrefab, "VertSize", grid.Rows.Count.ToString(),
                                        () => { IncVertSize(); },
                                        () => { DecVertSize(); },
                                        (val) => {  },
                                        () => { return(grid.Rows.Count.ToString()); },
                                        null);

                //create hor size block
                IncDecInputPanel.Create(sRC.scrollContent, IncDecGridPrefab, "HorSize", lcSet.HorSize.ToString(),
                                        () => { IncHorSize(); },
                                        () => { DecHorSize(); },
                                        (val) => { },
                                        () => { return(lcSet.HorSize.ToString()); },
                                        null);

                //create background block
                IncDecInputPanel.Create(sRC.scrollContent, IncDecGridPrefab, "BackGrounds", lcSet.backGroundNumber.ToString(),
                                        () => { IncBackGround(); },
                                        () => { DecBackGround(); },
                                        (val) => { },
                                        () => { return(lcSet.backGroundNumber.ToString()); },
                                        null);

                //create game object set block
                GameObjectsSet ms      = lcSet.Matchset;
                int            indexMS = MatchSets.IndexOf(ms);
                IncDecInputPanel.Create(sRC.scrollContent, IncDecGridPrefab, "GameSets", ms.name.ToString(),
                                        () => { if (indexMS < 0 || MatchSets.Count < 1)
                                                {
                                                    return;
                                                }
                                                indexMS = (int)Mathf.Repeat(++indexMS, MatchSets.Count); lcSet.Matchset = MatchSets[indexMS]; ShowLevelData(); },
                                        () => { if (indexMS < 0 || MatchSets.Count < 1)
                                                {
                                                    return;
                                                }
                                                indexMS = (int)Mathf.Repeat(--indexMS, MatchSets.Count); lcSet.Matchset = MatchSets[indexMS]; ShowLevelData(); },
                                        (val) => { },
                                        () => { return(lcSet.Matchset.name.ToString()); },
                                        null);


                sRC.OpenScrollPanel(null);
            }
        }
예제 #16
0
        public void Rebuild(LevelConstructSet lcSet, GameObjectsSet mSet, GameMode gMode)
        {
            Debug.Log("rebuild ");

            this.lcSet = lcSet;
            vertSize   = lcSet.VertSize;
            horSize    = lcSet.HorSize;

            float deltaX = lcSet.DistX;
            float deltaY = lcSet.DistY;
            float scale  = lcSet.Scale;

            parent.localScale = new Vector3(scale, scale, scale);

            this.goSet = mSet;
            List <CellData> featCells = lcSet.featuredCells;

            Cells.ForEach((c) => { c.DestroyGridObjects(); });

            List <GridCell> tempCells = Cells;

            Cells = new List <GridCell>(vertSize * horSize + horSize);
            Rows  = new List <Row <GridCell> >(vertSize);

            xStep = (cellSize.x + deltaX);
            yStep = (cellSize.y + deltaY);

            cOffset = (1 - horSize) * xStep / 2.0f; // offset from center by x-axe
            yStart  = (vertSize - 1) * yStep / 2.0f;

            // create rows
            GridCell       cell;
            Row <GridCell> row;
            int            cellCounter = 0;
            int            ri          = 0;
            Sprite         sRE         = mSet.gridCellEven.GetComponent <SpriteRenderer>()?.sprite;
            Sprite         sRO         = mSet.gridCellOdd.GetComponent <SpriteRenderer>().sprite;

            for (int i = 0; i < vertSize; i++)
            {
                bool isEvenRow = (i % 2 == 0);
                row = new Row <GridCell>(horSize);

                for (int j = 0; j < row.Length; j++)
                {
                    bool    isEvenColumn = (j % 2 == 0);
                    Vector3 pos          = new Vector3(j * xStep + cOffset, yStart - i * yStep, 0);

                    if (tempCells != null && cellCounter < tempCells.Count)
                    {
                        cell = tempCells[cellCounter];
                        cell.gameObject.SetActive(true);
                        cell.transform.localPosition = pos;
                        cellCounter++;
                        SpriteRenderer sR = cell.GetComponent <SpriteRenderer>();
                        if (sR)
                        {
                            if (isEvenRow)
                            {
                                sR.sprite = (!isEvenColumn) ? sRO : sRE;
                            }
                            else
                            {
                                sR.sprite = (isEvenColumn) ? sRO : sRE;
                            }
                        }
                    }
                    else
                    {
                        if (isEvenRow)
                        {
                            cell = UnityEngine.Object.Instantiate((!isEvenColumn) ? mSet.gridCellOdd : mSet.gridCellEven).GetComponent <GridCell>();
                        }
                        else
                        {
                            cell = UnityEngine.Object.Instantiate((isEvenColumn) ? mSet.gridCellOdd : mSet.gridCellEven).GetComponent <GridCell>();
                        }
                        cell.transform.parent        = parent;
                        cell.transform.localPosition = pos;
                        cell.transform.localScale    = Vector3.one;
                    }


                    Cells.Add(cell);
                    row[j] = cell;
                }
                Rows.Add(row);
                ri++;
            }

            // destroy not used cells
            if (cellCounter < tempCells.Count)
            {
                for (int i = cellCounter; i < tempCells.Count; i++)
                {
                    UnityEngine.Object.Destroy(tempCells[i].gameObject);
                }
            }

            // cache columns
            Columns = new List <Column <GridCell> >(horSize);
            Column <GridCell> column;

            for (int c = 0; c < horSize; c++)
            {
                column = new Column <GridCell>(Rows.Count);
                for (int r = 0; r < Rows.Count; r++)
                {
                    column[r] = Rows[r][c];
                }
                Columns.Add(column);
            }

            for (int r = 0; r < Rows.Count; r++)
            {
                for (int c = 0; c < horSize; c++)
                {
                    Rows[r][c].Init(r, c, Columns[c], Rows[r], gMode);
                }
            }
            SetObjectsData(lcSet, gMode);

            Debug.Log("rebuild cells: " + Cells.Count);
        }
예제 #17
0
 public Sprite GetImage(GameObjectsSet mSet)
 {
     return(mSet.GetMainObject(id).GuiImage);
 }
예제 #18
0
        internal void SetObject(int ID)
        {
            IsDisabled = false;
            MatchObjectData mOD = GOSet.GetMainObject(ID);

            if (mOD != null)
            {
                SetMatchObject(mOD);
                return;
            }

            OverlayObjectData oOD = GOSet.GetOverlayObject(ID);

            if (oOD != null)
            {
                SetOverlay(oOD);
                return;
            }

            UnderlayObjectData uOD = GOSet.GetUnderlayObject(ID);

            if (uOD != null)
            {
                SetUnderlay(uOD);
                return;
            }

            DynamicClickBombObjectData cdOD = GOSet.GetDynamicClickBombObject(ID);

            if (cdOD != null)
            {
                SetDynamicClickBomb(cdOD);
                return;
            }

            if (ID == GOSet.FallingObject.ID)
            {
                SetFalling(GOSet.FallingObject);
                return;
            }

            BaseObjectData bOD = GOSet.GetObject(ID);

            if (bOD != null && GameObjectsSet.IsDisabledObject(bOD.ID))
            {
                SetDisabledObject(bOD);
                return;
            }

            if (bOD != null && GameObjectsSet.IsBlockedObject(bOD.ID))
            {
                SetBlockedObject(bOD);
            }

            DynamicBlockerData dbOD = GOSet.GetDynamicBlockerObject(ID);

            if (dbOD != null)
            {
                SetDynamicBlockerObject(dbOD);
                return;
            }

            StaticBlockerData sbOD = GOSet.GetStaticBlockerObject(ID);

            if (sbOD != null)
            {
                SetStaticBlockerObject(sbOD);
                return;
            }
        }