コード例 #1
0
        protected override bool assignObject(object obj)
        {
            if (obj == null || obj.GetType() != typeof(Notes_CheckListItem))
            {
                return false;
            }

            checkListItem = (Notes_CheckListItem)obj;

            return true;
        }
コード例 #2
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;
        }
コード例 #3
0
 public void addCheckList(Notes_CheckListItem item)
 {
     if (!allChecks.ContainsKey(item.ID))
         allChecks.Add(item.ID, item);
 }