Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- c#코딩기초트레이닝
- 시샵문법
- 유니티공부
- unity게임
- unity게임만들기
- 유니티3dui
- unity3d
- c#코테
- c#
- Unity
- c# c#프로그래머스
- c# 백준
- C#문법
- 오블완
- c#기본문법
- c#프로그래머스기초문법
- 스파르타
- unity공부
- 유니티서바이벌게임만들기
- C++문법
- 유니티상호작용
- c#기초문법
- unity3dservival
- 유니티
- c#문제
- 스파르타코딩클럽
- 시샵
- 티스토리챌린지
- unity3d게임만들기
- 유니티게임만들기
Archives
- Today
- Total
나 개발자 진짜 되냐?
[ 12月 9日 ] 오늘 내가 배운 것 _ 60日次 본문
반응형
오늘은..
심신미약이 이어져서
공부를 제대로 하지 못했다.
심지어 내일까지 데이터를 마무리하라는
미션을 받았다
...
너무너무너무너무
걱정된다.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class DataBase<T>
{
//public int index;
public abstract void SetData(T metaData);
}
public abstract class DataBaseList<T1, T2, T3>
{
public Dictionary<T1, T2> datas = new Dictionary<T1, T2>();
public abstract void SetData(List<T3> metaDataList);
public T2 LoadData(T1 key)
{
if (!datas.ContainsKey(key)) return default; // 널과 같움
return datas[key];
}
}
[System.Serializable]
public class ItemData : DataBase<MetaItemData>
{
public int index;
public string name;
public string id;
public string KOR_Name;
public Status status;
public override void SetData(MetaItemData metaItemData)
{
this.index = metaItemData.index;
this.id = metaItemData.id;
this.name = metaItemData.name;
this.KOR_Name = metaItemData.kor_Name;
this.status = new Status(metaItemData.attack, metaItemData.defense);
/// <summary>
/// 힘, 크리티컬 제외
/// </summary>
//this.status = new Status(metaItemData.attack, metaItemData.defense, metaItemData.str, metaItemData.crt);
}
}
[System.Serializable]
public class ItemDataList : DataBaseList<string, ItemData, MetaItemData> // key, 리스트 안에 들어가있는 데이터, 어떤 데이터를 가져올건지
{
public override void SetData(List<MetaItemData> metaItemDatas)
{
datas = new Dictionary<string, ItemData>(metaItemDatas.Count);
metaItemDatas.ForEach(obj =>
{
ItemData item = new ItemData();
item.SetData(obj);
datas.Add(item.id, item);
});
}
}
[System.Serializable]
public struct Status
{
public int attack;
public int defense;
/// <summary>
/// 힘, 크리티컬 제외
/// </summary>
//public int str;
//public int crt;
public Status(int atk, int def)//(int atk, int def, int str, int crt)
{
this.attack = atk;
this.defense = def;
/// <summary>
/// 힘, 크리티컬 제외
/// </summary>
//this.str = str;
//this.crt = crt;
}
}
데이터베이스를 만들어주었다.
이유는 가공을 위해
그 친구들을 상속받아
만들어준다.
일단, 내일
만져보면서 조금씩 고쳐봐야겠다.
이게 다냐구요?
네.
반응형
'오늘 공부를 정리해봐요!' 카테고리의 다른 글
[ 12月 11日 ] 오늘 내가 배운 것 _ 62日次 _ 램을 바꾸는건 세상에서 가장 힘든 일 (2) | 2024.12.11 |
---|---|
[ 12月 10日 ] 오늘 내가 배운 것 _ 61日次 (4) | 2024.12.10 |
[ 12月 6日 ] 오늘 내가 배운 것 _ 59日次 (2) | 2024.12.06 |
[ 12月 5日 ] 오늘 내가 배운 것 _ 58日次 (2) | 2024.12.05 |
[ 12月 4日 ] 오늘 내가 배운 것 _ 57日次 (3) | 2024.12.04 |