private void ExportUpdate() { SECTR_Chunk myChunk = (SECTR_Chunk)target; if (myChunk) { SECTR_Sector mySector = myChunk.GetComponent <SECTR_Sector>(); if (mySector) { switch (modiferMode) { case ModifierMode.Export: SECTR_StreamExport.ExportToChunk(mySector); break; case ModifierMode.Import: SECTR_StreamExport.ImportFromChunk(mySector); break; case ModifierMode.Revert: SECTR_StreamExport.DeleteExportedSector(mySector); myChunk.enabled = true; break; case ModifierMode.None: default: break; } } modiferMode = ModifierMode.None; } EditorApplication.update -= ExportUpdate; }
public Modifier(float value, ModifierMode mode, ModifierTarget target) { _value = value; _mode = mode; _target = target; }
public override void Decode(MinecraftStream stream) { EntityId = stream.ReadVarInt(); int count = stream.ReadInt(); for (int i = 0; i < count; i++) { string key = stream.ReadString(); double value = stream.ReadDouble(); int propCount = stream.ReadVarInt(); Modifier[] modifiers = new Modifier[propCount]; for (int y = 0; y < modifiers.Length; y++) { UUID uuid = new UUID(stream.ReadUuid().ToByteArray()); double amount = stream.ReadDouble(); ModifierMode op = (ModifierMode)stream.ReadByte(); modifiers[y] = EntityProperty.Factory.CreateModifier(uuid, amount, op); } EntityProperty prop = EntityProperty.Factory.Create(key, value, modifiers); if (!Properties.ContainsKey(prop.Key)) { Properties.Add(prop.Key, prop); } } }
public void Reset() { Name = string.Empty; Resolution = 20; Range = 1; Radius = 5; RadiusModifier = ModifierMode.None; RadiusModifierCurve = AnimationCurve.Linear(0, 0, 1, 0); Z = 0; ZModifier = ModifierMode.None; ZModifierCurve = AnimationCurve.Linear(0, 0, 1, 0); Z = 0; m = 0; n1 = 1; n2 = 3; n3 = 4; a = 1; b = 1; WeldThreshold = 0.1f; AutoRefresh = true; AutoRefreshSpeed = 0; }
public AttributeModifierCommand(YTY.AocDatLib.Effect effect) { UnitId = effect.Arg1; Class = (UnitClass)effect.Arg2; Attribute = (Attribute)effect.Arg3; Amount = effect.Arg4; switch (effect.Command) { case 0: Mode = ModifierMode.Set; break; case 4: Mode = ModifierMode.Add; break; case 5: Mode = ModifierMode.Multiply; break; } ArmorId = 0; if (Attribute == Attribute.Armor || Attribute == Attribute.Attack) { var a = (int)Amount; ArmorId = a / 256; Amount = a % 256; } }
public override void OnInspectorGUI() { SECTR_Chunk myChunk = (SECTR_Chunk)target; SECTR_Sector mySector = myChunk.GetComponent <SECTR_Sector>(); EditorGUILayout.BeginHorizontal(); bool editMode = !EditorApplication.isPlaying && !EditorApplication.isPaused; bool alreadyExported = myChunk && System.IO.File.Exists(SECTR_Asset.UnityToOSPath(myChunk.NodeName)); GUI.enabled = editMode; if (mySector.Frozen) { // Import if (alreadyExported && GUILayout.Button(new GUIContent("Import", "Imports this Sector into the scene."))) { modiferMode = ModifierMode.Import; } // Export GUI.enabled = false; GUILayout.Button(new GUIContent("Export", "Exports this Sector into a Chunk scene.")); GUI.enabled = editMode; } else { // Revert if (alreadyExported && GUILayout.Button(new GUIContent("Revert", "Discards changes to this Sector."))) { modiferMode = ModifierMode.Revert; } // Export if (GUILayout.Button(new GUIContent("Export", "Exports this Sector into a Chunk scene."))) { modiferMode = ModifierMode.Export; } } EditorGUILayout.EndHorizontal(); base.OnInspectorGUI(); if (!mySector.Frozen) { proxyFoldout = EditorGUILayout.Foldout(proxyFoldout, "Proxy Mesh Tool"); if (proxyFoldout) { EditorGUILayout.BeginVertical(); _BuildChildControls(myChunk.transform, true); if (GUILayout.Button("Create Proxy Mesh")) { Dictionary <Material, List <CombineInstance> > meshHash = new Dictionary <Material, List <CombineInstance> >(); Matrix4x4 chunkWorldToLocal = myChunk.transform.worldToLocalMatrix; foreach (Renderer renderer in checkState.Keys) { if (checkState[renderer]) { MeshFilter meshFilter = renderer.GetComponent <MeshFilter>(); int numSubMeshes = meshFilter.sharedMesh.subMeshCount; for (int submeshIndex = 0; submeshIndex < numSubMeshes; ++submeshIndex) { Material material = renderer.sharedMaterials[submeshIndex]; List <CombineInstance> materialMeshes = null; if (!meshHash.TryGetValue(material, out materialMeshes)) { materialMeshes = new List <CombineInstance>(); meshHash[material] = materialMeshes; } CombineInstance instance = new CombineInstance(); instance.transform = chunkWorldToLocal * renderer.transform.localToWorldMatrix; instance.mesh = renderer.GetComponent <MeshFilter>().sharedMesh; instance.subMeshIndex = submeshIndex; materialMeshes.Add(instance); } } } if (meshHash.Count > 0) { List <CombineInstance> combinedMeshes = new List <CombineInstance>(); List <Material> combinedMaterials = new List <Material>(); foreach (Material material in meshHash.Keys) { CombineInstance instance = new CombineInstance(); instance.mesh = new Mesh(); instance.mesh.CombineMeshes(meshHash[material].ToArray(), true, true); combinedMeshes.Add(instance); combinedMaterials.Add(material); } string sceneDir; string sceneName; string exportFolder = SECTR_Asset.MakeExportFolder("Proxies", false, out sceneDir, out sceneName); myChunk.ProxyMesh = SECTR_Asset.Create <Mesh>(exportFolder, myChunk.name + "_Proxy", new Mesh()); myChunk.ProxyMesh.CombineMeshes(combinedMeshes.ToArray(), false, false); myChunk.ProxyMaterials = combinedMaterials.ToArray(); int numCombined = combinedMeshes.Count; for (int combinedIndex = 0; combinedIndex < numCombined; ++combinedIndex) { Mesh.DestroyImmediate(combinedMeshes[combinedIndex].mesh); } SECTR_VC.WaitForVC(); } else { EditorUtility.DisplayDialog("Proxy Error", "Must have at least one mesh selected to create a proxy.", "Ok"); } } EditorGUILayout.EndVertical(); } } GUI.enabled = true; if (modiferMode != ModifierMode.None) { EditorApplication.update += ExportUpdate; } }
public AbilityModifier(IResolvable source, string property, ModifierMode mode, Ability value) : base(source, property, mode) { Value = value; }
public Modifier(IResolvable source, string property, ModifierMode mode) { Source = source; Property = property; Mode = mode; }
public StringModifier(IResolvable source, string property, ModifierMode mode, string value) : base(source, property, mode) { Value = value; }
public CardTypeModifier(IResolvable source, string property, ModifierMode mode, CardType?value) : base(source, property, mode) { Value = value; }
public ColorModifier(IResolvable source, string property, ModifierMode mode, ManaColor value) : base(source, property, mode) { Value = value; }
public virtual Modifier CreateModifier(UUID uuid, double amount, ModifierMode modifierMode) { return(new Modifier(uuid, amount, modifierMode)); }
public Modifier(UUID uuid, double amount, ModifierMode mode) { Uuid = uuid; Amount = amount; Operation = mode; }
public VitalModifier(VitalType type, float value, ModifierMode mode, ModifierTarget target) : base(value, mode, target) { _type = type; }
public FleetVitalModifier(string reason, int duration, float value, FleetVitalType type, ModifierSetting setting, ModifierMode mode, ModifierTarget target) : base(value, mode, target) { _reason = reason; _duration = duration; _type = type; _setting = setting; isInfinite = duration < 0; }