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


C# BinaryReader.ReadSingle方法代码示例

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


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

示例1: Load

    // 바이너리 로드
    public void Load()
    {
        FileStream fs = new FileStream("SkillDB.bin", FileMode.Open);
        BinaryReader br = new BinaryReader(fs);

        // *주의
        // 바이너리 세이브 순서와 로드 순서가 같아야된다. [5/13/2012 JK]
        // 바이너리 리드
        int iCount = br.ReadInt32();        // 갯수 읽기
        for (int i = 0; i < iCount; ++i)
        {
            CSkillInfo Info = new CSkillInfo();

            Info.m_nSkillCode = br.ReadInt32();               // 스킬 고유 코드
            Info.m_strName = br.ReadString();                // 스킬 이름
            Info.m_fRange = br.ReadSingle();                 // 스킬 적용 범위
            Info.m_nDamage = br.ReadInt32();            // 스킬 데미지량
            Info.m_nHeal = br.ReadInt32();              // 스킬 힐량
            Info.m_fContinueTime = br.ReadSingle();          // 스킬 적용되는 시간
            Info.m_strPrefab = br.ReadString();             // 스킬 사용시 사용할 Prefab

            m_tmSkill.Add(Info.m_nSkillCode, Info);
        }

        fs.Close();
        br.Close();
    }
开发者ID:ditto21c,项目名称:ExampleSource,代码行数:28,代码来源:SkillDB.cs

示例2: Load

	public override void Load(BinaryReader br) {
		base.Load(br);
		dir = br.ReadBoolean() ? 1 : -1;
		height = br.ReadByte();
		sin = br.ReadSingle();
		sinSpeed = br.ReadSingle();
	}
开发者ID:mugmickey,项目名称:Terraria-tConfig-Mods,代码行数:7,代码来源:EffectFireflyHover.cs

示例3: Load

 public void Load(BinaryReader Stream)
 {
     PathTexture = Stream.ReadStringNull();
     PathNormalmap = Stream.ReadStringNull();
     ScaleTexture = Stream.ReadSingle();
     ScaleNormalmap = Stream.ReadSingle();
 }
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:7,代码来源:Layer.cs

示例4: Load

    // 바이너리 로드
    public void Load(TextAsset kTa_)
    {
        //FileStream fs = new FileStream("Assets\\Resources\\SkillDB.bytes", FileMode.Open);

        //BinaryReader br = new BinaryReader(fs);
        Stream kStream = new MemoryStream (kTa_.bytes);
        BinaryReader br = new BinaryReader(kStream);

        // *주의
        // 바이너리 세이브 순서와 로드 순서가 같아야된다. [5/13/2012 JK]
        // 바이너리 리드
        int iCount = br.ReadInt32();        // 갯수 읽기
        for (int i = 0; i < iCount; ++i)
        {
            StSkillInfo Info = new StSkillInfo();

            Info.m_nSkillCode = br.ReadInt32();               // 스킬 고유 코드
            Info.m_strName = br.ReadString();                // 스킬 이름
            Info.m_fRange = br.ReadSingle();                 // 스킬 적용 범위
            Info.m_nDamage = br.ReadInt32();            // 스킬 데미지량
            Info.m_nHeal = br.ReadInt32();              // 스킬 힐량
            Info.m_fContinueTime = br.ReadSingle();          // 스킬 적용되는 시간
            Info.m_strPrefab = br.ReadString();             // 스킬 사용시 사용할 Prefab

            m_tmSkill.Add(Info.m_nSkillCode, Info);
        }

        //fs.Close();
        br.Close();
        kStream.Close();
    }
开发者ID:ditto21c,项目名称:ExampleSource,代码行数:32,代码来源:SkillDB.cs

示例5: Load

    // 바이너리 로드
    public void Load()
    {
        FileStream fs = new FileStream("CharDB.bin", FileMode.Open);
        BinaryReader br = new BinaryReader(fs);

        // *주의
        // 바이너리 세이브 순서와 로드 순서가 같아야된다. [5/13/2012 JK]
        // 바이너리 리드
        int iCount = br.ReadInt32();        // 갯수 읽기
        for (int i = 0; i < iCount; ++i )
        {
            CCharInfo charInfo = new CCharInfo();

            charInfo.m_nCode = br.ReadInt32();          // 캐릭터 코드
            charInfo.m_strName = br.ReadString();       // 캐릭터 이름
            charInfo.m_strPrefab = br.ReadString();       // Assets 안에 있는 Prefab 텍스트명
            charInfo.m_nCharType = br.ReadInt32();      // 캐릭터 타입 0:플레이어 1:몬스터
            charInfo.m_nNowHP = br.ReadInt32();         // 현재 체력
            charInfo.m_nMaxHP = br.ReadInt32();         // 최대 체력
            charInfo.m_nCharWidth = br.ReadInt32();     // 캐릭터 넓이
            charInfo.m_fMoveSpeed = br.ReadSingle();    // 이동 속도(s) 목표지점까지 몇초만에 도착하는지
            charInfo.m_nAttackDamage = br.ReadInt32();  // 공격 데미지
            charInfo.m_nAttackRange = br.ReadInt32();   // 캐릭터 기본 사거리
            charInfo.m_fAttackSpeed = br.ReadSingle();  // 캐릭터 공격 속도 1: 1초에 한번
            charInfo.m_nExp = br.ReadInt32();           // 캐릭터가 죽었을시 제공되는 경험치
            charInfo.m_fAfterAttackIdleTermTime = br.ReadSingle(); // 공격후 Idle 유지 시간
            charInfo.m_nPay = br.ReadInt32();   // 보상(돈)
            m_mapCharacter.Add(charInfo.m_nCode, charInfo);
        }

        fs.Close();
        br.Close();
    }
开发者ID:ditto21c,项目名称:ExampleSource,代码行数:34,代码来源:CharacterDB.cs

示例6: ApplyChanges

    public override void ApplyChanges(Stream stream)
    {
        using (var reader = new BinaryReader(stream))
        {
            var stamp = reader.ReadInt64();
            var x = reader.ReadSingle();
            var y = reader.ReadSingle();
            var z = reader.ReadSingle();

            var vx = reader.ReadSingle();
            var vy = reader.ReadSingle();
            var vz = reader.ReadSingle();

            var rx = reader.ReadSingle();
            var ry = reader.ReadSingle();
            var rz = reader.ReadSingle();
            var rw = reader.ReadSingle();

            if (LastChanged < stamp)
            {
                LastChanged = stamp;
                Stormancer.MainThread.Post(() =>
                {
                    this.transform.position = new Vector3(x, y, z);
                    PlayerRigidbody.velocity = new Vector3(vx, vy, vz);
                    this.transform.rotation = new Quaternion(rx, ry, rz, rw);
                });
            }
        }
    }
开发者ID:songotony,项目名称:RType-Client,代码行数:30,代码来源:LocalPlayer.cs

示例7: LoadLevel

	/// <summary>
	/// Reads a level to a block array
	/// </summary>
	/// <param name="reader">BinaryReader to read with</param>
	/// <returns>Block array of level</returns>
	public static Block[,,] LoadLevel(BinaryReader reader) {
		//Read version number
		reader.ReadInt32();

		//Read thumbnail
		int thumbnailSize = reader.ReadInt32();
		reader.ReadBytes(thumbnailSize);

		//Read camera position
		CameraOrbit.instance.x = reader.ReadSingle();
		CameraOrbit.instance.y = reader.ReadSingle();
		CameraOrbit.instance.distance = reader.ReadSingle();

		CameraOrbit.instance.smoothX = CameraOrbit.instance.x;
		CameraOrbit.instance.smoothY = CameraOrbit.instance.y;
		CameraOrbit.instance.smoothDistance = CameraOrbit.instance.distance;

		float cameraX = reader.ReadSingle();
		float cameraZ = reader.ReadSingle();
		CameraMove.instance.floor = reader.ReadInt32();
		CameraMove.instance.transform.position = new Vector3(cameraX, CameraMove.instance.floor, cameraZ);

		//Read block ids
		List<Block> blockList = new List<Block>();

		short blockListCount = reader.ReadInt16();

		for (short i = 0; i < blockListCount; i++) {
            blockList.Add(BlockManager.GetBlock(reader.ReadString()));
		}

		//Read number of blocks
		int blockCount = reader.ReadInt32();

		//Read blocks
		Block[,,] blocks = new Block[World.worldBlockSize, World.worldBlockSize, World.worldBlockSize];
		for (int x = 0; x < World.worldBlockSize; x++) {
			for (int y = 0; y < World.worldBlockSize; y++) {
				for (int z = 0; z < World.worldBlockSize; z++) {
					blocks[x, y, z] = new AirBlock();
				}
			}
		}

		for (int i = 0; i < blockCount; i++) {
			byte x = reader.ReadByte();
			byte y = reader.ReadByte();
			byte z = reader.ReadByte();
			byte rotation = reader.ReadByte();
			short blockId = reader.ReadInt16();

			blocks[x, y, z] = blockList[blockId].Copy();
			blocks[x, y, z].rotation = rotation;
		}

		reader.Close();
		return blocks;
	}
开发者ID:platformed,项目名称:Platformed-Game,代码行数:63,代码来源:LevelSerializer.cs

示例8: Load

	public override void Load(BinaryReader br) {
		base.Load(br);
		hue = br.ReadSingle();
		hueSpeed = br.ReadSingle();
		
		rot1 = br.ReadSingle();
		rotSpeed1 = br.ReadSingle();
		flipped = br.ReadBoolean();
	}
开发者ID:mugmickey,项目名称:Terraria-tConfig-Mods,代码行数:9,代码来源:EffectFireflyRainbow.cs

示例9: Parse

	static public bool Parse(BinaryReader br, string id)
	{
		switch ( id )
		{
			case "Num":
				int num = br.ReadInt32();
				con.Keys = new MegaBezFloatKey[num];
				con.Times = new float[num];
				break;

			case "Keys":
				for ( int i = 0; i < con.Keys.Length; i++ )
				{
					con.Keys[i] = new MegaBezFloatKey();
					con.Keys[i].val = br.ReadSingle();
					con.Keys[i].intan = br.ReadSingle();
					con.Keys[i].outtan = br.ReadSingle();
					con.Times[i] = br.ReadSingle();
				}
				con.InitKeys();
				break;

			case "BKeys":	// Blender keys
				Vector2 co = Vector2.zero;
				Vector2 left = Vector2.zero;
				Vector3 right = Vector2.zero;

				Vector2 pco = Vector2.zero;
				Vector2 pleft = Vector2.zero;
				Vector3 pright = Vector2.zero;

				for ( int i = 0; i < con.Keys.Length; i++ )
				{
					con.Keys[i] = new MegaBezFloatKey();

					co.x = br.ReadSingle();
					co.y = br.ReadSingle();

					left.x = br.ReadSingle();
					left.y = br.ReadSingle();

					right.x = br.ReadSingle();
					right.y = br.ReadSingle();

					if ( i > 0 )
						con.MakeKey(con.Keys[i - 1], pco, pleft, pright, co, left, right);

					pco = co;
					pleft = left;
					pright = right;
					con.Times[i] = co.x / 30.0f;
				}
				break;
		}

		return true;
	}
开发者ID:Gounemond,项目名称:BretarisDemo,代码行数:57,代码来源:MegaParseEditor.cs

示例10: Load

	public override void Load(BinaryReader br) {
		base.Load(br);
		color = NetworkHelper.ReadColor(br);
		rot1 = br.ReadSingle();
		rotSpeed1 = br.ReadSingle();
		rot2 = br.ReadSingle();
		rotSpeed2 = br.ReadSingle();
		chaos = br.ReadBoolean();
	}
开发者ID:mugmickey,项目名称:Terraria-tConfig-Mods,代码行数:9,代码来源:EffectFireflyCorrupt.cs

示例11: ReadVector3

	static public Vector3 ReadVector3(BinaryReader br)
	{
		Vector3 p = Vector3.zero;

		p.x = br.ReadSingle();
		p.y = br.ReadSingle();
		p.z = br.ReadSingle();

		return p;
	}
开发者ID:Gounemond,项目名称:BretarisDemo,代码行数:10,代码来源:MegaFlowRealFlow.cs

示例12: Load

	public override void Load(BinaryReader br) {
		base.Load(br);
		type = br.ReadByte();
		color1 = NetworkHelper.ReadColor(br);
		color2 = NetworkHelper.ReadColor(br);
		rot1 = br.ReadSingle();
		rotSpeed1 = br.ReadSingle();
		rot2 = br.ReadSingle();
		rotSpeed2 = br.ReadSingle();
	}
开发者ID:mugmickey,项目名称:Terraria-tConfig-Mods,代码行数:10,代码来源:EffectFireflyFlame.cs

示例13: ReadP3

    public static Vector3 ReadP3(BinaryReader br)
    {
        Vector3 v = Vector3.zero;

        v.x = br.ReadSingle();
        v.y = br.ReadSingle();
        v.z = br.ReadSingle();

        return v;
    }
开发者ID:mobeid,项目名称:NP_SIMULATOR,代码行数:10,代码来源:MegaParseEditor.cs

示例14: Read

 public void Read(BinaryReader reader)
 {
     ID=reader.ReadInt32();
     Name=reader.ReadStringNative();
     IP = reader.ReadStringNative();
     Location = reader.ReadStringNative();
     lng=reader.ReadSingle();
     lat=reader.ReadSingle();
     Connected=reader.ReadBoolean();
     Available=reader.ReadBoolean();
 }
开发者ID:mrayy,项目名称:Telexistence-Gateway,代码行数:11,代码来源:RobotInfo.cs

示例15: Load

    public static void Load(string Path)
    {
        if (!File.Exists(Configuration.GameResources + "\\" + Path + "\\" + "cache.bin"))
            throw new FileNotFoundException("Файл бэйсов не найден. Проверьте правильность пути.");

        BinReader = new BinaryReader(File.OpenRead(Configuration.GameResources + "\\" + Path + "\\" + "cache.bin"));

        if (BinReader.ReadInt16() != 500)
            throw new FileLoadException("Неверная сигнатура файла.");

        if (BinReader.ReadInt32() != BinReader.BaseStream.Length)
            throw new FileLoadException("В заголовке указан неверный размер файла.");

        BinReader.BaseStream.Seek(4, SeekOrigin.Current); // Константа - 01 00 00 00

        while (BinReader.BaseStream.Position < BinReader.BaseStream.Length)
        {
            long TmpPosition = BinReader.BaseStream.Position;

            if (BinReader.ReadInt16() != 1000)
                throw new FileLoadException("Неверная сигнатура бейса. " + BinReader.BaseStream.Position);

            int BlockSize = BinReader.ReadInt32();
            GameObject Base = GameObject.Find(new string(BinReader.ReadChars(BinReader.ReadInt32())));

            BinReader.BaseStream.Seek(0x4C, SeekOrigin.Current); // unknown

            while (BinReader.BaseStream.Position < (TmpPosition + BlockSize))
            {
                if (BinReader.ReadInt16() != 2000)
                    throw new FileLoadException("Неверная сигнатура объекта." + BinReader.BaseStream.Position);

                BinReader.BaseStream.Seek(4, SeekOrigin.Current);

                string ObjectName = new string(BinReader.ReadChars(BinReader.ReadInt32()))
                    .Replace(".I3D", "").Replace(".i3d", "");

                GameObject Object = ModelSceneLoader.Load("models" + "\\" + ObjectName);
                Object.transform.parent = Base.transform;

                Object.transform.position = new Vector3(BinReader.ReadSingle(), BinReader.ReadSingle(), BinReader.ReadSingle()) * Configuration.ScaleFactor;
                Object.transform.rotation = new wxyz_s(BinReader.ReadSingle(), BinReader.ReadSingle(), BinReader.ReadSingle(), BinReader.ReadSingle()).ToQuat();
                Object.transform.localScale = new Vector3(BinReader.ReadSingle(), BinReader.ReadSingle(), BinReader.ReadSingle());

                BinReader.BaseStream.Seek(16, SeekOrigin.Current); // unknown
            }
        }
    }
开发者ID:nkarpey,项目名称:Mafia-Resources-Loader,代码行数:48,代码来源:CacheBinLoader.cs


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