public void LoadColor(ColorID colorID, string themeID) { switch (colorID) { case ColorID.MoonInnerCorona: CurrentMix.Atmosphere.MoonInnerCorona.Load(themeID); break; case ColorID.MoonOuterCorona: CurrentMix.Atmosphere.MoonOuterCorona.Load(themeID); break; case ColorID.SkyTint: CurrentMix.Atmosphere.SkyTint.Load(themeID); break; case ColorID.NightHorizonColor: CurrentMix.Atmosphere.NightHorizonColor.Load(themeID); break; case ColorID.EarlyNightZenithColor: CurrentMix.Atmosphere.EarlyNightZenithColor.Load(themeID); break; case ColorID.LateNightZenithColor: CurrentMix.Atmosphere.LateNightZenithColor.Load(themeID); break; case ColorID.WaterClean: CurrentMix.Water.WaterClean.Load(themeID); break; case ColorID.WaterDirty: CurrentMix.Water.WaterDirty.Load(themeID); break; case ColorID.WaterUnder: CurrentMix.Water.WaterUnder.Load(themeID); break; } SaveLocalMix(); EventUIDirty?.Invoke(this, new UIDirtyEventArgs(CurrentMix)); }
public bool IsSelected(string themeID, ColorID colorID) { switch (colorID) { case ColorID.EarlyNightZenithColor: return(CurrentMix.Atmosphere.EarlyNightZenithColor.IsSelected(themeID)); case ColorID.LateNightZenithColor: return(CurrentMix.Atmosphere.LateNightZenithColor.IsSelected(themeID)); case ColorID.MoonInnerCorona: return(CurrentMix.Atmosphere.MoonInnerCorona.IsSelected(themeID)); case ColorID.MoonOuterCorona: return(CurrentMix.Atmosphere.MoonOuterCorona.IsSelected(themeID)); case ColorID.NightHorizonColor: return(CurrentMix.Atmosphere.NightHorizonColor.IsSelected(themeID)); case ColorID.SkyTint: return(CurrentMix.Atmosphere.SkyTint.IsSelected(themeID)); case ColorID.WaterClean: return(CurrentMix.Water.WaterClean.IsSelected(themeID)); case ColorID.WaterDirty: return(CurrentMix.Water.WaterDirty.IsSelected(themeID)); case ColorID.WaterUnder: return(CurrentMix.Water.WaterDirty.IsSelected(themeID)); default: return(false); } }
internal Color GetColor(ColorID colorID, string themeID) { switch (colorID) { case ColorID.MoonInnerCorona: return(Themes[themeID].moonInnerCorona); case ColorID.MoonOuterCorona: return(Themes[themeID].moonOuterCorona); case ColorID.SkyTint: return(Themes[themeID].skyTint); case ColorID.NightHorizonColor: return(Themes[themeID].nightHorizonColor); case ColorID.EarlyNightZenithColor: return(Themes[themeID].earlyNightZenithColor); case ColorID.LateNightZenithColor: return(Themes[themeID].lateNightZenithColor); case ColorID.WaterClean: return(Themes[themeID].waterClean); case ColorID.WaterDirty: return(Themes[themeID].waterDirty); case ColorID.WaterUnder: return(Themes[themeID].waterUnder); default: return(default); } }
internal static string ColorToTranslationID(ColorID colorID) { switch (colorID) { case ColorID.MoonInnerCorona: return(LABEL_MOONINNERCORONA); case ColorID.MoonOuterCorona: return(LABEL_MOONOUTERCORONA); case ColorID.SkyTint: return(LABEL_SKYTINT); case ColorID.NightHorizonColor: return(LABEL_NIGHTHORIZONCOLOR); case ColorID.EarlyNightZenithColor: return(LABEL_EARLYNIGHTZENITHCOLOR); case ColorID.LateNightZenithColor: return(LABEL_LATENIGHTZENITHCOLOR); case ColorID.WaterClean: return(LABEL_WATERCLEAN); case ColorID.WaterDirty: return(LABEL_WATERDIRTY); case ColorID.WaterUnder: return(LABEL_WATERUNDER); default: return(string.Empty); } }
internal Color GetCurrentColor(ColorID colorID) { switch (colorID) { case ColorID.MoonInnerCorona: return((Color)(CurrentMix.Atmosphere.MoonInnerCorona.CustomValue ?? CurrentMix.Atmosphere.MoonInnerCorona.Value)); case ColorID.MoonOuterCorona: return((Color)(CurrentMix.Atmosphere.MoonOuterCorona.CustomValue ?? CurrentMix.Atmosphere.MoonOuterCorona.Value)); case ColorID.SkyTint: return((Color)(CurrentMix.Atmosphere.SkyTint.CustomValue ?? CurrentMix.Atmosphere.SkyTint.Value)); case ColorID.NightHorizonColor: return((Color)(CurrentMix.Atmosphere.NightHorizonColor.CustomValue ?? CurrentMix.Atmosphere.NightHorizonColor.Value)); case ColorID.EarlyNightZenithColor: return((Color)(CurrentMix.Atmosphere.EarlyNightZenithColor.CustomValue ?? CurrentMix.Atmosphere.EarlyNightZenithColor.Value)); case ColorID.LateNightZenithColor: return((Color)(CurrentMix.Atmosphere.LateNightZenithColor.CustomValue ?? CurrentMix.Atmosphere.LateNightZenithColor.Value)); case ColorID.WaterClean: return((Color)(CurrentMix.Water.WaterClean.CustomValue ?? CurrentMix.Water.WaterClean.Value)); case ColorID.WaterDirty: return((Color)(CurrentMix.Water.WaterDirty.CustomValue ?? CurrentMix.Water.WaterDirty.Value)); case ColorID.WaterUnder: return((Color)(CurrentMix.Water.WaterUnder.CustomValue ?? CurrentMix.Water.WaterUnder.Value)); default: return(default); } }
public static void SetBoardColorGoal(int hexagonID, ColorID seedColorID) { if (!State.gameBoard.presetBoard.ContainsKey(hexagonID)) { State.gameBoard.presetBoard.Add(hexagonID, (int)seedColorID); ActorGridManager.SetHexagonGoalColor(hexagonID, seedColorID); } }
public static void SetHexagonHoverColor(int hexagonID, ColorID colorID) { ActorHexagon target = GetHexagonActor(hexagonID); if (target != null) { target.SetHoverColor(colorID); } }
public Player(ActorHexagon h, ColorID c) { hexagon = h; color = c; nextMoveTime = Time.realtimeSinceStartup; isBot = false; moveDirection = new Vector2(1f, -1f); changeDirectionTime = Time.realtimeSinceStartup + Random.Range(0.5f, 2f); }
public static void SetSeedColor(int id) { if (State.gameState == GameState.win || State.gameState == GameState.loss) { return; } currentPlayerColorID = (ColorID)id; UpdateSeedSelectedDisplay(); }
public void SetHoverColor(ColorID hoverColorID) { hoverColor = hoverColorID; HoverImage.GetComponent <RectTransform>().localScale = hoverColorID == ColorID.white ? Vector3.zero : Vector3.one; //if ((int)hoverColorID > hoverCenters.Length - 1 || (int)hoverColorID < 0) // Debug.LogErrorFormat("Invalid hoverCenters requested {0} for {1}", (int)hoverColorID, gameObject.name); //else // HoverImage.sprite = hoverCenters[(int)hoverColorID]; }
public static void Initialize() { currentColorID = ColorID.Null; focusID = 0; gameTime = 0f; pictureSetMovementSpeed = 10f; gameScore = 0f; playerMaxLife = 10f; playerLife = playerMaxLife; isStarted = false; wave = 0; waveTrigger = false; }
public override bool Equals(Object obj) { clsProduct vObj = obj as clsProduct; if (vObj == null) { return(false); } else { return(ProductID.Equals(vObj.ProductID) && ColorID.Equals(vObj.ColorID)); } }
public void SetColor(int rotation, ColorID seedColorID) { hexagonColor = seedColorID; if (rotation >= 0 && rotation < 7 && ColorImage != null) { ColorImage.sprite = rotation < 6 ? flowerPetals[(int)seedColorID] : flowerCenters[(int)seedColorID]; gameObject.GetComponent <RectTransform>().localEulerAngles = new Vector3(0, 0, rotation * -60f); } else { Debug.LogErrorFormat("Improper rotation requested: {0} for {1} or no ColorImage define", rotation, gameObject.name); } }
private static ColorID GetColorFromTag(byte c, ColorID colorbak = Font.ColorID.White) { ColorID color = colorbak; switch ((FF8TextTagColor)c) { case FF8TextTagColor.Blue: case FF8TextTagColor.BlueBlink: color = ColorID.Blue; break; case FF8TextTagColor.Green: case FF8TextTagColor.GreenBlink: color = ColorID.Green; break; case FF8TextTagColor.Grey: case FF8TextTagColor.GreyBlink: color = ColorID.Grey; break; case FF8TextTagColor.Purple: case FF8TextTagColor.PurpleBlink: color = ColorID.Purple; break; case FF8TextTagColor.Red: case FF8TextTagColor.RedBlink: color = ColorID.Red; break; case FF8TextTagColor.White: case FF8TextTagColor.WhiteBlink: color = colorbak; // since ending color change reverts color to white. if you have a custom color // set this will allow reverting to that. break; case FF8TextTagColor.Yellow: case FF8TextTagColor.YellowBlink: color = ColorID.Yellow; break; case FF8TextTagColor.Dark_Gray: case FF8TextTagColor.Dark_GrayBlink: color = ColorID.Dark_Gray; break; } return(color); }
public ColorID GetSavedSaberColorID() { PlayerPrefsStorage playerPrefs = new PlayerPrefsStorage(Game.ForceVision); // Default if never set. ColorID color = ColorID.BLUE; if (playerPrefs.PrefKeyExists(Constants.SaberColorPlayerPrefKey)) { color = (ColorID)playerPrefs.GetPrefInt(Constants.SaberColorPlayerPrefKey); } return(color); }
public static void EnterEditMode() { State.gameActivity = GameActivity.edit; GameObject[] hexagons = GameObject.FindGameObjectsWithTag(HexagonTag); foreach (GameObject h in hexagons) { ActorHexagon ah = h.GetComponentInChildren <ActorHexagon>(); if (ah != null) { ColorID currentGoalColor = ah.goalColor; ah.SetGoalColor(ColorID.white); ah.SetColor(0, currentGoalColor); } } }
public void PlantSeed() { if (State.gameState == GameState.win || State.gameState == GameState.loss) { return; } ColorID seedColorID = ActorGameManager.currentPlayerColorID; if (seedColorID == ColorID.white) { // erasing if (hexagonColor == ColorID.white) { return; } SetColor(6, seedColorID); if (State.gameState == GameState.play) { GameObject.FindGameObjectWithTag("AudioManager").GetComponentInChildren <ActorAudioManager>().playPlanted(); } } else { // planting if (hexagonColor != ColorID.white) { return; } SetColor(6, seedColorID); foreach (KeyValuePair <int, ActorHexagon> p in petals) { p.Value.GrowPetal(p.Key, seedColorID); } ActorGameManager.AddScore(ActorGameManager.seedsPlanted, 1); ActorGameManager.RecordSeedPlanted(hexagonID, seedColorID); ActorGameManager.CheckWinLose(); if (State.gameState == GameState.play) { GameObject.FindGameObjectWithTag("AudioManager").GetComponentInChildren <ActorAudioManager>().playPlanted(); } } return; }
public static void RecordSeedPlanted(int hexagonID, ColorID seedColorID) { if (seedsPlantedHistory.Count < State.gameBoard.seedsPlantedSolution.Count) { GameStep nextSolution = State.gameBoard.seedsPlantedSolution.ToArray()[seedsPlantedHistory.Count]; if (nextSolution.colorID != (int)seedColorID || nextSolution.hexagonID != hexagonID) { // you are no longer following the solution, hide hint ShowGroup(getHintButton, false); } } else { // you have gone past the end of the solution, hide hint ShowGroup(getHintButton, false); } seedsPlantedHistory.Enqueue(new GameStep(hexagonID, (int)seedColorID)); }
protected override void Awake() { base.Awake(); rigidBody = GetComponent <Rigidbody>(); boxCollider = GetComponent <BoxCollider>(); if (_coloredModel) { Material[] materials = _coloredModel.GetComponent <Renderer>().materials; foreach (Material mat in materials) { _colorID = mat.GetMatchingColor(); if (_colorID != ColorID.None) { break; } } } }
void Update() { if (!boardBuilt && State.gameState == GameState.boardData) { // the board data has been returned // so the board can be built now boardBuilt = true; SetBoardToTurn(State.gameBoard.seedsPlantedSolution.Count); State.gameState = GameState.play; // when starting a new board // always set the starting seed to red // and make sure the display is updated currentPlayerColorID = ColorID.red; UpdateSeedSelectedDisplay(); } flowerSelectorThrobPercent = Mathf.PingPong(Time.realtimeSinceStartup, 1f); flowerSelectorImage.color = Color.Lerp(Color.green, Color.red, flowerSelectorThrobPercent); }
private void DrawLetter(Vector2 zoom, Type whichFont, float Fade, ColorID color, bool blink, Rectangle destRect, Rectangle sourceRect) { switch (whichFont) { case Type.menuFont: case Type.sysfnt: // if you use Memory.SpriteBatchStartAlpha(SamplerState.PointClamp); you won't need // to trim last pixel. but it doesn't look good on low res fonts. //trim pixels to remove texture filtering artifacts. //sourceRect.Width -= 1; //sourceRect.Height -= 1; Memory.spriteBatch.Draw(whichFont == Type.menuFont ? menuFont : sysfnt, destRect, sourceRect, ColorID2Color[color] * Fade); if (blink) { Memory.spriteBatch.Draw(whichFont == Type.menuFont ? menuFont : sysfnt, destRect, sourceRect, ColorID2Blink[color] * Fade * Menu.Blink_Amount); } break; case Type.sysFntBig: if (!sysfntbig.Modded) { Rectangle ShadowdestRect = new Rectangle(destRect.Location, destRect.Size); ShadowdestRect.Offset(zoom); sysfntbig.Draw(ShadowdestRect, sourceRect, Color.Black * Fade * .5f); } sysfntbig.Draw(destRect, sourceRect, ColorID2Color[color] * Fade); if (blink) { sysfntbig.Draw(destRect, sourceRect, ColorID2Blink[color] * Fade * Menu.Blink_Amount); } break; } }
public void GrowPetal(int rotation, ColorID seedColorID) { // early exit if hexagon color is already this color so no points are scored if (hexagonColor == seedColorID) { return; } if (hexagonColor == ColorID.white) { SetColor(rotation, seedColorID); ActorGameManager.AddScore(ActorGameManager.petalCount, 1); } else { SetColor(0, ColorID.white); ActorGameManager.AddScore(ActorGameManager.petalCount, -1); ActorGameManager.AddScore(ActorGameManager.petalExplosions, 1); SpawnPetalExplosion(); } return; }
internal void OnColorChanged(ColorID colorID, Color value) { switch (colorID) { case ColorID.MoonInnerCorona: CurrentMix.Atmosphere.MoonInnerCorona.SetCustomValue(value); break; case ColorID.MoonOuterCorona: CurrentMix.Atmosphere.MoonOuterCorona.SetCustomValue(value); break; case ColorID.SkyTint: CurrentMix.Atmosphere.SkyTint.SetCustomValue(value); break; case ColorID.NightHorizonColor: CurrentMix.Atmosphere.NightHorizonColor.SetCustomValue(value); break; case ColorID.EarlyNightZenithColor: CurrentMix.Atmosphere.EarlyNightZenithColor.SetCustomValue(value); break; case ColorID.LateNightZenithColor: CurrentMix.Atmosphere.LateNightZenithColor.SetCustomValue(value); break; case ColorID.WaterClean: CurrentMix.Water.WaterClean.SetCustomValue(value); break; case ColorID.WaterDirty: CurrentMix.Water.WaterDirty.SetCustomValue(value); break; case ColorID.WaterUnder: CurrentMix.Water.WaterUnder.SetCustomValue(value); break; } SaveLocalMix(); }
public static void SetGlobalColor(ColorID id, Color value) { Shader.SetGlobalColor(_colorIDs[(int)id], value); }
public static int GetColorPropertyID(ColorID id) { return(_colorIDs[(int)id]); }
internal Color GetCurrentColor(ColorID colorID) { return(ThemeManager.Instance.GetCurrentColor(colorID)); }
public Rectangle RenderBasicText(FF8String buffer, Vector2 pos, Vector2 zoom, Type whichFont = 0, float Fade = 1.0f, int lineSpacing = 0, bool skipdraw = false, ColorID color_ = ColorID.White, bool blink = false) { var colorbak = color_; var color = ColorID2Color[color_]; var faded_color = ColorID2Blink[color_]; if (buffer == null) { return(new Rectangle()); } var ret = new Rectangle(pos.RoundedPoint(), new Point(0)); var destRect = Rectangle.Empty; var real = pos.RoundedPoint(); var charCountWidth = 21; var charSize = 12; //pixelhandler does the 2x scaling on the fly. var size = (new Vector2(0, charSize) * zoom).RoundedPoint(); var baksize = size; var width = 0; var skipletter = false; for (var i = 0; i < buffer.Length; i++) { size = baksize; var c = buffer[i]; if (c == 0) { continue; } else if (c == (byte)FF8TextTagCode.Dialog) { if (++i < buffer.Length - 1) { c = buffer[i]; switch ((FF8TextTagDialog)c) { // Most of these should be replaced before it gets here becuase they have // values set by other objects. case FF8TextTagDialog.CustomICON: DrawIcon(buffer, zoom, Fade, skipdraw, real, ref size, ref skipletter, ref i, ref c); break; } //if (!skipletter) SetRetRec(pos, ref ret, ref real, size); continue; } } else if (c == (byte)FF8TextTagCode.Key) { if (++i < buffer.Length - 1) { var k = (FF8TextTagKey)buffer[i]; var str = Input2.ButtonString(k); var retpos = RenderBasicText(str, real, zoom, whichFont, Fade, lineSpacing, skipdraw, ColorID.Green); size.X = retpos.Width; //size.Y = retpos.Height; //real.X += retpos.Width; //TODO add key/controller input icons/text here. //if (!skipletter) SetRetRec(pos, ref ret, ref real, size); continue; } } else if (c == (byte)FF8TextTagCode.Color) { if (++i < buffer.Length - 1) { c = buffer[i]; blink = c >= (byte)FF8TextTagColor.Dark_GrayBlink ? true : false; GetColorFromTag(c, out var nc, out var fc); color = nc ?? ColorID2Color[colorbak]; faded_color = fc ?? ColorID2Blink[colorbak]; SetRetRec(pos, ref ret, ref real, size); continue; } } else if (c == (byte)FF8TextTagCode.Line && NewLine(pos, lineSpacing, ref real, size)) { SetRetRec(pos, ref ret, ref real, size); continue; } if (!skipletter) { var deltaChar = GetDeltaChar(c); if (deltaChar >= 0 && charWidths != null && deltaChar < charWidths.Length) { width = charWidths[deltaChar]; size.X = (int)(charWidths[deltaChar] * zoom.X); } else { width = charSize; size.X = (int)(charSize * zoom.X); } var curSize = size; var verticalPosition = deltaChar / charCountWidth; //i.e. 1280 is 100%, 640 is 50% and therefore 2560 is 200% which means multiply by 0.5f or 2.0f destRect = new Rectangle(real, size); if (!skipdraw) { var sourceRect = new Rectangle((deltaChar - (verticalPosition * charCountWidth)) * charSize, verticalPosition * charSize, width, charSize); DrawLetter(whichFont, Fade, blink ? Color.Lerp(color, faded_color, Menu.Blink_Amount) : color, destRect, sourceRect); } } skipletter = false; SetRetRec(pos, ref ret, ref real, size); } ret.Height = size.Y + (real.Y - (int)pos.Y); return(ret); }
public Rectangle RenderBasicText(FF8String buffer, Point pos, Vector2 zoom, Type whichFont = 0, float Fade = 1.0f, int lineSpacing = 0, bool skipdraw = false, ColorID color = ColorID.White) => RenderBasicText(buffer, pos.ToVector2(), zoom, whichFont, Fade, lineSpacing, skipdraw, color);
public Rectangle RenderBasicText(FF8String buffer, int x, int y, float zoomWidth = 2.545455f, float zoomHeight = 3.0375f, Type whichFont = 0, float Fade = 1.0f, int lineSpacing = 0, bool skipdraw = false, ColorID color = ColorID.White) => RenderBasicText(buffer, new Vector2(x, y), new Vector2(zoomWidth, zoomHeight), whichFont, Fade, lineSpacing, skipdraw, color);
public Rectangle RenderBasicText(FF8String buffer, Vector2 pos, Vector2 zoom, Type whichFont = 0, float Fade = 1.0f, int lineSpacing = 0, bool skipdraw = false, ColorID color = ColorID.White) { if (buffer == null) { return(new Rectangle()); } Rectangle ret = new Rectangle(pos.RoundedPoint(), new Point(0)); Point real = pos.RoundedPoint(); int charCountWidth = 21; int charSize = 12; //pixelhandler does the 2x scaling on the fly. Point size = (new Vector2(0, charSize) * zoom).RoundedPoint(); int width; foreach (byte cs in buffer) { byte[] expanded = cs > 0xE1 && FF8String.BytetoStr.ContainsKey(cs)? FF8String.BytetoStr[cs].Value : new byte[] { cs }; foreach (byte c in expanded) { if (c == 0) { continue; } int deltaChar = (c - 32); if (deltaChar >= 0 && deltaChar < charWidths.Length) { width = charWidths[deltaChar]; size.X = (int)(charWidths[deltaChar] * zoom.X); } else { width = charSize; size.X = (int)(charSize * zoom.X); } Point curSize = size; int verticalPosition = deltaChar / charCountWidth; //i.e. 1280 is 100%, 640 is 50% and therefore 2560 is 200% which means multiply by 0.5f or 2.0f if (c == 0x02)// \n { real.X = (int)pos.X; real.Y += size.Y + lineSpacing; continue; } Rectangle destRect = new Rectangle(real, size); // if you use Memory.SpriteBatchStartAlpha(SamplerState.PointClamp); you won't need // to trim last pixel. but it doesn't look good on low res fonts. if (!skipdraw) { Rectangle sourceRect = new Rectangle((deltaChar - (verticalPosition * charCountWidth)) * charSize, verticalPosition * charSize, width, charSize); switch (whichFont) { case Type.menuFont: case Type.sysfnt: //trim pixels to remove texture filtering artifacts. sourceRect.Width -= 1; sourceRect.Height -= 1; Memory.spriteBatch.Draw(whichFont == Type.menuFont ? menuFont : sysfnt, destRect, sourceRect, ColorID2Color[color] * Fade); break; case Type.sysFntBig: if (!sysfntbig.Modded) { Rectangle ShadowdestRect = new Rectangle(destRect.Location, destRect.Size); ShadowdestRect.Offset(zoom); sysfntbig.Draw(ShadowdestRect, sourceRect, Color.Black * Fade * .5f); } sysfntbig.Draw(destRect, sourceRect, ColorID2Color[color] * Fade); break; } } real.X += size.X; int curWidth = real.X - (int)pos.X; if (curWidth > ret.Width) { ret.Width = curWidth; } } } ret.Height = size.Y + (real.Y - (int)pos.Y); return(ret); }