Example #1
0
 public PartContainer(int i, Part p, cccam c)
 {
     idx  = i;
     part = p;
     cam  = c;
 }
Example #2
0
        public void Detect()
        {
            foreach (Part myCam in this.vessel.parts)
            {
                int cnt = 0;

                if (myCam.Modules != null)
                {
                    for (int i = 0; i < myCam.Modules.Count; i++)
                    {
                        if (myCam.Modules[i] is cccam)
                        {
                            cccam myCamMod = (cccam)myCam.Modules[i];

                            if (!myCams.ContainsKey(myCam.name + cnt.ToString()))
                            {
                                myCamMod.switchOn();
                                myCamMod.isOn = true;
                                myCamMod.Events["toggleOnOff"].guiName = "Switch Off";
                                PartContainer pc = new PartContainer(cnt, myCam, myCamMod);

                                myCams.Add(pc.pcIndex, pc);
                            }
                            cnt++;
                        }
                    }
                }
                else
                {
                    Debug.Log("Modules is null");
                }
            }

            foreach (Vessel ship in FlightGlobals.Vessels)
            {
                if (ship.loaded)
                {
                    foreach (Part myCam in ship.parts)
                    {
                        int cnt = 0;

                        if (myCam.Modules != null)
                        {
                            for (int i = 0; i < myCam.Modules.Count; i++)
                            {
                                if (myCam.Modules[i] is ccrcam)
                                {
                                    ccrcam myRemoteCamMod = (ccrcam)myCam.Modules[i];

                                    if (!myCams.ContainsKey(myCam.name + cnt.ToString()))
                                    {
                                        myRemoteCamMod.switchOn();
                                        myRemoteCamMod.isOn = true;
                                        myRemoteCamMod.Events["toggleOnOff"].guiName = "Switch Off";
                                        PartContainer pc = new PartContainer(cnt, myCam, myRemoteCamMod);

                                        myCams.Add(pc.pcIndex, pc);
                                    }
                                    cnt++;
                                }
                            }
                        }
                        else
                        {
                            Debug.Log("Modules is null");
                        }
                    }
                }
            }
        }