/// <summary> /// Create a Color Picker process with initialColor, useDefinedPosition, texturePath pLeft, pTop, activePingsNeeded, destroyOnClose /// </summary> /// <param name="initialColor">Sets the initial color</param> /// <param name="useDefinedPosition">Indicates whether a user-defined position is specified </param> /// <param name="texturePath">Path to a ColorPicker texture</param> /// <param name="pLeft">Left most pixel position of the window</param> /// <param name="pTop">Top most pixel position of the window</param> /// <param name="activePingsNeeded">If true, window needs frequent "pings" to not automatically close</param> /// <param name="destroyOnClose">If true, then destroys the window when closed</param> /// <returns>KSP_ColorPicker</returns> public static KSP_ColorPicker CreateColorPicker(Color initialColor, bool useDefinedPosition = false, string texturePath = null, int pLeft = 0, int pTop = 0, bool activePingsNeeded = true, bool destroyOnClose = true) { GameObject go = new GameObject(); colorPickerInstance = go.AddComponent <KSP_ColorPicker>(); colorPickerInstance.positionLeft = pLeft; colorPickerInstance.positionTop = pTop; if (texturePath != null) { colorPickerInstance.texturePath = texturePath; } pickerTextures = AvailableTextures(); // If it's not a rooted path, then assume it's in a subdir of the TEXTURES directory if (!System.IO.Path.IsPathRooted(colorPickerInstance.texturePath)) { colorPickerInstance.texturePath = TEXTURES + colorPickerInstance.texturePath; } colorPickerInstance.destroyOnClose = destroyOnClose; colorPickerInstance.FindInitTexture(); colorPickerInstance.LoadAndInitTexture(); colorPickerInstance.lastSetColor = initialColor; showPicker = true; success = false; return(colorPickerInstance); }