Exemplo n.º 1
0
        private IEnumerator LoadConfigNodes()
        {
            ConfigNode[] configNodes = GameDatabase.Instance.GetConfigNodes("SUITCOMBOS");
            foreach (ConfigNode configNode in configNodes)
            {
                var suitNodes = configNode.GetNodes("SUITCOMBO");
                foreach (ConfigNode suitNode in suitNodes)
                {
                    // Load IVA Node
                    ConfigNode ivaNode = new ConfigNode();
                    if (suitNode.TryGetNode("IVA", ref ivaNode))
                    {
                        IVASuit ivaSuit = new IVASuit();

                        ivaNode.TryGetValue("suitTexture", ref ivaSuit.suitTexture);
                        ivaNode.TryGetValue("normalTexture", ref ivaSuit.normalTexture);
                        suitNode.TryGetValue("suitType", ref ivaSuit.suitType);
                        suitNode.TryGetValue("gender", ref ivaSuit.gender);
                        suitNode.TryGetValue("suitTexture", ref ivaSuit.stockPath);

                        progressTitle = ivaSuit.suitTexture;
                        bool successTexture = GameDatabase.Instance.ExistsTexture(ivaSuit.suitTexture);
                        bool successNormal  = GameDatabase.Instance.ExistsTexture(ivaSuit.normalTexture);

                        if (successTexture && successNormal)
                        {
                            SuitComboDatabase.Instance.ivaSuits.Add(ivaSuit);
                        }
                        else if (!successTexture)
                        {
                            Debug.LogWarning($"[{DISPLAYNAME}] Could not find texture '{ivaSuit.suitTexture}'");
                        }
                        else if (!successNormal)
                        {
                            Debug.LogWarning($"[{DISPLAYNAME}] Could not find normal map '{ivaSuit.normalTexture}'");
                        }

                        yield return(null);
                    }
                    else
                    {
                        continue;
                    }
                }
            }

            finished = true;
        }
Exemplo n.º 2
0
        public bool CheckKerbalSuit(Kerbal kerbal, out IVASuit ivaSuit)
        {
            string suitType    = kerbal.protoCrewMember.suit.ToString();
            string gender      = kerbal.protoCrewMember.gender.ToString();
            string suitTexture = kerbal.protoCrewMember.SuitTexturePath;

            ivaSuit = SuitComboDatabase.Instance.ivaSuits.Where(iva => iva.suitType == suitType && iva.gender == gender && iva.stockPath == suitTexture)?.FirstOrDefault();

            if (ivaSuit == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }