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


C# ITerrainChannel.GetSerialised方法代码示例

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


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

示例1: LoadWorldWaterMap

        /// <summary>
        /// Loads the World heightmap
        /// </summary>
        public void LoadWorldWaterMap()
        {
            if (!m_use3DWater)
                return;
            try
            {
                short[] map = m_scene.SimulationDataService.LoadWater(m_scene.RegionInfo.RegionID, false, m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY);
                if (map == null)
                {
                    m_log.Info("[TERRAIN]: No default water. Generating a new water.");
                    m_waterChannel = new TerrainChannel(m_scene);

                    m_scene.SimulationDataService.StoreWater(m_waterChannel.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, false);
                }
                else
                {
                    m_channel = new TerrainChannel(map, m_scene);
                }
            }
            catch (IOException e)
            {
                m_log.Warn("[TERRAIN]: LoadWorldWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
                // Non standard region size.    If there's an old terrain in the database, it might read past the buffer
                if (m_scene.RegionInfo.RegionSizeX != Constants.RegionSize || m_scene.RegionInfo.RegionSizeY != Constants.RegionSize)
                {
                    m_waterChannel = new TerrainChannel(m_scene);

                    m_scene.SimulationDataService.StoreWater(m_waterChannel.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, false);
                }
            }
            catch (IndexOutOfRangeException e)
            {
                m_log.Warn("[TERRAIN]: LoadWorldWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
                m_waterChannel = new TerrainChannel(m_scene);

                m_scene.SimulationDataService.StoreWater(m_waterChannel.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, false);
            }
            catch (ArgumentOutOfRangeException e)
            {
                m_log.Warn("[TERRAIN]: LoadWorldWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
                m_waterChannel = new TerrainChannel(m_scene);

                m_scene.SimulationDataService.StoreWater(m_waterChannel.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, false);
            }
            catch (Exception e)
            {
                m_log.Warn("[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception " + e.ToString());
                m_waterChannel = new TerrainChannel(m_scene);

                m_scene.SimulationDataService.StoreWater(m_waterChannel.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, false);
            }
            LoadRevertWaterMap();
        }
开发者ID:kow,项目名称:Aurora-Sim,代码行数:56,代码来源:TerrainModule.cs

示例2: WriteTerrainToStream

 private static byte[] WriteTerrainToStream(ITerrainChannel tModule)
 {
     int tMapSize = tModule.Height*tModule.Height;
     byte[] sdata = new byte[tMapSize*2];
     Buffer.BlockCopy(tModule.GetSerialised(), 0, sdata, 0, sdata.Length);
     return sdata;
 }
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:7,代码来源:Backup.cs

示例3: LoadRevertWaterMap

        /// <summary>
        /// Loads the World Revert heightmap
        /// </summary>
        public void LoadRevertWaterMap()
        {
            try
            {
                short[] map = m_scene.SimulationDataService.LoadWater(m_scene.RegionInfo.RegionID, true, m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY);
                if (map == null)
                {
                    m_waterRevert = m_waterChannel.MakeCopy();

                    m_scene.SimulationDataService.StoreWater(m_waterRevert.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, true);
                }
                else
                {
                    m_waterRevert = new TerrainChannel(map, m_scene);
                }
            }
            catch (IOException e)
            {
                m_log.Warn("[TERRAIN]: LoadRevertWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
                // Non standard region size.    If there's an old terrain in the database, it might read past the buffer
                if (m_scene.RegionInfo.RegionSizeX != Constants.RegionSize || m_scene.RegionInfo.RegionSizeY != Constants.RegionSize)
                {
                    m_waterRevert = m_waterChannel.MakeCopy();

                    m_scene.SimulationDataService.StoreWater(m_waterRevert.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, true);
                }
            }
            catch (IndexOutOfRangeException e)
            {
                m_log.Warn("[TERRAIN]: LoadRevertWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
                m_waterRevert = m_waterChannel.MakeCopy();

                m_scene.SimulationDataService.StoreWater(m_waterRevert.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, true);
            }
            catch (ArgumentOutOfRangeException e)
            {
                m_log.Warn("[TERRAIN]: LoadRevertWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
                m_waterRevert = m_waterChannel.MakeCopy();

                m_scene.SimulationDataService.StoreWater(m_waterRevert.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, true);
            }
            catch (Exception e)
            {
                m_log.Warn("[TERRAIN]: LoadRevertWaterMap() - Failed with exception " + e.ToString());
                m_waterRevert = m_waterChannel.MakeCopy();

                m_scene.SimulationDataService.StoreWater(m_waterRevert.GetSerialised(m_scene), m_scene.RegionInfo.RegionID, true);
            }
        }
开发者ID:kow,项目名称:Aurora-Sim,代码行数:52,代码来源:TerrainModule.cs


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