protected override void InitRankSelection()
        {
            SetTopText("Select the spell Rank");
            DnDCharacter character = (DnDCharacter)AppStorage.Instance.CurrentCharacter;

            if (mSelectedClass > character.Classes.Count)
            {
                return;
            }
            DnDClassSoul soul = character.Classes[mSelectedClass];

            GameObject buttonPref   = Resources.Load(cSimplePrefab) as GameObject;
            int        buttonHeight = (int)buttonPref.GetComponent <LayoutElement>().minHeight;
            int        spacing      = (int)DragArea.transform.FindChild("ScrollArea").GetComponent <VerticalLayoutGroup>().spacing;

            buttonHeight += spacing;
            for (int i = 0; i < soul.KnownSpells.Count; ++i)
            {
                GameObject button = GameObject.Instantiate(buttonPref) as GameObject;
                button.transform.SetParent(DragArea.transform.FindChild("ScrollArea"));
                ViewUtility.ChangeSimpleButtonText("rank  " + i, button);
                button.GetComponent <IntButtonHandler>().NotificationInt     = i;
                button.GetComponent <IntButtonHandler>().NotificationCatcher = this;
                mTotalHeight += buttonHeight;
                ViewUtility.EnableSimpleButton(button, soul.KnownSpells[i].Count > 0);
                mButtonList.Add(button);
            }
            if (mViewHeight < mTotalHeight)
            {
                mTotalHeight -= spacing;
            }
            UpdateNow = true;
        }
        private string GetExtraTopText()
        {
            DnDCharacter character = (DnDCharacter)AppStorage.Instance.CurrentCharacter;

            if (character.Classes.Count < mSelectedClass)
            {
                return("");
            }
            DnDClassSoul soul = character.Classes[mSelectedClass];

            if (soul.KnownSpells.Count < mSelectedRank)
            {
                return("");
            }

            string result = "p / u";

            if (soul.CanCastExtraSpell)
            {
                result += " / +";
            }
            int prepared = soul.NumberOfPreparedMainSpells(mSelectedRank);
            int unused   = soul.SpellsPerDay()[mSelectedRank] - prepared;

            result += "\n" + prepared + "  /  " + unused;
            if (soul.CanCastExtraSpell)
            {
                int extra = soul.NumberOfPreparedExtraSpells(mSelectedRank);
                result += "  /  " + extra;
            }
            return(result);
        }
        public override void Next()
        {
            DnDCharacter character = (DnDCharacter)AppStorage.Instance.CurrentCharacter;

            if (character.Classes.Count < mSelectedClass)
            {
                return;
            }
            DnDClassSoul soul = character.Classes[mSelectedClass];

            if (soul.KnownSpells.Count < mSelectedRank)
            {
                return;
            }
            List <Spell> rank = soul.KnownSpells[mSelectedRank];

            if (rank.Count < mSelectedSpell)
            {
                return;
            }
            Spell spell = rank[mSelectedSpell];

            if (mSelectedSpellSender == cRegularSpell)
            {
                soul.PrepareMainSpell(spell, mSelectedRank);
            }
            else if (mSelectedSpellSender == cExtraSpell)
            {
                soul.PrepareExtraSpell(spell, mSelectedRank);
            }
        }
        protected override void InitSpellSelection()
        {
            SetTopText("Prepare spells", GetExtraTopText());
            DnDCharacter character = (DnDCharacter)AppStorage.Instance.CurrentCharacter;

            if (character.Classes.Count < mSelectedClass)
            {
                return;
            }
            DnDClassSoul soul = character.Classes[mSelectedClass];

            if (soul.KnownSpells.Count < mSelectedRank)
            {
                return;
            }

            mCurrentSpells = soul.KnownSpells[mSelectedRank];
            mCurrentSpells.Sort();
            if (soul.CanCastExtraSpell)
            {             // double buttons
                InitDualButtons();
            }
            else
            {             // single buttons
                InitSimpleButtons();
            }
        }
        protected override void InitSpellSelection()
        {
            DnDCharacter character = (DnDCharacter)AppStorage.Instance.CurrentCharacter;

            if (character.Classes.Count < mSelectedClass)
            {
                return;
            }
            mSoul = character.Classes[mSelectedClass];

            if (mSoul.NeedsToPrepareSpells)
            {
                SetTopText("Cast spells", "");
                InitPreparedSpells();
            }
            else
            {
                SetTopText("Cast spells", GetExtraTopText());
                InitKnownSpells();
            }
            int spacing = (int)DragArea.transform.FindChild("ScrollArea").GetComponent <VerticalLayoutGroup>().spacing;

            if (mViewHeight < mTotalHeight)
            {
                mTotalHeight -= spacing;
            }
        }
        public override void Next()
        {
            int level = 1;

            if (!string.IsNullOrEmpty(LevelInput.text))
            {
                level = int.Parse(LevelInput.text);
            }
            DnDCharClass chosen     = (DnDCharClass)((int)ClassSlider.value);
            DnDClassSoul soul       = null;
            int          nextScreen = -1;

            switch (chosen)
            {
            case DnDCharClass.Wizard:
                soul       = new DnDWizard((DnDCharacter)Storage.Character, level);
                nextScreen = cWizardScreen;
                break;

            default:
                break;
            }
            if (soul != null)
            {
                ((DnDCharacter)Storage.Character).Classes.Add(soul);
            }
            if (nextScreen >= 0)
            {
                Storage.Screens[nextScreen].SetActive(true);
                this.gameObject.SetActive(false);
            }
            else
            {
                SwitchScene(ScreenBase.SCENE_SPELLMASTERY);
            }
        }