Beispiel #1
0
            internal void Pick(NavBallInfo info, ProtoCrewMember kerbal = null, string name = null)
            {
                // Colors
                NavBall            = NavBall ?? info.NavBall.Pick(kerbal, info.useGameSeed, name);
                Shading            = Shading ?? info.Shading.Pick(kerbal, info.useGameSeed, name);
                Cursor             = Cursor ?? info.Cursor.Pick(kerbal, info.useGameSeed, name);
                Vectors            = Vectors ?? info.Vectors.Pick(kerbal, info.useGameSeed, name);
                ProgradeVector     = ProgradeVector ?? info.ProgradeVector.Pick(kerbal, info.useGameSeed, name);
                ProgradeWaypoint   = ProgradeWaypoint ?? info.ProgradeWaypoint.Pick(kerbal, info.useGameSeed, name);
                RetrogradeVector   = RetrogradeVector ?? info.RetrogradeVector.Pick(kerbal, info.useGameSeed, name);
                RetrogradeWaypoint = RetrogradeWaypoint ?? info.RetrogradeWaypoint.Pick(kerbal, info.useGameSeed, name);
                Maneuvers          = Maneuvers ?? info.Maneuvers.Pick(kerbal, info.useGameSeed, name);
                RadialInVector     = RadialInVector ?? info.RadialInVector.Pick(kerbal, info.useGameSeed, name);
                RadialOutVector    = RadialOutVector ?? info.RadialOutVector.Pick(kerbal, info.useGameSeed, name);
                NormalVector       = NormalVector ?? info.NormalVector.Pick(kerbal, info.useGameSeed, name);
                AntiNormalVector   = AntiNormalVector ?? info.AntiNormalVector.Pick(kerbal, info.useGameSeed, name);
                BurnVector         = BurnVector ?? info.BurnVector.Pick(kerbal, info.useGameSeed, name);
                Arrows             = Arrows ?? info.Arrows.Pick(kerbal, info.useGameSeed, name);
                Buttons            = Buttons ?? info.Buttons.Pick(kerbal, info.useGameSeed, name);
                Frame       = Frame ?? info.Frame.Pick(kerbal, info.useGameSeed, name);
                IVAbase     = IVAbase ?? info.IVAbase.Pick(kerbal, info.useGameSeed, name);
                IVAprograde = IVAprograde ?? info.IVAprograde.Pick(kerbal, info.useGameSeed, name);

                // Textures
                NavBallTex            = NavBallTex ?? info.NavBallTex.Pick(kerbal, info.useGameSeed, name);
                ShadingTex            = ShadingTex ?? info.ShadingTex.Pick(kerbal, info.useGameSeed, name);
                ShadingMaskTex        = ShadingMaskTex ?? info.ShadingMaskTex.Pick(kerbal, info.useGameSeed, name);
                CursorTex             = CursorTex ?? info.CursorTex.Pick(kerbal, info.useGameSeed, name);
                VectorsTex            = VectorsTex ?? info.VectorsTex.Pick(kerbal, info.useGameSeed, name);
                ProgradeVectorTex     = ProgradeVectorTex ?? info.ProgradeVectorTex.Pick(kerbal, info.useGameSeed, name);
                ProgradeWaypointTex   = ProgradeWaypointTex ?? info.ProgradeWaypointTex.Pick(kerbal, info.useGameSeed, name);
                RetrogradeVectorTex   = RetrogradeVectorTex ?? info.RetrogradeVectorTex.Pick(kerbal, info.useGameSeed, name);
                RetrogradeWaypointTex = RetrogradeWaypointTex ?? info.RetrogradeWaypointTex.Pick(kerbal, info.useGameSeed, name);
                ManeuversTex          = ManeuversTex ?? info.ManeuversTex.Pick(kerbal, info.useGameSeed, name);
                RadialInVectorTex     = RadialInVectorTex ?? info.RadialInVectorTex.Pick(kerbal, info.useGameSeed, name);
                RadialOutVectorTex    = RadialOutVectorTex ?? info.RadialOutVectorTex.Pick(kerbal, info.useGameSeed, name);
                NormalVectorTex       = NormalVectorTex ?? info.NormalVectorTex.Pick(kerbal, info.useGameSeed, name);
                AntiNormalVectorTex   = AntiNormalVectorTex ?? info.AntiNormalVectorTex.Pick(kerbal, info.useGameSeed, name);
                BurnVectorTex         = BurnVectorTex ?? info.BurnVectorTex.Pick(kerbal, info.useGameSeed, name);
                ArrowsTex             = ArrowsTex ?? info.ArrowsTex.Pick(kerbal, info.useGameSeed, name);
                ButtonsTex            = ButtonsTex ?? info.ButtonsTex.Pick(kerbal, info.useGameSeed, name);
                FrameTex       = FrameTex ?? info.FrameTex.Pick(kerbal, info.useGameSeed, name);
                FrameTexRes    = FrameTexRes ?? info.FrameTexRes.At(FrameTex, info.FrameTex, kerbal, info.useGameSeed, name);
                IVAbaseTex     = IVAbaseTex ?? info.IVAbaseTex.Pick(kerbal, info.useGameSeed, name);
                IVAemissiveTex = IVAemissiveTex ?? info.IVAemissiveTex.At(NavBallTex, info.NavBallTex, kerbal, info.useGameSeed, name);
                IVAprogradeTex = IVAprogradeTex ?? info.IVAprogradeTex.Pick(kerbal, info.useGameSeed, name);
            }
Beispiel #2
0
            public override void OnLoad(ConfigNode node)
            {
                if (HighLogic.LoadedScene == GameScenes.LOADING)
                {
                    ConfigNode NavBallNode = node.GetNode("NavBall");

                    CustomNavBall NavBall = gameObject.AddOrGetComponent <CustomNavBall>();

                    NavBallInfo info = new NavBallInfo(new ConfigNode(), NavBallNode ?? new ConfigNode());

                    NavBall.Pick(info, name: part.name);

                    if (!DataBase.ContainsKey(part.name))
                    {
                        DataBase.Add(part.name, NavBall);
                    }
                }
            }
Beispiel #3
0
            internal override void LoadFor(ProtoCrewMember kerbal)
            {
                Debug.Log("CustomNavBall.LoadFor", "kerbal = " + kerbal);

                Info.hash = "";
                int?   useChance  = null;
                string collection = "";

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

                    Debug.Log("CustomNavBall.LoadFor", "NavBallInfo.DataBase[" + i + "]");
                    if (info != null)
                    {
                        Debug.Log("CustomNavBall.LoadFor", "Matching navball collection = " + info.collection + " to current collection = " + collection);
                        if (string.IsNullOrEmpty(collection) || collection == info.collection)
                        {
                            if (useChance == null && info.useChance != 1)
                            {
                                useChance = kerbal.Hash(info.useGameSeed) % 100;
                            }

                            Debug.Log("CustomNavBall.LoadFor", "Matching navball useChance = " + info.useChance + " to generated chance = " + useChance + " %");
                            if (info.useChance == 1 || useChance < info.useChance * 100)
                            {
                                Debug.Log("CustomNavBall.LoadFor", "Loading NavBallInfo.DataBase[" + i + "]");

                                // Collection
                                collection = info.collection;

                                // Colors and Textures
                                Pick(info, kerbal);

                                continue;
                            }
                        }
                    }

                    Debug.Log("CustomNavBall.LoadFor", "Ignoring NavBallInfo.DataBase[" + i + "]");
                }
            }