void OnGUI() { if (!ECLProjectSetting.isProjectExit(ECLProjectManager.self)) { GUIStyle style = new GUIStyle(); style.fontSize = 20; style.normal.textColor = Color.yellow; GUILayout.Label("The scene is not ready, create it now?", style); if (GUILayout.Button("Show Project Manager")) { EditorWindow.GetWindow <ECLProjectManager> (false, "CoolapeProject", true); } Close(); return; } if (ECLProjectManager.data.hotUpgradeServers.Count > 0) { ECLEditorUtl.BeginContents(); { List <string> toolbarNames = new List <string> (); for (int i = 0; i < ECLProjectManager.data.hotUpgradeServers.Count; i++) { HotUpgradeServerInfor dd = ECLProjectManager.data.hotUpgradeServers [i] as HotUpgradeServerInfor; toolbarNames.Add(dd.name); } selectedServerIndex = GUILayout.Toolbar(selectedServerIndex, toolbarNames.ToArray()); HotUpgradeServerInfor hsi = ECLProjectManager.data.hotUpgradeServers [selectedServerIndex] as HotUpgradeServerInfor; selectedServer = hsi; // ECLProjectSetting.cellServerInor (hsi, false); //=================================================== GUILayout.BeginHorizontal(); { GUILayout.Label("Key:", ECLEditorUtl.width200); GUILayout.TextField(selectedServer.key); } GUILayout.EndHorizontal(); //=================================================== GUILayout.BeginHorizontal(); { GUILayout.Label("Hot Upgrade Base Url:", ECLEditorUtl.width200); GUILayout.TextField(selectedServer.hotUpgradeBaseUrl); } GUILayout.EndHorizontal(); //=================================================== GUILayout.BeginHorizontal(); { GUILayout.Label("Host 4 Upload Upgrade Package:", ECLEditorUtl.width200); GUILayout.TextField(selectedServer.host4UploadUpgradePackage); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { GUILayout.Label("Port 4 Upload Upgrade Package:", ECLEditorUtl.width200); EditorGUILayout.IntField(selectedServer.port4UploadUpgradePackage); } GUILayout.EndHorizontal(); } ECLEditorUtl.EndContents(); } if (selectedServer == null) { GUILayout.Label("Please select a server!"); return; } EditorGUILayout.BeginHorizontal(); { GUI.color = Color.green; if (GUILayout.Button("Refresh", GUILayout.Height(40f))) { setData(); } GUI.color = Color.white; if (!isSelectMod) { if (GUILayout.Button("Save", GUILayout.Height(40f))) { if (mList == null || mList.Count == 0) { Debug.LogWarning("Nothing need to save!"); return; } string str = JSON.JsonEncode(mList); File.WriteAllText(Application.dataPath + "/" + cfgPath, str); } } } EditorGUILayout.EndHorizontal(); ECLEditorUtl.BeginContents(); { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Package Name", GUILayout.Width(160)); EditorGUILayout.LabelField("MD5", GUILayout.Width(250)); EditorGUILayout.LabelField("Exist?", GUILayout.Width(40)); EditorGUILayout.LabelField("Upload?", GUILayout.Width(60)); EditorGUILayout.LabelField("...", GUILayout.Width(60)); EditorGUILayout.LabelField("Notes"); } EditorGUILayout.EndHorizontal(); if (mList == null) { return; } scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(position.width), GUILayout.Height(position.height - 75)); { for (int i = mList.Count - 1; i >= 0; i--) { item = ListEx.getMap(mList, i); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.TextField(MapEx.getString(item, "name"), GUILayout.Width(160)); EditorGUILayout.TextField(MapEx.getString(item, "md5"), GUILayout.Width(250)); if (!MapEx.getBool(item, "exist")) { GUI.color = Color.red; } EditorGUILayout.TextField(MapEx.getBool(item, "exist") ? "Yes" : "No", GUILayout.Width(40)); GUI.color = Color.white; if (!isUploaded(item)) { GUI.color = Color.red; } EditorGUILayout.TextField(isUploaded(item) ? "Yes" : "No", GUILayout.Width(60)); GUI.color = Color.white; if (MapEx.getBool(item, "exist")) { GUI.enabled = true; } else { GUI.enabled = false; } GUI.color = Color.yellow; if (isSelectMod) { if (GUILayout.Button("select", GUILayout.Width(60f))) { Close(); Utl.doCallback(onSelectedCallback, item, selectedCallbackParams); } } else { if (GUILayout.Button("upload", GUILayout.Width(60f))) { if (EditorUtility.DisplayDialog("Alert", "Really want to upload the upgrade package?", "Okey", "cancel")) { selectedPackageName = MapEx.getString(item, "name"); uploadUpgradePackage(MapEx.getString(item, "name")); } } if (GUILayout.Button("同步OSS", GUILayout.Width(60f))) { if (EditorUtility.DisplayDialog("Alert", "Really want to upload the upgrade package?", "Okey", "cancel")) { uploadOss(MapEx.getString(item, "name")); } } } GUI.color = Color.white; GUI.enabled = true; item ["remark"] = EditorGUILayout.TextArea(MapEx.getString(item, "remark")); GUILayout.Space(5); } EditorGUILayout.EndHorizontal(); } } EditorGUILayout.EndScrollView(); } ECLEditorUtl.EndContents(); }
void OnGUI() { if (!ECLProjectSetting.isProjectExit(ECLProjectManager.self)) { GUIStyle style = new GUIStyle(); style.fontSize = 20; style.normal.textColor = Color.yellow; GUILayout.Label("The scene is not ready, create it now?", style); if (GUILayout.Button("Show Project Manager")) { EditorWindow.GetWindow <ECLProjectManager> (false, "CoolapeProject", true); } Close(); return; } if (ECLProjectManager.data.hotUpgradeServers.Count <= 0) { GUI.color = Color.red; GUILayout.Label("There is no server"); GUI.color = Color.white; return; } if (ECLProjectManager.data.hotUpgradeServers.Count > 0) { ECLEditorUtl.BeginContents(); { List <string> toolbarNames = new List <string> (); for (int i = 0; i < ECLProjectManager.data.hotUpgradeServers.Count; i++) { HotUpgradeServerInfor dd = ECLProjectManager.data.hotUpgradeServers [i] as HotUpgradeServerInfor; toolbarNames.Add(dd.name); } int index = GUILayout.Toolbar(selectedServerIndex, toolbarNames.ToArray()); HotUpgradeServerInfor hsi = ECLProjectManager.data.hotUpgradeServers [index] as HotUpgradeServerInfor; selectedServer = hsi; if (selectedServerIndex != index) { selectedServerIndex = index; refreshData(); } //=================================================== GUILayout.BeginHorizontal(); { GUILayout.Label("Key:", ECLEditorUtl.width200); GUILayout.TextField(selectedServer.key); } GUILayout.EndHorizontal(); //=================================================== GUILayout.BeginHorizontal(); { GUILayout.Label("URL of get server list:", ECLEditorUtl.width200); GUILayout.TextField(selectedServer.getServerListUrl); } GUILayout.EndHorizontal(); //=================================================== GUILayout.BeginHorizontal(); { GUILayout.Label("URL of set upgrade pkg md5:", ECLEditorUtl.width200); GUILayout.TextField(selectedServer.setServerPkgMd5Url); } GUILayout.EndHorizontal(); } ECLEditorUtl.EndContents(); } GUI.color = Color.green; if (GUILayout.Button("Refresh")) { refreshData(); } GUI.color = Color.white; if (servers == null || servers.Count == 0) { return; } GUILayout.Space(5); EditorGUILayout.BeginHorizontal(); { if (GUILayout.Button("All", GUILayout.Width(30))) { isSelectAll = !isSelectAll; foreach (DictionaryEntry cell in servers) { server = (Hashtable)(cell.Value); server ["selected"] = isSelectAll; } } EditorGUILayout.LabelField("SID", GUILayout.Width(80)); EditorGUILayout.LabelField("SName", GUILayout.Width(100)); GUI.color = Color.yellow; #if UNITY_ANDROID EditorGUILayout.LabelField("UpgradeMd5Ver(Android)", GUILayout.Width(250)); #elif UNITY_IPHONE || UNITY_IOS EditorGUILayout.LabelField("UpgradeMd5Ver(ios)", GUILayout.Width(250)); #elif UNITY_STANDALONE_WIN EditorGUILayout.LabelField("UpgradeMd5Ver(win)", GUILayout.Width(250)); #elif UNITY_STANDALONE_OSX EditorGUILayout.LabelField("UpgradeMd5Ver(osx)", GUILayout.Width(250)); #elif UNITY_WEBGL EditorGUILayout.LabelField("UpgradeMd5Ver(webgl)", GUILayout.Width(250)); #endif EditorGUILayout.LabelField("UpgradePkg Name", GUILayout.Width(160)); EditorGUILayout.LabelField("UpgradePkg Mark", GUILayout.Width(250)); GUI.color = Color.white; #if UNITY_ANDROID if (GUILayout.Button("Select Md5(Android)")) { setUpgradePkgMutlMode("Android"); } #elif UNITY_IPHONE || UNITY_IOS if (GUILayout.Button("Select Md5(ios)")) { setUpgradePkgMutlMode("ios"); } #elif UNITY_STANDALONE_WIN if (GUILayout.Button("Select Md5(win)")) { setUpgradePkgMutlMode("win"); } #elif UNITY_STANDALONE_OSX if (GUILayout.Button("Select Md5(osx)")) { setUpgradePkgMutlMode("osx"); } #elif UNITY_WEBGL if (GUILayout.Button("Select Md5(webgl)")) { setUpgradePkgMutlMode("webgl"); } #endif } EditorGUILayout.EndHorizontal(); GUILayout.Space(5); ECLEditorUtl.BeginContents(); { scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(position.width), GUILayout.Height(position.height - 50)); { foreach (DictionaryEntry cell in servers) { server = (Hashtable)(cell.Value); EditorGUILayout.BeginHorizontal(); { server ["selected"] = EditorGUILayout.Toggle(MapEx.getBool(server, "selected"), GUILayout.Width(30)); if (MapEx.getBool(server, "selected")) { GUI.color = Color.cyan; } else { GUI.color = Color.white; } EditorGUILayout.TextField(MapEx.getString(server, "idx"), GUILayout.Width(80)); EditorGUILayout.TextField(MapEx.getString(server, "servername"), GUILayout.Width(100)); GUI.color = Color.yellow; #if UNITY_ANDROID EditorGUILayout.TextField(MapEx.getString(server, "androidversion"), GUILayout.Width(250)); #elif UNITY_IPHONE || UNITY_IOS EditorGUILayout.TextField(MapEx.getString(server, "iosversion"), GUILayout.Width(250)); #elif UNITY_STANDALONE_WIN EditorGUILayout.TextField(MapEx.getString(server, "winversion"), GUILayout.Width(250)); #elif UNITY_STANDALONE_OSX EditorGUILayout.TextField(MapEx.getString(server, "osxversion"), GUILayout.Width(250)); #elif UNITY_WEBGL EditorGUILayout.TextField(MapEx.getString(server, "webglversion"), GUILayout.Width(250)); #endif EditorGUILayout.TextField(MapEx.getString(server, "pkgName"), GUILayout.Width(160)); EditorGUILayout.TextArea(MapEx.getString(server, "pkgRemark"), GUILayout.Width(250)); GUI.color = Color.white; #if UNITY_ANDROID if (GUILayout.Button("Select Md5(Android)")) { ECLUpgradeListProc.popup4Select((Callback)onGetUpgradePkg, ListEx.builder().Add(cell.Key).Add("Android").ToList()); } #elif UNITY_IPHONE || UNITY_IOS if (GUILayout.Button("Select Md5(ios)")) { ECLUpgradeListProc.popup4Select((Callback)onGetUpgradePkg, ListEx.builder().Add(cell.Key).Add("ios").ToList()); } #elif UNITY_STANDALONE_WIN if (GUILayout.Button("Select Md5(win)")) { ECLUpgradeListProc.popup4Select((Callback)onGetUpgradePkg, ListEx.builder().Add(cell.Key).Add("win").ToList()); } #elif UNITY_STANDALONE_OSX if (GUILayout.Button("Select Md5(osx)")) { ECLUpgradeListProc.popup4Select((Callback)onGetUpgradePkg, ListEx.builder().Add(cell.Key).Add("osx").ToList()); } #elif UNITY_WEBGL if (GUILayout.Button("Select Md5(webgl)")) { ECLUpgradeListProc.popup4Select((Callback)onGetUpgradePkg, ListEx.builder().Add(cell.Key).Add("wegbl").ToList()); } #endif } EditorGUILayout.EndHorizontal(); } } EditorGUILayout.EndScrollView(); } ECLEditorUtl.EndContents(); }