少年修仙传客户端基础资源
dabaoji
2025-06-09 8ee0256378cbf5dbc9d76ed10b60b65a844ef4dd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using UnityEditor;
 
public class ClientPackageExtension
{
 
    public static void BuildApk()
    {
        var parameters = new BuildParameters();
 
        if (!parameters.error)
        {
            try
            {
                ClientPackage.AssetPrior = 1;
                ClientPackage.BuildPublishers(parameters.sdkPath, parameters.assetbundlePath, parameters.outputPath, parameters.publishers, parameters.buildIndex, false, false);
            }
            catch (Exception ex)
            {
                Debug.Log("打包apk失败");
                Debug.Log(ex);
                EditorApplication.Exit(1);
            }
        }
        else
        {
            EditorApplication.Exit(1);
        }
 
    }
 
    public static void BuildEXE()
    {
        var parameters = new BuildParameters();
        if (!parameters.error)
        {
            try
            {
                ClientPackage_Standalone.AssetPrior = 1;
                ClientPackage_Standalone.Build(new ClientPackage_Standalone.BuildParams()
                {
                    assetBundle = parameters.assetbundlePath,
                    output = parameters.outputPath,
                    buildIndex = parameters.buildIndex,
                    development = false,
                    publisher = parameters.publishers,
                });
            }
            catch (Exception ex)
            {
                Debug.Log("打包EXE失败");
                Debug.Log(ex);
                EditorApplication.Exit(1);
            }
        }
        else
        {
            EditorApplication.Exit(1);
        }
    }
 
    class BuildParameters
    {
        public bool error = false;
        public string assetbundlePath;
        public string outputPath;
        public string publishers;
        public int buildIndex;
        public string sdkPath;
 
        public BuildParameters()
        {
            try
            {
                var args = Environment.GetCommandLineArgs();
                for (int i = 0; i < args.Length; i++)
                {
                    var arg = args[i];
                    if (arg.ToLower() == "-outputpath")
                    {
                        outputPath = args[i + 1];
                    }
                    else if (arg.ToLower() == "-assetbundlepath")
                    {
                        assetbundlePath = args[i + 1];
                    }
                    else if (arg.ToLower() == "-publishers")
                    {
                        publishers = args[i + 1];
                    }
                    else if (arg.ToLower() == "-buildindex")
                    {
                        int.TryParse(args[i + 1], out buildIndex);
                    }
                    else if (arg.ToLower() == "-sdkpath")
                    {
                        sdkPath = args[i + 1];
                    }
                }
 
                error = false;
            }
            catch (Exception ex)
            {
                error = true;
                Debug.LogException(ex);
                EditorApplication.Exit(1);
            }
        }
    }
 
}