示例#1
0
 private static void SetTexture(TexturePreset preset)
 {
     typeof(GrassColor2).GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic).SetValue(selectedMod, preset.texturePath);
     selectedMod.ApplySettings();
 }
示例#2
0
        internal static void CreateContent()
        {
            content.Add(new DialogGUIHorizontalLayout(
                            new DialogGUILabel("Grass Color Editor", HighLogic.UISkin.label),
                            new DialogGUIFlexibleSpace(),
                            new DialogGUIButton("select preset", delegate { GrassColorPresetUI2.callBack = selectedMod.UpdateCallBack; GrassColorPresetUI2.instance.Open(); }, 50, 25, false),
                            new DialogGUIFlexibleSpace(),
                            new DialogGUIButton("Pick Surface Color", delegate {
                selectedMod.grassColor = GrassColorUtils.GetUnderGroundColor(selectedMod);
                selectedMod.ApplySettings();
            }, 80, 25, false)
                            ));


            content.Add(VaiantList);
            content.Add(new DialogGUIVerticalLayout(
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("NearGrassTexture", KKStyle.whiteLabel),
                                new DialogGUITextInput(NearGrassTexture, false, 40, SetNearGrassTexture, delegate { return(GetTextureName("nearGrassTextureName")); }, TMPro.TMP_InputField.ContentType.Standard, 25),
                                new DialogGUIButton("  S", delegate { OpenTextureSelector("nearGrassTextureName"); }, 21f, 21.0f, false, HighLogic.UISkin.label)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("FarGrassTexture", KKStyle.whiteLabel),
                                new DialogGUITextInput(FarGrassTexture, false, 40, SetFarGrassTexture, delegate { return(GetTextureName("farGrassTextureName")); }, TMPro.TMP_InputField.ContentType.Standard, 25),
                                new DialogGUIButton("  S", delegate { OpenTextureSelector("farGrassTextureName"); }, 21f, 21.0f, false, HighLogic.UISkin.label)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("TamarcTexture", KKStyle.whiteLabel),
                                new DialogGUITextInput(TamarcTexture, false, 40, SetTarmacTexture, delegate { return(GetTextureName("tarmacTextureName")); }, TMPro.TMP_InputField.ContentType.Standard, 25),
                                new DialogGUIButton("  S", delegate { OpenTextureSelector("tarmacTextureName"); }, 21f, 21.0f, false, HighLogic.UISkin.label)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("BlendMaskTexture", KKStyle.whiteLabel),
                                new DialogGUITextInput(BlendMaskTexture, false, 40, SetBlendMaskTexture, delegate { return(GetTextureName("blendMaskTextureName")); }, TMPro.TMP_InputField.ContentType.Standard, 25),
                                new DialogGUIButton("  S", delegate { OpenTextureSelector("blendMaskTextureName", TextureUsage.BlendMask); }, 21f, 21.0f, false, HighLogic.UISkin.label)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel(" Grass: R ", KKStyle.whiteLabel),
                                new DialogGUISlider(GetGrassFloatR, 0, 4f, false, 140, 25, SetGrassFloatR),
                                new DialogGUITextInput("0", false, 10, SetGrassRStr, GetGrassRStr, TMPro.TMP_InputField.ContentType.DecimalNumber, 25)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel(" Grass: G ", KKStyle.whiteLabel),
                                new DialogGUISlider(GetGrassFloatG, 0, 4f, false, 140, 25, SetGrassFloatG),
                                new DialogGUITextInput("0", false, 10, SetGrassGStr, GetGrassGStr, TMPro.TMP_InputField.ContentType.DecimalNumber, 25)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel(" Grass: B ", KKStyle.whiteLabel),
                                new DialogGUISlider(GetGrassFloatB, 0, 4f, false, 140, 25, SetGrassFloatB),
                                new DialogGUITextInput("0", false, 10, SetGrassBStr, GetGrassBStr, TMPro.TMP_InputField.ContentType.DecimalNumber, 25)),
                            //new DialogGUIHorizontalLayout(
                            //     new DialogGUILabel("Tarmac: R ", HighLogic.UISkin.label),
                            //     new DialogGUISlider(GetTarmacFloatR, 0, 1, false, 140, 25, SetTarmacFloatR),
                            //     new DialogGUITextInput("0", false, 10, SetTarmacRStr, GetTarmacRStr, TMPro.TMP_InputField.ContentType.DecimalNumber, 25)),
                            //new DialogGUIHorizontalLayout(
                            //     new DialogGUILabel("Tarmac: G ", HighLogic.UISkin.label),
                            //     new DialogGUISlider(GetTarmacFloatG, 0, 1, false, 140, 25, SetTarmacFloatG),
                            //     new DialogGUITextInput("0", false, 10, SetTarmacGStr, GetTarmacGStr, TMPro.TMP_InputField.ContentType.DecimalNumber, 25)),
                            //new DialogGUIHorizontalLayout(
                            //     new DialogGUILabel("Tarmac: B ", HighLogic.UISkin.label),
                            //     new DialogGUISlider(GetTarmacFloatB, 0, 1, false, 140, 25, SetTarmacFloatB),
                            //     new DialogGUITextInput("0", false, 10, SetTarmacBStr, GetTarmacBStr, TMPro.TMP_InputField.ContentType.DecimalNumber, 25)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("NearGrassTiling", KKStyle.whiteLabel),
                                new DialogGUITextInput(NearGrassTiling, NearGrassTiling, false, 10, SetNearTile, 25)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("FarGrassTiling", KKStyle.whiteLabel),
                                new DialogGUITextInput(FarGrassTiling, FarGrassTiling, false, 10, SetFarTile, 25)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("FarBlendDistance", KKStyle.whiteLabel),
                                new DialogGUITextInput(BlendDistance, BlendDistance, false, 10, SetBlendDistance, 25))

                            //new DialogGUIHorizontalLayout(
                            //    new DialogGUILabel("Overall Tiling", KKStyle.whiteLabel),
                            //    new DialogGUISlider(GetOffsetTiling, 0, 200f, true, 140, 25, SetOffsetTiling),
                            //    new DialogGUITextInput("0", false, 10, SetOffsetTilingStr, GetOffsetTilingStr, TMPro.TMP_InputField.ContentType.DecimalNumber, 25))

                            ));;
        }
示例#3
0
        internal static void CreateContent()
        {
            content.Add(new DialogGUIHorizontalLayout(
                            new DialogGUILabel("Grass Color Editor", HighLogic.UISkin.label),
                            new DialogGUIFlexibleSpace(),
                            new DialogGUIButton("select preset", delegate { GrassColorPresetUI2.callBack = selectedMod.UpdateCallBack; GrassColorPresetUI2.instance.Open(); }, 50, 25, false),
                            new DialogGUIFlexibleSpace(),
                            new DialogGUIButton("Pick Surface Color", delegate {
                selectedMod.grassColor = GrassColorUtils.GetUnderGroundColor(selectedMod);
                selectedMod.ApplySettings();
            }, 80, 25, false)
                            ));


            content.Add(VaiantList);

            content.Add(new DialogGUIVerticalLayout(
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("Grass Color : ", KKStyle.whiteLabel),
                                new DialogGUITextInput("", false, 40, delegate(string colorString) { selectedMod.grassColor = ConfigNode.ParseColor(colorString); return(colorString); }, delegate { return(ConfigNode.WriteColor(selectedMod.grassColor)); }, TMPro.TMP_InputField.ContentType.Standard, 25),
                                new DialogGUIButton("Edit", delegate { ColorSelector.callBack = SetGrassColor;; ColorSelector.selectedColor = selectedMod.grassColor; ColorSelector.Open(); }, 40f, 21.0f, false, KKStyle.whiteLabel)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("NearGrassTexture", KKStyle.whiteLabel),
                                new DialogGUITextInput(NearGrassTexture, false, 40, SetNearGrassTexture, delegate { return(GetTextureName("nearGrassTextureName")); }, TMPro.TMP_InputField.ContentType.Standard, 25),
                                new DialogGUIButton("  S", delegate { OpenTextureSelector("nearGrassTextureName"); }, 21f, 21.0f, false, HighLogic.UISkin.label)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("NearGrassTiling", KKStyle.whiteLabel),
                                new DialogGUITextInput(NearGrassTiling, NearGrassTiling, false, 10, SetNearTile, 25),
                                new DialogGUIToggle(selectedMod.nearGrassTextureGray, "GrayScale", delegate(bool state) { selectedMod.nearGrassTextureGray = state; selectedMod.ApplySettings(); }, 120, 21)),

                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("FarGrassTexture", KKStyle.whiteLabel),
                                new DialogGUITextInput(FarGrassTexture, false, 40, SetFarGrassTexture, delegate { return(GetTextureName("farGrassTextureName")); }, TMPro.TMP_InputField.ContentType.Standard, 25),
                                new DialogGUIButton("  S", delegate { OpenTextureSelector("farGrassTextureName"); }, 21f, 21.0f, false, HighLogic.UISkin.label)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("FarGrassTiling", KKStyle.whiteLabel),
                                new DialogGUITextInput(FarGrassTiling, FarGrassTiling, false, 10, SetFarTile, 25),
                                new DialogGUIToggle(selectedMod.farGrassTextureGray, "GrayScale", delegate(bool state) { selectedMod.farGrassTextureGray = state; selectedMod.ApplySettings(); }, 120, 21)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("FarBlendDistance", KKStyle.whiteLabel),
                                new DialogGUITextInput(BlendDistance, BlendDistance, false, 10, SetBlendDistance, 25)),
                            new DialogGUIHorizontalLayout(

                                new DialogGUILabel("TamarcTexture", KKStyle.whiteLabel),
                                new DialogGUITextInput(TamarcTexture, false, 40, SetTarmacTexture, delegate { return(GetTextureName("tarmacTextureName")); }, TMPro.TMP_InputField.ContentType.Standard, 25),
                                new DialogGUIButton("  S", delegate { OpenTextureSelector("tarmacTextureName"); }, 21f, 21.0f, false, HighLogic.UISkin.label)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("Tarmac Color : ", KKStyle.whiteLabel),
                                new DialogGUITextInput("", false, 40, delegate(string colorString) { selectedMod.tarmacColor = ConfigNode.ParseColor(colorString); return(colorString); }, delegate { return(ConfigNode.WriteColor(selectedMod.tarmacColor)); }, TMPro.TMP_InputField.ContentType.Standard, 25),
                                new DialogGUIButton("Edit", delegate { ColorSelector.callBack = SetTarmacColor;; ColorSelector.selectedColor = selectedMod.tarmacColor; ColorSelector.Open(); }, 40f, 21.0f, false, KKStyle.whiteLabel)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("Tarmac Tiling: U: ", KKStyle.whiteLabel),
                                new DialogGUITextInput("0", false, 10, SetTarmacUStr, GetTarmacUStr, TMPro.TMP_InputField.ContentType.DecimalNumber, 25),
                                new DialogGUILabel("V: ", KKStyle.whiteLabel),
                                new DialogGUITextInput("0", false, 10, SetTarmacVStr, GetTarmacVStr, TMPro.TMP_InputField.ContentType.DecimalNumber, 25)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUIToggle(selectedMod.tarmacTileRandom, "Tarmac Random", delegate(bool state) { selectedMod.tarmacTileRandom = state; selectedMod.ApplySettings(); }, 120, 21),
                                new DialogGUIToggle(selectedMod.tarmacTextureGray, "Tarmac GrayScale", delegate(bool state) { selectedMod.tarmacTextureGray = state; selectedMod.ApplySettings(); }, 120, 21)),

                            new DialogGUIHorizontalLayout(
                                new DialogGUIButton("  R", ReloadBlendMask, 21f, 21.0f, false, HighLogic.UISkin.label),
                                new DialogGUILabel("BlendMask", KKStyle.whiteLabel),
                                new DialogGUITextInput(BlendMaskTexture, false, 40, SetBlendMaskTexture, delegate { return(GetTextureName("blendMaskTextureName")); }, TMPro.TMP_InputField.ContentType.Standard, 25),
                                new DialogGUIButton("  S", delegate { OpenTextureSelector("blendMaskTextureName", TextureUsage.BlendMask); }, 21f, 21.0f, false, HighLogic.UISkin.label)),

                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("Third Texture", KKStyle.whiteLabel),
                                new DialogGUITextInput(ThirdTexture, false, 40, SetThirdTexture, delegate { return(GetTextureName("thirdTextureName")); }, TMPro.TMP_InputField.ContentType.Standard, 25),
                                new DialogGUIButton("  S", delegate { OpenTextureSelector("thirdTextureName"); }, 21f, 21.0f, false, HighLogic.UISkin.label)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("Third Texture Tiling: ", KKStyle.whiteLabel),
                                new DialogGUITextInput(ThirdTextureTiling, ThirdTextureTiling, false, 10, SetThirdTile, 25),
                                new DialogGUIToggle(selectedMod.thirdTextureTileRandom, "Random", delegate(bool state) { selectedMod.thirdTextureTileRandom = state; selectedMod.ApplySettings(); }, 60, 21),
                                new DialogGUIToggle(selectedMod.thirdTextureGray, "Gray", delegate(bool state) { selectedMod.thirdTextureGray = state; selectedMod.ApplySettings(); }, 60, 21)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("Third Color : ", KKStyle.whiteLabel),
                                new DialogGUITextInput("", false, 40, delegate(string colorString) { selectedMod.thirdTextureColor = ConfigNode.ParseColor(colorString); return(colorString); }, delegate { return(ConfigNode.WriteColor(selectedMod.thirdTextureColor)); }, TMPro.TMP_InputField.ContentType.Standard, 25),
                                new DialogGUIButton("Edit", delegate { ColorSelector.callBack = SetThirdColor;; ColorSelector.selectedColor = selectedMod.thirdTextureColor; ColorSelector.Open(); }, 40f, 21.0f, false, KKStyle.whiteLabel)),

                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("Fourth Texture", KKStyle.whiteLabel),
                                new DialogGUITextInput(FourthTexture, false, 40, SetFourthTexture, delegate { return(GetTextureName("fourthTextureName")); }, TMPro.TMP_InputField.ContentType.Standard, 25),
                                new DialogGUIButton("  S", delegate { OpenTextureSelector("fourthTextureName"); }, 21f, 21.0f, false, HighLogic.UISkin.label)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("Fourth Texture Tiling: ", KKStyle.whiteLabel),
                                new DialogGUITextInput(FourthTextureTiling, FourthTextureTiling, false, 10, SetFourthTile, 25),
                                new DialogGUIToggle(selectedMod.fourthTextureTileRandom, "Random", delegate(bool state) { selectedMod.fourthTextureTileRandom = state; selectedMod.ApplySettings(); }, 60, 21),
                                new DialogGUIToggle(selectedMod.fourthTextureGray, "Gray", delegate(bool state) { selectedMod.fourthTextureGray = state; selectedMod.ApplySettings(); }, 60, 21)),
                            new DialogGUIHorizontalLayout(
                                new DialogGUILabel("Fourth Color : ", KKStyle.whiteLabel),
                                new DialogGUITextInput("", false, 40, delegate(string colorString) { selectedMod.fourthTextureColor = ConfigNode.ParseColor(colorString); return(colorString); }, delegate { return(ConfigNode.WriteColor(selectedMod.fourthTextureColor)); }, TMPro.TMP_InputField.ContentType.Standard, 25),
                                new DialogGUIButton("Edit", delegate { ColorSelector.callBack = SetFourthColor;; ColorSelector.selectedColor = selectedMod.fourthTextureColor; ColorSelector.Open(); }, 40f, 21.0f, false, KKStyle.whiteLabel))

                            //new DialogGUIHorizontalLayout(
                            //    new DialogGUILabel("Overall Tiling", KKStyle.whiteLabel),
                            //    new DialogGUISlider(GetOffsetTiling, 0, 200f, true, 140, 25, SetOffsetTiling),
                            //    new DialogGUITextInput("0", false, 10, SetOffsetTilingStr, GetOffsetTilingStr, TMPro.TMP_InputField.ContentType.DecimalNumber, 25))

                            ));;
        }