private void ApplyShader(Material material) { if (material.shader.name != "Custom/DistrictBuilding") { material.shader = AssetsLoader.GetAsset("DistrictBuilding") as Shader; material.SetFloat("_MinHeight", float.MinValue); material.SetFloat("_MaxHeight", float.MaxValue); material.SetFloat("_WallProgress", 1f); material.SetTexture("_MainTex", AssetsLoader.GetAsset("largehousetex_default") as Texture2D); material.SetTexture("_MaskTex", AssetsLoader.GetAsset("largehousetex_mask") as Texture2D); material.color = Color.white; } }
private void InitializeCompute() { if (renderTexture == null) { renderTexture = new RenderTexture(textureWidth, textureHeight, 0, RenderTextureFormat.RGB111110Float); renderTexture.enableRandomWrite = true; renderTexture.Create(); } compute = AssetsLoader.GetAsset("GenerateSVTexture") as ComputeShader; kernelID = compute.FindKernel("CSMain"); image.texture = renderTexture; }
void Init() { this.OptionsContainer = Assets.District_UI_Children.Find(i => i.name == "Options"); this.Option = AssetsLoader.GetAsset("Option") as GameObject; }
public static void SetupAssets(KCModHelper _helper) { _helper.Log("-----------HOOKING UP ASSETS------------"); // Setup District UI GameObject District_UI_GameObject = GameObject.Instantiate(AssetsLoader.GetAsset("District") as GameObject); Transform Worker_UI = GameState.inst.playingMode.GameUIParent.transform.Find("WorkerUICanvas").Find("WorkerUI"); District_UI_GameObject.transform.SetParent(Worker_UI, false); // Collect Specific Children In District UI List <String> filter = new List <String>(new String[] { "District(Clone)", "Expand", "CreateSwatch", "ToggleSwatchPicker", "Dropdown", "Options", "Option", "ContentBar", "Picker", "Fill", "InputField", "BoxSlider", "Hue", "Background", "ModelPreview", "ToggleDeleteMode" }); District_UI_Children = Utilities.CollectChildren(District_UI_GameObject.transform, null, filter); GameObject Option_Prefab = District_UI_Children.Find(i => i.name == "Option").gameObject; AssetInfo option_Info = new AssetInfo("Option.Prefab", Option_Prefab.GetType(), Option_Prefab); AssetsLoader.assets.Add(option_Info); _helper.Log(option_Info.ToString()); // Mod Components District district_Component = District_UI_GameObject.AddComponent <District>(); Expand expand_Component = District_UI_Children.Find(i => i.name == "Expand").gameObject.AddComponent <Expand>(); CreateSwatch createSwatch_Component = District_UI_Children.Find(i => i.name == "CreateSwatch").gameObject.AddComponent <CreateSwatch>(); ModelPreview modelPreview_Component = District_UI_Children.Find(i => i.name == "ModelPreview").gameObject.AddComponent <ModelPreview>(); ToggleSwatchPicker toggleSwatchPicker_Component = District_UI_Children.Find(i => i.name == "ToggleSwatchPicker").gameObject.AddComponent <ToggleSwatchPicker>(); ToggleDeleteMode toggleDeleteMode_Componenet = District_UI_Children.Find(i => i.name == "ToggleDeleteMode").gameObject.AddComponent <ToggleDeleteMode>(); district_Component.AddSwatch(Color.white, District.SwatchType.Default); district_Component.AddSwatch(Color.blue, District.SwatchType.Default); district_Component.AddSwatch(Color.cyan, District.SwatchType.Default); district_Component.AddSwatch(Color.gray, District.SwatchType.Default); district_Component.AddSwatch(Color.green, District.SwatchType.Default); district_Component.AddSwatch(Color.magenta, District.SwatchType.Default); district_Component.AddSwatch(Color.red, District.SwatchType.Default); district_Component.AddSwatch(Color.yellow, District.SwatchType.Default); // Color Picker ColorPicker colorPicker_Component = District_UI_Children.Find(i => i.name == "Picker").gameObject.AddComponent <ColorPicker>(); ColorImage colorImage_Component = District_UI_Children.Find(i => i.name == "Fill").gameObject.AddComponent <ColorImage>(); colorImage_Component.picker = colorPicker_Component; HexColorField hexColorField_Component = District_UI_Children.Find(i => i.name == "InputField").gameObject.AddComponent <HexColorField>(); hexColorField_Component.hsvpicker = colorPicker_Component; BoxSlider boxSlider_Component = District_UI_Children.Find(i => i.name == "BoxSlider").gameObject.AddComponent <BoxSlider>(); boxSlider_Component.handleRect = boxSlider_Component.transform.Find("Handle Slide Area").Find("Handle").GetComponent <RectTransform>(); SVBoxSlider sVBoxSlider = boxSlider_Component.gameObject.AddComponent <SVBoxSlider>(); sVBoxSlider.picker = colorPicker_Component; ColorSlider colorSlider_Component = District_UI_Children.Find(i => i.name == "Hue").gameObject.AddComponent <ColorSlider>(); colorSlider_Component.hsvpicker = colorPicker_Component; colorSlider_Component.type = ColorValues.Hue; ColorSliderImage colorSliderImage_Component = colorSlider_Component.transform.Find("Background").gameObject.AddComponent <ColorSliderImage>(); colorSliderImage_Component.picker = colorPicker_Component; colorSliderImage_Component.type = ColorValues.Hue; colorSliderImage_Component.direction = Slider.Direction.BottomToTop; _helper.Log("-----------ASSETS HOOKED UP------------"); }