public PointV8(double x, double y, Rainbow rainbow) => (X, Y, Rainbow) = (x, y, rainbow);
private void RainbowTimer_Tick(object sender, EventArgs e) { Rainbow.RainbowEffect(); this.pnlRainbowTop.BackColor = Color.FromArgb(Rainbow.A, Rainbow.R, Rainbow.G); this.PnlRainbowDown.BackColor = Color.FromArgb(Rainbow.A, Rainbow.R, Rainbow.G); }
static void Main(string[] args) { string cmd; string temp; bool cmdMode = args.Length > 0; bool hasArgs = args.Length > 1; read_next: try { if (cmdMode) { cmd = args[0].Trim(); } else { Rainbow.WriteColor(ConsoleColor.Yellow, "-> "); cmd = Console.ReadLine().Trim(); } switch (cmd) { case "-v": case "--version": PrintAppVersion(); break; case "base64": HandleBase64Conversion(args); break; case "today": if (cmdMode && hasArgs && !String.IsNullOrEmpty(args[1])) { temp = DateTime.Now.ToString(args[1]); } else { temp = DateTime.Now.ToLongDateString(); } Console.WriteLine(temp); break; case "uptime": HandleSystemUptimeInquiry(); break; case "shutdown": // Especially for timed shutdown operation. if (cmdMode && hasArgs) { HandleTimedShutdown(args); } break; case "translate-color": if (cmdMode && hasArgs && !String.IsNullOrEmpty(args[1])) { Console.WriteLine(GenerateRGBA(args[1])); } break; case "": Console.WriteLine(); break; default: Warn("invalid command: " + cmd); break; } if (!cmdMode) { if (cmd != "clear" && cmd != "cls") { Console.WriteLine(); } goto read_next; } } catch (Exception ex) { if (cmdMode) { Warn(ex.Message); ExitConsole(ERROR_INVALID_FUNCTION); } } }
private static void Warn(string message) { Rainbow.WriteLineColor(ConsoleColor.Red, $"ERROR: {message}"); }
public EnemyData(GameObject enemy) { // Try to pull a PrefabKey script off the enemy (it should have one) PrefabKey prefabKeyScriptRef = enemy.GetComponent <PrefabKey>(); if (prefabKeyScriptRef != null) { _prefKey = prefabKeyScriptRef.GetPrefabKey(); } else { Debug.LogError("No PrefabKey script was attached to " + enemy.name); } // Try to pull an EnemyStats script off the enemy (it should have one) EnemyStats enemyStatsScriptRef = enemy.GetComponent <EnemyStats>(); if (enemyStatsScriptRef != null) { _strength = enemyStatsScriptRef.GetStrength(); _magic = enemyStatsScriptRef.GetMagic(); _speed = enemyStatsScriptRef.GetSpeed(); _vitality = enemyStatsScriptRef.GetVitality(); _baseXpToGive = enemyStatsScriptRef.GetBaseXpToGive(); _difficulty = enemyStatsScriptRef.GetDifficulty(); } else { Debug.LogError("No EnemyStats script was attached to " + enemy.name); } // Try to pull an EnemyHealth script off the enemy (it should have one) EnemyHealth enemyHealthScriptRef = enemy.GetComponent <EnemyHealth>(); if (enemyHealthScriptRef != null) { _curHP = enemyHealthScriptRef.CurHP; _maxHP = enemyHealthScriptRef.MaxHP; } else { Debug.LogError("No EnemyHealth script was attached to " + enemy.name); } // Try to pull a Rainbow script off the enemy (does not necessarily have one) Rainbow rainbowScriptRef = enemy.GetComponent <Rainbow>(); if (rainbowScriptRef != null) { _isRainbow = true; } else { _isRainbow = false; } // Position off transform _position = new float[3]; _position[0] = enemy.transform.position.x; _position[1] = enemy.transform.position.y; _position[2] = enemy.transform.position.z; }
//static Func<Rainbow, List<int>> isRed = colorBand => //{ // Console.WriteLine("oh,this is red color!"); // return new List<int> { 0xFF, 0x00, 0x00 }; //}; public static List <int> FromRainbow(Rainbow colorBand) => colorBand switch {
public static string FromRainbow(Rainbow colorBand) => colorBand switch {
public static RGBColor FromRainbow(Rainbow colorBand) => colorBand switch {
public static int FromRainbow(Rainbow colorBand) => colorBand switch {
internal static RGBColor TasteTheRainbow(Rainbow rainbowColor) => rainbowColor switch {
public static RGBColor FromRainbow(Rainbow colorBand) => // switch expression colorBand switch {
private void rgb_Tick(object sender, EventArgs e) { Rainbow.change_color(upperRgb); }
protected override void OnPaint(PaintEventArgs e) { _g.Clear(_backgroundColor); if (_region == null) { return; } int x1, y1, x2, y2; Brush brush = null; int count; int width = _bitmap.Width; int height = _bitmap.Height; int colSize = Math.Max(Math.Min(width / _region.Width, height / _region.Height) - 1, 2); StatInfo stat = _region.GetStatInfo(_propertyShowed); double val; foreach (HTMColumn col in _region.Columns) { x1 = (int)(col.X * (width - colSize - 1)); x2 = (int)(col.X * (width - colSize - 1) + colSize); y1 = (int)(col.Y * (height - colSize - 1)); y2 = (int)(col.Y * (height - colSize - 1) + colSize); switch (_propertyShowed) { case HTMRegionViewerPropertyShowed.ColumnActivation: if (col.IsActive) { brush = _activeColumnBrush; } else { brush = _inactiveColumnBrush; } break; case HTMRegionViewerPropertyShowed.ColumnPermanence: if (stat.Max == stat.Min) { val = 0; } else { val = (col.GetAveragePermanence() - stat.Min) / (stat.Max - stat.Min); } brush = new SolidBrush(Rainbow.GetRainbow(val)); break; case HTMRegionViewerPropertyShowed.ColumnOverlap: if (stat.Max == stat.Min) { val = 0; } else { val = (col.Overlap - stat.Min) / (stat.Max - stat.Min); } brush = new SolidBrush(Rainbow.GetRainbow(val)); break; case HTMRegionViewerPropertyShowed.ColumnBoost: if (stat.Max == stat.Min) { val = 0; } else { val = (col.Boost - stat.Min) / (stat.Max - stat.Min); } brush = new SolidBrush(Rainbow.GetRainbow(val)); break; case HTMRegionViewerPropertyShowed.DistalSegmentsCount: if (stat.Max == stat.Min) { val = 0; } else { count = 0; foreach (HTMCell cls in col.Cells) { count += cls.DistalSegments.Count; } val = (count - stat.Min) / (stat.Max - stat.Min); } brush = new SolidBrush(Rainbow.GetRainbow(val)); break; default: throw new Exception(); } _g.FillRectangle(brush, x1, y1, x2 - x1, y2 - y1); _g.DrawRectangle(new Pen(Color.Black), x1, y1, x2 - x1, y2 - y1); } _g1.DrawImageUnscaled(_bitmap, 0, statLabel.Height + statLabel.Top); }
public static RGBColor SwitchExpression(Rainbow colorBand) => colorBand switch {
private void rgbTimer_Tick(object sender, EventArgs e) { Rainbow.change_color(bgPanel); }