コード例 #1
0
        public override void RemoveReference(ModelCode referenceId, long globalId)
        {
            switch (referenceId)
            {
            case ModelCode.SWITCH_SWITCHINGOPERATION:

                if (Switches.Contains(globalId))
                {
                    Switches.Remove(globalId);
                }
                else
                {
                    CommonTrace.WriteTrace(CommonTrace.TraceWarning, "Entity (GID = 0x{0:x16}) doesn't contain reference 0x{1:x16}.", this.GlobalId, globalId);
                }

                break;

            default:
                base.RemoveReference(referenceId, globalId);
                break;
            }
        }
コード例 #2
0
 /// <summary>
 /// Determines if the specified switch is present on the command-line
 /// </summary>
 /// <param name="key">The switch value, e.g. "-myswitch"</param>
 /// <returns>True if present</returns>
 // ReSharper disable once UnusedMember.Global
 public bool IsSwitchSet(string key)
 {
     return(Switches.Contains(key));
 }
コード例 #3
0
        public void LoadTracks(string path)
        {
            string[] lines = File.ReadAllLines(path);

            string[] meta         = lines[0].Split(" ");
            int      nodeCount    = int.Parse(meta[0]);
            int      segmentCount = int.Parse(meta[1]);

            Nodes = new TrackNode[nodeCount];

            for (int i = 1; i <= nodeCount; i++)
            {
                string[] nodeData   = lines[i].Split(" ");
                int      switchType = int.Parse(nodeData[3]);
                if (switchType > 0)
                {
                    Nodes[i - 1] = new TrackSwitch(i - 1, new Vector3(float.Parse(nodeData[0]), float.Parse(nodeData[1]), float.Parse(nodeData[2])), (Direction)(switchType) - 1);
                }
                else
                {
                    Nodes[i - 1] = new TrackNode(i - 1, new Vector3(float.Parse(nodeData[0]), float.Parse(nodeData[1]), float.Parse(nodeData[2])));
                }
            }

            for (int i = nodeCount + 1; i <= nodeCount + segmentCount; i++)
            {
                string[]     segment      = lines[i].Split(" ");
                TrackSegment trackSegment = new TrackSegment(Segments.Count);
                for (int j = 0; j < segment.Length - 1; j++)
                {
                    TrackNode n1 = Nodes[int.Parse(segment[j]) - 1];
                    TrackNode n2 = Nodes[int.Parse(segment[j + 1]) - 1];

                    trackSegment.Nodes.Add(n1);

                    if (n1 is TrackSwitch)
                    {
                        TrackSwitch s1 = (TrackSwitch)n1;
                        if (s1.SwitchDirection == Direction.Forward)
                        {
                            if (!Switches.Contains(s1))
                            {
                                Switches.Add(s1);
                            }
                            s1.SwitchNodes.Add(n2);
                            if (s1.ToNode == null)
                            {
                                s1.ToNode = n2;
                            }
                        }
                        else
                        {
                            s1.ToNode = n2;
                        }
                    }
                    else
                    {
                        n1.ToNode = n2;
                    }

                    if (n2 is TrackSwitch)
                    {
                        TrackSwitch s2 = (TrackSwitch)n2;
                        if (s2.SwitchDirection == Direction.Backward)
                        {
                            Switches.Add(s2);
                            s2.SwitchNodes.Add(n1);
                            if (s2.FromNode == null)
                            {
                                s2.FromNode = n1;
                            }
                        }
                        else
                        {
                            s2.FromNode = n1;
                        }
                    }
                    else
                    {
                        n2.FromNode = n1;
                    }

                    n1.Segment = trackSegment;
                }
                Segments.Add(trackSegment);
            }
        }
コード例 #4
0
ファイル: CommandParser.cs プロジェクト: ssymax/JS_CSharp
 public bool HasSwitch(string switchName)
 {
     return(Switches.Contains(switchName));
 }