ART
How do I use A R T
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
205 | timer1.Start(); | 1 |
12 | void Start() | 2 |
58 | public void Start() | 3 |
45 | this.StartChat(); | 4 |
83 | private void StartChat() | 5 |
13 | void Start() | 6 |
20 | void Start () { | 7 |
31 | void RestartGame() { | 8 |
15 | void Start () { | 9 |
32 | if (GUI.Button (new Rect (Screen.width / 2 - 60, 35, 120, 53), "RESTART")) { | 10 |
File name: frmThiThat.cs
Copy
190 private void frmThiThat_Load(object sender, EventArgs e)
191 {
192
193
194 lbNgaythang.Text = DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString();
195
196 {
197 try
198 {
199 if (DeThi == true)
200 Load_DeThiThat();
201 else
202 Load_DeThiThat();
203 TaoBangRandomCauTraLoi();
204 LoadCauHoiVaoControl();
205 timer1.Start();
206
207 btPre.Enabled = false;
208 }
209 catch (Exception ex)
210 { MessageBox.Show(ex.Message); }
211 }
212
213 }
File name: ChatGui.cs
Copy
58 public void Start()
59 {
60 DontDestroyOnLoad(this.gameObject);
61 Application.runInBackground = true; // this must run in background or it will drop connection if not focussed.
62
63 if (string.IsNullOrEmpty(this.UserName))
64 {
65 this.UserName = "user" + Environment.TickCount%99; //made-up username
66 }
67
68 chatClient = new ChatClient(this);
69 chatClient.Connect(ChatAppId, "1.0", this.UserName, null);
70
71 if (this.AlignBottom)
72 {
73 this.GuiRect.y = Screen.height - this.GuiRect.height;
74 }
75 if (this.FullScreen)
76 {
77 this.GuiRect.x = 0;
78 this.GuiRect.y = 0;
79 this.GuiRect.width = Screen.width;
80 this.GuiRect.height = Screen.height;
81 }
82
83 Debug.Log(this.UserName);
84 }
File name: NamePickGui.cs
Copy
38 public void OnGUI()
39 {
40 // Enter-Key handling:
41 if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.KeypadEnter || Event.current.keyCode == KeyCode.Return))
42 {
43 if (!string.IsNullOrEmpty(this.InputLine))
44 {
45 this.StartChat();
46 return;
47 }
48 }
49
50
51 GUI.skin.label.wordWrap = true;
52 GUILayout.BeginArea(guiCenteredRect);
53
54
55 if (this.chatComponent != null && string.IsNullOrEmpty(this.chatComponent.ChatAppId))
56 {
57 GUILayout.Label("To continue, configure your Chat AppId.\nIt's listed in the Chat Dashboard (online).\nStop play-mode and edit:\nScripts/ChatGUI in the Hierarchy.");
58 if (GUILayout.Button("Open Chat Dashboard"))
59 {
60 Application.OpenURL("https://www.exitgames.com/en/Chat/Dashboard");
61 }
62 GUILayout.EndArea();
63 return;
64 }
65
66 GUILayout.Label(this.helpText);
67
68 GUILayout.BeginHorizontal();
69 GUI.SetNextControlName("NameInput");
70 this.InputLine = GUILayout.TextField(this.InputLine);
71 if (GUILayout.Button("Connect", GUILayout.ExpandWidth(false)))
72 {
73 this.StartChat();
74 }
75 GUILayout.EndHorizontal();
76
77 GUILayout.EndArea();
78
79
80 GUI.FocusControl("NameInput");
81 }
File name: NamePickGui.cs
Copy
83 private void StartChat()
84 {
85 this.chatComponent.UserName = this.InputLine;
86 this.chatComponent.enabled = true;
87 this.enabled = false;
88
89 PlayerPrefs.SetString(NamePickGui.UserNamePlayerPref, this.InputLine);
90 }
File name: GUICustomAuth.cs
Copy
13 void Start()
14 {
15 GuiRect = new Rect(Screen.width / 4, 80, Screen.width / 2, Screen.height - 100);
16 }
File name: BallControl.cs
Copy
20 void Start () {
21 rb2d = GetComponent
22 Invoke ("GoBall", 2);
23 }
File name: BallControl.cs
Copy
31 void RestartGame() {
32 ResetBall ();
33 Invoke ("GoBall", 1);
34 }
File name: GameManager.cs
Copy
15 void Start () {
16 theBall = GameObject.FindGameObjectWithTag ("Ball");
17 }
File name: GameManager.cs
Copy
27 void OnGUI() {
28 GUI.skin = layout;
29 GUI.Label (new Rect (Screen.width / 2 - 150 - 12, 20, 100, 100), "" + PlayerScore1);
30 GUI.Label (new Rect (Screen.width / 2 + 150 + 12, 20, 100, 100), "" + PlayerScore2);
31
32 if (GUI.Button (new Rect (Screen.width / 2 - 60, 35, 120, 53), "RESTART")) {
33 PlayerScore1 = 0;
34 PlayerScore2 = 0;
35 theBall.SendMessage ("RestartGame", 0.5f, SendMessageOptions.RequireReceiver);
36 }
37
38 if (PlayerScore1 == 10) {
39 GUI.Label (new Rect (Screen.width / 2 - 150, 200, 2000, 1000), "PLAYER ONE WINS");
40 theBall.SendMessage ("ResetBall", null, SendMessageOptions.RequireReceiver);
41 } else if (PlayerScore2 == 10) {
42 GUI.Label (new Rect (Screen.width / 2 - 150, 200, 2000, 1000), "PLAYER TWO WINS");
43 theBall.SendMessage ("ResetBall", null, SendMessageOptions.RequireReceiver);
44 }
45 }
Download file with original file name:ART
ART 110 lượt xem
Gõ tìm kiếm nhanh...