Esempio n. 1
0
        private CustomModeSettings setup() 
        {
            CustomModeSettings settings = new CustomModeSettings();

            SelectorDataContainer dataObject = new SelectorDataContainer();
            settings.dataInstance = dataObject;

            settings.name = "Part Selector";
            settings.ColorModeOverride = (int)CustomModeSettings.OVERRIDE_TYPES.FUNCTION;
            settings.OrientationOverride = (int)CustomModeSettings.OVERRIDE_TYPES.AS_BASIC;
            settings.CenteringOverride = (int)CustomModeSettings.OVERRIDE_TYPES.AS_BASIC;
            settings.MinimodesOverride = (int)CustomModeSettings.OVERRIDE_TYPES.STATIC;

            settings.staticSettings.displayCOM = false;
            settings.staticSettings.displayEngines = false;
            settings.staticSettings.displayAxes = false;
            settings.staticSettings.displayGround = (int)ViewerConstants.GROUND_DISPMODE.OFF;

            settings.fillColorDelegate = returnsBlack;
            settings.wireColorDelegate = getPartColorSelectMode;
            settings.boxColorDelegate = getBoxColorSelectMode;

            settings.fillColorDullDelegate = returnsTrue;
            settings.wireColorDullDelegate = returnsFalse;
            settings.boxColorDullDelegate = returnsFalse;

            return settings;
        }
Esempio n. 2
0
 //even though we dont use it, we still have to take a Part as argument to match the delegate
 private Color returnsRandomColor(CustomModeSettings customMode, Part part)
 {
     //grab the data object from the custom mode settings
     DiscoData data = (DiscoData)customMode.dataInstance;
     if (data.strobe) 
     {
         float red = data.rand.Next(256) / 256f;
         float grn = data.rand.Next(256) / 256f;
         float blu = data.rand.Next(256) / 256f;
         Color newColor = new Color(red, grn, blu);
         return newColor;
     }
     else 
     {
         int time = Time.frameCount % 512;
         if (time >= 256) time = 511 - time;
         return gradient[time];
     }
 }
Esempio n. 3
0
        //we set the custom mode up in a separate function so it can
        //be used for both the plugin and the RPM version
        private CustomModeSettings setup() 
        {
            CustomModeSettings settings = new CustomModeSettings();

            //we store our data in a object in the custom settings
            //this is not strictly necessary but it does mean you can have
            //different states active on different screens
            DiscoData dataObject = new DiscoData();
            settings.dataInstance = dataObject;

            settings.name = "DISCO MODE";

            //since we want to change the color of each part, we must override that
            settings.ColorModeOverride = (int)CustomModeSettings.OVERRIDE_TYPES.FUNCTION;
            //orientation and centering can remain user-specified
            settings.OrientationOverride = (int)CustomModeSettings.OVERRIDE_TYPES.AS_BASIC;
            settings.CenteringOverride = (int)CustomModeSettings.OVERRIDE_TYPES.AS_BASIC;
            //we need to override the settings for minimodes to disable them
            settings.MinimodesOverride = (int)CustomModeSettings.OVERRIDE_TYPES.STATIC;

            //all minimodes off
            settings.staticSettings.displayCOM = false;
            settings.staticSettings.displayEngines = false;
            settings.staticSettings.displayAxes = false;
            settings.staticSettings.displayGround = (int)ViewerConstants.GROUND_DISPMODE.OFF;

            //all functions in a given category must be overrided if any are
            settings.fillColorDelegate = returnsRandomColor;
            settings.wireColorDelegate = returnsRandomColor;
            settings.boxColorDelegate = returnsBlack;

            settings.fillColorDullDelegate = returnsFalse;
            settings.wireColorDullDelegate = returnsFalse;
            settings.boxColorDullDelegate = returnsFalse;

            return settings;
        }
Esempio n. 4
0
 public Color getBoxColorSelectMode(CustomModeSettings customMode,Part part)
 {
     if (((SelectorDataContainer)(customMode.dataInstance)).selectorTree.Active)
     {
         Part subselect = ((SelectorDataContainer)(customMode.dataInstance)).selectorTree.getSubselection();
         if (part == subselect) return Color.cyan;
         else return Color.black;
     }
     else if (((SelectorDataContainer)(customMode.dataInstance)).selectorGlobal.Active)
     {
         List<Part> parts = ((SelectorDataContainer)(customMode.dataInstance)).selectorGlobal.getPartsMatchingSelection();
         //if (parts == null) {MonoBehaviour.print("part list null"); return Color.red;}
         //if (part == null) { MonoBehaviour.print("part itself null"); return Color.red; }
         if (parts.Contains(part)) return Color.cyan;
         else return Color.black;
     }
     else if (((SelectorDataContainer)(customMode.dataInstance)).selectorSubmenu != null)
     {
         List<Part> parts = ((SelectorDataContainer)(customMode.dataInstance)).selectorSubmenu.getSelectedParts();
         if (parts.Contains(part)) return Color.cyan;
         else return Color.black;
     }
     else return Color.black;
 }
Esempio n. 5
0
 public Color returnsBlack(CustomModeSettings customMode,Part part) 
 {
     return Color.black;
 }
Esempio n. 6
0
 public bool returnsFalse(CustomModeSettings customMode) 
 {
     return false;
 }
Esempio n. 7
0
 public bool returnsTrue(CustomModeSettings customMode) 
 {
     return true;
 }
Esempio n. 8
0
 public Color getPartColorSelectMode(CustomModeSettings customMode,Part part)
 {
     if (((SelectorDataContainer)(customMode.dataInstance)).selectorTree.Active)
     {
         Color darkGreen = Color.green;
         darkGreen.g = 0.6f;
         darkGreen.r = 0.3f;
         darkGreen.b = 0.3f;
         Part selectedPart = ((SelectorDataContainer)(customMode.dataInstance)).selectorTree.getSelection();
         if (selectedPart == null) return Color.grey;
         if (part == selectedPart) return Color.green;
         if (((SelectorDataContainer)(customMode.dataInstance)).getSymm())
         {
             if (selectedPart.symmetryCounterparts.Contains(part)) return darkGreen;
         }
         if (partIsOnWayToRoot(part, selectedPart, FlightGlobals.ActiveVessel.rootPart)) return Color.yellow;
         if (part == FlightGlobals.ActiveVessel.rootPart) return Color.magenta;
         return Color.gray;
     }
     else if (((SelectorDataContainer)(customMode.dataInstance)).selectorGlobal.Active)
     {
         List<Part> parts = ((SelectorDataContainer)(customMode.dataInstance)).selectorGlobal.getPartsMatchingSelection();
         if (parts.Contains(part)) return Color.green;
         else return Color.gray;
     }
     else if (((SelectorDataContainer)(customMode.dataInstance)).selectorSubmenu != null)
     {
         List<Part> parts = ((SelectorDataContainer)(customMode.dataInstance)).selectorSubmenu.getSelectedParts();
         if (parts.Contains(part)) return Color.green;
         else return Color.gray;
     }
     else return Color.gray;
     
 }
Esempio n. 9
0
 public void setCustomSettings(CustomModeSettings settings)
 {
     customSettings = settings;
 }
Esempio n. 10
0
 private bool returnsFalse(CustomModeSettings customMode) 
 {
     return false;
 }
 public void setCustomSettings(CustomModeSettings settings)
 {
     master.CustomSettings = settings;
 }
Esempio n. 12
0
 public static void registerCustomMode(CustomModeSettings settings)
 {
     customModes.Add(settings);
 }
Esempio n. 13
0
 public void setCustomMode(CustomModeSettings customModeSettings)
 {
     customMode = customModeSettings;
 }
Esempio n. 14
0
 public void setCustomSettings(CustomModeSettings settings)
 {
     MonoBehaviour.print("just tried to set a custom mode on the custom mode menu. THIS SHOULD NEVER HAPPEN.");
 }
Esempio n. 15
0
 public static void registerCustomMode(CustomModeSettings settings) 
 {
     customModes.Add(settings);
 }