private void FindNearestPixelInRing(Point2 coor, ref int nearestPixel, out int previous) { var wasNearestPixel = nearestPixel; if (ColorsManager.FindNearest( coor.X, P => Pixels[P].X, false, PrecisionGrad, nearestPixel + HealpixManager.PixelsCountInRing(Pixels[nearestPixel].Ring), ref nearestPixel)) // todo add approximation { previous = nearestPixel; } else { previous = nearestPixel - 1; if (nearestPixel == Pixels.Length || Pixels[nearestPixel].PixelInRing == 1 /*next ring*/) { var pixelsInRing = HealpixManager.PixelsCountInRing(Pixels[wasNearestPixel].Ring); if (wasNearestPixel == nearestPixel) { previous += pixelsInRing; } else { nearestPixel -= pixelsInRing; } } } }
private void ApplyStyleFont(ExcelChartStyleEntry section, int indexForColor, IDrawingStyle chartPartWithFont, int numberOfItems) { if (section.HasTextBody) { chartPartWithFont.TextBody.SetFromXml(section.DefaultTextBody.PathElement); } if (section.HasTextRun) { chartPartWithFont.Font.SetFromXml(section.DefaultTextRun.PathElement); } if (section.FontReference.HasColor) { chartPartWithFont.Font.Fill.Style = eFillStyle.SolidFill; if (section.FontReference.Color.ColorType == eDrawingColorType.ChartStyleColor) { ColorsManager.Transform(section.FontReference.Color, indexForColor == -1 ? 0 : indexForColor, numberOfItems); } chartPartWithFont.Font.Fill.SolidFill.Color.ApplyNewColor(section.FontReference.Color); } if (section.FontReference.Index != eThemeFontCollectionType.None) { chartPartWithFont.Font.LatinFont = $"+{(section.FontReference.Index == eThemeFontCollectionType.Minor ? "mn" : "mj")}-lt"; chartPartWithFont.Font.EastAsianFont = $"+{(section.FontReference.Index == eThemeFontCollectionType.Minor ? "mn" : "mj")}-ea"; chartPartWithFont.Font.ComplexFont = $"+{(section.FontReference.Index == eThemeFontCollectionType.Minor ? "mn" : "mj")}-cs"; } }
/// <summary> /// also sets Colors /// /// good to override InitAltitudes(...) but seems not possible /// </summary> internal void InitPoints(Point2[] pixels, bool isGrey) { ColorsManager colorsManager = null; switch (_map.Projection) { case Projection.Healpix: case Projection.Healpix2Equirectangular: /*mean min, nax will be calculated later */ colorsManager = InitAltitudes(ApproxMan.Pixels, isGrey); break; case Projection.Equirectangular: /*min and max may not be precalculated*/ double?min = MinDefault, max = MaxDefault; if (min == null || max == null) { // slow? var pix = (from pixel in pixels select new HealCoor(Equirectangular.CoorFromXY(pixel, _map.YResolution, HealpixManager)) ).ToArray(); colorsManager = InitAltitudes(pix, isGrey); } break; } colorsManager.SetScales(_map.ColorsAbove, _map.ColorsUnder); }
private void OnCollisionEnter(Collision collision) { var ingredient = collision.gameObject.GetComponent <PickableObject>(); if (ingredient && !ingredient.IsHeld()) { var ingredientType = collision.gameObject.GetComponentInChildren <IngredientType>(); var thrower = ingredient.ThrownIntentionallyBy(); if (thrower && thrower.Equals(m_owner) && ingredientType && ShouldAcceptIngredient(ingredientType.m_type)) { OnCollectIngredient(); m_storedIngredient = ingredientType.m_type; Destroy(collision.gameObject); var nextMinigame = Random.Range(0, m_miniGames.Length); m_miniGames[nextMinigame].StartMinigame(); } else { var burst = Instantiate(HitPrefab, collision.GetContact(0).point, Quaternion.LookRotation(collision.GetContact(0).normal)); var burstMat = burst.gameObject.GetComponentInChildren <ParticleSystemRenderer>().material; var trailMat = burst.gameObject.GetComponentInChildren <ParticleSystemRenderer>().trailMaterial; burstMat.SetColor("_EmissionColor", ColorsManager.Get().PlayerForceFieldColors[m_owner.ID]); trailMat.SetColor("_EmissionColor", ColorsManager.Get().PlayerForceFieldColors[m_owner.ID]); StartCoroutine(DestroyWhenComplete(burst)); } ingredient.ResetAimAssist(); } }
private void TransformColor(ExcelDrawingColorManager color, ExcelChartStyleColorManager templateColor, int colorIndex, int numberOfItems) { if (templateColor != null && templateColor.ColorType == eDrawingColorType.ChartStyleColor && color.ColorType == eDrawingColorType.Scheme && color.SchemeColor.Color == eSchemeColor.Style) { ColorsManager.Transform(color, templateColor.StyleColor.Index ?? colorIndex, numberOfItems); } else if (color.ColorType == eDrawingColorType.Scheme && color.SchemeColor.Color == eSchemeColor.Style) { ColorsManager.Transform(color, colorIndex, numberOfItems); } }
public void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
public override IEnumerator SpellImplementation() { var targetPlayer = m_mainManager.GetPlayerById(_TargetedPlayer.id); var gift = Instantiate(m_giftPrefab, targetPlayer.transform.position + new Vector3(0, 2, -2), new Quaternion(0, 0, 0, 0)); var giftComponent = gift.GetComponent <Gift>(); giftComponent.SetIngredientType(Ingredient.NOT_AN_INGREDIENT); giftComponent.SetContents(m_bombPrefab); giftComponent.SetColor(ColorsManager.Get().PlayerGiftColors[_TargetedPlayer.id]); giftComponent.SetFollowTarget(targetPlayer.transform); yield return(null); }
public void OnPotionComplete(ARecipeManager cauldron) { var potionObj = Instantiate(m_potionPrefab, cauldron.transform.position + new Vector3(0, 3, 0), Quaternion.identity); var potion = potionObj.GetComponent <FlyingPotion>(); //Set color var liquidColor = ColorsManager.Get().CauldronLiquidColors[cauldron.Owner.ID]; potion.SetColor(liquidColor); //Set Destination potion.SetDestination(m_audienceInterface); }
void InitHUD() { var playersHUDZone = GameObject.FindGameObjectWithTag(Tags.PLAYERS_HUD_ZONE); var instance = Instantiate(_PlayerHUDPrefab, playersHUDZone.transform); Owner.PlayerHUD = instance.GetComponent <PlayerHUD>(); Owner.PlayerHUD.Manager = Owner; Owner.PlayerHUD.OwnerId = Owner.ID; var backdrop = instance.transform.Find("Organizer"); var rect = backdrop.GetComponent <Image>(); rect.color = ColorsManager.Get().CauldronLiquidColors[Owner.ID]; }
// Use this for initialization void Start() { instance = this; walls = GameObject.Find("Walls"); spikesBottom = GameObject.Find("SpikesBottom"); spikesTop = GameObject.Find("SpikesTop"); spikesRight = GameObject.Find("SpikesRight"); spikesLeft = GameObject.Find("SpikesLeft"); background = GameObject.Find("Background"); score = GameObject.Find("Score"); colorWalls = GameObject.Find("WallBottom").GetComponent <SpriteRenderer>().color; colorBackground = background.GetComponent <SpriteRenderer>().color; colorScore = score.GetComponent <Text>().color; }
public Form() { InitializeComponent(); colorDialog.FullOpen = true; _rgb = new RGB(); _cmyk = new CMYK(); _hsv = new HSV(); _manager = new ColorsManager( _rgb, _cmyk, _hsv, resultColorBox); }
/// <summary> /// also sets Colors /// </summary> public ColorsManager InitAltitudes(T[] basins, bool isGrey = false) { double?min = MinDefault, max = MaxDefault; foreach (var basin in basins) { var altitude = GetAltitude((T)basin); basin.Altitude = altitude; // not needed for Projection.Equirectangular if (altitude.HasValue) { CheckMaxMin(altitude.Value, ref min, ref max); } } Colors = new ColorsManager(min.Value, max.Value, ColorsMiddle, isGrey); return(Colors); }
// Override liquid and bubbles colors per player protected override void OnSetOwner(PlayerManager owner) { var liquid = transform.Find("Liquid"); var matOverrideLiquid = liquid.gameObject.AddComponent <gfx.MaterialOverride>(); var liquidColor = ColorsManager.Get().CauldronLiquidColors[owner.ID]; matOverrideLiquid.Entries.Add(new gfx.MaterialOverride.Entry("_Color", liquidColor)); matOverrideLiquid.Apply(); var bubbles = transform.Find("Bubbles"); var matOverrideBubbles = bubbles.gameObject.AddComponent <gfx.MaterialOverride>(); var bubblesColor = ColorsManager.Get().CauldronBubblesColors[owner.ID]; matOverrideBubbles.Entries.Add(new gfx.MaterialOverride.Entry("_EmissionColor", bubblesColor)); matOverrideBubbles.Apply(); }
protected string SaveBitmap(Bitmap bmp, ColorsManager colors, int accuracy, int step = 0) { if (!Directory.Exists(Dir)) { Directory.CreateDirectory(Dir); } var filename = string.Format( "{1}{0}{5}min{4}{3}.{2}", step == 0 ? null : step.ToString("0000") + "_", colors.IsGrey ? "grey" : null, ImageFormat.ToString().ToLower(), LegendToDraw ? null : "_nolegend", Projection == Projection.Equirectangular ? "_noHEALPix" : null, accuracy); var path = Path.Combine(Dir, filename); bmp.Save(path, ImageFormat); return(path); }
static public void FillColorsList(DropDownList list1, DropDownList list2) { list1.Items.Clear(); list2.Items.Clear(); var result = new ColorsManager().GetColorsNames(); list1.DataSource = result; list1.DataValueField = "ColorID"; list1.DataTextField = "ColorNameEn"; list1.DataBind(); list1.Items.Insert(0, ""); list2.DataSource = result; list2.DataValueField = "ColorID"; list2.DataTextField = "ColorNameEn"; list2.DataBind(); list2.Items.Insert(0, ""); }
private static void ColorsTest() { ColorsManager colorsManager = new ColorsManager(new EfColorDal()); colorsManager.Add(new Colors { Name = "Red" }); colorsManager.Update(new Colors { Id = 2, Name = "Black" }); colorsManager.Delete(new Colors { Id = 3, Name = "Blue" }); Console.WriteLine("Renk Seçeneklerimiz:"); foreach (var color in colorsManager.GetAll().Data) { Console.WriteLine(color.Name); } }
private void SetBorderColor() { var newLeaderId = GetLeaderId(); if (newLeaderId != m_currentLeaderId) { BordersStartColor = BordersMaterial.color; BordersEndColor = ColorsManager.Get().PlayerBorderColors[newLeaderId]; BordersPlaying = true; BordersStartTime = Time.time; PlayersInstances[newLeaderId].PlayerHUD.GetComponent <GrowShrinkEffect>().Grow(); if (m_currentLeaderId != -1) { PlayersInstances[m_currentLeaderId].PlayerHUD.GetComponent <GrowShrinkEffect>().Shrink(); } m_currentLeaderId = newLeaderId; } }
private static void ColorTest() { ColorsManager colorsManager = new ColorsManager(new EfColorsDal()); colorsManager.Delete(new Colors { ColorsId = 1 }); colorsManager.Add(new Colors { ColorsId = 1, ColorsName = "Eflatun" }); colorsManager.Update(new Colors { ColorsId = 2, ColorsName = "Mor" }); foreach (var colors in colorsManager.GetAll().Data) { Console.WriteLine(colors.ColorsName); } Console.WriteLine("**************************************************************************"); }
public void Get() { var man = new ColorsManager(-100, 100); Assert.AreEqual(ColorsManager.Red, man.Get(1000)); Assert.AreEqual(ColorsManager.DarkBlue, man.Get(-100)); Assert.AreEqual(new Color3(0, 238.1, 254.15), man.Get(-1)); Assert.AreEqual(ColorsManager.Blue, man.Get(0)); Assert.AreEqual(ColorsManager.Red, man.Get(100)); man = new ColorsManager(0, 100, 50); Assert.AreEqual(ColorsManager.Blue, man.Get(50)); Assert.AreEqual(new Color3(0, 145, 212.5), man.Get(25)); Assert.AreEqual(ColorsManager.DarkBlue, man.Get(0)); Assert.AreEqual(ColorsManager.Red, man.Get(100)); man = new ColorsManager(-200, 100, 50); Assert.AreEqual(ColorsManager.Blue, man.Get(50)); Assert.AreEqual(ColorsManager.DarkBlue, man.Get(-200)); Assert.AreEqual(ColorsManager.Red, man.Get(100)); }
PlayerManager InitPlayer() { var player = Instantiate( OwnerId % 2 == 0 ? _MalePrefab : _FemalePrefab, PlayerSpawnPosition, Quaternion.identity); player.transform.forward = -PlayerSpawnPosition; player.transform.SetParent(transform); Owner = player.GetComponent <PlayerManager>(); Owner.ID = OwnerId; Owner.Name = Players.Info[OwnerId].Name; Owner.Texture = ColorsManager.Get().PlayerColorTextures[Owner.ID]; var normalTex = ColorsManager.Get().PlayerNormalTextures[Owner.ID]; if (normalTex != null) { Owner.NormalTexture = normalTex; } var occlusionTex = ColorsManager.Get().PlayerOcclusionTextures[Owner.ID]; if (occlusionTex != null) { Owner.OcclusionTexture = occlusionTex; } var roughnessTex = ColorsManager.Get().PlayerRoughnessTextures[Owner.ID]; if (roughnessTex != null) { Owner.RoughnessTexture = roughnessTex; } Owner.CompletedPotionCount = 0; Owner.CollectedIngredientCount = 0; return(Owner); }
public LevelManager(ColorsManager colorsManager, SignalBus signalBus, AsyncProcessor asyncProcessor) { _colorsManager = colorsManager; _signalBus = signalBus; _asyncProcessor = asyncProcessor; }
/// <summary> /// Render state /// </summary> /// <param name="time"><see cref="GameTime"/></param> public override void Render(GameTime time) { DH.RenderScene(_gameplayScene, _camera, () => { foreach (WorldTile tile in _level.Map) { if (!tile.IsWall) { float distance = (float)Math.Sqrt(Math.Pow(tile.DisplayX - _player.X, 2) + Math.Pow(tile.DisplayY - _player.Y, 2)); float percentage = 1 - (distance < 350 ? 0 : (distance - 350) / 700); DH.Raw(_content.TEXGround.Texture, tile.DisplayX - 16, tile.DisplayY - 16, color: ColorsManager.Get(percentage)); } } if (_config.DebugMode) { foreach (WorldTile tile in _level.Map) { if (tile.Collisions.Contains(CollisionType.Left)) { DH.Line(tile.DisplayX, tile.DisplayY, tile.DisplayX, tile.DisplayY + tile.Size, 8, Color.Red); } if (tile.Collisions.Contains(CollisionType.Right)) { DH.Line(tile.DisplayX + tile.Size, tile.DisplayY, tile.DisplayX + tile.Size, tile.DisplayY + tile.Size, 8, Color.Red); } if (tile.Collisions.Contains(CollisionType.Top)) { DH.Line(tile.DisplayX, tile.DisplayY, tile.DisplayX + tile.Size, tile.DisplayY, 8, Color.Red); } if (tile.Collisions.Contains(CollisionType.Bottom)) { DH.Line(tile.DisplayX, tile.DisplayY + tile.Size, tile.DisplayX + tile.Size, tile.DisplayY + tile.Size, 8, Color.Red); } } } _player.Display(time); }); DH.RenderScene(Scene, () => { DH.Scene(_gameplayScene); DH.Text(_content.GetFont( ), _player.Name, 15, 15, false); // Mini-map UH.Loops(_level.Width, _level.Height, (x, y) => { if (!_level.Map[y * _level.Width + x].IsWall) { DH.Raw(_content.Pixel, _config.ViewWidth - 16 - _level.Width * 4 + x * 4, _config.ViewHeight - 16 - _level.Height * 4 + y * 4, 4, 4, (_player.OnMapX == x && _player.OnMapY == y ? Color.Red : Color.Gray) * .5f ); } }); if (_config.DebugMode) { DH.Text(_debugFont, $"{(int)(1 / time.ElapsedGameTime.TotalSeconds)} FPS", _config.WindowWidth - 10, 10, false, ColorsManager.DarkGray, AlignType.RT); DH.Text(_debugFont, $"Mouse ({_input.MouseX}, {_input.MouseY})", _config.WindowWidth - 10, 25, false, ColorsManager.DarkGray, AlignType.RT); DH.Text(_debugFont, $"Player ({_player.X:0.0}, {_player.Y:0.0}) ({_player.OnMapX}, {_player.OnMapY})", _config.WindowWidth - 10, 40, false, ColorsManager.DarkGray, AlignType.RT); DH.Text(_debugFont, $"Camera ({_camera.Target.X:0.0}, {_camera.Target.Y:0.0})", _config.WindowWidth - 10, 55, false, ColorsManager.DarkGray, AlignType.RT); DH.Text(_debugFont, $"Scale {_camera.Scale:0.00}x", _config.WindowWidth - 10, 70, false, ColorsManager.DarkGray, AlignType.RT); DH.Line(0, _config.WindowHeight / 2, _config.WindowWidth, _config.WindowHeight / 2, 1, ColorsManager.DarkestGray * .5f); DH.Line(_config.WindowWidth / 2, 0, _config.WindowWidth / 2, _config.WindowHeight, 1, ColorsManager.DarkestGray * .5f); } }); }
public void SetReadyActive() { RegularHUD.SetActive(false); ReadyPanel.SetActive(true); ReadyPanelMessage.color = ColorsManager.Get().PlayerMeshColors[Manager.ID]; }
public double GetMeanAltitude(KeyValuePair <int, double>[] deltas) { return(ColorsManager.LinearApproximation(deltas, P => Pixels[P].Altitude.Value)); }
public double GetMeanAltitude(Coor coor, Func <int, double> func) { return(ColorsManager.LinearApproximation(GetDeltas(coor), func)); }
private void SetAvatars() { var avatarContainer = GameObject.Find("Avatars").transform; int rank = 0; int count = 0; bool allCharactersHandled = false; for (int i = 0; i < avatarContainer.childCount; i++) { var a = avatarContainer.GetChild(i); if (!allCharactersHandled) { //Set color and correct model, ignore hair renderers SkinnedMeshRenderer[] tempRenderers = a.GetComponentsInChildren <SkinnedMeshRenderer>(); SkinnedMeshRenderer[] skinRenderers = new SkinnedMeshRenderer[2]; int j = 0; foreach (var r in tempRenderers) { if (r.gameObject.layer != 15) { skinRenderers[j] = r; j++; } } var id = m_finalRankings[rank][count].ID; var model = skinRenderers[id % 2]; model.material.mainTexture = ColorsManager.Get().PlayerColorTextures[id]; var temp = skinRenderers[(id + 1) % 2].transform; while (temp.parent != null) { if (temp.parent.tag == Tags.PLAYER_TAG) { temp.parent.gameObject.SetActive(false); break; } temp = temp.parent.transform; } //Scale based on rank a.gameObject.transform.localScale *= (MaxNumPlayers + 0.5f - rank) / 2.0f; //add 0.5 so the player in 4th is shrunk, not set to 0x scale a.gameObject.transform.position = new Vector3(0, 0, i * 60 - 240); if (rank == 0) { var anim = model.GetComponentInParent <MenuModelAnims>(); anim.Carry(); var trophy = a.transform.Find("trophy"); trophy.gameObject.SetActive(true); } else if (rank == m_finalRankings.Count - 1) { var anim = model.GetComponentInParent <MenuModelAnims>(); anim.Dizzy(); } count++; if (count >= m_finalRankings[rank].Count) { count = 0; rank++; if (rank >= m_finalRankings.Count) { allCharactersHandled = true; } } } else { a.gameObject.SetActive(false); } } }
private void Start() => GetComponentInChildren <Renderer>().material.color = ColorsManager.getStackColor();
public void Init(ColorsManager colorsManager, SignalBus signalBus) { //Debug.Log("PlayerController.Init"); _colorsManager = colorsManager; _signalBus = signalBus; }
public void Init(SignalBus signalBus, ColorsManager colorsManager) { _signalBus = signalBus; _colorsManager = colorsManager; }
public void Init(ColorsManager colorsManager) { //Debug.Log("ColoredGameObject.Init " + gameObject.name); _colorsManager = colorsManager; }