2019_12_18 UI:(2)
Unity/실습 2019. 12. 18. 18:57
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Newtonsoft.Json;
public class TestApp : MonoBehaviour
{
public Button btn1;
public Button btn2;
public Image image;
public TestUISelectedInfo testinfo;
public Inventory inventory;
void Start()
{
Dictionary<int,ItemInfo> dicInfoData = new Dictionary<int,ItemInfo>();
foreach(var data in json)
{
}
btn1.onClick.AddListener(() => {
image.gameObject.SetActive(true);
UserInfo info = new UserInfo("리룡린", 3, 5, 100);
});
btn2.onClick.AddListener(() =>
{
image.gameObject.SetActive(false);
});
}
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using UnityEngine.UI;
public class TestUISelectedInfo : MonoBehaviour
{
// Start is called before the first frame update
public Text text1;
public Text text2;
public Text text3;
public Text text4;
void Start()
{
}
public void InIt(UserInfo info)
{
text1.text = info.username;
}
}
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
public class UserInfo
{
public string username;
public int level;
public int attack;
public int hp;
public UserInfo(string name,int level,int attack,int hp)
{
this.username = name;
this.level = level;
this.attack = attack;
this.hp = hp;
}
void Start()
{
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|
'Unity > 실습' 카테고리의 다른 글
2019_12_18 UI (0) | 2019.12.18 |
---|---|
2019-11-13 Unity 버튼을 눌러 캐릭터 생성/메서드 (0) | 2019.11.13 |
2019-11-07 Unity (0) | 2019.11.07 |