示例#1
0
    // ================================================================================================== //
    private void onBeforeWindowLoaded()
    {
        if (!WindowManager.Instance.IsCurrentWindow(Consts.WindowNames.OPEN_BOOK))
        {
            return;
        }

        // go to adventure button
        _goToAdventureButton.gameObject.SetActive(Party.Instance.IsInVillage);

        // back button
        _backButton.Type = Party.Instance.IsInVillage ? BackButton.BackButtonType.BACK_TO_PREVIOUS : BackButton.BackButtonType.BACK_TO_HOME;

        // update pages grid
        List <int> pages = Library.Instance.GetPagesOfBook(DungeonName);

        _pagesGrid.Rebuild(pages.Count);
        for (int i = 0; i < _pagesGrid.Elements.Count; ++i)
        {
            GridElement pageGridElement = _pagesGrid.Elements[i];
            pageGridElement.GetComponent <BookPage>().PageNumber = pages[i];
        }

        // show first page
        DisplayPage(pages[0]);
    }
示例#2
0
    // =========================================================================================== //
    private void displaySkills()
    {
        // create the stats to display list, show only the skills with more than 0
        List <Stat> statsToDisplay = new List <Stat>();

        foreach (Stat stat in University.Instance.Skills)
        {
            int playerLevelInCurrentStat = Party.Instance.SelectedMember.Stats[stat];
            if (playerLevelInCurrentStat <= 0)
            {
                continue;
            }
            statsToDisplay.Add(stat);
        }

        // rebuild skills grid
        _grid.Rebuild(statsToDisplay.Count);

        // display skills
        for (int i = 0; i < statsToDisplay.Count; ++i)
        {
            Stat stat = statsToDisplay[i];
            _grid.GetElement(i).GetComponent <SkillButton>().Stat = stat;

            // disable clicking
            _grid.GetElement(i).GetComponent <SkillButton>().IsActive = false;
        }
    }
示例#3
0
    // =========================================================================================== //
    private void displaySkills()
    {
        // rebuild skills grid
        _grid.Rebuild(_skills.Count);

        // display skills
        for (int i = 0; i < _skills.Count; ++i)
        {
            Stat stat = _skills[i];
            _grid.GetElement(i).GetComponent <SkillButton>().Stat = stat;
        }
    }
示例#4
0
    // ================================================================================================== //
    public void BuildLibrary()
    {
        // rebuild the books grid to match the number of dungeons
        int numberOfDungeons = SaveAndLoad.Instance.PlayerSaveData.Dungeons.Count;

        _grid.Rebuild(numberOfDungeons);

        // set dungeon for each book
        for (int i = 0; i < numberOfDungeons; ++i)
        {
            string dungeonName = SaveAndLoad.Instance.PlayerSaveData.Dungeons[i].Name;
            Debug.Log(dungeonName + " Loaded to book...");
            _grid.GetElement(i).GetComponent <LibraryBook>().DungeonName = dungeonName;

            // init _bookAndItsPages dictionary page list for the current dungeon
            _bookAndItsPages[dungeonName] = new List <int>();
            // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            // TODO: delete those init test pages in book...
            if (dungeonName == "a")
            {
                _bookAndItsPages[dungeonName].Add(1);
                _bookAndItsPages[dungeonName].Add(3);
                _bookAndItsPages[dungeonName].Add(7);
            }
            else if (dungeonName == "b")
            {
                _bookAndItsPages[dungeonName].Add(1);
                _bookAndItsPages[dungeonName].Add(3);
                _bookAndItsPages[dungeonName].Add(7);
                _bookAndItsPages[dungeonName].Add(12);
                _bookAndItsPages[dungeonName].Add(13);
                _bookAndItsPages[dungeonName].Add(16);
                _bookAndItsPages[dungeonName].Add(19);
            }
            // @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
        }
    }