/// <summary> /// 装備文字を設定 /// </summary> private void SetText() { ProtectionItem[] armor = playerItem.CurrentArmor(); //装備を取得 WeaponItem leftHand = playerItem.LeftHand(); //左手 WeaponItem rightHand = playerItem.RightHand(); //右手 ConsumptionItem arrow = playerItem.Arrow(); AccessaryItem accessary = playerItem.Accessary(); equips = new string[8]; //装備文字初期化 for (int i = 0; i < 4; i++) //防具文字を設定 { colors[i] = Color.White; SetProtectionText(ref equips[i], armor, (ProtectionItem.ProtectionType)i); } if (leftHand == null) //左手に武器がない場合 { colors[4] = Color.White; EquipNull(ref equips[4]); } else { colors[4] = Color.Lerp(Color.White, Color.Gold, leftHand.GetItemRare() / 8.0f); //レア度で色付け equips[4] = leftHand.GetItemName() + " + " + leftHand.GetReinforcement(); } if (rightHand == null) //右手に武器がない場合 { colors[5] = Color.White; EquipNull(ref equips[5]); } else { colors[5] = Color.Lerp(Color.White, Color.Gold, rightHand.GetItemRare() / 8.0f); //レア度で色付け equips[5] = rightHand.GetItemName() + " + " + rightHand.GetReinforcement(); } if (arrow == null) //矢を装備していない場合 { colors[6] = Color.White; EquipNull(ref equips[6]); } else { colors[6] = Color.Lerp(Color.White, Color.Gold, arrow.GetItemRare() / 8.0f); //レア度で色付け equips[6] = arrow.GetItemName() + "(" + arrow.GetStack() + ")"; } if (accessary == null) { colors[7] = Color.White; EquipNull(ref equips[7]); } else { colors[7] = Color.Lerp(Color.White, Color.Gold, accessary.GetItemRare() / 8.0f); //レア度で色付け equips[7] = accessary.GetItemName(); } }
/// <summary> /// 装飾品の詳細設定 /// </summary> /// <param name="item">アイテム</param> private void AccessaryInfo(AccessaryItem item) { info = new string[6]; info[0] = item.GetItemName(); info[1] = "レア度 " + item.GetItemRare(); info[2] = "買値 " + item.GetItemPrice(); info[3] = "重量 " + item.GetItemWeight(); info[4] = "タイプ 装飾品"; info[5] = item.GetItemExplanation(); }
public void Set() { clearDungen = gameManager.DungeonProcess.GetProcess(); money = playerInventory.CurrentMoney(); bag = playerInventory.BagList(); armor = playerInventory.CurrentArmor(); leftHand = playerInventory.LeftHand(); rightHand = playerInventory.RightHand(); arrow = playerInventory.Arrow(); accessary = playerInventory.Accessary(); depotEquipment = playerInventory.EquipDepository(); depotConsumption = playerInventory.DepositoryItem(); questLoader = gameManager.QuestManager; quest = gameManager.PlayerQuest.CurrentQuest(); guildRank = gameManager.GuildInfo; }
public void Initialize() { ProtectionItem[] armor = playerItem.CurrentArmor(); //装備を取得 WeaponItem leftHand = playerItem.LeftHand(); //左手 WeaponItem rightHand = playerItem.RightHand(); //右手 ConsumptionItem arrow = playerItem.Arrow(); AccessaryItem accessary = playerItem.Accessary(); items = new Item[8]; for (int i = 0; i < armor.Length; i++) { items[i] = armor[i]; } items[4] = leftHand; items[5] = rightHand; items[6] = arrow; items[7] = accessary; currentItem = null; }
public SaveData(GameManager gameManager) { this.gameManager = gameManager; itemManager = gameManager.ItemManager; playerInventory = gameManager.PlayerItem; clearDungen = gameManager.DungeonProcess.GetProcess(); money = playerInventory.CurrentMoney(); bag = playerInventory.BagList(); armor = playerInventory.CurrentArmor(); leftHand = playerInventory.LeftHand(); rightHand = playerInventory.RightHand(); arrow = playerInventory.Arrow(); accessary = playerInventory.Accessary(); quest = new List <Quest>(); questLoader = gameManager.QuestManager; guildRank = gameManager.GuildInfo; saveFileName = @"Content/SaveCSV/SaveDate.csv"; isSave = false; isLoad = false; }
//セーブデータを読み込む public bool Load() { if (!File.Exists(saveFileName)) { return(false); } StreamReader sr = new StreamReader(saveFileName); try { isLoad = true; List <string[]> itemDates = new List <string[]>(); clearDungen = new Dictionary <int, int>(); armor = new ProtectionItem[4]; bag = new List <Item>(); int accessaryID = 0; depotEquipment = new List <Item>(); depotConsumption = new Dictionary <int, int>(); int bagNum = 0; int depotNum = 0; while (!sr.EndOfStream) { string line = sr.ReadLine(); string[] strings = line.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); if (strings[0] == "floor") { clearDungen[int.Parse(strings[1])] = int.Parse(strings[2]); } else if (strings[0] == "money") { money = int.Parse(strings[1]); } else if (strings[0] == "leftHand") { if (strings[1] != "no") { string[] itemDate = new string[] { strings[1], strings[2], strings[3], strings[4], strings[5], }; itemDates.Add(itemDate); } else { itemDates.Add(null); } } else if (strings[0] == "rightHand") { if (strings[1] != "no") { string[] itemDate = new string[] { strings[1], strings[2], strings[3], strings[4], strings[5], }; itemDates.Add(itemDate); } else { itemDates.Add(null); } } else if (strings[0] == "arrow") { if (strings[1] != "no") { string[] itemDate = new string[] { strings[1], strings[2], strings[3] }; itemDates.Add(itemDate); } else { itemDates.Add(null); } } else if (strings[0] == "armor") { if (strings[1] != "no") { string[] itemDate = new string[] { strings[1], strings[2], strings[3], strings[4], strings[5], }; itemDates.Add(itemDate); } else { itemDates.Add(null); } } else if (strings[0] == "accessary") { if (strings[1] != "no") { accessaryID = int.Parse(strings[2]); } } else if (strings[0] == "bag") { bagNum++; if (strings[1] == "Consumption") { string[] itemDate = new string[] { strings[1], strings[2], strings[3], }; itemDates.Add(itemDate); } else if (strings[1] == "Accessary") { string[] itemDate = new string[] { strings[1], strings[2], }; itemDates.Add(itemDate); } else { string[] itemDate = new string[] { strings[1], strings[2], strings[3], strings[4], strings[5], }; itemDates.Add(itemDate); } } else if (strings[0] == "depot") { if (strings[1] == "Consumption") { depotConsumption.Add(int.Parse(strings[2]), int.Parse(strings[3])); } else if (strings[1] == "Accessary") { depotNum++; string[] itemDate = new string[] { strings[1], strings[2], }; itemDates.Add(itemDate); } else { depotNum++; string[] itemDate = new string[] { strings[1], strings[2], strings[3], strings[4], strings[5], }; itemDates.Add(itemDate); } } else if (strings[0] == "quest") { Quest q = questLoader.GetQuest(int.Parse(strings[1])); for (int i = 0; i < 3; i++) { if (i >= q.RequireID().Length) { break; } q.SetItemAmount(q.RequireID()[i], int.Parse(strings[i + 2])); } quest.Add(q); } else if (strings[0] == "guild") { guildRank = new PlayerGuildRank(int.Parse(strings[1]), int.Parse(strings[2])); } } sr.Close(); List <Item> items = itemManager.LoadSaveItem(itemDates); if (accessaryID != 0) { accessary = (AccessaryItem)itemManager.GetAccessary(accessaryID); } leftHand = (WeaponItem)items[0]; rightHand = (WeaponItem)items[1]; arrow = (ConsumptionItem)items[2]; armor[0] = (ProtectionItem)items[3]; armor[1] = (ProtectionItem)items[4]; armor[2] = (ProtectionItem)items[5]; armor[3] = (ProtectionItem)items[6]; for (int i = 7; i < 7 + bagNum; i++) { bag.Add(items[i]); } for (int i = 7 + bagNum; i < 7 + bagNum + depotNum; i++) { depotEquipment.Add(items[i]); } isLoad = false; return(true); } catch (Exception e) { Console.WriteLine(e); sr.Close(); return(false); } }