Esempio n. 1
0
        protected void DrawAdd()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Effect Name", GUILayout.Width(120f));
            newEffectName = GUILayout.TextArea(newEffectName);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Effect Parent", GUILayout.Width(120f));
            parentName = GUILayout.TextArea(parentName);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Effect Model", GUILayout.Width(120f));
            modelFlag = GUILayout.SelectionGrid(modelFlag,
                                                modelOptions, Mathf.Min(modelOptions.Length, 2),
                                                GUIResources.GetStyle("radio_text_button"));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Shader", GUILayout.Width(120f));
            shaderFlag = GUILayout.SelectionGrid(shaderFlag,
                                                 shaderOptions, Mathf.Min(shaderOptions.Length, 2),
                                                 GUIResources.GetStyle("radio_text_button"));
            GUILayout.EndHorizontal();


            if (GUILayout.Button("Add"))
            {
                Transform[] modelXforms = module.GetComponentsInChildren <Transform>();

                if (modelXforms.ToList().FindAll(x => x.name == parentName).Any())
                {
                    module.AddEffect(CreateNewEffect());
                    WaterfallUI.Instance.RefreshEffectList();
                    showWindow = false;
                }
            }
            if (GUILayout.Button("Cancel"))
            {
                showWindow = false;
            }
        }
        protected void DrawAdd()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Effect Name", GUILayout.Width(160f));
            newEffectName = GUILayout.TextArea(newEffectName, GUILayout.Width(200f));
            GUILayout.Space(250f);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Effect Parent [required]", GUILayout.Width(160f));
            parentName = GUILayout.TextArea(parentName, GUILayout.Width(200f));
            if (parentErrorString != "")
            {
                GUILayout.Label($"<color=#FF0000>{parentErrorString}</color>", GUILayout.Width(250f));
            }
            else
            {
                GUILayout.Space(250f);
            }
            GUILayout.EndHorizontal();



            GUILayout.Label("<b>SELECT WORKFLOW</b>", GUILayout.Width(120f));
            int newFlag = GUILayout.SelectionGrid(workflowFlag,
                                                  workflowOptions,
                                                  Mathf.Min(workflowOptions.Length, 4),
                                                  UIResources.GetStyle("radio_text_button"));


            if (newFlag != workflowFlag)
            {
                workflowFlag = newFlag;

                var modelOpts = new List <string>();
                models = WaterfallAssets.GetModels((AssetWorkflow)Enum.Parse(typeof(AssetWorkflow), workflowOptions[workflowFlag]));
                foreach (var w in models)
                {
                    modelOpts.Add($"<b>{w.Name}</b>\n{w.Description}\n{w.Path}");
                }

                modelOptions = modelOpts.ToArray();

                var shaderOpts = new List <string>();
                shaders = WaterfallAssets.GetShaders((AssetWorkflow)Enum.Parse(typeof(AssetWorkflow), workflowOptions[workflowFlag]));
                foreach (var w in shaders)
                {
                    shaderOpts.Add($"<b>{w.Name}</b>\n{w.Description}");
                }

                shaderOptions = shaderOpts.ToArray();

                modelFlag  = 0;
                shaderFlag = 0;
            }

            GUILayout.BeginVertical(GUI.skin.textArea);

            GUILayout.BeginHorizontal();
            GUILayout.Label("<b>Model</b>", GUILayout.Width(120f));
            modelFlag = GUILayout.SelectionGrid(modelFlag,
                                                modelOptions,
                                                Mathf.Min(modelOptions.Length, 2),
                                                UIResources.GetStyle("radio_text_button"));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("<b>Shader</b>", GUILayout.Width(120f));
            shaderFlag = GUILayout.SelectionGrid(shaderFlag,
                                                 shaderOptions,
                                                 Mathf.Min(shaderOptions.Length, 2),
                                                 UIResources.GetStyle("radio_text_button"));
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
            GUILayout.BeginHorizontal();

            randomizeSeed = GUILayout.Toggle(randomizeSeed, "Randomize Effect Seed");

            GUILayout.EndHorizontal();

            if (GUILayout.Button("Add"))
            {
                var modelXforms = module.GetComponentsInChildren <Transform>();
                if (parentName == "")
                {
                    parentErrorString = "Please specify a valid Transform name";
                }
                else if (modelXforms.ToList().FindAll(x => x.name == parentName).Any())
                {
                    module.AddEffect(CreateNewEffect());
                    WaterfallUI.Instance.RefreshEffectList();
                    showWindow = false;
                }
                else
                {
                    parentErrorString = $"{parentName} is not a valid Transform on this part";
                }
            }

            if (GUILayout.Button("Cancel"))
            {
                showWindow = false;
            }
        }