Esempio n. 1
0
    public static void show4UpgradeList(string cfgPath)
    {
        if (string.IsNullOrEmpty(cfgPath))
        {
            cfgPath = ECLProjectManager.ver4UpgradeList;
        }
        isSelectMod = false;
        string str = "";
        string p   = Application.dataPath + "/" + cfgPath;

        if (File.Exists(p))
        {
            str = File.ReadAllText(p);
        }
        ArrayList list = JSON.DecodeList(str);

        if (list == null || list.Count == 0)
        {
            EditorUtility.DisplayDialog("Alert", "no data to show!", "Okay");
            return;
        }

        ECLUpgradeListProc window = ECLUpgradeListProc.GetWindow <ECLUpgradeListProc> (true, "Upgrade Res List", true);

        if (window == null)
        {
            window = new ECLUpgradeListProc();
        }
        Vector2 size = Handles.GetMainGameViewSize();
        Rect    rect = window.position;

        rect.x      = -Screen.width - Screen.width / 4;
        rect.y      = Screen.height / 2 - Screen.height / 4;
        rect.width  = Screen.width;
        rect.height = Screen.height / 2;

        rect                     = new Rect(10, 40, size.x, size.y / 2);
        window.position          = rect;
        window.title             = "Upgrade资源包列表";
        ECLUpgradeListProc.mList = list;
        window.refreshData();
        ECLUpgradeListProc.cfgPath = cfgPath;
        // window.ShowPopup ();
        window.ShowAuxWindow();
    }
    public void setUpgradePkgMutlMode(string platform)
    {
        bool canSetMd5 = false;

        foreach (DictionaryEntry cell in servers)
        {
            Hashtable server = cell.Value as Hashtable;
            if (MapEx.getBool(server, "selected"))
            {
                canSetMd5 = true;
                break;
            }
        }
        if (canSetMd5)
        {
            ECLUpgradeListProc.popup4Select((Callback)onGetUpgradePkgMultMode, platform);
        }
        else
        {
            Debug.LogError("Please select some servers!!");
        }
    }
Esempio n. 3
0
 public ECLUpgradeListProc()
 {
     self = this;
     EditorApplication.update += OnUpdate;
 }
    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();
    }