예제 #1
0
        public static void addStunt(ProgressNode n, string d, string id, string note, string r = "")
        {
            progressStandard s = null;

            if (id == ProgressTracking.Instance.runwayLanding.Id)
            {
                s             = new progressStandard(null, ProgressType.STUNT, n, d);
                runwayLanding = s;
            }
            else if (id == ProgressTracking.Instance.KSCLanding.Id)
            {
                s = new progressStandard(null, ProgressType.STUNT, n, d);
                launchpadLanding = s;
            }
            else if (id == ProgressTracking.Instance.launchpadLanding.Id)
            {
                s = new progressStandard(null, ProgressType.STUNT, n, d);
            }
            else if (id == ProgressTracking.Instance.towerBuzz.Id)
            {
                s         = new progressStandard(null, ProgressType.STUNT, n, d, note, r);
                towerBuzz = s;
            }

            if (s == null)
            {
                return;
            }

            standardNodes.Add(n.Id, s);
        }
예제 #2
0
        public static void addPointOfInterest(ProgressNode n, string d, string name, string note, string r = "")
        {
            if (pointsOfInterest.Contains(name))
            {
                return;
            }

            progressStandard s = new progressStandard(null, ProgressType.POINTOFINTEREST, n, d, note, r);

            pointsOfInterest.Add(name, s);
        }
예제 #3
0
        private static void addProgressStandard(ProgressType p, ProgressNode n, string id = "", string d = "", string g = "", string r = "")
        {
            if (n == null)
            {
                return;
            }

            if (standardNodes.Contains(n.Id))
            {
                return;
            }

            progressStandard s = null;

            switch (p)
            {
            case ProgressType.CREWRECOVERY:
                s            = new progressStandard(null, ProgressType.CREWRECOVERY, n, d, g, r);
                crewRecovery = s;
                standardNodes.Add(n.Id, s);
                break;

            case ProgressType.FIRSTLAUNCH:
                s           = new progressStandard(null, ProgressType.FIRSTLAUNCH, n, d, r);
                firstLaunch = s;
                standardNodes.Add(n.Id, s);
                break;

            case ProgressType.REACHSPACE:
                s          = new progressStandard(null, ProgressType.REACHSPACE, n, d, g, r);
                reachSpace = s;
                standardNodes.Add(n.Id, s);
                break;

            case ProgressType.STUNT:
                addStunt(n, d, id, g, r);
                break;

            case ProgressType.POINTOFINTEREST:
                addPointOfInterest(n, d, id, g, r);
                break;

            default:
                return;
            }
        }
        private void onComplete(ProgressNode node)
        {
            if (node == null)
            {
                return;
            }

            if (!node.IsComplete)
            {
                return;
            }

            if (!progressParser.isIntervalType(node))
            {
                if (progressParser.isPOI(node))
                {
                    progressStandard s = progressParser.getPOINode(node.Id);

                    if (s == null)
                    {
                        Debug.Log("[Progress Tracking Parser] POI Progress Node Not Found");
                    }
                    else
                    {
                        s.calculateRewards(null);
                        s.NoteReference = progressParser.vesselNameFromNode(node);

                        try
                        {
                            s.Time = (double)node.GetType().GetField("AchieveDate", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(node);
                        }
                        catch (Exception e)
                        {
                            Debug.LogWarning("[Progress Tracking Parser] Error In Detecting Progress Node Achievement Date\n" + e);
                        }
                    }
                }
                else
                {
                    progressStandard s = progressParser.getStandardNode(node.Id);

                    if (s != null)
                    {
                        s.calculateRewards(null);
                        string note = progressParser.crewNameFromNode(node);

                        if (string.IsNullOrEmpty(note))
                        {
                            note = progressParser.vesselNameFromNode(node);
                        }

                        s.NoteReference = note;

                        try
                        {
                            s.Time = (double)node.GetType().GetField("AchieveDate", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(node);
                        }
                        catch (Exception e)
                        {
                            Debug.LogWarning("[Progress Tracking Parser] Error In Detecting Progress Node Achievement Date\n" + e);
                        }
                    }
                    else
                    {
                        CelestialBody body = progressParser.getBodyFromType(node);

                        if (body == null)
                        {
                            Debug.Log("[Progress Tracking Parser] Body From Progress Node Null...");
                        }
                        else
                        {
                            progressBodyCollection b = progressParser.getProgressBody(body);

                            if (b != null)
                            {
                                progressStandard sb = b.getNode(node.Id);

                                if (sb == null)
                                {
                                    Debug.Log("[Progress Tracking Parser] Body Sub Progress Node Not Found");
                                }
                                else
                                {
                                    sb.calculateRewards(body);
                                    string note = progressParser.crewNameFromNode(node);

                                    if (string.IsNullOrEmpty(note))
                                    {
                                        note = progressParser.vesselNameFromNode(node);
                                    }

                                    sb.NoteReference = note;

                                    try
                                    {
                                        sb.Time = (double)node.GetType().GetField("AchieveDate", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(node);
                                    }
                                    catch (Exception e)
                                    {
                                        Debug.LogWarning("[Progress Tracking Parser] Error In Detecting Progress Node Achievement Date\n" + e);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                progressInterval i = progressParser.getIntervalNode(node.Id);

                if (i == null)
                {
                    Debug.Log("[Progress Tracking Parser] Interval Progress Node Not Found");
                }
                else
                {
                    if (node.IsReached)
                    {
                        i.calculateRewards(i.Interval);
                        i.Interval += 1;
                    }
                }
            }

            progressParser.updateCompletionRecord();
        }
		public void addProgressStandard(ProgressType p, CelestialBody b, ProgressNode n, string d = "", string g = "", string r = "")
		{
			if (n == null)
				return;

			if (bodyNodes.Contains(n.Id))
				return;

			progressStandard s = null;

			switch (p)
			{
				case ProgressType.FLYBYRETURN:
					s = new progressStandard(b, ProgressType.FLYBYRETURN, n, d, g, r);
					flybyReturn = s;
					break;
				case ProgressType.LANDINGRETURN:
					s = new progressStandard(b, ProgressType.LANDINGRETURN, n, d, g, r);
					landingReturn = s;
					break;
				case ProgressType.ORBITRETURN:
					s = new progressStandard(b, ProgressType.ORBITRETURN, n, d, g, r);
					orbitReturn = s;
					break;
				case ProgressType.BASECONSTRUCTION:
					s = new progressStandard(b, ProgressType.BASECONSTRUCTION, n, d, g, r);
					baseConstruct = s;
					break;
				case ProgressType.CREWTRANSFER:
					s = new progressStandard(b, ProgressType.CREWTRANSFER, n, d, g, r);
					transfer = s;
					break;
				case ProgressType.DOCKING:
					s = new progressStandard(b, ProgressType.DOCKING, n, d, g, r);
					docking = s;
					break;
				case ProgressType.ESCAPE:
					s = new progressStandard(b, ProgressType.ESCAPE, n, d, g, r);
					escape = s;
					break;
				case ProgressType.FLAGPLANT:
					s = new progressStandard(b, ProgressType.FLAGPLANT, n, d, g, r);
					flag = s;
					break;
				case ProgressType.FLIGHT:
					s = new progressStandard(b, ProgressType.FLIGHT, n, d, g, r);
					flight = s;
					break;
				case ProgressType.FLYBY:
					s = new progressStandard(b, ProgressType.FLYBY, n, d, g, r);
					flyby = s;
					break;
				case ProgressType.LANDING:
					s = new progressStandard(b, ProgressType.LANDING, n, d, g, r);
					landing = s;
					break;
				case ProgressType.ORBIT:
					s = new progressStandard(b, ProgressType.ORBIT, n, d, g, r);
					orbit = s;
					break;
				case ProgressType.RENDEZVOUS:
					s = new progressStandard(b, ProgressType.RENDEZVOUS, n, d, g, r);
					rendezvous = s;
					break;
				case ProgressType.SCIENCE:
					s = new progressStandard(b, ProgressType.SCIENCE, n, d, g, r);
					science = s;
					break;
				case ProgressType.SPACEWALK:
					s = new progressStandard(b, ProgressType.SPACEWALK, n, d, g, r);
					spacewalk = s;
					break;
				case ProgressType.SPLASHDOWN:
					s = new progressStandard(b, ProgressType.SPLASHDOWN, n, d, g, r);
					splashdown = s;
					break;
				case ProgressType.STATIONCONSTRUCTION:
					s = new progressStandard(b, ProgressType.STATIONCONSTRUCTION, n, d, g, r);
					station = s;
					break;
				case ProgressType.SUBORBIT:
					s = new progressStandard(b, ProgressType.SUBORBIT, n, d, g, r);
					suborbit = s;
					break;
				case ProgressType.SURFACEEVA:
					s = new progressStandard(b, ProgressType.SURFACEEVA, n, d, g, r);
					surfaceEVA = s;
					break;
				default:
					return;
			}

			if (s == null)
				return;

			bodyNodes.Add(n.Id, s);
		}
        public void addProgressStandard(ProgressType p, CelestialBody b, ProgressNode n, string d = "", string g = "", string r = "")
        {
            if (n == null)
            {
                return;
            }

            if (bodyNodes.Contains(n.Id))
            {
                return;
            }

            progressStandard s = null;

            switch (p)
            {
            case ProgressType.FLYBYRETURN:
                s           = new progressStandard(b, ProgressType.FLYBYRETURN, n, d, g, r);
                flybyReturn = s;
                break;

            case ProgressType.LANDINGRETURN:
                s             = new progressStandard(b, ProgressType.LANDINGRETURN, n, d, g, r);
                landingReturn = s;
                break;

            case ProgressType.ORBITRETURN:
                s           = new progressStandard(b, ProgressType.ORBITRETURN, n, d, g, r);
                orbitReturn = s;
                break;

            case ProgressType.BASECONSTRUCTION:
                s             = new progressStandard(b, ProgressType.BASECONSTRUCTION, n, d, g, r);
                baseConstruct = s;
                break;

            case ProgressType.CREWTRANSFER:
                s        = new progressStandard(b, ProgressType.CREWTRANSFER, n, d, g, r);
                transfer = s;
                break;

            case ProgressType.DOCKING:
                s       = new progressStandard(b, ProgressType.DOCKING, n, d, g, r);
                docking = s;
                break;

            case ProgressType.ESCAPE:
                s      = new progressStandard(b, ProgressType.ESCAPE, n, d, g, r);
                escape = s;
                break;

            case ProgressType.FLAGPLANT:
                s    = new progressStandard(b, ProgressType.FLAGPLANT, n, d, g, r);
                flag = s;
                break;

            case ProgressType.FLIGHT:
                s      = new progressStandard(b, ProgressType.FLIGHT, n, d, g, r);
                flight = s;
                break;

            case ProgressType.FLYBY:
                s     = new progressStandard(b, ProgressType.FLYBY, n, d, g, r);
                flyby = s;
                break;

            case ProgressType.LANDING:
                s       = new progressStandard(b, ProgressType.LANDING, n, d, g, r);
                landing = s;
                break;

            case ProgressType.ORBIT:
                s     = new progressStandard(b, ProgressType.ORBIT, n, d, g, r);
                orbit = s;
                break;

            case ProgressType.RENDEZVOUS:
                s          = new progressStandard(b, ProgressType.RENDEZVOUS, n, d, g, r);
                rendezvous = s;
                break;

            case ProgressType.SCIENCE:
                s       = new progressStandard(b, ProgressType.SCIENCE, n, d, g, r);
                science = s;
                break;

            case ProgressType.SPACEWALK:
                s         = new progressStandard(b, ProgressType.SPACEWALK, n, d, g, r);
                spacewalk = s;
                break;

            case ProgressType.SPLASHDOWN:
                s          = new progressStandard(b, ProgressType.SPLASHDOWN, n, d, g, r);
                splashdown = s;
                break;

            case ProgressType.STATIONCONSTRUCTION:
                s       = new progressStandard(b, ProgressType.STATIONCONSTRUCTION, n, d, g, r);
                station = s;
                break;

            case ProgressType.SUBORBIT:
                s        = new progressStandard(b, ProgressType.SUBORBIT, n, d, g, r);
                suborbit = s;
                break;

            case ProgressType.SURFACEEVA:
                s          = new progressStandard(b, ProgressType.SURFACEEVA, n, d, g, r);
                surfaceEVA = s;
                break;

            default:
                return;
            }

            if (s == null)
            {
                return;
            }

            bodyNodes.Add(n.Id, s);
        }
예제 #7
0
		public static void addPointOfInterest(ProgressNode n, string d, string name, string note, string r = "")
		{
			if (pointsOfInterest.Contains(name))
				return;

			progressStandard s = new progressStandard(null, ProgressType.POINTOFINTEREST, n, d, note, r);

			pointsOfInterest.Add(name, s);
		}
예제 #8
0
		public static void addStunt(ProgressNode n, string d, string id, string note, string r = "")
		{
			progressStandard s = null;

			if (id == ProgressTracking.Instance.runwayLanding.Id)
			{
				s = new progressStandard(null, ProgressType.STUNT, n, d);
				runwayLanding = s;
			}
			else if (id == ProgressTracking.Instance.KSCLanding.Id)
			{
				s = new progressStandard(null, ProgressType.STUNT, n, d);
				launchpadLanding = s;
			}
			else if (id == ProgressTracking.Instance.launchpadLanding.Id)
			{
				s = new progressStandard(null, ProgressType.STUNT, n, d);
			}
			else if (id == ProgressTracking.Instance.towerBuzz.Id)
			{
				s = new progressStandard(null, ProgressType.STUNT, n, d, note, r);
				towerBuzz = s;
			}

			if (s == null)
				return;

			standardNodes.Add(n.Id, s);
		}
예제 #9
0
		private static void addProgressStandard(ProgressType p, ProgressNode n, string id = "", string d = "", string g = "", string r = "")
		{
			if (n == null)
				return;

			if (standardNodes.Contains(n.Id))
				return;

			progressStandard s = null;

			switch (p)
			{
				case ProgressType.CREWRECOVERY:
					s = new progressStandard(null, ProgressType.CREWRECOVERY, n, d, g, r);
					crewRecovery = s;
					standardNodes.Add(n.Id, s);
					break;
				case ProgressType.FIRSTLAUNCH:
					s = new progressStandard(null, ProgressType.FIRSTLAUNCH, n, d, r);
					firstLaunch = s;
					standardNodes.Add(n.Id, s);
					break;
				case ProgressType.REACHSPACE:
					s= new progressStandard(null, ProgressType.REACHSPACE, n, d, g, r);
					reachSpace = s;
					standardNodes.Add(n.Id, s);
					break;
				case ProgressType.STUNT:					
					addStunt(n, d, id, g, r);
					break;
				case ProgressType.POINTOFINTEREST:
					addPointOfInterest(n, d, id, g, r);
					break;
				default:
					return;
			}
		}
        private void buildStandardNode(int id, progressStandard p, int size, ref Rect r, string s = "")
        {
            GUILayout.BeginHorizontal();

            r.x = 3;

            if (!string.IsNullOrEmpty(p.Note))
            {
                r.y += r.height + 4;
                r.width = 12 + (size * 2);
                r.height = 14 + (size * 4);

                if (!p.ShowNotes)
                {
                    if (GUI.Button(r, new GUIContent(contractSkins.noteIcon, "Show Completion Note"), contractSkins.texButtonSmall))
                        p.ShowNotes = !p.ShowNotes;
                }
                else
                {
                    if (GUI.Button(r, new GUIContent(contractSkins.noteIconOff, "Hide Completion Note"), contractSkins.texButtonSmall))
                        p.ShowNotes = !p.ShowNotes;
                }
                GUILayout.Space(16 + size * 2);
            }

            GUILayout.Label(string.Format(p.Descriptor, s), contractSkins.progressNodeTitle, GUILayout.MaxWidth(165 + size * 30));

            r = GUILayoutUtility.GetLastRect();

            GUILayout.EndHorizontal();

            //Only draw the rewards if they are visible in the window
            if (r.yMin >= (scroll.y - 20) && r.yMax <= (scroll.y + WindowRect.height - (20 + size * 6)))
            {
                Rect rewardsRect = r;
                rewardsRect.x = 180 + (size * 30);
                rewardsRect.y += (2 + (size * 2));

                scaledContent(ref rewardsRect, p.FundsRewardString, "", Currency.Funds, size, true, false);

                scaledContent(ref rewardsRect, p.SciRewardString, "", Currency.Science, size, true, false);

                scaledContent(ref rewardsRect, p.RepRewardString, "", Currency.Reputation, size, true, false);
            }

            //Display note
            if (!string.IsNullOrEmpty(p.Note) && p.ShowNotes)
            {
                GUILayout.Space(-7);
                GUILayout.Box(string.Format(p.Note, p.NoteReference, p.KSPDateString), GUILayout.MaxWidth(210 + size * 60));

                r.height += GUILayoutUtility.GetLastRect().height;
            }
        }
예제 #11
0
        private void drawStandardRecords(progressStandard p, string s = "")
        {
            GUILayout.Label(string.Format(p.Descriptor, s), CapComSkins.parameterText);

            if (!string.IsNullOrEmpty(p.Note))
            {
                GUILayout.Space(-7);
                GUILayout.Label(string.Format(p.Note, p.NoteReference, p.KSPDateString), CapComSkins.noteText);
            }

            GUILayout.Label("Rewards: ", CapComSkins.headerText, GUILayout.Width(80));

            sizedContent(p.FundsRewardString, p.SciRewardString, p.RepRewardString, TransactionReasons.ContractReward);
        }