예제 #1
0
        public void FillPartList()
        {
            // precalc our node dictionary
            Dictionary<string, ConfigNode> partnodes = new Dictionary<string, ConfigNode>();
            foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("ENTRYCOSTMODS"))
                foreach (ConfigNode n in node.GetNodes("PART"))
                    if (n.HasValue("name"))
                        partnodes[n.GetValue("name")] = n;

            // now fill our dictionary of parts
            if (PartLoader.Instance == null || PartLoader.LoadedPartsList == null)
            {
                Debug.LogError("*RP-0 EC: ERROR: Partloader instance null or list null!");
                return;
            }
            for (int a = PartLoader.LoadedPartsList.Count - 1; a >= 0; --a)
            {
                AvailablePart ap = PartLoader.LoadedPartsList[a];
                if (ap == null)
                {
                    continue;
                }
                Part part = ap.partPrefab;
                if (part != null)
                {
                    ConfigNode partnode = null;
                    string name = GetPartName(ap);
                    if (partnodes.TryGetValue(name, out partnode))
                        partlist[name] = new PartEntryCostHolder(partnode, ap);
                }
            }
        }
예제 #2
0
        public double PartEntryCost(string partName)
        {
            PartEntryCostHolder ec = null;

            if (partlist.TryGetValue(partName, out ec))
            {
                return(ec.EntryCost());
            }

            Debug.LogError("*RP-0 EC: ERROR: entry cost modifier for " + partName + " does not exist!");
            return(0d);
        }
예제 #3
0
        public bool IsUnlocked(string partname)
        {
            PartEntryCostHolder partEC = null;

            if (ResearchAndDevelopment.Instance != null)
            {
                if (partlist.TryGetValue(partname, out partEC))
                {
                    return(ResearchAndDevelopment.PartModelPurchased(partEC.ap));
                }
            }

            return(false);
        }
예제 #4
0
        public void FillPartList()
        {
            // precalc our node dictionary
            Dictionary <string, ConfigNode> partnodes = new Dictionary <string, ConfigNode>();

            foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("ENTRYCOSTMODS"))
            {
                foreach (ConfigNode n in node.GetNodes("PART"))
                {
                    if (n.HasValue("name"))
                    {
                        partnodes[n.GetValue("name")] = n;
                    }
                }
            }

            // now fill our dictionary of parts
            if (PartLoader.Instance == null || PartLoader.LoadedPartsList == null)
            {
                Debug.LogError("*RP-0 EC: ERROR: Partloader instance null or list null!");
                return;
            }
            for (int a = PartLoader.LoadedPartsList.Count - 1; a >= 0; --a)
            {
                AvailablePart ap = PartLoader.LoadedPartsList[a];
                if (ap == null)
                {
                    continue;
                }
                Part part = ap.partPrefab;
                if (part != null)
                {
                    ConfigNode partnode = null;
                    string     name     = GetPartName(ap);
                    if (partnodes.TryGetValue(name, out partnode))
                    {
                        partlist[name] = new PartEntryCostHolder(partnode, ap);
                    }
                }
            }
        }