コード例 #1
0
        async Task CompileCode(EngineNS.EPlatformType platform, bool usecache = false)
        {
            if (!Particle_Client.CheckError())
            {
                return;
            }

            CurrentResourceInfo.Version++;

            List <Macross.ResourceInfos.MacrossResourceInfo.CustomFunctionData> functions = new List <Macross.ResourceInfos.MacrossResourceInfo.CustomFunctionData>();

            Particle_Client.CollectFuncDatas(functions);

            //if (CheckCompileResult(await CompileCode(Macross_Client, platform, functions), platform) == false)
            //    return;
            //if (CheckCompileResult(await CompileMacrossCollector(Macross_Client, platform), platform) == false)
            //    return;
            if (await CompileCode(Particle_Client, ECSType.Client, usecache))
            {
                CompileStatusIcon = TryFindResource("Good") as ImageSource;
            }
            else
            {
                CompileStatusIcon = TryFindResource("Fail") as ImageSource;
                EditorCommon.MessageBox.Show($"{platform}平台MacrossScript编译失败!详细信息请编译游戏工程!\r\n");
                return;
            }

            if (platform == EngineNS.EPlatformType.PLATFORM_WIN)
            {
                //var scriptDllName = EngineNS.CEngine.Instance.FileManager.Bin + "MacrossScript.dll";
                //EngineNS.CEngine.Instance.MacrossDataManager.RefreshMacrossCollector();
                //var assembly = EngineNS.CEngine.Instance.MacrossDataManager.MacrossScripAssembly;//EngineNS.Rtti.RttiHelper.GetAssemblyFromDllFileName(EngineNS.CIPlatform.Instance.CSType, scriptDllName, "", true, true);
                //var clsTypeFullName = Macross.Program.GetClassNamespace(CurrentResourceInfo, ECSType.Client) + "." + Macross.Program.GetClassName(CurrentResourceInfo, ECSType.Client);
                //var clsType = assembly.GetType(clsTypeFullName);
                //var clsIdPro = clsType.GetProperty("ClassId");
                //var classId = (EngineNS.Hash64)clsIdPro.GetValue(null);
                //EngineNS.CEngine.Instance.MacrossDataManager.RefreshMacrossData(ref classId, clsType);
                EngineNS.Macross.MacrossFactory.SetVersion(CurrentResourceInfo.ResourceName, CurrentResourceInfo.Version);
            }

            Particle_Client.PG.Instance = null;

            string pfxcs = CurrentResourceInfo.AbsInfoFileName.Replace(".rinfo", "");

            EngineNS.RName pfxname = EngineNS.RName.GetRName(pfxcs.Replace(CEngine.Instance.FileManager.ProjectContent, ""));
            await Particle_Client.AddPfxMacross(pfxname);
        }
コード例 #2
0
        async Task Save()
        {
            //CurrentResourceInfo.ReferenceRNameList.Clear();
            //Particle_Client.Save();

            //CurrentResourceInfo.CustomFunctions_Client.Clear();
            //Particle_Client.CollectFuncDatas(CurrentResourceInfo.CustomFunctions_Client);

            ////await CompileCode(EngineNS.EPlatformType.PLATFORM_DROID);
            //await CompileCode(EngineNS.EPlatformType.PLATFORM_WIN);

            //List<RName> rnames = new List<RName>();
            //await mCodeGenerator.GenerateMacrossResource(Particle_Client, rnames);


            //foreach (var rname in rnames)
            //{
            //    CurrentResourceInfo.ReferenceRNameList.Add(rname);
            //}
            //await CurrentResourceInfo.Save();



            CurrentResourceInfo.ReferenceRNameList.Clear();
            Particle_Client.Save();

            var className     = Program.GetClassName(CurrentResourceInfo, ECSType.Client);
            var classFullName = Program.GetClassNamespace(CurrentResourceInfo, ECSType.Client) + "." + className;

            WPG.Data.PropertyCollection.RemoveCache(EngineNS.CEngine.Instance.MacrossDataManager.MacrossScripAssembly.GetType(classFullName));

            CurrentResourceInfo.CustomFunctions_Client.Clear();
            Particle_Client.CollectFuncDatas(CurrentResourceInfo.CustomFunctions_Client);

            //await CompileCode(EngineNS.EPlatformType.PLATFORM_DROID);
            await CompileCode(EngineNS.EPlatformType.PLATFORM_WIN);

            List <RName> rnames = new List <RName>();
            await mCodeGenerator.CollectMacrossResource(Particle_Client, rnames);

            foreach (var rname in rnames)
            {
                CurrentResourceInfo.ReferenceRNameList.Add(rname);
            }

            await CurrentResourceInfo.Save();

            var IsShowFloor  = Particle_Client.SceneControl.IsShowFloor;
            var IsShowSkyBox = Particle_Client.SceneControl.IsShowSkyBox;

            Particle_Client.SceneControl.IsShowFloor  = false;
            Particle_Client.SceneControl.IsShowSkyBox = false;

            var snapShotFile = CurrentResourceInfo.ResourceName.Address + EditorCommon.Program.SnapshotExt;
            var data         = new EngineNS.Support.CBlobObject[1];

            data[0] = new EngineNS.Support.CBlobObject();
            var rc = EngineNS.CEngine.Instance.RenderContext;

            Particle_Client.SceneControl.ViewPort.RPolicy.mCopyPostprocessPass.mScreenView.FrameBuffer.GetSRV_RenderTarget(0).Save2Memory(rc, data[0], EngineNS.EIMAGE_FILE_FORMAT.PNG);
            EngineNS.CShaderResourceView.SaveSnap(snapShotFile, data);

            Particle_Client.SceneControl.IsShowFloor  = IsShowFloor;
            Particle_Client.SceneControl.IsShowSkyBox = IsShowSkyBox;
        }