コード例 #1
0
 public void Start()
 {
     foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("INTERNAL"))
     {
         if (node.GetValue("name") == internalModel.internalName)
         {
             foreach (ConfigNode moduleConfig in node.GetNodes("MODULE"))
             {
                 // The order we get should in theory match the order of seats, shouldn't it.
                 if (moduleConfig.HasValue("name") && moduleConfig.GetValue("name") == "InternalSeat")
                 {
                     var seatData = new SeatCamera();
                     seatData.fov      = moduleConfig.GetFloat("fov") ?? defaultFov;
                     seatData.maxRot   = moduleConfig.GetFloat("maxRot") ?? defaultMaxRot;
                     seatData.maxPitch = moduleConfig.GetFloat("maxPitch") ?? defaultMaxPitch;
                     seatData.minPitch = moduleConfig.GetFloat("minPitch") ?? defaultMinPitch;
                     seats.Add(seatData);
                     JUtil.LogMessage(this, "Setting per-seat camera parameters for seat {0}: fov {1}, maxRot {2}, maxPitch {3}, minPitch {4}",
                                      seats.Count - 1, seatData.fov, seatData.maxRot, seatData.maxPitch, seatData.minPitch);
                 }
             }
         }
     }
     // Pseudo-seat with default values.
     seats.Add(new SeatCamera {
         fov      = defaultFov,
         maxRot   = defaultMaxRot,
         maxPitch = defaultMaxPitch,
         minPitch = defaultMinPitch
     });
 }
コード例 #2
0
		public void Start()
		{
			foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes ("INTERNAL")) {
				if (node.GetValue("name") == internalModel.internalName) {
					foreach (ConfigNode moduleConfig in node.GetNodes("MODULE")) {
						// The order we get should in theory match the order of seats, shouldn't it.
						if (moduleConfig.HasValue("name") && moduleConfig.GetValue("name") == "InternalSeat") {
							var seatData = new SeatCamera();
							seatData.fov = moduleConfig.GetFloat("fov") ?? defaultFov;
							seatData.maxRot = moduleConfig.GetFloat("maxRot") ?? defaultMaxRot;
							seatData.maxPitch = moduleConfig.GetFloat("maxPitch") ?? defaultMaxPitch;
							seatData.minPitch = moduleConfig.GetFloat("minPitch") ?? defaultMinPitch;
							seats.Add(seatData);
							JUtil.LogMessage(this, "Setting per-seat camera parameters for seat {0}: fov {1}, maxRot {2}, maxPitch {3}, minPitch {4}",
								seats.Count - 1, seatData.fov, seatData.maxRot, seatData.maxPitch, seatData.minPitch);
						}
					}
				}
			}
			// Pseudo-seat with default values.
			seats.Add(new SeatCamera {
				fov = defaultFov,
				maxRot = defaultMaxRot,
				maxPitch = defaultMaxPitch,
				minPitch = defaultMinPitch
			});
		}
コード例 #3
0
        public void Start()
        {
            foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("INTERNAL"))
            {
                if (node.GetValue("name") == internalModel.internalName)
                {
                    foreach (ConfigNode moduleConfig in node.GetNodes("MODULE"))
                    {
                        // The order we get should in theory match the order of seats, shouldn't it.
                        if (moduleConfig.HasValue("name") && moduleConfig.GetValue("name") == "InternalSeat")
                        {
                            var seatData = new SeatCamera();
                            seatData.fov = moduleConfig.GetFloat("fov") ?? defaultFov;
                            seatData.maxRot = moduleConfig.GetFloat("maxRot") ?? defaultMaxRot;
                            seatData.maxPitch = moduleConfig.GetFloat("maxPitch") ?? defaultMaxPitch;
                            seatData.minPitch = moduleConfig.GetFloat("minPitch") ?? defaultMinPitch;
                            seatData.hideKerbal = HideKerbal.none;

                            if (moduleConfig.HasValue("hideKerbal"))
                            {
                                string hideKerbalVal = moduleConfig.GetValue("hideKerbal");
                                if (hideKerbalVal == HideKerbal.head.ToString())
                                {
                                    seatData.hideKerbal = HideKerbal.head;
                                }
                                else if (hideKerbalVal == HideKerbal.all.ToString())
                                {
                                    seatData.hideKerbal = HideKerbal.all;
                                }
                            }

                            seats.Add(seatData);
                            JUtil.LogMessage(this, "Setting per-seat camera parameters for seat {0}: fov {1}, maxRot {2}, maxPitch {3}, minPitch {4}, hideKerbal {5}",
                                seats.Count - 1, seatData.fov, seatData.maxRot, seatData.maxPitch, seatData.minPitch, seatData.hideKerbal.ToString());
                        }
                    }
                }
            }
            GameEvents.OnCameraChange.Add(OnCameraChange);
            GameEvents.OnIVACameraKerbalChange.Add(OnIVACameraChange);
            // Pseudo-seat with default values.
            seats.Add(new SeatCamera
            {
                fov = defaultFov,
                maxRot = defaultMaxRot,
                maxPitch = defaultMaxPitch,
                minPitch = defaultMinPitch,
                hideKerbal = HideKerbal.none
            });

            // If (somehow) we start in IVA, make sure we initialize here.
            if (JUtil.UserIsInPod(part) && InternalCamera.Instance != null && InternalCamera.Instance.isActive && CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.IVA)
            {
                Kerbal activeKerbal = part.FindCurrentKerbal();
                int seatID;
                if (activeKerbal == null)
                {
                    seatID = -1;
                }
                else
                {
                    seatID = activeKerbal.protoCrewMember.seatIdx;
                }

                UpdateCameras(seatID, activeKerbal);
            }
        }
コード例 #4
0
        public void Start()
        {
            foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("INTERNAL"))
            {
                if (node.GetValue("name") == internalModel.internalName)
                {
                    foreach (ConfigNode moduleConfig in node.GetNodes("MODULE"))
                    {
                        // The order we get should in theory match the order of seats, shouldn't it.
                        if (moduleConfig.HasValue("name") && moduleConfig.GetValue("name") == "InternalSeat")
                        {
                            var seatData = new SeatCamera();
                            seatData.fov        = moduleConfig.GetFloat("fov") ?? defaultFov;
                            seatData.maxRot     = moduleConfig.GetFloat("maxRot") ?? defaultMaxRot;
                            seatData.maxPitch   = moduleConfig.GetFloat("maxPitch") ?? defaultMaxPitch;
                            seatData.minPitch   = moduleConfig.GetFloat("minPitch") ?? defaultMinPitch;
                            seatData.hideKerbal = HideKerbal.none;

                            if (moduleConfig.HasValue("hideKerbal"))
                            {
                                string hideKerbalVal = moduleConfig.GetValue("hideKerbal");
                                if (hideKerbalVal == HideKerbal.head.ToString())
                                {
                                    seatData.hideKerbal = HideKerbal.head;
                                }
                                else if (hideKerbalVal == HideKerbal.all.ToString())
                                {
                                    seatData.hideKerbal = HideKerbal.all;
                                }
                            }

                            seats.Add(seatData);
                            JUtil.LogMessage(this, "Setting per-seat camera parameters for seat {0}: fov {1}, maxRot {2}, maxPitch {3}, minPitch {4}, hideKerbal {5}",
                                             seats.Count - 1, seatData.fov, seatData.maxRot, seatData.maxPitch, seatData.minPitch, seatData.hideKerbal.ToString());
                        }
                    }
                }
            }
            GameEvents.OnCameraChange.Add(OnCameraChange);
            GameEvents.OnIVACameraKerbalChange.Add(OnIVACameraChange);
            // Pseudo-seat with default values.
            seats.Add(new SeatCamera
            {
                fov        = defaultFov,
                maxRot     = defaultMaxRot,
                maxPitch   = defaultMaxPitch,
                minPitch   = defaultMinPitch,
                hideKerbal = HideKerbal.none
            });

            // If (somehow) we start in IVA, make sure we initialize here.
            if (JUtil.UserIsInPod(part) && InternalCamera.Instance != null && InternalCamera.Instance.isActive && CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.IVA)
            {
                Kerbal activeKerbal = part.FindCurrentKerbal();
                int    seatID;
                if (activeKerbal == null)
                {
                    seatID = -1;
                }
                else
                {
                    seatID = activeKerbal.protoCrewMember.seatIdx;
                }

                UpdateCameras(seatID, activeKerbal);
            }
        }