BigAL Geschrieben 15. November 2016 Melden Share Geschrieben 15. November 2016 Hallo zusammen, ich bin neu bei Unity und schau mir gerade die Tutserie von Make an RPG von"HardlyBriefDan" an, leider stammt ein großer Teil der Reihe aus einer Zeit als es die neue GUI noch nicht gab. Kann man den Code in eine Tooglegroup unterbingen oder müsste ich dieses Scipt quasi nochmals irgendwie aufteilen ? using UnityEngine; using System.Collections; using UnityEngine.UI; using System.Collections.Generic; public class DisplayPlayerGUI { private StatAllocation statAllocation = new StatAllocation(); private int classSelection; private string[] classSelectionName = new string[] { "Mage", "Warrior", "Archer", "Rouge", "Warlock", "Paladin" }; public void DisplayClassSelection() { //Choose Your Class classSelection = GUI.SelectionGrid(new Rect(150f,150f,150f,200f), classSelection, classSelectionName, 1); GUI.Label(new Rect(450, 175, 300, 300), FindClassDescription(classSelection)); GUI.Label(new Rect(450,275,300,300), FindClassStatValue(classSelection)); } private string FindClassDescription(int classSelection) { //Shows Description of choosen Class if(classSelection == 0) { BaseCharacterClass tempClass = new BaseMageClass(); return tempClass.CharacterClassDescription; } else if(classSelection == 1) { BaseCharacterClass tempClass = new BaseWarriorClass(); return tempClass.CharacterClassDescription; } return "Sorry,No Description Found"; } private string FindClassStatValue(int classSelection) { //Show Stats from Choosen Class if(classSelection == 0) { BaseCharacterClass tempClass = new BaseMageClass(); string tempStats = "Stamina " + tempClass.Stamina + "\n" + "Strength " + tempClass.Strength + "\n" + "Intellect " + tempClass.Intellect + "\n" + "Endurance" + tempClass.Endurance; return tempStats; } else if(classSelection == 1) { BaseCharacterClass tempClass = new BaseWarriorClass(); string tempStats = "Stamina " + tempClass.Stamina + "\n" + "Strength " + tempClass.Strength + "\n" + "Intellect " + tempClass.Intellect + "\n" + "Endurance" + tempClass.Endurance; return tempStats; } return "Sorry, No Stats Found"; } public void DisplayStatAllocation() { statAllocation.DisplayStatAllocation(); } public void DisplayFinalSetup() { } public void DisplayMains() { // Rotatefunction for Showmodel Transform player = GameObject.FindGameObjectWithTag("Player").transform; GUI.Label(new Rect(Screen.width / 2, 125, 250, 100), "Create New Player"); if (GUI.Button(new Rect(725,450,50,50), "<<<<")) { player.Rotate(Vector3.up *25); } if (GUI.Button(new Rect(875,450,50,50), ">>>>")) { player.Rotate(Vector3.down *25); } } } vielen Dank für Eure Hilfe Zitieren Link zu diesem Kommentar Auf anderen Seiten teilen More sharing options...
Sascha Geschrieben 17. November 2016 Melden Share Geschrieben 17. November 2016 Egal, wie viel Arbeit für dich darin stecken sollte, das neue GUI-System zu erlernen und zu verwenden, es wird immer noch ein Bruchteil der Probleme sein, die du mit OnGUI hast. Wenn ein Tutorial ohne OnGUI nicht klarkommt, gut gemeinter Rat: Nimm ein anderes. 1 Zitieren Link zu diesem Kommentar Auf anderen Seiten teilen More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.