¡¡¥²¡¼¥àÆâ¤Î¥Ç¡¼¥¿¤òÊÝ»ý¤¹¤ë¥¯¥é¥¹¤Ç¤¹¡£
¥×¥ì¥¤¥ä¡¼¤Î¾ðÊó¤äŨ¤Î¾ðÊó¡¢¥¹¥Æ¡¼¥¸¤Î¾ðÊó¤Ê¤É¤ò´ÉÍý¤¹¤ë¤¿¤á¤Î¥¯¥é¥¹¤òºîÀ®¤·¡¢°ì¸µ´ÉÍý¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
¡¡
¡¡¤³¤Î¥¯¥é¥¹¤Ï¿¤¯¤Î¥¯¥é¥¹¤«¤é»²¾È¤µ¤ì¤ë¤³¤È¤¬Â¿¤¯¤Ê¤ëÁ°Äó¤Ç¤¹¤Î¤Ç¡¢¥·¥ó¥°¥ë¥È¥ó¡¦¥Ç¥¶¥¤¥ó¥Ñ¥¿¡¼¥ó¤òÍøÍѤ·¤¿À߷פò¹Ô¤¤¤Þ¤¹¡£
¡¡Æä˥·¥ó¥°¥ë¥È¥ó¥¯¥é¥¹¤Î¾ì¹ç¡¢¥·¡¼¥óÁ«°Ü»þ¤Ë¤âÇË´þ¤µ¤ì¤Ê¤¤¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤È¤¹¤ë¤³¤È¤Ç
¤É¤Î¥¯¥é¥¹¤«¤é¤Ç¤âÊÑ¿ô¤ä¥á¥½¥Ã¥É¤Ë¥¢¥¯¥»¥¹¤Ç¤¡¢¥·¡¼¥óÁ«°Ü¸å¤âÍøÍѤ¹¤ë¤³¤È¤¬¤Ç¤¤ë¥¯¥é¥¹¤È¤·¤ÆÀ®Î©¤·¤Þ¤¹¡£
GameData.cs
<= ¥¯¥ê¥Ã¥¯¤¹¤ë¤È³«¤¤Þ¤¹¡£
using UnityEngine;
using UniRx;
using System.Collections.Generic;
using System.Linq;
[System.Serializable] // ¥·¥ê¥¢¥é¥¤¥º²Äǽ¤Ê¾õÂ֤ˤ·¤Æ¤ª¤¯¤³¤È¤Ç¡¢¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Ëɽ¼¨¤µ¤ì¤ë¤È¤È¤â¤Ë¥»¡¼¥Ö¡¦¥í¡¼¥É¤¬²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£
public class GameData // MonoBehaviour ¥¯¥é¥¹¤Î·Ñ¾µ¤òºï½ü¤·¤Þ¤¹
private Character player;
private Character opponent;
////** GameData ·¿¤Î instance ÊÑ¿ô¤È¡¢Awake ¥á¥½¥Ã¥É¤òºï½ü¤·¤Þ¤¹¡¡**////
////** ¿·¤·¤¤ÊÑ¿ô¤òÄɲä·¤Þ¤¹¡¡**////
public Dictionary<int, int> myCardList = new(); // Dictionary<serialNo, cardId>
public List<CardData> attackCardList = new();
public List<CardData> magicCardList = new();
public int handCardCapacity; // TODO ¤È¤ê¤¢¤¨¤º¡¢¸ÇÄêÃÍ
public int inventoryCapacity;
public List<ItemDataSO.ItemData> myItemList = new();
public List<int> achievedChallengeTaskList = new();
public ReactiveProperty<int> DiamondCount = new();
public ReactiveProperty<int> RubyCount = new();
public ReactiveProperty<int> PurpleGemCount = new();
public ReactiveProperty<int> GoldGemCount = new();
public ReactiveProperty<int> DiamondGemCount = new();
public ReactiveProperty<int> RubyGemCount = new();
public ReactiveProperty<bool> HasSaveData = new(); // ¥»¡¼¥Ö¥Ç¡¼¥¿¤¬¤¢¤ë¤«¤É¤¦¤«¡£¤¢¤ë¾ì¹ç¡¢¤½¤Î¾ðÊó¤ò»È¤Ã¤ÆÃæÃǤ·¤¿Éôʬ¤«¤éºÆ³«¤¹¤ë¡£
private Character player;
private Character opponent;
private Dictionary<GemType, ReactiveProperty<int>> gemCounts = new();
private int currentSerialNo; // ¥«¡¼¥É¤ÎÄ̤·ÈÖ¹æ¤ÎºÇ¸å¤ÎÃÍ¡£¥«¡¼¥É¤òÀ¸À®¤¹¤ëºÝ¤Ë¡¢¤³¤ÎÃͤò¤Ä¤±¡¢Ä̤·ÈÖ¹æ¤Ï¾ï¤Ë°ì°Õ¤Ê¤â¤Î¤È¤¹¤ë
public int CurrentSerialNo
{
get => currentSerialNo;
set => currentSerialNo = value;
}
////** ¤³¤³¤Þ¤Ç¡¡**////
/// <summary>
/// ¥¥ã¥é¥¯¥¿¡¼¤ÎÀ¸À®
/// ¥×¥ì¥¤¥ä¡¼¤ÈÂÐÀïÁê¼ê¶¦ÍÑ
/// </summary>
/// <param name="status"></param>
/// <param name="hp"></param>
public void InitCharacter(OwnerStatus status, int hp) {
if (status == OwnerStatus.Player) {
// ¥×¥ì¥¤¥ä¡¼¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òÀ¸À®¤·¡¢HP¤òÀßÄê
player = new(hp, status);
}
else {
// ÂÐÀïÁê¼ê¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤òÀ¸À®¤·¡¢HP¤òÀßÄê
opponent = new(hp, status);
}
}
/// <summary>
/// ¥×¥ì¥¤¥ä¡¼¤Î¼èÆÀ
/// </summary>
/// <returns></returns>
public Character GetPlayer() => player;
/// <summary>
/// ÂÐÀïÁê¼ê(¥¨¥Í¥ß¡¼)¤Î¼èÆÀ
/// </summary>
/// <returns></returns>
public Character GetOpponent() => opponent;
////** ¥á¥½¥Ã¥É¤òÄɲä·¤Þ¤¹¡¡**////
/// <summary>
/// ¼«Ê¬¤«¤é¤ß¤Æ¡¢¥¿¡¼¥²¥Ã¥È¤ò¸«¤Ä¤±¤ë
/// </summary>
/// <param name="myStatus"></param>
/// <returns></returns>
public OwnerStatus GetTarget(OwnerStatus myStatus)
{
return myStatus == OwnerStatus.Player ? OwnerStatus.Opponent : OwnerStatus.Player;
}
/// <summary>
/// °ú¿ô¤Ë»ØÄꤷ¤¿Ä̤·ÈÖ¹æ¤ò»ý¤Ä¥«¡¼¥É¤òmyCardList¤«¤éºï½ü
/// </summary>
/// <param name="serialNo"></param>
public void RemoveMyCard(int serialNo)
{
if (myCardList.ContainsKey(serialNo))
{
myCardList.Remove(serialNo);
}
}
////** ¤³¤³¤Þ¤Ç¡¡**////
¡¡¡¡// TODO ¥«¡¼¥É´ÉÍýÍѤνèÍý¤òÄɲ乤ë
}
¥³¥á¥ó¥È¤ò¤«¤¯