当前位置: 首页>>代码示例>>C#>>正文


C# DesignState.MeltFixtures方法代码示例

本文整理汇总了C#中Server.Multis.DesignState.MeltFixtures方法的典型用法代码示例。如果您正苦于以下问题:C# DesignState.MeltFixtures方法的具体用法?C# DesignState.MeltFixtures怎么用?C# DesignState.MeltFixtures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server.Multis.DesignState的用法示例。


在下文中一共展示了DesignState.MeltFixtures方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EndConfirmCommit

        public void EndConfirmCommit( Mobile from )
        {
            if (Deleted || DesignContext.Find(from) == null)
                return;

            int oldPrice = Price;
            int newPrice = oldPrice + 10000 + ((DesignState.Components.List.Length - CurrentState.Components.List.Length) * 500);
            int cost = newPrice - oldPrice;

            if ( cost > 0 )
            {
                if ( Banker.Withdraw( from, cost ) )
                {
                    from.SendLocalizedMessage( 1060398, cost.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                }
                else
                {
                    from.SendLocalizedMessage( 1061903 ); // You cannot commit this house design, because you do not have the necessary funds in your bank box to pay for the upgrade.  Please back up your design, obtain the required funds, and commit your design again.
                    return;
                }
            }
            else if ( cost < 0 )
            {
                if ( Banker.Deposit( from, -cost ) )
                    from.SendLocalizedMessage( 1060397, (-cost).ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
                else
                    return;
            }

            /* Client chose to commit current design state
                 *  - Commit design state
                 *     - Construct a copy of the current design state
                 *     - Clear visible fixtures
                 *     - Melt fixtures from constructed state
                 *     - Add melted fixtures from constructed state
                 *     - Assign constructed state to foundation
                 *  - Update house price
                 *  - Remove design context
                 *  - Notify the client that customization has ended
                 *  - Notify the core that the foundation has changed and should be resent to all clients
                 *  - If a signpost is needed, add it
                 *  - Eject all from house
                 *  - Restore relocated entities
                 */

            // Commit design state : Construct a copy of the current design state
            DesignState copyState = new DesignState( DesignState );

            // Commit design state : Clear visible fixtures
            ClearFixtures( from );

            // Commit design state : Melt fixtures from constructed state
            copyState.MeltFixtures();

            // Commit design state : Add melted fixtures from constructed state
            AddFixtures( from, copyState.Fixtures );

            // Commit design state : Assign constructed state to foundation
            CurrentState = copyState;

            // Update house price
            Price = newPrice - 10000;

            // Remove design context
            DesignContext.Remove( from );

            // Notify the client that customization has ended
            from.Send( new EndHouseCustomization( this ) );

            // Notify the core that the foundation has changed and should be resent to all clients
            Delta( ItemDelta.Update );
            ProcessDelta();
            CurrentState.SendDetailedInfoTo( from.NetState );

            // If a signpost is needed, add it
            CheckSignpost();

            // Eject all from house
            from.RevealingAction();

            foreach ( Item item in GetItems() )
                item.Location = BanLocation;

            foreach ( Mobile mobile in GetMobiles() )
                mobile.Location = BanLocation;

            // Restore relocated entities
            RestoreRelocatedEntities();
        }
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:89,代码来源:HouseFoundation.cs

示例2: RefreshHouse

        public void RefreshHouse(Mobile owner)
        {
            DesignState copyState = new DesignState(DesignState);

            // Commit design state : Clear visible fixtures
            ClearFixtures(owner);

            // Commit design state : Melt fixtures from constructed state
            copyState.MeltFixtures();

            // Commit design state : Add melted fixtures from constructed state
            AddFixtures(owner, copyState.Fixtures);

            // Commit design state : Assign constructed state to foundation
            CurrentState = copyState;

            Delta(ItemDelta.Update);
            ProcessDelta();
            CurrentState.SendDetailedInfoTo(owner.NetState);

        }
开发者ID:zerodowned,项目名称:JustUO-merged-with-EC-Support,代码行数:21,代码来源:HouseFoundation.cs

示例3: ECEndConfirmCommit

        public void ECEndConfirmCommit(Mobile from)
        {
            if (this.Deleted)
                return;

            /* Client chose to commit current design state
             *  - Commit design state
             *     - Construct a copy of the current design state
             *     - Clear visible fixtures
             *     - Melt fixtures from constructed state
             *     - Add melted fixtures from constructed state
             *     - Assign constructed state to foundation
             *  - Update house price
             *  - Remove design context
             *  - Notify the client that customization has ended
             *  - Notify the core that the foundation has changed and should be resent to all clients
             *  - If a signpost is needed, add it
             *  - Eject all from house
             *  - Restore relocated entities
             */

            // Commit design state : Construct a copy of the current design state
            DesignState copyState = new DesignState(DesignState);

            // Commit design state : Clear visible fixtures
            ClearFixtures(from);

            // Commit design state : Melt fixtures from constructed state
            copyState.MeltFixtures();

            // Commit design state : Add melted fixtures from constructed state
            AddFixtures(from, copyState.Fixtures);

            // Commit design state : Assign constructed state to foundation
            CurrentState = copyState;

            //// Update house price
            //Price = newPrice;

            // Remove design context
            DesignContext.Remove(from);

            // Notify the client that customization has ended
            from.Send(new EndHouseCustomization(this));

            // Notify the core that the foundation has changed and should be resent to all clients
            Delta(ItemDelta.Update);
            ProcessDelta();
            CurrentState.SendDetailedInfoTo(from.NetState);

            // If a signpost is needed, add it
            CheckSignpost();

            // Eject all from house
            from.RevealingAction();

            foreach (Item item in GetItems())
                item.Location = BanLocation;

            foreach (Mobile mobile in GetMobiles())
                mobile.Location = BanLocation;

            // Restore relocated entities
            RestoreRelocatedEntities();
        }
开发者ID:zerodowned,项目名称:justuo-with-ec-support,代码行数:65,代码来源:HouseFoundation.cs

示例4: EndConfirmCommit

        public void EndConfirmCommit(Mobile from)
        {
            int oldPrice = this.Price;
            int newPrice = oldPrice + this.CustomizationCost + ((this.DesignState.Components.List.Length - (this.CurrentState.Components.List.Length + this.CurrentState.Fixtures.Length)) * 500);
            int cost = newPrice - oldPrice;

            if (!this.Deleted)
            { // Temporary Fix. We should be booting a client out of customization mode in the delete handler.
                if (from.AccessLevel >= AccessLevel.GameMaster && cost != 0)
                {
                    from.SendMessage("{0} gold would have been {1} your bank if you were not a GM.", cost.ToString(), ((cost > 0) ? "withdrawn from" : "deposited into"));
                }
                else
                {
                    if (cost > 0)
                    {
                        if (Banker.Withdraw(from, cost))
                        {
                            from.SendLocalizedMessage(1060398, cost.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1061903); // You cannot commit this house design, because you do not have the necessary funds in your bank box to pay for the upgrade.  Please back up your design, obtain the required funds, and commit your design again.
                            return;
                        }
                    }
                    else if (cost < 0)
                    {
                        if (Banker.Deposit(from, -cost))
                            from.SendLocalizedMessage(1060397, (-cost).ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box.
                        else
                            return;
                    }
                }
            }

            /* Client chose to commit current design state
            *  - Commit design state
            *     - Construct a copy of the current design state
            *     - Clear visible fixtures
            *     - Melt fixtures from constructed state
            *     - Add melted fixtures from constructed state
            *     - Assign constructed state to foundation
            *  - Update house price
            *  - Remove design context
            *  - Notify the client that customization has ended
            *  - Notify the core that the foundation has changed and should be resent to all clients
            *  - If a signpost is needed, add it
            *  - Eject all from house
            *  - Restore relocated entities
            */

            // Commit design state : Construct a copy of the current design state
            DesignState copyState = new DesignState(this.DesignState);

            // Commit design state : Clear visible fixtures
            this.ClearFixtures(from);

            // Commit design state : Melt fixtures from constructed state
            copyState.MeltFixtures();

            // Commit design state : Add melted fixtures from constructed state
            this.AddFixtures(from, copyState.Fixtures);

            // Commit design state : Assign constructed state to foundation
            this.CurrentState = copyState;

            // Update house price
            this.Price = newPrice - this.CustomizationCost;

            // Remove design context
            DesignContext.Remove(from);

            // Notify the client that customization has ended
            from.Send(new EndHouseCustomization(this));

            // Notify the core that the foundation has changed and should be resent to all clients
            this.Delta(ItemDelta.Update);
            this.ProcessDelta();
            this.CurrentState.SendDetailedInfoTo(from.NetState);

            // If a signpost is needed, add it
            this.CheckSignpost();

            // Eject all from house
            from.RevealingAction();

            foreach (Item item in this.GetItems())
                item.Location = this.BanLocation;

            foreach (Mobile mobile in this.GetMobiles())
                mobile.Location = this.BanLocation;

            // Restore relocated entities
            this.RestoreRelocatedEntities();
        }
开发者ID:jasegiffin,项目名称:JustUO,代码行数:96,代码来源:HouseFoundation.cs

示例5: EndConfirmCommit

		public void EndConfirmCommit(Mobile from)
		{
			int oldPrice = Price;
			int newPrice = oldPrice + CustomizationCost +
						   ((DesignState.Components.List.Length - (CurrentState.Components.List.Length + CurrentState.Fixtures.Length)) *
							500);
			int cost = newPrice - oldPrice;

			if (!Deleted)
			{
				// Temporary Fix. We should be booting a client out of customization mode in the delete handler.
				if (from.AccessLevel >= AccessLevel.GameMaster && cost != 0)
				{
					from.SendMessage("Staff may commit freely, no charges or rebates.");
				}
				else
				{
					Type cType = Expansion == Expansion.T2A ? typeof(Silver) : typeof(Gold);

					if (cost > 0)
					{
						if (Banker.Withdraw(from, cType, cost))
						{
							from.SendMessage("{0:#,0} {1} has been withdrawn from your bank box.", cost, cType.Name);
						}
						else
						{
							// You cannot commit this house design, because you do not have the necessary funds in your bank box to pay for the upgrade.  
							// Please back up your design, obtain the required funds, and commit your design again.
							from.SendLocalizedMessage(1061903);
							return;
						}
					}
					else if (cost < 0)
					{
						cost = Math.Abs(cost);

						if (Banker.Deposit(from, cType, cost))
						{
							from.SendMessage("{0:#,0} {1} has been deposited into your bank box.", cost, cType.Name);
						}
						else
						{
							return;
						}
					}
				}
			}

			/* Client chose to commit current design state
				 *  - Commit design state
				 *     - Construct a copy of the current design state
				 *     - Clear visible fixtures
				 *     - Melt fixtures from constructed state
				 *     - Add melted fixtures from constructed state
				 *     - Assign constructed state to foundation
				 *  - Update house price
				 *  - Remove design context
				 *  - Notify the client that customization has ended
				 *  - Notify the core that the foundation has changed and should be resent to all clients
				 *  - If a signpost is needed, add it
				 *  - Eject all from house
				 *  - Restore relocated entities
				 */

			// Commit design state : Construct a copy of the current design state
			var copyState = new DesignState(DesignState);

			// Commit design state : Clear visible fixtures
			ClearFixtures(from);

			// Commit design state : Melt fixtures from constructed state
			copyState.MeltFixtures();

			// Commit design state : Add melted fixtures from constructed state
			AddFixtures(from, copyState.Fixtures);

			// Commit design state : Assign constructed state to foundation
			CurrentState = copyState;

			// Update house price
			Price = newPrice - CustomizationCost;

			// Remove design context
			DesignContext.Remove(from);

			// Notify the client that customization has ended
			from.Send(new EndHouseCustomization(this));

			// Notify the core that the foundation has changed and should be resent to all clients
			Delta(ItemDelta.Update);
			ProcessDelta();
			CurrentState.SendDetailedInfoTo(from.NetState);

			// If a signpost is needed, add it
			CheckSignpost();

			// Eject all from house
			from.RevealingAction();

//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:101,代码来源:HouseFoundation.cs


注:本文中的Server.Multis.DesignState.MeltFixtures方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。