public void RequestBuy(Player player, PlotConstruction plot) { if (Bank.Ins.MoneyPlayer(player) >= plot.PurchasePrice) { photonView.RPC("RequestBuyServer", RpcTarget.MasterClient, player.Id, (int)plot.Id, PhotonNetwork.LocalPlayer.UserId); } else { OnBuyFailCallback?.Invoke("Not enough money"); } }
public void SetPlot(Plot plot) { if (plot is PlotConstructionMarket) { Plot = plot as PlotConstructionMarket; } else { Debug.LogError("Someone set plot that not Construction Temple into Temple Buy UI"); } }
private void BuySuccessCallback(Player player, PlotConstruction plot) { if (gameObject.activeSelf == false) { return; } if (player.MinePlayer && plot == Plot) { Debug.Log("Buy success"); TurnDirector.Ins.EndOfPhase(); StopPhaseUI.Ins.Deactive(GetScreenType()); _canClick = true; } }
public void BuySuccessCallback(int playerId, int plotId) { Player player = TurnDirector.Ins.GetPlayer(playerId); PlotConstruction plot = Plot.plotDictionary[(PLOT)plotId] as PlotConstruction; Bank.Ins.TakeMoney(player, plot.PurchasePrice, true); if (plot.Owner != null) { Bank.Ins.SendMoney(plot.Owner, plot.PurchasePrice, true); } plot.Owner = player; OnBuyCallback?.Invoke(player, plot); }
private void BuySuccessCallback(Player player, PlotConstruction plot) { if (gameObject.activeSelf == false) { return; } if (player.MinePlayer && plot == Plot) { Debug.Log("Buy success"); StopPhaseUI.Ins.Deactive(GetScreenType()); StopPhaseUI.Ins.Activate(PhaseScreens.MarketUpgradeUI, this._plot); _canClick = true; } }
private void RequestBuyServer(int playerId, int plotId, string clientID) { Player player = TurnDirector.Ins.GetPlayer(playerId); PlotConstruction plot = Plot.plotDictionary[(PLOT)plotId] as PlotConstruction; var cs = PhotonNetwork.PlayerList; Photon.Realtime.Player client = PhotonNetwork.PlayerList.Single(x => x.UserId == clientID); if (player == null | plot == null) { photonView.RPC("BuyFailCallback", client, "playerID " + playerId + " or plotID " + plotId + " not found"); return; } else if (Bank.Ins.MoneyPlayer(player) < plot.PurchasePrice) { photonView.RPC("BuyFailCallback", client, "Not enough money"); return; } else { photonView.RPC("BuySuccessCallback", RpcTarget.All, playerId, plotId); return; } }