Skip to content

Commit 1768e93

Browse files
authored
Chapter 19 Assets Upload
1 parent 8ca29bd commit 1768e93

File tree

9 files changed

+88
-0
lines changed

9 files changed

+88
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is a line the character says.
2+
The character also says this.
3+
And they say this, too!
3.34 KB
Binary file not shown.
36.3 KB
Binary file not shown.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public class Chapter19Buttons : MonoBehaviour {
6+
public Texture2D buttonTexture;
7+
8+
private void OnGUI() {
9+
if (GUI.Button(new Rect(10, 10, 100, 50), "Text Button")) {
10+
Debug.Log("Text Button Clicked");
11+
}
12+
13+
if (GUI.Button(new Rect(10, 80, 50, 50), buttonTexture)) {
14+
Debug.Log("Image Button Clicked");
15+
}
16+
}
17+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Collections;
3+
using System.Collections.Generic;
4+
using UnityEngine;
5+
6+
public class Chapter19Labels : MonoBehaviour {
7+
public Texture2D labelTexture;
8+
9+
private void OnGUI() {
10+
GUI.Label(new Rect(10, 10, 100, 50), "Text Label");
11+
GUI.Label(new Rect(10, 80, 50, 50), labelTexture);
12+
}
13+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public class Chapter19TextFieldAndArea : MonoBehaviour {
6+
private string textFieldText = "Enter text";
7+
private string textAreaText = "Enter text";
8+
private void OnGUI() {
9+
textFieldText = GUI.TextField(new Rect(10, 10, 100, 50), textFieldText);
10+
textAreaText = GUI.TextArea(new Rect(10, 80, 100, 100), textAreaText);
11+
}
12+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public class Chapter19Toggle : MonoBehaviour {
6+
private bool toggleBool = true;
7+
private void OnGUI() {
8+
toggleBool = GUI.Toggle(new Rect(10, 10, 100, 50), toggleBool,"Toggle Me");
9+
}
10+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Collections;
3+
using System.Collections.Generic;
4+
using UnityEngine;
5+
6+
public class DebugFrameRate : MonoBehaviour {
7+
int fps;
8+
private string fpsString;
9+
[SerializeField] int fpsThreshold;
10+
private void OnGUI() {
11+
if (fps < fpsThreshold) {
12+
GUI.contentColor = Color.red;
13+
}
14+
else {
15+
GUI.contentColor = Color.white;
16+
}
17+
18+
GUI.Label(new Rect(10, 10, 100, 50), "fps = " + fps.ToString());
19+
}
20+
21+
private void Update() {
22+
fps = (int)(1f / Time.unscaledDeltaTime);
23+
}
24+
}

Chapter 19/Scripts/DialogueData.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
[CreateAssetMenu(fileName = "New SO", menuName = "DialogueData", order = 1)]
6+
public class DialogueData : ScriptableObject {
7+
public string textPath;
8+
public List<string> importedDialogue;
9+
}

0 commit comments

Comments
 (0)