示例#1
0
    public void RPC_TradeProperty(PhotonPlayer trader, PhotonPlayer tradee, int[] propA, int[] propB, int moneyA, int moneyB)
    {
        if (!PhotonNetwork.isMasterClient)
        {
            return;
        }
        NPlayer playerA = FindGamePlayer(trader);
        NPlayer playerB = FindGamePlayer(tradee);

        playerA.ChangeMoney(-moneyA);
        playerA.ChangeMoney(moneyB);
        playerB.ChangeMoney(moneyA);
        playerB.ChangeMoney(-moneyB);

        foreach (int propID in propB)
        {
            NProperty property = NBoardManager.instance.Properties[propID];
            playerB.RemoveProperty(property);
            playerA.AddProperty(property);
            property.SoldTo(playerA);
            photonView.RPC("RPC_SetPropertyOwnerMarker", PhotonTargets.All, propID, trader);
        }

        foreach (int propID in propA)
        {
            NProperty property = NBoardManager.instance.Properties[propID];
            playerA.RemoveProperty(property);
            playerB.AddProperty(property);
            property.SoldTo(playerB);
            photonView.RPC("RPC_SetPropertyOwnerMarker", PhotonTargets.All, propID, tradee);
        }
    }
示例#2
0
 public void Initialize(NProperty propertyToSell, bool isCaller)
 {
     _property = propertyToSell;
     if (!isCaller)
     {
         buyButton.gameObject.SetActive(false);
         auctionButton.gameObject.SetActive(false);
     }
     if (propertyToSell is NLand)
     {
         GameObject landCard = Instantiate(landCardPrefab, propertyCardPlaceholder, false);
         landCard.transform.localScale = new Vector3(0.75f, 0.75f, 1);
         landCard.transform.position   = propertyCardPlaceholder.position;
         landCard.GetComponent <NDetailedLandCard>().Initialize(propertyToSell as NLand);
         if (propertyToSell.PropertyName == "Vatican")
         {
             buyButton.interactable = false;
         }
     }
     else if (propertyToSell is NRailroad)
     {
         GameObject railroadCard = Instantiate(railroadCardPrefab, propertyCardPlaceholder, false);
         railroadCard.transform.localScale = new Vector3(0.75f, 0.75f, 1);
         railroadCard.transform.position   = propertyCardPlaceholder.position;
         railroadCard.GetComponent <NDetailedRailroadCard>().Initialize(propertyToSell as NRailroad);
     }
 }
示例#3
0
        private NGroupBox CreateSample(string title, NProperty property, double step, double min, double max, int decimalPlaces)
        {
            NGroupBox groupBox = new NGroupBox(title);

            NStackPanel stack = new NStackPanel();

            groupBox.Content      = stack;
            stack.VerticalSpacing = 10;

            NStackPanel propertyStack = new NStackPanel();

            stack.Add(new NUniSizeBoxGroup(propertyStack));
            propertyStack.HorizontalPlacement = ENHorizontalPlacement.Left;

            NNumberPropertyEditor editor = CreateEditor(property, step, min, max, decimalPlaces);

            propertyStack.Add(new NPairBox("Step = ", editor.Step, true));
            propertyStack.Add(new NPairBox("Minimum = ", editor.Minimum, true));
            propertyStack.Add(new NPairBox("Maximum = ", editor.Maximum, true));
            if (editor is NFloatingNumberPropertyEditor)
            {
                propertyStack.Add(new NPairBox("Decimal Places = ", ((NFloatingNumberPropertyEditor)editor).DecimalPlaces, true));
            }

            for (int i = 0, count = propertyStack.Count; i < count; i++)
            {
                NPairBox    pairBox = (NPairBox)propertyStack[i];
                NUniSizeBox box1    = (NUniSizeBox)pairBox.Box1;
                box1.Content.HorizontalPlacement = ENHorizontalPlacement.Right;
            }

            stack.Add(editor);

            return(groupBox);
        }
示例#4
0
    public void Initialize(NPlayer caller, NProperty property)
    {
        // set up the property card
        if (property is NLand)
        {
            GameObject landCard = Instantiate(landCardPrefab, propertyCardPlaceholder, false);
            landCard.transform.localScale = new Vector3(0.9f, 0.9f, 1);
            landCard.transform.position   = propertyCardPlaceholder.position;
            landCard.GetComponent <NDetailedLandCard>().Initialize(property as NLand);
        }
        else if (property is NRailroad)
        {
            GameObject railroadCard = Instantiate(railroadCardPrefab, propertyCardPlaceholder, false);
            railroadCard.transform.localScale = new Vector3(0.9f, 0.9f, 1);
            railroadCard.transform.position   = propertyCardPlaceholder.position;
            railroadCard.GetComponent <NDetailedRailroadCard>().Initialize(property as NRailroad);
        }

        _isCaller        = (caller == NPlayer.thisPlayer);
        _currentBid      = property.PurchasePrice;
        bidInfoText.text = caller.photonView.owner.NickName + " has started the auction\n";
        bidInput.text    = _currentBid.ToString();

        NAuctionManager.instance.Initialize(caller, property, this);
    }
示例#5
0
 public void RemoveProperty(NProperty property)
 {
     if (!PhotonNetwork.isMasterClient)
     {
         return;
     }
     photonView.RPC("RPC_RemoveProperty", PhotonTargets.All, property.PropertyID);
 }
示例#6
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            stack.FillMode = ENStackFillMode.Last;
            stack.FitMode  = ENStackFitMode.Last;

            // Create a tab
            NTab tab = new NTab();

            stack.Add(tab);

            NProperty[] properties = new NProperty[] {
                NRangeSlider.EnabledProperty,
                NRangeSlider.BeginValueProperty,
                NRangeSlider.EndValueProperty,
                NRangeSlider.LargeChangeProperty,
                NRangeSlider.SnappingStepProperty,
                NRangeSlider.MinimumProperty,
                NRangeSlider.MaximumProperty,
                NRangeSlider.TicksPlacementProperty,
                NRangeSlider.TicksIntervalProperty,
                NRangeSlider.TicksLengthProperty
            };

            // Create the Horizontal slider properties
            NStackPanel             hsbStack = new NStackPanel();
            NList <NPropertyEditor> editors  = NDesigner.GetDesigner(m_HSlider).CreatePropertyEditors(
                m_HSlider, properties);

            for (int i = 0; i < editors.Count; i++)
            {
                hsbStack.Add(editors[i]);
            }

            tab.TabPages.Add(new NTabPage("Horzontal", hsbStack));

            // Create the Vertical slider properties
            NStackPanel vsbStack = new NStackPanel();

            editors = NDesigner.GetDesigner(m_VSlider).CreatePropertyEditors(
                m_VSlider, properties);

            for (int i = 0; i < editors.Count; i++)
            {
                vsbStack.Add(editors[i]);
            }

            tab.TabPages.Add(new NTabPage("Vertical", vsbStack));

            // Add events log
            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(new NUniSizeBoxGroup(stack));
        }
    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);
    }
示例#8
0
    public void Initialize(NPlayer startingPlayer, NProperty property, NAuctionDialog auctionDialog)
    {
        _bidders         = new List <NPlayer>(NGameplay.instance.Players);
        _property        = property;
        _currentBidder   = startingPlayer.Order;
        _currentBid      = property.PurchasePrice;
        _auctionFinished = false;
        _auctionDialog   = auctionDialog;

        StartCoroutine(Bidding());
    }
示例#9
0
        /// <summary>
        /// Adds a new property with the specified name and value.
        /// </summary>
        /// <typeparam name="T">The value type.</typeparam>
        /// <param name="propertyName">The name of the property to add.</param>
        /// <param name="value">The value of the property.</param>
        public void CreateProperty <T>(string propertyName, T value = default)
        {
            if (HasProperty(propertyName))
            {
                return;
            }

            var property = NProperty <T> .Create(propertyName, value);

            property.SetParent(Owner);

            AddProperty(property);
        }
    public void Initialize(NProperty property, int side, int index, bool interactable)
    {
        _property = property;

        NLand land = property as NLand;

        if (land != null)
        {
            groupColor.color = land.Group;
        }
        label.text = property.PropertyName;

        _side  = side;
        _index = index;
        toggle.interactable = interactable;
    }
示例#11
0
    public void RPC_RedeemProperty(int propertyID, PhotonPlayer caller)
    {
        if (!PhotonNetwork.isMasterClient)
        {
            return;
        }

        NProperty property = NBoardManager.instance.Properties[propertyID];
        NPlayer   player   = FindGamePlayer(caller);

        if (property.IsMortgaged)
        {
            property.IsMortgaged = false;
            player.ChangeMoney(-(int)(property.PurchasePrice / 2 * 1.1f));
            photonView.RPC("RPC_TogglePropertyMortgagedBackground", PhotonTargets.All, propertyID, false);
        }
    }
示例#12
0
    public void RPC_PurchaseProperty(int propertyID, int purchasePrice, PhotonPlayer caller)
    {
        if (!PhotonNetwork.isMasterClient)
        {
            return;
        }
        NPlayer   player   = FindGamePlayer(caller);
        NProperty property = NBoardManager.instance.Properties[propertyID];

        if (player.CurrentMoney >= purchasePrice)
        {
            player.ChangeMoney(-purchasePrice);
            player.AddProperty(property);
            property.SoldTo(player);
            photonView.RPC("RPC_SetPropertyOwnerMarker", PhotonTargets.All, propertyID, caller);
        }
    }
            private void OnAppointmentChanged(NEventArgs args)
            {
                NValueChangeEventArgs valueChangeArgs = args as NValueChangeEventArgs;

                if (valueChangeArgs == null)
                {
                    return;
                }

                // If the start or the end time of the appointment has changed, update the barcode
                NProperty property = valueChangeArgs.Property;

                if (property == NAppointmentBase.StartProperty || property == NAppointmentBase.EndProperty)
                {
                    UpdateBarcode();
                    NSchedule schedule = (NSchedule)this.GetFirstAncestor(NSchedule.NScheduleSchema);
                    schedule.ScrollToTime(TimeSpan.FromHours(6));
                }
            }
示例#14
0
        private void OnColorBoxSelectedColorChanged(NValueChangeEventArgs args)
        {
            if (m_Table == null)
            {
                return;
            }

            NColor    color    = (NColor)args.NewValue;
            NColorBox colorBox = (NColorBox)args.TargetNode;
            NProperty property = (NProperty)colorBox.Tag;

            INIterator <NNode> iterator = m_Table.GetSubtreeIterator(ENTreeTraversalOrder.DepthFirstPreOrder, new NInstanceOfSchemaFilter(NCanvas.NCanvasSchema));

            while (iterator.MoveNext())
            {
                NCanvas canvas = (NCanvas)iterator.Current;
                ((NHatchFill)canvas.Tag).SetValue(property, color);
                canvas.InvalidateDisplay();
            }
        }
示例#15
0
        private NNumberPropertyEditor CreateEditor(NProperty property, double step, double min, double max, int decimalPlaces)
        {
            NNumberPropertyEditor editor = (NNumberPropertyEditor)CreateEditor(property);
            NSimpleNode           node   = (NSimpleNode)editor.EditedNode;

            if (Double.IsNaN(step) == false)
            {
                editor.Step = step;
            }

            if (Double.IsNaN(min) == false)
            {
                editor.Minimum = min;
            }

            if (Double.IsNaN(max) == false)
            {
                editor.Maximum = max;
            }

            if (decimalPlaces != -1 && editor is NFloatingNumberPropertyEditor)
            {
                ((NFloatingNumberPropertyEditor)editor).DecimalPlaces = decimalPlaces;
            }

            // Ensure the value is in the range [min, max]
            double value = Convert.ToDouble(node.GetValue(property));

            if (value < min)
            {
                node.SetValue(property, Convert.ChangeType(editor.Minimum, property.DomType.Type, CultureInfo.InvariantCulture));
            }
            if (value > max)
            {
                node.SetValue(property, Convert.ChangeType(editor.Maximum, property.DomType.Type, CultureInfo.InvariantCulture));
            }

            return(editor);
        }
示例#16
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            stack.FillMode = ENStackFillMode.Last;
            stack.FitMode  = ENStackFitMode.Last;

            // properties
            NProperty[]             properties = new NProperty[] { NAccordion.ShowSymbolProperty };
            NList <NPropertyEditor> editors    = NDesigner.GetDesigner(m_Accordion).CreatePropertyEditors(m_Accordion, properties);

            for (int i = 0; i < editors.Count; i++)
            {
                stack.Add(editors[i]);
            }

            // create the events list box
            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(stack);
        }
示例#17
0
    private void RPC_SetPropertyOwnerMarker(int propertyID, PhotonPlayer player)
    {
        NProperty prop = NBoardManager.instance.FindProperty(propertyID);

        prop.SetNewOwnerMarker(FindGamePlayer(player));
    }
示例#18
0
    public void RPC_AddProperty(int propertyID)
    {
        NProperty property = allProperties[propertyID];

        _properties.Add(property);
    }
示例#19
0
    public void RPC_RemoveProperty(int propertyID)
    {
        NProperty property = allProperties[propertyID];

        _properties.Remove(property);
    }
示例#20
0
 private NPropertyEditor CreateEditor(NProperty property)
 {
     return(SimpleNodeDesigner.CreatePropertyEditor(m_SimpleNode, property));
 }
        static NTestNode()
        {
            NTestNodeSchema = NSchema.Create(typeof(NTestNode), NNode.NNodeSchema);

            ExtendedPropertyEx = NProperty.CreateExtended(NTestNodeSchema, "Extended", NDomType.Boolean, true);
        }
示例#22
0
 public void PurchaseProperty(NProperty property)
 {
     photonView.RPC("RPC_PurchaseProperty", PhotonTargets.MasterClient, property.PropertyID, property.PurchasePrice, PhotonNetwork.player);
 }
示例#23
0
    public void RPC_TogglePropertyMortgagedBackground(int propertyID, bool isMortgaged)
    {
        NProperty prop = NBoardManager.instance.FindProperty(propertyID);

        prop.ToggleMortgagedBackground(isMortgaged);
    }
示例#24
0
 public void AuctionProperty(NProperty property)
 {
     NDialogManager.instance.CallAuctionDialog(property);
 }
 // Auction Dialog
 public void CallAuctionDialog(NProperty property)
 {
     photonView.RPC("RPC_CallAuctionDialog", PhotonTargets.MasterClient, PhotonNetwork.player, property.PropertyID);
 }