//#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);
            }
        }