public void BeginProperty(Rect position, SerializedProperty property, GUIContent label) { if (property == null) { Debug.LogError("Cannot draw property drawer for null property."); return; } _drawerType = DrawerType.Property; serializedProperty = property; serializedObject = property.serializedObject; _cachedKey = GenerateKey(); totalHeight = 0; positionRect = position; bool guiWasEnabled = true; if (EditorCache.GetCachedValue("guiWasEnabled", ref guiWasEnabled, GenerateKey())) { GUI.enabled = guiWasEnabled; } InitializeGUIElements(); Rect totalRect = new Rect(positionRect.x, positionRect.y, positionRect.width, GetHeight()); DrawBackgroundRect(new Rect(positionRect.x, positionRect.y, positionRect.width, GetHeight())); //EditorGUI.BeginProperty(totalRect, label, property); EditorGUI.BeginChangeCheck(); }
public void BeginEditor(SerializedObject serializedObject) { _drawerType = DrawerType.Editor; this.serializedObject = serializedObject; serializedProperty = null; _cachedKey = GenerateKey(); if (serializedObject == null) { Debug.LogError("Cannot draw editor for null serializedObject."); return; } serializedObject.Update(); if (customPositionRect.x < 0 && customPositionRect.width < 0) { positionRect = EditorGUILayout.GetControlRect(); positionRect.x = positionRect.x - 3; positionRect.width = positionRect.width + 6; } else { positionRect = customPositionRect; } totalHeight = 0; InitializeGUIElements(); EditorGUI.BeginChangeCheck(); DrawBackgroundRect(new Rect(positionRect.x, positionRect.y, positionRect.width, GetHeight())); }
public static void ResetLastDrawerData() { LastPropertyUsedCustomDrawer = false; LastPropertyDoesntAllowAnimation = false; LastPropertyDrawer = null; LastPropertyDrawerType = DrawerType.None; }
/// <summary> /// Override the default behaviour to base the hash code of the attribute off of the stored values /// </summary> /// <returns>Returns a combined hash to reflect the assigned values</returns> public override int GetHashCode() { unchecked { int hash = 17; hash = hash * 31 + DrawerType.GetHashCode(); hash = hash * 31 + HandleChildren.GetHashCode(); return(hash); } }
public async Task CreateOnlyShortAsync(DrawerType drawerType, float height, float width, float depth, Fabric corpusFabric, Fabric frontFabric, Furniture furniture, int count) { if (drawerType == DrawerType.Versalite) { await CreateVersaliteDrawersAsync(width, depth, (height - count * 4) / count, 90, corpusFabric, frontFabric, count, furniture); } else if (drawerType == DrawerType.AmixBlum) { await CreateAmixBlumDrawersAsync(width, depth, (height - count * 4) / count, 90, corpusFabric, frontFabric, count, furniture); } else { throw new GfsException(ErrorCode.WrongDrawerType, _dictionary.WrongDrawerType); } }
public async Task CreateMixedConfigAsync(DrawerType drawerType, float height, float width, float depth, Fabric corpusFabric, Fabric frontFabric, Furniture furniture, int shortCount, int highCount) { if (drawerType == DrawerType.Versalite) { await CreateVersaliteDrawersAsync(width, depth, 284, 220, corpusFabric, frontFabric, highCount, furniture); await CreateVersaliteDrawersAsync(width, depth, 140, 90, corpusFabric, frontFabric, shortCount, furniture); } else if (drawerType == DrawerType.AmixBlum) { await CreateAmixBlumDrawersAsync(width, depth, 284, 200, corpusFabric, frontFabric, highCount, furniture); await CreateAmixBlumDrawersAsync(width, depth, 140, 90, corpusFabric, frontFabric, shortCount, furniture); } else { throw new GfsException(ErrorCode.WrongDrawerType, _dictionary.WrongDrawerType); } }
public ThingDefStats(ThingDef d) : base(d) { this.version = 2; Util.Populate(out this.VerbStats, Def.Verbs, (v) => { try { if (v != null) { return(new VerbStats(v)); } } catch (Exception e) { Log.Warning(e.GetType().Name + " -- " + e.Message); } Log.Warning("Poorly formatted VerbProperties in " + this.Def.defName); return(null); }); Util.Populate(out this.Tools, Def.tools, (v) => new ToolStats(v)); Util.Populate(out this.EquippedStatOffsets, Def.equippedStatOffsets, (v) => new FloatValueDefStat <StatDef>(v.stat, v.value)); this.destroyable = d.destroyable; this.rotatable = d.rotatable; this.smallVolume = d.smallVolume; this.useHitPoints = d.useHitPoints; this.receivesSignals = d.receivesSignals; this.smeltable = d.smeltable; this.randomizeRotationOnSpawn = d.randomizeRotationOnSpawn; this.isTechHediff = d.isTechHediff; this.isUnfinishedThing = d.isUnfinishedThing; this.leaveResourcesWhenKilled = d.leaveResourcesWhenKilled; this.isFrameInt = d.isFrameInt; this.hasInteractionCell = d.hasInteractionCell; this.interactionCellIconReverse = d.interactionCellIconReverse; this.forceDebugSpawnable = d.forceDebugSpawnable; this.intricate = d.intricate; this.scatterableOnMapGen = d.scatterableOnMapGen; this.deepCommonality = d.deepCommonality; this.deepCountPerCell = d.deepCountPerCell; this.deepCountPerPortion = d.deepCountPerPortion; this.generateCommonality = d.generateCommonality; this.generateAllowChance = d.generateAllowChance; this.canOverlapZones = GetCanOverlapZones(d); this.alwaysFlee = d.alwaysFlee; this.drawOffscreen = d.drawOffscreen; this.hideAtSnowDepth = d.hideAtSnowDepth; this.drawDamagedOverlay = d.drawDamagedOverlay; this.castEdgeShadows = d.castEdgeShadows; this.staticSunShadowHeight = d.staticSunShadowHeight; this.selectable = d.selectable; this.neverMultiSelect = d.neverMultiSelect; this.isAutoAttackableMapObject = d.isAutoAttackableMapObject; this.hasTooltip = d.hasTooltip; this.seeThroughFog = d.seeThroughFog; this.drawGUIOverlay = d.drawGUIOverlay; this.resourceReadoutPriority = d.resourceReadoutPriority; this.resourceReadoutAlwaysShow = d.resourceReadoutAlwaysShow; this.drawPlaceWorkersWhileSelected = d.drawPlaceWorkersWhileSelected; this.uiIconScale = d.uiIconScale; this.alwaysHaulable = d.alwaysHaulable; this.designateHaulable = d.designateHaulable; this.mineable = d.mineable; this.socialPropernessMatters = d.socialPropernessMatters; this.stealable = d.stealable; this.saveCompressible = d.saveCompressible; this.isSaveable = d.isSaveable; this.holdsRoof = d.holdsRoof; this.fillPercent = d.fillPercent; this.coversFloor = d.coversFloor; this.neverOverlapFloors = d.neverOverlapFloors; this.surfaceType = d.surfaceType; this.blockPlants = d.blockPlants; this.blockLight = d.blockLight; this.blockWind = d.blockWind; this.tradeability = d.tradeability; this.tradeNeverStack = d.tradeNeverStack; this.equippedAngleOffset = d.equippedAngleOffset; this.equipmentType = d.equipmentType; this.techLevel = d.techLevel; this.destroyOnDrop = d.destroyOnDrop; this.drawerType = d.drawerType; Util.AssignDefStat(d.slagDef, out this.slagDef); Util.AssignDefStat(d.interactionCellIcon, out this.interactionCellIcon); Util.AssignDefStat(d.filthLeaving, out this.filthLeaving); Util.AssignDefStat(d.minifiedDef, out this.minifiedDef); Util.AssignDefStat(d.soundDrop, out this.soundDrop); Util.AssignDefStat(d.soundPickup, out this.soundPickup); Util.AssignDefStat(d.soundInteract, out this.soundInteract); Util.AssignDefStat(d.soundImpactDefault, out this.soundImpactDefault); Util.AssignDefStat(d.entityDefToBuild, out this.entityDefToBuild); if (d.apparel != null) { this.apparel = new ApparelPropertiesStats(Def.apparel); } if (d.deepLumpSizeRange != null) { this.deepLumpSizeRange = new MinMaxIntStats(Def.deepLumpSizeRange); } if (d.interactionCellOffset != null) { this.interactionCellOffset = new IntVec3Stats(Def.interactionCellOffset); } if (d.startingHpRange != null) { this.startingHpRange = new MinMaxFloatStats(Def.startingHpRange); } if (d.graphicData != null) { this.graphicData = new GraphicDataStats(Def.graphicData); } if (d.ingestible != null) { this.ingestible = new IngestiblePropertiesStats(Def.ingestible); } if (d.filth != null) { this.filth = new FilthPropertiesStats(Def.filth); } if (d.gas != null) { this.gas = new GasPropertiesStats(Def.gas); } if (d.building != null) { this.building = new BuildingPropertiesStats(Def.building); } if (d.race != null) { this.race = new RacePropertiesStats(Def.race); } if (d.mote != null) { this.mote = new MotePropertiesStats(Def.mote); } if (d.plant != null) { this.plant = new PlantPropertiesStats(Def.plant); } if (d.stuffProps != null) { this.stuffProps = new StuffPropertiesStats(Def.stuffProps); } if (d.skyfaller != null) { this.skyfaller = new SkyfallerPropertiesStats(Def.skyfaller); } Util.Populate(out this.thingCategories, Def.thingCategories, (v) => new DefStat <ThingCategoryDef>(v)); Util.Populate(out this.killedLeavings, Def.killedLeavings, (v) => new IntValueDefStat <ThingDef>(v.thingDef, v.count)); Util.Populate(out this.butcherProducts, Def.butcherProducts, (v) => new IntValueDefStat <ThingDef>(v.thingDef, v.count)); Util.Populate(out this.smeltProducts, Def.smeltProducts, (v) => new IntValueDefStat <ThingDef>(v.thingDef, v.count)); Util.Populate(out this.damageMultipliers, Def.damageMultipliers, (v) => new FloatValueDefStat <DamageDef>(v.damageDef, v.multiplier)); Util.Populate(out this.thingSetMakers, Def.thingSetMakerTags); Util.Populate(out this.comps, Def.comps, (v) => v.compClass.FullName); Util.Populate(out this.tradeTags, Def.tradeTags); Util.Populate(out this.weaponTags, Def.weaponTags); Util.Populate(out this.techHediffsTags, Def.techHediffsTags); }
public static void ResetLastDrawerData() { lastPropertyUsedCustomDrawer = false; lastPropertyDrawer = null; lastPropertyDrawerType = DrawerType.None; }