當前位置: 首頁>>代碼示例>>C#>>正文


C# Multis.DesignState類代碼示例

本文整理匯總了C#中Server.Multis.DesignState的典型用法代碼示例。如果您正苦於以下問題:C# DesignState類的具體用法?C# DesignState怎麽用?C# DesignState使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DesignState類屬於Server.Multis命名空間,在下文中一共展示了DesignState類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TryInsertIntoState

        private static bool TryInsertIntoState(DesignState state, int itemID, int x, int y, int z)
        {
            MultiComponentList mcl = state.Components;

            if (x < mcl.Min.X || y < mcl.Min.Y || x > mcl.Max.X || y > mcl.Max.Y)
                return false;

            mcl.Add(itemID, x, y, z);
            state.OnRevised();

            return true;
        }
開發者ID:FreeReign,項目名稱:forkuo,代碼行數:12,代碼來源:DesignInsert.cs

示例2: SendDetails

 public static void SendDetails( NetState ns, HouseFoundation house, DesignState state )
 {
     m_SendQueue.Enqueue( new SendQueueEntry( ns, house, state ) );
     m_Sync.Set();
 }
開發者ID:BackupTheBerlios,項目名稱:sunuo-svn,代碼行數:5,代碼來源:HouseFoundation.cs

示例3: DesignState

        public DesignState( DesignState toCopy )
        {
            m_Foundation = toCopy.m_Foundation;
            m_Components = new MultiComponentList( toCopy.m_Components );
            m_Revision = toCopy.m_Revision;
            m_Fixtures = new MultiTileEntry[toCopy.m_Fixtures.Length];

            for ( int i = 0; i < m_Fixtures.Length; ++i )
                m_Fixtures[i] = toCopy.m_Fixtures[i];
        }
開發者ID:BackupTheBerlios,項目名稱:sunuo-svn,代碼行數:10,代碼來源:HouseFoundation.cs

示例4: SetInitialState

 public void SetInitialState()
 {
     // This is a new house, it has not yet loaded a design state
     m_Current = new DesignState( this, GetEmptyFoundation() );
     m_Design = new DesignState( m_Current );
     m_Backup = new DesignState( m_Current );
 }
開發者ID:BackupTheBerlios,項目名稱:sunuo-svn,代碼行數:7,代碼來源:HouseFoundation.cs

示例5: 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

示例6: Deserialize

        public override void Deserialize( GenericReader reader )
        {
            int version = reader.ReadInt();

            switch ( version )
            {
                case 5:
                case 4:
                {
                    m_Signpost = reader.ReadItem();
                    m_SignpostGraphic = reader.ReadInt();

                    goto case 3;
                }
                case 3:
                {
                    m_Type = (FoundationType)reader.ReadInt();

                    goto case 2;
                }
                case 2:
                {
                    m_SignHanger = reader.ReadItem();

                    goto case 1;
                }
                case 1:
                {
                    if ( version < 5 )
                        m_DefaultPrice = reader.ReadInt();

                    goto case 0;
                }
                case 0:
                {
                    if ( version < 3 )
                        m_Type = FoundationType.Stone;

                    if ( version < 4 )
                        m_SignpostGraphic = 9;

                    m_LastRevision = reader.ReadInt();
                    m_Fixtures = reader.ReadItemList();

                    m_Current = new DesignState( this, reader );
                    m_Design = new DesignState( this, reader );
                    m_Backup = new DesignState( this, reader );

                    break;
                }
            }

            base.Deserialize( reader );
        }
開發者ID:BackupTheBerlios,項目名稱:sunuo-svn,代碼行數:54,代碼來源:HouseFoundation.cs

示例7: Designer_Revert

        public static void Designer_Revert( NetState state, IEntity e, EncodedReader pvSrc )
        {
            Mobile from = state.Mobile;
            DesignContext context = DesignContext.Find( from );

            if ( context != null )
            {
                /* Client chose to revert design state to currently visible state
                 *  - Revert design state
                 *     - Construct a copy of the current visible state
                 *     - Freeze fixtures in constructed state
                 *     - Assign constructed state to foundation
                 *     - If a signpost is needed, add it
                 *  - Update revision
                 *  - Update client with new state
                 */

                // Revert design state : Construct a copy of the current visible state
                DesignState copyState = new DesignState( context.Foundation.CurrentState );

                // Revert design state : Freeze fixtures in constructed state
                copyState.FreezeFixtures();

                // Revert design state : Assign constructed state to foundation
                context.Foundation.DesignState = copyState;

                // Revert design state : If a signpost is needed, add it
                context.Foundation.CheckSignpost();

                // Update revision
                copyState.OnRevised();

                // Update client with new state
                context.Foundation.SendInfoTo( state );
                copyState.SendDetailedInfoTo( state );
            }
        }
開發者ID:BackupTheBerlios,項目名稱:sunuo-svn,代碼行數:37,代碼來源:HouseFoundation.cs

示例8: Designer_Backup

        public static void Designer_Backup( NetState state, IEntity e, EncodedReader pvSrc )
        {
            Mobile from = state.Mobile;
            DesignContext context = DesignContext.Find( from );

            if ( context != null )
            {
                /* Client chose to backup design state
                 *  - Construct a copy of the current design state
                 *  - Assign constructed state to backup state field
                 */

                // Construct a copy of the current design state
                DesignState copyState = new DesignState( context.Foundation.DesignState );

                // Assign constructed state to backup state field
                context.Foundation.BackupState = copyState;
            }
        }
開發者ID:BackupTheBerlios,項目名稱:sunuo-svn,代碼行數:19,代碼來源:HouseFoundation.cs

示例9: Designer_Clear

        public static void Designer_Clear( NetState state, IEntity e, EncodedReader pvSrc )
        {
            Mobile from = state.Mobile;
            DesignContext context = DesignContext.Find( from );

            if ( context != null )
            {
                /* Client chose to clear the design
                 *  - Restore empty foundation
                 *     - Construct new design state from empty foundation
                 *     - Assign constructed state to foundation
                 *  - Update revision
                 *  - Update client with new state
                 */

                // Restore empty foundation : Construct new design state from empty foundation
                DesignState newDesign = new DesignState( context.Foundation, context.Foundation.GetEmptyFoundation() );

                // Restore empty foundation : Assign constructed state to foundation
                context.Foundation.DesignState = newDesign;

                // Update revision
                newDesign.OnRevised();

                // Update client with new state
                context.Foundation.SendInfoTo( state );
                newDesign.SendDetailedInfoTo( state );
            }
        }
開發者ID:BackupTheBerlios,項目名稱:sunuo-svn,代碼行數:29,代碼來源:HouseFoundation.cs

示例10: 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

示例11: 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

示例12: 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

示例13: SetInitialState

        public override void SetInitialState()
        {
            m_Current = new DesignState(this, GetEmptyFoundation());

            // explicitly unused in StaticHousing
			m_Design = null;
			m_Backup = null;
            
            //init the other two design states just so they don't crash the base's serilization      
            MultiComponentList y = new MultiComponentList(m_Current.Components);
            MultiComponentList x = new MultiComponentList(StaticHouseHelper.GetComponents(m_HouseBlueprintID));
            
            //merge x into y.
            //first, remove all in y
            for (int i = y.List.Length - 1; i >= 0; i--)
            {
                y.Remove(y.List[i].m_ItemID, y.List[i].m_OffsetX, y.List[i].m_OffsetY, y.List[i].m_OffsetZ);
            }

            //then add all the ones we want to the list
            for (int i = 0; i < x.List.Length; ++i)
            {
                y.Add(x.List[i].m_ItemID, x.List[i].m_OffsetX, x.List[i].m_OffsetY, x.List[i].m_OffsetZ,true);
            }

            m_Current.Components = y;

			return;
        }
開發者ID:zerodowned,項目名稱:angelisland,代碼行數:29,代碼來源:StaticHouse.cs

示例14: 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

示例15: SendQueueEntry

            public SendQueueEntry( NetState ns, HouseFoundation foundation, DesignState state )
            {
                m_NetState = ns;
                m_Serial = foundation.Serial;
                m_Revision = state.Revision;
                m_Root = state;

                MultiComponentList mcl = state.Components;

                m_xMin = mcl.Min.X;
                m_yMin = mcl.Min.Y;
                m_xMax = mcl.Max.X;
                m_yMax = mcl.Max.Y;

                m_Tiles = mcl.List;
            }
開發者ID:BackupTheBerlios,項目名稱:sunuo-svn,代碼行數:16,代碼來源:HouseFoundation.cs


注:本文中的Server.Multis.DesignState類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。