private void OnTradeBtn(Button b, TradeActions action, Direction counterOffer) { PlayerTrade playerTrade = null; foreach (KeyValuePair <PlayerTrade, Button> valuePair in _incomingTradeDictionary) { if (valuePair.Value == b) { playerTrade = valuePair.Key; } } foreach (KeyValuePair <PlayerTrade, Button> valuePair in _outgoingTradeDictionary) { if (valuePair.Value == b) { playerTrade = valuePair.Key; } } if (playerTrade == null) { throw new Exception("We got a problem bois..."); } switch (action) { case TradeActions.TradeRejected: playerTrade.RejectTrade(_playerController); break; case TradeActions.TradeAccepted: playerTrade.AcceptTrade(counterOffer, _playerController); break; case TradeActions.TradeCanceled: playerTrade.CancelTrade(_playerController.playerTag); break; case TradeActions.TradeCanceledByGameHandler: playerTrade.CancelTrade(GameHandler.Current); break; default: throw new ArgumentOutOfRangeException(nameof(action), action, null); } }
public void RejectInfo() { if (_tradeConfirmed) { trade.CancelTrade(_playerController.playerTag); return; } LeanTween.moveLocalX(selectPlayerPanel, 168, 0.5f); LeanTween.moveLocalX(selectMovePanel, 168, 0.5f); LeanTween.moveLocalX(confirmationScreen, 168, 0.5f).setEase(LeanTweenType.easeInQuad).setOnComplete(() => { LeanTween.moveLocalY(confirmationScreen, 96.87f, 0); LeanTween.moveLocalX(confirmationScreen, 0, 0); //LeanTween.moveLocalY(confirmButton, -9.645f, 0); //LeanTween.moveLocalX(confirmButton, -58.1f, 0); //LeanTween.moveLocalY(rejectButton, -9.645f, 0); //LeanTween.moveLocalX(rejectButton, 58.1f, 0); }); }