C#/실습 10.14 클오클 클랜원 UIPanel 만들기 미고렝 2019. 10. 14. 15:32 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _10._14_Clan { class Program { static void Main(string[] args) { new App(); } } } using System; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _10._14_Clan { class App { public App() { UserData user1 = new UserData("홍길동", 200, 4500); UserData user2 = new UserData("김건모", 212, 4700); UserData user3 = new UserData("asb123", 190, 3500); UIPanel uiPanel1 = new UIPanel(new TextField(user1,2), new Sprite("C:/workspace/unity/study01/tier.png"), new Sprite("trophyImg"), new Sprite("panelImg")); UIPanel uiPanel2 = new UIPanel(new TextField(user2,1), new Sprite("C:/workspace/unity/study01/tier.png"), new Sprite("trophyImg"), new Sprite("panelImg")); UIPanel uiPanel3 = new UIPanel(new TextField(user3, 3), new Sprite("C:/workspace/unity/study01/tier.png"), new Sprite("trophyImg"), new Sprite("panelImg")); uiPanel1.ShowUIPanelImg(); uiPanel1.ShowUIPanelText(); uiPanel2.ShowUIPanelImg(); uiPanel2.ShowUIPanelText(); uiPanel3.ShowUIPanelImg(); uiPanel3.ShowUIPanelText(); } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _10._14_Clan { class TextField { public UserData userData; public int Ranking; public TextField(UserData userData, int ranking) { this.userData = userData; this.Ranking = ranking; } } } using System; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _10._14_Clan { class UIPanel { TextField textField; Sprite spritePanelImg; Sprite spriteTier; Sprite spriteTrophy; public UIPanel(TextField textField, Sprite tier, Sprite trophy , Sprite PanelImg) { this.textField = textField; this.spritePanelImg = PanelImg; this.spriteTier = tier; this.spriteTrophy = trophy; } public void ShowUIPanelImg() { Console.WriteLine(spritePanelImg.imgPath + "경로의 이미지를 로드해 보여줍니다."); Console.WriteLine(spriteTier.imgPath + "경로의 이미지를 로드해 보여줍니다."); Console.WriteLine(spriteTrophy.imgPath + "경로의 이미지를 로드해 보여줍니다."); } public void ShowUIPanelText() { Console.WriteLine(textField.userData.name); Console.WriteLine(textField.userData.level); Console.WriteLine(textField.userData.trophy); Console.WriteLine(textField.Ranking); } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _10._14_Clan { class UserData { public string name; public int level; public int trophy; public UserData(string name, int level, int trophy) { this.name = name; this.level = level; this.trophy = trophy; } } } using System; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _10._14_Clan { class Sprite { public string imgPath; public Sprite(string path) { this.imgPath = path; } } }