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


C# SaveMetrics.OnMobileSaved方法代码示例

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


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

示例1: SaveMobiles

		protected void SaveMobiles( SaveMetrics metrics ) {
			Dictionary<Serial, Mobile> mobiles = World.Mobiles;

			GenericWriter idx;
			GenericWriter tdb;
			GenericWriter bin;

			if ( World.SaveType == World.SaveOption.Normal ) {
				idx = new BinaryFileWriter( World.MobileIndexPath, false );
				tdb = new BinaryFileWriter( World.MobileTypesPath, false );
				bin = new BinaryFileWriter( World.MobileDataPath, true );
			} else {
				idx = new AsyncWriter( World.MobileIndexPath, false );
				tdb = new AsyncWriter( World.MobileTypesPath, false );
				bin = new AsyncWriter( World.MobileDataPath, true );
			}

			idx.Write( ( int ) mobiles.Count );
			foreach ( Mobile m in mobiles.Values ) {
				long start = bin.Position;

				idx.Write( ( int ) m.m_TypeRef );
				idx.Write( ( int ) m.Serial );
				idx.Write( ( long ) start );

				m.Serialize( bin );

				if ( metrics != null ) {
					metrics.OnMobileSaved( ( int ) ( bin.Position - start ) );
				}

				idx.Write( ( int ) ( bin.Position - start ) );

				m.FreeCache();
			}

			tdb.Write( ( int ) World.m_MobileTypes.Count );

			for ( int i = 0; i < World.m_MobileTypes.Count; ++i )
				tdb.Write( World.m_MobileTypes[i].FullName );

			idx.Close();
			tdb.Close();
			bin.Close();
		}
开发者ID:PepeBiondi,项目名称:runsa,代码行数:45,代码来源:StandardSaveStrategy.cs

示例2: SaveMobiles

		protected void SaveMobiles(SaveMetrics metrics)
		{
			Dictionary<Serial, Mobile> mobiles = World.Mobiles;

			GenericWriter idx;
			GenericWriter tdb;
			GenericWriter bin;

			if (UseSequentialWriters)
			{
				idx = new BinaryFileWriter(World.MobileIndexPath, false);
				tdb = new BinaryFileWriter(World.MobileTypesPath, false);
				bin = new BinaryFileWriter(World.MobileDataPath, true);
			}
			else
			{
				idx = new AsyncWriter(World.MobileIndexPath, false);
				tdb = new AsyncWriter(World.MobileTypesPath, false);
				bin = new AsyncWriter(World.MobileDataPath, true);
			}

			idx.Write(mobiles.Count);

			foreach (Mobile m in mobiles.Values)
			{
				long start = bin.Position;

				idx.Write(m._TypeRef);
				idx.Write(m.Serial);
				idx.Write(start);

				m.Serialize(bin);

				if (metrics != null)
				{
					metrics.OnMobileSaved((int)(bin.Position - start));
				}

				idx.Write((int)(bin.Position - start));

				m.FreeCache();
			}

			tdb.Write(World.m_MobileTypes.Count);

			foreach (Type t in World.m_MobileTypes)
			{
				tdb.Write(t.FullName);
			}

			idx.Close();
			tdb.Close();
			bin.Close();
		}
开发者ID:rokann,项目名称:JustUO,代码行数:54,代码来源:StandardSaveStrategy.cs

示例3: SaveCores

        protected void SaveCores(SaveMetrics metrics)
        {
            Dictionary<CustomSerial, BaseCore> cores = World.Cores;

            GenericWriter indexWriter;
            GenericWriter typeWriter;
            GenericWriter dataWriter;

            if (this.UseSequentialWriters)
            {
                indexWriter = new BinaryFileWriter(World.CoreIndexPath, false);
                typeWriter = new BinaryFileWriter(World.CoreTypesPath, false);
                dataWriter = new BinaryFileWriter(World.CoresDataPath, true);
            }
            else
            {
                indexWriter = new AsyncWriter(World.CoreIndexPath, false);
                typeWriter = new AsyncWriter(World.CoreTypesPath, false);
                dataWriter = new AsyncWriter(World.CoresDataPath, true);
            }

            indexWriter.Write(cores.Count);

            foreach (BaseCore core in cores.Values)
            {
                long start = dataWriter.Position;

                indexWriter.Write(core._TypeID);
                indexWriter.Write((int)core.Serial);
                indexWriter.Write(start);

                core.Serialize(dataWriter);

                if (metrics != null)
                    metrics.OnMobileSaved((int)(dataWriter.Position - start));

                indexWriter.Write((int)(dataWriter.Position - start));
            }

            typeWriter.Write(World._CoreTypes.Count);

            for (int i = 0; i < World._CoreTypes.Count; ++i)
                typeWriter.Write(World._CoreTypes[i].FullName);

            indexWriter.Close();
            typeWriter.Close();
            dataWriter.Close();
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:48,代码来源:StandardSaveStrategy.cs


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