Пример #1
0
    private void OnGUI()
    {
        #region  场景设置

        GUILayout.Space(10);
        GUILayout.BeginVertical();
        GUILayout.Label("设置打包场景:", "capsulebutton");
        GUILayout.Space(10);

        int enableIndex = 0;
        for (int i = 0; i < scenes.Length; i++)
        {
            int curIndex = i; //保存当前索引

            GUILayout.BeginHorizontal();
            scenes[i].enabled = GUILayout.Toggle(scenes[i].enabled, "");
            GUILayout.Label(scenes[i].path, (GUIStyle)"sv_label_2");
            GUILayout.FlexibleSpace();
            if (scenes[i].enabled)
            {
                if (GUILayout.Button("", (GUIStyle)"Grad Up Swatch"))
                {
                    SwitchBuildSceneOrder(curIndex, curIndex - 1);
                }
                //scene id
                GUILayout.Label(enableIndex.ToString());
                enableIndex++;

                if (GUILayout.Button("", (GUIStyle)"Grad Down Swatch"))
                {
                    SwitchBuildSceneOrder(curIndex, curIndex + 1);
                }
            }
            GUILayout.EndHorizontal();
        }

        //GUILayout.Space(10);
        //GUILayout.Label("", "capsulebutton");
        GUILayout.EndVertical();

        #endregion

        #region 版本号设置

        VersionObj version = BuildTool.GetVersionObj();
        GUILayout.Space(10);
        GUILayout.BeginVertical();
        GUILayout.Label("版本号设置:", "capsulebutton");
        GUILayout.Space(10);

        version.Open_Version = GUILayout.Toggle(version.Open_Version, "开启版本号控制:");

        if (version.Open_Version)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("主版本号", (GUIStyle)"ChannelStripAttenuationBar");
            GUILayout.FlexibleSpace();
            version.Main_Version_Number = GUILayout.TextField(version.Main_Version_Number);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("资源版本号", (GUIStyle)"ChannelStripAttenuationBar");
            GUILayout.FlexibleSpace();
            version.Asset_Version_Number = GUILayout.TextField(version.Asset_Version_Number);
            GUILayout.EndHorizontal();
        }

        GUILayout.Space(10);
        GUILayout.Label("", "capsulebutton");
        GUILayout.EndVertical();
        #endregion

        GUILayout.Space(10);

        if (GUILayout.Button("打包项目"))
        {
            SaveBuildScenes();
            BuildTool.BuildPackage();
            this.Close();
        }
        if (GUILayout.Button("关闭窗口"))
        {
            this.Close();
        }
    }