// Grab references to both the Object and Static databases void Start() { // Since our database exists within an object in the scene, we'll need to find it. // Alternatively you could expose the database as a public member, and use the // inspector to set it. GameObject statsdbobj = GameObject.Find("databaseObj"); if (statsdbobj != null) { // Get the CharacterStats component out of the GameObject. // CharacterStats is the name of the worksheet in the google spreadsheet // that we are getting the monster information from _statsDb = statsdbobj.GetComponent <CharacterStatsSample>(); } // The Items database is a Static class. Use it by grabbing the .Instance, this will // ensure the database is correctly initialized. Larger databases may take a while // to initialize, so grabbing an instance before the game is updating is recommended. _itemsDb = ItemsSample.Instance; }
public override void OnInspectorGUI() { CharacterStatsSample s = target as CharacterStatsSample; CharacterStatsSampleRow r = s.Rows[Index]; EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("<<")) { Index = 0; } if (GUILayout.Button("<")) { Index -= 1; if (Index < 0) { Index = s.Rows.Count - 1; } } if (GUILayout.Button(">")) { Index += 1; if (Index >= s.Rows.Count) { Index = 0; } } if (GUILayout.Button(">>")) { Index = s.Rows.Count - 1; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("ID", GUILayout.Width(150.0f)); { EditorGUILayout.LabelField(s.rowNames[Index]); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("NAME", GUILayout.Width(150.0f)); { EditorGUILayout.TextField(r._NAME); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("LEVEL", GUILayout.Width(150.0f)); { EditorGUILayout.IntField(r._LEVEL); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("BASEMODIFIER", GUILayout.Width(150.0f)); { EditorGUILayout.FloatField((float)r._BASEMODIFIER); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("ARCHETYPE", GUILayout.Width(150.0f)); { EditorGUILayout.TextField(r._ARCHETYPE); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("STRENGTH", GUILayout.Width(150.0f)); { EditorGUILayout.IntField(r._STRENGTH); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("ENDURANCE", GUILayout.Width(150.0f)); { EditorGUILayout.IntField(r._ENDURANCE); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("INTELLIGENCE", GUILayout.Width(150.0f)); { EditorGUILayout.IntField(r._INTELLIGENCE); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("DEXTERITY", GUILayout.Width(150.0f)); { EditorGUILayout.IntField(r._DEXTERITY); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("HEALTH", GUILayout.Width(150.0f)); { EditorGUILayout.IntField(r._HEALTH); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("MANA", GUILayout.Width(150.0f)); { EditorGUILayout.IntField(r._MANA); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("SPEED", GUILayout.Width(150.0f)); { EditorGUILayout.IntField(r._SPEED); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("UNLOCKED", GUILayout.Width(150.0f)); { EditorGUILayout.Toggle(System.Convert.ToBoolean(r._UNLOCKED)); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); GUILayout.Label("STARS", GUILayout.Width(150.0f)); { EditorGUILayout.TextField(System.Convert.ToString(r._STARS)); } EditorGUILayout.EndHorizontal(); }
// Grab references to both the Object and Static databases void Start() { // Since our database exists within an object in the scene, we'll need to find it. // Alternatively you could expose the database as a public member, and use the // inspector to set it. GameObject statsdbobj = GameObject.Find("databaseObj"); if ( statsdbobj != null ) { // Get the CharacterStats component out of the GameObject. // CharacterStats is the name of the worksheet in the google spreadsheet // that we are getting the monster information from _statsDb = statsdbobj.GetComponent<CharacterStatsSample>(); } // The Items database is a Static class. Use it by grabbing the .Instance, this will // ensure the database is correctly initialized. Larger databases may take a while // to initialize, so grabbing an instance before the game is updating is recommended. _itemsDb = ItemsSample.Instance; }