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


C# World.GetNpc方法代码示例

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


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

示例1: SaveV1


//.........这里部分代码省略.........
            bw.Write(world.SavedWizard);
            bw.Write(world.SavedMech);
            bw.Write(world.DownedGoblins);
            bw.Write(world.DownedClown);
            bw.Write(world.DownedFrost);
            bw.Write(world.DownedPirates);

            bw.Write(world.ShadowOrbSmashed);
            bw.Write(world.SpawnMeteor);
            bw.Write((byte) world.ShadowOrbCount);
            bw.Write(world.AltarCount);
            bw.Write(world.HardMode);
            bw.Write(world.InvasionDelay);
            bw.Write(world.InvasionSize);
            bw.Write(world.InvasionType);
            bw.Write(world.InvasionX);

            bw.Write(world.TempRaining);
            bw.Write(world.TempRainTime);
            bw.Write(world.TempMaxRain);
            bw.Write(world.OreTier1);
            bw.Write(world.OreTier2);
            bw.Write(world.OreTier3);
            bw.Write(world.BgTree);
            bw.Write(world.BgCorruption);
            bw.Write(world.BgJungle);
            bw.Write(world.BgSnow);
            bw.Write(world.BgHallow);
            bw.Write(world.BgCrimson);
            bw.Write(world.BgDesert);
            bw.Write(world.BgOcean);
            bw.Write((int) world.CloudBgActive);
            bw.Write(world.NumClouds);
            bw.Write(world.WindSpeedSet);


            for (int x = 0; x < world.TilesWide; ++x)
            {
                OnProgressChanged(world,
                    new ProgressChangedEventArgs(x.ProgressPercentage(world.TilesWide), "Saving UndoTiles..."));

                int rle = 0;
                for (int y = 0; y < world.TilesHigh; y = y + rle + 1)
                {
                    Tile curTile = world.Tiles[x, y];
                    WriteTileDataToStreamV1(curTile, bw);

                    int rleTemp = 1;
                    while (y + rleTemp < world.TilesHigh && curTile.Equals(world.Tiles[x, (y + rleTemp)]))
                        ++rleTemp;
                    rle = rleTemp - 1;
                    bw.Write((short) rle);
                }
            }
            OnProgressChanged(null, new ProgressChangedEventArgs(100, "Saving Chests..."));
            WriteChestDataToStreamV1(world.Chests, bw);
            OnProgressChanged(null, new ProgressChangedEventArgs(100, "Saving Signs..."));
            WriteSignDataToStreamV1(world.Signs, bw);
            OnProgressChanged(null, new ProgressChangedEventArgs(100, "Saving NPC Data..."));
            foreach (NPC curNpc in world.NPCs)
            {
                bw.Write(true);
                bw.Write(curNpc.Name);
                bw.Write(curNpc.Position.X);
                bw.Write(curNpc.Position.Y);
                bw.Write(curNpc.IsHomeless);
                bw.Write(curNpc.Home.X);
                bw.Write(curNpc.Home.Y);
            }
            bw.Write(false);


            OnProgressChanged(null, new ProgressChangedEventArgs(100, "Saving NPC Names..."));

            world.FixNpcs();

            bw.Write(world.GetNpc(17).Name);
            bw.Write(world.GetNpc(18).Name);
            bw.Write(world.GetNpc(19).Name);
            bw.Write(world.GetNpc(20).Name);
            bw.Write(world.GetNpc(22).Name);
            bw.Write(world.GetNpc(54).Name);
            bw.Write(world.GetNpc(38).Name);
            bw.Write(world.GetNpc(107).Name);
            bw.Write(world.GetNpc(108).Name);
            bw.Write(world.GetNpc(124).Name);
            bw.Write(world.GetNpc(160).Name);
            bw.Write(world.GetNpc(178).Name);
            bw.Write(world.GetNpc(207).Name);
            bw.Write(world.GetNpc(208).Name);
            bw.Write(world.GetNpc(209).Name);
            bw.Write(world.GetNpc(227).Name);
            bw.Write(world.GetNpc(228).Name);
            bw.Write(world.GetNpc(229).Name);

            OnProgressChanged(null, new ProgressChangedEventArgs(100, "Saving Validation Data..."));
            bw.Write(true);
            bw.Write(world.Title);
            bw.Write(world.WorldId);
        }
开发者ID:liquidradio,项目名称:Terraria-Map-Editor,代码行数:101,代码来源:World.FileV1.cs


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