public void CloseLevelsPanel(RectTransform sender)
    {
        LevelsPanel activePanel = sender.GetComponentInChildren <LevelsPanel>();

        if (activePanel != null)
        {
            activePanel.gameObject.SetActive(false);
        }
    }
    LevelsPanel InstantiateBtn(Button btn, string key = null)
    {
        btn.onClick.RemoveAllListeners();
        LevelsPanel levelsPanel = Instantiate(LevelsPanelPrefab);

        LevelsPanels.Add(levelsPanel);

        levelsPanel.ButtonKey = key;
        levelsPanel.transform.SetParent(LevelsParentl);
        levelsPanel.transform.localScale = Vector3.one;
        levelsPanel.GetComponent <RectTransform>().offsetMin = Vector2.zero;
        levelsPanel.GetComponent <RectTransform>().offsetMax = Vector2.zero;
        levelsPanel.gameObject.SetActive(false);
        btn.onClick.AddListener(() => { btn.transform.parent.parent.gameObject.SetActive(false); levelsPanel.gameObject.SetActive(true); });

        return(levelsPanel);
    }
Пример #3
0
    public void loadLevel(int n)
    {
        iLevel       = n;
        levelReached = Mathf.Max(levelReached, iLevel);

        myLoadScene(n);
        LevelText.text = "Level " + (iLevel);

        //DebugText.text += "\nlevelReached = " + levelReached + "   FROM GAMECONTROLLER";

        menu = false;
        MainMenuPanel.SetActive(false);
        LevelsPanel.SetActive(false);

        //if(n == 1)
        //{
        //    Debug.Log("Got here");

        //    GameObject camera = GameObject.Find("findTestCamera");
        //    if (camera) { Debug.Log("Camera found"); }
        //    else { Debug.Log("Camera found"); }

        //    //GameObject tiles = GameObject.Find("Tiles");
        //    //if (gameOverText) { Debug.Log("gameOverText found"); }
        //    //else { Debug.Log("gameOverText not found"); }

        //    //GameObject tiles = GameObject.FindGameObjectWithTag("Tiles"); //is this a list?
        //    //if (tiles) { Debug.Log("tiles found"); }
        //    //else { Debug.Log("tiles not found"); }
        //    ////GameObject tile00 = GameObject.Find("00");
        //    //GameObject tile00 = GameObject.Find("01");
        //    //if (tile00) { Debug.Log("tile found"); }
        //    //else { Debug.Log("tile not found"); }
        //    ////GameObject.
        //    //Camera camera = tile00.transform.Find("Camera").GetComponent<Camera>();
        //    //if (camera) { Debug.Log("camera found"); }
        //    //else { Debug.Log("camera not found"); }
        //    //camera.enabled = true;
        //}
        //Save(); /*Have this somewhere else? Manual*/
        //Debug.Log("INCOMMENT SAVE!");
    }
    protected override void InitPanels()
    {
        base.InitPanels();

        #region Auto_Generated_Code_Placement_Init
        MenuPanel     = new MenuPanel(dataPanelDict["MenuPanel"], dataMenuPanel, PanelTypes.Main);
        ChildrenPanel = new ChildrenPanel(dataPanelDict["ChildrenPanel"], dataChildrenPanel, PanelTypes.Main);
        AddChildPanel = new AddChildPanel(dataPanelDict["AddChildPanel"], dataAddChildPanel, PanelTypes.Secondary);
        InfoPanel     = new InfoPanel(dataPanelDict["InfoPanel"], DataInfoPanel, PanelTypes.Secondary);

        Panel statsPanel    = new StatsPanel(dataPanelDict["StatsPanel"], dataStatsPanel, PanelTypes.Main);
        Panel levelsPanel   = new LevelsPanel(dataPanelDict["LevelsPanel"], dataSetLevelsPanel, PanelTypes.Main);
        Panel sectionsPanel = new SectionsPanel(dataPanelDict["SectionsPanel"], dataSectionsPanel, PanelTypes.Main);
        Panel missionsPanel = new MissionsPanel(dataPanelDict["MissionsPanel"], dataSetMissionsPanel, PanelTypes.Main);
        Panel settingsPanel = new SettingsPanel(dataPanelDict["SettingsPanel"], dataSettingsPanel, PanelTypes.Secondary);
        Panel exitPanel     = new ExitPanel(dataPanelDict["ExitPanel"], dataExitPanel, PanelTypes.Secondary);

        UiTransitionDict = new Dictionary <Panel, Dictionary <Panel, TransitionTypes> >
        {
            {
                MenuPanel,
                new Dictionary <Panel, TransitionTypes>
                {
                    { statsPanel, TransitionTypes.Hard },
                    { ChildrenPanel, TransitionTypes.Hard },
                    { sectionsPanel, TransitionTypes.Hard },
                    { exitPanel, TransitionTypes.Soft },
                    { settingsPanel, TransitionTypes.Soft }
                }
            },
            {
                statsPanel,
                new Dictionary <Panel, TransitionTypes>
                {
                    { MenuPanel, TransitionTypes.Hard },
                }
            },
            {
                ChildrenPanel,
                new Dictionary <Panel, TransitionTypes>
                {
                    { MenuPanel, TransitionTypes.Hard },
                    { AddChildPanel, TransitionTypes.Soft }
                }
            },
            {
                AddChildPanel,
                new Dictionary <Panel, TransitionTypes>
                {
                }
            },
            {
                settingsPanel,
                new Dictionary <Panel, TransitionTypes>
                {
                    { MenuPanel, TransitionTypes.Normal },
                }
            },
            {
                InfoPanel,
                new Dictionary <Panel, TransitionTypes>
                {
                    { missionsPanel, TransitionTypes.Normal },
                    { levelsPanel, TransitionTypes.Normal }
                }
            },
            {
                exitPanel,
                new Dictionary <Panel, TransitionTypes>
                {
                    { MenuPanel, TransitionTypes.Hard },
                }
            },
            {
                sectionsPanel,
                new Dictionary <Panel, TransitionTypes>
                {
                    { MenuPanel, TransitionTypes.Hard },
                    { missionsPanel, TransitionTypes.Hard }
                }
            },
            {
                missionsPanel,
                new Dictionary <Panel, TransitionTypes>
                {
                    { sectionsPanel, TransitionTypes.Hard },
                    { levelsPanel, TransitionTypes.Hard },
                    { InfoPanel, TransitionTypes.Soft }
                }
            },
            {
                levelsPanel,
                new Dictionary <Panel, TransitionTypes>
                {
                    { missionsPanel, TransitionTypes.Hard },
                    { InfoPanel, TransitionTypes.Soft }
                }
            },
        };

        #endregion
    }
    public void MakeLevelButton(Button btn, List <LevelsContainer> levelsContainers, List <SaveData> saves, string key = null)
    {
        LevelsPanel levelsPanel = InstantiateBtn(btn, key);

        levelsPanel.AddLevels(levelsContainers, saves);
    }
    public void MakeLevelButton(Button btn, LevelsContainer levelsContainer, string key = null)
    {
        LevelsPanel levelsPanel = InstantiateBtn(btn, key);

        levelsPanel.AddLevels(levelsContainer);
    }