コード例 #1
0
        /// <summary>
        /// 创建资源版本
        /// </summary>
        /// <param name="remoteVers"></param>
        private void BuildVersionConfig(ref ResDataVersion remoteVers)
        {
            string         versions       = default;
            ResDataVersion resDataVersion = default;

            GetVersionDataFromRemote(ref remoteVers, ref versions, ref resDataVersion);

            string[] abNamesValue = ABNamesWillBuild != default ? ABNamesWillBuild.ToArray() : new string[0];
            resDataVersion.CreateNewResVersion(ref resRemoteGateWay, isUpdateVersion, isUpdateResVersion, isSyncAppVersion, ref remoteVers, ref abNamesValue);
            resDataVersion.Refresh();

            bool applyClientGateway = false;

            if (isSyncClientVersions)
            {
                List <ScriptableObject> list = default;
                ShipDockEditorUtils.FindAssetInEditorProject(ref list, "t:ScriptableObject", @"Assets\Prefabs");
                ClientResVersion clientRes = default;// = (ClientResVersion)list[0];
                foreach (ScriptableObject i in list)
                {
                    if (i.name == ClientVersionFileName)
                    {
                        clientRes = (ClientResVersion)i;
                        break;
                    }
                    else
                    {
                    }
                }

                applyClientGateway = clientRes.ApplyCurrentResGateway;
                if (applyClientGateway)
                {
                    resDataVersion.res_gateway = clientRes.ClientResVersionGateway();
                }

                clientRes.Versions.CloneVersionsFrom(ref resDataVersion);
                clientRes.SetChanges(resDataVersion.ResChanges);
                UnityEditor.EditorUtility.SetDirty(clientRes);
            }
            versions = JsonUtility.ToJson(resDataVersion);
            string stamp = "_".Append(System.DateTime.Now.ToShortDateString().Replace("/", "_"));

            FileOperater.WriteUTF8Text(versions, Application.dataPath.Append("/Prefabs/ClientResVersions_Previews/", ResDataVersion.FILE_RES_DATA_VERSIONS_NAME, stamp, ".json")); //仅用于查看
            FileOperater.WriteBytes(versions, AppPaths.ABBuildOutputRoot.Append(ResDataVersion.FILE_RES_DATA_VERSIONS_NAME));                                                      //位于资源主目录里的正式文件

            resDataVersion.Clean();
            remoteVers?.Clean();
        }
コード例 #2
0
        public static void CreateApplication()
        {
            string name = "UIRoot";

            if (GameObject.Find(name) == default)
            {
                List <GameObject> result = new List <GameObject>();
                ShipDockEditorUtils.FindAssetInEditorProject(ref result, "UIRoot t:GameObject", @"Assets\Scripts\ShipDock\Applications\Prefabs");

                GameObject UIRoot = Instantiate(result[0]);
                UIRoot.name = name;
                Canvas canvas = UIRoot.GetComponentInChildren <Canvas>();

                CanvasScaler     canvasScaler     = UIRoot.GetComponentInChildren <CanvasScaler>();
                GraphicRaycaster graphicRaycaster = UIRoot.GetComponentInChildren <GraphicRaycaster>();

                GameObject            target      = GameObject.Find("UIRoot/EventSystem");
                EventSystem           eventSystem = target.GetComponent <EventSystem>();
                StandaloneInputModule inputModule = target.GetComponent <StandaloneInputModule>();

                if (canvasScaler == default)
                {
                    canvas.gameObject.AddComponent <CanvasScaler>();
                }
                else
                {
                }

                if (graphicRaycaster == default)
                {
                    canvas.gameObject.AddComponent <GraphicRaycaster>();
                }
                else
                {
                }

                if (eventSystem == default)
                {
                    target.AddComponent <EventSystem>();
                }
                else
                {
                }

                if (inputModule == default)
                {
                    target.AddComponent <StandaloneInputModule>();
                }
                else
                {
                }
            }
            else
            {
            }

            string    gameSceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
            Transform p             = ShipDockEditorUtils.CreateGameObjectWithComponent <ShipDockGame>(gameSceneName);

            ShipDockEditorUtils.CreateGameObjectWithComponent <AssetsPoolingComponent>("AssetPool", p);
            ShipDockEditorUtils.CreateGameObjectWithComponent <CustomAssetCoordinator>("CustomAsset", p);
            ShipDockEditorUtils.CreateGameObjectWithComponent <TesterComponent>("TesterAsserter", p);
        }