public override void ExtraInit(GraphicRequest req, GraphicExtraData extraData) { base.ExtraInit(req, extraData); if (extraData == null) { Log.Error("PRF: invalid XML for conveyor Splitter's graphic:\n" + " it must have <texPath>[extraData]...[texPath2]path/to/building[/texPath2]</texPath>\n" + " but has string: " + req.path); return; } string doorBasePath = extraData.texPath2; splitterBuildingDoorOpen = new GraphicData { graphicClass = typeof(Graphic_Single), texPath = doorBasePath + "_Open", drawSize = Vector2.one }; splitterBuildingDoorClosed = new GraphicData { graphicClass = typeof(Graphic_Single), texPath = doorBasePath + "_Closed", drawSize = Vector2.one }; splitterBuildingBlueprint = new GraphicData { graphicClass = typeof(Graphic_Single), texPath = doorBasePath + "_Blueprint", drawSize = Vector2.one }; }
private static ThingDef GenerateNewDef(Def mDef, string desc, string label, GraphicData gData) { return(new ThingDef { defName = GENOME_PREAMBLE + mDef.defName + "_Implicit", label = label, description = desc, resourceReadoutPriority = ResourceCountPriority.Middle, category = ThingCategory.Item, thingClass = typeof(ThingWithComps), alwaysHaulable = true, thingCategories = new List <ThingCategoryDef> { PMThingCategoryDefOf.PM_MutationGenome }, graphicData = gData, useHitPoints = true, selectable = true, thingSetMakerTags = new List <string> { GENOME_SET_MAKER_TAG }, altitudeLayer = AltitudeLayer.Item, tickerType = TickerType.Never, rotatable = false, pathCost = DefGenerator.StandardItemPathCost, drawGUIOverlay = true, modContentPack = mDef.modContentPack, tradeTags = new List <string> { GENOME_TRADER_TAGS }, }); }
public static void PostFix(Thing t, Color newColor, bool reportFailure = true) { if (t.def.IsApparel && t.def.defName.StartsWith("CASFlak")) { CompColorable compColorable = ThingCompUtility.TryGetComp <CompColorable>(t); if (compColorable != null) { ThingDef def = t.def; bool flag; if (def == null) { flag = false; } else { GraphicData graphicData = def.graphicData; Color? color = (graphicData != null) ? new Color?(graphicData.color) : null; flag = (color != null); } if (flag) { Color color2 = t.def.graphicData.color; compColorable.Color = color2; } } } }
public override void ExtraInit(GraphicRequest req, GraphicExtraData extraData) { base.ExtraInit(req, extraData); if (extraData == null) { Log.Error("PRF's Wall Conveyor graphic requires GraphicExtraData"); } else { transitionWest = new GraphicData { graphicClass = typeof(Graphic_Single), texPath = extraData.texPath2 + "_West", drawSize = Vector2.one }; transitionSouth = new GraphicData { graphicClass = typeof(Graphic_Single), texPath = extraData.texPath2 + "_South", drawSize = Vector2.one }; transitionEast = new GraphicData { graphicClass = typeof(Graphic_Single), texPath = extraData.texPath2 + "_East", drawSize = Vector2.one }; sameLinkDefs = extraData.specialLinkDefs; } }
public GameObject(String id, Point position) { GameObjectData data = Game.Manager.Resources.GameObjectDatas[id]; Graphic = GraphicData.GenerateGraphic(data.GraphicId); Position = new Rectangle(position, data.Size); }
public DefenceDiagramSettingsVm(List <string> variableParametersValueStr) { _mineConfig = IoC.Resolve <MineConfig>(); //_parameters = parameter; //variableParametersValueStr = IoC.Resolve<MineConfig>().ParametersConfig.VariableParametersValue; variableParametersValue = new double[variableParametersValueStr.Count()]; for (int i = 0; i < variableParametersValueStr.Count(); i++) { variableParametersValue[i] = Convert.ToDouble(variableParametersValueStr[i], CultureInfo.GetCultureInfo("en-US")); } _points = 20; HzCrossHkDown = 0; HzCrossHkUp = 0; vVeight = new double[_points]; vPeople = new double[_points]; vEquipment = new double[_points]; vRevision = new double[_points]; hzVeightDown = new double[_points]; hzPeopleDown = new double[_points]; hzEquipmentDown = new double[_points]; hzRevision = new double[_points]; hzVeightUp = new double[_points]; hzPeopleUp = new double[_points]; hzEquipmentUp = new double[_points]; hkVeightDown = new double[_points]; hkPeopleDown = new double[_points]; hkEquipmentDown = new double[_points]; hkRevision = new double[_points]; hkVeightUp = new double[_points]; hkPeopleUp = new double[_points]; hkEquipmentUp = new double[_points]; DiagramVeight = new GraphicData[(2 * _points)]; for (int i = 0; i < (2 * _points); i++) { DiagramVeight[i] = new GraphicData(); } DiagramPeople = new GraphicData[(2 * _points)]; for (int i = 0; i < (2 * _points); i++) { DiagramPeople[i] = new GraphicData(); } DiagramEquipment = new GraphicData[(2 * _points)]; for (int i = 0; i < (2 * _points); i++) { DiagramEquipment[i] = new GraphicData(); } DiagramRevision = new GraphicData[_points]; for (int i = 0; i < _points; i++) { DiagramRevision[i] = new GraphicData(); } InitV(); SolveHz(); SolveHk(); CheckHz(); SolveDiagramData(); InverseHzAndV(); SolveHzWithEdges(); }
public override void ExtraInit(GraphicRequest req, GraphicExtraData extraData) { Debug.Warning(Debug.Flag.ConveyorGraphics, "Graphics ExtraInit for Graphic_LinkedConveyorWall: (" + req.graphicData.texPath + ")"); base.ExtraInit(req, extraData); if (extraData == null) { Log.Error("PRF's Wall Conveyor graphic requires GraphicExtraData"); } else if (extraData.graphicData1 == null) { Log.Error("PRF's Wall Conveyor grahpic requires GraphicExtraData's graphicData1"); } else { transitionGData = new GraphicData(); transitionGData.CopyFrom(extraData.graphicData1); // If this throws errors, that's okay - it's a config error that needs to be fixed: // NOTE: this can be changed later if the graphics needs to allow multilpe defs, // not all of which may be actually listed... sameLinkDefs = new List <ThingDef>(extraData.specialLinkDefs.Select( s => DefDatabase <ThingDef> .GetNamed(s))); Debug.Message(Debug.Flag.ConveyorGraphics, " added sameLinkDefs: " + (sameLinkDefs == null ? "null" : String.Join(", ", sameLinkDefs))); } }
private void DrawBackground(Building_RogueAI parent) { CompProperties_Overlays.GraphicOverlay background = Props.background; GraphicData gdRogueAI = background.graphicDataDefault; gdRogueAI.Graphic.Draw(parent.DrawPos + new Vector3(0, -1, 0), parent.Rotation, parent, 0f); }
private GraphicData GetPackageGraphicData(OrderPositionData opd) { // Получаем идентификаторы графиков позиций пакета var graphicIds = opd.Childs .SelectMany(c => c.GraphicsData) .Select(g => g.Id); // Находим минимальную дату выхода позиций пакета // с поставщиком пакета var minOutDate = _context.Graphics .Where(g => graphicIds.Contains(g.Id) && g.SupplierId == opd.SupplierId) .Min(g => g.OutDate); // Находим график выхода пакета - его дата выхода меньше // или равна миминальной дате выхода позиций пакета var graphic = _context.Graphics .Where(g => g.SupplierId == opd.SupplierId && g.PricePositionTypeId == opd.FormatData.FormatTypeId && g.OutDate <= minOutDate) .OrderByDescending(g => g.OutDate) .First(); var graphicData = new GraphicData { Id = graphic.Id, Childs = new List <int>() }; return(graphicData); }
/// <summary> /// Initialisation /// </summary> public Iterate(int width, int height) { _gData = new GraphicData(width, height); _pData = new PictureData(width, height); this._width = width; this._height = height; }
/// <summary> /// call Generate(m_act_val, m_zyklen, m_raster, m_screensize, m_formula, m_perspective) auf. /// </summary> protected void Start() { Generate(_actVal, _cycles, _screensize, _formula, _perspective); lock (_startCountLock) { _startCount--; } if (_startCount == 0) { if (_starter != null) { if (_abort) { if (_oldData != null) { _gData = _oldData; } if (_oldPictureData != null) { _pData = _oldPictureData; } } System.Diagnostics.Debug.WriteLine("Iter ends"); _start = false; _starter.ComputationEnds(); } } }
IEnumerator HideGraphic(GraphicData data) { //yield return new WaitForSeconds(fadeDelay); //data.originalActive = data.graphic.gameObject.activeSelf; //while (color.a > fadeOpacity) //{ // color.a -= fadeSpeed * Time.deltaTime; // data.graphic.color = color; // yield return null; //} yield return(new WaitForSeconds(fadeDelay)); Color color = data.graphic.color; data.originalOpacity = color.a; float start = color.a; float end = fadeOpacity; for (float t = 0f; t < fadeTime; t += Time.deltaTime) { float normalizedTime = t / fadeTime; color.a = Mathf.Lerp(start, end, normalizedTime); data.graphic.color = color; yield return(null); } color.a = end; data.graphic.color = color; }
public static TriColorGraphic Get( System.Type graphicClass, string path, Shader shader, Vector2 drawSize, Color color, Color colorTwo, Color colorThree, GraphicData data, List <ShaderParameter> shaderParameters) { TriColorGraphicRequest req = new TriColorGraphicRequest(graphicClass, path, shader, drawSize, color, colorTwo, colorThree, data, 0, shaderParameters); if (req.graphicClass == typeof(Graphic_Multi)) { return((TriColorGraphic)TriColorGraphicDatabase.GetInner <TriColorGraphic_Multi>(req)); } try { return((TriColorGraphic)GenGeneric.InvokeStaticGenericMethod(typeof(TriColorGraphicDatabase), req.graphicClass, "GetInner", (object)req)); } catch (Exception ex) { Log.Error("Exception getting " + (object)graphicClass + " at " + path + ": " + ex.ToString(), false); } return((TriColorGraphic)BaseContent.BadGraphic); }
/// <summary> /// Redirect Init calls from GraphicData to GraphicDataRGB /// </summary> /// <param name="__instance"></param> public static bool RGBInitRedirect(GraphicData __instance) { if (__instance is GraphicDataRGB graphicDataRGB) { graphicDataRGB.Init(); return(false); } return(true); }
/// <summary> /// Initialisation /// </summary> public Iterate(int width, int height, IAsyncComputationStarter starter, bool isRightView) { _starter = starter; _gData = new GraphicData(width, height); _pData = new PictureData(width, height); this._width = width; this._height = height; this._isRightView = isRightView; }
public Iterate(ParameterDict parameterDict, IAsyncComputationStarter starter, bool isRightView = false) { _parameterDict = parameterDict; _starter = starter; _width = parameterDict.GetWidth(); _height = parameterDict.GetHeight(); _gData = new GraphicData(_width, _height); _pData = new PictureData(_width, _height); this._isRightView = isRightView; }
public static void graphicsParser(ManagementObjectSearcher searcher) { GraphicAdapters myList = new GraphicAdapters(); foreach (ManagementObject queryObj in searcher.Get()) { Adapter currentItem = new Adapter(queryObj); myList.adptersList.Add(currentItem); } GraphicData.EventHandler(myList); }
private void DrawEye(Building_RogueAI parent) { CompProperties_Overlays.GraphicOverlay overlay = Props.GetEyeOverlay(parent.goingRogue ? Building_RogueAI.Mood.Mad : parent.CurMoodCategory); GraphicData gdEye = overlay.graphicDataDefault; Vector3 drawPosEye = parent.DrawPos; drawPosEye.y += 0.046875f; drawPosEye += overlay.offsetDefault; SetAnimationOffset(ref drawPosEye); gdEye.Graphic.Draw(drawPosEye, parent.Rotation, parent, 0f); }
public StatDef ResistHediffStat = null; //The default chance of adding a hediff. void CreateGraphics() { if (this.graphicData.graphicClass == typeof(Graphic_Random) || this.graphicData.graphicClass == typeof(Graphic_Flicker)) { for (int i = 0; i < textures.Count; i++) { List <Texture2D> list = (from x in ContentFinder <Texture2D> .GetAllInFolder(textures[i]) where !x.name.EndsWith(Graphic_Single.MaskSuffix) orderby x.name select x).ToList <Texture2D>(); if (list.NullOrEmpty <Texture2D>()) { Log.Error("Collection cannot init: No textures found at path " + textures[i], false); } for (int ii = 0; ii < list.Count; ii++) { GraphicData data = new GraphicData(); data.CopyFrom(this.graphicData); data.texPath = textures[i]; materials.Add(data.Graphic.MatSingle); // materials.Add(MaterialPool.MatFrom(textures[i] + "/" + list[ii].name, this.graphicData.shaderType.Shader, MapMaterialRenderQueues.OrbitalBeam)); } } } else { for (int i = 0; i < textures.Count; i++) { GraphicData data = new GraphicData(); data.CopyFrom(this.graphicData); data.texPath = textures[i]; materials.Add(data.Graphic.MatSingle); // materials.Add(MaterialPool.MatFrom(textures[i], this.graphicData.shaderType.Shader, MapMaterialRenderQueues.OrbitalBeam)); } } if (flareData != null) { GraphicData data = new GraphicData(); data.CopyFrom(this.flareData); flareMat = data.Graphic.MatSingle; // flareMat = MaterialPool.MatFrom(flareMatPath, this.flareShaderType?.Shader ?? this.graphicData.shaderType.Shader, MapMaterialRenderQueues.OrbitalBeam); } else if (!flareMatPath.NullOrEmpty()) { GraphicData data = new GraphicData(); data.CopyFrom(this.graphicData); data.graphicClass = typeof(Graphic_Single); data.texPath = flareMatPath; data.shaderType = this.flareShaderType ?? this.graphicData.shaderType; flareMat = data.Graphic.MatSingle; // flareMat = MaterialPool.MatFrom(flareMatPath, this.flareShaderType?.Shader ?? this.graphicData.shaderType.Shader, MapMaterialRenderQueues.OrbitalBeam); } }
public override void SpawnSetup(Map map, bool respawningAfterLoad) { base.SpawnSetup(map, respawningAfterLoad); //this.main_graphic = this.ageTracker.CurKindLifeStage.bodyGraphicData.texPath; this.pawn_renderer = ((Pawn_DrawTracker)typeof(Pawn).GetField("drawer", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(this)).renderer; GraphicData dessicatedgraphicdata = new GraphicData(); dessicatedgraphicdata.texPath = "Things/Pawn/Animal/AA_ChameleonYak/AA_Dessicated_ChameleonYak"; dessicatedGraphic = dessicatedgraphicdata.Graphic; this.ChangeTheGraphics(); }
public GraphicVaVm(Parameters parameter) { _parameters = parameter; Graphic = new GraphicData[3]; for (int i = 0; i < 3; i++) { Graphic[i] = new GraphicData(); } SolveNewGraphicPoint(); }
public void BoundShouldBeWidthAndHeightEqualZero() { //arrange var data = new GraphicData(); //act var result = validator.Validate(data); var err = result.Errors.FirstOrDefault(p => p.PropertyName == "Bounds"); //assert Assert.NotNull(err); }
// Token: 0x06000036 RID: 54 RVA: 0x000031C4 File Offset: 0x000013C4 public Graphic GetColoredVersion(ShaderTypeDef newShaderType, Color newColor, Color newColorTwo, ShadowData newShadowData) { var graphicData = new GraphicData(); graphicData.CopyFrom(data); graphicData.shaderType = newShaderType; graphicData.color = newColor; graphicData.colorTwo = newColorTwo; graphicData.shadowData = newShadowData; return(graphicData.Graphic); }
void AddToGraphicDict(IEnumerable <Graphic> graphics) { foreach (var g in graphics) { var data = new GraphicData { originalOpacity = g.color.a, originalActive = g.gameObject.activeSelf, graphic = g }; _graphicSet.Add(data); } }
/* * public static AvaliGraphic Get<T>(string path) where T : AvaliGraphic, new() * { * return (AvaliGraphic)AvaliGraphicDatabase.GetInner<T>(new AvaliGraphicRequest(typeof(T), path, ShaderDatabase.Cutout, Vector2.one, Color.white, Color.white, Color.white, (GraphicData)null, 0, (List<ShaderParameter>)null)); * } * * public static AvaliGraphic Get<T>(string path, Shader shader) where T : AvaliGraphic, new() * { * return (AvaliGraphic)AvaliGraphicDatabase.GetInner<T>(new AvaliGraphicRequest(typeof(T), path, shader, Vector2.one, Color.white, Color.white, Color.white, (GraphicData)null, 0, (List<ShaderParameter>)null)); * } * * public static AvaliGraphic Get<T>(string path, Shader shader, Vector2 drawSize, Color color) where T : AvaliGraphic, new() * { * return (AvaliGraphic)AvaliGraphicDatabase.GetInner<T>(new AvaliGraphicRequest(typeof(T), path, shader, drawSize, color, Color.white, Color.white, (GraphicData)null, 0, (List<ShaderParameter>)null)); * } * * public static AvaliGraphic Get<T>( * string path, * Shader shader, * Vector2 drawSize, * Color color, * int renderQueue) * where T : AvaliGraphic, new() * { * return (AvaliGraphic)AvaliGraphicDatabase.GetInner<T>(new AvaliGraphicRequest(typeof(T), path, shader, drawSize, color, Color.white, Color.white, (GraphicData)null, renderQueue, (List<ShaderParameter>)null)); * } * * public static AvaliGraphic Get<T>( * string path, * Shader shader, * Vector2 drawSize, * Color color, * Color colorTwo, * Color colorThree) * where T : AvaliGraphic, new() * { * return (AvaliGraphic)AvaliGraphicDatabase.GetInner<T>(new AvaliGraphicRequest(typeof(T), path, shader, drawSize, color, colorTwo, colorThree, (GraphicData)null, 0, (List<ShaderParameter>)null)); * } * public static AvaliGraphic Get<T>( * string path, * Shader shader, * Vector2 drawSize, * Color color, * Color colorTwo) * where T : AvaliGraphic, new() * { * return (AvaliGraphic)AvaliGraphicDatabase.GetInner<T>(new AvaliGraphicRequest(typeof(T), path, shader, drawSize, color, colorTwo, Color.white, (GraphicData)null, 0, (List<ShaderParameter>)null)); * } */ public static TriColorGraphic Get <T>( string path, Shader shader, Vector2 drawSize, Color color, Color colorTwo, Color colorThree, GraphicData data) where T : TriColorGraphic, new() { return((TriColorGraphic)TriColorGraphicDatabase.GetInner <T>(new TriColorGraphicRequest(typeof(T), path, shader, drawSize, color, colorTwo, colorThree, data, 0, (List <ShaderParameter>)null))); }
public void PolygonShouldBeNull() { //arrange var data = new GraphicData(); //act var result = validator.Validate(data); var err = result.Errors.FirstOrDefault(p => p.PropertyName == "Polygon"); //assert Assert.NotNull(err); }
private static ThingDef GenerateMutationGenome([NotNull] MutationCategoryDef mDef) { string desc = GetGenomeDesc(mDef); string label = LABEL_TTAG.Translate(mDef.Named("MUTATION")); GraphicData gData = GenerateGenomeGraphicData(mDef); ThingDef tDef = GenerateNewDef(mDef, desc, label, gData); SetGenomeStats(tDef, mDef); AddComps(tDef, mDef); return(tDef); }
public static GraphicData FogBlueprintGraphicFor(GraphicData baseGraphicData) { int hashKey = Gen.HashCombine <GraphicData>(0, baseGraphicData); GraphicData graphicData; if (!fogGraphics.TryGetValue(hashKey, out graphicData)) { graphicData = new GraphicData(); graphicData.CopyFrom(baseGraphicData); graphicData.shaderType = ShaderTypeDefOf.MetaOverlay; fogGraphics.Add(hashKey, graphicData); } return(graphicData); }
public override void PostDraw() { base.PostDraw(); if (!isInitialized) { graphicData = new GraphicData(); graphicData.texPath = Props.graphicData.texPath; graphicData.graphicClass = Props.graphicData.graphicClass; graphicData.drawSize = new Vector2() { x = ModSettingGetter.xDrawSize, y = ModSettingGetter.yDrawSize }; if (parent is ThingWithComps thingWithComps && thingWithComps.TryGetComp <CompQuality>() is CompQuality compQuality) { switch (compQuality.Quality) { case QualityCategory.Awful: graphicData.color = new Color(1f, 1f, 1f); // white break; case QualityCategory.Poor: graphicData.color = new Color(0.4f, 1f, 0.2f); // green break; case QualityCategory.Normal: graphicData.color = new Color(0f, 0f, 1f); // blue break; case QualityCategory.Good: graphicData.color = new Color(0.6f, 0.2f, 0.6f); // purple break; case QualityCategory.Excellent: graphicData.color = new Color(1f, 0.6f, 0f); // orange break; case QualityCategory.Masterwork: graphicData.color = new Color(1f, 0.2f, 0.8f); // pink break; case QualityCategory.Legendary: graphicData.color = new Color(0f, 1f, 1f); // cyan break; } } isInitialized = true; } graphicData.Graphic.Draw(parent.DrawPos + new Vector3(0f, 2f, 0.5f * graphicData.Graphic.drawSize.y), Rot4.North, parent); }
public void BoundShouldBeWidthAndHeightMoreThanZero() { //arrange var data = new GraphicData { Bounds = new RectangleF(0, 0, 1, 1) }; //act var result = validator.Validate(data); var err = result.Errors.FirstOrDefault(p => p.PropertyName == "Bounds"); //assert Assert.Null(err); }