コード例 #1
0
 public Notes_CheckListContainer(Notes_CheckListContainer copy, Notes_Archive_Container n)
 {
     allChecks = copy.allChecks;
     archive_Root = n;
     vessel = null;
     archived = true;
 }
コード例 #2
0
 public Notes_Archive_Container(Guid gid, string name, double time, double m, VesselType t)
 {
     id = gid;
     vesselName = name;
     recoveryTime = time;
     met = m;
     vtype = t;
     container = this;
     log = new Notes_VesselLog(container);
     notes = new Notes_TextContainer(container);
     checkList = new Notes_CheckListContainer(container);
     contracts = new Notes_ContractContainer(container);
     data = new Notes_DataContainer(container);
     crew = new Notes_Archived_Crew_Container(container);
 }
コード例 #3
0
        private void saveChecklist(ConfigNode node, Notes_CheckListContainer check, bool archived)
        {
            ConfigNode checkList = new ConfigNode("CHECK_LIST");

            for (int j = 0; j < check.noteCount; j++)
            {
                Notes_CheckListItem c = check.getCheckList(j);

                if (c == null)
                    continue;

                ConfigNode checkItem = new ConfigNode("CHECK_LIST_ITEM");

                checkItem.AddValue("KEY", c.ID);
                checkItem.AddValue("ORDER", c.Order);
                checkItem.AddValue("NOTE", c.Text);
                checkItem.AddValue("COMPLETE", c.Complete);
                if (c.Complete)
                    checkItem.AddValue("COMPLETE_TIME", c.CompleteTime.ToString("F2"));
                checkItem.AddValue("TYPE", c.CheckType);

                switch (c.CheckType)
                {
                    case Notes_CheckListType.dockVessel:
                    case Notes_CheckListType.dockAsteroid:
                    case Notes_CheckListType.rendezvousVessel:
                    case Notes_CheckListType.rendezvousAsteroid:
                        if (c.TargetVessel == null)
                            continue;
                        checkItem.AddValue("TARGET_VESSEL", c.TargetVessel.id);
                        break;
                    case Notes_CheckListType.launch:
                    case Notes_CheckListType.land:
                    case Notes_CheckListType.blastOff:
                    case Notes_CheckListType.orbit:
                    case Notes_CheckListType.enterOrbit:
                    case Notes_CheckListType.returnToOrbit:
                    case Notes_CheckListType.returnHome:
                    case Notes_CheckListType.plantFlag:
                    case Notes_CheckListType.spacewalk:
                    case Notes_CheckListType.surfaceEVA:
                        if (c.TargetBody == null)
                            continue;
                        checkItem.AddValue("TARGET_BODY", c.TargetBody.name);
                        break;
                    case Notes_CheckListType.science:
                        if (c.Data != null)
                            checkItem.AddValue("DATA", c.Data);
                        break;
                    case Notes_CheckListType.scienceFromPlanet:
                        if (c.TargetBody == null && !archived)
                            continue;
                        if (c.Data != null)
                            checkItem.AddValue("DATA", c.Data);
                        if (!archived)
                            checkItem.AddValue("TARGET_BODY", c.TargetBody.name);
                        break;
                }

                checkList.AddNode(checkItem);
            }

            node.AddNode(checkList);
        }
コード例 #4
0
        private Notes_CheckListContainer loadCheckList(ConfigNode node, bool archived)
        {
            Notes_CheckListContainer c = new Notes_CheckListContainer();

            for (int j = 0; j < node.GetNodes("CHECK_LIST_ITEM").Length; j++)
            {
                ConfigNode checkListItem = node.GetNodes("CHECK_LIST_ITEM")[j];

                if (checkListItem == null)
                    continue;

                if (!checkListItem.HasValue("NOTE"))
                    continue;

                string text = checkListItem.GetValue("NOTE");
                int order = checkListItem.parse("ORDER", j);
                bool complete = checkListItem.parse("COMPLETE", false);
                double completeTime = 0;
                if (complete)
                    completeTime = checkListItem.parse("COMPLETE_TIME", 0d);
                float? data = checkListItem.parse("DATA", (float?)null);
                Guid id = checkListItem.parse("KEY", Guid.NewGuid());
                Notes_CheckListType type = checkListItem.parse("TYPE", Notes_CheckListType.custom);

                Vessel targetV = null;
                CelestialBody targetB = null;

                if (!archived)
                {
                    targetV = checkListItem.parse("TARGET_VESSEL", (Vessel)null);
                    targetB = checkListItem.parse("TARGET_BODY", (CelestialBody)null);
                }

                if (!complete && !archived)
                {
                    switch (type)
                    {
                        case Notes_CheckListType.dockVessel:
                        case Notes_CheckListType.dockAsteroid:
                        case Notes_CheckListType.rendezvousVessel:
                        case Notes_CheckListType.rendezvousAsteroid:
                            if (targetV == null)
                                continue;
                            break;
                        case Notes_CheckListType.enterOrbit:
                        case Notes_CheckListType.land:
                        case Notes_CheckListType.orbit:
                        case Notes_CheckListType.blastOff:
                        case Notes_CheckListType.returnToOrbit:
                        case Notes_CheckListType.scienceFromPlanet:
                        case Notes_CheckListType.surfaceEVA:
                        case Notes_CheckListType.spacewalk:
                        case Notes_CheckListType.plantFlag:
                            if (targetB == null)
                                continue;
                            break;
                        case Notes_CheckListType.launch:
                        case Notes_CheckListType.returnHome:
                            if (targetB == null)
                                targetB = Planetarium.fetch.Home;
                            break;
                    }
                }

                Notes_CheckListItem newCheckListItem = new Notes_CheckListItem(text, order, complete, targetV, targetB, id, type, c, data, completeTime);

                c.addCheckList(newCheckListItem);
            }

            return c;
        }
コード例 #5
0
 public void loadCheckList(Notes_CheckListContainer c)
 {
     checkList = new Notes_CheckListContainer(c, this);
 }
コード例 #6
0
 public Notes_CheckListContainer(Notes_CheckListContainer copy, Notes_Container n)
 {
     allChecks = copy.allChecks;
     root = n;
     vessel = n.NotesVessel;
 }
コード例 #7
0
        public Notes_CheckListItem(string t, int i, bool b, Vessel targetV, CelestialBody targetB, Guid g, Notes_CheckListType y, Notes_CheckListContainer r, float? d, double c)
        {
            if (!loaded)
                loadStrings();
            text = t;
            order = i;
            complete = b;
            id = g;
            checkType = y;
            root = r;
            data = d;
            completeTime = c;

            if (root.Archived)
                return;

            targetBody = targetB;
            targetVessel = targetV;

            Notes_CheckListTypeHandler.registerCheckList(this);
        }
コード例 #8
0
        public Notes_CheckListItem(int i, Vessel targetV, CelestialBody targetB, Notes_CheckListType type, Notes_CheckListContainer r, string t = "", float? d = null)
        {
            if (!loaded)
                loadStrings();
            order = i;
            checkType = type;
            root = r;
            data = d;
            id = Guid.NewGuid();

            switch (checkType)
            {
                case Notes_CheckListType.dockVessel:
                case Notes_CheckListType.dockAsteroid:
                case Notes_CheckListType.rendezvousVessel:
                case Notes_CheckListType.rendezvousAsteroid:
                    targetVessel = targetV;
                    targetBody = null;
                    break;
                case Notes_CheckListType.land:
                case Notes_CheckListType.orbit:
                case Notes_CheckListType.enterOrbit:
                case Notes_CheckListType.returnToOrbit:
                case Notes_CheckListType.blastOff:
                case Notes_CheckListType.scienceFromPlanet:
                case Notes_CheckListType.spacewalk:
                case Notes_CheckListType.surfaceEVA:
                case Notes_CheckListType.plantFlag:
                    targetBody = targetB;
                    targetVessel = null;
                    break;
                case Notes_CheckListType.launch:
                case Notes_CheckListType.returnHome:
                    targetBody = Planetarium.fetch.Home;
                    targetVessel = null;
                    break;
                case Notes_CheckListType.science:
                    targetBody = null;
                    targetVessel = null;
                    break;
            }

            text = setTitle(t);

            Notes_CheckListTypeHandler.registerCheckList(this);
        }
コード例 #9
0
 public Notes_CheckListItem(Notes_CheckListContainer r)
 {
     if (!loaded)
         loadStrings();
     root = r;
 }