Exemplo n.º 1
0
    void OnGUI()
    {
        if (platformDatas == null)
        {
            return;
        }
        if (sexyShow.firstTime)
        {
            sexyShow.GetSexy();
        }
        sexyShow.Update();
        if (sexyShow.errorString != null)
        {
            window.ShowNotification(new GUIContent(sexyShow.errorString));
            sexyShow.errorString = null;
        }

        scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.MaxWidth(width), GUILayout.Width(width), GUILayout.Height(height), GUILayout.ExpandWidth(false));

        GUILayout.Label("@By James Zhan 2015.5.13 如未编辑发包参数,请点击以下按钮设置。设置完后即可发包", style1);
        if (!building)
        {
            if (GUILayout.Button("编辑发布参数"))
            {
                AssetDatabase.OpenAsset(platformDatas.GetInstanceID());
            }

            openBat1 = GUILayout.Toggle(openBat1, "是否WIFI运行(需要先连接到服务器)");
            if (openBat1 != openBat)
            {
                openBat = openBat1;
                PlayerPrefs.SetInt("RUN_BAT", openBat1 ? 1 : 0);
                PlayerPrefs.Save();
            }


            float btnWidth = 150;
            float max      = Mathf.Floor(width / btnWidth);
            int   i        = 0;
            for (i = 0; i < platformDatas.平台列表.Length; i++)
            {
                if (i == 0 || (i % max) == 0)
                {
                    GUILayout.BeginHorizontal();
                }

                PerPlatform p = platformDatas.平台列表[i];
                if (GUILayout.Button(platformDatas.平台列表[i].艺名, GUILayout.Width(btnWidth), GUILayout.Height(30)))
                {
                    if (platformDatas.平台列表[i].ManifestXml == null || platformDatas.平台列表[i].ManifestXml.ToString() == "")
                    {
                        AssetDatabase.OpenAsset(platformDatas.GetInstanceID());
                    }
                    else
                    {
                        cur      = p;
                        building = true;
                        EditorApplication.delayCall += DoCurrentCreate;
                        window.ShowNotification(new GUIContent("请骚等,正在生成...."));
                    }
                }

                if (platformDatas.平台列表[i].ManifestXml == null || platformDatas.平台列表[i].ManifestXml.ToString() == "")
                {
                    GUILayout.EndHorizontal();
                    EditorGUILayout.HelpBox("Hi, SX, you cant publish " + platformDatas.平台列表[i].艺名 + " if you dont assign a MANIFEST xml =.=!!!", MessageType.Error);
                    GUILayout.BeginHorizontal();
                }

                if ((i % max) + 1 == max)
                {
                    GUILayout.EndHorizontal();
                }
            }
            if ((i % max) != 0)
            {
                GUILayout.EndHorizontal();
            }

            if (sexyTexture != null)
            {
                GUILayout.Label(sexyShow.nowState + "," + "还有" + sexyShow.GetCount() + "张图片....");

                if (GUILayout.Button(sexyTexture))
                {
                    sexyShow.GetSexy();
                }
            }
            else
            {
                GUILayout.Label(sexyShow.nowState);
            }
        }
        else
        {
            GUILayout.Label("生成中,喝杯茶/咖啡?", style1);
            GUILayout.Space(10);
            if (GUILayout.Button("返回", GUILayout.Height(80)))
            {
                building = false;
            }
        }
        GUILayout.Space(10);
        GUILayout.EndScrollView();
    }