コード例 #1
0
        protected static List <PathPoint> PathPointsFromRailPointsEntry(ByamlIterator.DictionaryEntry railPointsEntry)
        {
            List <PathPoint> pathPoints = new List <PathPoint>();

            foreach (ByamlIterator.ArrayEntry pointEntry in railPointsEntry.IterArray())
            {
                Vector3 pos = new Vector3();
                Vector3 cp1 = new Vector3();
                Vector3 cp2 = new Vector3();
                foreach (ByamlIterator.DictionaryEntry entry in pointEntry.IterDictionary())
                {
                    dynamic _data = entry.Parse();
                    if (entry.Key == "Translate")
                    {
                        pos = new Vector3(
                            _data["X"] / 100f,
                            _data["Y"] / 100f,
                            _data["Z"] / 100f
                            );
                    }
                    else if (entry.Key == "ControlPoints")
                    {
                        cp1 = new Vector3(
                            _data[0]["X"] / 100f,
                            _data[0]["Y"] / 100f,
                            _data[0]["Z"] / 100f
                            );

                        cp2 = new Vector3(
                            _data[1]["X"] / 100f,
                            _data[1]["Y"] / 100f,
                            _data[1]["Z"] / 100f
                            );
                    }
                }
                pathPoints.Add(new RailPoint(pos, cp1 - pos, cp2 - pos));
            }

            return(pathPoints);
        }
コード例 #2
0
ファイル: Rail.cs プロジェクト: Finninator5/Spotlight
        protected static List <RailPoint> RailPointsFromRailPointsEntry(ByamlIterator.DictionaryEntry railPointsEntry)
        {
            List <RailPoint> pathPoints = new List <RailPoint>();

            foreach (ByamlIterator.ArrayEntry pointEntry in railPointsEntry.IterArray())
            {
                Vector3 pos = new Vector3();
                Vector3 cp1 = new Vector3();
                Vector3 cp2 = new Vector3();

                var properties = new Dictionary <string, dynamic>();

                foreach (ByamlIterator.DictionaryEntry entry in pointEntry.IterDictionary())
                {
                    if (entry.Key == "Comment" ||
                        entry.Key == "Id" ||
                        entry.Key == "IsLinkDest" ||
                        entry.Key == "LayerConfigName" ||
                        entry.Key == "Links" ||
                        entry.Key == "ModelName" ||
                        entry.Key == "Rotate" ||
                        entry.Key == "Scale" ||
                        entry.Key == "UnitConfig" ||
                        entry.Key == "UnitConfigName"

                        )
                    {
                        continue;
                    }

                    dynamic _data = entry.Parse();
                    if (entry.Key == "Translate")
                    {
                        pos = new Vector3(
                            _data["X"] / 100f,
                            _data["Y"] / 100f,
                            _data["Z"] / 100f
                            );
                    }
                    else if (entry.Key == "ControlPoints")
                    {
                        cp1 = new Vector3(
                            _data[0]["X"] / 100f,
                            _data[0]["Y"] / 100f,
                            _data[0]["Z"] / 100f
                            );

                        cp2 = new Vector3(
                            _data[1]["X"] / 100f,
                            _data[1]["Y"] / 100f,
                            _data[1]["Z"] / 100f
                            );
                    }
                    else
                    {
                        properties.Add(entry.Key, _data);
                    }
                }

                pathPoints.Add(new RailPoint(pos, cp1 - pos, cp2 - pos, properties));
            }

            return(pathPoints);
        }