Esempio n. 1
0
        //private void RecruitScreen()
        //{
        //    GUILayout.BeginVertical();
        //    GUILayout.BeginHorizontal();
        //    GUILayout.Label(String.Format(""), _labelStyle, GUILayout.Width(135)); //Spacer
        //    GUILayout.EndHorizontal();

        //    var count = _kolonists.Count;
        //    for (int i = 0; i < count; ++i)
        //    {
        //        var k = _kolonists[i];
        //        GUILayout.BeginHorizontal();
        //        if (GUILayout.Button(k.Name, GUILayout.Width(100)))
        //            RecruitKerbal(i);
        //        GUILayout.Label("", _labelStyle, GUILayout.Width(5));
        //        GUILayout.Label(k.Cost/1000 + "k", _labelStyle, GUILayout.Width(50));
        //        GUILayout.Label(k.Effects, _labelStyle, GUILayout.Width(400));
        //        GUILayout.EndHorizontal();
        //    }

        //    GUILayout.BeginHorizontal();
        //    if (GUILayout.Button("Random", GUILayout.Width(100)))
        //        RecruitKerbal(-1);
        //    GUILayout.Label("", _labelStyle, GUILayout.Width(5));
        //    GUILayout.Label("1k", _labelStyle, GUILayout.Width(50));
        //    GUILayout.Label("[Grab a random Kerbal!]", _labelStyle, GUILayout.Width(400));
        //    GUILayout.EndHorizontal();


        //    GUILayout.EndVertical();
        //}

        //private void RecruitKerbal(int id)
        //{
        //    Random r = new Random();
        //    var classId = id;
        //    if (id < 0)
        //        classId = r.Next(_kolonists.Count - 1);
        //    var k = _kolonists[classId];

        //    var cost = k.Cost;
        //    var trait = k.Name;
        //    if (id < 0)
        //        cost = 1000;

        //    string msg;
        //    if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER)
        //    {
        //        if (cost > Funding.Instance.Funds)
        //        {
        //            msg = string.Format("Not enough funds!");
        //            ScreenMessages.PostScreenMessage(msg, 5f, ScreenMessageStyle.UPPER_CENTER);
        //            return;
        //        }
        //        if (HighLogic.CurrentGame.CrewRoster.GetActiveCrewCount() >=
        //            GameVariables.Instance.GetActiveCrewLimit(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.AstronautComplex)))
        //        {
        //            msg = string.Format("Roster is full!");
        //            ScreenMessages.PostScreenMessage(msg, 5f, ScreenMessageStyle.UPPER_CENTER);
        //            return;
        //        }
        //        double myFunds = Funding.Instance.Funds;
        //        Funding.Instance.AddFunds(-cost, TransactionReasons.CrewRecruited);
        //    }

        //    msg = string.Format("Recruited {0}!",trait);
        //    ScreenMessages.PostScreenMessage(msg, 5f, ScreenMessageStyle.UPPER_CENTER);
        //    ProtoCrewMember newKerbal = HighLogic.CurrentGame.CrewRoster.GetNewKerbal();
        //    KerbalRoster.SetExperienceTrait(newKerbal, trait);
        //    newKerbal.rosterStatus = ProtoCrewMember.RosterStatus.Available;
        //    newKerbal.experience = 0;
        //    newKerbal.experienceLevel = 0;
        //}

        private void StatScreen()
        {
            scrollPos = GUILayout.BeginScrollView(scrollPos, _scrollStyle, GUILayout.Width(680), GUILayout.Height(380));
            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal();
            GUILayout.Label(String.Format("Body Name"), _labelStyle, GUILayout.Width(135));
            GUILayout.Label(String.Format("Geology"), _labelStyle, GUILayout.Width(80));
            GUILayout.Label(String.Format("Botany"), _labelStyle, GUILayout.Width(80));
            GUILayout.Label(String.Format("Kolonization"), _labelStyle, GUILayout.Width(80));
            GUILayout.EndHorizontal();

            var focusedPlanet = GetFocusedPlanet();
            var planetList    = KolonizationManager.Instance.KolonizationInfo.Select(p => p.BodyIndex).Distinct().OrderByDescending(pId => pId == focusedPlanet);

            foreach (var p in planetList)
            {
                var body = FlightGlobals.Bodies[p];
                var geo  = KolonizationManager.GetGeologyResearchBonus(p);
                var kol  = KolonizationManager.GetKolonizationResearchBonus(p);
                var bot  = KolonizationManager.GetBotanyResearchBonus(p);
                GUILayout.BeginHorizontal();
                GUILayout.Label(String.Format("<color=#FFFFFF>{0}</color>", body.bodyName), _labelStyle, GUILayout.Width(135));
                GUILayout.Label(String.Format("<color=#FFD900>{0:n3}%</color>", geo * 100d), _labelStyle, GUILayout.Width(80));
                GUILayout.Label(String.Format("<color=#FFD900>{0:n3}%</color>", bot * 100d), _labelStyle, GUILayout.Width(80));
                GUILayout.Label(String.Format("<color=#FFD900>{0:n3}%</color>", kol * 100d), _labelStyle, GUILayout.Width(80));
                GUILayout.EndHorizontal();
            }

            GUILayout.EndVertical();
            GUILayout.EndScrollView();
        }
Esempio n. 2
0
        public float GetEfficiencyBonus()
        {
            var bodyId   = vessel.mainBody.flightGlobalsIndex;
            var geoBonus = KolonizationManager.GetGeologyResearchBonus(bodyId);

            return(geoBonus * GetEfficiencyPartsBonus() * GetPlanetaryBonus());
        }
Esempio n. 3
0
        private float GetPlanetaryBonus()
        {
            var bodyId = vessel.mainBody.flightGlobalsIndex;

            switch (BonusEffect)
            {
            case "RepBoost":
                return(KolonizationManager.GetKolonizationResearchBonus(bodyId));

            case "ScienceBoost":
                return(KolonizationManager.GetBotanyResearchBonus(bodyId));

            default:
                return(KolonizationManager.GetGeologyResearchBonus(bodyId));
            }
        }
Esempio n. 4
0
        private float GetPlanetaryBonus()
        {
            var bodyId = vessel.mainBody.flightGlobalsIndex;

            if (BonusEffect == "RepBoost")
            {
                return(KolonizationManager.GetKolonizationResearchBonus(bodyId));
            }
            else if (BonusEffect == "ScienceBoost")
            {
                return(KolonizationManager.GetBotanyResearchBonus(bodyId));
            }
            else
            {
                return(KolonizationManager.GetGeologyResearchBonus(bodyId));
            }
        }
Esempio n. 5
0
        public Dictionary <string, float> GetEfficiencyBonuses()
        {
            var bodyId         = vessel.mainBody.flightGlobalsIndex;
            var geoBonus       = KolonizationManager.GetGeologyResearchBonus(bodyId);
            var planetaryBonus = GetPlanetaryBonus();

            var bonuses = new Dictionary <string, float>();

            if (_bonusTags != null && _bonusTags.Any())
            {
                for (int i = 0; i < _bonusTags.Count; i++)
                {
                    var tag        = _bonusTags[i];
                    var bonusValue = geoBonus * planetaryBonus * GetEfficiencyPartsBonus(tag);

                    bonuses.Add(tag, bonusValue);
                }
            }

            return(bonuses);
        }