스킨 목록을 출력하고
선택한 스킨을 따로 상세하게 출력하기
엑셀 테이블
1)
2)
3)
1. App class
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Study_19
{
class App
{
public App()
{
//데이터 매니저 생성
DataManager datamanager = DataManager.GetInstance();
//데이터 불러오기
datamanager.LoadData();
//출력하기
this.PrintProduct();
this.SelectProduct(1002);
}
public void PrintProduct()
{
List<ProductData> list = DataManager.GetInstance().GetProductData();
{
Console.WriteLine("-----------------------------------------------------------");
BudgetData budgetData = DataManager.GetInstance().GetBudgetDataByType(list[i].budget_type);
string name = list[i].name + list[i].name_string;
DateTime productTime = Convert.ToDateTime(list[i].time);
DateTime now = DateTime.Now;
TimeSpan leftTime = productTime - now;
Console.WriteLine(name);
Console.WriteLine(list[i].icon);
if (list[i].price == 0)
{
Console.WriteLine("곧 공개!");
}
else
{
}
}
}
public void SelectProduct(int id)
{
this.ShowPopUp(id);
return;
}
public void ShowPopUp(int id)
{
Console.WriteLine("-----------------------------------------------------------");
Console.WriteLine("**********구매 확인**********");
ProductData productData = DataManager.GetInstance().GetProductDataById(id);
BudgetData budgetData = DataManager.GetInstance().GetBudgetDataByType(productData.budget_type);
List<SkinDescData> skinData = DataManager.GetInstance().GetSkinDescDataByType(productData);
DateTime productTime = Convert.ToDateTime(productData.time);
DateTime now = DateTime.Now;
TimeSpan leftTime = productTime - now;
Console.WriteLine(name);
Console.WriteLine(productData.desc_string);
if (productData.open_type)
{
{
Console.WriteLine(skinData[i].desc);
}
}
else
{
Console.WriteLine("곧 출시 됩니다.");
}
Console.WriteLine("[체험]");
}
}
}
|
2. DataManager class
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
namespace Study_19
{
class DataManager
{
private static DataManager instance;
private Dictionary<int, ProductData> dicProductDatas;
private Dictionary<int, BudgetData> dicBudgetDatas;
private Dictionary<int, SkinDescData> dicSkinDescDatas;
private DataManager()
{
this.dicProductDatas = new Dictionary<int, ProductData>();
this.dicBudgetDatas = new Dictionary<int, BudgetData>();
this.dicSkinDescDatas = new Dictionary<int, SkinDescData>();
}
public static DataManager GetInstance()
{
if(DataManager.instance==null)
{
DataManager.instance = new DataManager();
return DataManager.instance;
}
return DataManager.instance;
}
public void LoadData()
{
this.dicProductDatas = JsonConvert.DeserializeObject<ProductData[]>(productJson).ToDictionary(x => x.id, x => x);
this.dicBudgetDatas = JsonConvert.DeserializeObject<BudgetData[]>(budgetJosn).ToDictionary(x => x.id, x => x);
this.dicSkinDescDatas = JsonConvert.DeserializeObject<SkinDescData[]>(skindescJson).ToDictionary(x => x.id, x => x);
}
public ProductData GetProductDataById(int id)
{
return this.dicProductDatas[id];
}
public BudgetData GetBudgetDataByType(int type)
{
BudgetData data = null;
foreach(var pair in this.dicBudgetDatas)
{
{
data = pair.Value;
}
}
return data;
}
public List<SkinDescData> GetSkinDescDataByType(ProductData data)
{
List<SkinDescData> list = new List<SkinDescData>();
foreach(var pair in this.dicSkinDescDatas)
{
{
}
{
}
{
}
{
}
{
}
}
return list;
}
public List<ProductData> GetProductData()
{
List<ProductData> list = new List<ProductData>();
foreach(var pair in this.dicProductDatas)
{
}
return list;
}
}
}
|
3. SkinDescData class
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Study_19
{
class SkinDescData
{
public int id;
public string desc;
}
}
|
4. BudgetData class
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Study_19
{
class BudgetData
{
public int id;
public int type;
public string name;
public string icon;
}
}
|
5. ProductData class
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Study_19
{
class ProductData
{
public int id;
public string name;
public string name_string;
public string desc_string;
public int desc_type1;
public int desc_type2;
public int desc_type3;
public int desc_type4;
public int desc_type5;
public string icon;
public int budget_type;
public int price;
public string time;
public bool open_type;
}
}
|
6. 결과 값
1)출시된 캐릭터
2) 미출시 캐릭터
'C# > 수업내용' 카테고리의 다른 글
2020.05.01. 수업내용 - 2차원 배열(캐릭터 이동하기) (0) | 2020.05.01 |
---|---|
2020.04.29. 수업내용 - 일일 출석 보상(+연속 출석 보상) (0) | 2020.04.30 |
2020.04.28. 수업내용 - 상점페이지 (시간) (0) | 2020.04.29 |
2020.04.26. 승급하기 연습 (메이플 스토리) (0) | 2020.04.26 |
2020.04.24. 수업내용 - 승급하기(바람의 나라) (0) | 2020.04.25 |