Exemple #1
0
            void Start()
            {
                // User Settings
                ConfigNode[] InfoNodes = UserSettings.ConfigNode.GetNodes("Kerbal");

                for (int i = 0; i < InfoNodes?.Length; i++)
                {
                    ConfigNode[] requirements = InfoNodes[i].GetNodes("Requirements");
                    ConfigNode[] info         = InfoNodes[i].GetNodes("Description");

                    if (requirements.Length == 0)
                    {
                        requirements = new[] { new ConfigNode() }
                    }
                    ;

                    for (int j = 0; j < requirements.Length; j++)
                    {
                        for (int k = 0; k < info.Length; k++)
                        {
                            DescriptionInfo.List.Add(new DescriptionInfo(requirements[j], info[k]));
                        }
                    }
                }

                if (DescriptionInfo.List?.Count > 0)
                {
                    DescriptionInfo.OrderDB();
                }
            }
        }
    private void Start()
    {
        if (baitText.Length != baitTypes.Length)
        {
            Debug.LogError("Make sure there are an identical number of bait types and text objects in each array in the player prefab");
        }

        baitText[0].color = Color.red;
        for (int i = 0; i < baitTypes.Length; i++)
        {
            baitText[i].text = baitTypes[i].ToString();
        }
        pBase     = GetComponentInParent <PlayerBase>();
        weapInv   = GetComponentInParent <WeaponInventory>();
        meleeInfo = meleeSlot.GetComponent <DescriptionInfo>();
        rangeInfo = rangeSlot.GetComponent <DescriptionInfo>();
        updateWeaponDisplay();
        updateStatDisplay();
    }
Exemple #3
0
 void Start()
 {
     descrInfo = GetComponent <DescriptionInfo>();
     SetDescription();
 }
Exemple #4
0
            // Load informations
            void LoadFor(ProtoCrewMember kerbal)
            {
                Debug.Log("CustomDescription.LoadFor", "kerbal = " + kerbal);

                Info.hash = "";
                string collection = "";

                displayName  = "";
                tooltipName  = "";
                informations = "";
                sprite       = null;
                int index       = 0;
                int?indexChance = null;

                for (int i = 0; i < DescriptionInfo.DataBase?.Count; i++)
                {
                    DescriptionInfo info = (DescriptionInfo)DescriptionInfo.DataBase[i].GetFor(kerbal);

                    if (info != null)
                    {
                        Debug.Log("CustomDescription.LoadFor", "Matching description index = " + info.index + " to current index = " + index);

                        if (info.index == null || info.index == index)
                        {
                            Debug.Log("CustomDescription.LoadFor", "Matching description collection = " + info.collection + " to current collection = " + collection);

                            if (string.IsNullOrEmpty(collection) || collection == info.collection)
                            {
                                if (info.useChance != 1 && indexChance == null)
                                {
                                    indexChance = kerbal.Hash(info.useGameSeed) % 100;
                                }

                                Debug.Log("CustomDescription.LoadFor", "Matching description useChance = " + info.useChance + " to current index chance = " + indexChance + " %");

                                if (info.useChance == 1 || indexChance < info.useChance * 100)
                                {
                                    Debug.Log("CustomDescription.LoadFor", "Matched all requirements.");

                                    // Collection
                                    collection = info.collection;
                                    Debug.Log("CustomDescription.LoadFor", "Current collection = " + collection);


                                    // Unique
                                    if (info.unique)
                                    {
                                        displayName = tooltipName = informations = "";
                                        sprite      = null;
                                    }

                                    // displayName
                                    if (string.IsNullOrEmpty(displayName))
                                    {
                                        displayName = info.displayName;
                                    }

                                    // tooltipName
                                    if (string.IsNullOrEmpty(tooltipName))
                                    {
                                        tooltipName = info.tooltipName;
                                    }

                                    // sprite
                                    sprite = sprite ?? info.sprite;

                                    // informations
                                    if (info.informations?.Length > 0)
                                    {
                                        Debug.Log("CustomDescription.LoadFor", "Adding text to informations field, index = " + index);

                                        if (info.informations.Length == 1)
                                        {
                                            informations += info.informations[0];
                                        }
                                        else
                                        {
                                            informations += info.informations[kerbal.Hash(info.useGameSeed) % info.informations.Length];
                                        }

                                        Debug.Log("CustomDescription.LoadFor", "Updated informations field = " + informations);
                                    }

                                    if (info.unique || info.last)
                                    {
                                        break;
                                    }

                                    index++;
                                    indexChance = null;
                                    Debug.Log("CustomDescription.LoadFor", "Index bumped to = " + index);
                                }
                            }
                        }
                    }
                }
            }
 public StatusResponse(VersionInfo version, PlayerInfo players, DescriptionInfo description)
 {
     Version     = version;
     Players     = players;
     Description = description;
 }