void DrawGUI() { GUI.SetNextControlName("empty"); GUI.Button(new Rect(0, 0, 0, 0), "", GUIStyle.none); GUIStyle activeTabStyle = new GUIStyle("ButtonMid"); GUIStyle activeTabStyleLeft = new GUIStyle("ButtonLeft"); GUIStyle activeTabStyleRight = new GUIStyle("ButtonRight"); GUIStyle inactiveTabStyle = new GUIStyle(activeTabStyle); GUIStyle inactiveTabStyleLeft = new GUIStyle(activeTabStyleLeft); GUIStyle inactiveTabStyleRight = new GUIStyle(activeTabStyleRight); activeTabStyle.normal = activeTabStyle.active; activeTabStyleLeft.normal = activeTabStyleLeft.active; activeTabStyleRight.normal = activeTabStyleRight.active; GUILayout.BeginHorizontal(); for (int i = 0, imax = (int)CloudGoodsSettings.ScreenType._LastDoNotUse; i < imax; i++) { GUIStyle active = activeTabStyleLeft; if (i > 2) { active = activeTabStyle; } if (i == (int)CloudGoodsSettings.ScreenType._LastDoNotUse - 1) { active = activeTabStyleRight; } GUIStyle inactive = inactiveTabStyleLeft; if (i > 2) { inactive = inactiveTabStyle; } if (i == (int)CloudGoodsSettings.ScreenType._LastDoNotUse - 1) { inactive = inactiveTabStyleRight; } GUI.backgroundColor = screen == (CloudGoodsSettings.ScreenType)i ? Color.cyan : Color.white; GUIContent mName = new GUIContent(((CloudGoodsSettings.ScreenType)i).ToString()); if (GUILayout.Button(((CloudGoodsSettings.ScreenType)i == CloudGoodsSettings.ScreenType.Settings) ? settingsContent : mName, screen == (CloudGoodsSettings.ScreenType)i ? active : inactive)) { GUI.FocusControl("empty"); screen = (CloudGoodsSettings.ScreenType)i; } } GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); switch (screen) { case CloudGoodsSettings.ScreenType.Settings: DrawSettingsGUI(); break; case CloudGoodsSettings.ScreenType.About: DrawAboutGUI(); break; } }
void DrawGUI() { GUI.SetNextControlName("empty"); GUI.Button(new Rect(0, 0, 0, 0), "", GUIStyle.none); GUIStyle activeTabStyle = new GUIStyle("ButtonMid"); GUIStyle activeTabStyleLeft = new GUIStyle("ButtonLeft"); GUIStyle activeTabStyleRight = new GUIStyle("ButtonRight"); GUIStyle inactiveTabStyle = new GUIStyle(activeTabStyle); GUIStyle inactiveTabStyleLeft = new GUIStyle(activeTabStyleLeft); GUIStyle inactiveTabStyleRight = new GUIStyle(activeTabStyleRight); activeTabStyle.normal = activeTabStyle.active; activeTabStyleLeft.normal = activeTabStyleLeft.active; activeTabStyleRight.normal = activeTabStyleRight.active; GUILayout.BeginHorizontal(); for (int i = 0, imax = (int)CloudGoodsSettings.ScreenType._LastDoNotUse; i < imax; i++) { GUIStyle active = activeTabStyleLeft; if (i > 2) active = activeTabStyle; if (i == (int)CloudGoodsSettings.ScreenType._LastDoNotUse - 1) active = activeTabStyleRight; GUIStyle inactive = inactiveTabStyleLeft; if (i > 2) inactive = inactiveTabStyle; if (i == (int)CloudGoodsSettings.ScreenType._LastDoNotUse - 1) inactive = inactiveTabStyleRight; GUI.backgroundColor = screen == (CloudGoodsSettings.ScreenType)i ? Color.cyan : Color.white; GUIContent mName = new GUIContent(((CloudGoodsSettings.ScreenType)i).ToString()); if (GUILayout.Button(((CloudGoodsSettings.ScreenType)i == CloudGoodsSettings.ScreenType.Settings) ? settingsContent : mName, screen == (CloudGoodsSettings.ScreenType)i ? active : inactive)) { GUI.FocusControl("empty"); screen = (CloudGoodsSettings.ScreenType)i; } } GUI.backgroundColor = Color.white; GUILayout.EndHorizontal(); switch (screen) { case CloudGoodsSettings.ScreenType.Settings: DrawSettingsGUI(); break; case CloudGoodsSettings.ScreenType.About: DrawAboutGUI(); break; } }