public void SetAddMode(ModuleWaterfallFX fxModule)
        {
            showWindow        = true;
            module            = fxModule;
            windowMode        = ModifierPopupMode.Add;
            parentErrorString = "";

            workflowOptions = Enum.GetNames(typeof(AssetWorkflow)).ToArray();
            workflowFlag    = 0;
            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();
            WindowPosition = new(Screen.width / 2, Screen.height / 2f, 750, 400);
        }
 public void SetDeleteMode(ModuleWaterfallFX fxModule, WaterfallEffect fx)
 {
     showWindow     = true;
     module         = fxModule;
     effect         = fx;
     windowMode     = ModifierPopupMode.Delete;
     WindowPosition = new(Screen.width / 2 - 100, Screen.height / 2f - 50, 200, 100);
 }
 public void SetDeleteMode(WaterfallController ctrl, ModuleWaterfallFX mod)
 {
     showWindow = true;
     control    = ctrl;
     fxMod      = mod;
     windowMode = ControllerPopupMode.Delete;
     GUI.BringWindowToFront(windowID);
 }
 public void SetDeleteMode(WaterfallController ctrl, ModuleWaterfallFX mod)
 {
     showWindow     = true;
     control        = ctrl;
     fxMod          = mod;
     windowMode     = ControllerPopupMode.Delete;
     WindowPosition = new Rect(Screen.width / 2 - 100, Screen.height / 2f - 50, 200, 100);
 }
        public void SetAddMode(ModuleWaterfallFX mod)
        {
            showWindow = true;
            fxMod      = mod;
            windowMode = ControllerPopupMode.Add;
            selectedControllerIndex = 0;

            GUI.BringWindowToFront(windowID);
        }
Пример #6
0
        public void SetAddMode(ModuleWaterfallFX fxModule)
        {
            showWindow = true;
            module     = fxModule;
            windowMode = ModifierPopupMode.Add;

            modelOptions   = WaterfallAssets.Models.Keys.ToArray();
            shaderOptions  = ShaderLoader.GetAllShadersNames().ToArray();
            WindowPosition = new Rect(Screen.width / 2, Screen.height / 2f, 750, 400);
        }
        public void SetEditMode(WaterfallController ctrl, ModuleWaterfallFX mod)
        {
            windowMode        = ControllerPopupMode.Modify;
            showWindow        = true;
            control           = ctrl;
            fxMod             = mod;
            newControllerName = ctrl.name;

            selectedControllerIndex = controllerTypes.IndexOf(ctrl.GetType());
            GUI.BringWindowToFront(windowID);

            controllerOptions[selectedControllerIndex].LoadOptions(ctrl);
        }
 public void SetAddMode(ModuleWaterfallFX mod)
 {
     showWindow     = true;
     fxMod          = mod;
     windowMode     = ControllerPopupMode.Add;
     controllerFlag = 0;
     WindowPosition = new Rect(Screen.width / 2, Screen.height / 2f, 400, 400);
     eventCurve     = new FloatCurve();
     eventCurve.Add(0f, 0f);
     eventCurve.Add(0.1f, 1f);
     eventCurve.Add(1f, 0f);
     GenerateCurveThumbs();
 }
        public void SetEditMode(WaterfallController ctrl, ModuleWaterfallFX mod)
        {
            showWindow        = true;
            control           = ctrl;
            fxMod             = mod;
            newControllerName = ctrl.name;
            controllerFlag    = controllerTypes.ToList().IndexOf(ctrl.linkedTo);
            windowMode        = ControllerPopupMode.Modify;
            WindowPosition    = new Rect(Screen.width / 2 - 100, Screen.height / 2f - 50, 400, 100);
            eventCurve        = new FloatCurve();

            if (control is RandomnessController r)
            {
                if (r.noiseType == "random")
                {
                    randomStrings[0] = r.range.x.ToString();
                    randomStrings[1] = r.range.y.ToString();
                }
                if (r.noiseType == "perlin")
                {
                    randomStrings[0] = r.seed.ToString();
                    randomStrings[1] = r.scale.ToString();
                    randomStrings[2] = r.speed.ToString();
                    randomStrings[3] = r.minimum.ToString();
                }
            }
            else if (control is EngineEventController e)
            {
                eventCurve          = e.eventCurve;
                eventDuration       = e.eventDuration;
                eventDurationString = e.eventDuration.ToString();
            }
            else if (control is ThrottleController t)
            {
                throttleStrings[0] = t.responseRateUp.ToString();
                throttleStrings[1] = t.responseRateDown.ToString();
            }
            else if (control is RCSController rcs)
            {
                throttleStrings[0] = rcs.responseRateUp.ToString();
                throttleStrings[1] = rcs.responseRateDown.ToString();
            }

            GenerateCurveThumbs();
        }
        public void Start()
        {
            if (engineID != "")
            {
                //Utils.Log($"{engineID} , {this.GetComponents<ModuleEnginesFX>().ToList().Count}, {this.GetComponents<ModuleEnginesFX>().ToList().Find(x => x.engineID == engineID)}");
                engine = this.GetComponents <ModuleEnginesFX>().ToList().Find(x => x.engineID == engineID);
                //Utils.Log($"{engineID} , {this.GetComponents<ModuleWaterfallFX>().ToList().Count}, {this.GetComponents<ModuleWaterfallFX>().ToList().Find(x => x.engineID == engineID)}");
                waterfallEffect = this.GetComponents <ModuleWaterfallFX>().ToList().Find(x => x.engineID == engineID);
            }
            else
            {
                engine          = this.GetComponents <ModuleEnginesFX>().ToList().First();
                waterfallEffect = this.GetComponents <ModuleWaterfallFX>().ToList().First();
            }
            savedThrust = engine.maxThrust;
            multiEngine = this.GetComponent <MultiModeEngine>();

            emissiveAnimator = this.GetComponents <ModuleColorAnimator>().ToList().Find(x => x.moduleID == emissiveColorAnimatorID);
            // Set up animations
            if (PulseAnimation != "")
            {
                pulseStates = Utils.SetUpAnimation(PulseAnimation, part);

                foreach (AnimationState pulseState in pulseStates)
                {
                    pulseState.layer = 1;
                }
            }
            SetupLight();

            /// Reload nodes as needed
            if (HighLogic.LoadedSceneIsFlight || HighLogic.LoadedSceneIsEditor)
            {
                if (LaserAnimations && (laserFX == null || laserFX.Count == 0))
                {
                    ConfigNode node = GameDatabase.Instance.GetConfigs("PART").
                                      Single(c => part.partInfo.name == c.name).config.
                                      GetNodes("MODULE").Single(n => n.GetValue("name") == moduleName && n.GetValue("engineID") == engineID);
                    OnLoad(node);
                }
            }
        }
Пример #11
0
 public void SelectFXModule(ModuleWaterfallFX fxMod)
 {
     selectedModule = fxMod;
     RefreshEffectList();
 }