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


C# BinaryReader.readColor方法代码示例

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


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

示例1: LoadMap

    internal IEnumerator LoadMap(string s, Action onError = null, Action onLoaded = null)
    {
        mapLoading = true;
        loadMap = null;
        unityMap = "";
        swirl = 0;
        scale = 1;
        print(mainSite + s);
        WWW www = new WWW(mainSite + s);
        yield return www;
        if (!string.IsNullOrEmpty(www.error)) { if (onError != null) onError(); yield break; }
        BinaryReader ms = new BinaryReader(www.bytes);
        Debug.LogWarning("Loading Map " + ms.Length + " " + s);
        int version = 0;
        Dictionary<int, CurvySpline2> saveIds = new Dictionary<int, CurvySpline2>();
        //bool ingame = _Game != null;
        //HashSet<KeyValuePair<Vector3, string>> cells = new HashSet<KeyValuePair<Vector3, string>>();
        ModelObject modelObject = null;
        var enumType = typeof(LevelPackets);
        //var levelPackets = Enum.GetValues(enumType);
        LevelPackets P, oldP = LevelPackets.Unknown;
        while (ms.Position < ms.Length)
        {
            try
            {
                P = (LevelPackets)ms.ReadInt();
                if (!Enum.IsDefined(enumType, P))
                {
                    ms.Position++;
                    if (isDebug)
                        Debug.LogError("wrong Levelpacked " + oldP);
                    else
                        Loader.errors++;
                    P = (LevelPackets)ms.ReadInt();
                    if (!Enum.IsDefined(enumType, P))
                    {
                        ms.Position--;
                        continue;
                    }

                }
            }
            catch (Exception e)
            {
                Debug.LogError(e);
                continue;
            }
            oldP = P;

            if (P == LevelPackets.unityMap)
            {
                var map = ms.ReadString();
                yield return StartCoroutine(LoadUnityMap(map));
            }

            if (P == LevelPackets.Spline)
                yield return StartCoroutine(CreateSpline());


            if (P == LevelPackets.shape)
            {
                yield return StartCoroutine(CreateSpline(null, true));
                spline.CreatePivot(ms.ReadVector());
                spline.saveId = ms.ReadInt();
                saveIds[spline.saveId] = spline;
                spline.tunnel = ms.ReadBool();
                spline.materialId = ms.ReadInt();
                spline.color = ms.readColor();
                spline.name = ms.ReadString();
            }
            try
            {
                if (P == LevelPackets.flatTerrain)
                    SetFlatTerrain(true);
                if (P == LevelPackets.ClosedSpline)
                    spline.Closed = true;

                if (P == LevelPackets.CheckPoint2)
                {
                    var t = SetCheckPoint(ms.ReadVector());
                    t.eulerAngles = ms.ReadVector();
                }
                if (P == LevelPackets.disableTerrain)
                    hideTerrain = true;
                if (P == LevelPackets.Block)
                {
                    var readString = ms.ReadString();
                    GameObject go;
                    if (modelLib == null)
                    {
                        Debug.LogWarning("Model lib not loaded");
                        go = GameObject.CreatePrimitive(PrimitiveType.Cube);

                    }
                    else if (modelLib.dict.ContainsKey(readString) && modelLib.dict[readString].gameObj != null)
                    {
                        ModelFile modelFile = modelLib.dict[readString];
                        var gameObj = modelFile.gameObj;
                        modelFile.usedCount++;
                        go = (GameObject)Instantiate(gameObj);
//.........这里部分代码省略.........
开发者ID:friuns,项目名称:New-Unity-Project-tm2---Copy,代码行数:101,代码来源:MapLoader.cs


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