/** * <summary>クリック処理</summary> * */ public override void OnClick(Vector2F position) { if (_dialog != null && _dialog.IsShow) { Function.PlaySoundOK(); _dialog.RemoveNode(_parentNode); return; } if (_numberInputWindow != null && _numberInputWindow.IsShow()) { _numberInputWindow.OnClick(position); return; } if (_confirmWindow != null && _confirmWindow.IsShow()) { _confirmWindow.OnClick(position); return; } foreach (var shopListButton in shopListButtons) { if (shopListButton.IsClick(position)) { Function.PlaySoundOK(); if (shopListButton.type == ShopListButton.Type.Seed) { _numberInputWindow = new NumberInputWindow(_parentNode, shopListButton.Id, shopListButton.Money); _numberInputWindow.Show(); } else if (shopListButton.type == ShopListButton.Type.Food) { _numberInputWindow = new NumberInputWindow(_parentNode, shopListButton.Id, shopListButton.Money, shopListButton.Quality); _numberInputWindow.Show(); } else if (shopListButton.type == ShopListButton.Type.Animal) { if (GameData.PlayerData.Money >= shopListButton.Money) { _confirmWindow = new ConfirmWindow(_parentNode, Function.SearchItemById(shopListButton.Id).name + "を購入しますか?\n" + "(" + shopListButton.Money.ToString() + "G)", () => { _dialog = new Dialog(); _dialog.SetNode( Function.SearchItemById(shopListButton.Id).name + "を購入しました", _parentNode); //お金を払う GameData.PlayerData.Money -= shopListButton.Money; //動物の追加 GameData.PlayerData.ranches.Add(new Ranch() { id = shopListButton.Id, growth = 0, quality = 0 }); _confirmWindow.Hide(); }); _confirmWindow.Show(); } else { _dialog = new Dialog(); _dialog.SetNode("お金が足りません。", _parentNode); } } return; } } //キャンセルボタン押下 if (_cancelButton.IsClick(position)) { Function.PlaySoundCancel(); Hide(); } }
public void OnClick(Vector2F position) { if (_dialog != null && _dialog.IsShow) { Function.PlaySoundOK(); if (_isLevelup) { _dialog.UpdateText( "経営レベルが上がりました\n(" + GameData.PlayerData.ManagementLevel.ToString() + ")" ); _isLevelup = false; return; } _dialog.RemoveNode(_parentNode); _confirmWindow.Hide(); return; } if (_confirmWindow != null && _confirmWindow.IsShow()) { _confirmWindow.OnClick(position); return; } foreach (var column in requestColumns) { if (column.DeliveryButton.Click(position)) { Function.PlaySoundOK(); _confirmWindow = new ConfirmWindow(_parentNode, column.Label.GetText() + "\n" + "納品しますか?\n" + "(品質の高いものから使用されます)", () => { var request = column.GetRequest(); int num = request.Num; int quolity = 0; for (int q = 0; q < Common.Parameter.QuolityMaxNum; q++) { if (GameData.PlayerData.Item[request.ItemId, q] < num) { quolity += Function.Quolity2Value(q) * GameData.PlayerData.Item[request.ItemId, q]; num -= GameData.PlayerData.Item[request.ItemId, q]; GameData.PlayerData.Item[request.ItemId, q] = 0; } else { quolity += Function.Quolity2Value(q) * num; GameData.PlayerData.Item[request.ItemId, q] -= num; break; } } Common.Parameter.Quality averageQuolity = Function.QualityByValue(quolity / request.Num); float bonus = Function.Quolity2Bonus(averageQuolity); GameData.PlayerData.Money += (int)(request.Money * bonus); _dialog = new Dialog(); _dialog.SetNode("納品しました\n" + "(品質" + Function.Quolity2String(averageQuolity) + ")\n" + "(+" + (request.Money * bonus).ToString() + "G)", _parentNode); column.DeleteRequest(); //納品出来なくなったリクエストはロックする foreach (var column2 in requestColumns) { column2.ButtonUpdate(); } GameData.PlayerData.ManagementExperience += column.Exp; if (GameData.PlayerData.ManagementExperience >= GameData.PlayerData.ManagementLevel * 25) { GameData.PlayerData.ManagementExperience -= GameData.PlayerData.ManagementLevel * 25; GameData.PlayerData.ManagementLevel++; GameData.PlayerData.MaxPower++; _isLevelup = true; } }); _confirmWindow.Show(); return; } if (column.DestructionButton.Click(position)) { Function.PlaySoundOK(); _confirmWindow = new ConfirmWindow(_parentNode, column.Label.GetText() + "\n破棄しますか?", () => { _dialog = new Dialog(); _dialog.SetNode("破棄しました", _parentNode); column.DeleteRequest(); }); _confirmWindow.Show(); return; } } }