//========================================================================= public bool HasTexCoord(EchoPFXOption iepo, int ipass) { List <PossibleOpts> poList; if (_erg == null) { return(false); } if (ipass == 0) { poList = _erg.possibleOpts1; } else { poList = _erg.possibleOpts2; } for (int loop = 0; loop < poList.Count; loop++) { if (poList[loop].type == iepo.optType) { return(poList[loop].useUniqueTC); } } return(false); }
//========================================================================= public void PostFxScanLinesGUI(EchoPFXOption iepo, PossibleOpts ipo) { if (ipo.scanlines == ECHOPFXSCANLINES.HORIZONTAL || ipo.scanlines == ECHOPFXSCANLINES.BOTH) { EditorGUILayout.LabelField("HORIZONTAL:"); EditorGUILayout.BeginHorizontal(); iepo.linesAmountDivideH = GUILayout.Toggle(iepo.linesAmountDivideH, ""); EditorGUILayout.LabelField("Divide Screen Height By Count"); EditorGUILayout.EndHorizontal(); iepo.linesAmountH = EditorGUILayout.IntField("Count", iepo.linesAmountH); iepo.linesScrollH = EditorGUILayout.FloatField("Scroll", iepo.linesScrollH); } if (ipo.scanlines == ECHOPFXSCANLINES.BOTH) { EditorGUILayout.Space(); } if (ipo.scanlines == ECHOPFXSCANLINES.VERTICAL || ipo.scanlines == ECHOPFXSCANLINES.BOTH) { EditorGUILayout.LabelField("VERTICAL:"); EditorGUILayout.BeginHorizontal(); iepo.linesAmountDivideV = GUILayout.Toggle(iepo.linesAmountDivideV, ""); EditorGUILayout.LabelField("Divide Screen Width By Count"); EditorGUILayout.EndHorizontal(); iepo.linesAmountV = EditorGUILayout.IntField("Count", iepo.linesAmountV); iepo.linesScrollV = EditorGUILayout.FloatField("Scroll", iepo.linesScrollV); } }
//========================================================================= public void PostEffectOptionsGUI(EchoPFXOption iepo) { EditorGUILayout.LabelField("TIMING:"); // attack time iepo.attackTime = EditorGUILayout.FloatField("Fade In", iepo.attackTime); // sustain time iepo.sustainTime = EditorGUILayout.FloatField("Sustain", iepo.sustainTime); // release time iepo.releaseTime = EditorGUILayout.FloatField("Fade Out", iepo.releaseTime); iepo.startDelay = EditorGUILayout.FloatField("Start Delay", iepo.startDelay); if (iepo.startDelay < 0) { iepo.startDelay = 0; } EditorGUILayout.Space(); EditorGUILayout.LabelField("FADE OPTIONS:"); iepo.fadeMin = EchoSlider("Min", iepo.fadeMin, 0, 1); iepo.fadeMax = EchoSlider("Max", iepo.fadeMax, 0, 1); iepo.fadeCur = EchoSlider("Current", iepo.fadeCur, iepo.fadeMin, iepo.fadeMax); EditorGUILayout.Space(); iepo.ValidateInput(); }
//========================================================================= public void CopyTo(EchoPFXOption iepo) { iepo.optType = optType; iepo.startDelay = startDelay; iepo.attackTime = attackTime; iepo.sustainTime = sustainTime; iepo.releaseTime = releaseTime; iepo.fadeCur = fadeCur; iepo.fadeMin = fadeMin; iepo.fadeMax = fadeMax; iepo.rgba = rgba; iepo.rgbaMultiply = rgbaMultiply; iepo.distAmountH = distAmountH; iepo.distSpeedH = distSpeedH; iepo.distStrengthH = distStrengthH; iepo.distAmountV = distAmountV; iepo.distSpeedV = distSpeedV; iepo.distStrengthV = distStrengthV; iepo.linesAmountDivideH = linesAmountDivideH; iepo.linesAmountH = linesAmountH; iepo.linesScrollH = linesScrollH; iepo.linesAmountDivideV = linesAmountDivideV; iepo.linesAmountV = linesAmountV; iepo.linesScrollV = linesScrollV; iepo.shockDistance = shockDistance; iepo.shockSize = shockSize; iepo.shockCenterX = shockCenterX; iepo.shockCenterY = shockCenterY; iepo.tex = tex; iepo.texBlend = texBlend; iepo.customArgs = customArgs; iepo.overlayST = overlayST; iepo.overlayST_Scroll = overlayST_Scroll; }
//========================================================================= public void PostFxShockwaveGUI(EchoPFXOption iepo) { EditorGUILayout.LabelField("OPTIONS:"); iepo.shockSize = EchoSlider("Size", iepo.shockSize, 0, 1); iepo.shockDistance = EchoSlider("Distance", iepo.shockDistance, 0, 1); iepo.shockCenterX = EchoSlider("Center X", iepo.shockCenterX, 0, 1); iepo.shockCenterY = EchoSlider("Center Y", iepo.shockCenterY, 0, 1); }
//========================================================================= public void PostFxColorGUI(EchoPFXOption iepo) { EditorGUILayout.LabelField("COLOR OPTIONS:"); EditorGUILayout.BeginHorizontal(); iepo.rgba = EditorGUILayout.ColorField(iepo.rgba); EditorGUILayout.LabelField(" ", GUILayout.Width(26)); EditorGUILayout.EndHorizontal(); iepo.rgbaMultiply = EchoSlider("Amplify", iepo.rgbaMultiply, 1, 8); }
//========================================================================= public bool PostFxOptionGUI(List <EchoPFXOption> iepolist, int ipos, string iname) { bool flag = true; EchoPFXOption epo = iepolist[ipos]; // toggle, start, end, duration GUILayout.Box("", new GUILayoutOption[] { GUILayout.ExpandWidth(true), GUILayout.Height(1) }); EditorGUILayout.BeginHorizontal(); if (epo.folded) { if (GUILayout.Button("▶", GUILayout.MaxWidth(24))) { epo.folded = false; } else { flag = false; } } else { if (GUILayout.Button("▼", GUILayout.MaxWidth(24))) { epo.folded = true; } } GUILayout.Box(iname, new GUILayoutOption[] { GUILayout.ExpandWidth(true) }); if (GUILayout.Button("Remove", GUILayout.MaxWidth(64))) { iepolist.RemoveAt(ipos); flag = false; } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); if (flag) { PostEffectOptionsGUI(epo); } return(flag); }
//========================================================================= public void PostFxCustomGUI(EchoPFXOption iepo, int ipass) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("CUSTOM:"); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); iepo.customArgs = EditorGUILayout.Vector4Field("Parameters", iepo.customArgs); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); PostFxColorGUI(iepo); EditorGUILayout.Space(); PostFxOverlayGUI(iepo, ipass); }
//============================================================ private static EchoPFXOption LoadOption(XmlNode inode) { ECHOPFXOPTION opt = ( ECHOPFXOPTION )NodeParseEnum(inode, "optType", typeof(ECHOPFXOPTION), (int)ECHOPFXOPTION.GREYSCALE); EchoPFXOption epo = new EchoPFXOption(opt); epo.passOrder = NodeParseInt(inode, "passOrder"); epo.startDelay = NodeParseFloat(inode, "startDelay"); epo.attackTime = NodeParseFloat(inode, "attackTime"); epo.sustainTime = NodeParseFloat(inode, "sustainTime"); epo.releaseTime = NodeParseFloat(inode, "releaseTime"); epo.fadeMin = NodeParseFloat(inode, "fadeMin"); epo.fadeMax = NodeParseFloat(inode, "fadeMax"); epo.fadeCur = NodeParseFloat(inode, "fadeCur"); epo.rgba = (Color)NodeParseVector4(inode, "rgba"); epo.rgbaMultiply = NodeParseFloat(inode, "rgbaMultiply"); epo.distAmountH = NodeParseFloat(inode, "distAmountH"); epo.distSpeedH = NodeParseFloat(inode, "distSpeedH"); epo.distStrengthH = NodeParseFloat(inode, "distStrengthH"); epo.distAmountV = NodeParseFloat(inode, "distAmountV"); epo.distSpeedV = NodeParseFloat(inode, "distSpeedV"); epo.distStrengthV = NodeParseFloat(inode, "distStrengthV"); epo.linesAmountDivideH = NodeParseBool(inode, "linesAmountDivideH"); epo.linesAmountH = NodeParseInt(inode, "linesAmountH"); epo.linesScrollH = NodeParseFloat(inode, "LinesScrollH"); epo.linesAmountDivideV = NodeParseBool(inode, "linesAmountDivideV"); epo.linesAmountV = NodeParseInt(inode, "linesAmountV"); epo.linesScrollV = NodeParseFloat(inode, "LinesScrollV"); epo.shockDistance = NodeParseFloat(inode, "shockDistance"); epo.shockSize = NodeParseFloat(inode, "shockSize"); epo.shockCenterX = NodeParseFloat(inode, "shockCenterX"); epo.shockCenterY = NodeParseFloat(inode, "shockCenterY"); epo.tex = NodeParseTex2D(inode, "tex"); epo.texBlend = ( ECHOPFXBLEND )NodeParseEnum(inode, "texBlend", typeof(ECHOPFXBLEND), (int)ECHOPFXBLEND.NORMAL); epo.customArgs = NodeParseVector4(inode, "customArgs"); epo.overlayST = NodeParseVector4(inode, "overlayST"); epo.overlayST_Scroll = NodeParseVector4(inode, "overlayST_Scroll"); return(epo); }
//========================================================================= public void PostFxOverlayGUI(EchoPFXOption iepo, int ipass) { bool hasTC = HasTexCoord(iepo, ipass); EditorGUILayout.LabelField("TEXTURE:"); if (iepo.tex != null && hasTC) { iepo.overlayST = EditorGUILayout.Vector4Field("Tiling = xy Offset = zw", iepo.overlayST); } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(GUILayout.Width(64)); iepo.tex = (Texture2D)EditorGUILayout.ObjectField(iepo.tex, typeof(Texture2D), true, GUILayout.Width(64), GUILayout.Height(64)); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); if (iepo.tex != null && hasTC) { EditorGUILayout.BeginVertical(); iepo.overlayST_Scroll.x = EchoSlider("Scroll U", iepo.overlayST_Scroll.x, 0.0f, 1.0f, 64); iepo.overlayST_Scroll.y = EchoSlider("Scroll V", iepo.overlayST_Scroll.y, 0.0f, 1.0f, 64); iepo.overlayST_Scroll.z = EchoSlider("U Throttle", iepo.overlayST_Scroll.z, -1.0f, 1.0f, 64); iepo.overlayST_Scroll.w = EchoSlider("V Throttle", iepo.overlayST_Scroll.w, -1.0f, 1.0f, 64); EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); }
//========================================================================= public void PostFxDistortionGUI(EchoPFXOption iepo) { EditorGUILayout.LabelField("HORIZONTAL:"); iepo.distAmountH = EditorGUILayout.FloatField("Amount", iepo.distAmountH); iepo.distSpeedH = EditorGUILayout.FloatField("Speed", iepo.distSpeedH); iepo.distStrengthH = EditorGUILayout.FloatField("Strength", iepo.distStrengthH); if (iepo.distAmountH < 0) { iepo.distAmountH = 0; } if (iepo.distStrengthH < 0) { iepo.distStrengthH = 0; } EditorGUILayout.Space(); EditorGUILayout.LabelField("VERTICAL:"); iepo.distAmountV = EditorGUILayout.FloatField("Amount", iepo.distAmountV); iepo.distSpeedV = EditorGUILayout.FloatField("Speed", iepo.distSpeedV); iepo.distStrengthV = EditorGUILayout.FloatField("Strength", iepo.distStrengthV); if (iepo.distAmountV < 0) { iepo.distAmountV = 0; } if (iepo.distStrengthV < 0) { iepo.distStrengthV = 0; } }
//========================================================================= public void PostFxTextureGUI(EchoPFXOption iepo) { iepo.tex = (Texture2D)EditorGUILayout.ObjectField(iepo.tex, typeof(Texture2D), true, GUILayout.Width(64), GUILayout.Height(64)); }
//============================================================ public static void SaveOption(EchoPFXOption iepo, XmlElement iparent) { XmlElement ele; ele = xfile.CreateElement("Option"); iparent.AppendChild(ele); iparent = ele; ele = xfile.CreateElement("optType"); ele.InnerText = iepo.optType.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("passOrder"); ele.InnerText = iepo.passOrder.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("startDelay"); ele.InnerText = iepo.startDelay.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("attackTime"); ele.InnerText = iepo.attackTime.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("sustainTime"); ele.InnerText = iepo.sustainTime.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("releaseTime"); ele.InnerText = iepo.releaseTime.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("fadeMin"); ele.InnerText = iepo.fadeMin.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("fadeMax"); ele.InnerText = iepo.fadeMax.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("fadeCur"); ele.InnerText = iepo.fadeCur.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("rgba"); ele.InnerText = ((Vector4)iepo.rgba).ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("rgbaMultiply"); ele.InnerText = iepo.rgbaMultiply.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("distAmountH"); ele.InnerText = iepo.distAmountH.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("distSpeedH"); ele.InnerText = iepo.distSpeedH.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("distStrengthH"); ele.InnerText = iepo.distStrengthH.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("distAmountV"); ele.InnerText = iepo.distAmountV.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("distSpeedV"); ele.InnerText = iepo.distSpeedV.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("distStrengthV"); ele.InnerText = iepo.distStrengthV.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("linesAmountDivideH"); ele.InnerText = iepo.linesAmountDivideH.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("linesAmountH"); ele.InnerText = iepo.linesAmountH.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("linesScrollH"); ele.InnerText = iepo.linesScrollH.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("linesAmountDivideV"); ele.InnerText = iepo.linesAmountDivideV.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("linesAmountV"); ele.InnerText = iepo.linesAmountV.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("linesScrollV"); ele.InnerText = iepo.linesScrollV.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("shockDistance"); ele.InnerText = iepo.shockDistance.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("shockSize"); ele.InnerText = iepo.shockSize.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("shockCenterX"); ele.InnerText = iepo.shockCenterX.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("shockCenterY"); ele.InnerText = iepo.shockCenterY.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("tex"); ele.InnerText = AssetDatabase.GetAssetPath(iepo.tex); iparent.AppendChild(ele); ele = xfile.CreateElement("texBlend"); ele.InnerText = iepo.texBlend.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("customArgs"); ele.InnerText = iepo.customArgs.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("overlayST"); ele.InnerText = iepo.overlayST.ToString(); iparent.AppendChild(ele); ele = xfile.CreateElement("overlayST_Scroll"); ele.InnerText = iepo.overlayST_Scroll.ToString(); iparent.AppendChild(ele); }