internal void a(TextBlock textBlock) { if (this.aAu != null) { textBlock.SetAttribute("methodParameter", this.aAu.UIN.ToString()); } if (this.aAV != null) { textBlock.SetAttribute("declareAction", this.aAV.UIN.ToString()); } if (this.aAv != null) { textBlock.SetAttribute("type", this.aAv.FullName); } if (this.aAW != null) { textBlock.SetAttribute("name", this.aAW); } if (this.aAw != null) { string saveValueString = EntityHelper.ConvertToString(this.aAv, this.aAw, null); if (saveValueString != null) { textBlock.SetAttribute("value", saveValueString); } } }
private void SaveCustomSerializationValues(TextBlock textBlock) { if (customSerializationValues.Count == 0) { return; } TextBlock customValuesBlock = textBlock.AddChild("customSerializationValues"); foreach (KeyValuePair <string, object> current in customSerializationValues) { string key = current.Key; object value = current.Value; if (value == null) { continue; } Type type = value.GetType(); string errorString = string.Format("World: Custom serialization value \"{0}\"", key); string saveValueString = EntityHelper.ConvertToString(type, value, errorString); TextBlock customValueBlock = customValuesBlock.AddChild(key); customValueBlock.SetAttribute("type", type.FullName); customValueBlock.SetAttribute("value", saveValueString); } ClearAllCustomSerializationValues(); }
internal void OnSave(TextBlock block) { if (block == null) { return; } block.SetAttribute("name", this.Name); if (!Visible) { block.SetAttribute("visible", Visible.ToString()); } if (!AllowSelect) { block.SetAttribute("allowSelect", AllowSelect.ToString()); } if (!AllowEdit) { block.SetAttribute("allowEdit", AllowEdit.ToString()); } foreach (EditorLayer child in children) { TextBlock childBlock = block.AddChild("layer"); child.OnSave(childBlock); } }
internal void OnSave(TextBlock textBlock) { if (this.waitintThreads.Count != 0) { TextBlock textBlock2 = textBlock.AddChild("waitItems"); foreach (WaitingThreadItem current in this.waitintThreads) { TextBlock textBlock3 = textBlock2.AddChild("item"); if (!string.IsNullOrEmpty(current.ThreadName)) { textBlock3.SetAttribute("threadName", current.ThreadName); } textBlock3.SetAttribute("remainingTime", current.RemainingTime.ToString()); if (current.currentExecutingMethodInformations != null) { TextBlock textBlock4 = textBlock3.AddChild("executeMethodInformations"); foreach (LogicExecuteMethodInformation current2 in current.currentExecutingMethodInformations) { TextBlock textBlock5 = textBlock4.AddChild("item"); current2.a(textBlock5); } } } } }
protected virtual void OnSave(TextBlock block) { if (taskPosition != Vec3.Zero) { block.SetAttribute("taskPosition", taskPosition.ToString()); } if (taskEntity != null) { block.SetAttribute("taskEntity", taskEntity.UIN.ToString()); } }
protected override void OnSave(TextBlock block) { base.OnSave(block); if (waveOnlyInVerticalPosition) { block.SetAttribute("waveOnlyInVerticalPosition", waveOnlyInVerticalPosition.ToString()); } if (receiveObjectsPositionsFromVertices) { block.SetAttribute("receiveObjectsPositionsFromVertices", receiveObjectsPositionsFromVertices.ToString()); } }
private void btnAddWeapon_Click(Button sender) { if (cbxWeaponSlots.SelectedItem == null || lstWeaponList.SelectedItem == null) { return; } AKunit u = spawner.Spawned as AKunit; AKunitType.WeaponItem wi = cbxWeaponSlots.SelectedItem as AKunitType.WeaponItem; AKunitType.AlternateWeaponItem awi = lstWeaponList.SelectedItem as AKunitType.AlternateWeaponItem; string selectedBodyPartName = GetBodyPartNameFromActiveButton(); int selectedBodyPartIndex = GetBodyPartIndex(selectedBodyPartName); int weaponFireGroup = u.Bp[selectedBodyPartIndex].Weapons[cbxWeaponSlots.SelectedIndex].FireGroup; u.Bp[selectedBodyPartIndex].Weapons[cbxWeaponSlots.SelectedIndex].Ammo = awi.Ammo; u.Bp[selectedBodyPartIndex].Weapons[cbxWeaponSlots.SelectedIndex].MagazineCapacity = awi.MagazineCapacity; u.Bp[selectedBodyPartIndex].Weapons[cbxWeaponSlots.SelectedIndex].WeaponType = awi.WeaponType; TextBlock bodyPartBlock = variant.FindChild(selectedBodyPartName); if (bodyPartBlock == null) { bodyPartBlock = variant.AddChild(selectedBodyPartName); } if (bodyPartBlock != null) { TextBlock wBlock = bodyPartBlock.FindChild(wi.MapObjectAlias); if (wBlock == null) { wBlock = bodyPartBlock.AddChild(wi.MapObjectAlias); } if (wBlock != null) { wBlock.SetAttribute("i", lstWeaponList.SelectedIndex.ToString()); wBlock.SetAttribute("g", weaponFireGroup.ToString()); } } UpdateVariantCost(awi.Price); PopulateWeaponSlotsDropDown(selectedBodyPartName); }
public bool SaveTypeToFile(EntityType type) { TextBlock textBlock = new TextBlock(); TextBlock typeBlock = textBlock.AddChild("type", type.Name); typeBlock.SetAttribute("class", type.ClassInfo.EntityClassType.Name); if (!type.Save(typeBlock)) { return(false); } if (!type._OnSave(typeBlock)) { return(false); } try { using (FileStream fileStream = new FileStream(VirtualFileSystem.GetRealPathByVirtual(type.FilePath), FileMode.Create)) { using (StreamWriter streamWriter = new StreamWriter(fileStream)) { streamWriter.Write(textBlock.DumpToString()); } } } catch (Exception ex) { Log.Warning("Save type to file failed: {0}", ex.ToString()); return(false); } return(true); }
void comboBoxAntialiasing_SelectedIndexChange(ComboBox sender) { //update Engine.config TextBlock engineConfigBlock = LoadEngineConfig(); if (engineConfigBlock == null) { engineConfigBlock = new TextBlock(); } TextBlock rendererBlock = engineConfigBlock.FindChild("Renderer"); if (rendererBlock == null) { rendererBlock = engineConfigBlock.AddChild("Renderer"); } if (comboBoxAntialiasing.SelectedIndex != -1) { ComboBoxItem item = (ComboBoxItem)comboBoxAntialiasing.SelectedItem; rendererBlock.SetAttribute("fullSceneAntialiasing", item.Identifier); } else { rendererBlock.DeleteAttribute("fullSceneAntialiasing"); } SaveEngineConfig(engineConfigBlock); EnableVideoRestartButton(); }
protected override void OnSave(TextBlock block) { base.OnSave(block); if (!string.IsNullOrEmpty(diffuseMap)) block.SetAttribute("diffuseMap", diffuseMap); }
void comboBoxTextureSkipMipLevels_SelectedIndexChange(ComboBox sender) { int levels = sender.SelectedIndex; if (sender.SelectedIndex < 0) { levels = 0; } //update Engine.config TextBlock engineConfigBlock = LoadEngineConfig(); if (engineConfigBlock == null) { engineConfigBlock = new TextBlock(); } TextBlock rendererBlock = engineConfigBlock.FindChild("Renderer"); if (rendererBlock == null) { rendererBlock = engineConfigBlock.AddChild("Renderer"); } rendererBlock.SetAttribute("textureSkipMipLevels", levels.ToString()); SaveEngineConfig(engineConfigBlock); EnableVideoRestartButton(); RendererWorld.InitializationOptions.TextureSkipMipLevels = levels; }
protected override void OnSave(TextBlock block) { base.OnSave(block); if (currentFireMode != null) { if (currentFireMode == normalMode) { block.SetAttribute("currentFireMode", "normal"); } else { block.SetAttribute("currentFireMode", "alternative"); } } }
/// <summary> /// Called when the type during saving. /// </summary> /// <param name="block">The text block in which data of type will be saved.</param> /// <returns><b>true</b> if the data are correct; otherwise, <b>false</b>.</returns> protected virtual bool OnSave(TextBlock block) { if (this.entityNetworkType > EntityNetworkTypes.NotSynchronized) { block.SetAttribute("networkType", this.entityNetworkType.ToString()); } return(true); }
protected override void OnSave(TextBlock block) { base.OnSave(block); if (Dimensions != new Vec3(1, 1, 1)) { block.SetAttribute("dimensions", Dimensions.ToString()); } }
protected override void OnSave(TextBlock block) { base.OnSave(block); if (this.aBX != null) { block.SetAttribute("value", this.aBX.ToString()); } }
protected override void OnSave(TextBlock block) { base.OnSave(block); if (receiveObjectsPositionsFromVertices) { block.SetAttribute("receiveObjectsPositionsFromVertices", receiveObjectsPositionsFromVertices.ToString()); } if (windEffectFactor != 1) { block.SetAttribute("windEffectFactor", windEffectFactor.ToString()); } if (bendScale != 0.02f) { block.SetAttribute("bendScale", bendScale.ToString()); } if (bendVariation != 0.01f) { block.SetAttribute("bendVariation", bendVariation.ToString()); } if (bendFrequency != 1) { block.SetAttribute("bendFrequency", bendFrequency.ToString()); } block.SetAttribute("detailBending", detailBending.ToString()); if (branchAmplitude != 0.01f) { block.SetAttribute("branchAmplitude", branchAmplitude.ToString()); } if (leafAmplitude != 0.01f) { block.SetAttribute("leafAmplitude", leafAmplitude.ToString()); } if (branchFrequency != 1) { block.SetAttribute("branchFrequency", branchFrequency.ToString()); } if (leafFrequency != 1) { block.SetAttribute("leafFrequency", leafFrequency.ToString()); } }
protected override void OnSave(TextBlock block) { if (EditorLayer != null) { block.SetAttribute("editorLayer", EditorLayer.Path); } base.OnSave(block); }
protected override void OnSave(TextBlock block) { base.OnSave(block); if (!string.IsNullOrEmpty(diffuseMap)) { block.SetAttribute("diffuseMap", diffuseMap); } }
protected override void OnNewResource(string directory) { base.OnNewResource(directory); EntityTypeNewResourceDialog cd = new EntityTypeNewResourceDialog(directory); if (cd.ShowDialog(MainForm.Instance) != DialogResult.OK) { return; } string text = ""; if (directory != "") { text = text + directory + "\\"; } text = text + cd.TypeName + ".type"; TextBlock textBlock = new TextBlock(); TextBlock typeBlock = textBlock.AddChild("type", cd.TypeName); typeBlock.SetAttribute("class", cd.TypeClass.EntityClassType.Name); try { using (Stream stream = new FileStream(VirtualFileSystem.GetRealPathByVirtual(text), FileMode.Create)) { using (StreamWriter streamWriter = new StreamWriter(stream)) { streamWriter.Write(textBlock.DumpToString()); } } } catch (Exception ex) { Log.Warning(ex.Message); return; } if (EntityTypes.Instance.LoadTypeFromFile(text) != null) { MainForm.Instance.ResourcesForm.UpdateAddResource(text); MainForm.Instance.ResourcesForm.SelectNodeByPath(text); return; } Log.Fatal("OnNewResource: EntityTypes.Instance.LoadType: Internal error."); }
void checkBoxVerticalSync_CheckedChange(CheckBox sender) { //update Engine.config TextBlock engineConfigBlock = LoadEngineConfig(); if (engineConfigBlock == null) { engineConfigBlock = new TextBlock(); } TextBlock rendererBlock = engineConfigBlock.FindChild("Renderer"); if (rendererBlock == null) { rendererBlock = engineConfigBlock.AddChild("Renderer"); } rendererBlock.SetAttribute("verticalSync", sender.Checked.ToString()); SaveEngineConfig(engineConfigBlock); EnableVideoRestartButton(); }
void checkBoxDepthBufferAccess_CheckedChange(CheckBox sender) { //update Engine.config TextBlock engineConfigBlock = LoadEngineConfig(); if (engineConfigBlock == null) { engineConfigBlock = new TextBlock(); } TextBlock rendererBlock = engineConfigBlock.FindChild("Renderer"); if (rendererBlock == null) { rendererBlock = engineConfigBlock.AddChild("Renderer"); } rendererBlock.SetAttribute("depthBufferAccess", sender.Checked.ToString()); SaveEngineConfig(engineConfigBlock); EnableVideoRestartButton(); UpdateComboBoxAntialiasing(); }
protected override void OnSave(TextBlock block) { base.OnSave(block); if (!(currentTask is IdleTask)) { TextBlock taskBlock = block.AddChild("currentTask"); taskBlock.SetAttribute("class", GetTaskClassName(currentTask)); currentTask._Save(taskBlock); } if (tasks.Count != 0) { TextBlock tasksBlock = block.AddChild("tasks"); foreach (Task task in tasks) { TextBlock taskBlock = tasksBlock.AddChild("item"); taskBlock.SetAttribute("class", GetTaskClassName(task)); task._Save(taskBlock); } } }
void comboBoxFiltering_SelectedIndexChange(ComboBox sender) { //update Engine.config TextBlock engineConfigBlock = LoadEngineConfig(); if (engineConfigBlock == null) { engineConfigBlock = new TextBlock(); } TextBlock rendererBlock = engineConfigBlock.FindChild("Renderer"); if (rendererBlock == null) { rendererBlock = engineConfigBlock.AddChild("Renderer"); } ComboBoxItem item = (ComboBoxItem)sender.SelectedItem; rendererBlock.SetAttribute("filtering", item.Identifier); SaveEngineConfig(engineConfigBlock); EnableVideoRestartButton(); }
void comboBoxLanguage_SelectedIndexChange(ComboBox sender) { //update Engine.config TextBlock engineConfigBlock = LoadEngineConfig(); if (engineConfigBlock == null) { engineConfigBlock = new TextBlock(); } TextBlock localizationBlock = engineConfigBlock.FindChild("Localization"); if (localizationBlock == null) { localizationBlock = engineConfigBlock.AddChild("Localization"); } ComboBoxItem item = (ComboBoxItem)sender.SelectedItem; localizationBlock.SetAttribute("language", item.Identifier); SaveEngineConfig(engineConfigBlock); EnableLanguageRestartButton(); }
public static void Save() { if (!ToolsLocalization.IsInitialized) { return; } string realPathByVirtual = VirtualFileSystem.GetRealPathByVirtual(ToolsLocalization.EL); TextBlock textBlock = new TextBlock(); TextBlock textBlock2 = textBlock.AddChild("groups"); foreach (ToolsLocalization.GroupItem current in ToolsLocalization.EM.Values) { TextBlock textBlock3 = textBlock2.AddChild("group", current.eM); foreach (KeyValuePair <string, string> current2 in current.em) { textBlock3.SetAttribute(current2.Key, current2.Value); } } using (StreamWriter streamWriter = new StreamWriter(realPathByVirtual)) { streamWriter.Write(textBlock.DumpToString()); } }
internal void a(TextBlock textBlock) { if (this.aAO != null) { textBlock.SetAttribute("method", this.aAO.UIN.ToString()); } if (this.aAo != null) { textBlock.SetAttribute("logicClassType", this.aAo.FullName); } if (this.aAp != null) { textBlock.SetAttribute("logicEntityObjectOwnerEntity", this.aAp.OwnerEntity().UIN.ToString()); } textBlock.SetAttribute("needReturn", this.aAQ.ToString()); textBlock.SetAttribute("needReturnForWait", this.aAq.ToString()); if (this.aAR.Count != 0) { TextBlock textBlock2 = textBlock.AddChild("localVariablesBlock"); foreach (LogicLocalVariable current in this.aAR.Values) { TextBlock textBlock3 = textBlock2.AddChild("item"); current.a(textBlock3); } } textBlock.SetAttribute("currentClassActionsLevelIndex", this.aAr.ToString()); if (this.aAS.Count != 0) { string text = ""; foreach (int current2 in this.aAS) { if (text != "") { text += " "; } text += current2.ToString(); } textBlock.SetAttribute("callActionsLevelIndexes", text); } }
private void btnSaveVariant_Click(Button sender) { if (string.IsNullOrEmpty(txtVariantName.Text)) { txtInfo.Text = "Variant name needed."; return; } //check if the file exists foreach (object item in lstWeaponList.Items) { VariantWeaponGroupItem vwgi = item as VariantWeaponGroupItem; TextBlock bodyPartBlock = variant.FindChild(vwgi.BodyPartName); TextBlock weaponBlock = bodyPartBlock.FindChild(vwgi.WeaponName); weaponBlock.SetAttribute("g", vwgi.NewWeaponGroup.ToString()); } if (SaveVariant != null) { SaveVariant(this, txtVariantName.Text.Trim(), variant); } }
protected override void OnSave( TextBlock block ) { base.OnSave( block ); if( Dimensions != new Vec3( 1, 1, 1 ) ) block.SetAttribute( "dimensions", Dimensions.ToString() ); }
protected override void OnSave( TextBlock block ) { base.OnSave( block ); //General { if( blending != MaterialBlendingTypes.Opaque ) block.SetAttribute( "blending", blending.ToString() ); if( !lighting ) block.SetAttribute( "lighting", lighting.ToString() ); if( !culling ) block.SetAttribute( "culling", culling.ToString() ); if( !useNormals ) block.SetAttribute( "useNormals", useNormals.ToString() ); if( !receiveShadows ) block.SetAttribute( "receiveShadows", receiveShadows.ToString() ); if( alphaRejectFunction != CompareFunction.AlwaysPass ) block.SetAttribute( "alphaRejectFunction", alphaRejectFunction.ToString() ); if( alphaRejectValue != 127 ) block.SetAttribute( "alphaRejectValue", alphaRejectValue.ToString() ); if( alphaToCoverage ) block.SetAttribute( "alphaToCoverage", alphaToCoverage.ToString() ); if( fadingByDistanceRange != new Range( 0, 0 ) ) block.SetAttribute( "fadingByDistanceRange", fadingByDistanceRange.ToString() ); if( !allowFog ) block.SetAttribute( "allowFog", allowFog.ToString() ); if( !depthWrite ) block.SetAttribute( "depthWrite", depthWrite.ToString() ); if( !depthTest ) block.SetAttribute( "depthTest", depthTest.ToString() ); } //Diffuse { if( diffuseColor != new ColorValue( 1, 1, 1 ) ) block.SetAttribute( "diffuseColor", diffuseColor.ToString() ); if( diffusePower != 1 ) block.SetAttribute( "diffusePower", diffusePower.ToString() ); if( diffuseScaleDynamic ) block.SetAttribute( "diffuseScaleDynamic", diffuseScaleDynamic.ToString() ); if( diffuseVertexColor ) block.SetAttribute( "diffuseVertexColor", diffuseVertexColor.ToString() ); if( diffuse1Map.IsDataExists() ) { TextBlock diffuse1MapBlock = block.AddChild( "diffuse1Map" ); diffuse1Map.Save( diffuse1MapBlock ); } if( diffuse2Map.IsDataExists() ) { TextBlock diffuse2MapBlock = block.AddChild( "diffuse2Map" ); diffuse2Map.Save( diffuse2MapBlock ); } if( diffuse3Map.IsDataExists() ) { TextBlock diffuse3MapBlock = block.AddChild( "diffuse3Map" ); diffuse3Map.Save( diffuse3MapBlock ); } if( diffuse4Map.IsDataExists() ) { TextBlock diffuse4MapBlock = block.AddChild( "diffuse4Map" ); diffuse4Map.Save( diffuse4MapBlock ); } } //Reflection { if( reflectionColor != new ColorValue( 0, 0, 0 ) ) block.SetAttribute( "reflectionColor", reflectionColor.ToString() ); if( reflectionPower != 1 ) block.SetAttribute( "reflectionPower", reflectionPower.ToString() ); if( reflectionScaleDynamic ) block.SetAttribute( "reflectionScaleDynamic", reflectionScaleDynamic.ToString() ); if( reflectionMap.IsDataExists() ) { TextBlock reflectionMapBlock = block.AddChild( "reflectionMap" ); reflectionMap.Save( reflectionMapBlock ); } if( !string.IsNullOrEmpty( reflectionSpecificCubemap ) ) block.SetAttribute( "reflectionSpecificCubemap", reflectionSpecificCubemap ); } //Emission { if( emissionColor != new ColorValue( 0, 0, 0 ) ) block.SetAttribute( "emissionColor", emissionColor.ToString() ); if( emissionPower != 1 ) block.SetAttribute( "emissionPower", emissionPower.ToString() ); if( emissionScaleDynamic ) block.SetAttribute( "emissionScaleDynamic", emissionScaleDynamic.ToString() ); if( emissionMap.IsDataExists() ) { TextBlock emissionMapBlock = block.AddChild( "emissionMap" ); emissionMap.Save( emissionMapBlock ); } } //Specular { if( specularColor != new ColorValue( 0, 0, 0 ) ) block.SetAttribute( "specularColor", specularColor.ToString() ); if( specularPower != 1 ) block.SetAttribute( "specularPower", specularPower.ToString() ); if( specularScaleDynamic ) block.SetAttribute( "specularScaleDynamic", specularScaleDynamic.ToString() ); if( specularMap.IsDataExists() ) { TextBlock specularMapBlock = block.AddChild( "specularMap" ); specularMap.Save( specularMapBlock ); } if( specularShininess != 20 ) block.SetAttribute( "specularShininess", specularShininess.ToString() ); } //Height { if( normalMap.IsDataExists() ) { TextBlock normalMapBlock = block.AddChild( "normalMap" ); normalMap.Save( normalMapBlock ); } if( heightFromNormalMapAlpha ) block.SetAttribute( "heightFromNormalMapAlpha", heightFromNormalMapAlpha.ToString() ); if( heightMap.IsDataExists() ) { TextBlock heightMapBlock = block.AddChild( "heightMap" ); heightMap.Save( heightMapBlock ); } if( heightScale != .04f ) block.SetAttribute( "heightScale", heightScale.ToString() ); } }
protected override void OnSave( TextBlock block ) { base.OnSave( block ); if( waveOnlyInVerticalPosition ) block.SetAttribute( "waveOnlyInVerticalPosition", waveOnlyInVerticalPosition.ToString() ); if( receiveObjectsPositionsFromVertices ) { block.SetAttribute( "receiveObjectsPositionsFromVertices", receiveObjectsPositionsFromVertices.ToString() ); } }
bool SaveEngineConfig() { TextBlock block = new TextBlock(); //Renderer { EngineComponentManager.ComponentInfo[] components = GetSortedComponentsByType( EngineComponentManager.ComponentTypeFlags.RenderingSystem); EngineComponentManager.ComponentInfo component = null; if (comboBoxRenderSystems.SelectedIndex != -1) { component = components[comboBoxRenderSystems.SelectedIndex]; } TextBlock rendererBlock = block.AddChild("Renderer"); if (component != null) { rendererBlock.SetAttribute("implementationComponent", component.Name); } //rendering device if (component != null && component.Name.Contains("Direct3D")) { rendererBlock.SetAttribute("renderingDeviceName", (string)comboBoxRenderingDevices.SelectedItem); rendererBlock.SetAttribute("renderingDeviceIndex", (comboBoxRenderingDevices.SelectedIndex - 1).ToString()); } if (!checkBoxAllowShaders.Checked) { rendererBlock.SetAttribute("allowShaders", checkBoxAllowShaders.Checked.ToString()); } //depthBufferAccess if (comboBoxDepthBufferAccess.SelectedIndex != -1) { rendererBlock.SetAttribute("depthBufferAccess", (comboBoxDepthBufferAccess.SelectedIndex == 1).ToString()); } //fullSceneAntialiasing if (comboBoxAntialiasing.SelectedIndex != -1) { ComboBoxItem item = (ComboBoxItem)comboBoxAntialiasing.SelectedItem; rendererBlock.SetAttribute("fullSceneAntialiasing", item.Identifier); } //filtering if (comboBoxFiltering.SelectedIndex != -1) { RendererWorld.FilteringModes filtering = (RendererWorld.FilteringModes) comboBoxFiltering.SelectedIndex; rendererBlock.SetAttribute("filtering", filtering.ToString()); } //renderTechnique if (comboBoxRenderTechnique.SelectedIndex != -1) { ComboBoxItem item = (ComboBoxItem)comboBoxRenderTechnique.SelectedItem; rendererBlock.SetAttribute("renderTechnique", item.Identifier); } //multiMonitorMode if (comboBoxVideoMode.SelectedIndex == 1) { rendererBlock.SetAttribute("multiMonitorMode", true.ToString()); } //videoMode if (comboBoxVideoMode.SelectedIndex >= 2) { string[] strings = ((string)comboBoxVideoMode.SelectedItem). Split(new char[] { 'x' }); Vec2I videoMode = new Vec2I(int.Parse(strings[0]), int.Parse(strings[1])); rendererBlock.SetAttribute("videoMode", videoMode.ToString()); } //fullScreen rendererBlock.SetAttribute("fullScreen", checkBoxFullScreen.Checked.ToString()); //vertical sync rendererBlock.SetAttribute("verticalSync", checkBoxVerticalSync.Checked.ToString()); } //Physics system { EngineComponentManager.ComponentInfo[] components = GetSortedComponentsByType( EngineComponentManager.ComponentTypeFlags.PhysicsSystem); EngineComponentManager.ComponentInfo component = null; if (comboBoxPhysicsSystems.SelectedIndex != -1) { component = components[comboBoxPhysicsSystems.SelectedIndex]; } if (component != null) { TextBlock physicsSystemBlock = block.AddChild("PhysicsSystem"); physicsSystemBlock.SetAttribute("implementationComponent", component.Name); //physicsSystemBlock.SetAttribute( "allowHardwareAcceleration", // checkBoxPhysicsAllowHardwareAcceleration.Checked.ToString() ); } } //Sound system { EngineComponentManager.ComponentInfo[] components = GetSortedComponentsByType( EngineComponentManager.ComponentTypeFlags.SoundSystem); EngineComponentManager.ComponentInfo component = null; if (comboBoxSoundSystems.SelectedIndex != -1) { component = components[comboBoxSoundSystems.SelectedIndex]; } if (component != null) { TextBlock soundSystemBlock = block.AddChild("SoundSystem"); soundSystemBlock.SetAttribute("implementationComponent", component.Name); } } //Localization { string language = "Autodetect"; if (comboBoxLanguages.SelectedIndex > 0) { language = (string)comboBoxLanguages.SelectedItem; } TextBlock localizationBlock = block.AddChild("Localization"); localizationBlock.SetAttribute("language", language); if (!checkBoxLocalizeEngine.Checked) { localizationBlock.SetAttribute("localizeEngine", checkBoxLocalizeEngine.Checked.ToString()); } if (!checkBoxLocalizeToolset.Checked) { localizationBlock.SetAttribute("localizeToolset", checkBoxLocalizeToolset.Checked.ToString()); } } //save file { string fileName = VirtualFileSystem.GetRealPathByVirtual( "user:Configs/Engine.config"); try { string directoryName = Path.GetDirectoryName(fileName); if (directoryName != "" && !Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } using (StreamWriter writer = new StreamWriter(fileName)) { writer.Write(block.DumpToString()); } } catch { string text = string.Format("Saving file failed \"{0}\".", fileName); MessageBox.Show(text, "Configurator", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } } return(true); }
protected virtual void OnSave(TextBlock block) { if (taskPosition != Vec3.Zero) block.SetAttribute("taskPosition", taskPosition.ToString()); if (taskEntity != null) block.SetAttribute("taskEntity", taskEntity.UIN.ToString()); }
public override void Save( TextBlock block ) { base.Save( block ); if( blending != MapBlendingTypes.Modulate ) block.SetAttribute( "blending", blending.ToString() ); }
void SaveSettings(TextBlock block) { options.Save(block); block.SetAttribute("SplitterDistance", kryptonSplitContainer1.SplitterDistance.ToString()); }
protected override void OnSave(TextBlock block) { base.OnSave(block); block.SetAttribute("reachDistance", reachDistance.ToString()); }
protected override void OnSave( TextBlock block ) { base.OnSave( block ); if( receiveObjectsPositionsFromVertices ) { block.SetAttribute( "receiveObjectsPositionsFromVertices", receiveObjectsPositionsFromVertices.ToString() ); } if( windEffectFactor != 1 ) block.SetAttribute( "windEffectFactor", windEffectFactor.ToString() ); if( bendScale != 0.02f ) block.SetAttribute( "bendScale", bendScale.ToString() ); if( bendVariation != 0.01f ) block.SetAttribute( "bendVariation", bendVariation.ToString() ); if( bendFrequency != 1 ) block.SetAttribute( "bendFrequency", bendFrequency.ToString() ); block.SetAttribute( "detailBending", detailBending.ToString() ); if( branchAmplitude != 0.01f ) block.SetAttribute( "branchAmplitude", branchAmplitude.ToString() ); if( leafAmplitude != 0.01f ) block.SetAttribute( "leafAmplitude", leafAmplitude.ToString() ); if( branchFrequency != 1 ) block.SetAttribute( "branchFrequency", branchFrequency.ToString() ); if( leafFrequency != 1 ) block.SetAttribute( "leafFrequency", leafFrequency.ToString() ); }
public void SaveCustomConfig() { var block = new TextBlock(); var controlBloc = block.AddChild("Controls"); //var deadzone = controlBloc.AddChild("DeadZone"); var keyBlockDz = DeadZone.ToString(); block.SetAttribute("DeadZone", keyBlockDz); foreach (GameControlItem item in Items) { var currentKeyBlock = controlBloc.AddChild(item.ControlKey.ToString()); //keybord Setting if (item.BindedKeyboardMouseValues.Count > 0) { var keyboardBlock = currentKeyBlock.AddChild("Keyboard"); foreach (var keyboardvalue in item.BindedKeyboardMouseValues) { var keyBlock = keyboardBlock.AddChild("Item"); SystemKeyboardMouseValue.Save(keyboardvalue, keyBlock); } } //Joystick setting if (item.BindedJoystickValues.Count > 0) { var joystickBlock = currentKeyBlock.AddChild("Joystick"); foreach (var joystickvalue in item.BindedJoystickValues) { var keyBlock = joystickBlock.AddChild("Item"); SystemJoystickValue.Save(joystickvalue, keyBlock); } } } string fileName = VirtualFileSystem.GetRealPathByVirtual(keyconfig); try { string directoryName = Path.GetDirectoryName(fileName); if (directoryName != "" && !Directory.Exists(directoryName)) Directory.CreateDirectory(directoryName); using (StreamWriter writer = new StreamWriter(fileName)) { writer.Write(block.DumpToString()); } } catch { Log.Fatal(string.Format("Saving file failed \"{0}\".", fileName)); return; } }
public void Save( TextBlock block ) { if( scroll != Vec2.Zero ) block.SetAttribute( "scroll", scroll.ToString() ); if( scale != new Vec2( 1, 1 ) ) block.SetAttribute( "scale", scale.ToString() ); if( rotate != 0 ) block.SetAttribute( "rotate", rotate.ToString() ); if( dynamicParameters ) block.SetAttribute( "dynamicParameters", dynamicParameters.ToString() ); if( animation.IsDataExists() ) { TextBlock animationBlock = block.AddChild( "animation" ); animation.Save( animationBlock ); } }
public virtual void Save( TextBlock block ) { if( !string.IsNullOrEmpty( texture ) ) block.SetAttribute( "texture", texture ); if( texCoord != TexCoordIndexes.TexCoord0 ) block.SetAttribute( "texCoord", texCoord.ToString() ); if( clamp ) block.SetAttribute( "clamp", clamp.ToString() ); if( transform.IsDataExists() ) { TextBlock transformBlock = block.AddChild( "transform" ); transform.Save( transformBlock ); } }
public static void Save(SystemKeyboardMouseValue item, TextBlock block) { block.SetAttribute("type", item.Type.ToString()); switch (item.Type) { case Types.Key: block.SetAttribute("key", item.Key.ToString()); block.SetAttribute("strength", item.Strength.ToString()); break; case Types.MouseButton: block.SetAttribute("button", item.MouseButton.ToString()); block.SetAttribute("strength", item.Strength.ToString()); break; case Types.MouseScrollDirection: block.SetAttribute("scroll", item.scrollDirection.ToString()); block.SetAttribute("strength", item.Strength.ToString()); break; } }
public void Save(TextBlock block) { block.SetAttribute(nameof(SplitterOrientation), SplitterOrientation.ToString()); }
public void Save(TextBlock block) { block.SetAttribute(nameof(PanelMode), PanelMode.ToString()); if (ListMode != ContentBrowser.ListModeEnum.List) { block.SetAttribute(nameof(ListMode), ListMode.ToString()); } if (TileImageSize != TileImageSizeDefault) { block.SetAttribute(nameof(TileImageSize), TileImageSize.ToString()); } if (ListImageSize != ListImageSizeDefault) { block.SetAttribute(nameof(ListImageSize), ListImageSize.ToString()); } if (ListColumnWidth != ListColumnWidthDefault) { block.SetAttribute(nameof(ListColumnWidth), ListColumnWidth.ToString()); } if (!Breadcrumb) { block.SetAttribute(nameof(Breadcrumb), Breadcrumb.ToString()); } if (DisplayPropertiesSortFilesBy) { if (SortFilesBy != ContentBrowser.SortByItems.Name) { block.SetAttribute(nameof(SortFilesBy), SortFilesBy.ToString()); } if (!SortFilesByAscending) { block.SetAttribute(nameof(SortFilesByAscending), SortFilesByAscending.ToString()); } } if (owner.Mode == ContentBrowser.ModeEnum.Resources) { if (!FilteringModeButton) { block.SetAttribute(nameof(FilteringModeButton), FilteringModeButton.ToString()); } } if (owner.Mode == ContentBrowser.ModeEnum.Objects) { if (!MembersButton) { block.SetAttribute(nameof(MembersButton), MembersButton.ToString()); } } if (DisplayPropertiesOpenButton) { if (!OpenButton) { block.SetAttribute(nameof(OpenButton), OpenButton.ToString()); } } if (DisplayPropertiesEditorSettingsButtons) { if (!EditorButton) { block.SetAttribute(nameof(EditorButton), EditorButton.ToString()); } if (!SettingsButton) { block.SetAttribute(nameof(SettingsButton), SettingsButton.ToString()); } } if (!ButtonsForEditing) { block.SetAttribute(nameof(ButtonsForEditing), ButtonsForEditing.ToString()); } if (owner.Mode == ContentBrowser.ModeEnum.Objects) { if (!SearchButton) { block.SetAttribute(nameof(SearchButton), SearchButton.ToString()); } } //!!!! if (!SearchBar) { block.SetAttribute(nameof(SearchBar), SearchBar.ToString()); } block.SetAttribute(nameof(SplitterPosition), SplitterPosition.ToString()); }
public static void Save(SystemJoystickValue item, TextBlock block) { block.SetAttribute("type", item.Type.ToString()); switch (item.Type) { case Types.Button: block.SetAttribute("button", item.Button.ToString()); block.SetAttribute("strength", item.strength.ToString()); break; case Types.Axis: block.SetAttribute("axis", item.Axis.ToString()); block.SetAttribute("axisfilter", item.AxisFilter.ToString()); block.SetAttribute("strength", item.strength.ToString()); break; case Types.POV: block.SetAttribute("POV", item.POV.ToString()); block.SetAttribute("POVDirection", item.POVDirection.ToString()); block.SetAttribute("strength", item.strength.ToString()); break; case Types.Slider: block.SetAttribute("slider", item.Slider.ToString()); block.SetAttribute("sliderAxis", item.SliderAxis.ToString()); block.SetAttribute("axisfilter", item.AxisFilter.ToString()); block.SetAttribute("strength", item.strength.ToString()); break; } }
protected override void OnSave( TextBlock block ) { base.OnSave( block ); if( currentFireMode != null ) { if( currentFireMode == normalMode ) block.SetAttribute( "currentFireMode", "normal" ); else block.SetAttribute( "currentFireMode", "alternative" ); } }
protected override void OnSave( TextBlock block ) { base.OnSave( block ); //General { if( blending != MaterialBlendingTypes.Opaque ) block.SetAttribute( "blending", blending.ToString() ); if( !lighting ) block.SetAttribute( "lighting", lighting.ToString() ); if( !ambientLighting ) block.SetAttribute( "ambientLighting", ambientLighting.ToString() ); if( doubleSided ) block.SetAttribute( "doubleSided", doubleSided.ToString() ); if( !useNormals ) block.SetAttribute( "useNormals", useNormals.ToString() ); if( !receiveShadows ) block.SetAttribute( "receiveShadows", receiveShadows.ToString() ); if( receiveSimpleShadows ) block.SetAttribute( "receiveSimpleShadows", receiveSimpleShadows.ToString() ); if( alphaRejectFunction != CompareFunction.AlwaysPass ) block.SetAttribute( "alphaRejectFunction", alphaRejectFunction.ToString() ); if( alphaRejectValue != 127 ) block.SetAttribute( "alphaRejectValue", alphaRejectValue.ToString() ); if( alphaToCoverage ) block.SetAttribute( "alphaToCoverage", alphaToCoverage.ToString() ); if( fadingByDistanceRange != new Range( 0, 0 ) ) block.SetAttribute( "fadingByDistanceRange", fadingByDistanceRange.ToString() ); if( !allowFog ) block.SetAttribute( "allowFog", allowFog.ToString() ); if( !depthWrite ) block.SetAttribute( "depthWrite", depthWrite.ToString() ); if( !depthTest ) block.SetAttribute( "depthTest", depthTest.ToString() ); if( softParticles ) block.SetAttribute( "softParticles", softParticles.ToString() ); if( softParticlesFadingLength != 1 ) block.SetAttribute( "softParticlesFadingLength", softParticlesFadingLength.ToString() ); if( depthOffset != 0 ) block.SetAttribute( "depthOffset", depthOffset.ToString() ); if( halfLambert ) block.SetAttribute( "halfLambert", halfLambert.ToString() ); } //Diffuse { if( diffuseColor != new ColorValue( 1, 1, 1 ) ) block.SetAttribute( "diffuseColor", diffuseColor.ToString() ); if( diffusePower != 1 ) block.SetAttribute( "diffusePower", diffusePower.ToString() ); if( diffuseScaleDynamic ) block.SetAttribute( "diffuseScaleDynamic", diffuseScaleDynamic.ToString() ); if( diffuseVertexColor ) block.SetAttribute( "diffuseVertexColor", diffuseVertexColor.ToString() ); if( diffuse1Map.IsDataExists() ) { TextBlock diffuse1MapBlock = block.AddChild( "diffuse1Map" ); diffuse1Map.Save( diffuse1MapBlock ); } if( diffuse2Map.IsDataExists() ) { TextBlock diffuse2MapBlock = block.AddChild( "diffuse2Map" ); diffuse2Map.Save( diffuse2MapBlock ); } if( diffuse3Map.IsDataExists() ) { TextBlock diffuse3MapBlock = block.AddChild( "diffuse3Map" ); diffuse3Map.Save( diffuse3MapBlock ); } if( diffuse4Map.IsDataExists() ) { TextBlock diffuse4MapBlock = block.AddChild( "diffuse4Map" ); diffuse4Map.Save( diffuse4MapBlock ); } } //Reflection { if( reflectionColor != new ColorValue( 0, 0, 0 ) ) block.SetAttribute( "reflectionColor", reflectionColor.ToString() ); if( reflectionPower != 1 ) block.SetAttribute( "reflectionPower", reflectionPower.ToString() ); if( reflectionScaleDynamic ) block.SetAttribute( "reflectionScaleDynamic", reflectionScaleDynamic.ToString() ); if( reflectionMap.IsDataExists() ) { TextBlock reflectionMapBlock = block.AddChild( "reflectionMap" ); reflectionMap.Save( reflectionMapBlock ); } if( !string.IsNullOrEmpty( reflectionSpecificCubemap ) ) block.SetAttribute( "reflectionSpecificCubemap", reflectionSpecificCubemap ); if( reflectionBoxParallaxCorrectedCubemaps ) block.SetAttribute( "reflectionBoxParallaxCorrectedCubemaps", reflectionBoxParallaxCorrectedCubemaps.ToString() ); } //Emission { if( emissionColor != new ColorValue( 0, 0, 0 ) ) block.SetAttribute( "emissionColor", emissionColor.ToString() ); if( emissionPower != 1 ) block.SetAttribute( "emissionPower", emissionPower.ToString() ); if( emissionScaleDynamic ) block.SetAttribute( "emissionScaleDynamic", emissionScaleDynamic.ToString() ); if( emissionMap.IsDataExists() ) { TextBlock emissionMapBlock = block.AddChild( "emissionMap" ); emissionMap.Save( emissionMapBlock ); } } //Specular { if( specularColor != new ColorValue( 0, 0, 0 ) ) block.SetAttribute( "specularColor", specularColor.ToString() ); if( specularPower != 1 ) block.SetAttribute( "specularPower", specularPower.ToString() ); if( specularScaleDynamic ) block.SetAttribute( "specularScaleDynamic", specularScaleDynamic.ToString() ); if( specularMap.IsDataExists() ) { TextBlock specularMapBlock = block.AddChild( "specularMap" ); specularMap.Save( specularMapBlock ); } if( specularShininess != 20 ) block.SetAttribute( "specularShininess", specularShininess.ToString() ); } //Translucency { if( translucencyColor != new ColorValue( 0, 0, 0 ) ) block.SetAttribute( "translucencyColor", translucencyColor.ToString() ); if( translucencyPower != 1 ) block.SetAttribute( "translucencyPower", translucencyPower.ToString() ); if( translucencyDynamic ) block.SetAttribute( "translucencyDynamic", translucencyDynamic.ToString() ); if( translucencyMap.IsDataExists() ) { TextBlock translucencyMapBlock = block.AddChild( "translucencyMap" ); translucencyMap.Save( translucencyMapBlock ); } if( translucencyClearness != 4f ) block.SetAttribute( "translucencyClearness", translucencyClearness.ToString() ); } //Height { if( normalMap.IsDataExists() ) { TextBlock normalMapBlock = block.AddChild( "normalMap" ); normalMap.Save( normalMapBlock ); } if( heightFromNormalMapAlpha ) block.SetAttribute( "heightFromNormalMapAlpha", heightFromNormalMapAlpha.ToString() ); if( heightMap.IsDataExists() ) { TextBlock heightMapBlock = block.AddChild( "heightMap" ); heightMap.Save( heightMapBlock ); } if( displacementTechnique != DisplacementTechniques.ParallaxOcclusionMapping ) block.SetAttribute( "displacementTechnique", displacementTechnique.ToString() ); if( heightScale != .04f ) block.SetAttribute( "heightScale", heightScale.ToString() ); } }
void SaveAnimationState( TextBlock block ) { if( currentAnimationItem != null && !currentAnimationItem.Removed ) { TextBlock itemBlock = block.AddChild( "currentAnimationItem" ); MeshObjectAnimationController.AnimationItem item = currentAnimationItem; itemBlock.SetAttribute( "animationBaseName", item.AnimationBaseName ); itemBlock.SetAttribute( "allowRandomAnimationNumber", item.AllowRandomAnimationNumber.ToString() ); itemBlock.SetAttribute( "loop", item.Loop.ToString() ); itemBlock.SetAttribute( "velocity", item.Velocity.ToString() ); itemBlock.SetAttribute( "weight", item.Weight.ToString() ); itemBlock.SetAttribute( "timePosition", item.TimePosition.ToString() ); } if( forceAnimationRemainingTime != 0 ) { block.SetAttribute( "forceAnimationRemainingTime", forceAnimationRemainingTime.ToString() ); } }
public void Save( TextBlock block ) { if( scrollSpeed != Vec2.Zero ) block.SetAttribute( "scrollSpeed", scrollSpeed.ToString() ); if( scrollRound != Vec2.Zero ) block.SetAttribute( "scrollRound", scrollRound.ToString() ); if( rotateSpeed != 0 ) block.SetAttribute( "rotateSpeed", rotateSpeed.ToString() ); }