Example #1
0
 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");
     }
 }
Example #2
0
 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");
     }
 }
Example #3
0
 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;
     }
 }
Example #4
0
    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);
    }
Example #5
0
    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;
        }
    }
Example #6
0
    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;
        }
    }