private ERuleButtonAction OnGUISizeRule(TextureImportMaxSizeChangeRule sizeRule, bool isTop, bool isBottom) { ERuleButtonAction action = ERuleButtonAction.Nothing; EditorGUILayout.BeginHorizontal(); if (isTop) { GUILayout.Label("", GUILayout.Width(20)); } else { if (GUILayout.Button(LanguageData.GetString(ETags.UpperBtn), GUILayout.Width(20))) { action = ERuleButtonAction.Upper; } } if (isBottom) { GUILayout.Label("", GUILayout.Width(20)); } else { if (GUILayout.Button(LanguageData.GetString(ETags.DownerBtn), GUILayout.Width(20))) { action = ERuleButtonAction.Downer; } } sizeRule.pathMatch = EditorGUILayout.TextField(sizeRule.pathMatch); int typeIdx = sizeRule.GetRulePopupIndex(); typeIdx = EditorGUILayout.Popup(typeIdx, sizeRuleStrList, GUILayout.Width(120.0f)); sizeRule.SetRulePopupIndex(typeIdx); if (sizeRule.parameterFormat == TextureImportMaxSizeChangeRule.EParameterFormat.Pixel) { int pixelIdx = sizeRule.GetMaxPixelPopupIndex(); pixelIdx = EditorGUILayout.Popup(pixelIdx, TextureImportMaxSizeChangeRule.MaxPixelSizeList, GUILayout.Width(80.0f)); sizeRule.SetMaxPixelPopupIndex(pixelIdx); } else { int divIdx = sizeRule.GetDivParamPopupIndex(); divIdx = EditorGUILayout.Popup(divIdx, TextureImportMaxSizeChangeRule.DivParamSizeList, GUILayout.Width(80.0f)); sizeRule.SetDivParamPopupIndex(divIdx); } if (GUILayout.Button(LanguageData.GetString(ETags.DeleteBtn), GUILayout.Width(50.0f))) { action = ERuleButtonAction.Delete; } EditorGUILayout.EndHorizontal(); return(action); }
private ERuleButtonAction OnGUIFormatRule(TextureImportFormatChangeRule formatRule, bool isTop, bool isBottom) { ERuleButtonAction action = ERuleButtonAction.Nothing; EditorGUILayout.BeginHorizontal(); if (isTop) { GUILayout.Label("", GUILayout.Width(20)); } else { if (GUILayout.Button(LanguageData.GetString(ETags.UpperBtn), GUILayout.Width(20))) { action = ERuleButtonAction.Upper; } } if (isBottom) { GUILayout.Label("", GUILayout.Width(20)); } else { if (GUILayout.Button(LanguageData.GetString(ETags.DownerBtn), GUILayout.Width(20))) { action = ERuleButtonAction.Downer; } } formatRule.pathMatch = EditorGUILayout.TextField(formatRule.pathMatch); int selectFormatIdx = GetPopFormatRuleUpIndex(this.AllowFormatList, formatRule.textureFormat); selectFormatIdx = EditorGUILayout.Popup(selectFormatIdx, this.AllowFormatStringList, GUILayout.Width(120.0f)); formatRule.textureFormat = this.AllowFormatList[selectFormatIdx]; if (IsNeedQualityFormat(formatRule.textureFormat)) { formatRule.quality = EditorGUILayout.IntField(formatRule.quality, GUILayout.Width(40)); formatRule.quality = Mathf.Clamp(formatRule.quality, 0, 100); } else { EditorGUILayout.LabelField("", GUILayout.Width(40)); } if (GUILayout.Button(LanguageData.GetString(ETags.DeleteBtn), GUILayout.Width(50.0f))) { action = ERuleButtonAction.Delete; } EditorGUILayout.EndHorizontal(); return(action); }
private void OnGUIFormatRuleList() { scrollFormatParam = EditorGUILayout.BeginScrollView(scrollFormatParam); int actionIndex = -1; ERuleButtonAction action = ERuleButtonAction.Nothing; int idx = 0; foreach (var formatRule in this.formatRuleList) { ERuleButtonAction tmpAction = this.OnGUIFormatRule(formatRule, (idx == 0), (idx == (this.formatRuleList.Count - 1))); if (tmpAction != ERuleButtonAction.Nothing) { action = tmpAction; actionIndex = idx; } ++idx; } if (GUILayout.Button(LanguageData.GetString(ETags.AddRuleBtn))) { this.formatRuleList.Add(new TextureImportFormatChangeRule("**", this.AllowFormatList[0], 50)); } if (actionIndex >= 0) { switch (action) { case ERuleButtonAction.Delete: this.formatRuleList.RemoveAt(actionIndex); break; case ERuleButtonAction.Downer: SwapFormatRule(this.formatRuleList, actionIndex, actionIndex + 1); break; case ERuleButtonAction.Upper: SwapFormatRule(this.formatRuleList, actionIndex, actionIndex - 1); break; } } EditorGUILayout.EndScrollView(); }
private void OnGUISizeRuleList() { scrollParam = EditorGUILayout.BeginScrollView(scrollParam); int actionIndex = -1; ERuleButtonAction action = ERuleButtonAction.Nothing; int idx = 0; foreach (var sizeRule in sizeRuleList) { ERuleButtonAction tmpAction = this.OnGUISizeRule(sizeRule, (idx == 0), (idx == (sizeRuleList.Count - 1))); if (tmpAction != ERuleButtonAction.Nothing) { action = tmpAction; actionIndex = idx; } ++idx; } if (actionIndex >= 0) { switch (action) { case ERuleButtonAction.Delete: this.sizeRuleList.RemoveAt(actionIndex); break; case ERuleButtonAction.Downer: SwapSizeRule(this.sizeRuleList, actionIndex, actionIndex + 1); break; case ERuleButtonAction.Upper: SwapSizeRule(this.sizeRuleList, actionIndex, actionIndex - 1); break; } } if (GUILayout.Button(LanguageData.GetString(ETags.AddRuleBtn))) { this.sizeRuleList.Add(new TextureImportMaxSizeChangeRule("**", TextureImportMaxSizeChangeRule.EParameterFormat.Pixel, 256)); } EditorGUILayout.EndScrollView(); }