Пример #1
0
    public void RPC_CreateAuctionDialog(PhotonPlayer caller, int propertyID, int viewID)
    {
        NPlayer   callingPlayer = NPlayerController.FindGamePlayer(caller);
        NProperty property      = NBoardManager.instance.FindProperty(propertyID);

        GameObject dialog = Instantiate(auctionDialogPrefab);

        dialog.GetComponent <PhotonView>().viewID = viewID;
        dialog.GetComponent <NAuctionDialog>().Initialize(callingPlayer, property);
    }
Пример #2
0
    // mode: 0.Trader  1.Tradee  2.Others
    public void Initialize(PhotonPlayer trader, PhotonPlayer tradee, int mode)
    {
        if (mode == 0)
        {
            offerButton.gameObject.SetActive(true);
            cancelButton.gameObject.SetActive(true);
            moneySliderA.interactable = true;
            moneyTextA.interactable   = true;
            moneySliderB.interactable = true;
            moneyTextB.interactable   = true;
        }
        else if (mode == 1)
        {
            offerButton.gameObject.SetActive(false);
            cancelButton.gameObject.SetActive(false);
            acceptButton.gameObject.SetActive(true);
            declineButton.gameObject.SetActive(true);
        }


        playerA = NPlayerController.FindGamePlayer(trader);
        playerB = NPlayerController.FindGamePlayer(tradee);

        // set name texts
        playerNameA.text = trader.NickName;
        playerNameB.text = tradee.NickName;

        // set money sliders
        moneySliderA.maxValue = playerA.CurrentMoney;
        moneySliderB.maxValue = playerB.CurrentMoney;

        // set property list panels
        for (int i = 0; i < playerA.Properties.Count; i++)
        {
            GameObject propertyMiniCard = Instantiate(propertyMiniCardPrefab);
            propertyMiniCard.transform.SetParent(propertyListA, false);
            propertyMiniCardsA.Add(propertyMiniCard.GetComponent <NPropertyMiniCard>());
            propertyMiniCard.GetComponent <NPropertyMiniCard>().Initialize(playerA.Properties[i], 0, i, (mode == 0));
        }
        for (int i = 0; i < playerB.Properties.Count; i++)
        {
            GameObject propertyMiniCard = Instantiate(propertyMiniCardPrefab);
            propertyMiniCard.transform.SetParent(propertyListB, false);
            propertyMiniCardsB.Add(propertyMiniCard.GetComponent <NPropertyMiniCard>());
            propertyMiniCard.GetComponent <NPropertyMiniCard>().Initialize(playerB.Properties[i], 1, i, (mode == 0));
        }
    }