private void BottomMenuLine() { if (GUILayout.Button("构建默认配置", GUILayout.Width(GUI_MenuButton_Width))) { bool isInitBuild = false; if (m_Scene.IsBuiling) { if (EditorUtility.DisplayDialog("重建默认配置", "当前存在未保存的地形配置,确定要清理重建吗?", "确定", "取消")) { isInitBuild = true; } } else { isInitBuild = true; } if (isInitBuild) { m_Scene.InitBuild(); m_GUIType = GUIType.Config; } } EditorGUILayout.Space(GUI_InfoContent_Space); if (m_Scene.IsBuiling) { if (GUILayout.Button("刷新场景", GUILayout.Width(GUI_MenuButton_Width))) { BuildScene(); } } }
void ShowQuickButton(GUIType type) { string temp = type.ToString(); int index = -1; for (int i = 0, count = buttonType.Length; i < count; i++) { if (buttonType[i] == temp) { index = i; tipGos[i].SetActive(true); } else { tipGos[i].SetActive(false); } } if (index >= 0 && buttonType.Length > index) { UIEventListener.Get(btnOpenWnds[index].gameObject).onClick = (x) => { GameCenter.uIMng.SwitchToUI(type); this.CloseUI(); }; } }
/// <summary> /// 供外部调用的打开接口 by吴江 /// </summary> /// <returns></returns> public virtual GUIBase OpenUI(GUIType _baseOn = GUIType.NONE) { baseOn = _baseOn; if (!this.gameObject.activeSelf) { this.gameObject.SetActive(true); TweenAlphaAllChild x = this.gameObject.GetComponent <TweenAlphaAllChild>(); if (x != null) { x.ResetToBeginning(); x.enabled = true; } subWndDictionary.Clear(); for (int i = 0; i < subWndArray.Length; i++) { if (subWndArray[i] != null) { subWndDictionary[subWndArray[i].type] = subWndArray[i]; } } OnOpen(); } return(this); }
//填充静态预制 public void FillInfo(SevenDaysTaskRef _dataRef) { //Debug.Log("FillInfo:" + _dataRef.des1); if (_dataRef.Action == 1) { //Debug.Log("_dataRef.Action:"+_dataRef.Action); if (btnGo != null) { UIEventListener.Get(btnGo.gameObject).onClick = delegate { if (_dataRef.num == 1) { GUIType type = (GUIType)System.Enum.Parse(typeof(GUIType), _dataRef.ui); //Debug.Log("type:" + type); GameCenter.uIMng.SwitchToUI(GUIType.NONE); //GameCenter.uIMng.ReleaseGUI(GUIType.SEVENCHALLENGE); GameCenter.uIMng.SwitchToUI(type); } else if (_dataRef.num == 2) { SubGUIType type = (SubGUIType)System.Enum.Parse(typeof(SubGUIType), _dataRef.ui); //GameCenter.uIMng.ReleaseGUI(GUIType.SEVENCHALLENGE); GameCenter.uIMng.SwitchToUI(GUIType.NONE); GameCenter.uIMng.SwitchToSubUI(type); } }; btnGo.gameObject.SetActive(true); //Invoke("DelayShow",0.75f); } } else { if (btnGo != null) { btnGo.gameObject.SetActive(false); } } if (title != null) { //data.des1; title.text = _dataRef.des1; } if (content != null) { ////data.des2; content.text = _dataRef.des2; //Debug.Log("_dataRef.des2:"+ _dataRef.des2); } if (num != null) { num.text = 0.ToString() + "/" + _dataRef.task_condition_num.ToString(); content.text = content.text.Replace("#1", num.text); } if (finish != null) { finish.gameObject.SetActive(false); } updateData(_dataRef); }
private static void StartGUI(String[] args) { GUIType gui = args.Any(str => str.ToLowerInvariant() == "-console") ? GUIType.Console : GUIType.WinForms; Globals.Initialize(gui); GUIView.Factory(gui).Start(args); }
public GUIObject(Rectangle rect, string text, Color color) { this.rectangle = rect; this.color = color; this.text = text; this.guiType = GUIType.BoxwString; this.position = new Vector2(rect.X, rect.Y); }
/// <summary> /// Switch the displayed /// </summary> /// <param name="targetGUI">the GUI Type to display</param> public void ChangeGui(GUIType targetGUI) { switch (targetGUI) { case GUIType.cDLSQIUserInterface: cDLSQItransformer.changeGUI(GetUserControlForm()); break; } }
public static void Initialize(GUIType gui) { AppVersion version = new AppVersion(MajorVersion); IIPCAppData data = new IPCAppData(ProjectName, ProjectShortName, version, AppStatus.NotFunctional, AppBranch.Master, TinyMessageBus.Fake); Domain.Create(data).Initialize <App>(gui); Localization = new ProgramLocalization(Settings.LanguageCode.GetValue()); }
/// <summary> /// 直接跳转到某个子界面,必须是跨界面打开才调用。如果是打开本身界面的子界面,则用本身界面自身的接口 by吴江 /// </summary> /// <param name="_subType"></param> /// <param name="_baseOn"></param> public void SwitchToSubUI(SubGUIType _subType, GUIType _baseOn = GUIType.NONE) { GUIType mainType = ConfigMng.Instance.GetSubGUITypeBelong(_subType); if (mainType != GUIType.NONE) { SwitchToUI(mainType, _subType, _baseOn); } }
public PlayerScoreItem(String name, int value, Vector2 loc, bool frame) { type = GUIType.text; location = loc; ScoreName = name; ScoreValue = value; chainModifier = UtilityClass.zero; drawEveryFrame = frame; }
public Component(GUIType g, string t, double h, double w, double x, double y) { this.type = g; this.text = t; this.height = h; this.width = w; this.xOffest = x; this.yOffset = y; }
public Label(GUIType g, string t, double h, double w, double x, double y) : base(g, t, h, w, x, y) { this.type = g; this.text = t; this.height = h; this.width = w; this.xOffest = x; this.yOffset = y; }
void ClickLabelBack(GameObject go) { if (GameCenter.mainPlayerMng.MainPlayerInfo.CurSceneType != SceneType.SCUFFLEFIELD) { GameCenter.messageMng.AddClientMsg(405); return; } string url = labText.GetUrlAtPosition(UICamera.lastWorldPosition); if (!string.IsNullOrEmpty(url)) { string[] urlStr = url.Split('|'); if (urlStr.Length == 3) { switch (urlStr[0]) { case "0": break; case "1": //跳到一级界面 GUIType uiType = (GUIType)Enum.Parse(Type.GetType("GUIType"), urlStr[2]); if (uiType == GUIType.NEWMALL && curEquipmentInfo != null) { GameCenter.buyMng.OpenBuyWnd(curEquipmentInfo); } else { GameCenter.uIMng.SwitchToUI(uiType); } ToolTipMng.CloseAllTooltip(); break; case "2": //跳到二级界面 SubGUIType subUiType = (SubGUIType)Enum.Parse(Type.GetType("SubGUIType"), urlStr[2]); GameCenter.uIMng.SwitchToSubUI(subUiType); ToolTipMng.CloseAllTooltip(); break; case "3": int npcID = 0; if (int.TryParse(urlStr[2], out npcID)) { ToolTipMng.CloseAllTooltip(); GameCenter.uIMng.SwitchToUI(GUIType.NONE); GameCenter.taskMng.PublicTraceToNpc(npcID); } break; } } else { Debug.Log("数据错误!"); } } Debug.Log("url:" + url); }
public PlayerScoreItem(GUIType type, int value, Vector2 loc, bool frame) { ScoreName = UtilityClass.emptyString; this.type = type; location = loc; ScoreValue = value; chainModifier = UtilityClass.zero; sprite = GetSprite(); drawEveryFrame = frame; }
public void AskRedeem(EquipmentInfo _eq, GUIType _type, BuyType _buyType, int _nums) { nums = 0; if (_eq != null) { curEq = _eq; } nums = _nums; buyType = _buyType; // GameCenter.uIMng.GenGUI(GUIType.BUYWND, true); }
public GUIComponent(GUIType type, string textureName, Point screenPosition, RenderLayer layer) { ResourceManager rm = ResourceManager.GetInstance(); Type = type; TexturePath = textureName; ScreenPosition = screenPosition; Layer = layer; IsActive = true; Texture = rm.GetResource <Texture2D>(textureName); }
} //============================================================================================================== public void StopBenchmark() { SetRectsResult(); displayType = GUIType.DisplayResults; colorAvg = EvaluateGradient(averageFPS); bigStyle.normal.textColor = colorAvg; //R_Console.Log("---------------------------------"); //R_Console.Log("Average FPS: " + averageFPS.ToString("F2")); //R_Console.Log("Mininum FPS: " + minimumFPS.ToString("F2")); //R_Console.Log("Maximum FPS: " + maximumFPS.ToString("F2")); //R_Console.Log("---------------------------------"); } //==============================================================================================================
public GUIProperties(string name,Rect rect,GUIType type,string style,bool check,float min,float max, float defaultVal, bool show) { this.name = name; this.rect = rect; this.type = type; this.style = style; this.check = check; this.max = max; this.min = min; this.defaultVal = defaultVal; this.show = show; }
/// <summary> /// 将一个界面!!![组合]!关闭! 除非特别了解已经确定,否则不建议使用。 建议使用SwitchToUI接口 by吴江 /// </summary> /// <param name="_type"></param> public void CloseGUI(GUIType _type) { List <string> needlist = GetUIByType(_type); foreach (var item in needlist) { if (uiDictionary.ContainsKey(item) && uiDictionary[item] != null) { GUIBase gui = uiDictionary[item]; gui.CloseUI(); } isClosingWnd = true; } }
public IDomain Initialize(WPFApp app, GUIType type) { Application = type switch { GUIType.Console => new ConsoleApplication(app), GUIType.ConsoleGUI => new ConsoleApplication(app), GUIType.WinForms => new WinFormsApplication(), GUIType.WPF => new WPFApplication(app), GUIType.None => throw new NotSupportedException(), _ => throw new NotSupportedException() }; return(this); }
protected void GoMustDoItem(GameObject go) { if (CurMustDoInfo != null) { if (CurMustDoInfo.UISort == 1) { GUIType type = (GUIType)System.Enum.Parse(typeof(GUIType), CurMustDoInfo.UIType); if (type == GUIType.GUILDMAIN && string.IsNullOrEmpty(GameCenter.mainPlayerMng.MainPlayerInfo.GuildName)) { GameCenter.messageMng.AddClientMsg(408); return; } GameCenter.uIMng.SwitchToUI(type); } else if (CurMustDoInfo.UISort == 2) { SubGUIType type = (SubGUIType)System.Enum.Parse(typeof(SubGUIType), CurMustDoInfo.UIType); GameCenter.uIMng.SwitchToSubUI(type); } //LivelyRef的where字段判断是否做自动寻路 if (CurMustDoInfo.RefData.where != null && CurMustDoInfo.RefData.where.Count >= 3)//大于3,否则下标越界 { CheckAutoPath(CurMustDoInfo.RefData.where); } } //仙盟活跃 if (CurLivelyInfo != null) { if (CurLivelyInfo.UISort == 1) { GUIType type = (GUIType)System.Enum.Parse(typeof(GUIType), CurLivelyInfo.UIType); if (type == GUIType.GUILDMAIN && string.IsNullOrEmpty(GameCenter.mainPlayerMng.MainPlayerInfo.GuildName)) { GameCenter.messageMng.AddClientMsg(408); return; } GameCenter.uIMng.SwitchToUI(type); } else if (CurLivelyInfo.UISort == 2) { SubGUIType type = (SubGUIType)System.Enum.Parse(typeof(SubGUIType), CurLivelyInfo.UIType); GameCenter.uIMng.SwitchToSubUI(type); } //LivelyRef的where字段判断是否做自动寻路 if (CurLivelyInfo.RefData.where != null && CurLivelyInfo.RefData.where.Count >= 3)//大于3,否则下标越界 { CheckAutoPath(CurLivelyInfo.RefData.where); } } }
/// <summary> /// 让一个窗口组合在另外一个窗口组合之上by吴江 /// </summary> /// <param name="_top"></param> /// <param name="_bottom"></param> public void SetCompareTop(GUIType _top, GUIType _bottom) { if (_top == GUIType.NONE || _bottom == GUIType.NONE) { return; } List <string> toplist = GetUIByType(_top); List <string> bottomlist = GetUIByType(_bottom); if (toplist.Count == 0 || bottomlist.Count == 0) { return; } List <GUIBase> topGuiList = new List <GUIBase>(); for (int i = 0; i < toplist.Count; i++) { if (uiDictionary.ContainsKey(toplist[i])) { topGuiList.Add(uiDictionary[toplist[i]]); } } if (topGuiList.Count == 0) { return; } List <GUIBase> bottomGuiList = new List <GUIBase>(); for (int i = 0; i < bottomlist.Count; i++) { if (uiDictionary.ContainsKey(bottomlist[i])) { bottomGuiList.Add(uiDictionary[bottomlist[i]]); } } if (topGuiList.Count == 0) { return; } for (int i = 0; i < topGuiList.Count; i++) { for (int j = 0; j < bottomGuiList.Count; j++) { SetCompareTop(topGuiList[i], bottomGuiList[j]); } } }
private void OnGUI() { PhysicalGUIs.ForEach((obj) => { GUI.color = obj.color; if (obj is PGUI) { ((PGUI)obj).PhysicsUpdate(); } GUI.Button(obj.rect, ""); GUI.color = Color.white; }); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); spawnWithMouse = GUILayout.Toggle(spawnWithMouse, "Spawn With Mouse"); guiType = (GUIType)EditorGUILayout.EnumPopup("Type", (System.Enum)guiType); controlSize = EditorGUILayout.Vector2Field("Size", controlSize); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); if (spawnWithMouse && Event.current.type == EventType.MouseDown) { switch (guiType) { case GUIType.rigidbody: PhysicalGUIs.Add(new PGUI(Event.current.mousePosition, controlSize)); break; case GUIType.staticGUI: PhysicalGUIs.Add(new GUICollider(Event.current.mousePosition, controlSize)); break; } } if (showFPS) { if (lastTime + 1 < Time.realtimeSinceStartup) { totalFrameUpdates = updates; updates = 0; lastTime = Time.realtimeSinceStartup; } updates += 1; GUI.Label(new Rect { position = new Vector2(position.width - 40, position.height - 20), size = new Vector2(40, 20) }, totalFrameUpdates.ToString()); } }
/// <summary> /// Constructor. Fills in default values /// </summary> public Config() { AutoScroll = true; MaxParallelConnections = 64; CheckInternet = true; AutoFillRange = true; AutoStart = false; ShowClassCView = true; ShowSystemInformation = true; PingTimeout = 500; UseICMP = true; IPRangeStart = new IPAddress(new byte[] { 192, 168, 1, 1 }).ToLong(); IPRangeEnd = new IPAddress(new byte[] { 192, 168, 1, 254 }).ToLong(); RecentHosts = new List <HostInformation>(); GUIType = ip40.GUIType.Auto; }
} //============================================================================================================== void Update() { if (displayType != oldDisplayType) { if (displayType == GUIType.DisplayResults) { SetRectsResult(); colorAvg = EvaluateGradient(averageFPS); bigStyle.normal.textColor = colorAvg; avgTextGUI.text = avgFPSText; } else if (displayType == GUIType.DisplayRunning) { Reset(); SetRectsRun(); } oldDisplayType = displayType; } if (Input.GetKeyDown(showHideButton) && acceptInput && displayType != GUIType.DisplayResults) { if (displayType == GUIType.DisplayNothing) { displayType = GUIType.DisplayRunning; } else { displayType = GUIType.DisplayNothing; } } if (displayType == GUIType.DisplayNothing) { return; } else if (displayType == GUIType.DisplayRunning) { GetFPS(); } if (reset) { reset = false; Reset(); } } //==============================================================================================================
private void UnInit() { if (m_Instance == null) { return; } m_Instance = null; m_GUIType = GUIType.Notthing; m_IsDirty = false; IsChangeCurrent = false; IsUpdateCurrentPiece = false; m_PieceFactory.UnInit(); m_GamePlay.UnInit(); m_Scene.UnInit(); m_Tool.UnInit(); m_Define.UnInit(); }
/// <summary> /// 将一个界面!!![组合]!!!实例从内存中释放 by吴江 /// </summary> /// <param name="_type"></param> public void ReleaseGUI(GUIType _type) { List <string> needlist = GetUIByType(_type); for (int i = 0; i < needlist.Count; i++) { string name = needlist[i]; if (uiDictionary.ContainsKey(name) && uiDictionary[name] != null) { GUIBase gui = uiDictionary[name]; gui.CloseUI(); uiDictionary[name] = null; uiDictionary.Remove(name); DestroyImmediate(gui.gameObject, true); DestroyImmediate(gui, true); isClosingWnd = true; } } }
private void Init() { m_GUIType = GUIType.Notthing; m_IsDirty = false; IsChangeCurrent = false; m_Define = new TerrainMakerDefine(); m_Define.Init(this); m_Tool = new TerrainMakerTool(); m_Tool.Init(this); m_Scene = new TerrainMakerSceneController(); m_Scene.Init(this); m_GamePlay = new TerrainMakerGamePlayController(); m_GamePlay.Init(this); m_PieceFactory = new TerrainMakerPieceFactory(); m_PieceFactory.Init(this); }
private void LeftMenuLine() { EditorGUILayout.BeginVertical("helpbox", GUILayout.Width(100), GUILayout.ExpandHeight(true)); EditorGUILayout.LabelField("编辑器", GUILayout.Width(GUI_LableWidth)); GUI.color = m_GUIType == GUIType.EditorWindowSetting ? Color.gray : Color.white; if (GUILayout.Button("编辑器配置")) { m_GUIType = GUIType.EditorWindowSetting; } EditorGUILayout.Space(GUI_InfoContent_Space); if (m_Scene.IsBuiling) { GUI.color = Color.white; EditorGUILayout.LabelField("当前地形配置", GUILayout.Width(GUI_LableWidth)); GUI.color = m_GUIType == GUIType.Config ? Color.gray : Color.white; if (GUILayout.Button("配置")) { m_GUIType = GUIType.Config; } GUI.color = m_GUIType == GUIType.Terrain ? Color.gray : Color.white; if (GUILayout.Button("地形")) { m_GUIType = GUIType.Terrain; } } GUI.color = Color.white; EditorGUILayout.Space(GUI_InfoContent_Space); EditorGUILayout.EndVertical(); }
/// <summary> /// 设置一个UILabel链接至UI界面 /// </summary> public static void SetUrlToUI(UILabel _lab, string _urlDes, string _urlText) { if (_lab != null) { _lab.text = GameHelper.GetUrlString(_urlDes, _urlText); } GameHelper.SetUrlCallback(_lab, (x) => { try { GUIType uiType = (GUIType)Enum.Parse(Type.GetType("GUIType"), (string)x, true); if (uiType != GUIType.NONE) { if (uiType == GUIType.NEWMALL) { GameCenter.newMallMng.OpenMall(); } else if (uiType == GUIType.SHOPWND) { GameCenter.shopMng.OpenShopWnd(); } else { GameCenter.uIMng.SwitchToUI(uiType); } } }catch (System.Exception e) { try { SubGUIType subUiType = (SubGUIType)Enum.Parse(Type.GetType("SubGUIType"), (string)x); GameCenter.uIMng.SwitchToSubUI(subUiType); }catch (System.Exception e2) { GameCenter.messageMng.AddClientMsg("配置错误"); } } }); }
/// <summary> /// 加载某个界面组合 by吴江 /// </summary> /// <param name="_type"></param> /// <param name="_needOpen">加载完以后是否需要打开</param> public void GenGUI(GUIType _type, bool _needOpen, SubGUIType _subType = SubGUIType.NONE, GUIType _baseOn = GUIType.NONE, System.Action <GUIBase> _callback = null) { List <string> needopenlist = GetUIByType(_type); foreach (var item in needopenlist) { if (uiDictionary.ContainsKey(item) && uiDictionary[item] != null) { if (_needOpen) { uiDictionary[item].OpenUI(); } if (_callback != null) { _callback(uiDictionary[item]); } } else { GenGUI(item, _needOpen, _subType, _baseOn, _callback); } } }
/// <summary> /// Retrieve raw size of gui texture /// </summary> /// <param name="type">Gui Type to check</param> /// <returns>Returns the size of texture</returns> public Vector2 GetSize(GUIType type) { // Retrieve texture object TextureContainer texture = m_textures.ElementAt((int)type); // Return the size of it. return new Vector2(texture.up.Width, texture.up.Height); }
void GUILayers(Vector2 WinSize,Vector2 Position) { RunHotkeys(); ShaderBase SSIO = OpenShader; if (SSIO==null) { GUIStage = GUIType.Start; GUITrans.Reset(); } else { ShaderUtil.BeginGroup(new Rect(Position.x,Position.y,WinSize.x,WinSize.y)); int ListCount = 1; if (ShaderLayerTab == ShaderLayerTabs.Base){ ListCount+=1; ListCount+=1; if (SSIO.SpecularOn.On==true) ListCount+=1; if (SSIO.EmissionOn.On==true) ListCount+=1; if (SSIO.ParallaxOn.On==true) ListCount+=1; if (SSIO.TransparencyOn.On==true) ListCount+=1; } if (ShaderLayerTab == ShaderLayerTabs.Shell){ ListCount+=1; if (SSIO.SpecularOn.On==true) ListCount+=1; if (SSIO.EmissionOn.On==true) ListCount+=1; if (SSIO.TransparencyOn.On==true) ListCount+=1; } if (ShaderLayerTab == ShaderLayerTabs.Lighting){ ListCount+=3; } if (ShaderLayerTab == ShaderLayerTabs.Mask) { //foreach(ShaderLayerList SLL in SSIO.ShaderLayersMasks) //for (int i = 0;i++ //{ ListCount += SSIO.ShaderLayersMasks.Count;//+=1; //} } LayerListScroll = ShaderUtil.BeginScrollView(new Rect(264,0,WinSize.x-264,WinSize.y),LayerListScroll,new Rect(0,0,ListCount*150,WinSize.y-20),false,false); GUIStyle ButtonStyle; if(Flatter){ ButtonStyle = new GUIStyle(GUI.skin.box); ButtonStyle.alignment = TextAnchor.MiddleCenter; } else ButtonStyle = new GUIStyle(GUI.skin.button); ButtonStyle.fontSize = 20; List<List<ShaderLayer>> SLList = new List<List<ShaderLayer>>(); GUI.color = BackgroundColor; GUI.DrawTexture( new Rect(264,30,300,25), EditorGUIUtility.whiteTexture ); GUI.color = new Color(1f,1f,1f,1f); int Pos = 0; bool Hit = false; if (ShaderLayerTab == ShaderLayerTabs.Lighting) { if(GUILayersBox(SSIO.ShaderLayersLightingAll,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersLightingAll.SLs); Pos+=1; if(GUILayersBox(SSIO.ShaderLayersLightingDiffuse,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersLightingDiffuse.SLs); Pos+=1; if(GUILayersBox(SSIO.ShaderLayersLightingSpecular,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersLightingSpecular.SLs); Pos+=1; if(GUILayersBox(SSIO.ShaderLayersLightingAmbient,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersLightingAmbient.SLs); } if (ShaderLayerTab == ShaderLayerTabs.Base) { if(GUILayersBox(SSIO.ShaderLayersDiffuse,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersDiffuse.SLs); Pos+=1; if(GUILayersBox(SSIO.ShaderLayersNormal,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersNormal.SLs); Pos+=1; if(GUILayersBox(SSIO.ShaderLayersVertex,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersVertex.SLs); if (SSIO.SpecularOn.On==true){ Pos+=1; if(GUILayersBox(SSIO.ShaderLayersSpecular,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersSpecular.SLs); } if (SSIO.EmissionOn.On==true){ Pos+=1; if(GUILayersBox(SSIO.ShaderLayersEmission,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersEmission.SLs); } if (SSIO.ParallaxOn.On==true){ Pos+=1; if(GUILayersBox(SSIO.ShaderLayersHeight,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersHeight.SLs); } if (SSIO.TransparencyOn.On==true){ Pos+=1; if(GUILayersBox(SSIO.ShaderLayersAlpha,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersAlpha.SLs); } } if (ShaderLayerTab == ShaderLayerTabs.Shell) { if(GUILayersBox(SSIO.ShaderLayersShellDiffuse,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersShellDiffuse.SLs); Pos+=1; if(GUILayersBox(SSIO.ShaderLayersShellNormal,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersShellNormal.SLs); if (SSIO.SpecularOn.On==true){ Pos+=1; if(GUILayersBox(SSIO.ShaderLayersShellSpecular,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersShellSpecular.SLs); } if (SSIO.EmissionOn.On==true){ Pos+=1; if(GUILayersBox(SSIO.ShaderLayersShellEmission,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersShellEmission.SLs); } if (SSIO.TransparencyOn.On==true){ Pos+=1; if(GUILayersBox(SSIO.ShaderLayersShellAlpha,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SSIO.ShaderLayersShellAlpha.SLs); } } if (ShaderLayerTab == ShaderLayerTabs.Mask) { if ((Event.current.type == EventType.MouseDown&&new Rect(150*(Pos+SSIO.ShaderLayersMasks.Count),30,150,WinSize.y).Contains(Event.current.mousePosition))) OpenShader.AddMask(); foreach(ShaderLayerList SLL in SSIO.ShaderLayersMasks) { if(GUILayersBox(SLL,Pos,WinSize,ButtonStyle))Hit = true; SLList.Add(SLL.SLs); Pos+=1; } if (!(Event.current.type == EventType.Repaint&&new Rect(150*Pos,30,150,WinSize.y).Contains(Event.current.mousePosition)))GUI.enabled = false; GUILayersBox(SSIO.ShaderLayersMaskTemp,Pos,WinSize,ButtonStyle); GUI.Label(new Rect(150*Pos+18,120,150,WinSize.y),"Click to Add Mask"); GUI.enabled = true; Pos+=1; //if (GUI.Button(new Rect(Pos*150,(WinSize.y-64),64,64),Plus)) //OpenShader.AddMask(); } ShaderUtil.EndScrollView(); GUI.skin.GetStyle("ButtonLeft").alignment = TextAnchor.MiddleLeft; GUI.skin.GetStyle("ButtonRight").alignment = TextAnchor.MiddleLeft; GUI.skin.GetStyle("ButtonMid").alignment = TextAnchor.MiddleLeft; //SeeShells = !GUI.Toggle(new Rect(251,10,100,25),!SeeShells,new GUIContent("Base",IconBase),GUI.skin.GetStyle("ButtonLeft")); if (ShaderLayerTab != ShaderLayerTabs.Base){ if (GUI.Button(new Rect(264,6,100,25),new GUIContent("Base",IconBase),GUI.skin.GetStyle("ButtonLeft")))ShaderLayerTab = ShaderLayerTabs.Base; } else{ GUI.Toggle(new Rect(264,6,100,25),true,new GUIContent("Base",IconBase),GUI.skin.GetStyle("ButtonLeft")); } if (!OpenShader.ShellsOn.On)GUI.enabled = false; if (ShaderLayerTab != ShaderLayerTabs.Shell){ if (GUI.Button(new Rect(364,6,100,25),new GUIContent("Shell",IconShell),GUI.skin.GetStyle("ButtonMid")))ShaderLayerTab = ShaderLayerTabs.Shell; } else{ GUI.Toggle(new Rect(364,6,100,25),true,new GUIContent("Shell",IconShell),GUI.skin.GetStyle("ButtonMid")); } GUI.enabled = true; if (ShaderLayerTab != ShaderLayerTabs.Mask){ if (GUI.Button(new Rect(464,6,100,25),new GUIContent("Mask",IconMask),GUI.skin.GetStyle("ButtonMid")))ShaderLayerTab = ShaderLayerTabs.Mask; } else{ GUI.Toggle(new Rect(464,6,100,25),true,new GUIContent("Mask",IconMask),GUI.skin.GetStyle("ButtonMid")); } GUI.enabled = true; if (ShaderLayerTab != ShaderLayerTabs.Lighting){ if (GUI.Button(new Rect(564,6,100,25),new GUIContent("Lighting",IconMask),GUI.skin.GetStyle("ButtonRight")))ShaderLayerTab = ShaderLayerTabs.Lighting; } else{ GUI.Toggle(new Rect(564,6,100,25),true,new GUIContent("Lighting",IconMask),GUI.skin.GetStyle("ButtonRight")); } GUI.enabled = true; GUI.Box(new Rect(0,0,264,WinSize.y),"",ButtonStyle); if (Hit==false&&Event.current.type == EventType.MouseDown&&!(new Rect(0,0,264,WinSize.y).Contains(Event.current.mousePosition))) LayerSelection = new Vector2(20,20); ShaderLayer DrawLayer = null; //if (LayerSelection.x==0) //{ if (LayerSelection.x<SLList.Count) if (LayerSelection.y<SLList[(int)LayerSelection.x].Count) if (SLList[(int)LayerSelection.x][(int)LayerSelection.y]!=null) DrawLayer = SLList[(int)LayerSelection.x][(int)LayerSelection.y]; //} GUI.Box(new Rect(0,0,264,48),"Layer Settings",ButtonStyle); int ScrollHeight = 660; ShaderUtil.BeginGroup(new Rect(0,48,264,WinSize.y-48)); if (!((WinSize.y-48-30)>ScrollHeight)) LayerScroll = ShaderUtil.BeginScrollView(new Rect(0,0,264,WinSize.y-48-30),LayerScroll,new Rect(0,0,230,ScrollHeight),false,true); else{ ShaderUtil.BeginScrollView(new Rect(0,0,264,WinSize.y-48-30),new Vector2(0,0),new Rect(0,0,230,ScrollHeight),false,true); ShaderUtil.EndScrollView(); } if (AnimateInputs&&Event.current.type==EventType.Repaint&&DrawLayer!=null){ foreach(ShaderLayer SL in DrawLayer.Parent.SLs){ SL.UpdateShaderVars(true); foreach(ShaderVar SV in SL.ShaderVars) SV.UpdateToInput(true); } } if (DrawLayer!=null) DrawLayer.DrawGUI(); else ShaderLayer.DrawGUIGen(true); //if ((WinSize.y-48)<=ScrollHeight) if (!((WinSize.y-48-30)>ScrollHeight)) ShaderUtil.EndScrollView(); ShaderUtil.EndGroup(); ChangeSaveTemp(DrawLayer); if (GUI.Button( ShaderUtil.Rect2(RectDir.Bottom,0,WinSize.y,64,30),"Back",ButtonStyle)) Goto(GUIType.Start,ShaderTransition.TransDir.Backward); if (GUI.Button( ShaderUtil.Rect2(RectDir.Bottom,64,WinSize.y,110,30),"Settings",ButtonStyle)) Goto(GUIType.Configure,ShaderTransition.TransDir.Backward); if (GUI.Button( ShaderUtil.Rect2(RectDir.Bottom,174,WinSize.y,100-24,30),"Inputs",ButtonStyle)) Goto(GUIType.Inputs,ShaderTransition.TransDir.Backward); ShaderUtil.EndGroup(); } }
void OnGUI() { //if(Event.current.type==EventType.Repaint) ValueChanged = false; RunHotkeys(); ShaderUtil.Rects.Clear(); //ShaderSandwich windowG = this;//(ShaderSandwich)EditorWindow.GetWindow (typeof (ShaderSandwich),false,"",false); Instance = this; int MenuPad = 15; Vector2 WinSize = new Vector2(position.width,position.height); Vector2 WinSize2 = new Vector2(position.width,position.height-MenuPad); GUIMouseDown = false; GUIMouseUp = false; if ((Event.current.type == EventType.MouseDown)) GUIMouseDown = true; if ((Event.current.type == EventType.MouseUp)) GUIMouseUp = true; if (GUIMouseDown) GUIMouseHold = true; if (GUIMouseUp) GUIMouseHold = false; LoadAssets(); SSSettings.CurPath = CurrentFilePath; GUISkin oldskin = GUI.skin; if(Event.current.type==EventType.Repaint) ShaderUtil.AddProSkin(WinSize); if (ShaderVarEditing!=null) ShaderVarEditing.UseEditingMouse(false); bool SVMD = false; if (ShaderVarEditing!=null&&(Event.current.type!=EventType.Repaint))//.type== EventType.MouseDown)) SVMD = true; if (SVMD) ShaderUtil.BeginGroup(new Rect(0,0,0,0)); if (OpenShader!=null&&AnimateInputs&&Event.current.type==EventType.Repaint){ foreach(ShaderInput SI in OpenShader.ShaderInputs) SI.Update(); } //if (EditorWindow.focusedWindow==this) Repaint(); //TransitionTime = Mathf.Min(TransitionTime,1); if (GUITrans.DoneHit()) { GUIStage = GUITransition; } float Movement = 0f; if (GUITrans.Transitioning==ShaderTransition.TransDir.Backward) Movement = WinSize.x; if (GUIStage==GUIType.Start) GUIStart(WinSize2,new Vector2(-GUITrans.Get()*WinSize.x+Movement,MenuPad)); else if (GUIStage==GUIType.Presets) GUIPresets(WinSize2,new Vector2(-GUITrans.Get()*WinSize.x+Movement,MenuPad)); else if (GUIStage==GUIType.Configure) GUIConfigure(WinSize2,new Vector2(-GUITrans.Get()*WinSize.x+Movement,MenuPad)); else if (GUIStage==GUIType.Layers) GUILayers(WinSize2,new Vector2(-GUITrans.Get()*WinSize.x+Movement,MenuPad)); else if (GUIStage==GUIType.Inputs) GUIInputs(WinSize2,new Vector2(-GUITrans.Get()*WinSize.x+Movement,MenuPad)); if (GUITrans.Done()!=true) { Movement = WinSize2.x; if (GUITrans.Transitioning==ShaderTransition.TransDir.Backward) Movement = 0*WinSize2.x; if (GUITransition==GUIType.Start) GUIStart(WinSize2,new Vector2(-GUITrans.Get()*WinSize.x+Movement,MenuPad)); else if (GUITransition==GUIType.Presets) GUIPresets(WinSize2,new Vector2(-GUITrans.Get()*WinSize.x+Movement,MenuPad)); else if (GUITransition==GUIType.Configure) GUIConfigure(WinSize2,new Vector2(-GUITrans.Get()*WinSize.x+Movement,MenuPad)); else if (GUITransition==GUIType.Layers) GUILayers(WinSize2,new Vector2(-GUITrans.Get()*WinSize.x+Movement,MenuPad)); else if (GUITransition==GUIType.Inputs) GUIInputs(WinSize2,new Vector2(-GUITrans.Get()*WinSize.x+Movement,MenuPad)); } DrawMenu(); if (SVMD) ShaderUtil.EndGroup(); if (ShaderVarEditing!=null) ShaderVarEditing.UseEditingMouse(true); //Debug.Log(GUI.tooltip==""); //Debug.Log(TooltipAlpha); //GUI.color = new Color(GUI.color.r,GUI.color.g,GUI.color.b,TooltipAlpha); GUI.skin = oldskin; ShaderUtil.DrawTooltip(0,WinSize); if (GUI.changed==true){ changedTimer = 100; } changedTimer -=1; /*if (changedTimer>-100&&changedTimer<=0) { if (OpenShader!=null) OpenShader.RecalculateAutoInputs(); changedTimer = -200; }*/ if (PleaseReimport!=""&&Event.current.type==EventType.Repaint){ GiveMeAFrame+=1; if (GiveMeAFrame==4){ AssetDatabase.ImportAsset(PleaseReimport,ImportAssetOptions.ForceSynchronousImport); SetStatus("Updating Preview Window","Preview Updated.",1f); PleaseReimport = ""; GiveMeAFrame = 0; } } }
/*float Min = 2; float Max = 5; float MinL = 0; float MaxL = 10;*/ void GUIConfigure(Vector2 WinSize,Vector2 Position) { RunHotkeys(); ShaderBase SSIO = OpenShader; if (SSIO==null) { GUIStage = GUIType.Start; GUITrans.Reset(); } else { ShaderUtil.BeginGroup(new Rect(Position.x,Position.y,WinSize.x,WinSize.y)); GUIStyle ButtonStyle; if (Flatter){ ButtonStyle = new GUIStyle(GUI.skin.box); ButtonStyle.alignment = TextAnchor.MiddleCenter; } else ButtonStyle = new GUIStyle(GUI.skin.button); ButtonStyle.fontSize = 20; if (GUI.Button( ShaderUtil.Rect2(RectDir.Diag,WinSize.x,WinSize.y,100,30),"Layers",ButtonStyle)) Goto(GUIType.Layers,ShaderTransition.TransDir.Forward); Vector2 BoxSize = GUIConfigureBoxStart("",OpenShader.DiffuseOn,WinSize,0,0); ConfigScroll = ShaderUtil.BeginScrollView(new Rect(0,0,WinSize.x,WinSize.y),ConfigScroll,new Rect(0,0,WinSize.x-16,BoxSize.y*5+15f),false,true); if (Flatter) GUI.Box(new Rect(0,0,WinSize.x,100),""); else GUI.Box(new Rect(0,0,WinSize.x,100),"","button"); GUI.skin.label.fontSize = 18; GUI.Label(new Rect(10,30,200,40),"Shader Name: "); GUIStyle TextFieldStyle = new GUIStyle(GUI.skin.textField); TextFieldStyle.fontSize = 18; SSIO.ShaderName.Text = GUI.TextField(new Rect(160,30,400,30),SSIO.ShaderName.Text,TextFieldStyle); GUIConfigureBoxStart("Diffuse (Color)",OpenShader.DiffuseOn,WinSize,0,0); SSIO.DiffuseLightingType.Draw(new Rect(2,30,120,120)); SU.Label(new Rect(122,30,BoxSize.x-124,70),SSIO.DiffuseLightingType.Descriptions[SSIO.DiffuseLightingType.Type],12); //SSIO.DiffuseColor.Draw(new Rect(122,50,BoxSize.x-124,20),"Color: "); /*EditorGUI.MinMaxSlider(new Rect(182,130,BoxSize.x-244,20), ref Min, ref Max, MinL, MaxL); MinL = EditorGUI.FloatField(new Rect(142,130,40,20),MinL); MaxL = EditorGUI.FloatField(new Rect(BoxSize.x-40,130,40,20),MaxL); Min = EditorGUI.FloatField(new Rect(142,160,40,20),Min); Max = EditorGUI.FloatField(new Rect(BoxSize.x-40,160,40,20),Max); if (Min-1<MinL) MinL-=0.001f; if (Max+1>MaxL) MaxL+=0.001f;*/ if (SSIO.DiffuseLightingType.Type==0) SSIO.DiffuseNormals.Draw(new Rect(122,105,BoxSize.x-124,20),"Disable Normals: "); if (SSIO.DiffuseLightingType.Type==1) SSIO.DiffuseSetting1.Draw(new Rect(122,105,BoxSize.x-124,20),"Roughness: "); if (SSIO.DiffuseLightingType.Type==2){ SSIO.DiffuseSetting1.Draw(new Rect(122,105,BoxSize.x-124,20),"Light Wrap: "); SSIO.DiffuseSetting2.Draw(new Rect(122,130,BoxSize.x-124,20),"Color: "); } GUIConfigureBoxEnd(); if (SSIO.IsPBR){ GUI.enabled = false; SSIO.SpecularOn.On = true; } GUIConfigureBoxStart("Specular (Shine)",SSIO.SpecularOn,WinSize,1,0); if (SSIO.SpecularOn.On==true) { if (SSIO.IsPBR){ GUI.enabled = false; SSIO.SpecularLightingType.Type = 0; } SSIO.SpecularLightingType.Draw(new Rect(2,30,120,120)); SU.Label(new Rect(122,30,BoxSize.x-124,70),SSIO.SpecularLightingType.Descriptions[SSIO.SpecularLightingType.Type],12); if (SSIO.IsPBR) GUI.enabled = true; } else SSIO.SpecularLightingType.DrawPicType(new Rect(2,30,120,120),SSIO.DiffuseLightingType.GetImage(0),"Off"); SSIO.SpecularHardness.Range0 = 0.0001f; SSIO.SpecularHardness.Draw(new Rect(122,80,BoxSize.x-124,20),"Size: "); if (SSIO.IsPBR){ GUI.enabled = false; SSIO.SpecularEnergy.On = true; } SSIO.SpecularOffset.Draw(new Rect(122,105,BoxSize.x-124,20),"Offset: "); SSIO.SpecularEnergy.Draw(new Rect(122,130,BoxSize.x-124,20),"Conserve Energy: "); if (SSIO.IsPBR) GUI.enabled = true; GUIConfigureBoxEnd(); GUIConfigureBoxStart("Emission (Glow)",OpenShader.EmissionOn,WinSize,0,1); if (SSIO.EmissionOn.On){ SSIO.EmissionType.Draw(new Rect(2,30,120,120)); SU.Label(new Rect(122,30,BoxSize.x-124,70),SSIO.EmissionType.Descriptions[SSIO.EmissionType.Type],12); } else SSIO.OtherTypes.DrawPicType(new Rect(2,30,120,120),SSIO.OtherTypes.GetImage(3),"Off"); GUIConfigureBoxEnd(); float AThird = (BoxSize.x-122)/3; float AHalf = (BoxSize.x-122)/2; GUIConfigureBoxStart("Transparency (See Through)",OpenShader.TransparencyOn,WinSize,1,1); if (SSIO.TransparencyOn.On){ SSIO.TransparencyType.Draw(new Rect(2,30,120,120)); SU.Label(new Rect(122,30,BoxSize.x-124,70),SSIO.TransparencyType.Descriptions[SSIO.TransparencyType.Type],12); } else SSIO.OtherTypes.DrawPicType(new Rect(2,30,120,120),SSIO.OtherTypes.GetImage(2),"Off"); if (SSIO.TransparencyType.Type==0||(SSIO.TransparencyZWrite.On&&SSIO.TransparencyZWriteType.Type==1)) SSIO.TransparencyAmount.Draw(new Rect(122,100,BoxSize.x-124,20),"Cutoff: "); if (SSIO.TransparencyType.Type==1&&!(SSIO.TransparencyZWrite.On&&SSIO.TransparencyZWriteType.Type==1)) SSIO.TransparencyAmount.Draw(new Rect(122,100,BoxSize.x-124,20),"Transparency: "); bool OldGUIEnabled = GUI.enabled; if (SSIO.TransparencyType.Type==0){ GUI.enabled = false; SSIO.TransparencyZWrite.On = false; } SSIO.TransparencyZWrite.Draw(new Rect(122,125,BoxSize.x-124,20),"Z Write: "); if (!SSIO.TransparencyZWrite.On) GUI.enabled = false; SSIO.TransparencyZWriteType.Draw(new Rect(122+150,125,BoxSize.x-124-150,20),""); GUI.enabled = OldGUIEnabled; if (!(SSIO.DiffuseLightingType.Type==4)||!(SSIO.TransparencyType.Type==1)) GUI.enabled = false; SSIO.TransparencyPBR.Draw(new Rect(122,150,BoxSize.x-124,20),"Use PBR: "); GUI.enabled = OldGUIEnabled; if (!(SSIO.TransparencyType.Type==1)) GUI.enabled = false; GUI.Label(new Rect(122+150,150,AHalf,20),"Blend: "); SSIO.BlendMode.Draw(new Rect(122+200,150,BoxSize.x-(122+202),20),"Blend Modes: "); GUI.enabled = OldGUIEnabled; //SSIO.TransparencyReceive.Draw(new Rect(122+150,125,BoxSize.x-124,20),"Recieve Shadows: "); //if (SSIO.TransparencyReceive.On) //SSIO.TransparencyPBR.On = false; GUIConfigureBoxEnd(); GUIConfigureBoxStart("Shells (Fur/Grass)",OpenShader.ShellsOn,WinSize,0,2); if (SSIO.ShellsOn.On){ SSIO.OtherTypes.DrawPicType(new Rect(2,30,120,120),SSIO.OtherTypes.GetImage(5),"On",false); //SU.Label(new Rect(122,30,BoxSize.x-124,70),SSIO.TransparencyType.Descriptions[SSIO.TransparencyType.Type],12); } else SSIO.OtherTypes.DrawPicType(new Rect(2,30,120,120),SSIO.OtherTypes.GetImage(4),"Off",false); //ShellsScroll = ShaderUtil.BeginScrollView(new Rect(122,30,BoxSize.x-122,BoxSize.y-30),ShellsScroll,new Rect(122,30,BoxSize.x-122-15,BoxSize.y-30+50),false,false); //BoxSize.x-=15; ShaderUtil.BeginGroup(new Rect(0,-20,BoxSize.x,BoxSize.y+50)); SSIO.ShellsCount.Draw(new Rect(122,50,BoxSize.x-124,20),"Shell Count: "); SSIO.ShellsCount.NoInputs=true; SSIO.ShellsDistance.Draw(new Rect(122,75,BoxSize.x-124,20),"Distance: "); SSIO.ShellsCount.Float = Mathf.Round(SSIO.ShellsCount.Float); SSIO.ShellsEase.Draw(new Rect(122,100,BoxSize.x-124,20),"Ease: "); SSIO.ShellsEase.Range0 = 0f; SSIO.ShellsEase.Range1 = 3f; SSIO.ShellsLighting.LabelOffset = (int)AThird; SSIO.ShellsZWrite.LabelOffset = (int)AThird; SSIO.ShellsFront.LabelOffset = (int)AThird; SSIO.ShellsLighting.Draw(new Rect(122,125,AThird,20),"Lighting: "); SSIO.ShellsZWrite.Draw(new Rect(122+AThird,125,AThird,20),"Z Write: "); SSIO.ShellsFront.Draw(new Rect(122+(AThird)*2,125,AThird,20),"In-Front: "); //SSIO.ShellsCull.Draw(new Rect(142,175,BoxSize.x-20-142,20),"Cull: "); //SSIO.ShellsBlendMode.Draw(new Rect(142,150,BoxSize.x-20-142,20),"Blend Modes: "); GUI.Label(new Rect(122,150,AHalf,20),"Cull: "); SSIO.ShellsCull.Draw(new Rect(122+80,150,AHalf+30,20),"Cull: "); GUI.Label(new Rect(122,170,AHalf,20),"Blend: "); SSIO.ShellsBlendMode.Draw(new Rect(122+80,170,AHalf+30,20),"Blend Modes: "); //SSIO.ShellsBlendMode.Draw(new Rect(270,150,(BoxSize.x-270),20),"Blend Modes: "); ShaderUtil.EndGroup(); //ShaderUtil.EndScrollView(); //BoxSize.x+=15; GUIConfigureBoxEnd(); GUIConfigureBoxStart("POM (Fake Parallax)",OpenShader.ParallaxOn,WinSize,1,2); //Debug.Log(SSIO.OtherTypes.GetImage(0)); if (SSIO.ParallaxOn.On==true&&SSIO.ParallaxHeight.Float>0) { SSIO.OtherTypes.DrawPicType(new Rect(2,30,120,120),SSIO.OtherTypes.GetImage(1),"On"); } else SSIO.OtherTypes.DrawPicType(new Rect(2,30,120,120),SSIO.OtherTypes.GetImage(0),"Off"); SSIO.ParallaxHeight.Range1 = 0.4f; SSIO.ParallaxHeight.Draw(new Rect(122,50,BoxSize.x-124,20),"Height: "); SSIO.ParallaxBinaryQuality.NoInputs = true; SSIO.ParallaxBinaryQuality.Draw(new Rect(122,75,BoxSize.x-124,20),"Quality: "); SSIO.ParallaxBinaryQuality.Float = Mathf.Round(SSIO.ParallaxBinaryQuality.Float); SSIO.ParallaxSilhouetteClipping.Draw(new Rect(122,100,BoxSize.x-124,20),"Edge Clipping: "); //GUI.Label(new Rect(2,100,BoxSize.x-4,20),"Silhouette Clipping: "); //SSIO.ParallaxSilhouetteClipping = GUI.Toggle(new Rect(162,100,BoxSize.x-164,20),SSIO.ParallaxSilhouetteClipping,""); GUIConfigureBoxEnd(); EditorGUI.BeginChangeCheck (); if (SSIO.TechShaderTarget.Float<=4) OpenShader.TessellationOn.On = false; GUIConfigureBoxStart("Tessellation (Subdivision-ish)",OpenShader.TessellationOn,WinSize,0,3); if (EditorGUI.EndChangeCheck ()&&SSIO.TechShaderTarget.Float<=4){ if (OpenShader.TessellationOn.On){ if (!EditorUtility.DisplayDialog("Enable Shader Model 5?","Tessellation requires Shader Model 5. Turning this on will force the Shader Model to 5, however to see it work you'll need to enable DX11; you can do this from the Unity Player Settings. As this is a DX11 only feature it will limit what computers your shaders work on (including possibly your own). You can lower the Shader Model within the Misc settings.","Ok, enable it!","Oh, ok don't.")){ PlayerSettings.useDirect3D11 = true; OpenShader.TessellationOn.On = false; }else{ SSIO.TechShaderTarget.Float = 5; } } } //Debug.Log(SSIO.OtherTypes.GetImage(0)); if (SSIO.TessellationOn.On==true&&SSIO.TessellationQuality.Float>0) { SSIO.OtherTypes.DrawPicType(new Rect(2,30,120,120),SSIO.OtherTypes.GetImage(7),"On"); } else SSIO.OtherTypes.DrawPicType(new Rect(2,30,120,120),SSIO.OtherTypes.GetImage(6),"Off"); SSIO.TessellationQuality.Draw(new Rect(122,50,BoxSize.x-124,20),"Quality: "); OldGUIEnabled = GUI.enabled; if (SSIO.TessellationType.Type<1) GUI.enabled = false; SSIO.TessellationFalloff.Draw(new Rect(122,75,BoxSize.x-124,20),"Falloff: "); GUI.enabled = OldGUIEnabled; EditorGUI.BeginChangeCheck(); SSIO.TessellationType.Draw(new Rect(122,125,BoxSize.x-124,20),"Type: "); if (EditorGUI.EndChangeCheck()){ if (SSIO.TessellationType.Type==0) SSIO.TessellationQuality.Float = 3; } //SSIO.ParallaxBinaryQuality.Draw(new Rect(122,75,BoxSize.x-124,20),"Quality: "); //SSIO.ParallaxBinaryQuality.Float = Mathf.Round(SSIO.ParallaxBinaryQuality.Float); SSIO.TessellationSmoothingAmount.Draw(new Rect(122,100,BoxSize.x-124,20),"Smoothing: "); //GUI.Label(new Rect(2,100,BoxSize.x-4,20),"Silhouette Clipping: "); //SSIO.ParallaxSilhouetteClipping = GUI.Toggle(new Rect(162,100,BoxSize.x-164,20),SSIO.ParallaxSilhouetteClipping,""); GUIConfigureBoxEnd(); AThird = (BoxSize.x-10)/3; AHalf = (BoxSize.x-10)/2; GUIConfigureBoxStart("Misc",null,WinSize,1,3); SSIO.TechLOD.NoInputs = true; SSIO.TechLOD.Range0 = 0; SSIO.TechLOD.Range1 = 1000; SSIO.TechLOD.Float = Mathf.Round(SSIO.TechLOD.Float); SSIO.TechLOD.LabelOffset = 50; SSIO.TechLOD.Draw(new Rect(10,50,AHalf-10,20),"LOD: "); SSIO.TechShaderTarget.NoInputs = true; SSIO.TechShaderTarget.Range0 = 2; SSIO.TechShaderTarget.Range1 = 5; SSIO.TechShaderTarget.Float = Mathf.Round(SSIO.TechShaderTarget.Float); SSIO.TechShaderTarget.LabelOffset = 100; SSIO.TechShaderTarget.Draw(new Rect(20+AHalf,50,AHalf-20,20),"Shader Model: "); SSIO.MiscAmbient.LabelOffset = (int)AThird; SSIO.MiscVertexLights.LabelOffset = (int)AThird; SSIO.MiscLightmap.LabelOffset = (int)AThird; SSIO.MiscFog.LabelOffset = (int)AThird; SSIO.MiscFullShadows.LabelOffset = (int)AThird; SSIO.MiscInterpolateView.LabelOffset = (int)AThird; SSIO.MiscHalfView.LabelOffset = (int)AThird; SSIO.MiscShadows.LabelOffset = (int)AThird; SSIO.MiscForwardAdd.LabelOffset = (int)AThird; SSIO.TechCull.Draw(new Rect(10,75,BoxSize.x-20,20),"Cull: "); SSIO.MiscAmbient.Draw(new Rect(10,100,AThird,20),"Ambient: "); SSIO.MiscVertexLights.Draw(new Rect(10,125,AThird,20),"Vertex Lights: "); SSIO.MiscLightmap.Draw(new Rect(10+AThird,100,AThird,20),"Lightmaps: "); SSIO.MiscFog.Draw(new Rect(10+AThird,125,AThird,20),"Fog: "); SSIO.MiscInterpolateView.Draw(new Rect(10+AThird*2,100,AThird,20),"Interpolate View: "); SSIO.MiscHalfView.Draw(new Rect(10+AThird*2,125,AThird,20),"Half as View: "); SSIO.MiscShadows.Draw(new Rect(10,150,AThird,20),"Shadows: "); OldGUIEnabled = GUI.enabled; GUI.enabled = SSIO.MiscShadows.On; if (!SSIO.MiscShadows.On) SSIO.MiscFullShadows.On = false; SSIO.MiscFullShadows.Draw(new Rect(10+AThird,150,AThird,20),"Forward Shadows: "); GUI.enabled = OldGUIEnabled; SSIO.MiscForwardAdd.Draw(new Rect(10+AThird*2,150,AThird,20),"Forward Add: "); GUIConfigureBoxEnd(); //GUIConfigureBoxStart("Misc",ref ShaderSandwich.Instance.OpenShader.SpecularOn,WinSize,0,3); //GUIConfigureBoxEnd(); ShaderUtil.EndScrollView(); //GUIStyle ButtonStyle = new GUIStyle(GUI.skin.button); //ButtonStyle.fontSize = 20; //if ((Event.current.type == EventType.MouseMove)) //Debug.Log((Event.current.type == EventType.MouseMove)); /*if ((Event.current.type == EventType.MouseMove)) GUI.Toggle( ShaderUtil.Rect2(RectDir.Diag,WinSize.x,WinSize.y,100,30),true,"Layers",ButtonStyle); else GUI.Toggle( ShaderUtil.Rect2(RectDir.Diag,WinSize.x,WinSize.y,100,30),false,"Layers",ButtonStyle);*/ GUI.Toggle( ShaderUtil.Rect2(RectDir.Diag,WinSize.x,WinSize.y,100,30),GUIMouseHold&&(ShaderUtil.Rect2(RectDir.Diag,WinSize.x,WinSize.y,100,30).Contains(Event.current.mousePosition)),"Layers",ButtonStyle); //(ShaderUtil.Rect2(RectDir.Diag,WinSize.x,WinSize.y,100,30).Contains(Event.current.mousePosition)) //Goto(GUIType.Layers,ShaderTransition.TransDir.Forward); ShaderUtil.EndGroup(); ChangeSaveTemp(null); } }
//Parameters: //tag: Identify each GUI object individually. Any GUIObject data that share the same tag will be overidden by the second //name: GUI Object that has a name will be labeled //position: Rectangular coordinates in order to draw out the GUI Object //type: The type of GUI to render see lines 9-12 of this code of the available options //style: using GUI.skin.getStyle(style). Provide the string of the style and if exists, will skin the GUI Object //check: default setting of the checkbox when the UI interface gets opened. This parameter only applies to toggles. //min: minimum value for slider //max: maximum value for slider //defaultVal: default value for the slider at the start public void CreateGUIObject(string tag,string name, Rect position, GUIType type, string style, bool check=false, float min=0.0f, float max=0.0f, float defaultVal=0.0f,bool show = true) { GUIObjects.Add(tag,new GUIProperties(name,position,type,style,check,min,max,defaultVal,show)); }
void Goto(GUIType GUI,ShaderTransition.TransDir dir) { //if (GUI==GUIType.Presets) //GUI = GUIType.Layers; GUITrans.Start(dir); GUITransition = GUI; if (GUI == GUIType.Start) { StartNewTrans.Reset(); } }
/// <summary> /// Create a button bundle to be used for rendering. /// </summary> /// <param name="type">Type of button</param> /// <param name="position">Button location</param> /// <param name="size">Button size</param> /// <returns>Button object of type.</returns> public Button CreateButton(GUIType type, Vector2 position, Vector2 size) { // Retrieve texture object TextureContainer texture = m_textures.ElementAt((int)type); // Allocate new button object return new Button(texture.up, texture.down, position, size); }
void GUIInputs(Vector2 WinSize,Vector2 Position) { ShaderUtil.BeginGroup(new Rect(Position.x,Position.y,WinSize.x,WinSize.y)); if (OpenShader==null) { GUIStage = GUIType.Start; GUITrans.Reset(); } else { if (InputSwitch==null||InputSwitch.Count!=6){ InputSwitch = new Dictionary<string,bool>(); InputSwitch.Add("Type",false); InputSwitch.Add("Type2",false); InputSwitch.Add("Name",false); InputSwitch.Add("In Editor",false); InputSwitch.Add("Replacement",false); InputSwitch.Add("Value",false); } GUIStyle ButtonStyle = new GUIStyle(GUI.skin.button); ButtonStyle.fontSize = 20; if (GUI.Button( ShaderUtil.Rect2(RectDir.Diag,WinSize.x,WinSize.y,100,30),"Layers",ButtonStyle)) Goto(GUIType.Layers,ShaderTransition.TransDir.Forward); // int XX; // int YY; int X = -1; // int PerWidth = 3; GUI.skin.GetStyle("ButtonLeft").alignment = TextAnchor.MiddleLeft; GUI.skin.GetStyle("ButtonRight").alignment = TextAnchor.MiddleLeft; GUI.skin.GetStyle("ButtonMid").alignment = TextAnchor.MiddleLeft; //SeeShells = !GUI.Toggle(new Rect(251,10,100,25),!SeeShells,new GUIContent("Base",IconBase),GUI.skin.GetStyle("ButtonLeft")); //bool GUIChanged = GUI.changed; if (GUI.Button(new Rect(20,6,100,25),new GUIContent("Type"),GUI.skin.GetStyle("ButtonLeft"))){ if (!InputSwitch["Type"]) OpenShader.ShaderInputs = OpenShader.ShaderInputs.OrderBy(o=>o.Type).ToList(); else OpenShader.ShaderInputs = OpenShader.ShaderInputs.OrderByDescending(o=>o.Type).ToList(); InputSwitch["Type"] = !InputSwitch["Type"]; } if (GUI.Button(new Rect(120,6,90,25),new GUIContent("Fallback"),GUI.skin.GetStyle("ButtonMid"))){ if (!InputSwitch["Type2"]) OpenShader.ShaderInputs = OpenShader.ShaderInputs.OrderBy(o=>o.Type).ToList(); else OpenShader.ShaderInputs = OpenShader.ShaderInputs.OrderByDescending(o=>o.Type).ToList(); InputSwitch["Type2"] = !InputSwitch["Type2"]; } if (GUI.Button(new Rect(210,6,150,25),new GUIContent("Name"),GUI.skin.GetStyle("ButtonMid"))){ if (!InputSwitch["Name"]) OpenShader.ShaderInputs = OpenShader.ShaderInputs.OrderBy(o=>o.VisName).ToList(); else OpenShader.ShaderInputs = OpenShader.ShaderInputs.OrderByDescending(o=>o.VisName).ToList(); InputSwitch["Name"] = !InputSwitch["Name"]; } if (GUI.Button(new Rect(360,6,60,25),new GUIContent("Visible"),GUI.skin.GetStyle("ButtonMid"))){ if (!InputSwitch["In Editor"]) OpenShader.ShaderInputs = OpenShader.ShaderInputs.OrderBy(o=>o.InEditor).ToList(); else OpenShader.ShaderInputs = OpenShader.ShaderInputs.OrderByDescending(o=>o.InEditor).ToList(); InputSwitch["In Editor"] = !InputSwitch["In Editor"]; } if (GUI.Button(new Rect(420,6,140,25),new GUIContent("Replacement"),GUI.skin.GetStyle("ButtonRight"))){ if (!InputSwitch["Replacement"]) OpenShader.ShaderInputs = OpenShader.ShaderInputs.OrderBy(o=>o.SpecialType).ToList(); else OpenShader.ShaderInputs = OpenShader.ShaderInputs.OrderByDescending(o=>o.SpecialType).ToList(); InputSwitch["Replacement"] = !InputSwitch["Replacement"]; } if (GUI.Button(new Rect(WinSize.x-160,6,140,25),"Clean Inputs")){ List<ShaderVar> SVs = new List<ShaderVar>(); foreach (ShaderLayer SL in ShaderUtil.GetAllLayers()){ SL.UpdateShaderVars(true); SVs.AddRange(SL.ShaderVars); } SVs.AddRange(OpenShader.GetMyShaderVars()); foreach(ShaderInput SI in OpenShader.ShaderInputs){ SI.UsedCount = 0; foreach(ShaderVar SV in SVs){ if (SV.Input==SI) SI.UsedCount+=1; } } for (int i = OpenShader.ShaderInputs.Count-1;i>-1;i--){ ShaderInput SI = OpenShader.ShaderInputs[i]; if (SI.UsedCount==0){ OpenShader.ShaderInputs.Remove(SI); foreach(ShaderVar SV in SVs){ if (SV.Input==SI) SV.Input = null; } } } EditorGUIUtility.ExitGUI(); } // GUI.changed = GUIChanged; ButtonStyle = new GUIStyle(GUI.skin.button); ButtonStyle.padding = new RectOffset(0,0,0,0); ButtonStyle.margin = new RectOffset(0,0,0,0); if ((OpenShader.ShaderInputs.Count*50+36)>WinSize.y) InputScroll = ShaderUtil.BeginScrollView(new Rect(0,36,WinSize.x,WinSize.y-36),InputScroll,new Rect(0,0,230,OpenShader.ShaderInputs.Count*50),false,true); else ShaderUtil.BeginGroup(new Rect(0,36,WinSize.x,WinSize.y-36)); foreach(ShaderInput SI in OpenShader.ShaderInputs){ X++;//5 //XX = X % PerWidth;//1 0,1,2,0,1 //YY = (int)Mathf.Floor((float)X/(float)PerWidth);//1 //ShaderUtil.DrawEffects(new Rect(0,0,350,350),SI.InputEffects,SelectedEffect); //if (SI.AutoCreated) //GUI.enabled = false; ShaderUtil.BeginGroup(new Rect(20,X*50,WinSize.x-40,40),"button"); if (SI.Type!=3&&SI.Type!=4){ GUI.enabled = false; SI.Type = EditorGUI.IntPopup(new Rect(10,10,80,20),SI.Type,new string[]{"Color","Image","Cubemap","Float","Range"},new int[]{1,0,2,3,4},GUI.skin.GetStyle("MiniPopup")); GUI.enabled = true; } else{ SI.Type = EditorGUI.IntPopup(new Rect(10,10,80,20),SI.Type,new string[]{"Float","Range"},new int[]{3,4},GUI.skin.GetStyle("MiniPopup")); } //None,MainColor,MainTexture,BumpMap,MainCubemap,SpecularColor,Shininess,ReflectColor,Parallax,ParallaxMap string[] SInputTypes = new string[0]; InputMainTypes[] EInputTypes = new InputMainTypes[0]; SInputTypes = new string[]{"None"}; EInputTypes = new InputMainTypes[]{InputMainTypes.None}; if (SI.Type==0){ SInputTypes = new string[]{"None","Main Texture","Normal Map","Parallax Map","Terrain/Control","Terrain/Splat 0","Terrain/Splat 1","Terrain/Splat 2","Terrain/Splat 3","Terrain/Normal 0","Terrain/Normal 1","Terrain/Normal 2","Terrain/Normal 3"}; EInputTypes = new InputMainTypes[]{InputMainTypes.None,InputMainTypes.MainTexture,InputMainTypes.BumpMap,InputMainTypes.ParallaxMap,InputMainTypes.TerrainControl,InputMainTypes.TerrainSplat0,InputMainTypes.TerrainSplat1,InputMainTypes.TerrainSplat2,InputMainTypes.TerrainSplat3,InputMainTypes.TerrainNormal0,InputMainTypes.TerrainNormal1,InputMainTypes.TerrainNormal2,InputMainTypes.TerrainNormal3}; } if (SI.Type==1){ SInputTypes = new string[]{"None","Main Color","Specular Color","Reflect Color"}; EInputTypes = new InputMainTypes[]{InputMainTypes.None,InputMainTypes.MainColor,InputMainTypes.SpecularColor,InputMainTypes.ReflectColor}; } if (SI.Type==2){ SInputTypes = new string[]{"None","Main Cubemap"}; EInputTypes = new InputMainTypes[]{InputMainTypes.None,InputMainTypes.MainCubemap}; } if (SI.Type==3||SI.Type==4){ SInputTypes = new string[]{"None","Shininess","Parallax","Cutoff","Shell Distance"}; EInputTypes = new InputMainTypes[]{InputMainTypes.None,InputMainTypes.Shininess,InputMainTypes.Parallax,InputMainTypes.Cutoff,InputMainTypes.ShellDistance}; } int IndexOfType=0; if (Array.IndexOf(EInputTypes,SI.MainType)!=-1) IndexOfType = Array.IndexOf(EInputTypes,SI.MainType); SI.MainType = EInputTypes[EditorGUI.Popup(new Rect(100,10,80,20),"",IndexOfType,SInputTypes,GUI.skin.GetStyle("MiniPopup"))]; //SI.MainType = (InputMainTypes)EditorGUI.EnumPopup(new Rect(100,10,80,20),"",SI.MainType); SI.VisName = GUI.TextField(new Rect(190,10,140,20),SI.VisName); //if (Event.current.type==EventType.Repaint){ if (SI.Type==0||SI.Type==2){ SI.InEditor = true; GUI.enabled = false; } if (SI.InEditor) SI.InEditor = GUI.Toggle(new Rect(340,10,20,20),SI.InEditor,ShaderSandwich.Tick,ButtonStyle); else SI.InEditor = GUI.Toggle(new Rect(340,10,20,20),SI.InEditor,ShaderSandwich.Cross,ButtonStyle); if (SI.Type==0||SI.Type==2){ GUI.enabled = true; } //None,Time,TimeFast,TimeSlow,SinTime,SinTimeFast,SinTimeSlow,CosTime,CosTimeFast,CosTimeSlow InputSpecialTypes[] EInputTypes2 = new InputSpecialTypes[0]; SInputTypes = new string[]{"None"}; EInputTypes2 = new InputSpecialTypes[]{InputSpecialTypes.None}; if (SI.Type==3||SI.Type==4){ SInputTypes = new string[]{"None","Time/Basic/Standard","Time/Basic/Fast","Time/Basic/Slow","Time/Basic/Very Slow","Time/Sine/Standard","Time/Sine/Fast","Time/Sine/Slow","Time/Cosine/Standard","Time/Cosine/Fast","Time/Cosine/Slow","Time/Clamped Sine/Standard","Time/Clamped Sine/Fast","Time/Clamped Sine/Slow","Time/Clamped Cosine/Standard","Time/Clamped Cosine/Fast","Time/Clamped Cosine/Slow","Depth/Shell","Depth/Parallax Occlusion Mapping"}; EInputTypes2 = new InputSpecialTypes[]{InputSpecialTypes.None,InputSpecialTypes.Time,InputSpecialTypes.TimeFast,InputSpecialTypes.TimeSlow,InputSpecialTypes.TimeVerySlow,InputSpecialTypes.SinTime,InputSpecialTypes.SinTimeFast,InputSpecialTypes.SinTimeSlow,InputSpecialTypes.CosTime,InputSpecialTypes.CosTimeFast,InputSpecialTypes.CosTimeSlow, InputSpecialTypes.ClampedSinTime,InputSpecialTypes.ClampedSinTimeFast,InputSpecialTypes.ClampedSinTimeSlow,InputSpecialTypes.ClampedCosTime,InputSpecialTypes.ClampedCosTimeFast,InputSpecialTypes.ClampedCosTimeSlow,InputSpecialTypes.ShellDepth,InputSpecialTypes.ParallaxDepth}; } IndexOfType=0; if (Array.IndexOf(EInputTypes2,SI.SpecialType)!=-1) IndexOfType = Array.IndexOf(EInputTypes2,SI.SpecialType); if (SI.InEditor){ SI.SpecialType = InputSpecialTypes.None; GUI.enabled = false; EditorGUI.Popup(new Rect(400,10,140,20),"",IndexOfType,SInputTypes,GUI.skin.GetStyle("MiniPopup")); GUI.enabled = true; } else SI.SpecialType = EInputTypes2[EditorGUI.Popup(new Rect(400,10,140,20),"",IndexOfType,SInputTypes,GUI.skin.GetStyle("MiniPopup"))]; GUI.enabled = true; if (SI.Type==3){//Float SI.Number = EditorGUI.FloatField(new Rect(550,10,120,20),"",SI.Number,GUI.skin.textField); } if (SI.Type==4){//Range SI.Range0 = EditorGUI.FloatField(new Rect(550,10,30,20),"",SI.Range0,GUI.skin.textField); SI.Number = GUI.HorizontalSlider(new Rect(590,10,40,20),SI.Number,SI.Range0,SI.Range1); SI.Range1 = EditorGUI.FloatField(new Rect(640,10,30,20),"",SI.Range1,GUI.skin.textField); } Color OldColor = GUI.backgroundColor; //GUI.color = new Color(1,1,1,1); GUI.backgroundColor = new Color(1,1,1,1); if (SI.Type==0){//Image SI.Image = (Texture2D) EditorGUI.ObjectField (new Rect(550,10,120,20),SI.ImageS(), typeof (Texture2D),false); } if (SI.Type==1){//Color SI.Color = (ShaderColor)EditorGUI.ColorField(new Rect(550,10,140,20),"",(Color)SI.Color); } if (SI.Type==2){//Cubemap SI.Cube = (Cubemap) EditorGUI.ObjectField (new Rect(550,10,120,20),SI.CubeS(), typeof (Cubemap),false); } GUI.backgroundColor = OldColor; if (SI.Type==0){ GUI.Label(new Rect(680,10,200,20),"Normal Map: "); if (SI.NormalMap) SI.NormalMap = GUI.Toggle(new Rect(770,10,20,20),SI.NormalMap,ShaderSandwich.Tick,ButtonStyle); else SI.NormalMap = GUI.Toggle(new Rect(770,10,20,20),SI.NormalMap,ShaderSandwich.Cross,ButtonStyle); } //InputSpecialTypes //UnityEngine.Debug.Log("ASD"); if (X==0) GUI.enabled = false; if (GUI.Button(new Rect(WinSize.x-40-75,10,20,20),UPArrow,ButtonStyle)) { ShaderUtil.MoveItem(ref OpenShader.ShaderInputs,X,X-1);//MoveLayerUp = Pos; EditorGUIUtility.ExitGUI(); } GUI.enabled = true; if (GUI.Button(new Rect(WinSize.x-40-50,10,20,20),CrossRed,ButtonStyle)) { OpenShader.ShaderInputs.RemoveAt(X); List<ShaderVar> SVs = new List<ShaderVar>(); foreach (ShaderLayer SL in ShaderUtil.GetAllLayers()){ SL.UpdateShaderVars(true); SVs.AddRange(SL.ShaderVars); } SVs.AddRange(OpenShader.GetMyShaderVars()); foreach(ShaderVar SV in SVs){ if (SV.Input==SI) SV.Input = null; } //UEObject.DestroyImmediate(SL,false); EditorGUIUtility.ExitGUI(); } if (X>=OpenShader.ShaderInputs.Count-1) GUI.enabled = false; if (GUI.Button(new Rect(WinSize.x-40-25,10,20,20),DOWNArrow,ButtonStyle)) { //Pos2+=1; ShaderUtil.MoveItem(ref OpenShader.ShaderInputs,X,X+1);//MoveLayerDown = Pos; EditorGUIUtility.ExitGUI(); } GUI.enabled = true; //SI.InEditor = GUI.Toggle(new Rect(250,10,20,20),SI.InEditor); ShaderUtil.EndGroup(); GUI.enabled = true; } if ((OpenShader.ShaderInputs.Count*50+36)>WinSize.y) ShaderUtil.EndScrollView(); else ShaderUtil.EndGroup(); /*Features: Editor Inputs Inputs: (Composed of editor inputs and custom values) Can apply effects to inputs Interface: Two Tabs: Primary and secondary inputs. */ ChangeSaveTemp(null,true); ButtonStyle.fontSize = 20; //if (GUI.Button( ShaderUtil.Rect2(RectDir.Diag,WinSize.x,WinSize.y,100,30),"Layers",ButtonStyle)) // Goto(GUIType.Layers,ShaderTransition.TransDir.Forward); GUI.Toggle( ShaderUtil.Rect2(RectDir.Diag,WinSize.x,WinSize.y,100,30),GUIMouseHold&&(ShaderUtil.Rect2(RectDir.Diag,WinSize.x,WinSize.y,100,30).Contains(Event.current.mousePosition)),"Layers",ButtonStyle); } ShaderUtil.EndGroup(); }