private void Btn_Refresh_Click(object sender, MouseButtonEventArgs e)
        {
            var noinfo = CompileCode(EngineNS.EPlatformType.PLATFORM_WIN, true);

            CurrentParticleResourceInfo.NeedRefresh = true;
            var test = CurrentResourceInfo.Save();
        }
Exemplo n.º 2
0
        async Task Save()
        {
            await CurrentResourceInfo.Save();

            if (CommonVisible == Visibility.Visible)
            {
                Macross_Common.Save();
            }
            if (ClientVisible == Visibility.Visible)
            {
                Macross_Client.Save();
            }
            if (ServerVisible == Visibility.Visible)
            {
                Macross_Server.Save();
            }

            CurrentResourceInfo.CustomFunctions_Client.Clear();
            Macross_Client.CollectFuncDatas(CurrentResourceInfo.CustomFunctions_Client);
            CurrentResourceInfo.CustomFunctions_Server.Clear();
            Macross_Server.CollectFuncDatas(CurrentResourceInfo.CustomFunctions_Server);
            await CurrentResourceInfo.Save();

            await CompileCode(EngineNS.EPlatformType.PLATFORM_DROID);
            await CompileCode(EngineNS.EPlatformType.PLATFORM_WIN);
        }
Exemplo n.º 3
0
        private void Btn_ClassSetting_Click(object sender, RoutedEventArgs e)
        {
            if (CurrentResourceInfo.BaseType == null)
            {
                EditorCommon.MessageBox.Show("找不到当前Macross的基类");
                return;
            }

            if (mClassSettingPropertiesClassInstance == null)
            {
                var atts   = CurrentResourceInfo.BaseType.GetCustomAttributes(typeof(EngineNS.Editor.Editor_MacrossClassAttribute), true);
                var att    = atts[0] as EngineNS.Editor.Editor_MacrossClassAttribute;
                var csType = att.CSType;
                List <CodeGenerateSystem.Base.CustomPropertyInfo> cpInfos = new List <CodeGenerateSystem.Base.CustomPropertyInfo>();

                var baseTypeCPInfo = new CodeGenerateSystem.Base.CustomPropertyInfo()
                {
                    PropertyName = "BaseType",
                    PropertyType = typeof(Type),
                    DefaultValue = CurrentResourceInfo.BaseType,
                    CurrentValue = CurrentResourceInfo.BaseType,
                };
                // Editor.Editor_BaseTypeDefine 限定类型基类
                baseTypeCPInfo.PropertyAttributes.Add(new EngineNS.Editor.Editor_TypeFilterAttribute(EngineNS.Editor.Editor_TypeFilterAttribute.enTypeFilter.Class, EngineNS.Editor.Editor_MacrossClassAttribute.enMacrossType.Inheritable));

                cpInfos.Add(baseTypeCPInfo);

                var initParam = new CodeGenerateSystem.Base.ConstructionParams()
                {
                    CSType = csType,
                };
                var tempNode = new TempNode(initParam);
                mClassSettingPropertiesClassInstance = CodeGenerateSystem.Base.PropertyClassGenerator.CreateClassInstanceFromCustomPropertys(cpInfos, tempNode, "MCSetting_" + EngineNS.Editor.Assist.GetValuedGUIDString(Guid.NewGuid()), false);
                var classType = mClassSettingPropertiesClassInstance.GetType();
                //var classType = CodeGenerateSystem.Base.PropertyClassGenerator.CreateTypeFromCustomPropertys(cpInfos, "MacrossClassSettingDynamicAssembly", );
                //mClassSettingPropertiesClassInstance = System.Activator.CreateInstance(classType) as CodeGenerateSystem.Base.GeneratorClassBase;
                //mClassSettingPropertiesClassInstance.CSType = csType;
                foreach (var cpInfo in cpInfos)
                {
                    var pro = classType.GetProperty(cpInfo.PropertyName);
                    pro.SetValue(mClassSettingPropertiesClassInstance, cpInfo.CurrentValue, null);
                }

                mClassSettingPropertiesClassInstance.OnPropertyChangedAction = (propertyName, newValue, oldValue) =>
                {
                    switch (propertyName)
                    {
                    case "BaseType":
                        CurrentResourceInfo.ResetBaseType((Type)newValue);
                        break;
                    }
                };
            }

            var ctrl = LinksTabControl.SelectedContent as MacrossLinkControl;

            ctrl.PG.Instance = mClassSettingPropertiesClassInstance;
        }
Exemplo n.º 4
0
        async Task Save()
        {
            CurrentResourceInfo.ReferenceRNameList.Clear();
            if (ClientVisible == Visibility.Visible)
            {
                Macross_Client.Save();
            }
            if (ServerVisible == Visibility.Visible)
            {
                Macross_Server.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();
            Macross_Client.CollectFuncDatas(CurrentResourceInfo.CustomFunctions_Client);
            CurrentResourceInfo.CustomFunctions_Server.Clear();
            Macross_Server.CollectFuncDatas(CurrentResourceInfo.CustomFunctions_Server);
            //await CurrentResourceInfo.Save();

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

            List <RName> rnames = new List <RName>();

            if (ClientVisible == Visibility.Visible)
            {
                await mCodeGenerator.CollectMacrossResource(Macross_Client, rnames);
            }
            if (ServerVisible == Visibility.Visible)
            {
                await mCodeGenerator.CollectMacrossResource(Macross_Server, rnames);
            }

            CurrentResourceInfo.ReferenceRNameList.AddRange(rnames);
            await CurrentResourceInfo.Save();
        }
        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;
        }