Exemple #1
0
        public virtual void FixModule(bool isEnabled)
        {
            try
            {
                switch (type)
                {
                case "ModuleWheelDeployment":
                    new LandingGearEC(module as ModuleWheelDeployment, extra_Deploy).FixModule(isEnabled);
                    break;

                case "ModuleAnimateGeneric":
                    new ModuleAnimateGenericEC(module as ModuleAnimateGeneric, extra_Cost).FixModule(isEnabled);
                    break;

                case "ModuleColorChanger":
                    new ModuleAnimateGenericEC(module as ModuleColorChanger, extra_Cost).FixModule(isEnabled);
                    break;

                case "ModuleAnimationGroup":
                    new AnimationGroupEC(module as ModuleAnimationGroup, extra_Cost, extra_Deploy).FixModule(isEnabled);
                    break;
                }
            }
            catch (Exception e)
            {
                Lib.Error("'{0}': {1}", part.partInfo.title, e.Message);
            }
        }
Exemple #2
0
        public virtual bool GetIsConsuming()
        {
            try
            {
                switch (type)
                {
                case "ModuleWheelDeployment":
                    modReturn  = new LandingGearEC(module as ModuleWheelDeployment, extra_Deploy).GetConsume();
                    actualCost = modReturn.Value;
                    return(modReturn.Key);

                case "ModuleColorChanger":
                    modReturn  = new ModuleAnimateGenericEC(module as ModuleColorChanger, extra_Cost).GetConsume();
                    actualCost = modReturn.Value;
                    return(modReturn.Key);

                case "ModuleAnimateGeneric":
                    modReturn  = new ModuleAnimateGenericEC(module as ModuleAnimateGeneric, extra_Cost).GetConsume();
                    actualCost = modReturn.Value;
                    return(modReturn.Key);

                case "ModuleAnimationGroup":
                    modReturn  = new AnimationGroupEC(module as ModuleAnimationGroup, extra_Cost, extra_Deploy).GetConsume();
                    actualCost = modReturn.Value;
                    return(modReturn.Key);
                }
            }
            catch (Exception e)
            {
                Lib.Error("'{0}': {1}", part.partInfo.title, e.Message);
            }
            actualCost = extra_Deploy;
            return(true);
        }
Exemple #3
0
 protected override void OnNetworkInitialized()
 {
     base.OnNetworkInitialized();
     try
     {
         GameEvents.onStageActivate.Add(StageActivate);
         GameEvents.onVesselWasModified.Add(VesselModified);
     }
     catch (Exception e)
     {
         Lib.Error("Vessel '{0}' doesn't have any CommNet capability, likely a mislabelled junk or a kerbin on EVA", Vessel.GetName());
         Lib.Error("'{0}'", e.Message);
     }
 }
Exemple #4
0
        // Some modules need to update the UI constantly
        public virtual void Constant_OnGUI(bool isEnabled)
        {
            try
            {
                switch (type)
                {
                case "ModuleAnimateGeneric":
                    new ModuleAnimateGenericEC(module as ModuleAnimateGeneric, extra_Cost).GUI_Update(isEnabled);
                    break;

                case "ModuleAnimationGroup":
                    new AnimationGroupEC(module as ModuleAnimationGroup, extra_Cost, extra_Deploy).GUI_Update(isEnabled);
                    break;
                }
            }
            catch (Exception e)
            {
                Lib.Error("'{0}': {1}", part.partInfo.title, e.Message);
            }
        }
Exemple #5
0
        public override void Constant_OnGUI(bool isEnabled)
        {
            try
            {
                switch (type)
                {
                case "ModuleDataTransmitter":
                    new AntennaEC(module as ModuleDataTransmitter, extra_Cost, extra_Deploy, antennaPower).GUI_Update(isEnabled);
                    break;

                case "Antenna":
                    new AntennaEC(module as Antenna, extra_Cost, extra_Deploy).GUI_Update(isEnabled);
                    break;
                }
            }
            catch (Exception e)
            {
                Lib.Error("'{0}': {1}", part.partInfo.title, e.Message);
            }
        }
Exemple #6
0
        public override bool GetIsConsuming()
        {
            try
            {
                switch (type)
                {
                case "ModuleDataTransmitter":
                    modReturn  = new AntennaEC(module as ModuleDataTransmitter, extra_Cost, extra_Deploy, antennaPower).GetConsume();
                    actualCost = modReturn.Value;
                    return(modReturn.Key);

                case "Antenna":
                    modReturn  = new AntennaEC(module as Antenna, extra_Cost, extra_Deploy).GetConsume();
                    actualCost = modReturn.Value;
                    return(modReturn.Key);
                }
            }
            catch (Exception e)
            {
                Lib.Error("'{0}': {1}", part.partInfo.title, e.Message);
            }
            actualCost = extra_Deploy;
            return(true);
        }