Exemplo n.º 1
0
        public void ToggleTankType()
        {
            switch (tankType)
            {
            case BallastTankTypes.Ballast:
            default:
                tankType = BallastTankTypes.ForwardTrim;
                break;

            case BallastTankTypes.ForwardTrim:
                tankType = BallastTankTypes.AftTrim;
                break;

            case BallastTankTypes.AftTrim:
                tankType = BallastTankTypes.Ballast;
                break;
            }

            updateGUI();

            int            count = this.part.symmetryCounterparts.Count;
            WBIBallastTank ballastTank;

            for (int index = 0; index < count; index++)
            {
                ballastTank = this.part.symmetryCounterparts[index].FindModuleImplementing <WBIBallastTank>();
                if (ballastTank != null)
                {
                    ballastTank.tankType = this.tankType;
                    ballastTank.updateGUI();
                }
            }
        }
Exemplo n.º 2
0
        private void onVariantChanged(BaseField baseField, object obj)
        {
            tankType = (BallastTankTypes)Enum.ToObject(typeof(BallastTankTypes), tankTypeIndex);
            updateGUI();
            onBallastTankUpdated.Fire(this, tankType, ventState, isConverted);

            if (updateSymmetryTanks)
            {
                int count = part.symmetryCounterparts.Count;
                if (count == 0)
                {
                    return;
                }
                SWBallastTank ballastTank;
                for (int index = 0; index < count; index++)
                {
                    ballastTank = part.symmetryCounterparts[index].FindModuleImplementing <SWBallastTank>();
                    if (ballastTank != null)
                    {
                        ballastTank.tankType = tankType;
                        ballastTank.updateGUI();
                    }
                }
                ballastTank = part.symmetryCounterparts[0].FindModuleImplementing <SWBallastTank>();
                onBallastTankUpdated.Fire(ballastTank, ballastTank.tankType, ballastTank.ventState, ballastTank.isConverted);
            }

            if (HighLogic.LoadedSceneIsEditor)
            {
                EditorLogic.fetch.SetBackup();
            }
        }
Exemplo n.º 3
0
        void OnBallastTankUpdated(SWBallastTank ballastTank, BallastTankTypes ballastTankType, BallastVentStates ballastVentState, bool tankIsConverted)
        {
            // Stay in sync with other ballast tanks that are controlling the host part.
            if (ballastTank.hostPart != hostPart)
            {
                return;
            }

            tankType    = ballastTankType;
            ventState   = ballastVentState;
            isConverted = tankIsConverted;
            updatePAW   = true;
            updateGUI();
        }