當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。