Esempio n. 1
0
        private void OnClickNode(UIMouseEvent evt, UIElement listeningElement, NodeParent node)
        {
            if (node.GetActivate)
            {
                if (node.GetNodeType == NodeType.Class)
                {
                    node.ToggleEnable();

                    UpdateValue();
                    if (node.GetEnable == false)
                    {
                        Main.PlaySound(SoundID.MenuClose);
                    }
                    else
                    {
                        Main.PlaySound(SoundID.MenuOpen);
                    }
                    return;
                }
            }

            RPGPlayer rPGPlayer = Main.player[Main.myPlayer].GetModPlayer <RPGPlayer>();

            switch (node.CanUpgrade(rPGPlayer.GetSkillPoints, rPGPlayer.GetLevel()))
            {
            case Reason.CanUpgrade:
                rPGPlayer.SpentSkillPoints(node.GetCostPerLevel);
                node.Upgrade();
                UpdateToolTip(node);
                UpdateValue();
                Main.PlaySound(SoundID.MenuOpen);
                break;

            default:
                Main.PlaySound(SoundID.MenuClose);
                break;
            }
        }